/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/assets/build";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 713);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */,
/* 1 */,
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _exportNames = {
react: true,
assertNode: true,
createTypeAnnotationBasedOnTypeof: true,
createUnionTypeAnnotation: true,
createFlowUnionType: true,
createTSUnionType: true,
cloneNode: true,
clone: true,
cloneDeep: true,
cloneDeepWithoutLoc: true,
cloneWithoutLoc: true,
addComment: true,
addComments: true,
inheritInnerComments: true,
inheritLeadingComments: true,
inheritsComments: true,
inheritTrailingComments: true,
removeComments: true,
ensureBlock: true,
toBindingIdentifierName: true,
toBlock: true,
toComputedKey: true,
toExpression: true,
toIdentifier: true,
toKeyAlias: true,
toSequenceExpression: true,
toStatement: true,
valueToNode: true,
appendToMemberExpression: true,
inherits: true,
prependToMemberExpression: true,
removeProperties: true,
removePropertiesDeep: true,
removeTypeDuplicates: true,
getBindingIdentifiers: true,
getOuterBindingIdentifiers: true,
traverse: true,
traverseFast: true,
shallowEqual: true,
is: true,
isBinding: true,
isBlockScoped: true,
isImmutable: true,
isLet: true,
isNode: true,
isNodesEquivalent: true,
isPlaceholderType: true,
isReferenced: true,
isScope: true,
isSpecifierDefault: true,
isType: true,
isValidES3Identifier: true,
isValidIdentifier: true,
isVar: true,
matchesPattern: true,
validate: true,
buildMatchMemberExpression: true
};
Object.defineProperty(exports, "assertNode", {
enumerable: true,
get: function () {
return _assertNode.default;
}
});
Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", {
enumerable: true,
get: function () {
return _createTypeAnnotationBasedOnTypeof.default;
}
});
Object.defineProperty(exports, "createUnionTypeAnnotation", {
enumerable: true,
get: function () {
return _createFlowUnionType.default;
}
});
Object.defineProperty(exports, "createFlowUnionType", {
enumerable: true,
get: function () {
return _createFlowUnionType.default;
}
});
Object.defineProperty(exports, "createTSUnionType", {
enumerable: true,
get: function () {
return _createTSUnionType.default;
}
});
Object.defineProperty(exports, "cloneNode", {
enumerable: true,
get: function () {
return _cloneNode.default;
}
});
Object.defineProperty(exports, "clone", {
enumerable: true,
get: function () {
return _clone.default;
}
});
Object.defineProperty(exports, "cloneDeep", {
enumerable: true,
get: function () {
return _cloneDeep.default;
}
});
Object.defineProperty(exports, "cloneDeepWithoutLoc", {
enumerable: true,
get: function () {
return _cloneDeepWithoutLoc.default;
}
});
Object.defineProperty(exports, "cloneWithoutLoc", {
enumerable: true,
get: function () {
return _cloneWithoutLoc.default;
}
});
Object.defineProperty(exports, "addComment", {
enumerable: true,
get: function () {
return _addComment.default;
}
});
Object.defineProperty(exports, "addComments", {
enumerable: true,
get: function () {
return _addComments.default;
}
});
Object.defineProperty(exports, "inheritInnerComments", {
enumerable: true,
get: function () {
return _inheritInnerComments.default;
}
});
Object.defineProperty(exports, "inheritLeadingComments", {
enumerable: true,
get: function () {
return _inheritLeadingComments.default;
}
});
Object.defineProperty(exports, "inheritsComments", {
enumerable: true,
get: function () {
return _inheritsComments.default;
}
});
Object.defineProperty(exports, "inheritTrailingComments", {
enumerable: true,
get: function () {
return _inheritTrailingComments.default;
}
});
Object.defineProperty(exports, "removeComments", {
enumerable: true,
get: function () {
return _removeComments.default;
}
});
Object.defineProperty(exports, "ensureBlock", {
enumerable: true,
get: function () {
return _ensureBlock.default;
}
});
Object.defineProperty(exports, "toBindingIdentifierName", {
enumerable: true,
get: function () {
return _toBindingIdentifierName.default;
}
});
Object.defineProperty(exports, "toBlock", {
enumerable: true,
get: function () {
return _toBlock.default;
}
});
Object.defineProperty(exports, "toComputedKey", {
enumerable: true,
get: function () {
return _toComputedKey.default;
}
});
Object.defineProperty(exports, "toExpression", {
enumerable: true,
get: function () {
return _toExpression.default;
}
});
Object.defineProperty(exports, "toIdentifier", {
enumerable: true,
get: function () {
return _toIdentifier.default;
}
});
Object.defineProperty(exports, "toKeyAlias", {
enumerable: true,
get: function () {
return _toKeyAlias.default;
}
});
Object.defineProperty(exports, "toSequenceExpression", {
enumerable: true,
get: function () {
return _toSequenceExpression.default;
}
});
Object.defineProperty(exports, "toStatement", {
enumerable: true,
get: function () {
return _toStatement.default;
}
});
Object.defineProperty(exports, "valueToNode", {
enumerable: true,
get: function () {
return _valueToNode.default;
}
});
Object.defineProperty(exports, "appendToMemberExpression", {
enumerable: true,
get: function () {
return _appendToMemberExpression.default;
}
});
Object.defineProperty(exports, "inherits", {
enumerable: true,
get: function () {
return _inherits.default;
}
});
Object.defineProperty(exports, "prependToMemberExpression", {
enumerable: true,
get: function () {
return _prependToMemberExpression.default;
}
});
Object.defineProperty(exports, "removeProperties", {
enumerable: true,
get: function () {
return _removeProperties.default;
}
});
Object.defineProperty(exports, "removePropertiesDeep", {
enumerable: true,
get: function () {
return _removePropertiesDeep.default;
}
});
Object.defineProperty(exports, "removeTypeDuplicates", {
enumerable: true,
get: function () {
return _removeTypeDuplicates.default;
}
});
Object.defineProperty(exports, "getBindingIdentifiers", {
enumerable: true,
get: function () {
return _getBindingIdentifiers.default;
}
});
Object.defineProperty(exports, "getOuterBindingIdentifiers", {
enumerable: true,
get: function () {
return _getOuterBindingIdentifiers.default;
}
});
Object.defineProperty(exports, "traverse", {
enumerable: true,
get: function () {
return _traverse.default;
}
});
Object.defineProperty(exports, "traverseFast", {
enumerable: true,
get: function () {
return _traverseFast.default;
}
});
Object.defineProperty(exports, "shallowEqual", {
enumerable: true,
get: function () {
return _shallowEqual.default;
}
});
Object.defineProperty(exports, "is", {
enumerable: true,
get: function () {
return _is.default;
}
});
Object.defineProperty(exports, "isBinding", {
enumerable: true,
get: function () {
return _isBinding.default;
}
});
Object.defineProperty(exports, "isBlockScoped", {
enumerable: true,
get: function () {
return _isBlockScoped.default;
}
});
Object.defineProperty(exports, "isImmutable", {
enumerable: true,
get: function () {
return _isImmutable.default;
}
});
Object.defineProperty(exports, "isLet", {
enumerable: true,
get: function () {
return _isLet.default;
}
});
Object.defineProperty(exports, "isNode", {
enumerable: true,
get: function () {
return _isNode.default;
}
});
Object.defineProperty(exports, "isNodesEquivalent", {
enumerable: true,
get: function () {
return _isNodesEquivalent.default;
}
});
Object.defineProperty(exports, "isPlaceholderType", {
enumerable: true,
get: function () {
return _isPlaceholderType.default;
}
});
Object.defineProperty(exports, "isReferenced", {
enumerable: true,
get: function () {
return _isReferenced.default;
}
});
Object.defineProperty(exports, "isScope", {
enumerable: true,
get: function () {
return _isScope.default;
}
});
Object.defineProperty(exports, "isSpecifierDefault", {
enumerable: true,
get: function () {
return _isSpecifierDefault.default;
}
});
Object.defineProperty(exports, "isType", {
enumerable: true,
get: function () {
return _isType.default;
}
});
Object.defineProperty(exports, "isValidES3Identifier", {
enumerable: true,
get: function () {
return _isValidES3Identifier.default;
}
});
Object.defineProperty(exports, "isValidIdentifier", {
enumerable: true,
get: function () {
return _isValidIdentifier.default;
}
});
Object.defineProperty(exports, "isVar", {
enumerable: true,
get: function () {
return _isVar.default;
}
});
Object.defineProperty(exports, "matchesPattern", {
enumerable: true,
get: function () {
return _matchesPattern.default;
}
});
Object.defineProperty(exports, "validate", {
enumerable: true,
get: function () {
return _validate.default;
}
});
Object.defineProperty(exports, "buildMatchMemberExpression", {
enumerable: true,
get: function () {
return _buildMatchMemberExpression.default;
}
});
exports.react = void 0;
var _isReactComponent = _interopRequireDefault(__webpack_require__(715));
var _isCompatTag = _interopRequireDefault(__webpack_require__(716));
var _buildChildren = _interopRequireDefault(__webpack_require__(717));
var _assertNode = _interopRequireDefault(__webpack_require__(788));
var _generated = __webpack_require__(789);
Object.keys(_generated).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated[key];
}
});
});
var _createTypeAnnotationBasedOnTypeof = _interopRequireDefault(__webpack_require__(790));
var _createFlowUnionType = _interopRequireDefault(__webpack_require__(791));
var _createTSUnionType = _interopRequireDefault(__webpack_require__(792));
var _generated2 = __webpack_require__(561);
Object.keys(_generated2).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated2[key];
}
});
});
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
var _clone = _interopRequireDefault(__webpack_require__(794));
var _cloneDeep = _interopRequireDefault(__webpack_require__(795));
var _cloneDeepWithoutLoc = _interopRequireDefault(__webpack_require__(796));
var _cloneWithoutLoc = _interopRequireDefault(__webpack_require__(797));
var _addComment = _interopRequireDefault(__webpack_require__(798));
var _addComments = _interopRequireDefault(__webpack_require__(671));
var _inheritInnerComments = _interopRequireDefault(__webpack_require__(672));
var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(675));
var _inheritsComments = _interopRequireDefault(__webpack_require__(676));
var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(677));
var _removeComments = _interopRequireDefault(__webpack_require__(810));
var _generated3 = __webpack_require__(811);
Object.keys(_generated3).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated3[key];
}
});
});
var _constants = __webpack_require__(575);
Object.keys(_constants).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _constants[key];
}
});
});
var _ensureBlock = _interopRequireDefault(__webpack_require__(812));
var _toBindingIdentifierName = _interopRequireDefault(__webpack_require__(813));
var _toBlock = _interopRequireDefault(__webpack_require__(678));
var _toComputedKey = _interopRequireDefault(__webpack_require__(814));
var _toExpression = _interopRequireDefault(__webpack_require__(815));
var _toIdentifier = _interopRequireDefault(__webpack_require__(679));
var _toKeyAlias = _interopRequireDefault(__webpack_require__(816));
var _toSequenceExpression = _interopRequireDefault(__webpack_require__(817));
var _toStatement = _interopRequireDefault(__webpack_require__(819));
var _valueToNode = _interopRequireDefault(__webpack_require__(820));
var _definitions = __webpack_require__(564);
Object.keys(_definitions).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _definitions[key];
}
});
});
var _appendToMemberExpression = _interopRequireDefault(__webpack_require__(824));
var _inherits = _interopRequireDefault(__webpack_require__(825));
var _prependToMemberExpression = _interopRequireDefault(__webpack_require__(826));
var _removeProperties = _interopRequireDefault(__webpack_require__(682));
var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(680));
var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(670));
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(601));
var _getOuterBindingIdentifiers = _interopRequireDefault(__webpack_require__(827));
var _traverse = _interopRequireDefault(__webpack_require__(828));
var _traverseFast = _interopRequireDefault(__webpack_require__(681));
var _shallowEqual = _interopRequireDefault(__webpack_require__(612));
var _is = _interopRequireDefault(__webpack_require__(579));
var _isBinding = _interopRequireDefault(__webpack_require__(829));
var _isBlockScoped = _interopRequireDefault(__webpack_require__(830));
var _isImmutable = _interopRequireDefault(__webpack_require__(831));
var _isLet = _interopRequireDefault(__webpack_require__(683));
var _isNode = _interopRequireDefault(__webpack_require__(669));
var _isNodesEquivalent = _interopRequireDefault(__webpack_require__(832));
var _isPlaceholderType = _interopRequireDefault(__webpack_require__(666));
var _isReferenced = _interopRequireDefault(__webpack_require__(833));
var _isScope = _interopRequireDefault(__webpack_require__(834));
var _isSpecifierDefault = _interopRequireDefault(__webpack_require__(835));
var _isType = _interopRequireDefault(__webpack_require__(626));
var _isValidES3Identifier = _interopRequireDefault(__webpack_require__(836));
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(580));
var _isVar = _interopRequireDefault(__webpack_require__(837));
var _matchesPattern = _interopRequireDefault(__webpack_require__(650));
var _validate = _interopRequireDefault(__webpack_require__(627));
var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(649));
var _generated4 = __webpack_require__(559);
Object.keys(_generated4).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated4[key];
}
});
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const react = {
isReactComponent: _isReactComponent.default,
isCompatTag: _isCompatTag.default,
buildChildren: _buildChildren.default
};
exports.react = react;
/***/ }),
/* 3 */,
/* 4 */,
/* 5 */,
/* 6 */,
/* 7 */,
/* 8 */,
/* 9 */,
/* 10 */,
/* 11 */,
/* 12 */,
/* 13 */,
/* 14 */,
/* 15 */,
/* 16 */,
/* 17 */,
/* 18 */,
/* 19 */,
/* 20 */,
/* 21 */,
/* 22 */,
/* 23 */,
/* 24 */,
/* 25 */,
/* 26 */,
/* 27 */,
/* 28 */,
/* 29 */,
/* 30 */,
/* 31 */,
/* 32 */,
/* 33 */,
/* 34 */,
/* 35 */,
/* 36 */,
/* 37 */,
/* 38 */,
/* 39 */,
/* 40 */,
/* 41 */,
/* 42 */,
/* 43 */,
/* 44 */,
/* 45 */,
/* 46 */,
/* 47 */,
/* 48 */,
/* 49 */,
/* 50 */,
/* 51 */,
/* 52 */,
/* 53 */,
/* 54 */,
/* 55 */,
/* 56 */,
/* 57 */,
/* 58 */,
/* 59 */,
/* 60 */,
/* 61 */,
/* 62 */,
/* 63 */,
/* 64 */,
/* 65 */,
/* 66 */,
/* 67 */,
/* 68 */,
/* 69 */,
/* 70 */,
/* 71 */,
/* 72 */,
/* 73 */,
/* 74 */,
/* 75 */,
/* 76 */,
/* 77 */,
/* 78 */,
/* 79 */,
/* 80 */,
/* 81 */,
/* 82 */,
/* 83 */,
/* 84 */,
/* 85 */,
/* 86 */,
/* 87 */,
/* 88 */,
/* 89 */,
/* 90 */,
/* 91 */,
/* 92 */,
/* 93 */,
/* 94 */,
/* 95 */,
/* 96 */,
/* 97 */,
/* 98 */,
/* 99 */,
/* 100 */,
/* 101 */,
/* 102 */,
/* 103 */,
/* 104 */,
/* 105 */,
/* 106 */,
/* 107 */,
/* 108 */,
/* 109 */,
/* 110 */,
/* 111 */,
/* 112 */,
/* 113 */,
/* 114 */,
/* 115 */,
/* 116 */,
/* 117 */,
/* 118 */,
/* 119 */,
/* 120 */,
/* 121 */,
/* 122 */,
/* 123 */,
/* 124 */,
/* 125 */,
/* 126 */,
/* 127 */,
/* 128 */,
/* 129 */,
/* 130 */,
/* 131 */,
/* 132 */,
/* 133 */,
/* 134 */,
/* 135 */,
/* 136 */,
/* 137 */,
/* 138 */,
/* 139 */,
/* 140 */,
/* 141 */,
/* 142 */,
/* 143 */,
/* 144 */,
/* 145 */,
/* 146 */,
/* 147 */,
/* 148 */,
/* 149 */,
/* 150 */,
/* 151 */,
/* 152 */,
/* 153 */,
/* 154 */,
/* 155 */,
/* 156 */,
/* 157 */,
/* 158 */,
/* 159 */,
/* 160 */,
/* 161 */,
/* 162 */,
/* 163 */,
/* 164 */,
/* 165 */,
/* 166 */,
/* 167 */,
/* 168 */,
/* 169 */,
/* 170 */,
/* 171 */,
/* 172 */,
/* 173 */,
/* 174 */,
/* 175 */,
/* 176 */,
/* 177 */,
/* 178 */,
/* 179 */,
/* 180 */,
/* 181 */,
/* 182 */,
/* 183 */,
/* 184 */,
/* 185 */,
/* 186 */,
/* 187 */,
/* 188 */,
/* 189 */,
/* 190 */,
/* 191 */,
/* 192 */,
/* 193 */,
/* 194 */,
/* 195 */,
/* 196 */,
/* 197 */,
/* 198 */,
/* 199 */,
/* 200 */,
/* 201 */,
/* 202 */,
/* 203 */,
/* 204 */,
/* 205 */,
/* 206 */,
/* 207 */,
/* 208 */,
/* 209 */,
/* 210 */,
/* 211 */,
/* 212 */,
/* 213 */,
/* 214 */,
/* 215 */,
/* 216 */,
/* 217 */,
/* 218 */,
/* 219 */,
/* 220 */,
/* 221 */,
/* 222 */,
/* 223 */,
/* 224 */,
/* 225 */,
/* 226 */,
/* 227 */,
/* 228 */,
/* 229 */,
/* 230 */,
/* 231 */,
/* 232 */,
/* 233 */,
/* 234 */,
/* 235 */,
/* 236 */,
/* 237 */,
/* 238 */,
/* 239 */,
/* 240 */,
/* 241 */,
/* 242 */,
/* 243 */,
/* 244 */,
/* 245 */,
/* 246 */,
/* 247 */,
/* 248 */,
/* 249 */,
/* 250 */,
/* 251 */,
/* 252 */,
/* 253 */,
/* 254 */,
/* 255 */,
/* 256 */,
/* 257 */,
/* 258 */,
/* 259 */,
/* 260 */,
/* 261 */,
/* 262 */,
/* 263 */,
/* 264 */,
/* 265 */,
/* 266 */,
/* 267 */,
/* 268 */,
/* 269 */,
/* 270 */,
/* 271 */,
/* 272 */,
/* 273 */,
/* 274 */,
/* 275 */,
/* 276 */,
/* 277 */,
/* 278 */,
/* 279 */,
/* 280 */,
/* 281 */,
/* 282 */,
/* 283 */,
/* 284 */,
/* 285 */,
/* 286 */,
/* 287 */,
/* 288 */,
/* 289 */,
/* 290 */,
/* 291 */,
/* 292 */,
/* 293 */,
/* 294 */,
/* 295 */,
/* 296 */,
/* 297 */,
/* 298 */,
/* 299 */,
/* 300 */,
/* 301 */,
/* 302 */,
/* 303 */,
/* 304 */,
/* 305 */,
/* 306 */,
/* 307 */,
/* 308 */,
/* 309 */,
/* 310 */,
/* 311 */,
/* 312 */,
/* 313 */,
/* 314 */,
/* 315 */,
/* 316 */,
/* 317 */,
/* 318 */,
/* 319 */,
/* 320 */,
/* 321 */,
/* 322 */,
/* 323 */,
/* 324 */,
/* 325 */,
/* 326 */,
/* 327 */,
/* 328 */,
/* 329 */,
/* 330 */,
/* 331 */,
/* 332 */,
/* 333 */,
/* 334 */,
/* 335 */,
/* 336 */,
/* 337 */,
/* 338 */,
/* 339 */,
/* 340 */,
/* 341 */,
/* 342 */,
/* 343 */,
/* 344 */,
/* 345 */,
/* 346 */,
/* 347 */,
/* 348 */,
/* 349 */,
/* 350 */,
/* 351 */,
/* 352 */,
/* 353 */,
/* 354 */,
/* 355 */,
/* 356 */,
/* 357 */,
/* 358 */,
/* 359 */,
/* 360 */,
/* 361 */,
/* 362 */,
/* 363 */,
/* 364 */,
/* 365 */,
/* 366 */,
/* 367 */,
/* 368 */,
/* 369 */,
/* 370 */,
/* 371 */,
/* 372 */,
/* 373 */,
/* 374 */,
/* 375 */,
/* 376 */,
/* 377 */,
/* 378 */,
/* 379 */,
/* 380 */,
/* 381 */,
/* 382 */,
/* 383 */,
/* 384 */,
/* 385 */,
/* 386 */,
/* 387 */,
/* 388 */,
/* 389 */,
/* 390 */,
/* 391 */,
/* 392 */,
/* 393 */,
/* 394 */,
/* 395 */,
/* 396 */,
/* 397 */,
/* 398 */,
/* 399 */,
/* 400 */,
/* 401 */,
/* 402 */,
/* 403 */,
/* 404 */,
/* 405 */,
/* 406 */,
/* 407 */,
/* 408 */,
/* 409 */,
/* 410 */,
/* 411 */,
/* 412 */,
/* 413 */,
/* 414 */,
/* 415 */,
/* 416 */,
/* 417 */,
/* 418 */,
/* 419 */,
/* 420 */,
/* 421 */,
/* 422 */,
/* 423 */,
/* 424 */,
/* 425 */,
/* 426 */,
/* 427 */,
/* 428 */,
/* 429 */,
/* 430 */,
/* 431 */,
/* 432 */,
/* 433 */,
/* 434 */,
/* 435 */,
/* 436 */,
/* 437 */,
/* 438 */,
/* 439 */,
/* 440 */,
/* 441 */,
/* 442 */,
/* 443 */,
/* 444 */,
/* 445 */,
/* 446 */,
/* 447 */,
/* 448 */,
/* 449 */,
/* 450 */,
/* 451 */,
/* 452 */,
/* 453 */,
/* 454 */,
/* 455 */,
/* 456 */,
/* 457 */,
/* 458 */,
/* 459 */,
/* 460 */,
/* 461 */,
/* 462 */,
/* 463 */,
/* 464 */,
/* 465 */,
/* 466 */,
/* 467 */,
/* 468 */,
/* 469 */,
/* 470 */,
/* 471 */,
/* 472 */,
/* 473 */,
/* 474 */,
/* 475 */,
/* 476 */,
/* 477 */,
/* 478 */,
/* 479 */,
/* 480 */,
/* 481 */,
/* 482 */,
/* 483 */,
/* 484 */,
/* 485 */,
/* 486 */,
/* 487 */,
/* 488 */,
/* 489 */,
/* 490 */,
/* 491 */,
/* 492 */,
/* 493 */,
/* 494 */,
/* 495 */,
/* 496 */,
/* 497 */,
/* 498 */,
/* 499 */,
/* 500 */,
/* 501 */,
/* 502 */,
/* 503 */,
/* 504 */,
/* 505 */,
/* 506 */,
/* 507 */,
/* 508 */,
/* 509 */,
/* 510 */,
/* 511 */,
/* 512 */,
/* 513 */,
/* 514 */,
/* 515 */,
/* 516 */,
/* 517 */,
/* 518 */,
/* 519 */,
/* 520 */,
/* 521 */,
/* 522 */,
/* 523 */,
/* 524 */,
/* 525 */,
/* 526 */,
/* 527 */,
/* 528 */,
/* 529 */,
/* 530 */,
/* 531 */,
/* 532 */,
/* 533 */,
/* 534 */,
/* 535 */,
/* 536 */,
/* 537 */,
/* 538 */,
/* 539 */,
/* 540 */,
/* 541 */,
/* 542 */,
/* 543 */,
/* 544 */,
/* 545 */,
/* 546 */,
/* 547 */,
/* 548 */,
/* 549 */,
/* 550 */,
/* 551 */,
/* 552 */,
/* 553 */,
/* 554 */,
/* 555 */,
/* 556 */,
/* 557 */,
/* 558 */,
/* 559 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isArrayExpression = isArrayExpression;
exports.isAssignmentExpression = isAssignmentExpression;
exports.isBinaryExpression = isBinaryExpression;
exports.isInterpreterDirective = isInterpreterDirective;
exports.isDirective = isDirective;
exports.isDirectiveLiteral = isDirectiveLiteral;
exports.isBlockStatement = isBlockStatement;
exports.isBreakStatement = isBreakStatement;
exports.isCallExpression = isCallExpression;
exports.isCatchClause = isCatchClause;
exports.isConditionalExpression = isConditionalExpression;
exports.isContinueStatement = isContinueStatement;
exports.isDebuggerStatement = isDebuggerStatement;
exports.isDoWhileStatement = isDoWhileStatement;
exports.isEmptyStatement = isEmptyStatement;
exports.isExpressionStatement = isExpressionStatement;
exports.isFile = isFile;
exports.isForInStatement = isForInStatement;
exports.isForStatement = isForStatement;
exports.isFunctionDeclaration = isFunctionDeclaration;
exports.isFunctionExpression = isFunctionExpression;
exports.isIdentifier = isIdentifier;
exports.isIfStatement = isIfStatement;
exports.isLabeledStatement = isLabeledStatement;
exports.isStringLiteral = isStringLiteral;
exports.isNumericLiteral = isNumericLiteral;
exports.isNullLiteral = isNullLiteral;
exports.isBooleanLiteral = isBooleanLiteral;
exports.isRegExpLiteral = isRegExpLiteral;
exports.isLogicalExpression = isLogicalExpression;
exports.isMemberExpression = isMemberExpression;
exports.isNewExpression = isNewExpression;
exports.isProgram = isProgram;
exports.isObjectExpression = isObjectExpression;
exports.isObjectMethod = isObjectMethod;
exports.isObjectProperty = isObjectProperty;
exports.isRestElement = isRestElement;
exports.isReturnStatement = isReturnStatement;
exports.isSequenceExpression = isSequenceExpression;
exports.isParenthesizedExpression = isParenthesizedExpression;
exports.isSwitchCase = isSwitchCase;
exports.isSwitchStatement = isSwitchStatement;
exports.isThisExpression = isThisExpression;
exports.isThrowStatement = isThrowStatement;
exports.isTryStatement = isTryStatement;
exports.isUnaryExpression = isUnaryExpression;
exports.isUpdateExpression = isUpdateExpression;
exports.isVariableDeclaration = isVariableDeclaration;
exports.isVariableDeclarator = isVariableDeclarator;
exports.isWhileStatement = isWhileStatement;
exports.isWithStatement = isWithStatement;
exports.isAssignmentPattern = isAssignmentPattern;
exports.isArrayPattern = isArrayPattern;
exports.isArrowFunctionExpression = isArrowFunctionExpression;
exports.isClassBody = isClassBody;
exports.isClassExpression = isClassExpression;
exports.isClassDeclaration = isClassDeclaration;
exports.isExportAllDeclaration = isExportAllDeclaration;
exports.isExportDefaultDeclaration = isExportDefaultDeclaration;
exports.isExportNamedDeclaration = isExportNamedDeclaration;
exports.isExportSpecifier = isExportSpecifier;
exports.isForOfStatement = isForOfStatement;
exports.isImportDeclaration = isImportDeclaration;
exports.isImportDefaultSpecifier = isImportDefaultSpecifier;
exports.isImportNamespaceSpecifier = isImportNamespaceSpecifier;
exports.isImportSpecifier = isImportSpecifier;
exports.isMetaProperty = isMetaProperty;
exports.isClassMethod = isClassMethod;
exports.isObjectPattern = isObjectPattern;
exports.isSpreadElement = isSpreadElement;
exports.isSuper = isSuper;
exports.isTaggedTemplateExpression = isTaggedTemplateExpression;
exports.isTemplateElement = isTemplateElement;
exports.isTemplateLiteral = isTemplateLiteral;
exports.isYieldExpression = isYieldExpression;
exports.isAnyTypeAnnotation = isAnyTypeAnnotation;
exports.isArrayTypeAnnotation = isArrayTypeAnnotation;
exports.isBooleanTypeAnnotation = isBooleanTypeAnnotation;
exports.isBooleanLiteralTypeAnnotation = isBooleanLiteralTypeAnnotation;
exports.isNullLiteralTypeAnnotation = isNullLiteralTypeAnnotation;
exports.isClassImplements = isClassImplements;
exports.isDeclareClass = isDeclareClass;
exports.isDeclareFunction = isDeclareFunction;
exports.isDeclareInterface = isDeclareInterface;
exports.isDeclareModule = isDeclareModule;
exports.isDeclareModuleExports = isDeclareModuleExports;
exports.isDeclareTypeAlias = isDeclareTypeAlias;
exports.isDeclareOpaqueType = isDeclareOpaqueType;
exports.isDeclareVariable = isDeclareVariable;
exports.isDeclareExportDeclaration = isDeclareExportDeclaration;
exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration;
exports.isDeclaredPredicate = isDeclaredPredicate;
exports.isExistsTypeAnnotation = isExistsTypeAnnotation;
exports.isFunctionTypeAnnotation = isFunctionTypeAnnotation;
exports.isFunctionTypeParam = isFunctionTypeParam;
exports.isGenericTypeAnnotation = isGenericTypeAnnotation;
exports.isInferredPredicate = isInferredPredicate;
exports.isInterfaceExtends = isInterfaceExtends;
exports.isInterfaceDeclaration = isInterfaceDeclaration;
exports.isInterfaceTypeAnnotation = isInterfaceTypeAnnotation;
exports.isIntersectionTypeAnnotation = isIntersectionTypeAnnotation;
exports.isMixedTypeAnnotation = isMixedTypeAnnotation;
exports.isEmptyTypeAnnotation = isEmptyTypeAnnotation;
exports.isNullableTypeAnnotation = isNullableTypeAnnotation;
exports.isNumberLiteralTypeAnnotation = isNumberLiteralTypeAnnotation;
exports.isNumberTypeAnnotation = isNumberTypeAnnotation;
exports.isObjectTypeAnnotation = isObjectTypeAnnotation;
exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot;
exports.isObjectTypeCallProperty = isObjectTypeCallProperty;
exports.isObjectTypeIndexer = isObjectTypeIndexer;
exports.isObjectTypeProperty = isObjectTypeProperty;
exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty;
exports.isOpaqueType = isOpaqueType;
exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier;
exports.isStringLiteralTypeAnnotation = isStringLiteralTypeAnnotation;
exports.isStringTypeAnnotation = isStringTypeAnnotation;
exports.isSymbolTypeAnnotation = isSymbolTypeAnnotation;
exports.isThisTypeAnnotation = isThisTypeAnnotation;
exports.isTupleTypeAnnotation = isTupleTypeAnnotation;
exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation;
exports.isTypeAlias = isTypeAlias;
exports.isTypeAnnotation = isTypeAnnotation;
exports.isTypeCastExpression = isTypeCastExpression;
exports.isTypeParameter = isTypeParameter;
exports.isTypeParameterDeclaration = isTypeParameterDeclaration;
exports.isTypeParameterInstantiation = isTypeParameterInstantiation;
exports.isUnionTypeAnnotation = isUnionTypeAnnotation;
exports.isVariance = isVariance;
exports.isVoidTypeAnnotation = isVoidTypeAnnotation;
exports.isEnumDeclaration = isEnumDeclaration;
exports.isEnumBooleanBody = isEnumBooleanBody;
exports.isEnumNumberBody = isEnumNumberBody;
exports.isEnumStringBody = isEnumStringBody;
exports.isEnumSymbolBody = isEnumSymbolBody;
exports.isEnumBooleanMember = isEnumBooleanMember;
exports.isEnumNumberMember = isEnumNumberMember;
exports.isEnumStringMember = isEnumStringMember;
exports.isEnumDefaultedMember = isEnumDefaultedMember;
exports.isJSXAttribute = isJSXAttribute;
exports.isJSXClosingElement = isJSXClosingElement;
exports.isJSXElement = isJSXElement;
exports.isJSXEmptyExpression = isJSXEmptyExpression;
exports.isJSXExpressionContainer = isJSXExpressionContainer;
exports.isJSXSpreadChild = isJSXSpreadChild;
exports.isJSXIdentifier = isJSXIdentifier;
exports.isJSXMemberExpression = isJSXMemberExpression;
exports.isJSXNamespacedName = isJSXNamespacedName;
exports.isJSXOpeningElement = isJSXOpeningElement;
exports.isJSXSpreadAttribute = isJSXSpreadAttribute;
exports.isJSXText = isJSXText;
exports.isJSXFragment = isJSXFragment;
exports.isJSXOpeningFragment = isJSXOpeningFragment;
exports.isJSXClosingFragment = isJSXClosingFragment;
exports.isNoop = isNoop;
exports.isPlaceholder = isPlaceholder;
exports.isV8IntrinsicIdentifier = isV8IntrinsicIdentifier;
exports.isArgumentPlaceholder = isArgumentPlaceholder;
exports.isAwaitExpression = isAwaitExpression;
exports.isBindExpression = isBindExpression;
exports.isClassProperty = isClassProperty;
exports.isOptionalMemberExpression = isOptionalMemberExpression;
exports.isPipelineTopicExpression = isPipelineTopicExpression;
exports.isPipelineBareFunction = isPipelineBareFunction;
exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference;
exports.isOptionalCallExpression = isOptionalCallExpression;
exports.isClassPrivateProperty = isClassPrivateProperty;
exports.isClassPrivateMethod = isClassPrivateMethod;
exports.isImport = isImport;
exports.isImportAttribute = isImportAttribute;
exports.isDecorator = isDecorator;
exports.isDoExpression = isDoExpression;
exports.isExportDefaultSpecifier = isExportDefaultSpecifier;
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
exports.isPrivateName = isPrivateName;
exports.isBigIntLiteral = isBigIntLiteral;
exports.isRecordExpression = isRecordExpression;
exports.isTupleExpression = isTupleExpression;
exports.isTSParameterProperty = isTSParameterProperty;
exports.isTSDeclareFunction = isTSDeclareFunction;
exports.isTSDeclareMethod = isTSDeclareMethod;
exports.isTSQualifiedName = isTSQualifiedName;
exports.isTSCallSignatureDeclaration = isTSCallSignatureDeclaration;
exports.isTSConstructSignatureDeclaration = isTSConstructSignatureDeclaration;
exports.isTSPropertySignature = isTSPropertySignature;
exports.isTSMethodSignature = isTSMethodSignature;
exports.isTSIndexSignature = isTSIndexSignature;
exports.isTSAnyKeyword = isTSAnyKeyword;
exports.isTSBooleanKeyword = isTSBooleanKeyword;
exports.isTSBigIntKeyword = isTSBigIntKeyword;
exports.isTSNeverKeyword = isTSNeverKeyword;
exports.isTSNullKeyword = isTSNullKeyword;
exports.isTSNumberKeyword = isTSNumberKeyword;
exports.isTSObjectKeyword = isTSObjectKeyword;
exports.isTSStringKeyword = isTSStringKeyword;
exports.isTSSymbolKeyword = isTSSymbolKeyword;
exports.isTSUndefinedKeyword = isTSUndefinedKeyword;
exports.isTSUnknownKeyword = isTSUnknownKeyword;
exports.isTSVoidKeyword = isTSVoidKeyword;
exports.isTSThisType = isTSThisType;
exports.isTSFunctionType = isTSFunctionType;
exports.isTSConstructorType = isTSConstructorType;
exports.isTSTypeReference = isTSTypeReference;
exports.isTSTypePredicate = isTSTypePredicate;
exports.isTSTypeQuery = isTSTypeQuery;
exports.isTSTypeLiteral = isTSTypeLiteral;
exports.isTSArrayType = isTSArrayType;
exports.isTSTupleType = isTSTupleType;
exports.isTSOptionalType = isTSOptionalType;
exports.isTSRestType = isTSRestType;
exports.isTSUnionType = isTSUnionType;
exports.isTSIntersectionType = isTSIntersectionType;
exports.isTSConditionalType = isTSConditionalType;
exports.isTSInferType = isTSInferType;
exports.isTSParenthesizedType = isTSParenthesizedType;
exports.isTSTypeOperator = isTSTypeOperator;
exports.isTSIndexedAccessType = isTSIndexedAccessType;
exports.isTSMappedType = isTSMappedType;
exports.isTSLiteralType = isTSLiteralType;
exports.isTSExpressionWithTypeArguments = isTSExpressionWithTypeArguments;
exports.isTSInterfaceDeclaration = isTSInterfaceDeclaration;
exports.isTSInterfaceBody = isTSInterfaceBody;
exports.isTSTypeAliasDeclaration = isTSTypeAliasDeclaration;
exports.isTSAsExpression = isTSAsExpression;
exports.isTSTypeAssertion = isTSTypeAssertion;
exports.isTSEnumDeclaration = isTSEnumDeclaration;
exports.isTSEnumMember = isTSEnumMember;
exports.isTSModuleDeclaration = isTSModuleDeclaration;
exports.isTSModuleBlock = isTSModuleBlock;
exports.isTSImportType = isTSImportType;
exports.isTSImportEqualsDeclaration = isTSImportEqualsDeclaration;
exports.isTSExternalModuleReference = isTSExternalModuleReference;
exports.isTSNonNullExpression = isTSNonNullExpression;
exports.isTSExportAssignment = isTSExportAssignment;
exports.isTSNamespaceExportDeclaration = isTSNamespaceExportDeclaration;
exports.isTSTypeAnnotation = isTSTypeAnnotation;
exports.isTSTypeParameterInstantiation = isTSTypeParameterInstantiation;
exports.isTSTypeParameterDeclaration = isTSTypeParameterDeclaration;
exports.isTSTypeParameter = isTSTypeParameter;
exports.isExpression = isExpression;
exports.isBinary = isBinary;
exports.isScopable = isScopable;
exports.isBlockParent = isBlockParent;
exports.isBlock = isBlock;
exports.isStatement = isStatement;
exports.isTerminatorless = isTerminatorless;
exports.isCompletionStatement = isCompletionStatement;
exports.isConditional = isConditional;
exports.isLoop = isLoop;
exports.isWhile = isWhile;
exports.isExpressionWrapper = isExpressionWrapper;
exports.isFor = isFor;
exports.isForXStatement = isForXStatement;
exports.isFunction = isFunction;
exports.isFunctionParent = isFunctionParent;
exports.isPureish = isPureish;
exports.isDeclaration = isDeclaration;
exports.isPatternLike = isPatternLike;
exports.isLVal = isLVal;
exports.isTSEntityName = isTSEntityName;
exports.isLiteral = isLiteral;
exports.isImmutable = isImmutable;
exports.isUserWhitespacable = isUserWhitespacable;
exports.isMethod = isMethod;
exports.isObjectMember = isObjectMember;
exports.isProperty = isProperty;
exports.isUnaryLike = isUnaryLike;
exports.isPattern = isPattern;
exports.isClass = isClass;
exports.isModuleDeclaration = isModuleDeclaration;
exports.isExportDeclaration = isExportDeclaration;
exports.isModuleSpecifier = isModuleSpecifier;
exports.isFlow = isFlow;
exports.isFlowType = isFlowType;
exports.isFlowBaseAnnotation = isFlowBaseAnnotation;
exports.isFlowDeclaration = isFlowDeclaration;
exports.isFlowPredicate = isFlowPredicate;
exports.isEnumBody = isEnumBody;
exports.isEnumMember = isEnumMember;
exports.isJSX = isJSX;
exports.isPrivate = isPrivate;
exports.isTSTypeElement = isTSTypeElement;
exports.isTSType = isTSType;
exports.isTSBaseType = isTSBaseType;
exports.isNumberLiteral = isNumberLiteral;
exports.isRegexLiteral = isRegexLiteral;
exports.isRestProperty = isRestProperty;
exports.isSpreadProperty = isSpreadProperty;
var _shallowEqual = _interopRequireDefault(__webpack_require__(612));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isArrayExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ArrayExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isAssignmentExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "AssignmentExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBinaryExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BinaryExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isInterpreterDirective(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "InterpreterDirective") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDirective(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Directive") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDirectiveLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DirectiveLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBlockStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BlockStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBreakStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BreakStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isCallExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "CallExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isCatchClause(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "CatchClause") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isConditionalExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ConditionalExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isContinueStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ContinueStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDebuggerStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DebuggerStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDoWhileStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DoWhileStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEmptyStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EmptyStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExpressionStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExpressionStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFile(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "File") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isForInStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ForInStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isForStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ForStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFunctionDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FunctionDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFunctionExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FunctionExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isIdentifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Identifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isIfStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "IfStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isLabeledStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "LabeledStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isStringLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "StringLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNumericLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NumericLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNullLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NullLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBooleanLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BooleanLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isRegExpLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "RegExpLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isLogicalExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "LogicalExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isMemberExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "MemberExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNewExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NewExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isProgram(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Program") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectMethod") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isRestElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "RestElement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isReturnStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ReturnStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSequenceExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SequenceExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isParenthesizedExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ParenthesizedExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSwitchCase(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SwitchCase") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSwitchStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SwitchStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isThisExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ThisExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isThrowStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ThrowStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTryStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TryStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isUnaryExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UnaryExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isUpdateExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UpdateExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isVariableDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "VariableDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isVariableDeclarator(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "VariableDeclarator") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isWhileStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "WhileStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isWithStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "WithStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isAssignmentPattern(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "AssignmentPattern") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isArrayPattern(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ArrayPattern") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isArrowFunctionExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ArrowFunctionExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassBody") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportAllDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportAllDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportDefaultDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportDefaultDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportNamedDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportNamedDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isForOfStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ForOfStatement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImportDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ImportDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImportDefaultSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ImportDefaultSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImportNamespaceSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ImportNamespaceSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImportSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ImportSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isMetaProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "MetaProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassMethod") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectPattern(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectPattern") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSpreadElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SpreadElement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSuper(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Super") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTaggedTemplateExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TaggedTemplateExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTemplateElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TemplateElement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTemplateLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TemplateLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isYieldExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "YieldExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isAnyTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "AnyTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isArrayTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ArrayTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBooleanTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BooleanTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBooleanLiteralTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BooleanLiteralTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNullLiteralTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NullLiteralTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassImplements(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassImplements") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareClass(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareClass") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareFunction(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareFunction") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareInterface(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareInterface") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareModule(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareModule") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareModuleExports(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareModuleExports") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareTypeAlias(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareTypeAlias") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareOpaqueType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareOpaqueType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareVariable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareVariable") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareExportDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareExportDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclareExportAllDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclareExportAllDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclaredPredicate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DeclaredPredicate") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExistsTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExistsTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFunctionTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FunctionTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFunctionTypeParam(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FunctionTypeParam") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isGenericTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "GenericTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isInferredPredicate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "InferredPredicate") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isInterfaceExtends(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "InterfaceExtends") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isInterfaceDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "InterfaceDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isInterfaceTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "InterfaceTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isIntersectionTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "IntersectionTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isMixedTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "MixedTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEmptyTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EmptyTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNullableTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NullableTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNumberLiteralTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NumberLiteralTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNumberTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NumberTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectTypeInternalSlot(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectTypeInternalSlot") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectTypeCallProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectTypeCallProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectTypeIndexer(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectTypeIndexer") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectTypeProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectTypeProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectTypeSpreadProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectTypeSpreadProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOpaqueType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OpaqueType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isQualifiedTypeIdentifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "QualifiedTypeIdentifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isStringLiteralTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "StringLiteralTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isStringTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "StringTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSymbolTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SymbolTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isThisTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ThisTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTupleTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TupleTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeofTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeofTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeAlias(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeAlias") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeCastExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeCastExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeParameter(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeParameter") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeParameterDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeParameterDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTypeParameterInstantiation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TypeParameterInstantiation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isUnionTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UnionTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isVariance(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Variance") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isVoidTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "VoidTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumBooleanBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumBooleanBody") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumNumberBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumNumberBody") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumStringBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumStringBody") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumSymbolBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumSymbolBody") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumBooleanMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumBooleanMember") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumNumberMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumNumberMember") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumStringMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumStringMember") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumDefaultedMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumDefaultedMember") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXAttribute(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXAttribute") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXClosingElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXClosingElement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXElement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXEmptyExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXEmptyExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXExpressionContainer(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXExpressionContainer") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXSpreadChild(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXSpreadChild") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXIdentifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXIdentifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXMemberExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXMemberExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXNamespacedName(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXNamespacedName") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXOpeningElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXOpeningElement") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXSpreadAttribute(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXSpreadAttribute") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXText(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXText") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXFragment(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXFragment") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXOpeningFragment(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXOpeningFragment") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSXClosingFragment(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSXClosingFragment") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNoop(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Noop") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPlaceholder(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Placeholder") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isV8IntrinsicIdentifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "V8IntrinsicIdentifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isArgumentPlaceholder(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ArgumentPlaceholder") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isAwaitExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "AwaitExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBindExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BindExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOptionalMemberExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalMemberExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPipelineTopicExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PipelineTopicExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPipelineBareFunction(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PipelineBareFunction") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPipelinePrimaryTopicReference(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PipelinePrimaryTopicReference") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOptionalCallExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalCallExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassPrivateProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassPrivateProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClassPrivateMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ClassPrivateMethod") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImport(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Import") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImportAttribute(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ImportAttribute") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDecorator(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Decorator") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDoExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DoExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportDefaultSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportDefaultSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportNamespaceSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportNamespaceSpecifier") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPrivateName(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PrivateName") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBigIntLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BigIntLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isRecordExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "RecordExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTupleExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TupleExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSParameterProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSParameterProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSDeclareFunction(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSDeclareFunction") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSDeclareMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSDeclareMethod") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSQualifiedName(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSQualifiedName") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSCallSignatureDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSCallSignatureDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSConstructSignatureDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSConstructSignatureDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSPropertySignature(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSPropertySignature") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSMethodSignature(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSMethodSignature") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSIndexSignature(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSIndexSignature") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSAnyKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSAnyKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSBooleanKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSBooleanKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSBigIntKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSBigIntKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSNeverKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNeverKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSNullKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNullKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSNumberKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNumberKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSObjectKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSObjectKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSStringKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSStringKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSSymbolKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSSymbolKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSUndefinedKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSUndefinedKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSUnknownKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSUnknownKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSVoidKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSVoidKeyword") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSThisType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSThisType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSFunctionType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSFunctionType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSConstructorType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSConstructorType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeReference(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeReference") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypePredicate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypePredicate") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeQuery(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeQuery") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSArrayType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSArrayType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTupleType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTupleType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSOptionalType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSOptionalType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSRestType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSRestType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSUnionType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSUnionType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSIntersectionType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSIntersectionType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSConditionalType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSConditionalType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSInferType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSInferType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSParenthesizedType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSParenthesizedType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeOperator(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeOperator") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSIndexedAccessType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSIndexedAccessType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSMappedType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSMappedType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSLiteralType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSLiteralType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSExpressionWithTypeArguments(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSExpressionWithTypeArguments") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSInterfaceDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSInterfaceDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSInterfaceBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSInterfaceBody") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeAliasDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeAliasDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSAsExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSAsExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeAssertion(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeAssertion") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSEnumDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSEnumDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSEnumMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSEnumMember") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSModuleDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSModuleDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSModuleBlock(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSModuleBlock") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSImportType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSImportType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSImportEqualsDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSImportEqualsDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSExternalModuleReference(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSExternalModuleReference") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSNonNullExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNonNullExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSExportAssignment(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSExportAssignment") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSNamespaceExportDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNamespaceExportDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeAnnotation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeParameterInstantiation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeParameterInstantiation") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeParameterDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeParameterDeclaration") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeParameter(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeParameter") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Expression" || "ArrayExpression" === nodeType || "AssignmentExpression" === nodeType || "BinaryExpression" === nodeType || "CallExpression" === nodeType || "ConditionalExpression" === nodeType || "FunctionExpression" === nodeType || "Identifier" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "LogicalExpression" === nodeType || "MemberExpression" === nodeType || "NewExpression" === nodeType || "ObjectExpression" === nodeType || "SequenceExpression" === nodeType || "ParenthesizedExpression" === nodeType || "ThisExpression" === nodeType || "UnaryExpression" === nodeType || "UpdateExpression" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "MetaProperty" === nodeType || "Super" === nodeType || "TaggedTemplateExpression" === nodeType || "TemplateLiteral" === nodeType || "YieldExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "AwaitExpression" === nodeType || "BindExpression" === nodeType || "OptionalMemberExpression" === nodeType || "PipelinePrimaryTopicReference" === nodeType || "OptionalCallExpression" === nodeType || "Import" === nodeType || "DoExpression" === nodeType || "BigIntLiteral" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "TSAsExpression" === nodeType || "TSTypeAssertion" === nodeType || "TSNonNullExpression" === nodeType || nodeType === "Placeholder" && ("Expression" === node.expectedNode || "Identifier" === node.expectedNode || "StringLiteral" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBinary(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Binary" || "BinaryExpression" === nodeType || "LogicalExpression" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isScopable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Scopable" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBlockParent(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "BlockParent" || "BlockStatement" === nodeType || "CatchClause" === nodeType || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "Program" === nodeType || "ObjectMethod" === nodeType || "SwitchStatement" === nodeType || "WhileStatement" === nodeType || "ArrowFunctionExpression" === nodeType || "ForOfStatement" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isBlock(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Block" || "BlockStatement" === nodeType || "Program" === nodeType || "TSModuleBlock" === nodeType || nodeType === "Placeholder" && "BlockStatement" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Statement" || "BlockStatement" === nodeType || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "DebuggerStatement" === nodeType || "DoWhileStatement" === nodeType || "EmptyStatement" === nodeType || "ExpressionStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "FunctionDeclaration" === nodeType || "IfStatement" === nodeType || "LabeledStatement" === nodeType || "ReturnStatement" === nodeType || "SwitchStatement" === nodeType || "ThrowStatement" === nodeType || "TryStatement" === nodeType || "VariableDeclaration" === nodeType || "WhileStatement" === nodeType || "WithStatement" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ForOfStatement" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || "TSImportEqualsDeclaration" === nodeType || "TSExportAssignment" === nodeType || "TSNamespaceExportDeclaration" === nodeType || nodeType === "Placeholder" && ("Statement" === node.expectedNode || "Declaration" === node.expectedNode || "BlockStatement" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTerminatorless(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Terminatorless" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType || "YieldExpression" === nodeType || "AwaitExpression" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isCompletionStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "CompletionStatement" || "BreakStatement" === nodeType || "ContinueStatement" === nodeType || "ReturnStatement" === nodeType || "ThrowStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isConditional(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Conditional" || "ConditionalExpression" === nodeType || "IfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isLoop(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Loop" || "DoWhileStatement" === nodeType || "ForInStatement" === nodeType || "ForStatement" === nodeType || "WhileStatement" === nodeType || "ForOfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isWhile(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "While" || "DoWhileStatement" === nodeType || "WhileStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExpressionWrapper(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExpressionWrapper" || "ExpressionStatement" === nodeType || "ParenthesizedExpression" === nodeType || "TypeCastExpression" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFor(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "For" || "ForInStatement" === nodeType || "ForStatement" === nodeType || "ForOfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isForXStatement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ForXStatement" || "ForInStatement" === nodeType || "ForOfStatement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFunction(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Function" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFunctionParent(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FunctionParent" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "ObjectMethod" === nodeType || "ArrowFunctionExpression" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPureish(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Pureish" || "FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "BigIntLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Declaration" || "FunctionDeclaration" === nodeType || "VariableDeclaration" === nodeType || "ClassDeclaration" === nodeType || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType || "EnumDeclaration" === nodeType || "TSDeclareFunction" === nodeType || "TSInterfaceDeclaration" === nodeType || "TSTypeAliasDeclaration" === nodeType || "TSEnumDeclaration" === nodeType || "TSModuleDeclaration" === nodeType || nodeType === "Placeholder" && "Declaration" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPatternLike(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "PatternLike" || "Identifier" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isLVal(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "LVal" || "Identifier" === nodeType || "MemberExpression" === nodeType || "RestElement" === nodeType || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || "TSParameterProperty" === nodeType || nodeType === "Placeholder" && ("Pattern" === node.expectedNode || "Identifier" === node.expectedNode)) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSEntityName(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSEntityName" || "Identifier" === nodeType || "TSQualifiedName" === nodeType || nodeType === "Placeholder" && "Identifier" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Literal" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isImmutable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Immutable" || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "BigIntLiteral" === nodeType || nodeType === "Placeholder" && "StringLiteral" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isUserWhitespacable(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UserWhitespacable" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isMethod(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Method" || "ObjectMethod" === nodeType || "ClassMethod" === nodeType || "ClassPrivateMethod" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isObjectMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ObjectMember" || "ObjectMethod" === nodeType || "ObjectProperty" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isProperty(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Property" || "ObjectProperty" === nodeType || "ClassProperty" === nodeType || "ClassPrivateProperty" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isUnaryLike(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "UnaryLike" || "UnaryExpression" === nodeType || "SpreadElement" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPattern(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Pattern" || "AssignmentPattern" === nodeType || "ArrayPattern" === nodeType || "ObjectPattern" === nodeType || nodeType === "Placeholder" && "Pattern" === node.expectedNode) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isClass(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Class" || "ClassExpression" === nodeType || "ClassDeclaration" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isModuleDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ModuleDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType || "ImportDeclaration" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isExportDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ExportDeclaration" || "ExportAllDeclaration" === nodeType || "ExportDefaultDeclaration" === nodeType || "ExportNamedDeclaration" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isModuleSpecifier(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ModuleSpecifier" || "ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportDefaultSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFlow(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Flow" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ClassImplements" === nodeType || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "DeclaredPredicate" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "FunctionTypeParam" === nodeType || "GenericTypeAnnotation" === nodeType || "InferredPredicate" === nodeType || "InterfaceExtends" === nodeType || "InterfaceDeclaration" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "ObjectTypeInternalSlot" === nodeType || "ObjectTypeCallProperty" === nodeType || "ObjectTypeIndexer" === nodeType || "ObjectTypeProperty" === nodeType || "ObjectTypeSpreadProperty" === nodeType || "OpaqueType" === nodeType || "QualifiedTypeIdentifier" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "TypeAlias" === nodeType || "TypeAnnotation" === nodeType || "TypeCastExpression" === nodeType || "TypeParameter" === nodeType || "TypeParameterDeclaration" === nodeType || "TypeParameterInstantiation" === nodeType || "UnionTypeAnnotation" === nodeType || "Variance" === nodeType || "VoidTypeAnnotation" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFlowType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowType" || "AnyTypeAnnotation" === nodeType || "ArrayTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "BooleanLiteralTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "ExistsTypeAnnotation" === nodeType || "FunctionTypeAnnotation" === nodeType || "GenericTypeAnnotation" === nodeType || "InterfaceTypeAnnotation" === nodeType || "IntersectionTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NullableTypeAnnotation" === nodeType || "NumberLiteralTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "ObjectTypeAnnotation" === nodeType || "StringLiteralTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "TupleTypeAnnotation" === nodeType || "TypeofTypeAnnotation" === nodeType || "UnionTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFlowBaseAnnotation(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowBaseAnnotation" || "AnyTypeAnnotation" === nodeType || "BooleanTypeAnnotation" === nodeType || "NullLiteralTypeAnnotation" === nodeType || "MixedTypeAnnotation" === nodeType || "EmptyTypeAnnotation" === nodeType || "NumberTypeAnnotation" === nodeType || "StringTypeAnnotation" === nodeType || "SymbolTypeAnnotation" === nodeType || "ThisTypeAnnotation" === nodeType || "VoidTypeAnnotation" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFlowDeclaration(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowDeclaration" || "DeclareClass" === nodeType || "DeclareFunction" === nodeType || "DeclareInterface" === nodeType || "DeclareModule" === nodeType || "DeclareModuleExports" === nodeType || "DeclareTypeAlias" === nodeType || "DeclareOpaqueType" === nodeType || "DeclareVariable" === nodeType || "DeclareExportDeclaration" === nodeType || "DeclareExportAllDeclaration" === nodeType || "InterfaceDeclaration" === nodeType || "OpaqueType" === nodeType || "TypeAlias" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isFlowPredicate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "FlowPredicate" || "DeclaredPredicate" === nodeType || "InferredPredicate" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumBody(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumBody" || "EnumBooleanBody" === nodeType || "EnumNumberBody" === nodeType || "EnumStringBody" === nodeType || "EnumSymbolBody" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isEnumMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "EnumMember" || "EnumBooleanMember" === nodeType || "EnumNumberMember" === nodeType || "EnumStringMember" === nodeType || "EnumDefaultedMember" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isJSX(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "JSX" || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXEmptyExpression" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXIdentifier" === nodeType || "JSXMemberExpression" === nodeType || "JSXNamespacedName" === nodeType || "JSXOpeningElement" === nodeType || "JSXSpreadAttribute" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isPrivate(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "Private" || "ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSTypeElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSTypeElement" || "TSCallSignatureDeclaration" === nodeType || "TSConstructSignatureDeclaration" === nodeType || "TSPropertySignature" === nodeType || "TSMethodSignature" === nodeType || "TSIndexSignature" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSType" || "TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSFunctionType" === nodeType || "TSConstructorType" === nodeType || "TSTypeReference" === nodeType || "TSTypePredicate" === nodeType || "TSTypeQuery" === nodeType || "TSTypeLiteral" === nodeType || "TSArrayType" === nodeType || "TSTupleType" === nodeType || "TSOptionalType" === nodeType || "TSRestType" === nodeType || "TSUnionType" === nodeType || "TSIntersectionType" === nodeType || "TSConditionalType" === nodeType || "TSInferType" === nodeType || "TSParenthesizedType" === nodeType || "TSTypeOperator" === nodeType || "TSIndexedAccessType" === nodeType || "TSMappedType" === nodeType || "TSLiteralType" === nodeType || "TSExpressionWithTypeArguments" === nodeType || "TSImportType" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTSBaseType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSBaseType" || "TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSNeverKeyword" === nodeType || "TSNullKeyword" === nodeType || "TSNumberKeyword" === nodeType || "TSObjectKeyword" === nodeType || "TSStringKeyword" === nodeType || "TSSymbolKeyword" === nodeType || "TSUndefinedKeyword" === nodeType || "TSUnknownKeyword" === nodeType || "TSVoidKeyword" === nodeType || "TSThisType" === nodeType || "TSLiteralType" === nodeType) {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isNumberLiteral(node, opts) {
console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
if (!node) return false;
const nodeType = node.type;
if (nodeType === "NumberLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isRegexLiteral(node, opts) {
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
if (!node) return false;
const nodeType = node.type;
if (nodeType === "RegexLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isRestProperty(node, opts) {
console.trace("The node type RestProperty has been renamed to RestElement");
if (!node) return false;
const nodeType = node.type;
if (nodeType === "RestProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isSpreadProperty(node, opts) {
console.trace("The node type SpreadProperty has been renamed to SpreadElement");
if (!node) return false;
const nodeType = node.type;
if (nodeType === "SpreadProperty") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
/***/ }),
/* 560 */
/***/ (function(module, exports, __webpack_require__) {
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
const networkRequest = __webpack_require__(567);
const workerUtils = __webpack_require__(568);
module.exports = {
networkRequest,
workerUtils
};
/***/ }),
/* 561 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.arrayExpression = exports.ArrayExpression = ArrayExpression;
exports.assignmentExpression = exports.AssignmentExpression = AssignmentExpression;
exports.binaryExpression = exports.BinaryExpression = BinaryExpression;
exports.interpreterDirective = exports.InterpreterDirective = InterpreterDirective;
exports.directive = exports.Directive = Directive;
exports.directiveLiteral = exports.DirectiveLiteral = DirectiveLiteral;
exports.blockStatement = exports.BlockStatement = BlockStatement;
exports.breakStatement = exports.BreakStatement = BreakStatement;
exports.callExpression = exports.CallExpression = CallExpression;
exports.catchClause = exports.CatchClause = CatchClause;
exports.conditionalExpression = exports.ConditionalExpression = ConditionalExpression;
exports.continueStatement = exports.ContinueStatement = ContinueStatement;
exports.debuggerStatement = exports.DebuggerStatement = DebuggerStatement;
exports.doWhileStatement = exports.DoWhileStatement = DoWhileStatement;
exports.emptyStatement = exports.EmptyStatement = EmptyStatement;
exports.expressionStatement = exports.ExpressionStatement = ExpressionStatement;
exports.file = exports.File = File;
exports.forInStatement = exports.ForInStatement = ForInStatement;
exports.forStatement = exports.ForStatement = ForStatement;
exports.functionDeclaration = exports.FunctionDeclaration = FunctionDeclaration;
exports.functionExpression = exports.FunctionExpression = FunctionExpression;
exports.identifier = exports.Identifier = Identifier;
exports.ifStatement = exports.IfStatement = IfStatement;
exports.labeledStatement = exports.LabeledStatement = LabeledStatement;
exports.stringLiteral = exports.StringLiteral = StringLiteral;
exports.numericLiteral = exports.NumericLiteral = NumericLiteral;
exports.nullLiteral = exports.NullLiteral = NullLiteral;
exports.booleanLiteral = exports.BooleanLiteral = BooleanLiteral;
exports.regExpLiteral = exports.RegExpLiteral = RegExpLiteral;
exports.logicalExpression = exports.LogicalExpression = LogicalExpression;
exports.memberExpression = exports.MemberExpression = MemberExpression;
exports.newExpression = exports.NewExpression = NewExpression;
exports.program = exports.Program = Program;
exports.objectExpression = exports.ObjectExpression = ObjectExpression;
exports.objectMethod = exports.ObjectMethod = ObjectMethod;
exports.objectProperty = exports.ObjectProperty = ObjectProperty;
exports.restElement = exports.RestElement = RestElement;
exports.returnStatement = exports.ReturnStatement = ReturnStatement;
exports.sequenceExpression = exports.SequenceExpression = SequenceExpression;
exports.parenthesizedExpression = exports.ParenthesizedExpression = ParenthesizedExpression;
exports.switchCase = exports.SwitchCase = SwitchCase;
exports.switchStatement = exports.SwitchStatement = SwitchStatement;
exports.thisExpression = exports.ThisExpression = ThisExpression;
exports.throwStatement = exports.ThrowStatement = ThrowStatement;
exports.tryStatement = exports.TryStatement = TryStatement;
exports.unaryExpression = exports.UnaryExpression = UnaryExpression;
exports.updateExpression = exports.UpdateExpression = UpdateExpression;
exports.variableDeclaration = exports.VariableDeclaration = VariableDeclaration;
exports.variableDeclarator = exports.VariableDeclarator = VariableDeclarator;
exports.whileStatement = exports.WhileStatement = WhileStatement;
exports.withStatement = exports.WithStatement = WithStatement;
exports.assignmentPattern = exports.AssignmentPattern = AssignmentPattern;
exports.arrayPattern = exports.ArrayPattern = ArrayPattern;
exports.arrowFunctionExpression = exports.ArrowFunctionExpression = ArrowFunctionExpression;
exports.classBody = exports.ClassBody = ClassBody;
exports.classExpression = exports.ClassExpression = ClassExpression;
exports.classDeclaration = exports.ClassDeclaration = ClassDeclaration;
exports.exportAllDeclaration = exports.ExportAllDeclaration = ExportAllDeclaration;
exports.exportDefaultDeclaration = exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
exports.exportNamedDeclaration = exports.ExportNamedDeclaration = ExportNamedDeclaration;
exports.exportSpecifier = exports.ExportSpecifier = ExportSpecifier;
exports.forOfStatement = exports.ForOfStatement = ForOfStatement;
exports.importDeclaration = exports.ImportDeclaration = ImportDeclaration;
exports.importDefaultSpecifier = exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
exports.importNamespaceSpecifier = exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
exports.importSpecifier = exports.ImportSpecifier = ImportSpecifier;
exports.metaProperty = exports.MetaProperty = MetaProperty;
exports.classMethod = exports.ClassMethod = ClassMethod;
exports.objectPattern = exports.ObjectPattern = ObjectPattern;
exports.spreadElement = exports.SpreadElement = SpreadElement;
exports.super = exports.Super = Super;
exports.taggedTemplateExpression = exports.TaggedTemplateExpression = TaggedTemplateExpression;
exports.templateElement = exports.TemplateElement = TemplateElement;
exports.templateLiteral = exports.TemplateLiteral = TemplateLiteral;
exports.yieldExpression = exports.YieldExpression = YieldExpression;
exports.anyTypeAnnotation = exports.AnyTypeAnnotation = AnyTypeAnnotation;
exports.arrayTypeAnnotation = exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
exports.booleanTypeAnnotation = exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
exports.booleanLiteralTypeAnnotation = exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
exports.nullLiteralTypeAnnotation = exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
exports.classImplements = exports.ClassImplements = ClassImplements;
exports.declareClass = exports.DeclareClass = DeclareClass;
exports.declareFunction = exports.DeclareFunction = DeclareFunction;
exports.declareInterface = exports.DeclareInterface = DeclareInterface;
exports.declareModule = exports.DeclareModule = DeclareModule;
exports.declareModuleExports = exports.DeclareModuleExports = DeclareModuleExports;
exports.declareTypeAlias = exports.DeclareTypeAlias = DeclareTypeAlias;
exports.declareOpaqueType = exports.DeclareOpaqueType = DeclareOpaqueType;
exports.declareVariable = exports.DeclareVariable = DeclareVariable;
exports.declareExportDeclaration = exports.DeclareExportDeclaration = DeclareExportDeclaration;
exports.declareExportAllDeclaration = exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
exports.declaredPredicate = exports.DeclaredPredicate = DeclaredPredicate;
exports.existsTypeAnnotation = exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
exports.functionTypeAnnotation = exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.functionTypeParam = exports.FunctionTypeParam = FunctionTypeParam;
exports.genericTypeAnnotation = exports.GenericTypeAnnotation = GenericTypeAnnotation;
exports.inferredPredicate = exports.InferredPredicate = InferredPredicate;
exports.interfaceExtends = exports.InterfaceExtends = InterfaceExtends;
exports.interfaceDeclaration = exports.InterfaceDeclaration = InterfaceDeclaration;
exports.interfaceTypeAnnotation = exports.InterfaceTypeAnnotation = InterfaceTypeAnnotation;
exports.intersectionTypeAnnotation = exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
exports.mixedTypeAnnotation = exports.MixedTypeAnnotation = MixedTypeAnnotation;
exports.emptyTypeAnnotation = exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
exports.nullableTypeAnnotation = exports.NullableTypeAnnotation = NullableTypeAnnotation;
exports.numberLiteralTypeAnnotation = exports.NumberLiteralTypeAnnotation = NumberLiteralTypeAnnotation;
exports.numberTypeAnnotation = exports.NumberTypeAnnotation = NumberTypeAnnotation;
exports.objectTypeAnnotation = exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
exports.objectTypeInternalSlot = exports.ObjectTypeInternalSlot = ObjectTypeInternalSlot;
exports.objectTypeCallProperty = exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
exports.objectTypeIndexer = exports.ObjectTypeIndexer = ObjectTypeIndexer;
exports.objectTypeProperty = exports.ObjectTypeProperty = ObjectTypeProperty;
exports.objectTypeSpreadProperty = exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
exports.opaqueType = exports.OpaqueType = OpaqueType;
exports.qualifiedTypeIdentifier = exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
exports.stringLiteralTypeAnnotation = exports.StringLiteralTypeAnnotation = StringLiteralTypeAnnotation;
exports.stringTypeAnnotation = exports.StringTypeAnnotation = StringTypeAnnotation;
exports.symbolTypeAnnotation = exports.SymbolTypeAnnotation = SymbolTypeAnnotation;
exports.thisTypeAnnotation = exports.ThisTypeAnnotation = ThisTypeAnnotation;
exports.tupleTypeAnnotation = exports.TupleTypeAnnotation = TupleTypeAnnotation;
exports.typeofTypeAnnotation = exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
exports.typeAlias = exports.TypeAlias = TypeAlias;
exports.typeAnnotation = exports.TypeAnnotation = TypeAnnotation;
exports.typeCastExpression = exports.TypeCastExpression = TypeCastExpression;
exports.typeParameter = exports.TypeParameter = TypeParameter;
exports.typeParameterDeclaration = exports.TypeParameterDeclaration = TypeParameterDeclaration;
exports.typeParameterInstantiation = exports.TypeParameterInstantiation = TypeParameterInstantiation;
exports.unionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
exports.variance = exports.Variance = Variance;
exports.voidTypeAnnotation = exports.VoidTypeAnnotation = VoidTypeAnnotation;
exports.enumDeclaration = exports.EnumDeclaration = EnumDeclaration;
exports.enumBooleanBody = exports.EnumBooleanBody = EnumBooleanBody;
exports.enumNumberBody = exports.EnumNumberBody = EnumNumberBody;
exports.enumStringBody = exports.EnumStringBody = EnumStringBody;
exports.enumSymbolBody = exports.EnumSymbolBody = EnumSymbolBody;
exports.enumBooleanMember = exports.EnumBooleanMember = EnumBooleanMember;
exports.enumNumberMember = exports.EnumNumberMember = EnumNumberMember;
exports.enumStringMember = exports.EnumStringMember = EnumStringMember;
exports.enumDefaultedMember = exports.EnumDefaultedMember = EnumDefaultedMember;
exports.jSXAttribute = exports.jsxAttribute = exports.JSXAttribute = JSXAttribute;
exports.jSXClosingElement = exports.jsxClosingElement = exports.JSXClosingElement = JSXClosingElement;
exports.jSXElement = exports.jsxElement = exports.JSXElement = JSXElement;
exports.jSXEmptyExpression = exports.jsxEmptyExpression = exports.JSXEmptyExpression = JSXEmptyExpression;
exports.jSXExpressionContainer = exports.jsxExpressionContainer = exports.JSXExpressionContainer = JSXExpressionContainer;
exports.jSXSpreadChild = exports.jsxSpreadChild = exports.JSXSpreadChild = JSXSpreadChild;
exports.jSXIdentifier = exports.jsxIdentifier = exports.JSXIdentifier = JSXIdentifier;
exports.jSXMemberExpression = exports.jsxMemberExpression = exports.JSXMemberExpression = JSXMemberExpression;
exports.jSXNamespacedName = exports.jsxNamespacedName = exports.JSXNamespacedName = JSXNamespacedName;
exports.jSXOpeningElement = exports.jsxOpeningElement = exports.JSXOpeningElement = JSXOpeningElement;
exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = exports.JSXSpreadAttribute = JSXSpreadAttribute;
exports.jSXText = exports.jsxText = exports.JSXText = JSXText;
exports.jSXFragment = exports.jsxFragment = exports.JSXFragment = JSXFragment;
exports.jSXOpeningFragment = exports.jsxOpeningFragment = exports.JSXOpeningFragment = JSXOpeningFragment;
exports.jSXClosingFragment = exports.jsxClosingFragment = exports.JSXClosingFragment = JSXClosingFragment;
exports.noop = exports.Noop = Noop;
exports.placeholder = exports.Placeholder = Placeholder;
exports.v8IntrinsicIdentifier = exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier;
exports.argumentPlaceholder = exports.ArgumentPlaceholder = ArgumentPlaceholder;
exports.awaitExpression = exports.AwaitExpression = AwaitExpression;
exports.bindExpression = exports.BindExpression = BindExpression;
exports.classProperty = exports.ClassProperty = ClassProperty;
exports.optionalMemberExpression = exports.OptionalMemberExpression = OptionalMemberExpression;
exports.pipelineTopicExpression = exports.PipelineTopicExpression = PipelineTopicExpression;
exports.pipelineBareFunction = exports.PipelineBareFunction = PipelineBareFunction;
exports.pipelinePrimaryTopicReference = exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
exports.optionalCallExpression = exports.OptionalCallExpression = OptionalCallExpression;
exports.classPrivateProperty = exports.ClassPrivateProperty = ClassPrivateProperty;
exports.classPrivateMethod = exports.ClassPrivateMethod = ClassPrivateMethod;
exports.import = exports.Import = Import;
exports.importAttribute = exports.ImportAttribute = ImportAttribute;
exports.decorator = exports.Decorator = Decorator;
exports.doExpression = exports.DoExpression = DoExpression;
exports.exportDefaultSpecifier = exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
exports.exportNamespaceSpecifier = exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
exports.privateName = exports.PrivateName = PrivateName;
exports.bigIntLiteral = exports.BigIntLiteral = BigIntLiteral;
exports.recordExpression = exports.RecordExpression = RecordExpression;
exports.tupleExpression = exports.TupleExpression = TupleExpression;
exports.tSParameterProperty = exports.tsParameterProperty = exports.TSParameterProperty = TSParameterProperty;
exports.tSDeclareFunction = exports.tsDeclareFunction = exports.TSDeclareFunction = TSDeclareFunction;
exports.tSDeclareMethod = exports.tsDeclareMethod = exports.TSDeclareMethod = TSDeclareMethod;
exports.tSQualifiedName = exports.tsQualifiedName = exports.TSQualifiedName = TSQualifiedName;
exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = exports.TSConstructSignatureDeclaration = TSConstructSignatureDeclaration;
exports.tSPropertySignature = exports.tsPropertySignature = exports.TSPropertySignature = TSPropertySignature;
exports.tSMethodSignature = exports.tsMethodSignature = exports.TSMethodSignature = TSMethodSignature;
exports.tSIndexSignature = exports.tsIndexSignature = exports.TSIndexSignature = TSIndexSignature;
exports.tSAnyKeyword = exports.tsAnyKeyword = exports.TSAnyKeyword = TSAnyKeyword;
exports.tSBooleanKeyword = exports.tsBooleanKeyword = exports.TSBooleanKeyword = TSBooleanKeyword;
exports.tSBigIntKeyword = exports.tsBigIntKeyword = exports.TSBigIntKeyword = TSBigIntKeyword;
exports.tSNeverKeyword = exports.tsNeverKeyword = exports.TSNeverKeyword = TSNeverKeyword;
exports.tSNullKeyword = exports.tsNullKeyword = exports.TSNullKeyword = TSNullKeyword;
exports.tSNumberKeyword = exports.tsNumberKeyword = exports.TSNumberKeyword = TSNumberKeyword;
exports.tSObjectKeyword = exports.tsObjectKeyword = exports.TSObjectKeyword = TSObjectKeyword;
exports.tSStringKeyword = exports.tsStringKeyword = exports.TSStringKeyword = TSStringKeyword;
exports.tSSymbolKeyword = exports.tsSymbolKeyword = exports.TSSymbolKeyword = TSSymbolKeyword;
exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = exports.TSUndefinedKeyword = TSUndefinedKeyword;
exports.tSUnknownKeyword = exports.tsUnknownKeyword = exports.TSUnknownKeyword = TSUnknownKeyword;
exports.tSVoidKeyword = exports.tsVoidKeyword = exports.TSVoidKeyword = TSVoidKeyword;
exports.tSThisType = exports.tsThisType = exports.TSThisType = TSThisType;
exports.tSFunctionType = exports.tsFunctionType = exports.TSFunctionType = TSFunctionType;
exports.tSConstructorType = exports.tsConstructorType = exports.TSConstructorType = TSConstructorType;
exports.tSTypeReference = exports.tsTypeReference = exports.TSTypeReference = TSTypeReference;
exports.tSTypePredicate = exports.tsTypePredicate = exports.TSTypePredicate = TSTypePredicate;
exports.tSTypeQuery = exports.tsTypeQuery = exports.TSTypeQuery = TSTypeQuery;
exports.tSTypeLiteral = exports.tsTypeLiteral = exports.TSTypeLiteral = TSTypeLiteral;
exports.tSArrayType = exports.tsArrayType = exports.TSArrayType = TSArrayType;
exports.tSTupleType = exports.tsTupleType = exports.TSTupleType = TSTupleType;
exports.tSOptionalType = exports.tsOptionalType = exports.TSOptionalType = TSOptionalType;
exports.tSRestType = exports.tsRestType = exports.TSRestType = TSRestType;
exports.tSUnionType = exports.tsUnionType = exports.TSUnionType = TSUnionType;
exports.tSIntersectionType = exports.tsIntersectionType = exports.TSIntersectionType = TSIntersectionType;
exports.tSConditionalType = exports.tsConditionalType = exports.TSConditionalType = TSConditionalType;
exports.tSInferType = exports.tsInferType = exports.TSInferType = TSInferType;
exports.tSParenthesizedType = exports.tsParenthesizedType = exports.TSParenthesizedType = TSParenthesizedType;
exports.tSTypeOperator = exports.tsTypeOperator = exports.TSTypeOperator = TSTypeOperator;
exports.tSIndexedAccessType = exports.tsIndexedAccessType = exports.TSIndexedAccessType = TSIndexedAccessType;
exports.tSMappedType = exports.tsMappedType = exports.TSMappedType = TSMappedType;
exports.tSLiteralType = exports.tsLiteralType = exports.TSLiteralType = TSLiteralType;
exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments;
exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = exports.TSInterfaceDeclaration = TSInterfaceDeclaration;
exports.tSInterfaceBody = exports.tsInterfaceBody = exports.TSInterfaceBody = TSInterfaceBody;
exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = exports.TSTypeAliasDeclaration = TSTypeAliasDeclaration;
exports.tSAsExpression = exports.tsAsExpression = exports.TSAsExpression = TSAsExpression;
exports.tSTypeAssertion = exports.tsTypeAssertion = exports.TSTypeAssertion = TSTypeAssertion;
exports.tSEnumDeclaration = exports.tsEnumDeclaration = exports.TSEnumDeclaration = TSEnumDeclaration;
exports.tSEnumMember = exports.tsEnumMember = exports.TSEnumMember = TSEnumMember;
exports.tSModuleDeclaration = exports.tsModuleDeclaration = exports.TSModuleDeclaration = TSModuleDeclaration;
exports.tSModuleBlock = exports.tsModuleBlock = exports.TSModuleBlock = TSModuleBlock;
exports.tSImportType = exports.tsImportType = exports.TSImportType = TSImportType;
exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = exports.TSImportEqualsDeclaration = TSImportEqualsDeclaration;
exports.tSExternalModuleReference = exports.tsExternalModuleReference = exports.TSExternalModuleReference = TSExternalModuleReference;
exports.tSNonNullExpression = exports.tsNonNullExpression = exports.TSNonNullExpression = TSNonNullExpression;
exports.tSExportAssignment = exports.tsExportAssignment = exports.TSExportAssignment = TSExportAssignment;
exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
exports.tSTypeAnnotation = exports.tsTypeAnnotation = exports.TSTypeAnnotation = TSTypeAnnotation;
exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = exports.TSTypeParameterInstantiation = TSTypeParameterInstantiation;
exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = exports.TSTypeParameterDeclaration = TSTypeParameterDeclaration;
exports.tSTypeParameter = exports.tsTypeParameter = exports.TSTypeParameter = TSTypeParameter;
exports.numberLiteral = exports.NumberLiteral = NumberLiteral;
exports.regexLiteral = exports.RegexLiteral = RegexLiteral;
exports.restProperty = exports.RestProperty = RestProperty;
exports.spreadProperty = exports.SpreadProperty = SpreadProperty;
var _builder = _interopRequireDefault(__webpack_require__(719));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ArrayExpression(...args) {
return (0, _builder.default)("ArrayExpression", ...args);
}
function AssignmentExpression(...args) {
return (0, _builder.default)("AssignmentExpression", ...args);
}
function BinaryExpression(...args) {
return (0, _builder.default)("BinaryExpression", ...args);
}
function InterpreterDirective(...args) {
return (0, _builder.default)("InterpreterDirective", ...args);
}
function Directive(...args) {
return (0, _builder.default)("Directive", ...args);
}
function DirectiveLiteral(...args) {
return (0, _builder.default)("DirectiveLiteral", ...args);
}
function BlockStatement(...args) {
return (0, _builder.default)("BlockStatement", ...args);
}
function BreakStatement(...args) {
return (0, _builder.default)("BreakStatement", ...args);
}
function CallExpression(...args) {
return (0, _builder.default)("CallExpression", ...args);
}
function CatchClause(...args) {
return (0, _builder.default)("CatchClause", ...args);
}
function ConditionalExpression(...args) {
return (0, _builder.default)("ConditionalExpression", ...args);
}
function ContinueStatement(...args) {
return (0, _builder.default)("ContinueStatement", ...args);
}
function DebuggerStatement(...args) {
return (0, _builder.default)("DebuggerStatement", ...args);
}
function DoWhileStatement(...args) {
return (0, _builder.default)("DoWhileStatement", ...args);
}
function EmptyStatement(...args) {
return (0, _builder.default)("EmptyStatement", ...args);
}
function ExpressionStatement(...args) {
return (0, _builder.default)("ExpressionStatement", ...args);
}
function File(...args) {
return (0, _builder.default)("File", ...args);
}
function ForInStatement(...args) {
return (0, _builder.default)("ForInStatement", ...args);
}
function ForStatement(...args) {
return (0, _builder.default)("ForStatement", ...args);
}
function FunctionDeclaration(...args) {
return (0, _builder.default)("FunctionDeclaration", ...args);
}
function FunctionExpression(...args) {
return (0, _builder.default)("FunctionExpression", ...args);
}
function Identifier(...args) {
return (0, _builder.default)("Identifier", ...args);
}
function IfStatement(...args) {
return (0, _builder.default)("IfStatement", ...args);
}
function LabeledStatement(...args) {
return (0, _builder.default)("LabeledStatement", ...args);
}
function StringLiteral(...args) {
return (0, _builder.default)("StringLiteral", ...args);
}
function NumericLiteral(...args) {
return (0, _builder.default)("NumericLiteral", ...args);
}
function NullLiteral(...args) {
return (0, _builder.default)("NullLiteral", ...args);
}
function BooleanLiteral(...args) {
return (0, _builder.default)("BooleanLiteral", ...args);
}
function RegExpLiteral(...args) {
return (0, _builder.default)("RegExpLiteral", ...args);
}
function LogicalExpression(...args) {
return (0, _builder.default)("LogicalExpression", ...args);
}
function MemberExpression(...args) {
return (0, _builder.default)("MemberExpression", ...args);
}
function NewExpression(...args) {
return (0, _builder.default)("NewExpression", ...args);
}
function Program(...args) {
return (0, _builder.default)("Program", ...args);
}
function ObjectExpression(...args) {
return (0, _builder.default)("ObjectExpression", ...args);
}
function ObjectMethod(...args) {
return (0, _builder.default)("ObjectMethod", ...args);
}
function ObjectProperty(...args) {
return (0, _builder.default)("ObjectProperty", ...args);
}
function RestElement(...args) {
return (0, _builder.default)("RestElement", ...args);
}
function ReturnStatement(...args) {
return (0, _builder.default)("ReturnStatement", ...args);
}
function SequenceExpression(...args) {
return (0, _builder.default)("SequenceExpression", ...args);
}
function ParenthesizedExpression(...args) {
return (0, _builder.default)("ParenthesizedExpression", ...args);
}
function SwitchCase(...args) {
return (0, _builder.default)("SwitchCase", ...args);
}
function SwitchStatement(...args) {
return (0, _builder.default)("SwitchStatement", ...args);
}
function ThisExpression(...args) {
return (0, _builder.default)("ThisExpression", ...args);
}
function ThrowStatement(...args) {
return (0, _builder.default)("ThrowStatement", ...args);
}
function TryStatement(...args) {
return (0, _builder.default)("TryStatement", ...args);
}
function UnaryExpression(...args) {
return (0, _builder.default)("UnaryExpression", ...args);
}
function UpdateExpression(...args) {
return (0, _builder.default)("UpdateExpression", ...args);
}
function VariableDeclaration(...args) {
return (0, _builder.default)("VariableDeclaration", ...args);
}
function VariableDeclarator(...args) {
return (0, _builder.default)("VariableDeclarator", ...args);
}
function WhileStatement(...args) {
return (0, _builder.default)("WhileStatement", ...args);
}
function WithStatement(...args) {
return (0, _builder.default)("WithStatement", ...args);
}
function AssignmentPattern(...args) {
return (0, _builder.default)("AssignmentPattern", ...args);
}
function ArrayPattern(...args) {
return (0, _builder.default)("ArrayPattern", ...args);
}
function ArrowFunctionExpression(...args) {
return (0, _builder.default)("ArrowFunctionExpression", ...args);
}
function ClassBody(...args) {
return (0, _builder.default)("ClassBody", ...args);
}
function ClassExpression(...args) {
return (0, _builder.default)("ClassExpression", ...args);
}
function ClassDeclaration(...args) {
return (0, _builder.default)("ClassDeclaration", ...args);
}
function ExportAllDeclaration(...args) {
return (0, _builder.default)("ExportAllDeclaration", ...args);
}
function ExportDefaultDeclaration(...args) {
return (0, _builder.default)("ExportDefaultDeclaration", ...args);
}
function ExportNamedDeclaration(...args) {
return (0, _builder.default)("ExportNamedDeclaration", ...args);
}
function ExportSpecifier(...args) {
return (0, _builder.default)("ExportSpecifier", ...args);
}
function ForOfStatement(...args) {
return (0, _builder.default)("ForOfStatement", ...args);
}
function ImportDeclaration(...args) {
return (0, _builder.default)("ImportDeclaration", ...args);
}
function ImportDefaultSpecifier(...args) {
return (0, _builder.default)("ImportDefaultSpecifier", ...args);
}
function ImportNamespaceSpecifier(...args) {
return (0, _builder.default)("ImportNamespaceSpecifier", ...args);
}
function ImportSpecifier(...args) {
return (0, _builder.default)("ImportSpecifier", ...args);
}
function MetaProperty(...args) {
return (0, _builder.default)("MetaProperty", ...args);
}
function ClassMethod(...args) {
return (0, _builder.default)("ClassMethod", ...args);
}
function ObjectPattern(...args) {
return (0, _builder.default)("ObjectPattern", ...args);
}
function SpreadElement(...args) {
return (0, _builder.default)("SpreadElement", ...args);
}
function Super(...args) {
return (0, _builder.default)("Super", ...args);
}
function TaggedTemplateExpression(...args) {
return (0, _builder.default)("TaggedTemplateExpression", ...args);
}
function TemplateElement(...args) {
return (0, _builder.default)("TemplateElement", ...args);
}
function TemplateLiteral(...args) {
return (0, _builder.default)("TemplateLiteral", ...args);
}
function YieldExpression(...args) {
return (0, _builder.default)("YieldExpression", ...args);
}
function AnyTypeAnnotation(...args) {
return (0, _builder.default)("AnyTypeAnnotation", ...args);
}
function ArrayTypeAnnotation(...args) {
return (0, _builder.default)("ArrayTypeAnnotation", ...args);
}
function BooleanTypeAnnotation(...args) {
return (0, _builder.default)("BooleanTypeAnnotation", ...args);
}
function BooleanLiteralTypeAnnotation(...args) {
return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...args);
}
function NullLiteralTypeAnnotation(...args) {
return (0, _builder.default)("NullLiteralTypeAnnotation", ...args);
}
function ClassImplements(...args) {
return (0, _builder.default)("ClassImplements", ...args);
}
function DeclareClass(...args) {
return (0, _builder.default)("DeclareClass", ...args);
}
function DeclareFunction(...args) {
return (0, _builder.default)("DeclareFunction", ...args);
}
function DeclareInterface(...args) {
return (0, _builder.default)("DeclareInterface", ...args);
}
function DeclareModule(...args) {
return (0, _builder.default)("DeclareModule", ...args);
}
function DeclareModuleExports(...args) {
return (0, _builder.default)("DeclareModuleExports", ...args);
}
function DeclareTypeAlias(...args) {
return (0, _builder.default)("DeclareTypeAlias", ...args);
}
function DeclareOpaqueType(...args) {
return (0, _builder.default)("DeclareOpaqueType", ...args);
}
function DeclareVariable(...args) {
return (0, _builder.default)("DeclareVariable", ...args);
}
function DeclareExportDeclaration(...args) {
return (0, _builder.default)("DeclareExportDeclaration", ...args);
}
function DeclareExportAllDeclaration(...args) {
return (0, _builder.default)("DeclareExportAllDeclaration", ...args);
}
function DeclaredPredicate(...args) {
return (0, _builder.default)("DeclaredPredicate", ...args);
}
function ExistsTypeAnnotation(...args) {
return (0, _builder.default)("ExistsTypeAnnotation", ...args);
}
function FunctionTypeAnnotation(...args) {
return (0, _builder.default)("FunctionTypeAnnotation", ...args);
}
function FunctionTypeParam(...args) {
return (0, _builder.default)("FunctionTypeParam", ...args);
}
function GenericTypeAnnotation(...args) {
return (0, _builder.default)("GenericTypeAnnotation", ...args);
}
function InferredPredicate(...args) {
return (0, _builder.default)("InferredPredicate", ...args);
}
function InterfaceExtends(...args) {
return (0, _builder.default)("InterfaceExtends", ...args);
}
function InterfaceDeclaration(...args) {
return (0, _builder.default)("InterfaceDeclaration", ...args);
}
function InterfaceTypeAnnotation(...args) {
return (0, _builder.default)("InterfaceTypeAnnotation", ...args);
}
function IntersectionTypeAnnotation(...args) {
return (0, _builder.default)("IntersectionTypeAnnotation", ...args);
}
function MixedTypeAnnotation(...args) {
return (0, _builder.default)("MixedTypeAnnotation", ...args);
}
function EmptyTypeAnnotation(...args) {
return (0, _builder.default)("EmptyTypeAnnotation", ...args);
}
function NullableTypeAnnotation(...args) {
return (0, _builder.default)("NullableTypeAnnotation", ...args);
}
function NumberLiteralTypeAnnotation(...args) {
return (0, _builder.default)("NumberLiteralTypeAnnotation", ...args);
}
function NumberTypeAnnotation(...args) {
return (0, _builder.default)("NumberTypeAnnotation", ...args);
}
function ObjectTypeAnnotation(...args) {
return (0, _builder.default)("ObjectTypeAnnotation", ...args);
}
function ObjectTypeInternalSlot(...args) {
return (0, _builder.default)("ObjectTypeInternalSlot", ...args);
}
function ObjectTypeCallProperty(...args) {
return (0, _builder.default)("ObjectTypeCallProperty", ...args);
}
function ObjectTypeIndexer(...args) {
return (0, _builder.default)("ObjectTypeIndexer", ...args);
}
function ObjectTypeProperty(...args) {
return (0, _builder.default)("ObjectTypeProperty", ...args);
}
function ObjectTypeSpreadProperty(...args) {
return (0, _builder.default)("ObjectTypeSpreadProperty", ...args);
}
function OpaqueType(...args) {
return (0, _builder.default)("OpaqueType", ...args);
}
function QualifiedTypeIdentifier(...args) {
return (0, _builder.default)("QualifiedTypeIdentifier", ...args);
}
function StringLiteralTypeAnnotation(...args) {
return (0, _builder.default)("StringLiteralTypeAnnotation", ...args);
}
function StringTypeAnnotation(...args) {
return (0, _builder.default)("StringTypeAnnotation", ...args);
}
function SymbolTypeAnnotation(...args) {
return (0, _builder.default)("SymbolTypeAnnotation", ...args);
}
function ThisTypeAnnotation(...args) {
return (0, _builder.default)("ThisTypeAnnotation", ...args);
}
function TupleTypeAnnotation(...args) {
return (0, _builder.default)("TupleTypeAnnotation", ...args);
}
function TypeofTypeAnnotation(...args) {
return (0, _builder.default)("TypeofTypeAnnotation", ...args);
}
function TypeAlias(...args) {
return (0, _builder.default)("TypeAlias", ...args);
}
function TypeAnnotation(...args) {
return (0, _builder.default)("TypeAnnotation", ...args);
}
function TypeCastExpression(...args) {
return (0, _builder.default)("TypeCastExpression", ...args);
}
function TypeParameter(...args) {
return (0, _builder.default)("TypeParameter", ...args);
}
function TypeParameterDeclaration(...args) {
return (0, _builder.default)("TypeParameterDeclaration", ...args);
}
function TypeParameterInstantiation(...args) {
return (0, _builder.default)("TypeParameterInstantiation", ...args);
}
function UnionTypeAnnotation(...args) {
return (0, _builder.default)("UnionTypeAnnotation", ...args);
}
function Variance(...args) {
return (0, _builder.default)("Variance", ...args);
}
function VoidTypeAnnotation(...args) {
return (0, _builder.default)("VoidTypeAnnotation", ...args);
}
function EnumDeclaration(...args) {
return (0, _builder.default)("EnumDeclaration", ...args);
}
function EnumBooleanBody(...args) {
return (0, _builder.default)("EnumBooleanBody", ...args);
}
function EnumNumberBody(...args) {
return (0, _builder.default)("EnumNumberBody", ...args);
}
function EnumStringBody(...args) {
return (0, _builder.default)("EnumStringBody", ...args);
}
function EnumSymbolBody(...args) {
return (0, _builder.default)("EnumSymbolBody", ...args);
}
function EnumBooleanMember(...args) {
return (0, _builder.default)("EnumBooleanMember", ...args);
}
function EnumNumberMember(...args) {
return (0, _builder.default)("EnumNumberMember", ...args);
}
function EnumStringMember(...args) {
return (0, _builder.default)("EnumStringMember", ...args);
}
function EnumDefaultedMember(...args) {
return (0, _builder.default)("EnumDefaultedMember", ...args);
}
function JSXAttribute(...args) {
return (0, _builder.default)("JSXAttribute", ...args);
}
function JSXClosingElement(...args) {
return (0, _builder.default)("JSXClosingElement", ...args);
}
function JSXElement(...args) {
return (0, _builder.default)("JSXElement", ...args);
}
function JSXEmptyExpression(...args) {
return (0, _builder.default)("JSXEmptyExpression", ...args);
}
function JSXExpressionContainer(...args) {
return (0, _builder.default)("JSXExpressionContainer", ...args);
}
function JSXSpreadChild(...args) {
return (0, _builder.default)("JSXSpreadChild", ...args);
}
function JSXIdentifier(...args) {
return (0, _builder.default)("JSXIdentifier", ...args);
}
function JSXMemberExpression(...args) {
return (0, _builder.default)("JSXMemberExpression", ...args);
}
function JSXNamespacedName(...args) {
return (0, _builder.default)("JSXNamespacedName", ...args);
}
function JSXOpeningElement(...args) {
return (0, _builder.default)("JSXOpeningElement", ...args);
}
function JSXSpreadAttribute(...args) {
return (0, _builder.default)("JSXSpreadAttribute", ...args);
}
function JSXText(...args) {
return (0, _builder.default)("JSXText", ...args);
}
function JSXFragment(...args) {
return (0, _builder.default)("JSXFragment", ...args);
}
function JSXOpeningFragment(...args) {
return (0, _builder.default)("JSXOpeningFragment", ...args);
}
function JSXClosingFragment(...args) {
return (0, _builder.default)("JSXClosingFragment", ...args);
}
function Noop(...args) {
return (0, _builder.default)("Noop", ...args);
}
function Placeholder(...args) {
return (0, _builder.default)("Placeholder", ...args);
}
function V8IntrinsicIdentifier(...args) {
return (0, _builder.default)("V8IntrinsicIdentifier", ...args);
}
function ArgumentPlaceholder(...args) {
return (0, _builder.default)("ArgumentPlaceholder", ...args);
}
function AwaitExpression(...args) {
return (0, _builder.default)("AwaitExpression", ...args);
}
function BindExpression(...args) {
return (0, _builder.default)("BindExpression", ...args);
}
function ClassProperty(...args) {
return (0, _builder.default)("ClassProperty", ...args);
}
function OptionalMemberExpression(...args) {
return (0, _builder.default)("OptionalMemberExpression", ...args);
}
function PipelineTopicExpression(...args) {
return (0, _builder.default)("PipelineTopicExpression", ...args);
}
function PipelineBareFunction(...args) {
return (0, _builder.default)("PipelineBareFunction", ...args);
}
function PipelinePrimaryTopicReference(...args) {
return (0, _builder.default)("PipelinePrimaryTopicReference", ...args);
}
function OptionalCallExpression(...args) {
return (0, _builder.default)("OptionalCallExpression", ...args);
}
function ClassPrivateProperty(...args) {
return (0, _builder.default)("ClassPrivateProperty", ...args);
}
function ClassPrivateMethod(...args) {
return (0, _builder.default)("ClassPrivateMethod", ...args);
}
function Import(...args) {
return (0, _builder.default)("Import", ...args);
}
function ImportAttribute(...args) {
return (0, _builder.default)("ImportAttribute", ...args);
}
function Decorator(...args) {
return (0, _builder.default)("Decorator", ...args);
}
function DoExpression(...args) {
return (0, _builder.default)("DoExpression", ...args);
}
function ExportDefaultSpecifier(...args) {
return (0, _builder.default)("ExportDefaultSpecifier", ...args);
}
function ExportNamespaceSpecifier(...args) {
return (0, _builder.default)("ExportNamespaceSpecifier", ...args);
}
function PrivateName(...args) {
return (0, _builder.default)("PrivateName", ...args);
}
function BigIntLiteral(...args) {
return (0, _builder.default)("BigIntLiteral", ...args);
}
function RecordExpression(...args) {
return (0, _builder.default)("RecordExpression", ...args);
}
function TupleExpression(...args) {
return (0, _builder.default)("TupleExpression", ...args);
}
function TSParameterProperty(...args) {
return (0, _builder.default)("TSParameterProperty", ...args);
}
function TSDeclareFunction(...args) {
return (0, _builder.default)("TSDeclareFunction", ...args);
}
function TSDeclareMethod(...args) {
return (0, _builder.default)("TSDeclareMethod", ...args);
}
function TSQualifiedName(...args) {
return (0, _builder.default)("TSQualifiedName", ...args);
}
function TSCallSignatureDeclaration(...args) {
return (0, _builder.default)("TSCallSignatureDeclaration", ...args);
}
function TSConstructSignatureDeclaration(...args) {
return (0, _builder.default)("TSConstructSignatureDeclaration", ...args);
}
function TSPropertySignature(...args) {
return (0, _builder.default)("TSPropertySignature", ...args);
}
function TSMethodSignature(...args) {
return (0, _builder.default)("TSMethodSignature", ...args);
}
function TSIndexSignature(...args) {
return (0, _builder.default)("TSIndexSignature", ...args);
}
function TSAnyKeyword(...args) {
return (0, _builder.default)("TSAnyKeyword", ...args);
}
function TSBooleanKeyword(...args) {
return (0, _builder.default)("TSBooleanKeyword", ...args);
}
function TSBigIntKeyword(...args) {
return (0, _builder.default)("TSBigIntKeyword", ...args);
}
function TSNeverKeyword(...args) {
return (0, _builder.default)("TSNeverKeyword", ...args);
}
function TSNullKeyword(...args) {
return (0, _builder.default)("TSNullKeyword", ...args);
}
function TSNumberKeyword(...args) {
return (0, _builder.default)("TSNumberKeyword", ...args);
}
function TSObjectKeyword(...args) {
return (0, _builder.default)("TSObjectKeyword", ...args);
}
function TSStringKeyword(...args) {
return (0, _builder.default)("TSStringKeyword", ...args);
}
function TSSymbolKeyword(...args) {
return (0, _builder.default)("TSSymbolKeyword", ...args);
}
function TSUndefinedKeyword(...args) {
return (0, _builder.default)("TSUndefinedKeyword", ...args);
}
function TSUnknownKeyword(...args) {
return (0, _builder.default)("TSUnknownKeyword", ...args);
}
function TSVoidKeyword(...args) {
return (0, _builder.default)("TSVoidKeyword", ...args);
}
function TSThisType(...args) {
return (0, _builder.default)("TSThisType", ...args);
}
function TSFunctionType(...args) {
return (0, _builder.default)("TSFunctionType", ...args);
}
function TSConstructorType(...args) {
return (0, _builder.default)("TSConstructorType", ...args);
}
function TSTypeReference(...args) {
return (0, _builder.default)("TSTypeReference", ...args);
}
function TSTypePredicate(...args) {
return (0, _builder.default)("TSTypePredicate", ...args);
}
function TSTypeQuery(...args) {
return (0, _builder.default)("TSTypeQuery", ...args);
}
function TSTypeLiteral(...args) {
return (0, _builder.default)("TSTypeLiteral", ...args);
}
function TSArrayType(...args) {
return (0, _builder.default)("TSArrayType", ...args);
}
function TSTupleType(...args) {
return (0, _builder.default)("TSTupleType", ...args);
}
function TSOptionalType(...args) {
return (0, _builder.default)("TSOptionalType", ...args);
}
function TSRestType(...args) {
return (0, _builder.default)("TSRestType", ...args);
}
function TSUnionType(...args) {
return (0, _builder.default)("TSUnionType", ...args);
}
function TSIntersectionType(...args) {
return (0, _builder.default)("TSIntersectionType", ...args);
}
function TSConditionalType(...args) {
return (0, _builder.default)("TSConditionalType", ...args);
}
function TSInferType(...args) {
return (0, _builder.default)("TSInferType", ...args);
}
function TSParenthesizedType(...args) {
return (0, _builder.default)("TSParenthesizedType", ...args);
}
function TSTypeOperator(...args) {
return (0, _builder.default)("TSTypeOperator", ...args);
}
function TSIndexedAccessType(...args) {
return (0, _builder.default)("TSIndexedAccessType", ...args);
}
function TSMappedType(...args) {
return (0, _builder.default)("TSMappedType", ...args);
}
function TSLiteralType(...args) {
return (0, _builder.default)("TSLiteralType", ...args);
}
function TSExpressionWithTypeArguments(...args) {
return (0, _builder.default)("TSExpressionWithTypeArguments", ...args);
}
function TSInterfaceDeclaration(...args) {
return (0, _builder.default)("TSInterfaceDeclaration", ...args);
}
function TSInterfaceBody(...args) {
return (0, _builder.default)("TSInterfaceBody", ...args);
}
function TSTypeAliasDeclaration(...args) {
return (0, _builder.default)("TSTypeAliasDeclaration", ...args);
}
function TSAsExpression(...args) {
return (0, _builder.default)("TSAsExpression", ...args);
}
function TSTypeAssertion(...args) {
return (0, _builder.default)("TSTypeAssertion", ...args);
}
function TSEnumDeclaration(...args) {
return (0, _builder.default)("TSEnumDeclaration", ...args);
}
function TSEnumMember(...args) {
return (0, _builder.default)("TSEnumMember", ...args);
}
function TSModuleDeclaration(...args) {
return (0, _builder.default)("TSModuleDeclaration", ...args);
}
function TSModuleBlock(...args) {
return (0, _builder.default)("TSModuleBlock", ...args);
}
function TSImportType(...args) {
return (0, _builder.default)("TSImportType", ...args);
}
function TSImportEqualsDeclaration(...args) {
return (0, _builder.default)("TSImportEqualsDeclaration", ...args);
}
function TSExternalModuleReference(...args) {
return (0, _builder.default)("TSExternalModuleReference", ...args);
}
function TSNonNullExpression(...args) {
return (0, _builder.default)("TSNonNullExpression", ...args);
}
function TSExportAssignment(...args) {
return (0, _builder.default)("TSExportAssignment", ...args);
}
function TSNamespaceExportDeclaration(...args) {
return (0, _builder.default)("TSNamespaceExportDeclaration", ...args);
}
function TSTypeAnnotation(...args) {
return (0, _builder.default)("TSTypeAnnotation", ...args);
}
function TSTypeParameterInstantiation(...args) {
return (0, _builder.default)("TSTypeParameterInstantiation", ...args);
}
function TSTypeParameterDeclaration(...args) {
return (0, _builder.default)("TSTypeParameterDeclaration", ...args);
}
function TSTypeParameter(...args) {
return (0, _builder.default)("TSTypeParameter", ...args);
}
function NumberLiteral(...args) {
console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
return NumberLiteral("NumberLiteral", ...args);
}
function RegexLiteral(...args) {
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
return RegexLiteral("RegexLiteral", ...args);
}
function RestProperty(...args) {
console.trace("The node type RestProperty has been renamed to RestElement");
return RestProperty("RestProperty", ...args);
}
function SpreadProperty(...args) {
console.trace("The node type SpreadProperty has been renamed to SpreadElement");
return SpreadProperty("SpreadProperty", ...args);
}
/***/ }),
/* 562 */
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(589);
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ }),
/* 563 */
/***/ (function(module, exports) {
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
module.exports = isArray;
/***/ }),
/* 564 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "VISITOR_KEYS", {
enumerable: true,
get: function () {
return _utils.VISITOR_KEYS;
}
});
Object.defineProperty(exports, "ALIAS_KEYS", {
enumerable: true,
get: function () {
return _utils.ALIAS_KEYS;
}
});
Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", {
enumerable: true,
get: function () {
return _utils.FLIPPED_ALIAS_KEYS;
}
});
Object.defineProperty(exports, "NODE_FIELDS", {
enumerable: true,
get: function () {
return _utils.NODE_FIELDS;
}
});
Object.defineProperty(exports, "BUILDER_KEYS", {
enumerable: true,
get: function () {
return _utils.BUILDER_KEYS;
}
});
Object.defineProperty(exports, "DEPRECATED_KEYS", {
enumerable: true,
get: function () {
return _utils.DEPRECATED_KEYS;
}
});
Object.defineProperty(exports, "NODE_PARENT_VALIDATIONS", {
enumerable: true,
get: function () {
return _utils.NODE_PARENT_VALIDATIONS;
}
});
Object.defineProperty(exports, "PLACEHOLDERS", {
enumerable: true,
get: function () {
return _placeholders.PLACEHOLDERS;
}
});
Object.defineProperty(exports, "PLACEHOLDERS_ALIAS", {
enumerable: true,
get: function () {
return _placeholders.PLACEHOLDERS_ALIAS;
}
});
Object.defineProperty(exports, "PLACEHOLDERS_FLIPPED_ALIAS", {
enumerable: true,
get: function () {
return _placeholders.PLACEHOLDERS_FLIPPED_ALIAS;
}
});
exports.TYPES = void 0;
var _toFastProperties = _interopRequireDefault(__webpack_require__(780));
__webpack_require__(600);
__webpack_require__(628);
__webpack_require__(783);
__webpack_require__(784);
__webpack_require__(785);
__webpack_require__(786);
__webpack_require__(787);
var _utils = __webpack_require__(571);
var _placeholders = __webpack_require__(668);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
(0, _toFastProperties.default)(_utils.VISITOR_KEYS);
(0, _toFastProperties.default)(_utils.ALIAS_KEYS);
(0, _toFastProperties.default)(_utils.FLIPPED_ALIAS_KEYS);
(0, _toFastProperties.default)(_utils.NODE_FIELDS);
(0, _toFastProperties.default)(_utils.BUILDER_KEYS);
(0, _toFastProperties.default)(_utils.DEPRECATED_KEYS);
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_ALIAS);
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS);
const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS));
exports.TYPES = TYPES;
/***/ }),
/* 565 */
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ }),
/* 566 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[2],
host: match[3],
port: match[4],
path: match[5]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = '';
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ':';
}
url += '//';
if (aParsedUrl.auth) {
url += aParsedUrl.auth + '@';
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
/**
* Normalizes a path, or the path portion of a URL:
*
* - Replaces consecutive slashes with one slash.
* - Removes unnecessary '.' parts.
* - Removes unnecessary '
/..' parts.
*
* Based on code in the Node.js 'path' core module.
*
* @param aPath The path or url to normalize.
*/
function normalize(aPath) {
var path = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path = url.path;
}
var isAbsolute = exports.isAbsolute(path);
var parts = path.split(/\/+/);
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === '.') {
parts.splice(i, 1);
} else if (part === '..') {
up++;
} else if (up > 0) {
if (part === '') {
// The first part is blank if the path is absolute. Trying to go
// above the root is a no-op. Therefore we can remove all '..' parts
// directly after the root.
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path = parts.join('/');
if (path === '') {
path = isAbsolute ? '/' : '.';
}
if (url) {
url.path = path;
return urlGenerate(url);
}
return path;
}
exports.normalize = normalize;
/**
* Joins two paths/URLs.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be joined with the root.
*
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
* first.
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
* is updated with the result and aRoot is returned. Otherwise the result
* is returned.
* - If aPath is absolute, the result is aPath.
* - Otherwise the two paths are joined with a slash.
* - Joining for example 'http://' and 'www.example.com' is also supported.
*/
function join(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || '/';
}
// `join(foo, '//www.example.org')`
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
}
// `join('http://', 'www.example.com')`
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === '/'
? aPath
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports.join = join;
exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
};
/**
* Make a path relative to a URL or another path.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be made relative to aRoot.
*/
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, '');
// It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from the root one by one, until either we find
// a prefix that fits, or we run out of components to remove.
var level = 0;
while (aPath.indexOf(aRoot + '/') !== 0) {
var index = aRoot.lastIndexOf("/");
if (index < 0) {
return aPath;
}
// If the only part of the root that is left is the scheme (i.e. http://,
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
// have exhausted all components, so the path is not relative to the root.
aRoot = aRoot.slice(0, index);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
}
// Make sure we add a "../" for each component we removed from the root.
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports.relative = relative;
var supportsNullProto = (function () {
var obj = Object.create(null);
return !('__proto__' in obj);
}());
function identity (s) {
return s;
}
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
if (isProtoString(aStr)) {
return '$' + aStr;
}
return aStr;
}
exports.toSetString = supportsNullProto ? identity : toSetString;
function fromSetString(aStr) {
if (isProtoString(aStr)) {
return aStr.slice(1);
}
return aStr;
}
exports.fromSetString = supportsNullProto ? identity : fromSetString;
function isProtoString(s) {
if (!s) {
return false;
}
var length = s.length;
if (length < 9 /* "__proto__".length */) {
return false;
}
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
return false;
}
for (var i = length - 10; i >= 0; i--) {
if (s.charCodeAt(i) !== 36 /* '$' */) {
return false;
}
}
return true;
}
/**
* Comparator between two mappings where the original positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same original source/line/column, but different generated
* line and column the same. Useful when searching for a mapping with a
* stubbed out mapping.
*/
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = mappingA.source - mappingB.source;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return mappingA.name - mappingB.name;
}
exports.compareByOriginalPositions = compareByOriginalPositions;
/**
* Comparator between two mappings with deflated source and name indices where
* the generated positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same generated line and column, but different
* source/name/original line and column the same. Useful when searching for a
* mapping with a stubbed out mapping.
*/
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = mappingA.source - mappingB.source;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return mappingA.name - mappingB.name;
}
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
/**
* Comparator between two mappings with inflated source and name strings where
* the generated positions are compared.
*/
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
/***/ }),
/* 567 */
/***/ (function(module, exports) {
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
function networkRequest(url, opts) {
return fetch(url, {
cache: opts.loadFromCache ? "default" : "no-cache"
}).then(res => {
if (res.status >= 200 && res.status < 300) {
if (res.headers.get("Content-Type") === "application/wasm") {
return res.arrayBuffer().then(buffer => ({
content: buffer,
isDwarf: true
}));
}
return res.text().then(text => ({
content: text
}));
}
return Promise.reject(`request failed with status ${res.status}`);
});
}
module.exports = networkRequest;
/***/ }),
/* 568 */
/***/ (function(module, exports) {
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
function WorkerDispatcher() {
this.msgId = 1;
this.worker = null;
}
WorkerDispatcher.prototype = {
start(url, win = window) {
this.worker = new win.Worker(url);
this.worker.onerror = err => {
console.error(`Error in worker ${url}`, err.message);
};
},
stop() {
if (!this.worker) {
return;
}
this.worker.terminate();
this.worker = null;
},
task(method, {
queue = false
} = {}) {
const calls = [];
const push = args => {
return new Promise((resolve, reject) => {
if (queue && calls.length === 0) {
Promise.resolve().then(flush);
}
calls.push([args, resolve, reject]);
if (!queue) {
flush();
}
});
};
const flush = () => {
const items = calls.slice();
calls.length = 0;
if (!this.worker) {
return;
}
const id = this.msgId++;
this.worker.postMessage({
id,
method,
calls: items.map(item => item[0])
});
const listener = ({
data: result
}) => {
if (result.id !== id) {
return;
}
if (!this.worker) {
return;
}
this.worker.removeEventListener("message", listener);
result.results.forEach((resultData, i) => {
const [, resolve, reject] = items[i];
if (resultData.error) {
const err = new Error(resultData.message);
err.metadata = resultData.metadata;
reject(err);
} else {
resolve(resultData.response);
}
});
};
this.worker.addEventListener("message", listener);
};
return (...args) => push(args);
},
invoke(method, ...args) {
return this.task(method)(...args);
}
};
function workerHandler(publicInterface) {
return function (msg) {
const {
id,
method,
calls
} = msg.data;
Promise.all(calls.map(args => {
try {
const response = publicInterface[method].apply(undefined, args);
if (response instanceof Promise) {
return response.then(val => ({
response: val
}), err => asErrorMessage(err));
}
return {
response
};
} catch (error) {
return asErrorMessage(error);
}
})).then(results => {
self.postMessage({
id,
results
});
});
};
}
function asErrorMessage(error) {
if (typeof error === "object" && error && "message" in error) {
// Error can't be sent via postMessage, so be sure to convert to
// string.
return {
error: true,
message: error.message,
metadata: error.metadata
};
}
return {
error: true,
message: error == null ? error : error.toString(),
metadata: undefined
};
}
module.exports = {
WorkerDispatcher,
workerHandler
};
/***/ }),
/* 569 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(570),
getRawTag = __webpack_require__(615),
objectToString = __webpack_require__(616);
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ }),
/* 570 */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(562);
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/* 571 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.validate = validate;
exports.typeIs = typeIs;
exports.validateType = validateType;
exports.validateOptional = validateOptional;
exports.validateOptionalType = validateOptionalType;
exports.arrayOf = arrayOf;
exports.arrayOfType = arrayOfType;
exports.validateArrayOfType = validateArrayOfType;
exports.assertEach = assertEach;
exports.assertOneOf = assertOneOf;
exports.assertNodeType = assertNodeType;
exports.assertNodeOrValueType = assertNodeOrValueType;
exports.assertValueType = assertValueType;
exports.assertShape = assertShape;
exports.assertOptionalChainStart = assertOptionalChainStart;
exports.chain = chain;
exports.default = defineType;
exports.NODE_PARENT_VALIDATIONS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = void 0;
var _is = _interopRequireDefault(__webpack_require__(579));
var _validate = __webpack_require__(627);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const VISITOR_KEYS = {};
exports.VISITOR_KEYS = VISITOR_KEYS;
const ALIAS_KEYS = {};
exports.ALIAS_KEYS = ALIAS_KEYS;
const FLIPPED_ALIAS_KEYS = {};
exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS;
const NODE_FIELDS = {};
exports.NODE_FIELDS = NODE_FIELDS;
const BUILDER_KEYS = {};
exports.BUILDER_KEYS = BUILDER_KEYS;
const DEPRECATED_KEYS = {};
exports.DEPRECATED_KEYS = DEPRECATED_KEYS;
const NODE_PARENT_VALIDATIONS = {};
exports.NODE_PARENT_VALIDATIONS = NODE_PARENT_VALIDATIONS;
function getType(val) {
if (Array.isArray(val)) {
return "array";
} else if (val === null) {
return "null";
} else {
return typeof val;
}
}
function validate(validate) {
return {
validate
};
}
function typeIs(typeName) {
return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName);
}
function validateType(typeName) {
return validate(typeIs(typeName));
}
function validateOptional(validate) {
return {
validate,
optional: true
};
}
function validateOptionalType(typeName) {
return {
validate: typeIs(typeName),
optional: true
};
}
function arrayOf(elementType) {
return chain(assertValueType("array"), assertEach(elementType));
}
function arrayOfType(typeName) {
return arrayOf(typeIs(typeName));
}
function validateArrayOfType(typeName) {
return validate(arrayOfType(typeName));
}
function assertEach(callback) {
function validator(node, key, val) {
if (!Array.isArray(val)) return;
for (let i = 0; i < val.length; i++) {
const subkey = `${key}[${i}]`;
const v = val[i];
callback(node, subkey, v);
if (Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) (0, _validate.validateChild)(node, subkey, v);
}
}
validator.each = callback;
return validator;
}
function assertOneOf(...values) {
function validate(node, key, val) {
if (values.indexOf(val) < 0) {
throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`);
}
}
validate.oneOf = values;
return validate;
}
function assertNodeType(...types) {
function validate(node, key, val) {
for (const type of types) {
if ((0, _is.default)(type, val)) {
(0, _validate.validateChild)(node, key, val);
return;
}
}
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`);
}
validate.oneOfNodeTypes = types;
return validate;
}
function assertNodeOrValueType(...types) {
function validate(node, key, val) {
for (const type of types) {
if (getType(val) === type || (0, _is.default)(type, val)) {
(0, _validate.validateChild)(node, key, val);
return;
}
}
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`);
}
validate.oneOfNodeOrValueTypes = types;
return validate;
}
function assertValueType(type) {
function validate(node, key, val) {
const valid = getType(val) === type;
if (!valid) {
throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`);
}
}
validate.type = type;
return validate;
}
function assertShape(shape) {
function validate(node, key, val) {
const errors = [];
for (const property of Object.keys(shape)) {
try {
(0, _validate.validateField)(node, property, val[property], shape[property]);
} catch (error) {
if (error instanceof TypeError) {
errors.push(error.message);
continue;
}
throw error;
}
}
if (errors.length) {
throw new TypeError(`Property ${key} of ${node.type} expected to have the following:\n${errors.join("\n")}`);
}
}
validate.shapeOf = shape;
return validate;
}
function assertOptionalChainStart() {
function validate(node) {
var _current;
let current = node;
while (node) {
const {
type
} = current;
if (type === "OptionalCallExpression") {
if (current.optional) return;
current = current.callee;
continue;
}
if (type === "OptionalMemberExpression") {
if (current.optional) return;
current = current.object;
continue;
}
break;
}
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${(_current = current) == null ? void 0 : _current.type}`);
}
return validate;
}
function chain(...fns) {
function validate(...args) {
for (const fn of fns) {
fn(...args);
}
}
validate.chainOf = fns;
return validate;
}
const validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"];
const validFieldKeys = ["default", "optional", "validate"];
function defineType(type, opts = {}) {
const inherits = opts.inherits && store[opts.inherits] || {};
let fields = opts.fields;
if (!fields) {
fields = {};
if (inherits.fields) {
const keys = Object.getOwnPropertyNames(inherits.fields);
for (const key of keys) {
const field = inherits.fields[key];
fields[key] = {
default: field.default,
optional: field.optional,
validate: field.validate
};
}
}
}
const visitor = opts.visitor || inherits.visitor || [];
const aliases = opts.aliases || inherits.aliases || [];
const builder = opts.builder || inherits.builder || opts.visitor || [];
for (const k of Object.keys(opts)) {
if (validTypeOpts.indexOf(k) === -1) {
throw new Error(`Unknown type option "${k}" on ${type}`);
}
}
if (opts.deprecatedAlias) {
DEPRECATED_KEYS[opts.deprecatedAlias] = type;
}
for (const key of visitor.concat(builder)) {
fields[key] = fields[key] || {};
}
for (const key of Object.keys(fields)) {
const field = fields[key];
if (field.default !== undefined && builder.indexOf(key) === -1) {
field.optional = true;
}
if (field.default === undefined) {
field.default = null;
} else if (!field.validate && field.default != null) {
field.validate = assertValueType(getType(field.default));
}
for (const k of Object.keys(field)) {
if (validFieldKeys.indexOf(k) === -1) {
throw new Error(`Unknown field key "${k}" on ${type}.${key}`);
}
}
}
VISITOR_KEYS[type] = opts.visitor = visitor;
BUILDER_KEYS[type] = opts.builder = builder;
NODE_FIELDS[type] = opts.fields = fields;
ALIAS_KEYS[type] = opts.aliases = aliases;
aliases.forEach(alias => {
FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || [];
FLIPPED_ALIAS_KEYS[alias].push(type);
});
if (opts.validate) {
NODE_PARENT_VALIDATIONS[type] = opts.validate;
}
store[type] = opts;
}
const store = {};
/***/ }),
/* 572 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parse = parse;
exports.parseConsoleScript = parseConsoleScript;
exports.parseScript = parseScript;
exports.getAst = getAst;
exports.clearASTs = clearASTs;
exports.traverseAst = traverseAst;
exports.hasNode = hasNode;
exports.replaceNode = replaceNode;
var _parseScriptTags = _interopRequireDefault(__webpack_require__(838));
var babelParser = _interopRequireWildcard(__webpack_require__(685));
var t = _interopRequireWildcard(__webpack_require__(2));
var _isEmpty = _interopRequireDefault(__webpack_require__(686));
var _sources = __webpack_require__(687);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
let ASTs = new Map();
function _parse(code, opts) {
return babelParser.parse(code, { ...opts,
tokens: true
});
}
const sourceOptions = {
generated: {
sourceType: "unambiguous",
tokens: true,
plugins: ["classProperties", "objectRestSpread", "optionalChaining", "nullishCoalescingOperator"]
},
original: {
sourceType: "unambiguous",
tokens: true,
plugins: ["jsx", "flow", "doExpressions", "optionalChaining", "nullishCoalescingOperator", "decorators-legacy", "objectRestSpread", "classProperties", "exportDefaultFrom", "exportNamespaceFrom", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "react-jsx"]
}
};
function parse(text, opts) {
let ast;
if (!text) {
return;
}
try {
ast = _parse(text, opts);
} catch (error) {
console.error(error);
ast = {};
}
return ast;
} // Custom parser for parse-script-tags that adapts its input structure to
// our parser's signature
function htmlParser({
source,
line
}) {
return parse(source, {
startLine: line,
...sourceOptions.generated
});
}
const VUE_COMPONENT_START = /^\s*;
function vueParser({
source,
line
}) {
return parse(source, {
startLine: line,
...sourceOptions.original
});
}
function parseVueScript(code) {
if (typeof code !== "string") {
return;
}
let ast; // .vue files go through several passes, so while there is a
// single-file-component Vue template, there are also generally .vue files
// that are still just JS as well.
if (code.match(VUE_COMPONENT_START)) {
ast = (0, _parseScriptTags.default)(code, vueParser);
if (t.isFile(ast)) {
// parseScriptTags is currently hard-coded to return scripts, but Vue
// always expects ESM syntax, so we just hard-code it.
ast.program.sourceType = "module";
}
} else {
ast = parse(code, sourceOptions.original);
}
return ast;
}
function parseConsoleScript(text, opts) {
try {
return _parse(text, {
plugins: ["objectRestSpread", "dynamicImport", "nullishCoalescingOperator", "optionalChaining"],
...opts,
allowAwaitOutsideFunction: true
});
} catch (e) {
return null;
}
}
function parseScript(text, opts) {
return _parse(text, opts);
}
function getAst(sourceId) {
if (ASTs.has(sourceId)) {
return ASTs.get(sourceId);
}
const source = (0, _sources.getSource)(sourceId);
if (source.isWasm) {
return null;
}
let ast = {};
const {
contentType
} = source;
if (contentType == "text/html") {
ast = (0, _parseScriptTags.default)(source.text, htmlParser) || {};
} else if (contentType && contentType === "text/vue") {
ast = parseVueScript(source.text) || {};
} else if (contentType && contentType.match(/(javascript|jsx)/) && !contentType.match(/typescript-jsx/)) {
const type = source.id.includes("original") ? "original" : "generated";
const options = sourceOptions[type];
ast = parse(source.text, options);
} else if (contentType && contentType.match(/typescript/)) {
const options = { ...sourceOptions.original,
plugins: [...sourceOptions.original.plugins.filter(p => p !== "flow" && p !== "decorators" && p !== "decorators2" && (p !== "jsx" || contentType.match(/typescript-jsx/))), "decorators-legacy", "typescript"]
};
ast = parse(source.text, options);
}
ASTs.set(source.id, ast);
return ast;
}
function clearASTs() {
ASTs = new Map();
}
function traverseAst(sourceId, visitor, state) {
const ast = getAst(sourceId);
if ((0, _isEmpty.default)(ast)) {
return null;
}
t.traverse(ast, visitor, state);
return ast;
}
function hasNode(rootNode, predicate) {
try {
t.traverse(rootNode, {
enter: (node, ancestors) => {
if (predicate(node, ancestors)) {
throw new Error("MATCH");
}
}
});
} catch (e) {
if (e.message === "MATCH") {
return true;
}
}
return false;
}
function replaceNode(ancestors, node) {
const parent = ancestors[ancestors.length - 1];
if (typeof parent.index === "number") {
if (Array.isArray(node)) {
parent.node[parent.key].splice(parent.index, 1, ...node);
} else {
parent.node[parent.key][parent.index] = node;
}
} else {
parent.node[parent.key] = node;
}
}
/***/ }),
/* 573 */
/***/ (function(module, exports) {
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ }),
/* 574 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsNative = __webpack_require__(732),
getValue = __webpack_require__(735);
/**
* Gets the native function at `key` of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {string} key The key of the method to get.
* @returns {*} Returns the function if it's native, else `undefined`.
*/
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
module.exports = getNative;
/***/ }),
/* 575 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = void 0;
const STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
exports.STATEMENT_OR_BLOCK_KEYS = STATEMENT_OR_BLOCK_KEYS;
const FLATTENABLE_KEYS = ["body", "expressions"];
exports.FLATTENABLE_KEYS = FLATTENABLE_KEYS;
const FOR_INIT_KEYS = ["left", "init"];
exports.FOR_INIT_KEYS = FOR_INIT_KEYS;
const COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"];
exports.COMMENT_KEYS = COMMENT_KEYS;
const LOGICAL_OPERATORS = ["||", "&&", "??"];
exports.LOGICAL_OPERATORS = LOGICAL_OPERATORS;
const UPDATE_OPERATORS = ["++", "--"];
exports.UPDATE_OPERATORS = UPDATE_OPERATORS;
const BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="];
exports.BOOLEAN_NUMBER_BINARY_OPERATORS = BOOLEAN_NUMBER_BINARY_OPERATORS;
const EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="];
exports.EQUALITY_BINARY_OPERATORS = EQUALITY_BINARY_OPERATORS;
const COMPARISON_BINARY_OPERATORS = [...EQUALITY_BINARY_OPERATORS, "in", "instanceof"];
exports.COMPARISON_BINARY_OPERATORS = COMPARISON_BINARY_OPERATORS;
const BOOLEAN_BINARY_OPERATORS = [...COMPARISON_BINARY_OPERATORS, ...BOOLEAN_NUMBER_BINARY_OPERATORS];
exports.BOOLEAN_BINARY_OPERATORS = BOOLEAN_BINARY_OPERATORS;
const NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"];
exports.NUMBER_BINARY_OPERATORS = NUMBER_BINARY_OPERATORS;
const BINARY_OPERATORS = ["+", ...NUMBER_BINARY_OPERATORS, ...BOOLEAN_BINARY_OPERATORS];
exports.BINARY_OPERATORS = BINARY_OPERATORS;
const ASSIGNMENT_OPERATORS = ["=", "+=", ...NUMBER_BINARY_OPERATORS.map(op => op + "="), ...LOGICAL_OPERATORS.map(op => op + "=")];
exports.ASSIGNMENT_OPERATORS = ASSIGNMENT_OPERATORS;
const BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
exports.BOOLEAN_UNARY_OPERATORS = BOOLEAN_UNARY_OPERATORS;
const NUMBER_UNARY_OPERATORS = ["+", "-", "~"];
exports.NUMBER_UNARY_OPERATORS = NUMBER_UNARY_OPERATORS;
const STRING_UNARY_OPERATORS = ["typeof"];
exports.STRING_UNARY_OPERATORS = STRING_UNARY_OPERATORS;
const UNARY_OPERATORS = ["void", "throw", ...BOOLEAN_UNARY_OPERATORS, ...NUMBER_UNARY_OPERATORS, ...STRING_UNARY_OPERATORS];
exports.UNARY_OPERATORS = UNARY_OPERATORS;
const INHERIT_KEYS = {
optional: ["typeAnnotation", "typeParameters", "returnType"],
force: ["start", "loc", "end"]
};
exports.INHERIT_KEYS = INHERIT_KEYS;
const BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped");
exports.BLOCK_SCOPED_SYMBOL = BLOCK_SCOPED_SYMBOL;
const NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding");
exports.NOT_LOCAL_BINDING = NOT_LOCAL_BINDING;
/***/ }),
/* 576 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cloneNode;
var _definitions = __webpack_require__(564);
const has = Function.call.bind(Object.prototype.hasOwnProperty);
function cloneIfNode(obj, deep, withoutLoc) {
if (obj && typeof obj.type === "string") {
return cloneNode(obj, deep, withoutLoc);
}
return obj;
}
function cloneIfNodeOrArray(obj, deep, withoutLoc) {
if (Array.isArray(obj)) {
return obj.map(node => cloneIfNode(node, deep, withoutLoc));
}
return cloneIfNode(obj, deep, withoutLoc);
}
function cloneNode(node, deep = true, withoutLoc = false) {
if (!node) return node;
const {
type
} = node;
const newNode = {
type
};
if (type === "Identifier") {
newNode.name = node.name;
if (has(node, "optional") && typeof node.optional === "boolean") {
newNode.optional = node.optional;
}
if (has(node, "typeAnnotation")) {
newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc) : node.typeAnnotation;
}
} else if (!has(_definitions.NODE_FIELDS, type)) {
throw new Error(`Unknown node type: "${type}"`);
} else {
for (const field of Object.keys(_definitions.NODE_FIELDS[type])) {
if (has(node, field)) {
if (deep) {
newNode[field] = type === "File" && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc) : cloneIfNodeOrArray(node[field], true, withoutLoc);
} else {
newNode[field] = node[field];
}
}
}
}
if (has(node, "loc")) {
if (withoutLoc) {
newNode.loc = null;
} else {
newNode.loc = node.loc;
}
}
if (has(node, "leadingComments")) {
newNode.leadingComments = maybeCloneComments(node.leadingComments, deep, withoutLoc);
}
if (has(node, "innerComments")) {
newNode.innerComments = maybeCloneComments(node.innerComments, deep, withoutLoc);
}
if (has(node, "trailingComments")) {
newNode.trailingComments = maybeCloneComments(node.trailingComments, deep, withoutLoc);
}
if (has(node, "extra")) {
newNode.extra = Object.assign({}, node.extra);
}
return newNode;
}
function cloneCommentsWithoutLoc(comments) {
return comments.map(({
type,
value
}) => ({
type,
value,
loc: null
}));
}
function maybeCloneComments(comments, deep, withoutLoc) {
return deep && withoutLoc ? cloneCommentsWithoutLoc(comments) : comments;
}
/***/ }),
/* 577 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(569),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
}
module.exports = isSymbol;
/***/ }),
/* 578 */
/***/ (function(module, exports, __webpack_require__) {
var DataView = __webpack_require__(765),
Map = __webpack_require__(614),
Promise = __webpack_require__(766),
Set = __webpack_require__(664),
WeakMap = __webpack_require__(767),
baseGetTag = __webpack_require__(569),
toSource = __webpack_require__(652);
/** `Object#toString` result references. */
var mapTag = '[object Map]',
objectTag = '[object Object]',
promiseTag = '[object Promise]',
setTag = '[object Set]',
weakMapTag = '[object WeakMap]';
var dataViewTag = '[object DataView]';
/** Used to detect maps, sets, and weakmaps. */
var dataViewCtorString = toSource(DataView),
mapCtorString = toSource(Map),
promiseCtorString = toSource(Promise),
setCtorString = toSource(Set),
weakMapCtorString = toSource(WeakMap);
/**
* Gets the `toStringTag` of `value`.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
var getTag = baseGetTag;
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
(Map && getTag(new Map) != mapTag) ||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
(Set && getTag(new Set) != setTag) ||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
getTag = function(value) {
var result = baseGetTag(value),
Ctor = result == objectTag ? value.constructor : undefined,
ctorString = Ctor ? toSource(Ctor) : '';
if (ctorString) {
switch (ctorString) {
case dataViewCtorString: return dataViewTag;
case mapCtorString: return mapTag;
case promiseCtorString: return promiseTag;
case setCtorString: return setTag;
case weakMapCtorString: return weakMapTag;
}
}
return result;
};
}
module.exports = getTag;
/***/ }),
/* 579 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = is;
var _shallowEqual = _interopRequireDefault(__webpack_require__(612));
var _isType = _interopRequireDefault(__webpack_require__(626));
var _isPlaceholderType = _interopRequireDefault(__webpack_require__(666));
var _definitions = __webpack_require__(564);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function is(type, node, opts) {
if (!node) return false;
const matches = (0, _isType.default)(node.type, type);
if (!matches) {
if (!opts && node.type === "Placeholder" && type in _definitions.FLIPPED_ALIAS_KEYS) {
return (0, _isPlaceholderType.default)(node.expectedNode, type);
}
return false;
}
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
/***/ }),
/* 580 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isValidIdentifier;
var _helperValidatorIdentifier = __webpack_require__(667);
function isValidIdentifier(name, reserved = true) {
if (typeof name !== "string") return false;
if (reserved) {
if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name)) {
return false;
} else if (name === "await") {
return false;
}
}
return (0, _helperValidatorIdentifier.isIdentifierName)(name);
}
/***/ }),
/* 581 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var base64VLQ = __webpack_require__(582);
var util = __webpack_require__(566);
var ArraySet = __webpack_require__(583).ArraySet;
var MappingList = __webpack_require__(634).MappingList;
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. You may pass an object with the following
* properties:
*
* - file: The filename of the generated source.
* - sourceRoot: A root for all relative URLs in this source map.
*/
function SourceMapGenerator(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, 'file', null);
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap =
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
});
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
SourceMapGenerator.prototype.addMapping =
function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
});
};
/**
* Set the source content for a source file.
*/
SourceMapGenerator.prototype.setSourceContent =
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param aSourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
SourceMapGenerator.prototype.applySourceMap =
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
var sourceFile = aSourceFile;
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
'or the source map\'s "file" property. Both were omitted.'
);
}
sourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot;
// Make "sourceFile" relative if an absolute Url is passed.
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
// Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet();
// Find mappings for the "sourceFile"
this._mappings.unsortedForEach(function (mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source)
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
// Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aSourceMapPath != null) {
sourceFile = util.join(aSourceMapPath, sourceFile);
}
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
};
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping =
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
aName) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
throw new Error(
'original.line and original.column are not numbers -- you probably meant to omit ' +
'the original mapping entirely and only map the generated position. If so, pass ' +
'null for the original mapping instead of an object with empty or null values.'
);
}
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
// Case 1.
return;
}
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
// Cases 2 and 3.
return;
}
else {
throw new Error('Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
};
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
SourceMapGenerator.prototype._serializeMappings =
function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var next;
var mapping;
var nameIdx;
var sourceIdx;
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = ''
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ';';
previousGeneratedLine++;
}
}
else {
if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ',';
}
}
next += base64VLQ.encode(mapping.generatedColumn
- previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx;
// lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1
- previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn
- previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
};
SourceMapGenerator.prototype._generateSourcesContent =
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function (source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util.relative(aSourceRoot, source);
}
var key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
? this._sourcesContents[key]
: null;
}, this);
};
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON =
function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString =
function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
exports.SourceMapGenerator = SourceMapGenerator;
/***/ }),
/* 582 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var base64 = __webpack_require__(633);
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5;
// binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0
? ((-aValue) << 1) + 1
: (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string via the out parameter.
*/
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (aIndex >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charCodeAt(aIndex++));
if (digit === -1) {
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
}
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
};
/***/ }),
/* 583 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(566);
var has = Object.prototype.hasOwnProperty;
var hasNativeMap = typeof Map !== "undefined";
/**
* A data structure which is a combination of an array and a set. Adding a new
* member is O(1), testing for membership is O(1), and finding the index of an
* element is O(1). Removing elements from the set is not supported. Only
* strings are supported for membership.
*/
function ArraySet() {
this._array = [];
this._set = hasNativeMap ? new Map() : Object.create(null);
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
};
/**
* Return how many unique items are in this ArraySet. If duplicates have been
* added, than those do not count towards the size.
*
* @returns Number
*/
ArraySet.prototype.size = function ArraySet_size() {
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
};
/**
* Add the given string to this set.
*
* @param String aStr
*/
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
if (hasNativeMap) {
this._set.set(aStr, idx);
} else {
this._set[sStr] = idx;
}
}
};
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
ArraySet.prototype.has = function ArraySet_has(aStr) {
if (hasNativeMap) {
return this._set.has(aStr);
} else {
var sStr = util.toSetString(aStr);
return has.call(this._set, sStr);
}
};
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (hasNativeMap) {
var idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
} else {
var sStr = util.toSetString(aStr);
if (has.call(this._set, sStr)) {
return this._set[sStr];
}
}
throw new Error('"' + aStr + '" is not in the set.');
};
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
};
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports.ArraySet = ArraySet;
/***/ }),
/* 584 */,
/* 585 */,
/* 586 */
/***/ (function(module, exports, __webpack_require__) {
var listCacheClear = __webpack_require__(722),
listCacheDelete = __webpack_require__(723),
listCacheGet = __webpack_require__(724),
listCacheHas = __webpack_require__(725),
listCacheSet = __webpack_require__(726);
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ }),
/* 587 */
/***/ (function(module, exports, __webpack_require__) {
var eq = __webpack_require__(588);
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
/***/ }),
/* 588 */
/***/ (function(module, exports) {
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
module.exports = eq;
/***/ }),
/* 589 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(590)))
/***/ }),
/* 590 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 591 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574);
/* Built-in method references that are verified to be native. */
var nativeCreate = getNative(Object, 'create');
module.exports = nativeCreate;
/***/ }),
/* 592 */
/***/ (function(module, exports, __webpack_require__) {
var isKeyable = __webpack_require__(744);
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
module.exports = getMapData;
/***/ }),
/* 593 */
/***/ (function(module, exports, __webpack_require__) {
var assignValue = __webpack_require__(653),
baseAssignValue = __webpack_require__(654);
/**
* Copies properties of `source` to `object`.
*
* @private
* @param {Object} source The object to copy properties from.
* @param {Array} props The property identifiers to copy.
* @param {Object} [object={}] The object to copy properties to.
* @param {Function} [customizer] The function to customize copied values.
* @returns {Object} Returns `object`.
*/
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer
? customizer(object[key], source[key], key, object, source)
: undefined;
if (newValue === undefined) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
}
module.exports = copyObject;
/***/ }),
/* 594 */
/***/ (function(module, exports, __webpack_require__) {
var arrayLikeKeys = __webpack_require__(655),
baseKeys = __webpack_require__(656),
isArrayLike = __webpack_require__(599);
/**
* Creates an array of the own enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects. See the
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* for more details.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keys(new Foo);
* // => ['a', 'b'] (iteration order is not guaranteed)
*
* _.keys('hi');
* // => ['0', '1']
*/
function keys(object) {
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
}
module.exports = keys;
/***/ }),
/* 595 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(562),
stubFalse = __webpack_require__(753);
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
/**
* Checks if `value` is a buffer.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
* @example
*
* _.isBuffer(new Buffer(2));
* // => true
*
* _.isBuffer(new Uint8Array(2));
* // => false
*/
var isBuffer = nativeIsBuffer || stubFalse;
module.exports = isBuffer;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(619)(module)))
/***/ }),
/* 596 */
/***/ (function(module, exports) {
/**
* The base implementation of `_.unary` without support for storing metadata.
*
* @private
* @param {Function} func The function to cap arguments for.
* @returns {Function} Returns the new capped function.
*/
function baseUnary(func) {
return function(value) {
return func(value);
};
}
module.exports = baseUnary;
/***/ }),
/* 597 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var freeGlobal = __webpack_require__(589);
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Detect free variable `process` from Node.js. */
var freeProcess = moduleExports && freeGlobal.process;
/** Used to access faster Node.js helpers. */
var nodeUtil = (function() {
try {
// Use `util.types` for Node.js 10+.
var types = freeModule && freeModule.require && freeModule.require('util').types;
if (types) {
return types;
}
// Legacy `process.binding('util')` for Node.js < 10.
return freeProcess && freeProcess.binding && freeProcess.binding('util');
} catch (e) {}
}());
module.exports = nodeUtil;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(619)(module)))
/***/ }),
/* 598 */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Checks if `value` is likely a prototype object.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
*/
function isPrototype(value) {
var Ctor = value && value.constructor,
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
return value === proto;
}
module.exports = isPrototype;
/***/ }),
/* 599 */
/***/ (function(module, exports, __webpack_require__) {
var isFunction = __webpack_require__(651),
isLength = __webpack_require__(622);
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
module.exports = isArrayLike;
/***/ }),
/* 600 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0;
var _is = _interopRequireDefault(__webpack_require__(579));
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(580));
var _helperValidatorIdentifier = __webpack_require__(667);
var _constants = __webpack_require__(575);
var _utils = _interopRequireWildcard(__webpack_require__(571));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
(0, _utils.default)("ArrayExpression", {
fields: {
elements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "Expression", "SpreadElement"))),
default: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? [] : undefined
}
},
visitor: ["elements"],
aliases: ["Expression"]
});
(0, _utils.default)("AssignmentExpression", {
fields: {
operator: {
validate: function () {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) {
return (0, _utils.assertValueType)("string");
}
const identifier = (0, _utils.assertOneOf)(..._constants.ASSIGNMENT_OPERATORS);
const pattern = (0, _utils.assertOneOf)("=");
return function (node, key, val) {
const validator = (0, _is.default)("Pattern", node.left) ? pattern : identifier;
validator(node, key, val);
};
}()
},
left: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern")
},
right: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
builder: ["operator", "left", "right"],
visitor: ["left", "right"],
aliases: ["Expression"]
});
(0, _utils.default)("BinaryExpression", {
builder: ["operator", "left", "right"],
fields: {
operator: {
validate: (0, _utils.assertOneOf)(..._constants.BINARY_OPERATORS)
},
left: {
validate: function () {
const expression = (0, _utils.assertNodeType)("Expression");
const inOp = (0, _utils.assertNodeType)("Expression", "PrivateName");
const validator = function (node, key, val) {
const validator = node.operator === "in" ? inOp : expression;
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "PrivateName"];
return validator;
}()
},
right: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
visitor: ["left", "right"],
aliases: ["Binary", "Expression"]
});
(0, _utils.default)("InterpreterDirective", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
}
});
(0, _utils.default)("Directive", {
visitor: ["value"],
fields: {
value: {
validate: (0, _utils.assertNodeType)("DirectiveLiteral")
}
}
});
(0, _utils.default)("DirectiveLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
}
});
(0, _utils.default)("BlockStatement", {
builder: ["body", "directives"],
visitor: ["directives", "body"],
fields: {
directives: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))),
default: []
},
body: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
}
},
aliases: ["Scopable", "BlockParent", "Block", "Statement"]
});
(0, _utils.default)("BreakStatement", {
visitor: ["label"],
fields: {
label: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
}
},
aliases: ["Statement", "Terminatorless", "CompletionStatement"]
});
(0, _utils.default)("CallExpression", {
visitor: ["callee", "arguments", "typeParameters", "typeArguments"],
builder: ["callee", "arguments"],
aliases: ["Expression"],
fields: Object.assign({
callee: {
validate: (0, _utils.assertNodeType)("Expression", "V8IntrinsicIdentifier")
},
arguments: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName", "ArgumentPlaceholder")))
}
}, !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? {
optional: {
validate: (0, _utils.assertOneOf)(true, false),
optional: true
}
} : {}, {
typeArguments: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
optional: true
}
})
});
(0, _utils.default)("CatchClause", {
visitor: ["param", "body"],
fields: {
param: {
validate: (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern"),
optional: true
},
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
},
aliases: ["Scopable", "BlockParent"]
});
(0, _utils.default)("ConditionalExpression", {
visitor: ["test", "consequent", "alternate"],
fields: {
test: {
validate: (0, _utils.assertNodeType)("Expression")
},
consequent: {
validate: (0, _utils.assertNodeType)("Expression")
},
alternate: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
aliases: ["Expression", "Conditional"]
});
(0, _utils.default)("ContinueStatement", {
visitor: ["label"],
fields: {
label: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
}
},
aliases: ["Statement", "Terminatorless", "CompletionStatement"]
});
(0, _utils.default)("DebuggerStatement", {
aliases: ["Statement"]
});
(0, _utils.default)("DoWhileStatement", {
visitor: ["test", "body"],
fields: {
test: {
validate: (0, _utils.assertNodeType)("Expression")
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
}
},
aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"]
});
(0, _utils.default)("EmptyStatement", {
aliases: ["Statement"]
});
(0, _utils.default)("ExpressionStatement", {
visitor: ["expression"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
aliases: ["Statement", "ExpressionWrapper"]
});
(0, _utils.default)("File", {
builder: ["program", "comments", "tokens"],
visitor: ["program"],
fields: {
program: {
validate: (0, _utils.assertNodeType)("Program")
},
comments: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? Object.assign(() => {}, {
each: {
oneOfNodeTypes: ["CommentBlock", "CommentLine"]
}
}) : (0, _utils.assertEach)((0, _utils.assertNodeType)("CommentBlock", "CommentLine")),
optional: true
},
tokens: {
validate: (0, _utils.assertEach)(Object.assign(() => {}, {
type: "any"
})),
optional: true
}
}
});
(0, _utils.default)("ForInStatement", {
visitor: ["left", "right", "body"],
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
fields: {
left: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("VariableDeclaration", "LVal") : (0, _utils.assertNodeType)("VariableDeclaration", "Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern")
},
right: {
validate: (0, _utils.assertNodeType)("Expression")
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
}
}
});
(0, _utils.default)("ForStatement", {
visitor: ["init", "test", "update", "body"],
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"],
fields: {
init: {
validate: (0, _utils.assertNodeType)("VariableDeclaration", "Expression"),
optional: true
},
test: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
},
update: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
}
}
});
const functionCommon = {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty")))
},
generator: {
default: false
},
async: {
default: false
}
};
exports.functionCommon = functionCommon;
const functionTypeAnnotationCommon = {
returnType: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true
}
};
exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
const functionDeclarationCommon = Object.assign({}, functionCommon, {
declare: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
id: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
}
});
exports.functionDeclarationCommon = functionDeclarationCommon;
(0, _utils.default)("FunctionDeclaration", {
builder: ["id", "params", "body", "generator", "async"],
visitor: ["id", "params", "body", "returnType", "typeParameters"],
fields: Object.assign({}, functionDeclarationCommon, functionTypeAnnotationCommon, {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
}),
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"],
validate: function () {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return () => {};
const identifier = (0, _utils.assertNodeType)("Identifier");
return function (parent, key, node) {
if (!(0, _is.default)("ExportDefaultDeclaration", parent)) {
identifier(node, "id", node.id);
}
};
}()
});
(0, _utils.default)("FunctionExpression", {
inherits: "FunctionDeclaration",
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
id: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
},
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
})
});
const patternLikeCommon = {
typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator")))
}
};
exports.patternLikeCommon = patternLikeCommon;
(0, _utils.default)("Identifier", {
builder: ["name"],
visitor: ["typeAnnotation", "decorators"],
aliases: ["Expression", "PatternLike", "LVal", "TSEntityName"],
fields: Object.assign({}, patternLikeCommon, {
name: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (!(0, _isValidIdentifier.default)(val, false)) {
throw new TypeError(`"${val}" is not a valid identifier name`);
}
}, {
type: "string"
}))
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
}),
validate(parent, key, node) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
const match = /\.(\w+)$/.exec(key);
if (!match) return;
const [, parentKey] = match;
const nonComp = {
computed: false
};
if (parentKey === "property") {
if ((0, _is.default)("MemberExpression", parent, nonComp)) return;
if ((0, _is.default)("OptionalMemberExpression", parent, nonComp)) return;
} else if (parentKey === "key") {
if ((0, _is.default)("Property", parent, nonComp)) return;
if ((0, _is.default)("Method", parent, nonComp)) return;
} else if (parentKey === "exported") {
if ((0, _is.default)("ExportSpecifier", parent)) return;
} else if (parentKey === "imported") {
if ((0, _is.default)("ImportSpecifier", parent, {
imported: node
})) return;
} else if (parentKey === "meta") {
if ((0, _is.default)("MetaProperty", parent, {
meta: node
})) return;
}
if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name)) && node.name !== "this") {
throw new TypeError(`"${node.name}" is not a valid identifier`);
}
}
});
(0, _utils.default)("IfStatement", {
visitor: ["test", "consequent", "alternate"],
aliases: ["Statement", "Conditional"],
fields: {
test: {
validate: (0, _utils.assertNodeType)("Expression")
},
consequent: {
validate: (0, _utils.assertNodeType)("Statement")
},
alternate: {
optional: true,
validate: (0, _utils.assertNodeType)("Statement")
}
}
});
(0, _utils.default)("LabeledStatement", {
visitor: ["label", "body"],
aliases: ["Statement"],
fields: {
label: {
validate: (0, _utils.assertNodeType)("Identifier")
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
}
}
});
(0, _utils.default)("StringLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("NumericLiteral", {
builder: ["value"],
deprecatedAlias: "NumberLiteral",
fields: {
value: {
validate: (0, _utils.assertValueType)("number")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("NullLiteral", {
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("BooleanLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("boolean")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("RegExpLiteral", {
builder: ["pattern", "flags"],
deprecatedAlias: "RegexLiteral",
aliases: ["Expression", "Pureish", "Literal"],
fields: {
pattern: {
validate: (0, _utils.assertValueType)("string")
},
flags: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
const invalid = /[^gimsuy]/.exec(val);
if (invalid) {
throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`);
}
}, {
type: "string"
})),
default: ""
}
}
});
(0, _utils.default)("LogicalExpression", {
builder: ["operator", "left", "right"],
visitor: ["left", "right"],
aliases: ["Binary", "Expression"],
fields: {
operator: {
validate: (0, _utils.assertOneOf)(..._constants.LOGICAL_OPERATORS)
},
left: {
validate: (0, _utils.assertNodeType)("Expression")
},
right: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("MemberExpression", {
builder: ["object", "property", "computed", "optional"],
visitor: ["object", "property"],
aliases: ["Expression", "LVal"],
fields: Object.assign({
object: {
validate: (0, _utils.assertNodeType)("Expression")
},
property: {
validate: function () {
const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName");
const computed = (0, _utils.assertNodeType)("Expression");
const validator = function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "Identifier", "PrivateName"];
return validator;
}()
},
computed: {
default: false
}
}, !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? {
optional: {
validate: (0, _utils.assertOneOf)(true, false),
optional: true
}
} : {})
});
(0, _utils.default)("NewExpression", {
inherits: "CallExpression"
});
(0, _utils.default)("Program", {
visitor: ["directives", "body"],
builder: ["body", "directives", "sourceType", "interpreter"],
fields: {
sourceFile: {
validate: (0, _utils.assertValueType)("string")
},
sourceType: {
validate: (0, _utils.assertOneOf)("script", "module"),
default: "script"
},
interpreter: {
validate: (0, _utils.assertNodeType)("InterpreterDirective"),
default: null,
optional: true
},
directives: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Directive"))),
default: []
},
body: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
}
},
aliases: ["Scopable", "BlockParent", "Block"]
});
(0, _utils.default)("ObjectExpression", {
visitor: ["properties"],
aliases: ["Expression"],
fields: {
properties: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadElement")))
}
}
});
(0, _utils.default)("ObjectMethod", {
builder: ["kind", "key", "params", "body", "computed", "generator", "async"],
fields: Object.assign({}, functionCommon, functionTypeAnnotationCommon, {
kind: Object.assign({
validate: (0, _utils.assertOneOf)("method", "get", "set")
}, !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? {
default: "method"
} : {}),
computed: {
default: false
},
key: {
validate: function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
const computed = (0, _utils.assertNodeType)("Expression");
const validator = function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral"];
return validator;
}()
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
}),
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"]
});
(0, _utils.default)("ObjectProperty", {
builder: ["key", "value", "computed", "shorthand", ...(!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? ["decorators"] : [])],
fields: {
computed: {
default: false
},
key: {
validate: function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
const computed = (0, _utils.assertNodeType)("Expression");
const validator = function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral"];
return validator;
}()
},
value: {
validate: (0, _utils.assertNodeType)("Expression", "PatternLike")
},
shorthand: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), Object.assign(function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (val && node.computed) {
throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true");
}
}, {
type: "boolean"
}), function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (val && !(0, _is.default)("Identifier", node.key)) {
throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier");
}
}),
default: false
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
},
visitor: ["key", "value", "decorators"],
aliases: ["UserWhitespacable", "Property", "ObjectMember"],
validate: function () {
const pattern = (0, _utils.assertNodeType)("Identifier", "Pattern");
const expression = (0, _utils.assertNodeType)("Expression");
return function (parent, key, node) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
const validator = (0, _is.default)("ObjectPattern", parent) ? pattern : expression;
validator(node, "value", node.value);
};
}()
});
(0, _utils.default)("RestElement", {
visitor: ["argument", "typeAnnotation"],
builder: ["argument"],
aliases: ["LVal", "PatternLike"],
deprecatedAlias: "RestProperty",
fields: Object.assign({}, patternLikeCommon, {
argument: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("LVal") : (0, _utils.assertNodeType)("Identifier", "Pattern", "MemberExpression")
}
}),
validate(parent, key) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
const match = /(\w+)\[(\d+)\]/.exec(key);
if (!match) throw new Error("Internal Babel error: malformed key.");
const [, listKey, index] = match;
if (parent[listKey].length > index + 1) {
throw new TypeError(`RestElement must be last element of ${listKey}`);
}
}
});
(0, _utils.default)("ReturnStatement", {
visitor: ["argument"],
aliases: ["Statement", "Terminatorless", "CompletionStatement"],
fields: {
argument: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
}
}
});
(0, _utils.default)("SequenceExpression", {
visitor: ["expressions"],
fields: {
expressions: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression")))
}
},
aliases: ["Expression"]
});
(0, _utils.default)("ParenthesizedExpression", {
visitor: ["expression"],
aliases: ["Expression", "ExpressionWrapper"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("SwitchCase", {
visitor: ["test", "consequent"],
fields: {
test: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
},
consequent: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
}
}
});
(0, _utils.default)("SwitchStatement", {
visitor: ["discriminant", "cases"],
aliases: ["Statement", "BlockParent", "Scopable"],
fields: {
discriminant: {
validate: (0, _utils.assertNodeType)("Expression")
},
cases: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("SwitchCase")))
}
}
});
(0, _utils.default)("ThisExpression", {
aliases: ["Expression"]
});
(0, _utils.default)("ThrowStatement", {
visitor: ["argument"],
aliases: ["Statement", "Terminatorless", "CompletionStatement"],
fields: {
argument: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("TryStatement", {
visitor: ["block", "handler", "finalizer"],
aliases: ["Statement"],
fields: {
block: {
validate: (0, _utils.chain)((0, _utils.assertNodeType)("BlockStatement"), Object.assign(function (node) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (!node.handler && !node.finalizer) {
throw new TypeError("TryStatement expects either a handler or finalizer, or both");
}
}, {
oneOfNodeTypes: ["BlockStatement"]
}))
},
handler: {
optional: true,
validate: (0, _utils.assertNodeType)("CatchClause")
},
finalizer: {
optional: true,
validate: (0, _utils.assertNodeType)("BlockStatement")
}
}
});
(0, _utils.default)("UnaryExpression", {
builder: ["operator", "argument", "prefix"],
fields: {
prefix: {
default: true
},
argument: {
validate: (0, _utils.assertNodeType)("Expression")
},
operator: {
validate: (0, _utils.assertOneOf)(..._constants.UNARY_OPERATORS)
}
},
visitor: ["argument"],
aliases: ["UnaryLike", "Expression"]
});
(0, _utils.default)("UpdateExpression", {
builder: ["operator", "argument", "prefix"],
fields: {
prefix: {
default: false
},
argument: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? (0, _utils.assertNodeType)("Expression") : (0, _utils.assertNodeType)("Identifier", "MemberExpression")
},
operator: {
validate: (0, _utils.assertOneOf)(..._constants.UPDATE_OPERATORS)
}
},
visitor: ["argument"],
aliases: ["Expression"]
});
(0, _utils.default)("VariableDeclaration", {
builder: ["kind", "declarations"],
visitor: ["declarations"],
aliases: ["Statement", "Declaration"],
fields: {
declare: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
kind: {
validate: (0, _utils.assertOneOf)("var", "let", "const")
},
declarations: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("VariableDeclarator")))
}
},
validate(parent, key, node) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (!(0, _is.default)("ForXStatement", parent, {
left: node
})) return;
if (node.declarations.length !== 1) {
throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`);
}
}
});
(0, _utils.default)("VariableDeclarator", {
visitor: ["id", "init"],
fields: {
id: {
validate: function () {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) {
return (0, _utils.assertNodeType)("LVal");
}
const normal = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern");
const without = (0, _utils.assertNodeType)("Identifier");
return function (node, key, val) {
const validator = node.init ? normal : without;
validator(node, key, val);
};
}()
},
definite: {
optional: true,
validate: (0, _utils.assertValueType)("boolean")
},
init: {
optional: true,
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("WhileStatement", {
visitor: ["test", "body"],
aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"],
fields: {
test: {
validate: (0, _utils.assertNodeType)("Expression")
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
}
}
});
(0, _utils.default)("WithStatement", {
visitor: ["object", "body"],
aliases: ["Statement"],
fields: {
object: {
validate: (0, _utils.assertNodeType)("Expression")
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
}
}
});
/***/ }),
/* 601 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getBindingIdentifiers;
var _generated = __webpack_require__(559);
function getBindingIdentifiers(node, duplicates, outerOnly) {
let search = [].concat(node);
const ids = Object.create(null);
while (search.length) {
const id = search.shift();
if (!id) continue;
const keys = getBindingIdentifiers.keys[id.type];
if ((0, _generated.isIdentifier)(id)) {
if (duplicates) {
const _ids = ids[id.name] = ids[id.name] || [];
_ids.push(id);
} else {
ids[id.name] = id;
}
continue;
}
if ((0, _generated.isExportDeclaration)(id)) {
if ((0, _generated.isDeclaration)(id.declaration)) {
search.push(id.declaration);
}
continue;
}
if (outerOnly) {
if ((0, _generated.isFunctionDeclaration)(id)) {
search.push(id.id);
continue;
}
if ((0, _generated.isFunctionExpression)(id)) {
continue;
}
}
if (keys) {
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
if (id[key]) {
search = search.concat(id[key]);
}
}
}
}
return ids;
}
getBindingIdentifiers.keys = {
DeclareClass: ["id"],
DeclareFunction: ["id"],
DeclareModule: ["id"],
DeclareVariable: ["id"],
DeclareInterface: ["id"],
DeclareTypeAlias: ["id"],
DeclareOpaqueType: ["id"],
InterfaceDeclaration: ["id"],
TypeAlias: ["id"],
OpaqueType: ["id"],
CatchClause: ["param"],
LabeledStatement: ["label"],
UnaryExpression: ["argument"],
AssignmentExpression: ["left"],
ImportSpecifier: ["local"],
ImportNamespaceSpecifier: ["local"],
ImportDefaultSpecifier: ["local"],
ImportDeclaration: ["specifiers"],
ExportSpecifier: ["exported"],
ExportNamespaceSpecifier: ["exported"],
ExportDefaultSpecifier: ["exported"],
FunctionDeclaration: ["id", "params"],
FunctionExpression: ["id", "params"],
ArrowFunctionExpression: ["params"],
ObjectMethod: ["params"],
ClassMethod: ["params"],
ForInStatement: ["left"],
ForOfStatement: ["left"],
ClassDeclaration: ["id"],
ClassExpression: ["id"],
RestElement: ["argument"],
UpdateExpression: ["argument"],
ObjectProperty: ["value"],
AssignmentPattern: ["left"],
ArrayPattern: ["elements"],
ObjectPattern: ["properties"],
VariableDeclaration: ["declarations"],
VariableDeclarator: ["id"]
};
/***/ }),
/* 602 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isFunction = isFunction;
exports.isAwaitExpression = isAwaitExpression;
exports.isYieldExpression = isYieldExpression;
exports.isObjectShorthand = isObjectShorthand;
exports.getObjectExpressionValue = getObjectExpressionValue;
exports.getCode = getCode;
exports.getComments = getComments;
exports.getSpecifiers = getSpecifiers;
exports.isComputedExpression = isComputedExpression;
exports.getMemberExpression = getMemberExpression;
exports.getVariables = getVariables;
exports.getPatternIdentifiers = getPatternIdentifiers;
exports.isTopLevel = isTopLevel;
exports.nodeLocationKey = nodeLocationKey;
exports.getFunctionParameterNames = getFunctionParameterNames;
var t = _interopRequireWildcard(__webpack_require__(2));
var _generator = _interopRequireDefault(__webpack_require__(603));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
function isFunction(node) {
return t.isFunction(node) || t.isArrowFunctionExpression(node) || t.isObjectMethod(node) || t.isClassMethod(node);
}
function isAwaitExpression(path) {
const {
node,
parent
} = path;
return t.isAwaitExpression(node) || t.isAwaitExpression(parent.init) || t.isAwaitExpression(parent);
}
function isYieldExpression(path) {
const {
node,
parent
} = path;
return t.isYieldExpression(node) || t.isYieldExpression(parent.init) || t.isYieldExpression(parent);
}
function isObjectShorthand(parent) {
if (!t.isObjectProperty(parent)) {
return false;
}
if (parent.value && parent.value.left) {
return parent.value.type === "AssignmentPattern" && parent.value.left.type === "Identifier";
}
return parent.value && parent.key.start == parent.value.start && parent.key.loc.identifierName === parent.value.loc.identifierName;
}
function getObjectExpressionValue(node) {
const {
value
} = node;
if (t.isIdentifier(value)) {
return value.name;
}
if (t.isCallExpression(value) || t.isFunctionExpression(value)) {
return "";
}
const code = (0, _generator.default)(value).code;
const shouldWrap = t.isObjectExpression(value);
return shouldWrap ? `(${code})` : code;
}
function getCode(node) {
return (0, _generator.default)(node).code;
}
function getComments(ast) {
if (!ast || !ast.comments) {
return [];
}
return ast.comments.map(comment => ({
name: comment.location,
location: comment.loc
}));
}
function getSpecifiers(specifiers) {
if (!specifiers) {
return [];
}
return specifiers.map(specifier => {
var _specifier$local;
return (_specifier$local = specifier.local) === null || _specifier$local === void 0 ? void 0 : _specifier$local.name;
});
}
function isComputedExpression(expression) {
return /^\[/m.test(expression);
}
function getMemberExpression(root) {
function _getMemberExpression(node, expr) {
if (t.isMemberExpression(node)) {
expr = [node.property.name].concat(expr);
return _getMemberExpression(node.object, expr);
}
if (t.isCallExpression(node)) {
return [];
}
if (t.isThisExpression(node)) {
return ["this"].concat(expr);
}
return [node.name].concat(expr);
}
const expr = _getMemberExpression(root, []);
return expr.join(".");
}
function getVariables(dec) {
if (!dec.id) {
return [];
}
if (t.isArrayPattern(dec.id)) {
if (!dec.id.elements) {
return [];
} // NOTE: it's possible that an element is empty or has several variables
// e.g. const [, a] = arr
// e.g. const [{a, b }] = 2
return dec.id.elements.filter(Boolean).map(element => {
var _element$argument;
return {
name: t.isAssignmentPattern(element) ? element.left.name : element.name || ((_element$argument = element.argument) === null || _element$argument === void 0 ? void 0 : _element$argument.name),
location: element.loc
};
}).filter(({
name
}) => name);
}
return [{
name: dec.id.name,
location: dec.loc
}];
}
function getPatternIdentifiers(pattern) {
let items = [];
if (t.isObjectPattern(pattern)) {
items = pattern.properties.map(({
value
}) => value);
}
if (t.isArrayPattern(pattern)) {
items = pattern.elements;
}
return getIdentifiers(items);
}
function getIdentifiers(items) {
let ids = [];
items.forEach(function (item) {
if (t.isObjectPattern(item) || t.isArrayPattern(item)) {
ids = ids.concat(getPatternIdentifiers(item));
} else if (t.isIdentifier(item)) {
const {
start,
end
} = item.loc;
ids.push({
name: item.name,
expression: item.name,
location: {
start,
end
}
});
}
});
return ids;
} // Top Level checks the number of "body" nodes in the ancestor chain
// if the node is top-level, then it shoul only have one body.
function isTopLevel(ancestors) {
return ancestors.filter(ancestor => ancestor.key == "body").length == 1;
}
function nodeLocationKey(a) {
const {
start,
end
} = a.location;
return `${start.line}:${start.column}:${end.line}:${end.column}`;
}
function getFunctionParameterNames(path) {
if (path.node.params != null) {
return path.node.params.map(param => {
if (param.type !== "AssignmentPattern") {
return param.name;
} // Parameter with default value
if (param.left.type === "Identifier" && param.right.type === "Identifier") {
return `${param.left.name} = ${param.right.name}`;
} else if (param.left.type === "Identifier" && param.right.type === "StringLiteral") {
return `${param.left.name} = ${param.right.value}`;
} else if (param.left.type === "Identifier" && param.right.type === "ObjectExpression") {
return `${param.left.name} = {}`;
} else if (param.left.type === "Identifier" && param.right.type === "ArrayExpression") {
return `${param.left.name} = []`;
} else if (param.left.type === "Identifier" && param.right.type === "NullLiteral") {
return `${param.left.name} = null`;
}
});
}
return [];
}
/***/ }),
/* 603 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.CodeGenerator = void 0;
var _sourceMap = _interopRequireDefault(__webpack_require__(841));
var _printer = _interopRequireDefault(__webpack_require__(842));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class Generator extends _printer.default {
constructor(ast, opts = {}, code) {
const format = normalizeOptions(code, opts);
const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
super(format, map);
this.ast = ast;
}
generate() {
return super.generate(this.ast);
}
}
function normalizeOptions(code, opts) {
const format = {
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
shouldPrintComment: opts.shouldPrintComment,
retainLines: opts.retainLines,
retainFunctionParens: opts.retainFunctionParens,
comments: opts.comments == null || opts.comments,
compact: opts.compact,
minified: opts.minified,
concise: opts.concise,
jsonCompatibleStrings: opts.jsonCompatibleStrings,
indent: {
adjustMultilineComment: true,
style: " ",
base: 0
},
decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
jsescOption: Object.assign({
quotes: "double",
wrap: true
}, opts.jsescOption),
recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType
};
if (format.minified) {
format.compact = true;
format.shouldPrintComment = format.shouldPrintComment || (() => format.comments);
} else {
format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0);
}
if (format.compact === "auto") {
format.compact = code.length > 500000;
if (format.compact) {
console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`);
}
}
if (format.compact) {
format.indent.adjustMultilineComment = false;
}
return format;
}
class CodeGenerator {
constructor(ast, opts, code) {
this._generator = new Generator(ast, opts, code);
}
generate() {
return this._generator.generate();
}
}
exports.CodeGenerator = CodeGenerator;
function _default(ast, opts, code) {
const gen = new Generator(ast, opts, code);
return gen.generate();
}
/***/ }),
/* 604 */
/***/ (function(module, exports, __webpack_require__) {
var toFinite = __webpack_require__(844);
/**
* Converts `value` to an integer.
*
* **Note:** This method is loosely based on
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
* @example
*
* _.toInteger(3.2);
* // => 3
*
* _.toInteger(Number.MIN_VALUE);
* // => 0
*
* _.toInteger(Infinity);
* // => 1.7976931348623157e+308
*
* _.toInteger('3.2');
* // => 3
*/
function toInteger(value) {
var result = toFinite(value),
remainder = result % 1;
return result === result ? (remainder ? result - remainder : result) : 0;
}
module.exports = toInteger;
/***/ }),
/* 605 */
/***/ (function(module, exports, __webpack_require__) {
var baseToString = __webpack_require__(639);
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
module.exports = toString;
/***/ }),
/* 606 */
/***/ (function(module, exports, __webpack_require__) {
var isSymbol = __webpack_require__(577);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
module.exports = toKey;
/***/ }),
/* 607 */,
/* 608 */,
/* 609 */,
/* 610 */,
/* 611 */,
/* 612 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = shallowEqual;
function shallowEqual(actual, expected) {
const keys = Object.keys(expected);
for (const key of keys) {
if (actual[key] !== expected[key]) {
return false;
}
}
return true;
}
/***/ }),
/* 613 */
/***/ (function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(586),
stackClear = __webpack_require__(727),
stackDelete = __webpack_require__(728),
stackGet = __webpack_require__(729),
stackHas = __webpack_require__(730),
stackSet = __webpack_require__(731);
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
module.exports = Stack;
/***/ }),
/* 614 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574),
root = __webpack_require__(562);
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');
module.exports = Map;
/***/ }),
/* 615 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(570);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ }),
/* 616 */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/* 617 */
/***/ (function(module, exports, __webpack_require__) {
var mapCacheClear = __webpack_require__(736),
mapCacheDelete = __webpack_require__(743),
mapCacheGet = __webpack_require__(745),
mapCacheHas = __webpack_require__(746),
mapCacheSet = __webpack_require__(747);
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
module.exports = MapCache;
/***/ }),
/* 618 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsArguments = __webpack_require__(752),
isObjectLike = __webpack_require__(565);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee');
};
module.exports = isArguments;
/***/ }),
/* 619 */
/***/ (function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
if(!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function() {
return module.i;
}
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/* 620 */
/***/ (function(module, exports) {
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** Used to detect unsigned integer values. */
var reIsUint = /^(?:0|[1-9]\d*)$/;
/**
* Checks if `value` is a valid array-like index.
*
* @private
* @param {*} value The value to check.
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
*/
function isIndex(value, length) {
var type = typeof value;
length = length == null ? MAX_SAFE_INTEGER : length;
return !!length &&
(type == 'number' ||
(type != 'symbol' && reIsUint.test(value))) &&
(value > -1 && value % 1 == 0 && value < length);
}
module.exports = isIndex;
/***/ }),
/* 621 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsTypedArray = __webpack_require__(754),
baseUnary = __webpack_require__(596),
nodeUtil = __webpack_require__(597);
/* Node.js helper references. */
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
/**
* Checks if `value` is classified as a typed array.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
* @example
*
* _.isTypedArray(new Uint8Array);
* // => true
*
* _.isTypedArray([]);
* // => false
*/
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
module.exports = isTypedArray;
/***/ }),
/* 622 */
/***/ (function(module, exports) {
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
module.exports = isLength;
/***/ }),
/* 623 */
/***/ (function(module, exports, __webpack_require__) {
var arrayFilter = __webpack_require__(762),
stubArray = __webpack_require__(659);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
module.exports = getSymbols;
/***/ }),
/* 624 */
/***/ (function(module, exports, __webpack_require__) {
var overArg = __webpack_require__(657);
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
module.exports = getPrototype;
/***/ }),
/* 625 */
/***/ (function(module, exports, __webpack_require__) {
var Uint8Array = __webpack_require__(665);
/**
* Creates a clone of `arrayBuffer`.
*
* @private
* @param {ArrayBuffer} arrayBuffer The array buffer to clone.
* @returns {ArrayBuffer} Returns the cloned array buffer.
*/
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
}
module.exports = cloneArrayBuffer;
/***/ }),
/* 626 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isType;
var _definitions = __webpack_require__(564);
function isType(nodeType, targetType) {
if (nodeType === targetType) return true;
if (_definitions.ALIAS_KEYS[targetType]) return false;
const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType];
if (aliases) {
if (aliases[0] === nodeType) return true;
for (const alias of aliases) {
if (nodeType === alias) return true;
}
}
return false;
}
/***/ }),
/* 627 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = validate;
exports.validateField = validateField;
exports.validateChild = validateChild;
var _definitions = __webpack_require__(564);
function validate(node, key, val) {
if (!node) return;
const fields = _definitions.NODE_FIELDS[node.type];
if (!fields) return;
const field = fields[key];
validateField(node, key, val, field);
validateChild(node, key, val);
}
function validateField(node, key, val, field) {
if (!(field == null ? void 0 : field.validate)) return;
if (field.optional && val == null) return;
field.validate(node, key, val);
}
function validateChild(node, key, val) {
if (val == null) return;
const validate = _definitions.NODE_PARENT_VALIDATIONS[val.type];
if (!validate) return;
validate(node, key, val);
}
/***/ }),
/* 628 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.classMethodOrDeclareMethodCommon = exports.classMethodOrPropertyCommon = void 0;
var _utils = _interopRequireWildcard(__webpack_require__(571));
var _core = __webpack_require__(600);
var _is = _interopRequireDefault(__webpack_require__(579));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
(0, _utils.default)("AssignmentPattern", {
visitor: ["left", "right", "decorators"],
builder: ["left", "right"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, _core.patternLikeCommon, {
left: {
validate: (0, _utils.assertNodeType)("Identifier", "ObjectPattern", "ArrayPattern", "MemberExpression")
},
right: {
validate: (0, _utils.assertNodeType)("Expression")
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
})
});
(0, _utils.default)("ArrayPattern", {
visitor: ["elements", "typeAnnotation"],
builder: ["elements"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, _core.patternLikeCommon, {
elements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeOrValueType)("null", "PatternLike")))
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
})
});
(0, _utils.default)("ArrowFunctionExpression", {
builder: ["params", "body", "async"],
visitor: ["params", "body", "returnType", "typeParameters"],
aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
fields: Object.assign({}, _core.functionCommon, _core.functionTypeAnnotationCommon, {
expression: {
validate: (0, _utils.assertValueType)("boolean")
},
body: {
validate: (0, _utils.assertNodeType)("BlockStatement", "Expression")
}
})
});
(0, _utils.default)("ClassBody", {
visitor: ["body"],
fields: {
body: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ClassMethod", "ClassPrivateMethod", "ClassProperty", "ClassPrivateProperty", "TSDeclareMethod", "TSIndexSignature")))
}
}
});
(0, _utils.default)("ClassExpression", {
builder: ["id", "superClass", "body", "decorators"],
visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"],
aliases: ["Scopable", "Class", "Expression"],
fields: {
id: {
validate: (0, _utils.assertNodeType)("Identifier"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true
},
body: {
validate: (0, _utils.assertNodeType)("ClassBody")
},
superClass: {
optional: true,
validate: (0, _utils.assertNodeType)("Expression")
},
superTypeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
optional: true
},
implements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
mixins: {
validate: (0, _utils.assertNodeType)("InterfaceExtends"),
optional: true
}
}
});
(0, _utils.default)("ClassDeclaration", {
inherits: "ClassExpression",
aliases: ["Scopable", "Class", "Statement", "Declaration"],
fields: {
id: {
validate: (0, _utils.assertNodeType)("Identifier")
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
optional: true
},
body: {
validate: (0, _utils.assertNodeType)("ClassBody")
},
superClass: {
optional: true,
validate: (0, _utils.assertNodeType)("Expression")
},
superTypeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
optional: true
},
implements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSExpressionWithTypeArguments", "ClassImplements"))),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
mixins: {
validate: (0, _utils.assertNodeType)("InterfaceExtends"),
optional: true
},
declare: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
abstract: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
},
validate: function () {
const identifier = (0, _utils.assertNodeType)("Identifier");
return function (parent, key, node) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (!(0, _is.default)("ExportDefaultDeclaration", parent)) {
identifier(node, "id", node.id);
}
};
}()
});
(0, _utils.default)("ExportAllDeclaration", {
visitor: ["source"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
fields: {
source: {
validate: (0, _utils.assertNodeType)("StringLiteral")
}
}
});
(0, _utils.default)("ExportDefaultDeclaration", {
visitor: ["declaration"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
fields: {
declaration: {
validate: (0, _utils.assertNodeType)("FunctionDeclaration", "TSDeclareFunction", "ClassDeclaration", "Expression")
}
}
});
(0, _utils.default)("ExportNamedDeclaration", {
visitor: ["declaration", "specifiers", "source"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
fields: {
declaration: {
optional: true,
validate: (0, _utils.chain)((0, _utils.assertNodeType)("Declaration"), Object.assign(function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (val && node.specifiers.length) {
throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");
}
}, {
oneOfNodeTypes: ["Declaration"]
}), function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (val && node.source) {
throw new TypeError("Cannot export a declaration from a source");
}
})
},
specifiers: {
default: [],
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)(function () {
const sourced = (0, _utils.assertNodeType)("ExportSpecifier", "ExportDefaultSpecifier", "ExportNamespaceSpecifier");
const sourceless = (0, _utils.assertNodeType)("ExportSpecifier");
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return sourced;
return function (node, key, val) {
const validator = node.source ? sourced : sourceless;
validator(node, key, val);
};
}()))
},
source: {
validate: (0, _utils.assertNodeType)("StringLiteral"),
optional: true
},
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value"))
}
});
(0, _utils.default)("ExportSpecifier", {
visitor: ["local", "exported"],
aliases: ["ModuleSpecifier"],
fields: {
local: {
validate: (0, _utils.assertNodeType)("Identifier")
},
exported: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("ForOfStatement", {
visitor: ["left", "right", "body"],
builder: ["left", "right", "body", "await"],
aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
fields: {
left: {
validate: function () {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) {
return (0, _utils.assertNodeType)("VariableDeclaration", "LVal");
}
const declaration = (0, _utils.assertNodeType)("VariableDeclaration");
const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern");
return function (node, key, val) {
if ((0, _is.default)("VariableDeclaration", val)) {
declaration(node, key, val);
} else {
lval(node, key, val);
}
};
}()
},
right: {
validate: (0, _utils.assertNodeType)("Expression")
},
body: {
validate: (0, _utils.assertNodeType)("Statement")
},
await: {
default: false
}
}
});
(0, _utils.default)("ImportDeclaration", {
visitor: ["specifiers", "source"],
aliases: ["Statement", "Declaration", "ModuleDeclaration"],
fields: {
specifiers: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")))
},
source: {
validate: (0, _utils.assertNodeType)("StringLiteral")
},
importKind: {
validate: (0, _utils.assertOneOf)("type", "typeof", "value"),
optional: true
}
}
});
(0, _utils.default)("ImportDefaultSpecifier", {
visitor: ["local"],
aliases: ["ModuleSpecifier"],
fields: {
local: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("ImportNamespaceSpecifier", {
visitor: ["local"],
aliases: ["ModuleSpecifier"],
fields: {
local: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("ImportSpecifier", {
visitor: ["local", "imported"],
aliases: ["ModuleSpecifier"],
fields: {
local: {
validate: (0, _utils.assertNodeType)("Identifier")
},
imported: {
validate: (0, _utils.assertNodeType)("Identifier")
},
importKind: {
validate: (0, _utils.assertOneOf)("type", "typeof"),
optional: true
}
}
});
(0, _utils.default)("MetaProperty", {
visitor: ["meta", "property"],
aliases: ["Expression"],
fields: {
meta: {
validate: (0, _utils.chain)((0, _utils.assertNodeType)("Identifier"), Object.assign(function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
let property;
switch (val.name) {
case "function":
property = "sent";
break;
case "new":
property = "target";
break;
case "import":
property = "meta";
break;
}
if (!(0, _is.default)("Identifier", node.property, {
name: property
})) {
throw new TypeError("Unrecognised MetaProperty");
}
}, {
oneOfNodeTypes: ["Identifier"]
}))
},
property: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
const classMethodOrPropertyCommon = {
abstract: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
accessibility: {
validate: (0, _utils.assertOneOf)("public", "private", "protected"),
optional: true
},
static: {
default: false
},
computed: {
default: false
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
key: {
validate: (0, _utils.chain)(function () {
const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral");
const computed = (0, _utils.assertNodeType)("Expression");
return function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
}(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "Expression"))
}
};
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
const classMethodOrDeclareMethodCommon = Object.assign({}, _core.functionCommon, classMethodOrPropertyCommon, {
kind: {
validate: (0, _utils.assertOneOf)("get", "set", "method", "constructor"),
default: "method"
},
access: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), (0, _utils.assertOneOf)("public", "private", "protected")),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
});
exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon;
(0, _utils.default)("ClassMethod", {
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
builder: ["kind", "key", "params", "body", "computed", "static", "generator", "async"],
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
fields: Object.assign({}, classMethodOrDeclareMethodCommon, _core.functionTypeAnnotationCommon, {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
})
});
(0, _utils.default)("ObjectPattern", {
visitor: ["properties", "typeAnnotation", "decorators"],
builder: ["properties"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, _core.patternLikeCommon, {
properties: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("RestElement", "ObjectProperty")))
}
})
});
(0, _utils.default)("SpreadElement", {
visitor: ["argument"],
aliases: ["UnaryLike"],
deprecatedAlias: "SpreadProperty",
fields: {
argument: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("Super", {
aliases: ["Expression"]
});
(0, _utils.default)("TaggedTemplateExpression", {
visitor: ["tag", "quasi"],
aliases: ["Expression"],
fields: {
tag: {
validate: (0, _utils.assertNodeType)("Expression")
},
quasi: {
validate: (0, _utils.assertNodeType)("TemplateLiteral")
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
optional: true
}
}
});
(0, _utils.default)("TemplateElement", {
builder: ["value", "tail"],
fields: {
value: {
validate: (0, _utils.assertShape)({
raw: {
validate: (0, _utils.assertValueType)("string")
},
cooked: {
validate: (0, _utils.assertValueType)("string"),
optional: true
}
})
},
tail: {
default: false
}
}
});
(0, _utils.default)("TemplateLiteral", {
visitor: ["quasis", "expressions"],
aliases: ["Expression", "Literal"],
fields: {
quasis: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TemplateElement")))
},
expressions: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression")), function (node, key, val) {
if (node.quasis.length !== val.length + 1) {
throw new TypeError(`Number of ${node.type} quasis should be exactly one more than the number of expressions.\nExpected ${val.length + 1} quasis but got ${node.quasis.length}`);
}
})
}
}
});
(0, _utils.default)("YieldExpression", {
builder: ["argument", "delegate"],
visitor: ["argument"],
aliases: ["Expression", "Terminatorless"],
fields: {
delegate: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), Object.assign(function (node, key, val) {
if (!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING) return;
if (val && !node.argument) {
throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument");
}
}, {
type: "boolean"
})),
default: false
},
argument: {
optional: true,
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
/***/ }),
/* 629 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inherit;
var _uniq = _interopRequireDefault(__webpack_require__(799));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inherit(key, child, parent) {
if (child && parent) {
child[key] = (0, _uniq.default)([].concat(child[key], parent[key]).filter(Boolean));
}
}
/***/ }),
/* 630 */
/***/ (function(module, exports) {
/**
* The base implementation of `_.findIndex` and `_.findLastIndex` without
* support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} predicate The function invoked per iteration.
* @param {number} fromIndex The index to search from.
* @param {boolean} [fromRight] Specify iterating from right to left.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseFindIndex(array, predicate, fromIndex, fromRight) {
var length = array.length,
index = fromIndex + (fromRight ? 1 : -1);
while ((fromRight ? index-- : ++index < length)) {
if (predicate(array[index], index, array)) {
return index;
}
}
return -1;
}
module.exports = baseFindIndex;
/***/ }),
/* 631 */
/***/ (function(module, exports) {
/**
* Converts `set` to an array of its values.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the values.
*/
function setToArray(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = value;
});
return result;
}
module.exports = setToArray;
/***/ }),
/* 632 */
/***/ (function(module, exports, __webpack_require__) {
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = __webpack_require__(581).SourceMapGenerator;
exports.SourceMapConsumer = __webpack_require__(635).SourceMapConsumer;
exports.SourceNode = __webpack_require__(638).SourceNode;
/***/ }),
/* 633 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function (number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
/**
* Decode a single base 64 character code digit to an integer. Returns -1 on
* failure.
*/
exports.decode = function (charCode) {
var bigA = 65; // 'A'
var bigZ = 90; // 'Z'
var littleA = 97; // 'a'
var littleZ = 122; // 'z'
var zero = 48; // '0'
var nine = 57; // '9'
var plus = 43; // '+'
var slash = 47; // '/'
var littleOffset = 26;
var numberOffset = 52;
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
if (bigA <= charCode && charCode <= bigZ) {
return (charCode - bigA);
}
// 26 - 51: abcdefghijklmnopqrstuvwxyz
if (littleA <= charCode && charCode <= littleZ) {
return (charCode - littleA + littleOffset);
}
// 52 - 61: 0123456789
if (zero <= charCode && charCode <= nine) {
return (charCode - zero + numberOffset);
}
// 62: +
if (charCode == plus) {
return 62;
}
// 63: /
if (charCode == slash) {
return 63;
}
// Invalid base64 digit.
return -1;
};
/***/ }),
/* 634 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2014 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(566);
/**
* Determine whether mappingB is after mappingA with respect to generated
* position.
*/
function generatedPositionAfter(mappingA, mappingB) {
// Optimized for most common case
var lineA = mappingA.generatedLine;
var lineB = mappingB.generatedLine;
var columnA = mappingA.generatedColumn;
var columnB = mappingB.generatedColumn;
return lineB > lineA || lineB == lineA && columnB >= columnA ||
util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
}
/**
* A data structure to provide a sorted view of accumulated mappings in a
* performance conscious manner. It trades a neglibable overhead in general
* case for a large speedup in case of mappings being added in order.
*/
function MappingList() {
this._array = [];
this._sorted = true;
// Serves as infimum
this._last = {generatedLine: -1, generatedColumn: 0};
}
/**
* Iterate through internal items. This method takes the same arguments that
* `Array.prototype.forEach` takes.
*
* NOTE: The order of the mappings is NOT guaranteed.
*/
MappingList.prototype.unsortedForEach =
function MappingList_forEach(aCallback, aThisArg) {
this._array.forEach(aCallback, aThisArg);
};
/**
* Add the given source mapping.
*
* @param Object aMapping
*/
MappingList.prototype.add = function MappingList_add(aMapping) {
if (generatedPositionAfter(this._last, aMapping)) {
this._last = aMapping;
this._array.push(aMapping);
} else {
this._sorted = false;
this._array.push(aMapping);
}
};
/**
* Returns the flat, sorted array of mappings. The mappings are sorted by
* generated position.
*
* WARNING: This method returns internal data without copying, for
* performance. The return value must NOT be mutated, and should be treated as
* an immutable borrow. If you want to take ownership, you must make your own
* copy.
*/
MappingList.prototype.toArray = function MappingList_toArray() {
if (!this._sorted) {
this._array.sort(util.compareByGeneratedPositionsInflated);
this._sorted = true;
}
return this._array;
};
exports.MappingList = MappingList;
/***/ }),
/* 635 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(566);
var binarySearch = __webpack_require__(636);
var ArraySet = __webpack_require__(583).ArraySet;
var base64VLQ = __webpack_require__(582);
var quickSort = __webpack_require__(637).quickSort;
function SourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
return sourceMap.sections != null
? new IndexedSourceMapConsumer(sourceMap)
: new BasicSourceMapConsumer(sourceMap);
}
SourceMapConsumer.fromSourceMap = function(aSourceMap) {
return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
}
/**
* The version of the source mapping spec that we are consuming.
*/
SourceMapConsumer.prototype._version = 3;
// `__generatedMappings` and `__originalMappings` are arrays that hold the
// parsed mapping coordinates from the source map's "mappings" attribute. They
// are lazily instantiated, accessed via the `_generatedMappings` and
// `_originalMappings` getters respectively, and we only parse the mappings
// and create these arrays once queried for a source location. We jump through
// these hoops because there can be many thousands of mappings, and parsing
// them is expensive, so we only want to do it if we must.
//
// Each object in the arrays is of the form:
//
// {
// generatedLine: The line number in the generated code,
// generatedColumn: The column number in the generated code,
// source: The path to the original source file that generated this
// chunk of code,
// originalLine: The line number in the original source that
// corresponds to this chunk of generated code,
// originalColumn: The column number in the original source that
// corresponds to this chunk of generated code,
// name: The name of the original symbol which generated this chunk of
// code.
// }
//
// All properties except for `generatedLine` and `generatedColumn` can be
// `null`.
//
// `_generatedMappings` is ordered by the generated positions.
//
// `_originalMappings` is ordered by the original positions.
SourceMapConsumer.prototype.__generatedMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
get: function () {
if (!this.__generatedMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__generatedMappings;
}
});
SourceMapConsumer.prototype.__originalMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
get: function () {
if (!this.__originalMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__originalMappings;
}
});
SourceMapConsumer.prototype._charIsMappingSeparator =
function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
var c = aStr.charAt(index);
return c === ";" || c === ",";
};
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
SourceMapConsumer.prototype._parseMappings =
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
throw new Error("Subclasses must implement _parseMappings");
};
SourceMapConsumer.GENERATED_ORDER = 1;
SourceMapConsumer.ORIGINAL_ORDER = 2;
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param Function aCallback
* The function that is called with each mapping.
* @param Object aContext
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param aOrder
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
SourceMapConsumer.prototype.eachMapping =
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
switch (order) {
case SourceMapConsumer.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
var sourceRoot = this.sourceRoot;
mappings.map(function (mapping) {
var source = mapping.source === null ? null : this._sources.at(mapping.source);
if (source != null && sourceRoot != null) {
source = util.join(sourceRoot, source);
}
return {
source: source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name === null ? null : this._names.at(mapping.name)
};
}, this).forEach(aCallback, context);
};
/**
* Returns all generated line and column information for the original source,
* line, and column provided. If no column is provided, returns all mappings
* corresponding to a either the line we are searching for or the next
* closest line that has any mappings. Otherwise, returns all mappings
* corresponding to the given line and either the column we are searching for
* or the next closest column that has any offsets.
*
* The only argument is an object with the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: Optional. the column number in the original source.
*
* and an array of objects is returned, each with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
SourceMapConsumer.prototype.allGeneratedPositionsFor =
function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
var line = util.getArg(aArgs, 'line');
// When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
// returns the index of the closest mapping less than the needle. By
// setting needle.originalColumn to 0, we thus find the last mapping for
// the given line, provided such a mapping exists.
var needle = {
source: util.getArg(aArgs, 'source'),
originalLine: line,
originalColumn: util.getArg(aArgs, 'column', 0)
};
if (this.sourceRoot != null) {
needle.source = util.relative(this.sourceRoot, needle.source);
}
if (!this._sources.has(needle.source)) {
return [];
}
needle.source = this._sources.indexOf(needle.source);
var mappings = [];
var index = this._findMapping(needle,
this._originalMappings,
"originalLine",
"originalColumn",
util.compareByOriginalPositions,
binarySearch.LEAST_UPPER_BOUND);
if (index >= 0) {
var mapping = this._originalMappings[index];
if (aArgs.column === undefined) {
var originalLine = mapping.originalLine;
// Iterate until either we run out of mappings, or we run into
// a mapping for a different line than the one we found. Since
// mappings are sorted, this is guaranteed to find all mappings for
// the line we found.
while (mapping && mapping.originalLine === originalLine) {
mappings.push({
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
});
mapping = this._originalMappings[++index];
}
} else {
var originalColumn = mapping.originalColumn;
// Iterate until either we run out of mappings, or we run into
// a mapping for a different line than the one we were searching for.
// Since mappings are sorted, this is guaranteed to find all mappings for
// the line we are searching for.
while (mapping &&
mapping.originalLine === line &&
mapping.originalColumn == originalColumn) {
mappings.push({
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
});
mapping = this._originalMappings[++index];
}
}
}
return mappings;
};
exports.SourceMapConsumer = SourceMapConsumer;
/**
* A BasicSourceMapConsumer instance represents a parsed source map which we can
* query for information about the original file positions by giving it a file
* position in the generated source.
*
* The only parameter is the raw source map (either as a JSON string, or
* already parsed to an object). According to the spec, source maps have the
* following attributes:
*
* - version: Which version of the source map spec this map is following.
* - sources: An array of URLs to the original source files.
* - names: An array of identifiers which can be referrenced by individual mappings.
* - sourceRoot: Optional. The URL root from which all sources are relative.
* - sourcesContent: Optional. An array of contents of the original source files.
* - mappings: A string of base64 VLQs which contain the actual mappings.
* - file: Optional. The generated file this source map is associated with.
*
* Here is an example source map, taken from the source map spec[0]:
*
* {
* version : 3,
* file: "out.js",
* sourceRoot : "",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AA,AB;;ABCDE;"
* }
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
*/
function BasicSourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
var version = util.getArg(sourceMap, 'version');
var sources = util.getArg(sourceMap, 'sources');
// Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
// requires the array) to play nice here.
var names = util.getArg(sourceMap, 'names', []);
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
var mappings = util.getArg(sourceMap, 'mappings');
var file = util.getArg(sourceMap, 'file', null);
// Once again, Sass deviates from the spec and supplies the version as a
// string rather than a number, so we use loose equality checking here.
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
sources = sources
.map(String)
// Some source maps produce relative source paths like "./foo.js" instead of
// "foo.js". Normalize these first so that future comparisons will succeed.
// See bugzil.la/1090768.
.map(util.normalize)
// Always ensure that absolute sources are internally stored relative to
// the source root, if the source root is absolute. Not doing this would
// be particularly problematic when the source root is a prefix of the
// source (valid, but why??). See github issue #199 and bugzil.la/1188982.
.map(function (source) {
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
? util.relative(sourceRoot, source)
: source;
});
// Pass `true` below to allow duplicate names and sources. While source maps
// are intended to be compressed and deduplicated, the TypeScript compiler
// sometimes generates source maps with duplicates in them. See Github issue
// #72 and bugzil.la/889492.
this._names = ArraySet.fromArray(names.map(String), true);
this._sources = ArraySet.fromArray(sources, true);
this.sourceRoot = sourceRoot;
this.sourcesContent = sourcesContent;
this._mappings = mappings;
this.file = file;
}
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
/**
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
*
* @param SourceMapGenerator aSourceMap
* The source map that will be consumed.
* @returns BasicSourceMapConsumer
*/
BasicSourceMapConsumer.fromSourceMap =
function SourceMapConsumer_fromSourceMap(aSourceMap) {
var smc = Object.create(BasicSourceMapConsumer.prototype);
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
smc.sourceRoot = aSourceMap._sourceRoot;
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
smc.sourceRoot);
smc.file = aSourceMap._file;
// Because we are modifying the entries (by converting string sources and
// names to indices into the sources and names ArraySets), we have to make
// a copy of the entry or else bad things happen. Shared mutable state
// strikes again! See github issue #191.
var generatedMappings = aSourceMap._mappings.toArray().slice();
var destGeneratedMappings = smc.__generatedMappings = [];
var destOriginalMappings = smc.__originalMappings = [];
for (var i = 0, length = generatedMappings.length; i < length; i++) {
var srcMapping = generatedMappings[i];
var destMapping = new Mapping;
destMapping.generatedLine = srcMapping.generatedLine;
destMapping.generatedColumn = srcMapping.generatedColumn;
if (srcMapping.source) {
destMapping.source = sources.indexOf(srcMapping.source);
destMapping.originalLine = srcMapping.originalLine;
destMapping.originalColumn = srcMapping.originalColumn;
if (srcMapping.name) {
destMapping.name = names.indexOf(srcMapping.name);
}
destOriginalMappings.push(destMapping);
}
destGeneratedMappings.push(destMapping);
}
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
return smc;
};
/**
* The version of the source mapping spec that we are consuming.
*/
BasicSourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
get: function () {
return this._sources.toArray().map(function (s) {
return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
}, this);
}
});
/**
* Provide the JIT with a nice shape / hidden class.
*/
function Mapping() {
this.generatedLine = 0;
this.generatedColumn = 0;
this.source = null;
this.originalLine = null;
this.originalColumn = null;
this.name = null;
}
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
BasicSourceMapConsumer.prototype._parseMappings =
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
var length = aStr.length;
var index = 0;
var cachedSegments = {};
var temp = {};
var originalMappings = [];
var generatedMappings = [];
var mapping, str, segment, end, value;
while (index < length) {
if (aStr.charAt(index) === ';') {
generatedLine++;
index++;
previousGeneratedColumn = 0;
}
else if (aStr.charAt(index) === ',') {
index++;
}
else {
mapping = new Mapping();
mapping.generatedLine = generatedLine;
// Because each offset is encoded relative to the previous one,
// many segments often have the same encoding. We can exploit this
// fact by caching the parsed variable length fields of each segment,
// allowing us to avoid a second parse if we encounter the same
// segment again.
for (end = index; end < length; end++) {
if (this._charIsMappingSeparator(aStr, end)) {
break;
}
}
str = aStr.slice(index, end);
segment = cachedSegments[str];
if (segment) {
index += str.length;
} else {
segment = [];
while (index < end) {
base64VLQ.decode(aStr, index, temp);
value = temp.value;
index = temp.rest;
segment.push(value);
}
if (segment.length === 2) {
throw new Error('Found a source, but no line and column');
}
if (segment.length === 3) {
throw new Error('Found a source and line, but no column');
}
cachedSegments[str] = segment;
}
// Generated column.
mapping.generatedColumn = previousGeneratedColumn + segment[0];
previousGeneratedColumn = mapping.generatedColumn;
if (segment.length > 1) {
// Original source.
mapping.source = previousSource + segment[1];
previousSource += segment[1];
// Original line.
mapping.originalLine = previousOriginalLine + segment[2];
previousOriginalLine = mapping.originalLine;
// Lines are stored 0-based
mapping.originalLine += 1;
// Original column.
mapping.originalColumn = previousOriginalColumn + segment[3];
previousOriginalColumn = mapping.originalColumn;
if (segment.length > 4) {
// Original name.
mapping.name = previousName + segment[4];
previousName += segment[4];
}
}
generatedMappings.push(mapping);
if (typeof mapping.originalLine === 'number') {
originalMappings.push(mapping);
}
}
}
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
this.__generatedMappings = generatedMappings;
quickSort(originalMappings, util.compareByOriginalPositions);
this.__originalMappings = originalMappings;
};
/**
* Find the mapping that best matches the hypothetical "needle" mapping that
* we are searching for in the given "haystack" of mappings.
*/
BasicSourceMapConsumer.prototype._findMapping =
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
aColumnName, aComparator, aBias) {
// To return the position we are searching for, we must first find the
// mapping for the given position and then return the opposite position it
// points to. Because the mappings are sorted, we can use binary search to
// find the best mapping.
if (aNeedle[aLineName] <= 0) {
throw new TypeError('Line must be greater than or equal to 1, got '
+ aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError('Column must be greater than or equal to 0, got '
+ aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
};
/**
* Compute the last column for each generated mapping. The last column is
* inclusive.
*/
BasicSourceMapConsumer.prototype.computeColumnSpans =
function SourceMapConsumer_computeColumnSpans() {
for (var index = 0; index < this._generatedMappings.length; ++index) {
var mapping = this._generatedMappings[index];
// Mappings do not contain a field for the last generated columnt. We
// can come up with an optimistic estimate, however, by assuming that
// mappings are contiguous (i.e. given two consecutive mappings, the
// first mapping ends where the second one starts).
if (index + 1 < this._generatedMappings.length) {
var nextMapping = this._generatedMappings[index + 1];
if (mapping.generatedLine === nextMapping.generatedLine) {
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
continue;
}
}
// The last mapping for each line spans the entire line.
mapping.lastGeneratedColumn = Infinity;
}
};
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
BasicSourceMapConsumer.prototype.originalPositionFor =
function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
var index = this._findMapping(
needle,
this._generatedMappings,
"generatedLine",
"generatedColumn",
util.compareByGeneratedPositionsDeflated,
util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
);
if (index >= 0) {
var mapping = this._generatedMappings[index];
if (mapping.generatedLine === needle.generatedLine) {
var source = util.getArg(mapping, 'source', null);
if (source !== null) {
source = this._sources.at(source);
if (this.sourceRoot != null) {
source = util.join(this.sourceRoot, source);
}
}
var name = util.getArg(mapping, 'name', null);
if (name !== null) {
name = this._names.at(name);
}
return {
source: source,
line: util.getArg(mapping, 'originalLine', null),
column: util.getArg(mapping, 'originalColumn', null),
name: name
};
}
}
return {
source: null,
line: null,
column: null,
name: null
};
};
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
function BasicSourceMapConsumer_hasContentsOfAllSources() {
if (!this.sourcesContent) {
return false;
}
return this.sourcesContent.length >= this._sources.size() &&
!this.sourcesContent.some(function (sc) { return sc == null; });
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
BasicSourceMapConsumer.prototype.sourceContentFor =
function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
if (!this.sourcesContent) {
return null;
}
if (this.sourceRoot != null) {
aSource = util.relative(this.sourceRoot, aSource);
}
if (this._sources.has(aSource)) {
return this.sourcesContent[this._sources.indexOf(aSource)];
}
var url;
if (this.sourceRoot != null
&& (url = util.urlParse(this.sourceRoot))) {
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
// many users. We can help them out when they expect file:// URIs to
// behave like it would if they were running a local HTTP server. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
if (url.scheme == "file"
&& this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
}
if ((!url.path || url.path == "/")
&& this._sources.has("/" + aSource)) {
return this.sourcesContent[this._sources.indexOf("/" + aSource)];
}
}
// This function is used recursively from
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
// don't want to throw if we can't find the source - we just want to
// return null, so we provide a flag to exit gracefully.
if (nullOnMissing) {
return null;
}
else {
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
BasicSourceMapConsumer.prototype.generatedPositionFor =
function SourceMapConsumer_generatedPositionFor(aArgs) {
var source = util.getArg(aArgs, 'source');
if (this.sourceRoot != null) {
source = util.relative(this.sourceRoot, source);
}
if (!this._sources.has(source)) {
return {
line: null,
column: null,
lastColumn: null
};
}
source = this._sources.indexOf(source);
var needle = {
source: source,
originalLine: util.getArg(aArgs, 'line'),
originalColumn: util.getArg(aArgs, 'column')
};
var index = this._findMapping(
needle,
this._originalMappings,
"originalLine",
"originalColumn",
util.compareByOriginalPositions,
util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
);
if (index >= 0) {
var mapping = this._originalMappings[index];
if (mapping.source === needle.source) {
return {
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
};
}
}
return {
line: null,
column: null,
lastColumn: null
};
};
exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
/**
* An IndexedSourceMapConsumer instance represents a parsed source map which
* we can query for information. It differs from BasicSourceMapConsumer in
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
* input.
*
* The only parameter is a raw source map (either as a JSON string, or already
* parsed to an object). According to the spec for indexed source maps, they
* have the following attributes:
*
* - version: Which version of the source map spec this map is following.
* - file: Optional. The generated file this source map is associated with.
* - sections: A list of section definitions.
*
* Each value under the "sections" field has two fields:
* - offset: The offset into the original specified at which this section
* begins to apply, defined as an object with a "line" and "column"
* field.
* - map: A source map definition. This source map could also be indexed,
* but doesn't have to be.
*
* Instead of the "map" field, it's also possible to have a "url" field
* specifying a URL to retrieve a source map from, but that's currently
* unsupported.
*
* Here's an example source map, taken from the source map spec[0], but
* modified to omit a section which uses the "url" field.
*
* {
* version : 3,
* file: "app.js",
* sections: [{
* offset: {line:100, column:10},
* map: {
* version : 3,
* file: "section.js",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AAAA,E;;ABCDE;"
* }
* }],
* }
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
*/
function IndexedSourceMapConsumer(aSourceMap) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
}
var version = util.getArg(sourceMap, 'version');
var sections = util.getArg(sourceMap, 'sections');
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
this._sources = new ArraySet();
this._names = new ArraySet();
var lastOffset = {
line: -1,
column: 0
};
this._sections = sections.map(function (s) {
if (s.url) {
// The url field will require support for asynchronicity.
// See https://github.com/mozilla/source-map/issues/16
throw new Error('Support for url field in sections not implemented.');
}
var offset = util.getArg(s, 'offset');
var offsetLine = util.getArg(offset, 'line');
var offsetColumn = util.getArg(offset, 'column');
if (offsetLine < lastOffset.line ||
(offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
throw new Error('Section offsets must be ordered and non-overlapping.');
}
lastOffset = offset;
return {
generatedOffset: {
// The offset fields are 0-based, but we use 1-based indices when
// encoding/decoding from VLQ.
generatedLine: offsetLine + 1,
generatedColumn: offsetColumn + 1
},
consumer: new SourceMapConsumer(util.getArg(s, 'map'))
}
});
}
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
/**
* The version of the source mapping spec that we are consuming.
*/
IndexedSourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
get: function () {
var sources = [];
for (var i = 0; i < this._sections.length; i++) {
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
sources.push(this._sections[i].consumer.sources[j]);
}
}
return sources;
}
});
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source.
* - column: The column number in the generated source.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null.
* - column: The column number in the original source, or null.
* - name: The original identifier, or null.
*/
IndexedSourceMapConsumer.prototype.originalPositionFor =
function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
// Find the section containing the generated position we're trying to map
// to an original position.
var sectionIndex = binarySearch.search(needle, this._sections,
function(needle, section) {
var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
if (cmp) {
return cmp;
}
return (needle.generatedColumn -
section.generatedOffset.generatedColumn);
});
var section = this._sections[sectionIndex];
if (!section) {
return {
source: null,
line: null,
column: null,
name: null
};
}
return section.consumer.originalPositionFor({
line: needle.generatedLine -
(section.generatedOffset.generatedLine - 1),
column: needle.generatedColumn -
(section.generatedOffset.generatedLine === needle.generatedLine
? section.generatedOffset.generatedColumn - 1
: 0),
bias: aArgs.bias
});
};
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
function IndexedSourceMapConsumer_hasContentsOfAllSources() {
return this._sections.every(function (s) {
return s.consumer.hasContentsOfAllSources();
});
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
IndexedSourceMapConsumer.prototype.sourceContentFor =
function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var content = section.consumer.sourceContentFor(aSource, true);
if (content) {
return content;
}
}
if (nullOnMissing) {
return null;
}
else {
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source.
* - column: The column number in the original source.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null.
* - column: The column number in the generated source, or null.
*/
IndexedSourceMapConsumer.prototype.generatedPositionFor =
function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
// Only consider this section if the requested source is in the list of
// sources of the consumer.
if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
continue;
}
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
if (generatedPosition) {
var ret = {
line: generatedPosition.line +
(section.generatedOffset.generatedLine - 1),
column: generatedPosition.column +
(section.generatedOffset.generatedLine === generatedPosition.line
? section.generatedOffset.generatedColumn - 1
: 0)
};
return ret;
}
}
return {
line: null,
column: null
};
};
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
IndexedSourceMapConsumer.prototype._parseMappings =
function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
this.__generatedMappings = [];
this.__originalMappings = [];
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var sectionMappings = section.consumer._generatedMappings;
for (var j = 0; j < sectionMappings.length; j++) {
var mapping = sectionMappings[j];
var source = section.consumer._sources.at(mapping.source);
if (section.consumer.sourceRoot !== null) {
source = util.join(section.consumer.sourceRoot, source);
}
this._sources.add(source);
source = this._sources.indexOf(source);
var name = section.consumer._names.at(mapping.name);
this._names.add(name);
name = this._names.indexOf(name);
// The mappings coming from the consumer for the section have
// generated positions relative to the start of the section, so we
// need to offset them to be relative to the start of the concatenated
// generated file.
var adjustedMapping = {
source: source,
generatedLine: mapping.generatedLine +
(section.generatedOffset.generatedLine - 1),
generatedColumn: mapping.generatedColumn +
(section.generatedOffset.generatedLine === mapping.generatedLine
? section.generatedOffset.generatedColumn - 1
: 0),
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: name
};
this.__generatedMappings.push(adjustedMapping);
if (typeof adjustedMapping.originalLine === 'number') {
this.__originalMappings.push(adjustedMapping);
}
}
}
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
quickSort(this.__originalMappings, util.compareByOriginalPositions);
};
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
/***/ }),
/* 636 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.GREATEST_LOWER_BOUND = 1;
exports.LEAST_UPPER_BOUND = 2;
/**
* Recursive implementation of binary search.
*
* @param aLow Indices here and lower do not contain the needle.
* @param aHigh Indices here and higher do not contain the needle.
* @param aNeedle The element being searched for.
* @param aHaystack The non-empty array being searched.
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
*/
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the index of
// the next-closest element.
//
// 3. We did not find the exact element, and there is no next-closest
// element than the one we are searching for, so we return -1.
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
// Found the element we are looking for.
return mid;
}
else if (cmp > 0) {
// Our needle is greater than aHaystack[mid].
if (aHigh - mid > 1) {
// The element is in the upper half.
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
}
// The exact needle element was not found in this haystack. Determine if
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
} else {
return mid;
}
}
else {
// Our needle is less than aHaystack[mid].
if (mid - aLow > 1) {
// The element is in the lower half.
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
}
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return mid;
} else {
return aLow < 0 ? -1 : aLow;
}
}
}
/**
* This is an implementation of binary search which will always try and return
* the index of the closest element if there is no exact hit. This is because
* mappings between original and generated line/col pairs are single points,
* and there is an implicit region between each of them, so a miss just means
* that you aren't on the very start of a region.
*
* @param aNeedle The element you are looking for.
* @param aHaystack The array that is being searched.
* @param aCompare A function which takes the needle and an element in the
* array and returns -1, 0, or 1 depending on whether the needle is less
* than, equal to, or greater than the element, respectively.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
*/
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
if (aHaystack.length === 0) {
return -1;
}
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
if (index < 0) {
return -1;
}
// We have found either the exact element, or the next-closest element than
// the one we are searching for. However, there may be more than one such
// element. Make sure we always return the smallest of these.
while (index - 1 >= 0) {
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
break;
}
--index;
}
return index;
};
/***/ }),
/* 637 */
/***/ (function(module, exports) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
// It turns out that some (most?) JavaScript engines don't self-host
// `Array.prototype.sort`. This makes sense because C++ will likely remain
// faster than JS when doing raw CPU-intensive sorting. However, when using a
// custom comparator function, calling back and forth between the VM's C++ and
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
// worse generated code for the comparator function than would be optimal. In
// fact, when sorting with a comparator, these costs outweigh the benefits of
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
// a ~3500ms mean speed-up in `bench/bench.html`.
/**
* Swap the elements indexed by `x` and `y` in the array `ary`.
*
* @param {Array} ary
* The array.
* @param {Number} x
* The index of the first item.
* @param {Number} y
* The index of the second item.
*/
function swap(ary, x, y) {
var temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
/**
* Returns a random integer within the range `low .. high` inclusive.
*
* @param {Number} low
* The lower bound on the range.
* @param {Number} high
* The upper bound on the range.
*/
function randomIntInRange(low, high) {
return Math.round(low + (Math.random() * (high - low)));
}
/**
* The Quick Sort algorithm.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
* @param {Number} p
* Start index of the array
* @param {Number} r
* End index of the array
*/
function doQuickSort(ary, comparator, p, r) {
// If our lower bound is less than our upper bound, we (1) partition the
// array into two pieces and (2) recurse on each half. If it is not, this is
// the empty array and our base case.
if (p < r) {
// (1) Partitioning.
//
// The partitioning chooses a pivot between `p` and `r` and moves all
// elements that are less than or equal to the pivot to the before it, and
// all the elements that are greater than it after it. The effect is that
// once partition is done, the pivot is in the exact place it will be when
// the array is put in sorted order, and it will not need to be moved
// again. This runs in O(n) time.
// Always choose a random pivot so that an input array which is reverse
// sorted does not cause O(n^2) running time.
var pivotIndex = randomIntInRange(p, r);
var i = p - 1;
swap(ary, pivotIndex, r);
var pivot = ary[r];
// Immediately after `j` is incremented in this loop, the following hold
// true:
//
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
//
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
for (var j = p; j < r; j++) {
if (comparator(ary[j], pivot) <= 0) {
i += 1;
swap(ary, i, j);
}
}
swap(ary, i + 1, j);
var q = i + 1;
// (2) Recurse on each half.
doQuickSort(ary, comparator, p, q - 1);
doQuickSort(ary, comparator, q + 1, r);
}
}
/**
* Sort the given array in-place with the given comparator function.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
*/
exports.quickSort = function (ary, comparator) {
doQuickSort(ary, comparator, 0, ary.length - 1);
};
/***/ }),
/* 638 */
/***/ (function(module, exports, __webpack_require__) {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var SourceMapGenerator = __webpack_require__(581).SourceMapGenerator;
var util = __webpack_require__(566);
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
// operating systems these days (capturing the result).
var REGEX_NEWLINE = /(\r?\n)/;
// Newline character code for charCodeAt() comparisons
var NEWLINE_CODE = 10;
// Private symbol for identifying `SourceNode`s when multiple versions of
// the source-map library are loaded. This MUST NOT CHANGE across
// versions!
var isSourceNode = "$$$isSourceNode$$$";
/**
* SourceNodes provide a way to abstract over interpolating/concatenating
* snippets of generated JavaScript source code while maintaining the line and
* column information associated with the original source code.
*
* @param aLine The original line number.
* @param aColumn The original column number.
* @param aSource The original source's filename.
* @param aChunks Optional. An array of strings which are snippets of
* generated JS, or other SourceNodes.
* @param aName The original identifier.
*/
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine == null ? null : aLine;
this.column = aColumn == null ? null : aColumn;
this.source = aSource == null ? null : aSource;
this.name = aName == null ? null : aName;
this[isSourceNode] = true;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
* @param aRelativePath Optional. The path that relative sources in the
* SourceMapConsumer should be relative to.
*/
SourceNode.fromStringWithSourceMap =
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
var node = new SourceNode();
// All even indices of this array are one line of the generated code,
// while all odd indices are the newlines between two adjacent lines
// (since `REGEX_NEWLINE` captures its match).
// Processed fragments are accessed by calling `shiftNextLine`.
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
var remainingLinesIndex = 0;
var shiftNextLine = function() {
var lineContents = getNextLine();
// The last line of a file might not have a newline.
var newLine = getNextLine() || "";
return lineContents + newLine;
function getNextLine() {
return remainingLinesIndex < remainingLines.length ?
remainingLines[remainingLinesIndex++] : undefined;
}
};
// We need to remember the position of "remainingLines"
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
var lastMapping = null;
aSourceMapConsumer.eachMapping(function (mapping) {
if (lastMapping !== null) {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine < mapping.generatedLine) {
// Associate first line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
lastGeneratedLine++;
lastGeneratedColumn = 0;
// The remaining code is added without mapping
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
var nextLine = remainingLines[remainingLinesIndex];
var code = nextLine.substr(0, mapping.generatedColumn -
lastGeneratedColumn);
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
// No more remaining code, continue
lastMapping = mapping;
return;
}
}
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine < mapping.generatedLine) {
node.add(shiftNextLine());
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[remainingLinesIndex];
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
lastMapping = mapping;
}, this);
// We have processed all mappings.
if (remainingLinesIndex < remainingLines.length) {
if (lastMapping) {
// Associate the remaining code in the current line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
}
// and add the remaining lines without any mapping
node.add(remainingLines.splice(remainingLinesIndex).join(""));
}
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === undefined) {
node.add(code);
} else {
var source = aRelativePath
? util.join(aRelativePath, mapping.source)
: mapping.source;
node.add(new SourceNode(mapping.originalLine,
mapping.originalColumn,
source,
code,
mapping.name));
}
}
};
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function (chunk) {
this.add(chunk);
}, this);
}
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length-1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
}
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
this.children.unshift(aChunk);
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
var chunk;
for (var i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk[isSourceNode]) {
chunk.walk(aFn);
}
else {
if (chunk !== '') {
aFn(chunk, { source: this.source,
line: this.line,
column: this.column,
name: this.name });
}
}
}
};
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len-1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild[isSourceNode]) {
lastChild.replaceRight(aPattern, aReplacement);
}
else if (typeof lastChild === 'string') {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
}
else {
this.children.push(''.replace(aPattern, aReplacement));
}
return this;
};
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
SourceNode.prototype.setSourceContent =
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
};
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walkSourceContents =
function SourceNode_walkSourceContents(aFn) {
for (var i = 0, len = this.children.length; i < len; i++) {
if (this.children[i][isSourceNode]) {
this.children[i].walkSourceContents(aFn);
}
}
var sources = Object.keys(this.sourceContents);
for (var i = 0, len = sources.length; i < len; i++) {
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
};
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function (chunk) {
str += chunk;
});
return str;
};
/**
* Returns the string representation of this source node along with a source
* map.
*/
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
var lastOriginalSource = null;
var lastOriginalLine = null;
var lastOriginalColumn = null;
var lastOriginalName = null;
this.walk(function (chunk, original) {
generated.code += chunk;
if (original.source !== null
&& original.line !== null
&& original.column !== null) {
if(lastOriginalSource !== original.source
|| lastOriginalLine !== original.line
|| lastOriginalColumn !== original.column
|| lastOriginalName !== original.name) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
for (var idx = 0, length = chunk.length; idx < length; idx++) {
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
generated.line++;
generated.column = 0;
// Mappings end at eol
if (idx + 1 === length) {
lastOriginalSource = null;
sourceMappingActive = false;
} else if (sourceMappingActive) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
} else {
generated.column++;
}
}
});
this.walkSourceContents(function (sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map: map };
};
exports.SourceNode = SourceNode;
/***/ }),
/* 639 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(570),
arrayMap = __webpack_require__(640),
isArray = __webpack_require__(563),
isSymbol = __webpack_require__(577);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isArray(value)) {
// Recursively convert values (susceptible to call stack limits).
return arrayMap(value, baseToString) + '';
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
module.exports = baseToString;
/***/ }),
/* 640 */
/***/ (function(module, exports) {
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
/***/ }),
/* 641 */
/***/ (function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(563),
isSymbol = __webpack_require__(577);
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/;
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
module.exports = isKey;
/***/ }),
/* 642 */,
/* 643 */,
/* 644 */,
/* 645 */,
/* 646 */,
/* 647 */,
/* 648 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clearSymbols = clearSymbols;
exports.getSymbols = getSymbols;
var t = _interopRequireWildcard(__webpack_require__(2));
var _simplePath = _interopRequireDefault(__webpack_require__(684));
var _ast = __webpack_require__(572);
var _helpers = __webpack_require__(602);
var _inferClassName = __webpack_require__(867);
var _getFunctionName = _interopRequireDefault(__webpack_require__(691));
var _frameworks = __webpack_require__(868);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
let symbolDeclarations = new Map();
function getUniqueIdentifiers(identifiers) {
const newIdentifiers = [];
const locationKeys = new Set();
for (const newId of identifiers) {
const key = (0, _helpers.nodeLocationKey)(newId);
if (!locationKeys.has(key)) {
locationKeys.add(key);
newIdentifiers.push(newId);
}
}
return newIdentifiers;
} // eslint-disable-next-line complexity
function extractSymbol(path, symbols, state) {
if ((0, _helpers.isFunction)(path)) {
const name = (0, _getFunctionName.default)(path.node, path.parent);
if (!state.fnCounts[name]) {
state.fnCounts[name] = 0;
}
const index = state.fnCounts[name]++;
symbols.functions.push({
name,
klass: (0, _inferClassName.inferClassName)(path),
location: path.node.loc,
parameterNames: (0, _helpers.getFunctionParameterNames)(path),
identifier: path.node.id,
// indicates the occurence of the function in a file
// e.g { name: foo, ... index: 4 } is the 4th foo function
// in the file
index
});
}
if (t.isJSXElement(path)) {
symbols.hasJsx = true;
}
if (t.isGenericTypeAnnotation(path)) {
symbols.hasTypes = true;
}
if (t.isClassDeclaration(path)) {
const {
loc,
superClass
} = path.node;
symbols.classes.push({
name: path.node.id.name,
parent: superClass ? {
name: t.isMemberExpression(superClass) ? (0, _helpers.getCode)(superClass) : superClass.name,
location: superClass.loc
} : null,
location: loc
});
}
if (t.isImportDeclaration(path)) {
symbols.imports.push({
source: path.node.source.value,
location: path.node.loc,
specifiers: (0, _helpers.getSpecifiers)(path.node.specifiers)
});
}
if (t.isObjectProperty(path)) {
const {
start,
end,
identifierName
} = path.node.key.loc;
symbols.objectProperties.push({
name: identifierName,
location: {
start,
end
},
expression: getSnippet(path)
});
}
if (t.isMemberExpression(path) || t.isOptionalMemberExpression(path)) {
const {
start,
end
} = path.node.property.loc;
symbols.memberExpressions.push({
name: path.node.property.name,
location: {
start,
end
},
expression: getSnippet(path),
computed: path.node.computed
});
}
if ((t.isStringLiteral(path) || t.isNumericLiteral(path)) && t.isMemberExpression(path.parentPath)) {
// We only need literals that are part of computed memeber expressions
const {
start,
end
} = path.node.loc;
symbols.literals.push({
name: path.node.value,
location: {
start,
end
},
expression: getSnippet(path.parentPath)
});
}
if (t.isCallExpression(path)) {
const {
callee
} = path.node;
const args = path.node.arguments;
if (t.isMemberExpression(callee)) {
const {
property: {
name,
loc
}
} = callee;
symbols.callExpressions.push({
name,
values: args.filter(arg => arg.value).map(arg => arg.value),
location: loc
});
} else {
const {
start,
end,
identifierName
} = callee.loc;
symbols.callExpressions.push({
name: identifierName,
values: args.filter(arg => arg.value).map(arg => arg.value),
location: {
start,
end
}
});
}
}
if (t.isStringLiteral(path) && t.isProperty(path.parentPath)) {
const {
start,
end
} = path.node.loc;
return symbols.identifiers.push({
name: path.node.value,
expression: (0, _helpers.getObjectExpressionValue)(path.parent),
location: {
start,
end
}
});
}
if (t.isIdentifier(path) && !t.isGenericTypeAnnotation(path.parent)) {
let {
start,
end
} = path.node.loc; // We want to include function params, but exclude the function name
if (t.isClassMethod(path.parent) && !path.inList) {
return;
}
if (t.isProperty(path.parentPath) && !(0, _helpers.isObjectShorthand)(path.parent)) {
return symbols.identifiers.push({
name: path.node.name,
expression: (0, _helpers.getObjectExpressionValue)(path.parent),
location: {
start,
end
}
});
}
if (path.node.typeAnnotation) {
const {
column
} = path.node.typeAnnotation.loc.start;
end = { ...end,
column
};
}
symbols.identifiers.push({
name: path.node.name,
expression: path.node.name,
location: {
start,
end
}
});
}
if (t.isThisExpression(path.node)) {
const {
start,
end
} = path.node.loc;
symbols.identifiers.push({
name: "this",
location: {
start,
end
},
expression: "this"
});
}
if (t.isVariableDeclarator(path)) {
const nodeId = path.node.id;
symbols.identifiers.push(...(0, _helpers.getPatternIdentifiers)(nodeId));
}
}
function extractSymbols(sourceId) {
const symbols = {
functions: [],
callExpressions: [],
memberExpressions: [],
objectProperties: [],
comments: [],
identifiers: [],
classes: [],
imports: [],
literals: [],
hasJsx: false,
hasTypes: false,
loading: false,
framework: undefined
};
const state = {
fnCounts: Object.create(null)
};
const ast = (0, _ast.traverseAst)(sourceId, {
enter(node, ancestors) {
try {
const path = (0, _simplePath.default)(ancestors);
if (path) {
extractSymbol(path, symbols, state);
}
} catch (e) {
console.error(e);
}
}
}); // comments are extracted separately from the AST
symbols.comments = (0, _helpers.getComments)(ast);
symbols.identifiers = getUniqueIdentifiers(symbols.identifiers);
symbols.framework = (0, _frameworks.getFramework)(symbols);
return symbols;
}
function extendSnippet(name, expression, path, prevPath) {
var _path$node$property, _path$node$property$e;
const computed = path === null || path === void 0 ? void 0 : path.node.computed;
const optional = path === null || path === void 0 ? void 0 : path.node.optional;
const prevComputed = prevPath === null || prevPath === void 0 ? void 0 : prevPath.node.computed;
const prevArray = t.isArrayExpression(prevPath);
const array = t.isArrayExpression(path);
const value = (path === null || path === void 0 ? void 0 : (_path$node$property = path.node.property) === null || _path$node$property === void 0 ? void 0 : (_path$node$property$e = _path$node$property.extra) === null || _path$node$property$e === void 0 ? void 0 : _path$node$property$e.raw) || "";
if (expression === "") {
if (computed) {
return name === undefined ? `[${value}]` : `[${name}]`;
}
return name;
}
if (computed || array) {
if (prevComputed || prevArray) {
return `[${name}]${expression}`;
}
return `[${name === undefined ? value : name}].${expression}`;
}
if (prevComputed || prevArray) {
return `${name}${expression}`;
}
if ((0, _helpers.isComputedExpression)(expression) && name !== undefined) {
return `${name}${expression}`;
}
if (optional) {
return `${name}?.${expression}`;
}
return `${name}.${expression}`;
}
function getMemberSnippet(node, expression = "", optional = false) {
if (t.isMemberExpression(node) || t.isOptionalMemberExpression(node)) {
const name = node.property.name;
const snippet = getMemberSnippet(node.object, extendSnippet(name, expression, {
node
}), node.optional);
return snippet;
}
if (t.isCallExpression(node)) {
return "";
}
if (t.isThisExpression(node)) {
return `this.${expression}`;
}
if (t.isIdentifier(node)) {
if ((0, _helpers.isComputedExpression)(expression)) {
return `${node.name}${expression}`;
}
if (optional) {
return `${node.name}?.${expression}`;
}
return `${node.name}.${expression}`;
}
return expression;
}
function getObjectSnippet(path, prevPath, expression = "") {
if (!path) {
return expression;
}
const {
name
} = path.node.key;
const extendedExpression = extendSnippet(name, expression, path, prevPath);
const nextPrevPath = path;
const nextPath = path.parentPath && path.parentPath.parentPath;
return getSnippet(nextPath, nextPrevPath, extendedExpression);
}
function getArraySnippet(path, prevPath, expression) {
if (!prevPath.parentPath) {
throw new Error("Assertion failure - path should exist");
}
const index = `${prevPath.parentPath.containerIndex}`;
const extendedExpression = extendSnippet(index, expression, path, prevPath);
const nextPrevPath = path;
const nextPath = path.parentPath && path.parentPath.parentPath;
return getSnippet(nextPath, nextPrevPath, extendedExpression);
}
function getSnippet(path, prevPath, expression = "") {
if (!path) {
return expression;
}
if (t.isVariableDeclaration(path)) {
const node = path.node.declarations[0];
const {
name
} = node.id;
return extendSnippet(name, expression, path, prevPath);
}
if (t.isVariableDeclarator(path)) {
const node = path.node.id;
if (t.isObjectPattern(node)) {
return expression;
}
const prop = extendSnippet(node.name, expression, path, prevPath);
return prop;
}
if (t.isAssignmentExpression(path)) {
const node = path.node.left;
const name = t.isMemberExpression(node) ? getMemberSnippet(node) : node.name;
const prop = extendSnippet(name, expression, path, prevPath);
return prop;
}
if ((0, _helpers.isFunction)(path)) {
return expression;
}
if (t.isIdentifier(path)) {
return `${path.node.name}.${expression}`;
}
if (t.isObjectProperty(path)) {
return getObjectSnippet(path, prevPath, expression);
}
if (t.isObjectExpression(path)) {
const parentPath = prevPath === null || prevPath === void 0 ? void 0 : prevPath.parentPath;
return getObjectSnippet(parentPath, prevPath, expression);
}
if (t.isMemberExpression(path) || t.isOptionalMemberExpression(path)) {
return getMemberSnippet(path.node, expression);
}
if (t.isArrayExpression(path)) {
if (!prevPath) {
throw new Error("Assertion failure - path should exist");
}
return getArraySnippet(path, prevPath, expression);
}
return "";
}
function clearSymbols() {
symbolDeclarations = new Map();
}
function getSymbols(sourceId) {
if (symbolDeclarations.has(sourceId)) {
const symbols = symbolDeclarations.get(sourceId);
if (symbols) {
return symbols;
}
}
const symbols = extractSymbols(sourceId);
symbolDeclarations.set(sourceId, symbols);
return symbols;
}
/***/ }),
/* 649 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = buildMatchMemberExpression;
var _matchesPattern = _interopRequireDefault(__webpack_require__(650));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function buildMatchMemberExpression(match, allowPartial) {
const parts = match.split(".");
return member => (0, _matchesPattern.default)(member, parts, allowPartial);
}
/***/ }),
/* 650 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = matchesPattern;
var _generated = __webpack_require__(559);
function matchesPattern(member, match, allowPartial) {
if (!(0, _generated.isMemberExpression)(member)) return false;
const parts = Array.isArray(match) ? match : match.split(".");
const nodes = [];
let node;
for (node = member; (0, _generated.isMemberExpression)(node); node = node.object) {
nodes.push(node.property);
}
nodes.push(node);
if (nodes.length < parts.length) return false;
if (!allowPartial && nodes.length > parts.length) return false;
for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) {
const node = nodes[j];
let value;
if ((0, _generated.isIdentifier)(node)) {
value = node.name;
} else if ((0, _generated.isStringLiteral)(node)) {
value = node.value;
} else {
return false;
}
if (parts[i] !== value) return false;
}
return true;
}
/***/ }),
/* 651 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(569),
isObject = __webpack_require__(573);
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
if (!isObject(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
module.exports = isFunction;
/***/ }),
/* 652 */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var funcProto = Function.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to convert.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
module.exports = toSource;
/***/ }),
/* 653 */
/***/ (function(module, exports, __webpack_require__) {
var baseAssignValue = __webpack_require__(654),
eq = __webpack_require__(588);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Assigns `value` to `key` of `object` if the existing value is not equivalent
* using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
(value === undefined && !(key in object))) {
baseAssignValue(object, key, value);
}
}
module.exports = assignValue;
/***/ }),
/* 654 */
/***/ (function(module, exports, __webpack_require__) {
var defineProperty = __webpack_require__(749);
/**
* The base implementation of `assignValue` and `assignMergeValue` without
* value checks.
*
* @private
* @param {Object} object The object to modify.
* @param {string} key The key of the property to assign.
* @param {*} value The value to assign.
*/
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty) {
defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
}
module.exports = baseAssignValue;
/***/ }),
/* 655 */
/***/ (function(module, exports, __webpack_require__) {
var baseTimes = __webpack_require__(751),
isArguments = __webpack_require__(618),
isArray = __webpack_require__(563),
isBuffer = __webpack_require__(595),
isIndex = __webpack_require__(620),
isTypedArray = __webpack_require__(621);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Creates an array of the enumerable property names of the array-like `value`.
*
* @private
* @param {*} value The value to query.
* @param {boolean} inherited Specify returning inherited property names.
* @returns {Array} Returns the array of property names.
*/
function arrayLikeKeys(value, inherited) {
var isArr = isArray(value),
isArg = !isArr && isArguments(value),
isBuff = !isArr && !isArg && isBuffer(value),
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
skipIndexes = isArr || isArg || isBuff || isType,
result = skipIndexes ? baseTimes(value.length, String) : [],
length = result.length;
for (var key in value) {
if ((inherited || hasOwnProperty.call(value, key)) &&
!(skipIndexes && (
// Safari 9 has enumerable `arguments.length` in strict mode.
key == 'length' ||
// Node.js 0.10 has enumerable non-index properties on buffers.
(isBuff && (key == 'offset' || key == 'parent')) ||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
// Skip index properties.
isIndex(key, length)
))) {
result.push(key);
}
}
return result;
}
module.exports = arrayLikeKeys;
/***/ }),
/* 656 */
/***/ (function(module, exports, __webpack_require__) {
var isPrototype = __webpack_require__(598),
nativeKeys = __webpack_require__(755);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
if (!isPrototype(object)) {
return nativeKeys(object);
}
var result = [];
for (var key in Object(object)) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key);
}
}
return result;
}
module.exports = baseKeys;
/***/ }),
/* 657 */
/***/ (function(module, exports) {
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function(arg) {
return func(transform(arg));
};
}
module.exports = overArg;
/***/ }),
/* 658 */
/***/ (function(module, exports, __webpack_require__) {
var arrayLikeKeys = __webpack_require__(655),
baseKeysIn = __webpack_require__(757),
isArrayLike = __webpack_require__(599);
/**
* Creates an array of the own and inherited enumerable property names of `object`.
*
* **Note:** Non-object values are coerced to objects.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Object
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.keysIn(new Foo);
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
*/
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
}
module.exports = keysIn;
/***/ }),
/* 659 */
/***/ (function(module, exports) {
/**
* This method returns a new empty array.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {Array} Returns the new empty array.
* @example
*
* var arrays = _.times(2, _.stubArray);
*
* console.log(arrays);
* // => [[], []]
*
* console.log(arrays[0] === arrays[1]);
* // => false
*/
function stubArray() {
return [];
}
module.exports = stubArray;
/***/ }),
/* 660 */
/***/ (function(module, exports, __webpack_require__) {
var arrayPush = __webpack_require__(661),
getPrototype = __webpack_require__(624),
getSymbols = __webpack_require__(623),
stubArray = __webpack_require__(659);
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols;
/**
* Creates an array of the own and inherited enumerable symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols.
*/
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
var result = [];
while (object) {
arrayPush(result, getSymbols(object));
object = getPrototype(object);
}
return result;
};
module.exports = getSymbolsIn;
/***/ }),
/* 661 */
/***/ (function(module, exports) {
/**
* Appends the elements of `values` to `array`.
*
* @private
* @param {Array} array The array to modify.
* @param {Array} values The values to append.
* @returns {Array} Returns `array`.
*/
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
}
module.exports = arrayPush;
/***/ }),
/* 662 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetAllKeys = __webpack_require__(663),
getSymbols = __webpack_require__(623),
keys = __webpack_require__(594);
/**
* Creates an array of own enumerable property names and symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeys(object) {
return baseGetAllKeys(object, keys, getSymbols);
}
module.exports = getAllKeys;
/***/ }),
/* 663 */
/***/ (function(module, exports, __webpack_require__) {
var arrayPush = __webpack_require__(661),
isArray = __webpack_require__(563);
/**
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @param {Function} keysFunc The function to get the keys of `object`.
* @param {Function} symbolsFunc The function to get the symbols of `object`.
* @returns {Array} Returns the array of property names and symbols.
*/
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
}
module.exports = baseGetAllKeys;
/***/ }),
/* 664 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574),
root = __webpack_require__(562);
/* Built-in method references that are verified to be native. */
var Set = getNative(root, 'Set');
module.exports = Set;
/***/ }),
/* 665 */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(562);
/** Built-in value references. */
var Uint8Array = root.Uint8Array;
module.exports = Uint8Array;
/***/ }),
/* 666 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isPlaceholderType;
var _definitions = __webpack_require__(564);
function isPlaceholderType(placeholderType, targetType) {
if (placeholderType === targetType) return true;
const aliases = _definitions.PLACEHOLDERS_ALIAS[placeholderType];
if (aliases) {
for (const alias of aliases) {
if (targetType === alias) return true;
}
}
return false;
}
/***/ }),
/* 667 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "isIdentifierName", {
enumerable: true,
get: function () {
return _identifier.isIdentifierName;
}
});
Object.defineProperty(exports, "isIdentifierChar", {
enumerable: true,
get: function () {
return _identifier.isIdentifierChar;
}
});
Object.defineProperty(exports, "isIdentifierStart", {
enumerable: true,
get: function () {
return _identifier.isIdentifierStart;
}
});
Object.defineProperty(exports, "isReservedWord", {
enumerable: true,
get: function () {
return _keyword.isReservedWord;
}
});
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
enumerable: true,
get: function () {
return _keyword.isStrictBindOnlyReservedWord;
}
});
Object.defineProperty(exports, "isStrictBindReservedWord", {
enumerable: true,
get: function () {
return _keyword.isStrictBindReservedWord;
}
});
Object.defineProperty(exports, "isStrictReservedWord", {
enumerable: true,
get: function () {
return _keyword.isStrictReservedWord;
}
});
Object.defineProperty(exports, "isKeyword", {
enumerable: true,
get: function () {
return _keyword.isKeyword;
}
});
var _identifier = __webpack_require__(781);
var _keyword = __webpack_require__(782);
/***/ }),
/* 668 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PLACEHOLDERS_FLIPPED_ALIAS = exports.PLACEHOLDERS_ALIAS = exports.PLACEHOLDERS = void 0;
var _utils = __webpack_require__(571);
const PLACEHOLDERS = ["Identifier", "StringLiteral", "Expression", "Statement", "Declaration", "BlockStatement", "ClassBody", "Pattern"];
exports.PLACEHOLDERS = PLACEHOLDERS;
const PLACEHOLDERS_ALIAS = {
Declaration: ["Statement"],
Pattern: ["PatternLike", "LVal"]
};
exports.PLACEHOLDERS_ALIAS = PLACEHOLDERS_ALIAS;
for (const type of PLACEHOLDERS) {
const alias = _utils.ALIAS_KEYS[type];
if (alias == null ? void 0 : alias.length) PLACEHOLDERS_ALIAS[type] = alias;
}
const PLACEHOLDERS_FLIPPED_ALIAS = {};
exports.PLACEHOLDERS_FLIPPED_ALIAS = PLACEHOLDERS_FLIPPED_ALIAS;
Object.keys(PLACEHOLDERS_ALIAS).forEach(type => {
PLACEHOLDERS_ALIAS[type].forEach(alias => {
if (!Object.hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) {
PLACEHOLDERS_FLIPPED_ALIAS[alias] = [];
}
PLACEHOLDERS_FLIPPED_ALIAS[alias].push(type);
});
});
/***/ }),
/* 669 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isNode;
var _definitions = __webpack_require__(564);
function isNode(node) {
return !!(node && _definitions.VISITOR_KEYS[node.type]);
}
/***/ }),
/* 670 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = removeTypeDuplicates;
var _generated = __webpack_require__(559);
function removeTypeDuplicates(nodes) {
const generics = {};
const bases = {};
const typeGroups = [];
const types = [];
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (!node) continue;
if (types.indexOf(node) >= 0) {
continue;
}
if ((0, _generated.isAnyTypeAnnotation)(node)) {
return [node];
}
if ((0, _generated.isFlowBaseAnnotation)(node)) {
bases[node.type] = node;
continue;
}
if ((0, _generated.isUnionTypeAnnotation)(node)) {
if (typeGroups.indexOf(node.types) < 0) {
nodes = nodes.concat(node.types);
typeGroups.push(node.types);
}
continue;
}
if ((0, _generated.isGenericTypeAnnotation)(node)) {
const name = node.id.name;
if (generics[name]) {
let existing = generics[name];
if (existing.typeParameters) {
if (node.typeParameters) {
existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params));
}
} else {
existing = node.typeParameters;
}
} else {
generics[name] = node;
}
continue;
}
types.push(node);
}
for (const type of Object.keys(bases)) {
types.push(bases[type]);
}
for (const name of Object.keys(generics)) {
types.push(generics[name]);
}
return types;
}
/***/ }),
/* 671 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = addComments;
function addComments(node, type, comments) {
if (!comments || !node) return node;
const key = `${type}Comments`;
if (node[key]) {
if (type === "leading") {
node[key] = comments.concat(node[key]);
} else {
node[key] = node[key].concat(comments);
}
} else {
node[key] = comments;
}
return node;
}
/***/ }),
/* 672 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inheritInnerComments;
var _inherit = _interopRequireDefault(__webpack_require__(629));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inheritInnerComments(child, parent) {
(0, _inherit.default)("innerComments", child, parent);
}
/***/ }),
/* 673 */
/***/ (function(module, exports, __webpack_require__) {
var MapCache = __webpack_require__(617),
setCacheAdd = __webpack_require__(801),
setCacheHas = __webpack_require__(802);
/**
*
* Creates an array cache object to store unique values.
*
* @private
* @constructor
* @param {Array} [values] The values to cache.
*/
function SetCache(values) {
var index = -1,
length = values == null ? 0 : values.length;
this.__data__ = new MapCache;
while (++index < length) {
this.add(values[index]);
}
}
// Add methods to `SetCache`.
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
SetCache.prototype.has = setCacheHas;
module.exports = SetCache;
/***/ }),
/* 674 */
/***/ (function(module, exports) {
/**
* Checks if a `cache` value for `key` exists.
*
* @private
* @param {Object} cache The cache to query.
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function cacheHas(cache, key) {
return cache.has(key);
}
module.exports = cacheHas;
/***/ }),
/* 675 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inheritLeadingComments;
var _inherit = _interopRequireDefault(__webpack_require__(629));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inheritLeadingComments(child, parent) {
(0, _inherit.default)("leadingComments", child, parent);
}
/***/ }),
/* 676 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inheritsComments;
var _inheritTrailingComments = _interopRequireDefault(__webpack_require__(677));
var _inheritLeadingComments = _interopRequireDefault(__webpack_require__(675));
var _inheritInnerComments = _interopRequireDefault(__webpack_require__(672));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inheritsComments(child, parent) {
(0, _inheritTrailingComments.default)(child, parent);
(0, _inheritLeadingComments.default)(child, parent);
(0, _inheritInnerComments.default)(child, parent);
return child;
}
/***/ }),
/* 677 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inheritTrailingComments;
var _inherit = _interopRequireDefault(__webpack_require__(629));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inheritTrailingComments(child, parent) {
(0, _inherit.default)("trailingComments", child, parent);
}
/***/ }),
/* 678 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toBlock;
var _generated = __webpack_require__(559);
var _generated2 = __webpack_require__(561);
function toBlock(node, parent) {
if ((0, _generated.isBlockStatement)(node)) {
return node;
}
let blockNodes = [];
if ((0, _generated.isEmptyStatement)(node)) {
blockNodes = [];
} else {
if (!(0, _generated.isStatement)(node)) {
if ((0, _generated.isFunction)(parent)) {
node = (0, _generated2.returnStatement)(node);
} else {
node = (0, _generated2.expressionStatement)(node);
}
}
blockNodes = [node];
}
return (0, _generated2.blockStatement)(blockNodes);
}
/***/ }),
/* 679 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toIdentifier;
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(580));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toIdentifier(name) {
name = name + "";
name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
name = name.replace(/^[-0-9]+/, "");
name = name.replace(/[-\s]+(.)?/g, function (match, c) {
return c ? c.toUpperCase() : "";
});
if (!(0, _isValidIdentifier.default)(name)) {
name = `_${name}`;
}
return name || "_";
}
/***/ }),
/* 680 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = removePropertiesDeep;
var _traverseFast = _interopRequireDefault(__webpack_require__(681));
var _removeProperties = _interopRequireDefault(__webpack_require__(682));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function removePropertiesDeep(tree, opts) {
(0, _traverseFast.default)(tree, _removeProperties.default, opts);
return tree;
}
/***/ }),
/* 681 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = traverseFast;
var _definitions = __webpack_require__(564);
function traverseFast(node, enter, opts) {
if (!node) return;
const keys = _definitions.VISITOR_KEYS[node.type];
if (!keys) return;
opts = opts || {};
enter(node, opts);
for (const key of keys) {
const subNode = node[key];
if (Array.isArray(subNode)) {
for (const node of subNode) {
traverseFast(node, enter, opts);
}
} else {
traverseFast(subNode, enter, opts);
}
}
}
/***/ }),
/* 682 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = removeProperties;
var _constants = __webpack_require__(575);
const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
const CLEAR_KEYS_PLUS_COMMENTS = _constants.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS);
function removeProperties(node, opts = {}) {
const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;
for (const key of map) {
if (node[key] != null) node[key] = undefined;
}
for (const key of Object.keys(node)) {
if (key[0] === "_" && node[key] != null) node[key] = undefined;
}
const symbols = Object.getOwnPropertySymbols(node);
for (const sym of symbols) {
node[sym] = null;
}
}
/***/ }),
/* 683 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isLet;
var _generated = __webpack_require__(559);
var _constants = __webpack_require__(575);
function isLet(node) {
return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
}
/***/ }),
/* 684 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createSimplePath;
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
function createSimplePath(ancestors) {
if (ancestors.length === 0) {
return null;
} // Slice the array because babel-types traverse may continue mutating
// the ancestors array in later traversal logic.
return new SimplePath(ancestors.slice());
}
/**
* Mimics @babel/traverse's NodePath API in a simpler fashion that isn't as
* heavy, but still allows the ease of passing paths around to process nested
* AST structures.
*/
class SimplePath {
constructor(ancestors, index = ancestors.length - 1) {
if (index < 0 || index >= ancestors.length) {
console.error(ancestors);
throw new Error("Created invalid path");
}
this._ancestors = ancestors;
this._ancestor = ancestors[index];
this._index = index;
}
get parentPath() {
let path = this._parentPath;
if (path === undefined) {
if (this._index === 0) {
path = null;
} else {
path = new SimplePath(this._ancestors, this._index - 1);
}
this._parentPath = path;
}
return path;
}
get parent() {
return this._ancestor.node;
}
get node() {
const {
node,
key,
index
} = this._ancestor;
if (typeof index === "number") {
return node[key][index];
}
return node[key];
}
get key() {
return this._ancestor.key;
}
set node(replacement) {
if (this.type !== "Identifier") {
throw new Error("Replacing anything other than leaf nodes is undefined behavior " + "in t.traverse()");
}
const {
node,
key,
index
} = this._ancestor;
if (typeof index === "number") {
node[key][index] = replacement;
} else {
node[key] = replacement;
}
}
get type() {
return this.node.type;
}
get inList() {
return typeof this._ancestor.index === "number";
}
get containerIndex() {
const {
index
} = this._ancestor;
if (typeof index !== "number") {
throw new Error("Cannot get index of non-array node");
}
return index;
}
get depth() {
return this._index;
}
replace(node) {
this.node = node;
}
find(predicate) {
for (let path = this; path; path = path.parentPath) {
if (predicate(path)) {
return path;
}
}
return null;
}
findParent(predicate) {
if (!this.parentPath) {
throw new Error("Cannot use findParent on root path");
}
return this.parentPath.find(predicate);
}
getSibling(offset) {
const {
node,
key,
index
} = this._ancestor;
if (typeof index !== "number") {
throw new Error("Non-array nodes do not have siblings");
}
const container = node[key];
const siblingIndex = index + offset;
if (siblingIndex < 0 || siblingIndex >= container.length) {
return null;
}
return new SimplePath(this._ancestors.slice(0, -1).concat([{
node,
key,
index: siblingIndex
}]));
}
}
/***/ }),
/* 685 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', { value: true });
const beforeExpr = true;
const startsExpr = true;
const isLoop = true;
const isAssign = true;
const prefix = true;
const postfix = true;
class TokenType {
constructor(label, conf = {}) {
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.rightAssociative = !!conf.rightAssociative;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop != null ? conf.binop : null;
this.updateContext = null;
}
}
const keywords = new Map();
function createKeyword(name, options = {}) {
options.keyword = name;
const token = new TokenType(name, options);
keywords.set(name, token);
return token;
}
function createBinop(name, binop) {
return new TokenType(name, {
beforeExpr,
binop
});
}
const types = {
num: new TokenType("num", {
startsExpr
}),
bigint: new TokenType("bigint", {
startsExpr
}),
regexp: new TokenType("regexp", {
startsExpr
}),
string: new TokenType("string", {
startsExpr
}),
name: new TokenType("name", {
startsExpr
}),
eof: new TokenType("eof"),
bracketL: new TokenType("[", {
beforeExpr,
startsExpr
}),
bracketHashL: new TokenType("#[", {
beforeExpr,
startsExpr
}),
bracketBarL: new TokenType("[|", {
beforeExpr,
startsExpr
}),
bracketR: new TokenType("]"),
bracketBarR: new TokenType("|]"),
braceL: new TokenType("{", {
beforeExpr,
startsExpr
}),
braceBarL: new TokenType("{|", {
beforeExpr,
startsExpr
}),
braceHashL: new TokenType("#{", {
beforeExpr,
startsExpr
}),
braceR: new TokenType("}"),
braceBarR: new TokenType("|}"),
parenL: new TokenType("(", {
beforeExpr,
startsExpr
}),
parenR: new TokenType(")"),
comma: new TokenType(",", {
beforeExpr
}),
semi: new TokenType(";", {
beforeExpr
}),
colon: new TokenType(":", {
beforeExpr
}),
doubleColon: new TokenType("::", {
beforeExpr
}),
dot: new TokenType("."),
question: new TokenType("?", {
beforeExpr
}),
questionDot: new TokenType("?."),
arrow: new TokenType("=>", {
beforeExpr
}),
template: new TokenType("template"),
ellipsis: new TokenType("...", {
beforeExpr
}),
backQuote: new TokenType("`", {
startsExpr
}),
dollarBraceL: new TokenType("${", {
beforeExpr,
startsExpr
}),
at: new TokenType("@"),
hash: new TokenType("#", {
startsExpr
}),
interpreterDirective: new TokenType("#!..."),
eq: new TokenType("=", {
beforeExpr,
isAssign
}),
assign: new TokenType("_=", {
beforeExpr,
isAssign
}),
incDec: new TokenType("++/--", {
prefix,
postfix,
startsExpr
}),
bang: new TokenType("!", {
beforeExpr,
prefix,
startsExpr
}),
tilde: new TokenType("~", {
beforeExpr,
prefix,
startsExpr
}),
pipeline: createBinop("|>", 0),
nullishCoalescing: createBinop("??", 1),
logicalOR: createBinop("||", 1),
logicalAND: createBinop("&&", 2),
bitwiseOR: createBinop("|", 3),
bitwiseXOR: createBinop("^", 4),
bitwiseAND: createBinop("&", 5),
equality: createBinop("==/!=/===/!==", 6),
relational: createBinop(">/<=/>=", 7),
bitShift: createBinop("<>>/>>>", 8),
plusMin: new TokenType("+/-", {
beforeExpr,
binop: 9,
prefix,
startsExpr
}),
modulo: new TokenType("%", {
beforeExpr,
binop: 10,
startsExpr
}),
star: createBinop("*", 10),
slash: createBinop("/", 10),
exponent: new TokenType("**", {
beforeExpr,
binop: 11,
rightAssociative: true
}),
_break: createKeyword("break"),
_case: createKeyword("case", {
beforeExpr
}),
_catch: createKeyword("catch"),
_continue: createKeyword("continue"),
_debugger: createKeyword("debugger"),
_default: createKeyword("default", {
beforeExpr
}),
_do: createKeyword("do", {
isLoop,
beforeExpr
}),
_else: createKeyword("else", {
beforeExpr
}),
_finally: createKeyword("finally"),
_for: createKeyword("for", {
isLoop
}),
_function: createKeyword("function", {
startsExpr
}),
_if: createKeyword("if"),
_return: createKeyword("return", {
beforeExpr
}),
_switch: createKeyword("switch"),
_throw: createKeyword("throw", {
beforeExpr,
prefix,
startsExpr
}),
_try: createKeyword("try"),
_var: createKeyword("var"),
_const: createKeyword("const"),
_while: createKeyword("while", {
isLoop
}),
_with: createKeyword("with"),
_new: createKeyword("new", {
beforeExpr,
startsExpr
}),
_this: createKeyword("this", {
startsExpr
}),
_super: createKeyword("super", {
startsExpr
}),
_class: createKeyword("class", {
startsExpr
}),
_extends: createKeyword("extends", {
beforeExpr
}),
_export: createKeyword("export"),
_import: createKeyword("import", {
startsExpr
}),
_null: createKeyword("null", {
startsExpr
}),
_true: createKeyword("true", {
startsExpr
}),
_false: createKeyword("false", {
startsExpr
}),
_in: createKeyword("in", {
beforeExpr,
binop: 7
}),
_instanceof: createKeyword("instanceof", {
beforeExpr,
binop: 7
}),
_typeof: createKeyword("typeof", {
beforeExpr,
prefix,
startsExpr
}),
_void: createKeyword("void", {
beforeExpr,
prefix,
startsExpr
}),
_delete: createKeyword("delete", {
beforeExpr,
prefix,
startsExpr
})
};
const SCOPE_OTHER = 0b00000000,
SCOPE_PROGRAM = 0b00000001,
SCOPE_FUNCTION = 0b00000010,
SCOPE_ARROW = 0b00000100,
SCOPE_SIMPLE_CATCH = 0b00001000,
SCOPE_SUPER = 0b00010000,
SCOPE_DIRECT_SUPER = 0b00100000,
SCOPE_CLASS = 0b01000000,
SCOPE_TS_MODULE = 0b10000000,
SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE;
const BIND_KIND_VALUE = 0b00000000001,
BIND_KIND_TYPE = 0b00000000010,
BIND_SCOPE_VAR = 0b00000000100,
BIND_SCOPE_LEXICAL = 0b00000001000,
BIND_SCOPE_FUNCTION = 0b00000010000,
BIND_FLAGS_NONE = 0b00001000000,
BIND_FLAGS_CLASS = 0b00010000000,
BIND_FLAGS_TS_ENUM = 0b00100000000,
BIND_FLAGS_TS_CONST_ENUM = 0b01000000000,
BIND_FLAGS_TS_EXPORT_ONLY = 0b10000000000;
const BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS,
BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0,
BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0,
BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0,
BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS,
BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0,
BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM,
BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY,
BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE,
BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE,
BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM,
BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY;
const CLASS_ELEMENT_FLAG_STATIC = 0b100,
CLASS_ELEMENT_KIND_GETTER = 0b010,
CLASS_ELEMENT_KIND_SETTER = 0b001,
CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
const CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC,
CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC,
CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_KIND_GETTER,
CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_KIND_SETTER,
CLASS_ELEMENT_OTHER = 0;
const lineBreak = /\r\n?|[\n\u2028\u2029]/;
const lineBreakG = new RegExp(lineBreak.source, "g");
function isNewLine(code) {
switch (code) {
case 10:
case 13:
case 8232:
case 8233:
return true;
default:
return false;
}
}
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
function isWhitespace(code) {
switch (code) {
case 0x0009:
case 0x000b:
case 0x000c:
case 32:
case 160:
case 5760:
case 0x2000:
case 0x2001:
case 0x2002:
case 0x2003:
case 0x2004:
case 0x2005:
case 0x2006:
case 0x2007:
case 0x2008:
case 0x2009:
case 0x200a:
case 0x202f:
case 0x205f:
case 0x3000:
case 0xfeff:
return true;
default:
return false;
}
}
class Position {
constructor(line, col) {
this.line = line;
this.column = col;
}
}
class SourceLocation {
constructor(start, end) {
this.start = start;
this.end = end;
}
}
function getLineInfo(input, offset) {
let line = 1;
let lineStart = 0;
let match;
lineBreakG.lastIndex = 0;
while ((match = lineBreakG.exec(input)) && match.index < offset) {
line++;
lineStart = lineBreakG.lastIndex;
}
return new Position(line, offset - lineStart);
}
class BaseParser {
constructor() {
this.sawUnambiguousESM = false;
this.ambiguousScriptDifferentAst = false;
}
hasPlugin(name) {
return this.plugins.has(name);
}
getPluginOption(plugin, name) {
if (this.hasPlugin(plugin)) return this.plugins.get(plugin)[name];
}
}
function last(stack) {
return stack[stack.length - 1];
}
class CommentsParser extends BaseParser {
addComment(comment) {
if (this.filename) comment.loc.filename = this.filename;
this.state.trailingComments.push(comment);
this.state.leadingComments.push(comment);
}
adjustCommentsAfterTrailingComma(node, elements, takeAllComments) {
if (this.state.leadingComments.length === 0) {
return;
}
let lastElement = null;
let i = elements.length;
while (lastElement === null && i > 0) {
lastElement = elements[--i];
}
if (lastElement === null) {
return;
}
for (let j = 0; j < this.state.leadingComments.length; j++) {
if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
this.state.leadingComments.splice(j, 1);
j--;
}
}
const newTrailingComments = [];
for (let i = 0; i < this.state.leadingComments.length; i++) {
const leadingComment = this.state.leadingComments[i];
if (leadingComment.end < node.end) {
newTrailingComments.push(leadingComment);
if (!takeAllComments) {
this.state.leadingComments.splice(i, 1);
i--;
}
} else {
if (node.trailingComments === undefined) {
node.trailingComments = [];
}
node.trailingComments.push(leadingComment);
}
}
if (takeAllComments) this.state.leadingComments = [];
if (newTrailingComments.length > 0) {
lastElement.trailingComments = newTrailingComments;
} else if (lastElement.trailingComments !== undefined) {
lastElement.trailingComments = [];
}
}
processComment(node) {
if (node.type === "Program" && node.body.length > 0) return;
const stack = this.state.commentStack;
let firstChild, lastChild, trailingComments, i, j;
if (this.state.trailingComments.length > 0) {
if (this.state.trailingComments[0].start >= node.end) {
trailingComments = this.state.trailingComments;
this.state.trailingComments = [];
} else {
this.state.trailingComments.length = 0;
}
} else if (stack.length > 0) {
const lastInStack = last(stack);
if (lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) {
trailingComments = lastInStack.trailingComments;
delete lastInStack.trailingComments;
}
}
if (stack.length > 0 && last(stack).start >= node.start) {
firstChild = stack.pop();
}
while (stack.length > 0 && last(stack).start >= node.start) {
lastChild = stack.pop();
}
if (!lastChild && firstChild) lastChild = firstChild;
if (firstChild) {
switch (node.type) {
case "ObjectExpression":
this.adjustCommentsAfterTrailingComma(node, node.properties);
break;
case "ObjectPattern":
this.adjustCommentsAfterTrailingComma(node, node.properties, true);
break;
case "CallExpression":
this.adjustCommentsAfterTrailingComma(node, node.arguments);
break;
case "ArrayExpression":
this.adjustCommentsAfterTrailingComma(node, node.elements);
break;
case "ArrayPattern":
this.adjustCommentsAfterTrailingComma(node, node.elements, true);
break;
}
} else if (this.state.commentPreviousNode && (this.state.commentPreviousNode.type === "ImportSpecifier" && node.type !== "ImportSpecifier" || this.state.commentPreviousNode.type === "ExportSpecifier" && node.type !== "ExportSpecifier")) {
this.adjustCommentsAfterTrailingComma(node, [this.state.commentPreviousNode]);
}
if (lastChild) {
if (lastChild.leadingComments) {
if (lastChild !== node && lastChild.leadingComments.length > 0 && last(lastChild.leadingComments).end <= node.start) {
node.leadingComments = lastChild.leadingComments;
delete lastChild.leadingComments;
} else {
for (i = lastChild.leadingComments.length - 2; i >= 0; --i) {
if (lastChild.leadingComments[i].end <= node.start) {
node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
break;
}
}
}
}
} else if (this.state.leadingComments.length > 0) {
if (last(this.state.leadingComments).end <= node.start) {
if (this.state.commentPreviousNode) {
for (j = 0; j < this.state.leadingComments.length; j++) {
if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
this.state.leadingComments.splice(j, 1);
j--;
}
}
}
if (this.state.leadingComments.length > 0) {
node.leadingComments = this.state.leadingComments;
this.state.leadingComments = [];
}
} else {
for (i = 0; i < this.state.leadingComments.length; i++) {
if (this.state.leadingComments[i].end > node.start) {
break;
}
}
const leadingComments = this.state.leadingComments.slice(0, i);
if (leadingComments.length) {
node.leadingComments = leadingComments;
}
trailingComments = this.state.leadingComments.slice(i);
if (trailingComments.length === 0) {
trailingComments = null;
}
}
}
this.state.commentPreviousNode = node;
if (trailingComments) {
if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
node.innerComments = trailingComments;
} else {
const firstTrailingCommentIndex = trailingComments.findIndex(comment => comment.end >= node.end);
if (firstTrailingCommentIndex > 0) {
node.innerComments = trailingComments.slice(0, firstTrailingCommentIndex);
node.trailingComments = trailingComments.slice(firstTrailingCommentIndex);
} else {
node.trailingComments = trailingComments;
}
}
}
stack.push(node);
}
}
const ErrorMessages = Object.freeze({
ArgumentsDisallowedInInitializer: "'arguments' is not allowed in class field initializer",
AsyncFunctionInSingleStatementContext: "Async functions can only be declared at the top level or inside a block",
AwaitBindingIdentifier: "Can not use 'await' as identifier inside an async function",
AwaitExpressionFormalParameter: "await is not allowed in async function parameters",
AwaitNotInAsyncFunction: "Can not use keyword 'await' outside an async function",
BadGetterArity: "getter must not have any formal parameters",
BadSetterArity: "setter must have exactly one formal parameter",
BadSetterRestParameter: "setter function argument must not be a rest parameter",
ConstructorClassField: "Classes may not have a field named 'constructor'",
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'",
ConstructorIsAccessor: "Class constructor may not be an accessor",
ConstructorIsAsync: "Constructor can't be an async function",
ConstructorIsGenerator: "Constructor can't be a generator",
DeclarationMissingInitializer: "%0 require an initialization value",
DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax",
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.",
DecoratorSemicolon: "Decorators must not be followed by a semicolon",
DeletePrivateField: "Deleting a private field is not allowed",
DestructureNamedImport: "ES2015 named imports do not destructure. Use another statement for destructuring after the import.",
DuplicateConstructor: "Duplicate constructor in the same class",
DuplicateDefaultExport: "Only one default export allowed per module.",
DuplicateExport: "`%0` has already been exported. Exported identifiers must be unique.",
DuplicateProto: "Redefinition of __proto__ property",
DuplicateRegExpFlags: "Duplicate regular expression flag",
ElementAfterRest: "Rest element must be last element",
EscapedCharNotAnIdentifier: "Invalid Unicode escape",
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'",
ForInOfLoopInitializer: "%0 loop variable declaration may not have an initializer",
GeneratorInSingleStatementContext: "Generators can only be declared at the top level or inside a block",
IllegalBreakContinue: "Unsyntactic %0",
IllegalLanguageModeDirective: "Illegal 'use strict' directive in function with non-simple parameter list",
IllegalReturn: "'return' outside of function",
ImportCallArgumentTrailingComma: "Trailing comma is disallowed inside import(...) arguments",
ImportCallArity: "import() requires exactly %0",
ImportCallNotNewExpression: "Cannot use new with import(...)",
ImportCallSpreadArgument: "... is not allowed in import()",
ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`,
ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: "module"'`,
InvalidBigIntLiteral: "Invalid BigIntLiteral",
InvalidCodePoint: "Code point out of bounds",
InvalidDigit: "Expected number in radix %0",
InvalidEscapeSequence: "Bad character escape sequence",
InvalidEscapeSequenceTemplate: "Invalid escape sequence in template",
InvalidEscapedReservedWord: "Escape sequence in keyword %0",
InvalidIdentifier: "Invalid identifier %0",
InvalidLhs: "Invalid left-hand side in %0",
InvalidLhsBinding: "Binding invalid left-hand side in %0",
InvalidNumber: "Invalid number",
InvalidOrUnexpectedToken: "Unexpected character '%0'",
InvalidParenthesizedAssignment: "Invalid parenthesized assignment pattern",
InvalidPrivateFieldResolution: "Private name #%0 is not defined",
InvalidPropertyBindingPattern: "Binding member expression",
InvalidRecordProperty: "Only properties and spread elements are allowed in record definitions",
InvalidRestAssignmentPattern: "Invalid rest operator's argument",
LabelRedeclaration: "Label '%0' is already declared",
LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations.",
MalformedRegExpFlags: "Invalid regular expression flag",
MissingClassName: "A class name is required",
MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
MissingUnicodeEscape: "Expecting Unicode escape sequence \\uXXXX",
MixingCoalesceWithLogical: "Nullish coalescing operator(??) requires parens when mixing with logical operators",
ModuleAttributeDifferentFromType: "The only accepted module attribute is `type`",
ModuleAttributeInvalidValue: "Only string literals are allowed as module attribute values",
ModuleAttributesWithDuplicateKeys: 'Duplicate key "%0" is not allowed in module attributes',
ModuleExportUndefined: "Export '%0' is not defined",
MultipleDefaultsInSwitch: "Multiple default clauses",
NewlineAfterThrow: "Illegal newline after throw",
NoCatchOrFinally: "Missing catch or finally clause",
NumberIdentifier: "Identifier directly after number",
NumericSeparatorInEscapeSequence: "Numeric separators are not allowed inside unicode escape sequences or hex escape sequences",
ObsoleteAwaitStar: "await* has been removed from the async functions proposal. Use Promise.all() instead.",
OptionalChainingNoNew: "constructors in/after an Optional Chain are not allowed",
OptionalChainingNoTemplate: "Tagged Template Literals are not allowed in optionalChain",
ParamDupe: "Argument name clash",
PatternHasAccessor: "Object pattern can't contain getter or setter",
PatternHasMethod: "Object pattern can't contain methods",
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized',
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression",
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression",
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference",
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding",
PrimaryTopicRequiresSmartPipeline: "Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option.",
PrivateInExpectedIn: "Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`)",
PrivateNameRedeclaration: "Duplicate private name #%0",
RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'",
RecordNoProto: "'__proto__' is not allowed in Record expressions",
RestTrailingComma: "Unexpected trailing comma after rest element",
SloppyFunction: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",
StaticPrototype: "Classes may not have static property named prototype",
StrictDelete: "Deleting local variable in strict mode",
StrictEvalArguments: "Assigning to '%0' in strict mode",
StrictEvalArgumentsBinding: "Binding '%0' in strict mode",
StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block",
StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode",
StrictWith: "'with' in strict mode",
SuperNotAllowed: "super() is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",
SuperPrivateField: "Private fields can't be accessed on super",
TrailingDecorator: "Decorators must be attached to a class element",
TupleExpressionBarIncorrectEndSyntaxType: "Tuple expressions ending with '|]' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
TupleExpressionBarIncorrectStartSyntaxType: "Tuple expressions starting with '[|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
TupleExpressionHashIncorrectStartSyntaxType: "Tuple expressions starting with '#[' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'",
UnexpectedArgumentPlaceholder: "Unexpected argument placeholder",
UnexpectedAwaitAfterPipelineBody: 'Unexpected "await" after pipeline body; await must have parentheses in minimal proposal',
UnexpectedDigitAfterHash: "Unexpected digit after hash token",
UnexpectedImportExport: "'import' and 'export' may only appear at the top level",
UnexpectedKeyword: "Unexpected keyword '%0'",
UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration",
UnexpectedLexicalDeclaration: "Lexical declaration cannot appear in a single-statement context",
UnexpectedNewTarget: "new.target can only be used in functions",
UnexpectedNumericSeparator: "A numeric separator is only allowed between two digits",
UnexpectedPrivateField: "Private names can only be used as the name of a class element (i.e. class C { #p = 42; #m() {} } )\n or a property of member expression (i.e. this.#p).",
UnexpectedReservedWord: "Unexpected reserved word '%0'",
UnexpectedSuper: "super is only allowed in object methods and classes",
UnexpectedToken: "Unexpected token '%0'",
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
UnsupportedBind: "Binding should be performed on object property.",
UnsupportedDecoratorExport: "A decorated export must export a class declaration",
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
UnsupportedImport: "import can only be used in import() or import.meta",
UnsupportedMetaProperty: "The only valid meta property for %0 is %0.%1",
UnsupportedParameterDecorator: "Decorators cannot be used to decorate parameters",
UnsupportedPropertyDecorator: "Decorators cannot be used to decorate object literal properties",
UnsupportedSuper: "super can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop])",
UnterminatedComment: "Unterminated comment",
UnterminatedRegExp: "Unterminated regular expression",
UnterminatedString: "Unterminated string constant",
UnterminatedTemplate: "Unterminated template",
VarRedeclaration: "Identifier '%0' has already been declared",
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator",
YieldInParameter: "yield is not allowed in generator parameters",
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0"
});
class ParserError extends CommentsParser {
getLocationForPosition(pos) {
let loc;
if (pos === this.state.start) loc = this.state.startLoc;else if (pos === this.state.lastTokStart) loc = this.state.lastTokStartLoc;else if (pos === this.state.end) loc = this.state.endLoc;else if (pos === this.state.lastTokEnd) loc = this.state.lastTokEndLoc;else loc = getLineInfo(this.input, pos);
return loc;
}
raise(pos, errorTemplate, ...params) {
return this.raiseWithData(pos, undefined, errorTemplate, ...params);
}
raiseWithData(pos, data, errorTemplate, ...params) {
const loc = this.getLocationForPosition(pos);
const message = errorTemplate.replace(/%(\d+)/g, (_, i) => params[i]) + ` (${loc.line}:${loc.column})`;
return this._raise(Object.assign({
loc,
pos
}, data), message);
}
_raise(errorContext, message) {
const err = new SyntaxError(message);
Object.assign(err, errorContext);
if (this.options.errorRecovery) {
if (!this.isLookahead) this.state.errors.push(err);
return err;
} else {
throw err;
}
}
}
function isSimpleProperty(node) {
return node != null && node.type === "Property" && node.kind === "init" && node.method === false;
}
var estree = (superClass => class extends superClass {
estreeParseRegExpLiteral({
pattern,
flags
}) {
let regex = null;
try {
regex = new RegExp(pattern, flags);
} catch (e) {}
const node = this.estreeParseLiteral(regex);
node.regex = {
pattern,
flags
};
return node;
}
estreeParseBigIntLiteral(value) {
const bigInt = typeof BigInt !== "undefined" ? BigInt(value) : null;
const node = this.estreeParseLiteral(bigInt);
node.bigint = String(node.value || value);
return node;
}
estreeParseLiteral(value) {
return this.parseLiteral(value, "Literal");
}
directiveToStmt(directive) {
const directiveLiteral = directive.value;
const stmt = this.startNodeAt(directive.start, directive.loc.start);
const expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
expression.value = directiveLiteral.value;
expression.raw = directiveLiteral.extra.raw;
stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end);
stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end);
}
initFunction(node, isAsync) {
super.initFunction(node, isAsync);
node.expression = false;
}
checkDeclaration(node) {
if (isSimpleProperty(node)) {
this.checkDeclaration(node.value);
} else {
super.checkDeclaration(node);
}
}
checkGetterSetterParams(method) {
const prop = method;
const paramCount = prop.kind === "get" ? 0 : 1;
const start = prop.start;
if (prop.value.params.length !== paramCount) {
if (method.kind === "get") {
this.raise(start, ErrorMessages.BadGetterArity);
} else {
this.raise(start, ErrorMessages.BadSetterArity);
}
} else if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
this.raise(start, ErrorMessages.BadSetterRestParameter);
}
}
checkLVal(expr, bindingType = BIND_NONE, checkClashes, contextDescription, disallowLetBinding) {
switch (expr.type) {
case "ObjectPattern":
expr.properties.forEach(prop => {
this.checkLVal(prop.type === "Property" ? prop.value : prop, bindingType, checkClashes, "object destructuring pattern", disallowLetBinding);
});
break;
default:
super.checkLVal(expr, bindingType, checkClashes, contextDescription, disallowLetBinding);
}
}
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
if (prop.method) {
return;
}
super.checkProto(prop, isRecord, protoRef, refExpressionErrors);
}
isValidDirective(stmt) {
var _stmt$expression$extr;
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !((_stmt$expression$extr = stmt.expression.extra) == null ? void 0 : _stmt$expression$extr.parenthesized);
}
stmtToDirective(stmt) {
const directive = super.stmtToDirective(stmt);
const value = stmt.expression.value;
directive.value.value = value;
return directive;
}
parseBlockBody(node, allowDirectives, topLevel, end) {
super.parseBlockBody(node, allowDirectives, topLevel, end);
const directiveStatements = node.directives.map(d => this.directiveToStmt(d));
node.body = directiveStatements.concat(node.body);
delete node.directives;
}
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);
if (method.typeParameters) {
method.value.typeParameters = method.typeParameters;
delete method.typeParameters;
}
classBody.body.push(method);
}
parseExprAtom(refExpressionErrors) {
switch (this.state.type) {
case types.num:
case types.string:
return this.estreeParseLiteral(this.state.value);
case types.regexp:
return this.estreeParseRegExpLiteral(this.state.value);
case types.bigint:
return this.estreeParseBigIntLiteral(this.state.value);
case types._null:
return this.estreeParseLiteral(null);
case types._true:
return this.estreeParseLiteral(true);
case types._false:
return this.estreeParseLiteral(false);
default:
return super.parseExprAtom(refExpressionErrors);
}
}
parseLiteral(value, type, startPos, startLoc) {
const node = super.parseLiteral(value, type, startPos, startLoc);
node.raw = node.extra.raw;
delete node.extra;
return node;
}
parseFunctionBody(node, allowExpression, isMethod = false) {
super.parseFunctionBody(node, allowExpression, isMethod);
node.expression = node.body.type !== "BlockStatement";
}
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
let funcNode = this.startNode();
funcNode.kind = node.kind;
funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
funcNode.type = "FunctionExpression";
delete funcNode.kind;
node.value = funcNode;
type = type === "ClassMethod" ? "MethodDefinition" : type;
return this.finishNode(node, type);
}
parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) {
const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc);
if (node) {
node.type = "Property";
if (node.kind === "method") node.kind = "init";
node.shorthand = false;
}
return node;
}
parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors) {
const node = super.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors);
if (node) {
node.kind = "init";
node.type = "Property";
}
return node;
}
toAssignable(node) {
if (isSimpleProperty(node)) {
this.toAssignable(node.value);
return node;
}
return super.toAssignable(node);
}
toAssignableObjectExpressionProp(prop, isLast) {
if (prop.kind === "get" || prop.kind === "set") {
throw this.raise(prop.key.start, ErrorMessages.PatternHasAccessor);
} else if (prop.method) {
throw this.raise(prop.key.start, ErrorMessages.PatternHasMethod);
} else {
super.toAssignableObjectExpressionProp(prop, isLast);
}
}
finishCallExpression(node, optional) {
super.finishCallExpression(node, optional);
if (node.callee.type === "Import") {
node.type = "ImportExpression";
node.source = node.arguments[0];
delete node.arguments;
delete node.callee;
} else if (node.type === "CallExpression") {
node.optional = false;
}
return node;
}
toReferencedListDeep(exprList, isParenthesizedExpr) {
if (!exprList) {
return;
}
super.toReferencedListDeep(exprList, isParenthesizedExpr);
}
parseExport(node) {
super.parseExport(node);
switch (node.type) {
case "ExportAllDeclaration":
node.exported = null;
break;
case "ExportNamedDeclaration":
if (node.specifiers.length === 1 && node.specifiers[0].type === "ExportNamespaceSpecifier") {
node.type = "ExportAllDeclaration";
node.exported = node.specifiers[0].exported;
delete node.specifiers;
}
break;
}
return node;
}
parseSubscript(...args) {
const node = super.parseSubscript(...args);
if (node.type === "MemberExpression") {
node.optional = false;
}
return node;
}
});
class TokContext {
constructor(token, isExpr, preserveSpace, override) {
this.token = token;
this.isExpr = !!isExpr;
this.preserveSpace = !!preserveSpace;
this.override = override;
}
}
const types$1 = {
braceStatement: new TokContext("{", false),
braceExpression: new TokContext("{", true),
templateQuasi: new TokContext("${", false),
parenStatement: new TokContext("(", false),
parenExpression: new TokContext("(", true),
template: new TokContext("`", true, true, p => p.readTmplToken()),
functionExpression: new TokContext("function", true),
functionStatement: new TokContext("function", false)
};
types.parenR.updateContext = types.braceR.updateContext = function () {
if (this.state.context.length === 1) {
this.state.exprAllowed = true;
return;
}
let out = this.state.context.pop();
if (out === types$1.braceStatement && this.curContext().token === "function") {
out = this.state.context.pop();
}
this.state.exprAllowed = !out.isExpr;
};
types.name.updateContext = function (prevType) {
let allowed = false;
if (prevType !== types.dot) {
if (this.state.value === "of" && !this.state.exprAllowed && prevType !== types._function && prevType !== types._class || this.state.value === "yield" && this.prodParam.hasYield) {
allowed = true;
}
}
this.state.exprAllowed = allowed;
if (this.state.isIterator) {
this.state.isIterator = false;
}
};
types.braceL.updateContext = function (prevType) {
this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression);
this.state.exprAllowed = true;
};
types.dollarBraceL.updateContext = function () {
this.state.context.push(types$1.templateQuasi);
this.state.exprAllowed = true;
};
types.parenL.updateContext = function (prevType) {
const statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression);
this.state.exprAllowed = true;
};
types.incDec.updateContext = function () {};
types._function.updateContext = types._class.updateContext = function (prevType) {
if (prevType === types.dot || prevType === types.questionDot) ; else if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else && !(prevType === types._return && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) && !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat)) {
this.state.context.push(types$1.functionExpression);
} else {
this.state.context.push(types$1.functionStatement);
}
this.state.exprAllowed = false;
};
types.backQuote.updateContext = function () {
if (this.curContext() === types$1.template) {
this.state.context.pop();
} else {
this.state.context.push(types$1.template);
}
this.state.exprAllowed = false;
};
types.star.updateContext = function () {
this.state.exprAllowed = false;
};
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
function isInAstralSet(code, set) {
let pos = 0x10000;
for (let i = 0, length = set.length; i < length; i += 2) {
pos += set[i];
if (pos > code) return false;
pos += set[i + 1];
if (pos >= code) return true;
}
return false;
}
function isIdentifierStart(code) {
if (code < 65) return code === 36;
if (code <= 90) return true;
if (code < 97) return code === 95;
if (code <= 122) return true;
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
return isInAstralSet(code, astralIdentifierStartCodes);
}
function isIdentifierChar(code) {
if (code < 48) return code === 36;
if (code < 58) return true;
if (code < 65) return false;
if (code <= 90) return true;
if (code < 97) return code === 95;
if (code <= 122) return true;
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
}
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
const reservedWords = {
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
strictBind: ["eval", "arguments"]
};
const keywords$1 = new Set(reservedWords.keyword);
const reservedWordsStrictSet = new Set(reservedWords.strict);
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
function isReservedWord(word, inModule) {
return inModule && word === "await" || word === "enum";
}
function isStrictReservedWord(word, inModule) {
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
}
function isStrictBindOnlyReservedWord(word) {
return reservedWordsStrictBindSet.has(word);
}
function isStrictBindReservedWord(word, inModule) {
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
}
function isKeyword(word) {
return keywords$1.has(word);
}
const keywordRelationalOperator = /^in(stanceof)?$/;
function isIteratorStart(current, next) {
return current === 64 && next === 64;
}
const reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
const FlowErrors = Object.freeze({
AmbiguousConditionalArrow: "Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",
AmbiguousDeclareModuleKind: "Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module",
AssignReservedType: "Cannot overwrite reserved type %0",
DeclareClassElement: "The `declare` modifier can only appear on class fields.",
DeclareClassFieldInitializer: "Initializers are not allowed in fields with the `declare` modifier.",
DuplicateDeclareModuleExports: "Duplicate `declare module.exports` statement",
EnumBooleanMemberNotInitialized: "Boolean enum members need to be initialized. Use either `%0 = true,` or `%0 = false,` in enum `%1`.",
EnumDuplicateMemberName: "Enum member names need to be unique, but the name `%0` has already been used before in enum `%1`.",
EnumInconsistentMemberValues: "Enum `%0` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.",
EnumInvalidExplicitType: "Enum type `%1` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `%0`.",
EnumInvalidExplicitTypeUnknownSupplied: "Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `%0`.",
EnumInvalidMemberInitializerPrimaryType: "Enum `%0` has type `%2`, so the initializer of `%1` needs to be a %2 literal.",
EnumInvalidMemberInitializerSymbolType: "Symbol enum members cannot be initialized. Use `%1,` in enum `%0`.",
EnumInvalidMemberInitializerUnknownType: "The enum member initializer for `%1` needs to be a literal (either a boolean, number, or string) in enum `%0`.",
EnumInvalidMemberName: "Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `%0`, consider using `%1`, in enum `%2`.",
EnumNumberMemberNotInitialized: "Number enum members need to be initialized, e.g. `%1 = 1` in enum `%0`.",
EnumStringMemberInconsistentlyInitailized: "String enum members need to consistently either all use initializers, or use no initializers, in enum `%0`.",
ImportTypeShorthandOnlyInPureImport: "The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements",
InexactInsideExact: "Explicit inexact syntax cannot appear inside an explicit exact object type",
InexactInsideNonObject: "Explicit inexact syntax cannot appear in class or interface definitions",
InexactVariance: "Explicit inexact syntax cannot have variance",
InvalidNonTypeImportInDeclareModule: "Imports within a `declare module` body must always be `import type` or `import typeof`",
MissingTypeParamDefault: "Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",
NestedDeclareModule: "`declare module` cannot be used inside another `declare module`",
NestedFlowComment: "Cannot have a flow comment inside another flow comment",
OptionalBindingPattern: "A binding pattern parameter cannot be optional in an implementation signature.",
SpreadVariance: "Spread properties cannot have variance",
TypeBeforeInitializer: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`",
TypeCastInPattern: "The type cast expression is expected to be wrapped with parenthesis",
UnexpectedExplicitInexactInObject: "Explicit inexact syntax must appear at the end of an inexact object",
UnexpectedReservedType: "Unexpected reserved type %0",
UnexpectedReservedUnderscore: "`_` is only allowed as a type argument to call or new",
UnexpectedSpaceBetweenModuloChecks: "Spaces between `%` and `checks` are not allowed here.",
UnexpectedSpreadType: "Spread operator cannot appear in class or interface definitions",
UnexpectedSubtractionOperand: 'Unexpected token, expected "number" or "bigint"',
UnexpectedTokenAfterTypeParameter: "Expected an arrow function after this type parameter declaration",
UnsupportedDeclareExportKind: "`declare export %0` is not supported. Use `%1` instead",
UnsupportedStatementInDeclareModule: "Only declares and type imports are allowed inside declare module",
UnterminatedFlowComment: "Unterminated flow-comment"
});
function isEsModuleType(bodyElement) {
return bodyElement.type === "DeclareExportAllDeclaration" || bodyElement.type === "DeclareExportDeclaration" && (!bodyElement.declaration || bodyElement.declaration.type !== "TypeAlias" && bodyElement.declaration.type !== "InterfaceDeclaration");
}
function hasTypeImportKind(node) {
return node.importKind === "type" || node.importKind === "typeof";
}
function isMaybeDefaultImport(state) {
return (state.type === types.name || !!state.type.keyword) && state.value !== "from";
}
const exportSuggestions = {
const: "declare export var",
let: "declare export var",
type: "export type",
interface: "export interface"
};
function partition(list, test) {
const list1 = [];
const list2 = [];
for (let i = 0; i < list.length; i++) {
(test(list[i], i, list) ? list1 : list2).push(list[i]);
}
return [list1, list2];
}
const FLOW_PRAGMA_REGEX = /\*?\s*@((?:no)?flow)\b/;
var flow = (superClass => class extends superClass {
constructor(options, input) {
super(options, input);
this.flowPragma = undefined;
}
shouldParseTypes() {
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
}
shouldParseEnums() {
return !!this.getPluginOption("flow", "enums");
}
finishToken(type, val) {
if (type !== types.string && type !== types.semi && type !== types.interpreterDirective) {
if (this.flowPragma === undefined) {
this.flowPragma = null;
}
}
return super.finishToken(type, val);
}
addComment(comment) {
if (this.flowPragma === undefined) {
const matches = FLOW_PRAGMA_REGEX.exec(comment.value);
if (!matches) ; else if (matches[1] === "flow") {
this.flowPragma = "flow";
} else if (matches[1] === "noflow") {
this.flowPragma = "noflow";
} else {
throw new Error("Unexpected flow pragma");
}
}
return super.addComment(comment);
}
flowParseTypeInitialiser(tok) {
const oldInType = this.state.inType;
this.state.inType = true;
this.expect(tok || types.colon);
const type = this.flowParseType();
this.state.inType = oldInType;
return type;
}
flowParsePredicate() {
const node = this.startNode();
const moduloLoc = this.state.startLoc;
const moduloPos = this.state.start;
this.expect(types.modulo);
const checksLoc = this.state.startLoc;
this.expectContextual("checks");
if (moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1) {
this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks);
}
if (this.eat(types.parenL)) {
node.value = this.parseExpression();
this.expect(types.parenR);
return this.finishNode(node, "DeclaredPredicate");
} else {
return this.finishNode(node, "InferredPredicate");
}
}
flowParseTypeAndPredicateInitialiser() {
const oldInType = this.state.inType;
this.state.inType = true;
this.expect(types.colon);
let type = null;
let predicate = null;
if (this.match(types.modulo)) {
this.state.inType = oldInType;
predicate = this.flowParsePredicate();
} else {
type = this.flowParseType();
this.state.inType = oldInType;
if (this.match(types.modulo)) {
predicate = this.flowParsePredicate();
}
}
return [type, predicate];
}
flowParseDeclareClass(node) {
this.next();
this.flowParseInterfaceish(node, true);
return this.finishNode(node, "DeclareClass");
}
flowParseDeclareFunction(node) {
this.next();
const id = node.id = this.parseIdentifier();
const typeNode = this.startNode();
const typeContainer = this.startNode();
if (this.isRelational("<")) {
typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
typeNode.typeParameters = null;
}
this.expect(types.parenL);
const tmp = this.flowParseFunctionTypeParams();
typeNode.params = tmp.params;
typeNode.rest = tmp.rest;
this.expect(types.parenR);
[typeNode.returnType, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
this.resetEndLocation(id);
this.semicolon();
return this.finishNode(node, "DeclareFunction");
}
flowParseDeclare(node, insideModule) {
if (this.match(types._class)) {
return this.flowParseDeclareClass(node);
} else if (this.match(types._function)) {
return this.flowParseDeclareFunction(node);
} else if (this.match(types._var)) {
return this.flowParseDeclareVariable(node);
} else if (this.eatContextual("module")) {
if (this.match(types.dot)) {
return this.flowParseDeclareModuleExports(node);
} else {
if (insideModule) {
this.raise(this.state.lastTokStart, FlowErrors.NestedDeclareModule);
}
return this.flowParseDeclareModule(node);
}
} else if (this.isContextual("type")) {
return this.flowParseDeclareTypeAlias(node);
} else if (this.isContextual("opaque")) {
return this.flowParseDeclareOpaqueType(node);
} else if (this.isContextual("interface")) {
return this.flowParseDeclareInterface(node);
} else if (this.match(types._export)) {
return this.flowParseDeclareExportDeclaration(node, insideModule);
} else {
throw this.unexpected();
}
}
flowParseDeclareVariable(node) {
this.next();
node.id = this.flowParseTypeAnnotatableIdentifier(true);
this.scope.declareName(node.id.name, BIND_VAR, node.id.start);
this.semicolon();
return this.finishNode(node, "DeclareVariable");
}
flowParseDeclareModule(node) {
this.scope.enter(SCOPE_OTHER);
if (this.match(types.string)) {
node.id = this.parseExprAtom();
} else {
node.id = this.parseIdentifier();
}
const bodyNode = node.body = this.startNode();
const body = bodyNode.body = [];
this.expect(types.braceL);
while (!this.match(types.braceR)) {
let bodyNode = this.startNode();
if (this.match(types._import)) {
this.next();
if (!this.isContextual("type") && !this.match(types._typeof)) {
this.raise(this.state.lastTokStart, FlowErrors.InvalidNonTypeImportInDeclareModule);
}
this.parseImport(bodyNode);
} else {
this.expectContextual("declare", FlowErrors.UnsupportedStatementInDeclareModule);
bodyNode = this.flowParseDeclare(bodyNode, true);
}
body.push(bodyNode);
}
this.scope.exit();
this.expect(types.braceR);
this.finishNode(bodyNode, "BlockStatement");
let kind = null;
let hasModuleExport = false;
body.forEach(bodyElement => {
if (isEsModuleType(bodyElement)) {
if (kind === "CommonJS") {
this.raise(bodyElement.start, FlowErrors.AmbiguousDeclareModuleKind);
}
kind = "ES";
} else if (bodyElement.type === "DeclareModuleExports") {
if (hasModuleExport) {
this.raise(bodyElement.start, FlowErrors.DuplicateDeclareModuleExports);
}
if (kind === "ES") {
this.raise(bodyElement.start, FlowErrors.AmbiguousDeclareModuleKind);
}
kind = "CommonJS";
hasModuleExport = true;
}
});
node.kind = kind || "CommonJS";
return this.finishNode(node, "DeclareModule");
}
flowParseDeclareExportDeclaration(node, insideModule) {
this.expect(types._export);
if (this.eat(types._default)) {
if (this.match(types._function) || this.match(types._class)) {
node.declaration = this.flowParseDeclare(this.startNode());
} else {
node.declaration = this.flowParseType();
this.semicolon();
}
node.default = true;
return this.finishNode(node, "DeclareExportDeclaration");
} else {
if (this.match(types._const) || this.isLet() || (this.isContextual("type") || this.isContextual("interface")) && !insideModule) {
const label = this.state.value;
const suggestion = exportSuggestions[label];
throw this.raise(this.state.start, FlowErrors.UnsupportedDeclareExportKind, label, suggestion);
}
if (this.match(types._var) || this.match(types._function) || this.match(types._class) || this.isContextual("opaque")) {
node.declaration = this.flowParseDeclare(this.startNode());
node.default = false;
return this.finishNode(node, "DeclareExportDeclaration");
} else if (this.match(types.star) || this.match(types.braceL) || this.isContextual("interface") || this.isContextual("type") || this.isContextual("opaque")) {
node = this.parseExport(node);
if (node.type === "ExportNamedDeclaration") {
node.type = "ExportDeclaration";
node.default = false;
delete node.exportKind;
}
node.type = "Declare" + node.type;
return node;
}
}
throw this.unexpected();
}
flowParseDeclareModuleExports(node) {
this.next();
this.expectContextual("exports");
node.typeAnnotation = this.flowParseTypeAnnotation();
this.semicolon();
return this.finishNode(node, "DeclareModuleExports");
}
flowParseDeclareTypeAlias(node) {
this.next();
this.flowParseTypeAlias(node);
node.type = "DeclareTypeAlias";
return node;
}
flowParseDeclareOpaqueType(node) {
this.next();
this.flowParseOpaqueType(node, true);
node.type = "DeclareOpaqueType";
return node;
}
flowParseDeclareInterface(node) {
this.next();
this.flowParseInterfaceish(node);
return this.finishNode(node, "DeclareInterface");
}
flowParseInterfaceish(node, isClass = false) {
node.id = this.flowParseRestrictedIdentifier(!isClass, true);
this.scope.declareName(node.id.name, isClass ? BIND_FUNCTION : BIND_LEXICAL, node.id.start);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
node.typeParameters = null;
}
node.extends = [];
node.implements = [];
node.mixins = [];
if (this.eat(types._extends)) {
do {
node.extends.push(this.flowParseInterfaceExtends());
} while (!isClass && this.eat(types.comma));
}
if (this.isContextual("mixins")) {
this.next();
do {
node.mixins.push(this.flowParseInterfaceExtends());
} while (this.eat(types.comma));
}
if (this.isContextual("implements")) {
this.next();
do {
node.implements.push(this.flowParseInterfaceExtends());
} while (this.eat(types.comma));
}
node.body = this.flowParseObjectType({
allowStatic: isClass,
allowExact: false,
allowSpread: false,
allowProto: isClass,
allowInexact: false
});
}
flowParseInterfaceExtends() {
const node = this.startNode();
node.id = this.flowParseQualifiedTypeIdentifier();
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterInstantiation();
} else {
node.typeParameters = null;
}
return this.finishNode(node, "InterfaceExtends");
}
flowParseInterface(node) {
this.flowParseInterfaceish(node);
return this.finishNode(node, "InterfaceDeclaration");
}
checkNotUnderscore(word) {
if (word === "_") {
this.raise(this.state.start, FlowErrors.UnexpectedReservedUnderscore);
}
}
checkReservedType(word, startLoc, declaration) {
if (!reservedTypes.has(word)) return;
this.raise(startLoc, declaration ? FlowErrors.AssignReservedType : FlowErrors.UnexpectedReservedType, word);
}
flowParseRestrictedIdentifier(liberal, declaration) {
this.checkReservedType(this.state.value, this.state.start, declaration);
return this.parseIdentifier(liberal);
}
flowParseTypeAlias(node) {
node.id = this.flowParseRestrictedIdentifier(false, true);
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
node.typeParameters = null;
}
node.right = this.flowParseTypeInitialiser(types.eq);
this.semicolon();
return this.finishNode(node, "TypeAlias");
}
flowParseOpaqueType(node, declare) {
this.expectContextual("type");
node.id = this.flowParseRestrictedIdentifier(true, true);
this.scope.declareName(node.id.name, BIND_LEXICAL, node.id.start);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
} else {
node.typeParameters = null;
}
node.supertype = null;
if (this.match(types.colon)) {
node.supertype = this.flowParseTypeInitialiser(types.colon);
}
node.impltype = null;
if (!declare) {
node.impltype = this.flowParseTypeInitialiser(types.eq);
}
this.semicolon();
return this.finishNode(node, "OpaqueType");
}
flowParseTypeParameter(requireDefault = false) {
const nodeStart = this.state.start;
const node = this.startNode();
const variance = this.flowParseVariance();
const ident = this.flowParseTypeAnnotatableIdentifier();
node.name = ident.name;
node.variance = variance;
node.bound = ident.typeAnnotation;
if (this.match(types.eq)) {
this.eat(types.eq);
node.default = this.flowParseType();
} else {
if (requireDefault) {
this.raise(nodeStart, FlowErrors.MissingTypeParamDefault);
}
}
return this.finishNode(node, "TypeParameter");
}
flowParseTypeParameterDeclaration() {
const oldInType = this.state.inType;
const node = this.startNode();
node.params = [];
this.state.inType = true;
if (this.isRelational("<") || this.match(types.jsxTagStart)) {
this.next();
} else {
this.unexpected();
}
let defaultRequired = false;
do {
const typeParameter = this.flowParseTypeParameter(defaultRequired);
node.params.push(typeParameter);
if (typeParameter.default) {
defaultRequired = true;
}
if (!this.isRelational(">")) {
this.expect(types.comma);
}
} while (!this.isRelational(">"));
this.expectRelational(">");
this.state.inType = oldInType;
return this.finishNode(node, "TypeParameterDeclaration");
}
flowParseTypeParameterInstantiation() {
const node = this.startNode();
const oldInType = this.state.inType;
node.params = [];
this.state.inType = true;
this.expectRelational("<");
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
this.state.noAnonFunctionType = false;
while (!this.isRelational(">")) {
node.params.push(this.flowParseType());
if (!this.isRelational(">")) {
this.expect(types.comma);
}
}
this.state.noAnonFunctionType = oldNoAnonFunctionType;
this.expectRelational(">");
this.state.inType = oldInType;
return this.finishNode(node, "TypeParameterInstantiation");
}
flowParseTypeParameterInstantiationCallOrNew() {
const node = this.startNode();
const oldInType = this.state.inType;
node.params = [];
this.state.inType = true;
this.expectRelational("<");
while (!this.isRelational(">")) {
node.params.push(this.flowParseTypeOrImplicitInstantiation());
if (!this.isRelational(">")) {
this.expect(types.comma);
}
}
this.expectRelational(">");
this.state.inType = oldInType;
return this.finishNode(node, "TypeParameterInstantiation");
}
flowParseInterfaceType() {
const node = this.startNode();
this.expectContextual("interface");
node.extends = [];
if (this.eat(types._extends)) {
do {
node.extends.push(this.flowParseInterfaceExtends());
} while (this.eat(types.comma));
}
node.body = this.flowParseObjectType({
allowStatic: false,
allowExact: false,
allowSpread: false,
allowProto: false,
allowInexact: false
});
return this.finishNode(node, "InterfaceTypeAnnotation");
}
flowParseObjectPropertyKey() {
return this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
}
flowParseObjectTypeIndexer(node, isStatic, variance) {
node.static = isStatic;
if (this.lookahead().type === types.colon) {
node.id = this.flowParseObjectPropertyKey();
node.key = this.flowParseTypeInitialiser();
} else {
node.id = null;
node.key = this.flowParseType();
}
this.expect(types.bracketR);
node.value = this.flowParseTypeInitialiser();
node.variance = variance;
return this.finishNode(node, "ObjectTypeIndexer");
}
flowParseObjectTypeInternalSlot(node, isStatic) {
node.static = isStatic;
node.id = this.flowParseObjectPropertyKey();
this.expect(types.bracketR);
this.expect(types.bracketR);
if (this.isRelational("<") || this.match(types.parenL)) {
node.method = true;
node.optional = false;
node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
} else {
node.method = false;
if (this.eat(types.question)) {
node.optional = true;
}
node.value = this.flowParseTypeInitialiser();
}
return this.finishNode(node, "ObjectTypeInternalSlot");
}
flowParseObjectTypeMethodish(node) {
node.params = [];
node.rest = null;
node.typeParameters = null;
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
this.expect(types.parenL);
while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
node.params.push(this.flowParseFunctionTypeParam());
if (!this.match(types.parenR)) {
this.expect(types.comma);
}
}
if (this.eat(types.ellipsis)) {
node.rest = this.flowParseFunctionTypeParam();
}
this.expect(types.parenR);
node.returnType = this.flowParseTypeInitialiser();
return this.finishNode(node, "FunctionTypeAnnotation");
}
flowParseObjectTypeCallProperty(node, isStatic) {
const valueNode = this.startNode();
node.static = isStatic;
node.value = this.flowParseObjectTypeMethodish(valueNode);
return this.finishNode(node, "ObjectTypeCallProperty");
}
flowParseObjectType({
allowStatic,
allowExact,
allowSpread,
allowProto,
allowInexact
}) {
const oldInType = this.state.inType;
this.state.inType = true;
const nodeStart = this.startNode();
nodeStart.callProperties = [];
nodeStart.properties = [];
nodeStart.indexers = [];
nodeStart.internalSlots = [];
let endDelim;
let exact;
let inexact = false;
if (allowExact && this.match(types.braceBarL)) {
this.expect(types.braceBarL);
endDelim = types.braceBarR;
exact = true;
} else {
this.expect(types.braceL);
endDelim = types.braceR;
exact = false;
}
nodeStart.exact = exact;
while (!this.match(endDelim)) {
let isStatic = false;
let protoStart = null;
let inexactStart = null;
const node = this.startNode();
if (allowProto && this.isContextual("proto")) {
const lookahead = this.lookahead();
if (lookahead.type !== types.colon && lookahead.type !== types.question) {
this.next();
protoStart = this.state.start;
allowStatic = false;
}
}
if (allowStatic && this.isContextual("static")) {
const lookahead = this.lookahead();
if (lookahead.type !== types.colon && lookahead.type !== types.question) {
this.next();
isStatic = true;
}
}
const variance = this.flowParseVariance();
if (this.eat(types.bracketL)) {
if (protoStart != null) {
this.unexpected(protoStart);
}
if (this.eat(types.bracketL)) {
if (variance) {
this.unexpected(variance.start);
}
nodeStart.internalSlots.push(this.flowParseObjectTypeInternalSlot(node, isStatic));
} else {
nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
}
} else if (this.match(types.parenL) || this.isRelational("<")) {
if (protoStart != null) {
this.unexpected(protoStart);
}
if (variance) {
this.unexpected(variance.start);
}
nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
} else {
let kind = "init";
if (this.isContextual("get") || this.isContextual("set")) {
const lookahead = this.lookahead();
if (lookahead.type === types.name || lookahead.type === types.string || lookahead.type === types.num) {
kind = this.state.value;
this.next();
}
}
const propOrInexact = this.flowParseObjectTypeProperty(node, isStatic, protoStart, variance, kind, allowSpread, allowInexact != null ? allowInexact : !exact);
if (propOrInexact === null) {
inexact = true;
inexactStart = this.state.lastTokStart;
} else {
nodeStart.properties.push(propOrInexact);
}
}
this.flowObjectTypeSemicolon();
if (inexactStart && !this.match(types.braceR) && !this.match(types.braceBarR)) {
this.raise(inexactStart, FlowErrors.UnexpectedExplicitInexactInObject);
}
}
this.expect(endDelim);
if (allowSpread) {
nodeStart.inexact = inexact;
}
const out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
this.state.inType = oldInType;
return out;
}
flowParseObjectTypeProperty(node, isStatic, protoStart, variance, kind, allowSpread, allowInexact) {
if (this.eat(types.ellipsis)) {
const isInexactToken = this.match(types.comma) || this.match(types.semi) || this.match(types.braceR) || this.match(types.braceBarR);
if (isInexactToken) {
if (!allowSpread) {
this.raise(this.state.lastTokStart, FlowErrors.InexactInsideNonObject);
} else if (!allowInexact) {
this.raise(this.state.lastTokStart, FlowErrors.InexactInsideExact);
}
if (variance) {
this.raise(variance.start, FlowErrors.InexactVariance);
}
return null;
}
if (!allowSpread) {
this.raise(this.state.lastTokStart, FlowErrors.UnexpectedSpreadType);
}
if (protoStart != null) {
this.unexpected(protoStart);
}
if (variance) {
this.raise(variance.start, FlowErrors.SpreadVariance);
}
node.argument = this.flowParseType();
return this.finishNode(node, "ObjectTypeSpreadProperty");
} else {
node.key = this.flowParseObjectPropertyKey();
node.static = isStatic;
node.proto = protoStart != null;
node.kind = kind;
let optional = false;
if (this.isRelational("<") || this.match(types.parenL)) {
node.method = true;
if (protoStart != null) {
this.unexpected(protoStart);
}
if (variance) {
this.unexpected(variance.start);
}
node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
if (kind === "get" || kind === "set") {
this.flowCheckGetterSetterParams(node);
}
} else {
if (kind !== "init") this.unexpected();
node.method = false;
if (this.eat(types.question)) {
optional = true;
}
node.value = this.flowParseTypeInitialiser();
node.variance = variance;
}
node.optional = optional;
return this.finishNode(node, "ObjectTypeProperty");
}
}
flowCheckGetterSetterParams(property) {
const paramCount = property.kind === "get" ? 0 : 1;
const start = property.start;
const length = property.value.params.length + (property.value.rest ? 1 : 0);
if (length !== paramCount) {
if (property.kind === "get") {
this.raise(start, ErrorMessages.BadGetterArity);
} else {
this.raise(start, ErrorMessages.BadSetterArity);
}
}
if (property.kind === "set" && property.value.rest) {
this.raise(start, ErrorMessages.BadSetterRestParameter);
}
}
flowObjectTypeSemicolon() {
if (!this.eat(types.semi) && !this.eat(types.comma) && !this.match(types.braceR) && !this.match(types.braceBarR)) {
this.unexpected();
}
}
flowParseQualifiedTypeIdentifier(startPos, startLoc, id) {
startPos = startPos || this.state.start;
startLoc = startLoc || this.state.startLoc;
let node = id || this.flowParseRestrictedIdentifier(true);
while (this.eat(types.dot)) {
const node2 = this.startNodeAt(startPos, startLoc);
node2.qualification = node;
node2.id = this.flowParseRestrictedIdentifier(true);
node = this.finishNode(node2, "QualifiedTypeIdentifier");
}
return node;
}
flowParseGenericType(startPos, startLoc, id) {
const node = this.startNodeAt(startPos, startLoc);
node.typeParameters = null;
node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterInstantiation();
}
return this.finishNode(node, "GenericTypeAnnotation");
}
flowParseTypeofType() {
const node = this.startNode();
this.expect(types._typeof);
node.argument = this.flowParsePrimaryType();
return this.finishNode(node, "TypeofTypeAnnotation");
}
flowParseTupleType() {
const node = this.startNode();
node.types = [];
this.expect(types.bracketL);
while (this.state.pos < this.length && !this.match(types.bracketR)) {
node.types.push(this.flowParseType());
if (this.match(types.bracketR)) break;
this.expect(types.comma);
}
this.expect(types.bracketR);
return this.finishNode(node, "TupleTypeAnnotation");
}
flowParseFunctionTypeParam() {
let name = null;
let optional = false;
let typeAnnotation = null;
const node = this.startNode();
const lh = this.lookahead();
if (lh.type === types.colon || lh.type === types.question) {
name = this.parseIdentifier();
if (this.eat(types.question)) {
optional = true;
}
typeAnnotation = this.flowParseTypeInitialiser();
} else {
typeAnnotation = this.flowParseType();
}
node.name = name;
node.optional = optional;
node.typeAnnotation = typeAnnotation;
return this.finishNode(node, "FunctionTypeParam");
}
reinterpretTypeAsFunctionTypeParam(type) {
const node = this.startNodeAt(type.start, type.loc.start);
node.name = null;
node.optional = false;
node.typeAnnotation = type;
return this.finishNode(node, "FunctionTypeParam");
}
flowParseFunctionTypeParams(params = []) {
let rest = null;
while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
params.push(this.flowParseFunctionTypeParam());
if (!this.match(types.parenR)) {
this.expect(types.comma);
}
}
if (this.eat(types.ellipsis)) {
rest = this.flowParseFunctionTypeParam();
}
return {
params,
rest
};
}
flowIdentToTypeAnnotation(startPos, startLoc, node, id) {
switch (id.name) {
case "any":
return this.finishNode(node, "AnyTypeAnnotation");
case "bool":
case "boolean":
return this.finishNode(node, "BooleanTypeAnnotation");
case "mixed":
return this.finishNode(node, "MixedTypeAnnotation");
case "empty":
return this.finishNode(node, "EmptyTypeAnnotation");
case "number":
return this.finishNode(node, "NumberTypeAnnotation");
case "string":
return this.finishNode(node, "StringTypeAnnotation");
case "symbol":
return this.finishNode(node, "SymbolTypeAnnotation");
default:
this.checkNotUnderscore(id.name);
return this.flowParseGenericType(startPos, startLoc, id);
}
}
flowParsePrimaryType() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const node = this.startNode();
let tmp;
let type;
let isGroupedType = false;
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
switch (this.state.type) {
case types.name:
if (this.isContextual("interface")) {
return this.flowParseInterfaceType();
}
return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
case types.braceL:
return this.flowParseObjectType({
allowStatic: false,
allowExact: false,
allowSpread: true,
allowProto: false,
allowInexact: true
});
case types.braceBarL:
return this.flowParseObjectType({
allowStatic: false,
allowExact: true,
allowSpread: true,
allowProto: false,
allowInexact: false
});
case types.bracketL:
this.state.noAnonFunctionType = false;
type = this.flowParseTupleType();
this.state.noAnonFunctionType = oldNoAnonFunctionType;
return type;
case types.relational:
if (this.state.value === "<") {
node.typeParameters = this.flowParseTypeParameterDeclaration();
this.expect(types.parenL);
tmp = this.flowParseFunctionTypeParams();
node.params = tmp.params;
node.rest = tmp.rest;
this.expect(types.parenR);
this.expect(types.arrow);
node.returnType = this.flowParseType();
return this.finishNode(node, "FunctionTypeAnnotation");
}
break;
case types.parenL:
this.next();
if (!this.match(types.parenR) && !this.match(types.ellipsis)) {
if (this.match(types.name)) {
const token = this.lookahead().type;
isGroupedType = token !== types.question && token !== types.colon;
} else {
isGroupedType = true;
}
}
if (isGroupedType) {
this.state.noAnonFunctionType = false;
type = this.flowParseType();
this.state.noAnonFunctionType = oldNoAnonFunctionType;
if (this.state.noAnonFunctionType || !(this.match(types.comma) || this.match(types.parenR) && this.lookahead().type === types.arrow)) {
this.expect(types.parenR);
return type;
} else {
this.eat(types.comma);
}
}
if (type) {
tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
} else {
tmp = this.flowParseFunctionTypeParams();
}
node.params = tmp.params;
node.rest = tmp.rest;
this.expect(types.parenR);
this.expect(types.arrow);
node.returnType = this.flowParseType();
node.typeParameters = null;
return this.finishNode(node, "FunctionTypeAnnotation");
case types.string:
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
case types._true:
case types._false:
node.value = this.match(types._true);
this.next();
return this.finishNode(node, "BooleanLiteralTypeAnnotation");
case types.plusMin:
if (this.state.value === "-") {
this.next();
if (this.match(types.num)) {
return this.parseLiteral(-this.state.value, "NumberLiteralTypeAnnotation", node.start, node.loc.start);
}
if (this.match(types.bigint)) {
return this.parseLiteral(-this.state.value, "BigIntLiteralTypeAnnotation", node.start, node.loc.start);
}
throw this.raise(this.state.start, FlowErrors.UnexpectedSubtractionOperand);
}
throw this.unexpected();
case types.num:
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
case types.bigint:
return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
case types._void:
this.next();
return this.finishNode(node, "VoidTypeAnnotation");
case types._null:
this.next();
return this.finishNode(node, "NullLiteralTypeAnnotation");
case types._this:
this.next();
return this.finishNode(node, "ThisTypeAnnotation");
case types.star:
this.next();
return this.finishNode(node, "ExistsTypeAnnotation");
default:
if (this.state.type.keyword === "typeof") {
return this.flowParseTypeofType();
} else if (this.state.type.keyword) {
const label = this.state.type.label;
this.next();
return super.createIdentifier(node, label);
}
}
throw this.unexpected();
}
flowParsePostfixType() {
const startPos = this.state.start,
startLoc = this.state.startLoc;
let type = this.flowParsePrimaryType();
while (this.match(types.bracketL) && !this.canInsertSemicolon()) {
const node = this.startNodeAt(startPos, startLoc);
node.elementType = type;
this.expect(types.bracketL);
this.expect(types.bracketR);
type = this.finishNode(node, "ArrayTypeAnnotation");
}
return type;
}
flowParsePrefixType() {
const node = this.startNode();
if (this.eat(types.question)) {
node.typeAnnotation = this.flowParsePrefixType();
return this.finishNode(node, "NullableTypeAnnotation");
} else {
return this.flowParsePostfixType();
}
}
flowParseAnonFunctionWithoutParens() {
const param = this.flowParsePrefixType();
if (!this.state.noAnonFunctionType && this.eat(types.arrow)) {
const node = this.startNodeAt(param.start, param.loc.start);
node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
node.rest = null;
node.returnType = this.flowParseType();
node.typeParameters = null;
return this.finishNode(node, "FunctionTypeAnnotation");
}
return param;
}
flowParseIntersectionType() {
const node = this.startNode();
this.eat(types.bitwiseAND);
const type = this.flowParseAnonFunctionWithoutParens();
node.types = [type];
while (this.eat(types.bitwiseAND)) {
node.types.push(this.flowParseAnonFunctionWithoutParens());
}
return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
}
flowParseUnionType() {
const node = this.startNode();
this.eat(types.bitwiseOR);
const type = this.flowParseIntersectionType();
node.types = [type];
while (this.eat(types.bitwiseOR)) {
node.types.push(this.flowParseIntersectionType());
}
return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
}
flowParseType() {
const oldInType = this.state.inType;
this.state.inType = true;
const type = this.flowParseUnionType();
this.state.inType = oldInType;
this.state.exprAllowed = this.state.exprAllowed || this.state.noAnonFunctionType;
return type;
}
flowParseTypeOrImplicitInstantiation() {
if (this.state.type === types.name && this.state.value === "_") {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const node = this.parseIdentifier();
return this.flowParseGenericType(startPos, startLoc, node);
} else {
return this.flowParseType();
}
}
flowParseTypeAnnotation() {
const node = this.startNode();
node.typeAnnotation = this.flowParseTypeInitialiser();
return this.finishNode(node, "TypeAnnotation");
}
flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();
if (this.match(types.colon)) {
ident.typeAnnotation = this.flowParseTypeAnnotation();
this.resetEndLocation(ident);
}
return ident;
}
typeCastToParameter(node) {
node.expression.typeAnnotation = node.typeAnnotation;
this.resetEndLocation(node.expression, node.typeAnnotation.end, node.typeAnnotation.loc.end);
return node.expression;
}
flowParseVariance() {
let variance = null;
if (this.match(types.plusMin)) {
variance = this.startNode();
if (this.state.value === "+") {
variance.kind = "plus";
} else {
variance.kind = "minus";
}
this.next();
this.finishNode(variance, "Variance");
}
return variance;
}
parseFunctionBody(node, allowExpressionBody, isMethod = false) {
if (allowExpressionBody) {
return this.forwardNoArrowParamsConversionAt(node, () => super.parseFunctionBody(node, true, isMethod));
}
return super.parseFunctionBody(node, false, isMethod);
}
parseFunctionBodyAndFinish(node, type, isMethod = false) {
if (this.match(types.colon)) {
const typeNode = this.startNode();
[typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
node.returnType = typeNode.typeAnnotation ? this.finishNode(typeNode, "TypeAnnotation") : null;
}
super.parseFunctionBodyAndFinish(node, type, isMethod);
}
parseStatement(context, topLevel) {
if (this.state.strict && this.match(types.name) && this.state.value === "interface") {
const node = this.startNode();
this.next();
return this.flowParseInterface(node);
} else if (this.shouldParseEnums() && this.isContextual("enum")) {
const node = this.startNode();
this.next();
return this.flowParseEnumDeclaration(node);
} else {
const stmt = super.parseStatement(context, topLevel);
if (this.flowPragma === undefined && !this.isValidDirective(stmt)) {
this.flowPragma = null;
}
return stmt;
}
}
parseExpressionStatement(node, expr) {
if (expr.type === "Identifier") {
if (expr.name === "declare") {
if (this.match(types._class) || this.match(types.name) || this.match(types._function) || this.match(types._var) || this.match(types._export)) {
return this.flowParseDeclare(node);
}
} else if (this.match(types.name)) {
if (expr.name === "interface") {
return this.flowParseInterface(node);
} else if (expr.name === "type") {
return this.flowParseTypeAlias(node);
} else if (expr.name === "opaque") {
return this.flowParseOpaqueType(node, false);
}
}
}
return super.parseExpressionStatement(node, expr);
}
shouldParseExportDeclaration() {
return this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || this.shouldParseEnums() && this.isContextual("enum") || super.shouldParseExportDeclaration();
}
isExportDefaultSpecifier() {
if (this.match(types.name) && (this.state.value === "type" || this.state.value === "interface" || this.state.value === "opaque" || this.shouldParseEnums() && this.state.value === "enum")) {
return false;
}
return super.isExportDefaultSpecifier();
}
parseExportDefaultExpression() {
if (this.shouldParseEnums() && this.isContextual("enum")) {
const node = this.startNode();
this.next();
return this.flowParseEnumDeclaration(node);
}
return super.parseExportDefaultExpression();
}
parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
if (!this.match(types.question)) return expr;
if (refNeedsArrowPos) {
const result = this.tryParse(() => super.parseConditional(expr, noIn, startPos, startLoc));
if (!result.node) {
refNeedsArrowPos.start = result.error.pos || this.state.start;
return expr;
}
if (result.error) this.state = result.failState;
return result.node;
}
this.expect(types.question);
const state = this.state.clone();
const originalNoArrowAt = this.state.noArrowAt;
const node = this.startNodeAt(startPos, startLoc);
let {
consequent,
failed
} = this.tryParseConditionalConsequent();
let [valid, invalid] = this.getArrowLikeExpressions(consequent);
if (failed || invalid.length > 0) {
const noArrowAt = [...originalNoArrowAt];
if (invalid.length > 0) {
this.state = state;
this.state.noArrowAt = noArrowAt;
for (let i = 0; i < invalid.length; i++) {
noArrowAt.push(invalid[i].start);
}
({
consequent,
failed
} = this.tryParseConditionalConsequent());
[valid, invalid] = this.getArrowLikeExpressions(consequent);
}
if (failed && valid.length > 1) {
this.raise(state.start, FlowErrors.AmbiguousConditionalArrow);
}
if (failed && valid.length === 1) {
this.state = state;
this.state.noArrowAt = noArrowAt.concat(valid[0].start);
({
consequent,
failed
} = this.tryParseConditionalConsequent());
}
}
this.getArrowLikeExpressions(consequent, true);
this.state.noArrowAt = originalNoArrowAt;
this.expect(types.colon);
node.test = expr;
node.consequent = consequent;
node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(noIn, undefined, undefined, undefined));
return this.finishNode(node, "ConditionalExpression");
}
tryParseConditionalConsequent() {
this.state.noArrowParamsConversionAt.push(this.state.start);
const consequent = this.parseMaybeAssign();
const failed = !this.match(types.colon);
this.state.noArrowParamsConversionAt.pop();
return {
consequent,
failed
};
}
getArrowLikeExpressions(node, disallowInvalid) {
const stack = [node];
const arrows = [];
while (stack.length !== 0) {
const node = stack.pop();
if (node.type === "ArrowFunctionExpression") {
if (node.typeParameters || !node.returnType) {
this.finishArrowValidation(node);
} else {
arrows.push(node);
}
stack.push(node.body);
} else if (node.type === "ConditionalExpression") {
stack.push(node.consequent);
stack.push(node.alternate);
}
}
if (disallowInvalid) {
arrows.forEach(node => this.finishArrowValidation(node));
return [arrows, []];
}
return partition(arrows, node => node.params.every(param => this.isAssignable(param, true)));
}
finishArrowValidation(node) {
var _node$extra;
this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingComma);
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
super.checkParams(node, false, true);
this.scope.exit();
}
forwardNoArrowParamsConversionAt(node, parse) {
let result;
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
this.state.noArrowParamsConversionAt.push(this.state.start);
result = parse();
this.state.noArrowParamsConversionAt.pop();
} else {
result = parse();
}
return result;
}
parseParenItem(node, startPos, startLoc) {
node = super.parseParenItem(node, startPos, startLoc);
if (this.eat(types.question)) {
node.optional = true;
this.resetEndLocation(node);
}
if (this.match(types.colon)) {
const typeCastNode = this.startNodeAt(startPos, startLoc);
typeCastNode.expression = node;
typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
return this.finishNode(typeCastNode, "TypeCastExpression");
}
return node;
}
assertModuleNodeAllowed(node) {
if (node.type === "ImportDeclaration" && (node.importKind === "type" || node.importKind === "typeof") || node.type === "ExportNamedDeclaration" && node.exportKind === "type" || node.type === "ExportAllDeclaration" && node.exportKind === "type") {
return;
}
super.assertModuleNodeAllowed(node);
}
parseExport(node) {
const decl = super.parseExport(node);
if (decl.type === "ExportNamedDeclaration" || decl.type === "ExportAllDeclaration") {
decl.exportKind = decl.exportKind || "value";
}
return decl;
}
parseExportDeclaration(node) {
if (this.isContextual("type")) {
node.exportKind = "type";
const declarationNode = this.startNode();
this.next();
if (this.match(types.braceL)) {
node.specifiers = this.parseExportSpecifiers();
this.parseExportFrom(node);
return null;
} else {
return this.flowParseTypeAlias(declarationNode);
}
} else if (this.isContextual("opaque")) {
node.exportKind = "type";
const declarationNode = this.startNode();
this.next();
return this.flowParseOpaqueType(declarationNode, false);
} else if (this.isContextual("interface")) {
node.exportKind = "type";
const declarationNode = this.startNode();
this.next();
return this.flowParseInterface(declarationNode);
} else if (this.shouldParseEnums() && this.isContextual("enum")) {
node.exportKind = "value";
const declarationNode = this.startNode();
this.next();
return this.flowParseEnumDeclaration(declarationNode);
} else {
return super.parseExportDeclaration(node);
}
}
eatExportStar(node) {
if (super.eatExportStar(...arguments)) return true;
if (this.isContextual("type") && this.lookahead().type === types.star) {
node.exportKind = "type";
this.next();
this.next();
return true;
}
return false;
}
maybeParseExportNamespaceSpecifier(node) {
const pos = this.state.start;
const hasNamespace = super.maybeParseExportNamespaceSpecifier(node);
if (hasNamespace && node.exportKind === "type") {
this.unexpected(pos);
}
return hasNamespace;
}
parseClassId(node, isStatement, optionalId) {
super.parseClassId(node, isStatement, optionalId);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
}
parseClassMember(classBody, member, state, constructorAllowsSuper) {
const pos = this.state.start;
if (this.isContextual("declare")) {
if (this.parseClassMemberFromModifier(classBody, member)) {
return;
}
member.declare = true;
}
super.parseClassMember(classBody, member, state, constructorAllowsSuper);
if (member.declare) {
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty") {
this.raise(pos, FlowErrors.DeclareClassElement);
} else if (member.value) {
this.raise(member.value.start, FlowErrors.DeclareClassFieldInitializer);
}
}
}
getTokenFromCode(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (code === 123 && next === 124) {
return this.finishOp(types.braceBarL, 2);
} else if (this.state.inType && (code === 62 || code === 60)) {
return this.finishOp(types.relational, 1);
} else if (isIteratorStart(code, next)) {
this.state.isIterator = true;
return super.readWord();
} else {
return super.getTokenFromCode(code);
}
}
isAssignable(node, isBinding) {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
return true;
case "ObjectExpression":
{
const last = node.properties.length - 1;
return node.properties.every((prop, i) => {
return prop.type !== "ObjectMethod" && (i === last || prop.type === "SpreadElement") && this.isAssignable(prop);
});
}
case "ObjectProperty":
return this.isAssignable(node.value);
case "SpreadElement":
return this.isAssignable(node.argument);
case "ArrayExpression":
return node.elements.every(element => this.isAssignable(element));
case "AssignmentExpression":
return node.operator === "=";
case "ParenthesizedExpression":
case "TypeCastExpression":
return this.isAssignable(node.expression);
case "MemberExpression":
case "OptionalMemberExpression":
return !isBinding;
default:
return false;
}
}
toAssignable(node) {
if (node.type === "TypeCastExpression") {
return super.toAssignable(this.typeCastToParameter(node));
} else {
return super.toAssignable(node);
}
}
toAssignableList(exprList, trailingCommaPos) {
for (let i = 0; i < exprList.length; i++) {
const expr = exprList[i];
if ((expr == null ? void 0 : expr.type) === "TypeCastExpression") {
exprList[i] = this.typeCastToParameter(expr);
}
}
return super.toAssignableList(exprList, trailingCommaPos);
}
toReferencedList(exprList, isParenthesizedExpr) {
for (let i = 0; i < exprList.length; i++) {
var _expr$extra;
const expr = exprList[i];
if (expr && expr.type === "TypeCastExpression" && !((_expr$extra = expr.extra) == null ? void 0 : _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
this.raise(expr.typeAnnotation.start, FlowErrors.TypeCastInPattern);
}
}
return exprList;
}
checkLVal(expr, bindingType = BIND_NONE, checkClashes, contextDescription) {
if (expr.type !== "TypeCastExpression") {
return super.checkLVal(expr, bindingType, checkClashes, contextDescription);
}
}
parseClassProperty(node) {
if (this.match(types.colon)) {
node.typeAnnotation = this.flowParseTypeAnnotation();
}
return super.parseClassProperty(node);
}
parseClassPrivateProperty(node) {
if (this.match(types.colon)) {
node.typeAnnotation = this.flowParseTypeAnnotation();
}
return super.parseClassPrivateProperty(node);
}
isClassMethod() {
return this.isRelational("<") || super.isClassMethod();
}
isClassProperty() {
return this.match(types.colon) || super.isClassProperty();
}
isNonstaticConstructor(method) {
return !this.match(types.colon) && super.isNonstaticConstructor(method);
}
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
if (method.variance) {
this.unexpected(method.variance.start);
}
delete method.variance;
if (this.isRelational("<")) {
method.typeParameters = this.flowParseTypeParameterDeclaration();
}
super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
}
pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
if (method.variance) {
this.unexpected(method.variance.start);
}
delete method.variance;
if (this.isRelational("<")) {
method.typeParameters = this.flowParseTypeParameterDeclaration();
}
super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
}
parseClassSuper(node) {
super.parseClassSuper(node);
if (node.superClass && this.isRelational("<")) {
node.superTypeParameters = this.flowParseTypeParameterInstantiation();
}
if (this.isContextual("implements")) {
this.next();
const implemented = node.implements = [];
do {
const node = this.startNode();
node.id = this.flowParseRestrictedIdentifier(true);
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterInstantiation();
} else {
node.typeParameters = null;
}
implemented.push(this.finishNode(node, "ClassImplements"));
} while (this.eat(types.comma));
}
}
parsePropertyName(node, isPrivateNameAllowed) {
const variance = this.flowParseVariance();
const key = super.parsePropertyName(node, isPrivateNameAllowed);
node.variance = variance;
return key;
}
parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refExpressionErrors, containsEsc) {
if (prop.variance) {
this.unexpected(prop.variance.start);
}
delete prop.variance;
let typeParameters;
if (this.isRelational("<")) {
typeParameters = this.flowParseTypeParameterDeclaration();
if (!this.match(types.parenL)) this.unexpected();
}
super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refExpressionErrors, containsEsc);
if (typeParameters) {
(prop.value || prop).typeParameters = typeParameters;
}
}
parseAssignableListItemTypes(param) {
if (this.eat(types.question)) {
if (param.type !== "Identifier") {
this.raise(param.start, FlowErrors.OptionalBindingPattern);
}
param.optional = true;
}
if (this.match(types.colon)) {
param.typeAnnotation = this.flowParseTypeAnnotation();
}
this.resetEndLocation(param);
return param;
}
parseMaybeDefault(startPos, startLoc, left) {
const node = super.parseMaybeDefault(startPos, startLoc, left);
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
this.raise(node.typeAnnotation.start, FlowErrors.TypeBeforeInitializer);
}
return node;
}
shouldParseDefaultImport(node) {
if (!hasTypeImportKind(node)) {
return super.shouldParseDefaultImport(node);
}
return isMaybeDefaultImport(this.state);
}
parseImportSpecifierLocal(node, specifier, type, contextDescription) {
specifier.local = hasTypeImportKind(node) ? this.flowParseRestrictedIdentifier(true, true) : this.parseIdentifier();
this.checkLVal(specifier.local, BIND_LEXICAL, undefined, contextDescription);
node.specifiers.push(this.finishNode(specifier, type));
}
maybeParseDefaultImportSpecifier(node) {
node.importKind = "value";
let kind = null;
if (this.match(types._typeof)) {
kind = "typeof";
} else if (this.isContextual("type")) {
kind = "type";
}
if (kind) {
const lh = this.lookahead();
if (kind === "type" && lh.type === types.star) {
this.unexpected(lh.start);
}
if (isMaybeDefaultImport(lh) || lh.type === types.braceL || lh.type === types.star) {
this.next();
node.importKind = kind;
}
}
return super.maybeParseDefaultImportSpecifier(node);
}
parseImportSpecifier(node) {
const specifier = this.startNode();
const firstIdentLoc = this.state.start;
const firstIdent = this.parseIdentifier(true);
let specifierTypeKind = null;
if (firstIdent.name === "type") {
specifierTypeKind = "type";
} else if (firstIdent.name === "typeof") {
specifierTypeKind = "typeof";
}
let isBinding = false;
if (this.isContextual("as") && !this.isLookaheadContextual("as")) {
const as_ident = this.parseIdentifier(true);
if (specifierTypeKind !== null && !this.match(types.name) && !this.state.type.keyword) {
specifier.imported = as_ident;
specifier.importKind = specifierTypeKind;
specifier.local = as_ident.__clone();
} else {
specifier.imported = firstIdent;
specifier.importKind = null;
specifier.local = this.parseIdentifier();
}
} else if (specifierTypeKind !== null && (this.match(types.name) || this.state.type.keyword)) {
specifier.imported = this.parseIdentifier(true);
specifier.importKind = specifierTypeKind;
if (this.eatContextual("as")) {
specifier.local = this.parseIdentifier();
} else {
isBinding = true;
specifier.local = specifier.imported.__clone();
}
} else {
isBinding = true;
specifier.imported = firstIdent;
specifier.importKind = null;
specifier.local = specifier.imported.__clone();
}
const nodeIsTypeImport = hasTypeImportKind(node);
const specifierIsTypeImport = hasTypeImportKind(specifier);
if (nodeIsTypeImport && specifierIsTypeImport) {
this.raise(firstIdentLoc, FlowErrors.ImportTypeShorthandOnlyInPureImport);
}
if (nodeIsTypeImport || specifierIsTypeImport) {
this.checkReservedType(specifier.local.name, specifier.local.start, true);
}
if (isBinding && !nodeIsTypeImport && !specifierIsTypeImport) {
this.checkReservedWord(specifier.local.name, specifier.start, true, true);
}
this.checkLVal(specifier.local, BIND_LEXICAL, undefined, "import specifier");
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
}
parseFunctionParams(node, allowModifiers) {
const kind = node.kind;
if (kind !== "get" && kind !== "set" && this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
super.parseFunctionParams(node, allowModifiers);
}
parseVarId(decl, kind) {
super.parseVarId(decl, kind);
if (this.match(types.colon)) {
decl.id.typeAnnotation = this.flowParseTypeAnnotation();
this.resetEndLocation(decl.id);
}
}
parseAsyncArrowFromCallExpression(node, call) {
if (this.match(types.colon)) {
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
this.state.noAnonFunctionType = true;
node.returnType = this.flowParseTypeAnnotation();
this.state.noAnonFunctionType = oldNoAnonFunctionType;
}
return super.parseAsyncArrowFromCallExpression(node, call);
}
shouldParseAsyncArrow() {
return this.match(types.colon) || super.shouldParseAsyncArrow();
}
parseMaybeAssign(noIn, refExpressionErrors, afterLeftParse, refNeedsArrowPos) {
var _jsx;
let state = null;
let jsx;
if (this.hasPlugin("jsx") && (this.match(types.jsxTagStart) || this.isRelational("<"))) {
state = this.state.clone();
jsx = this.tryParse(() => super.parseMaybeAssign(noIn, refExpressionErrors, afterLeftParse, refNeedsArrowPos), state);
if (!jsx.error) return jsx.node;
const {
context
} = this.state;
if (context[context.length - 1] === types$1.j_oTag) {
context.length -= 2;
} else if (context[context.length - 1] === types$1.j_expr) {
context.length -= 1;
}
}
if (((_jsx = jsx) == null ? void 0 : _jsx.error) || this.isRelational("<")) {
var _arrow$node, _jsx2, _jsx3;
state = state || this.state.clone();
let typeParameters;
const arrow = this.tryParse(() => {
typeParameters = this.flowParseTypeParameterDeclaration();
const arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, () => super.parseMaybeAssign(noIn, refExpressionErrors, afterLeftParse, refNeedsArrowPos));
arrowExpression.typeParameters = typeParameters;
this.resetStartLocationFromNode(arrowExpression, typeParameters);
return arrowExpression;
}, state);
const arrowExpression = ((_arrow$node = arrow.node) == null ? void 0 : _arrow$node.type) === "ArrowFunctionExpression" ? arrow.node : null;
if (!arrow.error && arrowExpression) return arrowExpression;
if ((_jsx2 = jsx) == null ? void 0 : _jsx2.node) {
this.state = jsx.failState;
return jsx.node;
}
if (arrowExpression) {
this.state = arrow.failState;
return arrowExpression;
}
if ((_jsx3 = jsx) == null ? void 0 : _jsx3.thrown) throw jsx.error;
if (arrow.thrown) throw arrow.error;
throw this.raise(typeParameters.start, FlowErrors.UnexpectedTokenAfterTypeParameter);
}
return super.parseMaybeAssign(noIn, refExpressionErrors, afterLeftParse, refNeedsArrowPos);
}
parseArrow(node) {
if (this.match(types.colon)) {
const result = this.tryParse(() => {
const oldNoAnonFunctionType = this.state.noAnonFunctionType;
this.state.noAnonFunctionType = true;
const typeNode = this.startNode();
[typeNode.typeAnnotation, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
this.state.noAnonFunctionType = oldNoAnonFunctionType;
if (this.canInsertSemicolon()) this.unexpected();
if (!this.match(types.arrow)) this.unexpected();
return typeNode;
});
if (result.thrown) return null;
if (result.error) this.state = result.failState;
node.returnType = result.node.typeAnnotation ? this.finishNode(result.node, "TypeAnnotation") : null;
}
return super.parseArrow(node);
}
shouldParseArrow() {
return this.match(types.colon) || super.shouldParseArrow();
}
setArrowFunctionParameters(node, params) {
if (this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
node.params = params;
} else {
super.setArrowFunctionParameters(node, params);
}
}
checkParams(node, allowDuplicates, isArrowFunction) {
if (isArrowFunction && this.state.noArrowParamsConversionAt.indexOf(node.start) !== -1) {
return;
}
return super.checkParams(...arguments);
}
parseParenAndDistinguishExpression(canBeArrow) {
return super.parseParenAndDistinguishExpression(canBeArrow && this.state.noArrowAt.indexOf(this.state.start) === -1);
}
parseSubscripts(base, startPos, startLoc, noCalls) {
if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.indexOf(startPos) !== -1) {
this.next();
const node = this.startNodeAt(startPos, startLoc);
node.callee = base;
node.arguments = this.parseCallExpressionArguments(types.parenR, false);
base = this.finishNode(node, "CallExpression");
} else if (base.type === "Identifier" && base.name === "async" && this.isRelational("<")) {
const state = this.state.clone();
const arrow = this.tryParse(abort => this.parseAsyncArrowWithTypeParameters(startPos, startLoc) || abort(), state);
if (!arrow.error && !arrow.aborted) return arrow.node;
const result = this.tryParse(() => super.parseSubscripts(base, startPos, startLoc, noCalls), state);
if (result.node && !result.error) return result.node;
if (arrow.node) {
this.state = arrow.failState;
return arrow.node;
}
if (result.node) {
this.state = result.failState;
return result.node;
}
throw arrow.error || result.error;
}
return super.parseSubscripts(base, startPos, startLoc, noCalls);
}
parseSubscript(base, startPos, startLoc, noCalls, subscriptState) {
if (this.match(types.questionDot) && this.isLookaheadRelational("<")) {
subscriptState.optionalChainMember = true;
if (noCalls) {
subscriptState.stop = true;
return base;
}
this.next();
const node = this.startNodeAt(startPos, startLoc);
node.callee = base;
node.typeArguments = this.flowParseTypeParameterInstantiation();
this.expect(types.parenL);
node.arguments = this.parseCallExpressionArguments(types.parenR, false);
node.optional = true;
return this.finishCallExpression(node, true);
} else if (!noCalls && this.shouldParseTypes() && this.isRelational("<")) {
const node = this.startNodeAt(startPos, startLoc);
node.callee = base;
const result = this.tryParse(() => {
node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew();
this.expect(types.parenL);
node.arguments = this.parseCallExpressionArguments(types.parenR, false);
if (subscriptState.optionalChainMember) node.optional = false;
return this.finishCallExpression(node, subscriptState.optionalChainMember);
});
if (result.node) {
if (result.error) this.state = result.failState;
return result.node;
}
}
return super.parseSubscript(base, startPos, startLoc, noCalls, subscriptState);
}
parseNewArguments(node) {
let targs = null;
if (this.shouldParseTypes() && this.isRelational("<")) {
targs = this.tryParse(() => this.flowParseTypeParameterInstantiationCallOrNew()).node;
}
node.typeArguments = targs;
super.parseNewArguments(node);
}
parseAsyncArrowWithTypeParameters(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
this.parseFunctionParams(node);
if (!this.parseArrow(node)) return;
return this.parseArrowExpression(node, undefined, true);
}
readToken_mult_modulo(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (code === 42 && next === 47 && this.state.hasFlowComment) {
this.state.hasFlowComment = false;
this.state.pos += 2;
this.nextToken();
return;
}
super.readToken_mult_modulo(code);
}
readToken_pipe_amp(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (code === 124 && next === 125) {
this.finishOp(types.braceBarR, 2);
return;
}
super.readToken_pipe_amp(code);
}
parseTopLevel(file, program) {
const fileNode = super.parseTopLevel(file, program);
if (this.state.hasFlowComment) {
this.raise(this.state.pos, FlowErrors.UnterminatedFlowComment);
}
return fileNode;
}
skipBlockComment() {
if (this.hasPlugin("flowComments") && this.skipFlowComment()) {
if (this.state.hasFlowComment) {
this.unexpected(null, FlowErrors.NestedFlowComment);
}
this.hasFlowCommentCompletion();
this.state.pos += this.skipFlowComment();
this.state.hasFlowComment = true;
return;
}
if (this.state.hasFlowComment) {
const end = this.input.indexOf("*-/", this.state.pos += 2);
if (end === -1) {
throw this.raise(this.state.pos - 2, ErrorMessages.UnterminatedComment);
}
this.state.pos = end + 3;
return;
}
super.skipBlockComment();
}
skipFlowComment() {
const {
pos
} = this.state;
let shiftToFirstNonWhiteSpace = 2;
while ([32, 9].includes(this.input.charCodeAt(pos + shiftToFirstNonWhiteSpace))) {
shiftToFirstNonWhiteSpace++;
}
const ch2 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos);
const ch3 = this.input.charCodeAt(shiftToFirstNonWhiteSpace + pos + 1);
if (ch2 === 58 && ch3 === 58) {
return shiftToFirstNonWhiteSpace + 2;
}
if (this.input.slice(shiftToFirstNonWhiteSpace + pos, shiftToFirstNonWhiteSpace + pos + 12) === "flow-include") {
return shiftToFirstNonWhiteSpace + 12;
}
if (ch2 === 58 && ch3 !== 58) {
return shiftToFirstNonWhiteSpace;
}
return false;
}
hasFlowCommentCompletion() {
const end = this.input.indexOf("*/", this.state.pos);
if (end === -1) {
throw this.raise(this.state.pos, ErrorMessages.UnterminatedComment);
}
}
flowEnumErrorBooleanMemberNotInitialized(pos, {
enumName,
memberName
}) {
this.raise(pos, FlowErrors.EnumBooleanMemberNotInitialized, memberName, enumName);
}
flowEnumErrorInvalidMemberName(pos, {
enumName,
memberName
}) {
const suggestion = memberName[0].toUpperCase() + memberName.slice(1);
this.raise(pos, FlowErrors.EnumInvalidMemberName, memberName, suggestion, enumName);
}
flowEnumErrorDuplicateMemberName(pos, {
enumName,
memberName
}) {
this.raise(pos, FlowErrors.EnumDuplicateMemberName, memberName, enumName);
}
flowEnumErrorInconsistentMemberValues(pos, {
enumName
}) {
this.raise(pos, FlowErrors.EnumInconsistentMemberValues, enumName);
}
flowEnumErrorInvalidExplicitType(pos, {
enumName,
suppliedType
}) {
return this.raise(pos, suppliedType === null ? FlowErrors.EnumInvalidExplicitTypeUnknownSupplied : FlowErrors.EnumInvalidExplicitType, enumName, suppliedType);
}
flowEnumErrorInvalidMemberInitializer(pos, {
enumName,
explicitType,
memberName
}) {
let message = null;
switch (explicitType) {
case "boolean":
case "number":
case "string":
message = FlowErrors.EnumInvalidMemberInitializerPrimaryType;
break;
case "symbol":
message = FlowErrors.EnumInvalidMemberInitializerSymbolType;
break;
default:
message = FlowErrors.EnumInvalidMemberInitializerUnknownType;
}
return this.raise(pos, message, enumName, memberName, explicitType);
}
flowEnumErrorNumberMemberNotInitialized(pos, {
enumName,
memberName
}) {
this.raise(pos, FlowErrors.EnumNumberMemberNotInitialized, enumName, memberName);
}
flowEnumErrorStringMemberInconsistentlyInitailized(pos, {
enumName
}) {
this.raise(pos, FlowErrors.EnumStringMemberInconsistentlyInitailized, enumName);
}
flowEnumMemberInit() {
const startPos = this.state.start;
const endOfInit = () => this.match(types.comma) || this.match(types.braceR);
switch (this.state.type) {
case types.num:
{
const literal = this.parseLiteral(this.state.value, "NumericLiteral");
if (endOfInit()) {
return {
type: "number",
pos: literal.start,
value: literal
};
}
return {
type: "invalid",
pos: startPos
};
}
case types.string:
{
const literal = this.parseLiteral(this.state.value, "StringLiteral");
if (endOfInit()) {
return {
type: "string",
pos: literal.start,
value: literal
};
}
return {
type: "invalid",
pos: startPos
};
}
case types._true:
case types._false:
{
const literal = this.parseBooleanLiteral();
if (endOfInit()) {
return {
type: "boolean",
pos: literal.start,
value: literal
};
}
return {
type: "invalid",
pos: startPos
};
}
default:
return {
type: "invalid",
pos: startPos
};
}
}
flowEnumMemberRaw() {
const pos = this.state.start;
const id = this.parseIdentifier(true);
const init = this.eat(types.eq) ? this.flowEnumMemberInit() : {
type: "none",
pos
};
return {
id,
init
};
}
flowEnumCheckExplicitTypeMismatch(pos, context, expectedType) {
const {
explicitType
} = context;
if (explicitType === null) {
return;
}
if (explicitType !== expectedType) {
this.flowEnumErrorInvalidMemberInitializer(pos, context);
}
}
flowEnumMembers({
enumName,
explicitType
}) {
const seenNames = new Set();
const members = {
booleanMembers: [],
numberMembers: [],
stringMembers: [],
defaultedMembers: []
};
while (!this.match(types.braceR)) {
const memberNode = this.startNode();
const {
id,
init
} = this.flowEnumMemberRaw();
const memberName = id.name;
if (memberName === "") {
continue;
}
if (/^[a-z]/.test(memberName)) {
this.flowEnumErrorInvalidMemberName(id.start, {
enumName,
memberName
});
}
if (seenNames.has(memberName)) {
this.flowEnumErrorDuplicateMemberName(id.start, {
enumName,
memberName
});
}
seenNames.add(memberName);
const context = {
enumName,
explicitType,
memberName
};
memberNode.id = id;
switch (init.type) {
case "boolean":
{
this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "boolean");
memberNode.init = init.value;
members.booleanMembers.push(this.finishNode(memberNode, "EnumBooleanMember"));
break;
}
case "number":
{
this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "number");
memberNode.init = init.value;
members.numberMembers.push(this.finishNode(memberNode, "EnumNumberMember"));
break;
}
case "string":
{
this.flowEnumCheckExplicitTypeMismatch(init.pos, context, "string");
memberNode.init = init.value;
members.stringMembers.push(this.finishNode(memberNode, "EnumStringMember"));
break;
}
case "invalid":
{
throw this.flowEnumErrorInvalidMemberInitializer(init.pos, context);
}
case "none":
{
switch (explicitType) {
case "boolean":
this.flowEnumErrorBooleanMemberNotInitialized(init.pos, context);
break;
case "number":
this.flowEnumErrorNumberMemberNotInitialized(init.pos, context);
break;
default:
members.defaultedMembers.push(this.finishNode(memberNode, "EnumDefaultedMember"));
}
}
}
if (!this.match(types.braceR)) {
this.expect(types.comma);
}
}
return members;
}
flowEnumStringMembers(initializedMembers, defaultedMembers, {
enumName
}) {
if (initializedMembers.length === 0) {
return defaultedMembers;
} else if (defaultedMembers.length === 0) {
return initializedMembers;
} else if (defaultedMembers.length > initializedMembers.length) {
for (let _i = 0; _i < initializedMembers.length; _i++) {
const member = initializedMembers[_i];
this.flowEnumErrorStringMemberInconsistentlyInitailized(member.start, {
enumName
});
}
return defaultedMembers;
} else {
for (let _i2 = 0; _i2 < defaultedMembers.length; _i2++) {
const member = defaultedMembers[_i2];
this.flowEnumErrorStringMemberInconsistentlyInitailized(member.start, {
enumName
});
}
return initializedMembers;
}
}
flowEnumParseExplicitType({
enumName
}) {
if (this.eatContextual("of")) {
if (!this.match(types.name)) {
throw this.flowEnumErrorInvalidExplicitType(this.state.start, {
enumName,
suppliedType: null
});
}
const {
value
} = this.state;
this.next();
if (value !== "boolean" && value !== "number" && value !== "string" && value !== "symbol") {
this.flowEnumErrorInvalidExplicitType(this.state.start, {
enumName,
suppliedType: value
});
}
return value;
}
return null;
}
flowEnumBody(node, {
enumName,
nameLoc
}) {
const explicitType = this.flowEnumParseExplicitType({
enumName
});
this.expect(types.braceL);
const members = this.flowEnumMembers({
enumName,
explicitType
});
switch (explicitType) {
case "boolean":
node.explicitType = true;
node.members = members.booleanMembers;
this.expect(types.braceR);
return this.finishNode(node, "EnumBooleanBody");
case "number":
node.explicitType = true;
node.members = members.numberMembers;
this.expect(types.braceR);
return this.finishNode(node, "EnumNumberBody");
case "string":
node.explicitType = true;
node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
enumName
});
this.expect(types.braceR);
return this.finishNode(node, "EnumStringBody");
case "symbol":
node.members = members.defaultedMembers;
this.expect(types.braceR);
return this.finishNode(node, "EnumSymbolBody");
default:
{
const empty = () => {
node.members = [];
this.expect(types.braceR);
return this.finishNode(node, "EnumStringBody");
};
node.explicitType = false;
const boolsLen = members.booleanMembers.length;
const numsLen = members.numberMembers.length;
const strsLen = members.stringMembers.length;
const defaultedLen = members.defaultedMembers.length;
if (!boolsLen && !numsLen && !strsLen && !defaultedLen) {
return empty();
} else if (!boolsLen && !numsLen) {
node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
enumName
});
this.expect(types.braceR);
return this.finishNode(node, "EnumStringBody");
} else if (!numsLen && !strsLen && boolsLen >= defaultedLen) {
for (let _i3 = 0, _members$defaultedMem = members.defaultedMembers; _i3 < _members$defaultedMem.length; _i3++) {
const member = _members$defaultedMem[_i3];
this.flowEnumErrorBooleanMemberNotInitialized(member.start, {
enumName,
memberName: member.id.name
});
}
node.members = members.booleanMembers;
this.expect(types.braceR);
return this.finishNode(node, "EnumBooleanBody");
} else if (!boolsLen && !strsLen && numsLen >= defaultedLen) {
for (let _i4 = 0, _members$defaultedMem2 = members.defaultedMembers; _i4 < _members$defaultedMem2.length; _i4++) {
const member = _members$defaultedMem2[_i4];
this.flowEnumErrorNumberMemberNotInitialized(member.start, {
enumName,
memberName: member.id.name
});
}
node.members = members.numberMembers;
this.expect(types.braceR);
return this.finishNode(node, "EnumNumberBody");
} else {
this.flowEnumErrorInconsistentMemberValues(nameLoc, {
enumName
});
return empty();
}
}
}
}
flowParseEnumDeclaration(node) {
const id = this.parseIdentifier();
node.id = id;
node.body = this.flowEnumBody(this.startNode(), {
enumName: id.name,
nameLoc: id.start
});
return this.finishNode(node, "EnumDeclaration");
}
updateContext(prevType) {
if (this.match(types.name) && this.state.value === "of" && prevType === types.name && this.input.slice(this.state.lastTokStart, this.state.lastTokEnd) === "interface") {
this.state.exprAllowed = false;
} else {
super.updateContext(prevType);
}
}
});
const entities = {
quot: "\u0022",
amp: "&",
apos: "\u0027",
lt: "<",
gt: ">",
nbsp: "\u00A0",
iexcl: "\u00A1",
cent: "\u00A2",
pound: "\u00A3",
curren: "\u00A4",
yen: "\u00A5",
brvbar: "\u00A6",
sect: "\u00A7",
uml: "\u00A8",
copy: "\u00A9",
ordf: "\u00AA",
laquo: "\u00AB",
not: "\u00AC",
shy: "\u00AD",
reg: "\u00AE",
macr: "\u00AF",
deg: "\u00B0",
plusmn: "\u00B1",
sup2: "\u00B2",
sup3: "\u00B3",
acute: "\u00B4",
micro: "\u00B5",
para: "\u00B6",
middot: "\u00B7",
cedil: "\u00B8",
sup1: "\u00B9",
ordm: "\u00BA",
raquo: "\u00BB",
frac14: "\u00BC",
frac12: "\u00BD",
frac34: "\u00BE",
iquest: "\u00BF",
Agrave: "\u00C0",
Aacute: "\u00C1",
Acirc: "\u00C2",
Atilde: "\u00C3",
Auml: "\u00C4",
Aring: "\u00C5",
AElig: "\u00C6",
Ccedil: "\u00C7",
Egrave: "\u00C8",
Eacute: "\u00C9",
Ecirc: "\u00CA",
Euml: "\u00CB",
Igrave: "\u00CC",
Iacute: "\u00CD",
Icirc: "\u00CE",
Iuml: "\u00CF",
ETH: "\u00D0",
Ntilde: "\u00D1",
Ograve: "\u00D2",
Oacute: "\u00D3",
Ocirc: "\u00D4",
Otilde: "\u00D5",
Ouml: "\u00D6",
times: "\u00D7",
Oslash: "\u00D8",
Ugrave: "\u00D9",
Uacute: "\u00DA",
Ucirc: "\u00DB",
Uuml: "\u00DC",
Yacute: "\u00DD",
THORN: "\u00DE",
szlig: "\u00DF",
agrave: "\u00E0",
aacute: "\u00E1",
acirc: "\u00E2",
atilde: "\u00E3",
auml: "\u00E4",
aring: "\u00E5",
aelig: "\u00E6",
ccedil: "\u00E7",
egrave: "\u00E8",
eacute: "\u00E9",
ecirc: "\u00EA",
euml: "\u00EB",
igrave: "\u00EC",
iacute: "\u00ED",
icirc: "\u00EE",
iuml: "\u00EF",
eth: "\u00F0",
ntilde: "\u00F1",
ograve: "\u00F2",
oacute: "\u00F3",
ocirc: "\u00F4",
otilde: "\u00F5",
ouml: "\u00F6",
divide: "\u00F7",
oslash: "\u00F8",
ugrave: "\u00F9",
uacute: "\u00FA",
ucirc: "\u00FB",
uuml: "\u00FC",
yacute: "\u00FD",
thorn: "\u00FE",
yuml: "\u00FF",
OElig: "\u0152",
oelig: "\u0153",
Scaron: "\u0160",
scaron: "\u0161",
Yuml: "\u0178",
fnof: "\u0192",
circ: "\u02C6",
tilde: "\u02DC",
Alpha: "\u0391",
Beta: "\u0392",
Gamma: "\u0393",
Delta: "\u0394",
Epsilon: "\u0395",
Zeta: "\u0396",
Eta: "\u0397",
Theta: "\u0398",
Iota: "\u0399",
Kappa: "\u039A",
Lambda: "\u039B",
Mu: "\u039C",
Nu: "\u039D",
Xi: "\u039E",
Omicron: "\u039F",
Pi: "\u03A0",
Rho: "\u03A1",
Sigma: "\u03A3",
Tau: "\u03A4",
Upsilon: "\u03A5",
Phi: "\u03A6",
Chi: "\u03A7",
Psi: "\u03A8",
Omega: "\u03A9",
alpha: "\u03B1",
beta: "\u03B2",
gamma: "\u03B3",
delta: "\u03B4",
epsilon: "\u03B5",
zeta: "\u03B6",
eta: "\u03B7",
theta: "\u03B8",
iota: "\u03B9",
kappa: "\u03BA",
lambda: "\u03BB",
mu: "\u03BC",
nu: "\u03BD",
xi: "\u03BE",
omicron: "\u03BF",
pi: "\u03C0",
rho: "\u03C1",
sigmaf: "\u03C2",
sigma: "\u03C3",
tau: "\u03C4",
upsilon: "\u03C5",
phi: "\u03C6",
chi: "\u03C7",
psi: "\u03C8",
omega: "\u03C9",
thetasym: "\u03D1",
upsih: "\u03D2",
piv: "\u03D6",
ensp: "\u2002",
emsp: "\u2003",
thinsp: "\u2009",
zwnj: "\u200C",
zwj: "\u200D",
lrm: "\u200E",
rlm: "\u200F",
ndash: "\u2013",
mdash: "\u2014",
lsquo: "\u2018",
rsquo: "\u2019",
sbquo: "\u201A",
ldquo: "\u201C",
rdquo: "\u201D",
bdquo: "\u201E",
dagger: "\u2020",
Dagger: "\u2021",
bull: "\u2022",
hellip: "\u2026",
permil: "\u2030",
prime: "\u2032",
Prime: "\u2033",
lsaquo: "\u2039",
rsaquo: "\u203A",
oline: "\u203E",
frasl: "\u2044",
euro: "\u20AC",
image: "\u2111",
weierp: "\u2118",
real: "\u211C",
trade: "\u2122",
alefsym: "\u2135",
larr: "\u2190",
uarr: "\u2191",
rarr: "\u2192",
darr: "\u2193",
harr: "\u2194",
crarr: "\u21B5",
lArr: "\u21D0",
uArr: "\u21D1",
rArr: "\u21D2",
dArr: "\u21D3",
hArr: "\u21D4",
forall: "\u2200",
part: "\u2202",
exist: "\u2203",
empty: "\u2205",
nabla: "\u2207",
isin: "\u2208",
notin: "\u2209",
ni: "\u220B",
prod: "\u220F",
sum: "\u2211",
minus: "\u2212",
lowast: "\u2217",
radic: "\u221A",
prop: "\u221D",
infin: "\u221E",
ang: "\u2220",
and: "\u2227",
or: "\u2228",
cap: "\u2229",
cup: "\u222A",
int: "\u222B",
there4: "\u2234",
sim: "\u223C",
cong: "\u2245",
asymp: "\u2248",
ne: "\u2260",
equiv: "\u2261",
le: "\u2264",
ge: "\u2265",
sub: "\u2282",
sup: "\u2283",
nsub: "\u2284",
sube: "\u2286",
supe: "\u2287",
oplus: "\u2295",
otimes: "\u2297",
perp: "\u22A5",
sdot: "\u22C5",
lceil: "\u2308",
rceil: "\u2309",
lfloor: "\u230A",
rfloor: "\u230B",
lang: "\u2329",
rang: "\u232A",
loz: "\u25CA",
spades: "\u2660",
clubs: "\u2663",
hearts: "\u2665",
diams: "\u2666"
};
const HEX_NUMBER = /^[\da-fA-F]+$/;
const DECIMAL_NUMBER = /^\d+$/;
const JsxErrors = Object.freeze({
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression",
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>",
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text",
UnterminatedJsxContent: "Unterminated JSX contents",
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...>?"
});
types$1.j_oTag = new TokContext("...", true, true);
types.jsxName = new TokenType("jsxName");
types.jsxText = new TokenType("jsxText", {
beforeExpr: true
});
types.jsxTagStart = new TokenType("jsxTagStart", {
startsExpr: true
});
types.jsxTagEnd = new TokenType("jsxTagEnd");
types.jsxTagStart.updateContext = function () {
this.state.context.push(types$1.j_expr);
this.state.context.push(types$1.j_oTag);
this.state.exprAllowed = false;
};
types.jsxTagEnd.updateContext = function (prevType) {
const out = this.state.context.pop();
if (out === types$1.j_oTag && prevType === types.slash || out === types$1.j_cTag) {
this.state.context.pop();
this.state.exprAllowed = this.curContext() === types$1.j_expr;
} else {
this.state.exprAllowed = true;
}
};
function isFragment(object) {
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
}
function getQualifiedJSXName(object) {
if (object.type === "JSXIdentifier") {
return object.name;
}
if (object.type === "JSXNamespacedName") {
return object.namespace.name + ":" + object.name.name;
}
if (object.type === "JSXMemberExpression") {
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
}
throw new Error("Node had unexpected type: " + object.type);
}
var jsx = (superClass => class extends superClass {
jsxReadToken() {
let out = "";
let chunkStart = this.state.pos;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent);
}
const ch = this.input.charCodeAt(this.state.pos);
switch (ch) {
case 60:
case 123:
if (this.state.pos === this.state.start) {
if (ch === 60 && this.state.exprAllowed) {
++this.state.pos;
return this.finishToken(types.jsxTagStart);
}
return super.getTokenFromCode(ch);
}
out += this.input.slice(chunkStart, this.state.pos);
return this.finishToken(types.jsxText, out);
case 38:
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
break;
default:
if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadNewLine(true);
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
}
}
jsxReadNewLine(normalizeCRLF) {
const ch = this.input.charCodeAt(this.state.pos);
let out;
++this.state.pos;
if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
++this.state.pos;
out = normalizeCRLF ? "\n" : "\r\n";
} else {
out = String.fromCharCode(ch);
}
++this.state.curLine;
this.state.lineStart = this.state.pos;
return out;
}
jsxReadString(quote) {
let out = "";
let chunkStart = ++this.state.pos;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(this.state.start, ErrorMessages.UnterminatedString);
}
const ch = this.input.charCodeAt(this.state.pos);
if (ch === quote) break;
if (ch === 38) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadNewLine(false);
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
out += this.input.slice(chunkStart, this.state.pos++);
return this.finishToken(types.string, out);
}
jsxReadEntity() {
let str = "";
let count = 0;
let entity;
let ch = this.input[this.state.pos];
const startPos = ++this.state.pos;
while (this.state.pos < this.length && count++ < 10) {
ch = this.input[this.state.pos++];
if (ch === ";") {
if (str[0] === "#") {
if (str[1] === "x") {
str = str.substr(2);
if (HEX_NUMBER.test(str)) {
entity = String.fromCodePoint(parseInt(str, 16));
}
} else {
str = str.substr(1);
if (DECIMAL_NUMBER.test(str)) {
entity = String.fromCodePoint(parseInt(str, 10));
}
}
} else {
entity = entities[str];
}
break;
}
str += ch;
}
if (!entity) {
this.state.pos = startPos;
return "&";
}
return entity;
}
jsxReadWord() {
let ch;
const start = this.state.pos;
do {
ch = this.input.charCodeAt(++this.state.pos);
} while (isIdentifierChar(ch) || ch === 45);
return this.finishToken(types.jsxName, this.input.slice(start, this.state.pos));
}
jsxParseIdentifier() {
const node = this.startNode();
if (this.match(types.jsxName)) {
node.name = this.state.value;
} else if (this.state.type.keyword) {
node.name = this.state.type.keyword;
} else {
this.unexpected();
}
this.next();
return this.finishNode(node, "JSXIdentifier");
}
jsxParseNamespacedName() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const name = this.jsxParseIdentifier();
if (!this.eat(types.colon)) return name;
const node = this.startNodeAt(startPos, startLoc);
node.namespace = name;
node.name = this.jsxParseIdentifier();
return this.finishNode(node, "JSXNamespacedName");
}
jsxParseElementName() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let node = this.jsxParseNamespacedName();
if (node.type === "JSXNamespacedName") {
return node;
}
while (this.eat(types.dot)) {
const newNode = this.startNodeAt(startPos, startLoc);
newNode.object = node;
newNode.property = this.jsxParseIdentifier();
node = this.finishNode(newNode, "JSXMemberExpression");
}
return node;
}
jsxParseAttributeValue() {
let node;
switch (this.state.type) {
case types.braceL:
node = this.startNode();
this.next();
node = this.jsxParseExpressionContainer(node);
if (node.expression.type === "JSXEmptyExpression") {
this.raise(node.start, JsxErrors.AttributeIsEmpty);
}
return node;
case types.jsxTagStart:
case types.string:
return this.parseExprAtom();
default:
throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue);
}
}
jsxParseEmptyExpression() {
const node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc);
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc);
}
jsxParseSpreadChild(node) {
this.next();
node.expression = this.parseExpression();
this.expect(types.braceR);
return this.finishNode(node, "JSXSpreadChild");
}
jsxParseExpressionContainer(node) {
if (this.match(types.braceR)) {
node.expression = this.jsxParseEmptyExpression();
} else {
node.expression = this.parseExpression();
}
this.expect(types.braceR);
return this.finishNode(node, "JSXExpressionContainer");
}
jsxParseAttribute() {
const node = this.startNode();
if (this.eat(types.braceL)) {
this.expect(types.ellipsis);
node.argument = this.parseMaybeAssign();
this.expect(types.braceR);
return this.finishNode(node, "JSXSpreadAttribute");
}
node.name = this.jsxParseNamespacedName();
node.value = this.eat(types.eq) ? this.jsxParseAttributeValue() : null;
return this.finishNode(node, "JSXAttribute");
}
jsxParseOpeningElementAt(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
if (this.match(types.jsxTagEnd)) {
this.expect(types.jsxTagEnd);
return this.finishNode(node, "JSXOpeningFragment");
}
node.name = this.jsxParseElementName();
return this.jsxParseOpeningElementAfterName(node);
}
jsxParseOpeningElementAfterName(node) {
const attributes = [];
while (!this.match(types.slash) && !this.match(types.jsxTagEnd)) {
attributes.push(this.jsxParseAttribute());
}
node.attributes = attributes;
node.selfClosing = this.eat(types.slash);
this.expect(types.jsxTagEnd);
return this.finishNode(node, "JSXOpeningElement");
}
jsxParseClosingElementAt(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
if (this.match(types.jsxTagEnd)) {
this.expect(types.jsxTagEnd);
return this.finishNode(node, "JSXClosingFragment");
}
node.name = this.jsxParseElementName();
this.expect(types.jsxTagEnd);
return this.finishNode(node, "JSXClosingElement");
}
jsxParseElementAt(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
const children = [];
const openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
let closingElement = null;
if (!openingElement.selfClosing) {
contents: for (;;) {
switch (this.state.type) {
case types.jsxTagStart:
startPos = this.state.start;
startLoc = this.state.startLoc;
this.next();
if (this.eat(types.slash)) {
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
break contents;
}
children.push(this.jsxParseElementAt(startPos, startLoc));
break;
case types.jsxText:
children.push(this.parseExprAtom());
break;
case types.braceL:
{
const node = this.startNode();
this.next();
if (this.match(types.ellipsis)) {
children.push(this.jsxParseSpreadChild(node));
} else {
children.push(this.jsxParseExpressionContainer(node));
}
break;
}
default:
throw this.unexpected();
}
}
if (isFragment(openingElement) && !isFragment(closingElement)) {
this.raise(closingElement.start, JsxErrors.MissingClosingTagFragment);
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
}
}
}
if (isFragment(openingElement)) {
node.openingFragment = openingElement;
node.closingFragment = closingElement;
} else {
node.openingElement = openingElement;
node.closingElement = closingElement;
}
node.children = children;
if (this.isRelational("<")) {
throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements);
}
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
}
jsxParseElement() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
this.next();
return this.jsxParseElementAt(startPos, startLoc);
}
parseExprAtom(refExpressionErrors) {
if (this.match(types.jsxText)) {
return this.parseLiteral(this.state.value, "JSXText");
} else if (this.match(types.jsxTagStart)) {
return this.jsxParseElement();
} else if (this.isRelational("<") && this.input.charCodeAt(this.state.pos) !== 33) {
this.finishToken(types.jsxTagStart);
return this.jsxParseElement();
} else {
return super.parseExprAtom(refExpressionErrors);
}
}
getTokenFromCode(code) {
if (this.state.inPropertyName) return super.getTokenFromCode(code);
const context = this.curContext();
if (context === types$1.j_expr) {
return this.jsxReadToken();
}
if (context === types$1.j_oTag || context === types$1.j_cTag) {
if (isIdentifierStart(code)) {
return this.jsxReadWord();
}
if (code === 62) {
++this.state.pos;
return this.finishToken(types.jsxTagEnd);
}
if ((code === 34 || code === 39) && context === types$1.j_oTag) {
return this.jsxReadString(code);
}
}
if (code === 60 && this.state.exprAllowed && this.input.charCodeAt(this.state.pos + 1) !== 33) {
++this.state.pos;
return this.finishToken(types.jsxTagStart);
}
return super.getTokenFromCode(code);
}
updateContext(prevType) {
if (this.match(types.braceL)) {
const curContext = this.curContext();
if (curContext === types$1.j_oTag) {
this.state.context.push(types$1.braceExpression);
} else if (curContext === types$1.j_expr) {
this.state.context.push(types$1.templateQuasi);
} else {
super.updateContext(prevType);
}
this.state.exprAllowed = true;
} else if (this.match(types.slash) && prevType === types.jsxTagStart) {
this.state.context.length -= 2;
this.state.context.push(types$1.j_cTag);
this.state.exprAllowed = false;
} else {
return super.updateContext(prevType);
}
}
});
class Scope {
constructor(flags) {
this.var = [];
this.lexical = [];
this.functions = [];
this.flags = flags;
}
}
class ScopeHandler {
constructor(raise, inModule) {
this.scopeStack = [];
this.undefinedExports = new Map();
this.undefinedPrivateNames = new Map();
this.raise = raise;
this.inModule = inModule;
}
get inFunction() {
return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0;
}
get allowSuper() {
return (this.currentThisScope().flags & SCOPE_SUPER) > 0;
}
get allowDirectSuper() {
return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0;
}
get inClass() {
return (this.currentThisScope().flags & SCOPE_CLASS) > 0;
}
get inNonArrowFunction() {
return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0;
}
get treatFunctionsAsVar() {
return this.treatFunctionsAsVarInScope(this.currentScope());
}
createScope(flags) {
return new Scope(flags);
}
enter(flags) {
this.scopeStack.push(this.createScope(flags));
}
exit() {
this.scopeStack.pop();
}
treatFunctionsAsVarInScope(scope) {
return !!(scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_PROGRAM);
}
declareName(name, bindingType, pos) {
let scope = this.currentScope();
if (bindingType & BIND_SCOPE_LEXICAL || bindingType & BIND_SCOPE_FUNCTION) {
this.checkRedeclarationInScope(scope, name, bindingType, pos);
if (bindingType & BIND_SCOPE_FUNCTION) {
scope.functions.push(name);
} else {
scope.lexical.push(name);
}
if (bindingType & BIND_SCOPE_LEXICAL) {
this.maybeExportDefined(scope, name);
}
} else if (bindingType & BIND_SCOPE_VAR) {
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
scope = this.scopeStack[i];
this.checkRedeclarationInScope(scope, name, bindingType, pos);
scope.var.push(name);
this.maybeExportDefined(scope, name);
if (scope.flags & SCOPE_VAR) break;
}
}
if (this.inModule && scope.flags & SCOPE_PROGRAM) {
this.undefinedExports.delete(name);
}
}
maybeExportDefined(scope, name) {
if (this.inModule && scope.flags & SCOPE_PROGRAM) {
this.undefinedExports.delete(name);
}
}
checkRedeclarationInScope(scope, name, bindingType, pos) {
if (this.isRedeclaredInScope(scope, name, bindingType)) {
this.raise(pos, ErrorMessages.VarRedeclaration, name);
}
}
isRedeclaredInScope(scope, name, bindingType) {
if (!(bindingType & BIND_KIND_VALUE)) return false;
if (bindingType & BIND_SCOPE_LEXICAL) {
return scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
}
if (bindingType & BIND_SCOPE_FUNCTION) {
return scope.lexical.indexOf(name) > -1 || !this.treatFunctionsAsVarInScope(scope) && scope.var.indexOf(name) > -1;
}
return scope.lexical.indexOf(name) > -1 && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.indexOf(name) > -1;
}
checkLocalExport(id) {
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1 && this.scopeStack[0].functions.indexOf(id.name) === -1) {
this.undefinedExports.set(id.name, id.start);
}
}
currentScope() {
return this.scopeStack[this.scopeStack.length - 1];
}
currentVarScope() {
for (let i = this.scopeStack.length - 1;; i--) {
const scope = this.scopeStack[i];
if (scope.flags & SCOPE_VAR) {
return scope;
}
}
}
currentThisScope() {
for (let i = this.scopeStack.length - 1;; i--) {
const scope = this.scopeStack[i];
if ((scope.flags & SCOPE_VAR || scope.flags & SCOPE_CLASS) && !(scope.flags & SCOPE_ARROW)) {
return scope;
}
}
}
}
class TypeScriptScope extends Scope {
constructor(...args) {
super(...args);
this.types = [];
this.enums = [];
this.constEnums = [];
this.classes = [];
this.exportOnlyBindings = [];
}
}
class TypeScriptScopeHandler extends ScopeHandler {
createScope(flags) {
return new TypeScriptScope(flags);
}
declareName(name, bindingType, pos) {
const scope = this.currentScope();
if (bindingType & BIND_FLAGS_TS_EXPORT_ONLY) {
this.maybeExportDefined(scope, name);
scope.exportOnlyBindings.push(name);
return;
}
super.declareName(...arguments);
if (bindingType & BIND_KIND_TYPE) {
if (!(bindingType & BIND_KIND_VALUE)) {
this.checkRedeclarationInScope(scope, name, bindingType, pos);
this.maybeExportDefined(scope, name);
}
scope.types.push(name);
}
if (bindingType & BIND_FLAGS_TS_ENUM) scope.enums.push(name);
if (bindingType & BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.push(name);
if (bindingType & BIND_FLAGS_CLASS) scope.classes.push(name);
}
isRedeclaredInScope(scope, name, bindingType) {
if (scope.enums.indexOf(name) > -1) {
if (bindingType & BIND_FLAGS_TS_ENUM) {
const isConst = !!(bindingType & BIND_FLAGS_TS_CONST_ENUM);
const wasConst = scope.constEnums.indexOf(name) > -1;
return isConst !== wasConst;
}
return true;
}
if (bindingType & BIND_FLAGS_CLASS && scope.classes.indexOf(name) > -1) {
if (scope.lexical.indexOf(name) > -1) {
return !!(bindingType & BIND_KIND_VALUE);
} else {
return false;
}
}
if (bindingType & BIND_KIND_TYPE && scope.types.indexOf(name) > -1) {
return true;
}
return super.isRedeclaredInScope(...arguments);
}
checkLocalExport(id) {
if (this.scopeStack[0].types.indexOf(id.name) === -1 && this.scopeStack[0].exportOnlyBindings.indexOf(id.name) === -1) {
super.checkLocalExport(id);
}
}
}
const PARAM = 0b000,
PARAM_YIELD = 0b001,
PARAM_AWAIT = 0b010,
PARAM_RETURN = 0b100;
class ProductionParameterHandler {
constructor() {
this.stacks = [];
}
enter(flags) {
this.stacks.push(flags);
}
exit() {
this.stacks.pop();
}
currentFlags() {
return this.stacks[this.stacks.length - 1];
}
get hasAwait() {
return (this.currentFlags() & PARAM_AWAIT) > 0;
}
get hasYield() {
return (this.currentFlags() & PARAM_YIELD) > 0;
}
get hasReturn() {
return (this.currentFlags() & PARAM_RETURN) > 0;
}
}
function functionFlags(isAsync, isGenerator) {
return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);
}
function nonNull(x) {
if (x == null) {
throw new Error(`Unexpected ${x} value.`);
}
return x;
}
function assert(x) {
if (!x) {
throw new Error("Assert fail");
}
}
const TSErrors = Object.freeze({
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier",
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier",
DeclareClassFieldHasInitializer: "'declare' class fields cannot have an initializer",
DuplicateModifier: "Duplicate modifier: '%0'",
EmptyHeritageClauseType: "'%0' list cannot be empty.",
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier",
IndexSignatureHasAccessibility: "Index signatures cannot have an accessibility modifier ('%0')",
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier",
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.",
PrivateElementHasAccessibility: "Private elements cannot have an accessibility modifier ('%0')",
TemplateTypeHasSubstitution: "Template literal types cannot have any substitution",
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`",
UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.",
UnexpectedTypeAnnotation: "Did not expect a type annotation here.",
UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.",
UnsupportedImportTypeArgument: "Argument in a type import must be a string literal",
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
UnsupportedSignatureParameterKind: "Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got %0"
});
function keywordTypeFromName(value) {
switch (value) {
case "any":
return "TSAnyKeyword";
case "boolean":
return "TSBooleanKeyword";
case "bigint":
return "TSBigIntKeyword";
case "never":
return "TSNeverKeyword";
case "number":
return "TSNumberKeyword";
case "object":
return "TSObjectKeyword";
case "string":
return "TSStringKeyword";
case "symbol":
return "TSSymbolKeyword";
case "undefined":
return "TSUndefinedKeyword";
case "unknown":
return "TSUnknownKeyword";
default:
return undefined;
}
}
var typescript = (superClass => class extends superClass {
getScopeHandler() {
return TypeScriptScopeHandler;
}
tsIsIdentifier() {
return this.match(types.name);
}
tsNextTokenCanFollowModifier() {
this.next();
return !this.hasPrecedingLineBreak() && !this.match(types.parenL) && !this.match(types.parenR) && !this.match(types.colon) && !this.match(types.eq) && !this.match(types.question) && !this.match(types.bang);
}
tsParseModifier(allowedModifiers) {
if (!this.match(types.name)) {
return undefined;
}
const modifier = this.state.value;
if (allowedModifiers.indexOf(modifier) !== -1 && this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
return modifier;
}
return undefined;
}
tsParseModifiers(modified, allowedModifiers) {
for (;;) {
const startPos = this.state.start;
const modifier = this.tsParseModifier(allowedModifiers);
if (!modifier) break;
if (Object.hasOwnProperty.call(modified, modifier)) {
this.raise(startPos, TSErrors.DuplicateModifier, modifier);
}
modified[modifier] = true;
}
}
tsIsListTerminator(kind) {
switch (kind) {
case "EnumMembers":
case "TypeMembers":
return this.match(types.braceR);
case "HeritageClauseElement":
return this.match(types.braceL);
case "TupleElementTypes":
return this.match(types.bracketR);
case "TypeParametersOrArguments":
return this.isRelational(">");
}
throw new Error("Unreachable");
}
tsParseList(kind, parseElement) {
const result = [];
while (!this.tsIsListTerminator(kind)) {
result.push(parseElement());
}
return result;
}
tsParseDelimitedList(kind, parseElement) {
return nonNull(this.tsParseDelimitedListWorker(kind, parseElement, true));
}
tsParseDelimitedListWorker(kind, parseElement, expectSuccess) {
const result = [];
for (;;) {
if (this.tsIsListTerminator(kind)) {
break;
}
const element = parseElement();
if (element == null) {
return undefined;
}
result.push(element);
if (this.eat(types.comma)) {
continue;
}
if (this.tsIsListTerminator(kind)) {
break;
}
if (expectSuccess) {
this.expect(types.comma);
}
return undefined;
}
return result;
}
tsParseBracketedList(kind, parseElement, bracket, skipFirstToken) {
if (!skipFirstToken) {
if (bracket) {
this.expect(types.bracketL);
} else {
this.expectRelational("<");
}
}
const result = this.tsParseDelimitedList(kind, parseElement);
if (bracket) {
this.expect(types.bracketR);
} else {
this.expectRelational(">");
}
return result;
}
tsParseImportType() {
const node = this.startNode();
this.expect(types._import);
this.expect(types.parenL);
if (!this.match(types.string)) {
this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument);
}
node.argument = this.parseExprAtom();
this.expect(types.parenR);
if (this.eat(types.dot)) {
node.qualifier = this.tsParseEntityName(true);
}
if (this.isRelational("<")) {
node.typeParameters = this.tsParseTypeArguments();
}
return this.finishNode(node, "TSImportType");
}
tsParseEntityName(allowReservedWords) {
let entity = this.parseIdentifier();
while (this.eat(types.dot)) {
const node = this.startNodeAtNode(entity);
node.left = entity;
node.right = this.parseIdentifier(allowReservedWords);
entity = this.finishNode(node, "TSQualifiedName");
}
return entity;
}
tsParseTypeReference() {
const node = this.startNode();
node.typeName = this.tsParseEntityName(false);
if (!this.hasPrecedingLineBreak() && this.isRelational("<")) {
node.typeParameters = this.tsParseTypeArguments();
}
return this.finishNode(node, "TSTypeReference");
}
tsParseThisTypePredicate(lhs) {
this.next();
const node = this.startNodeAtNode(lhs);
node.parameterName = lhs;
node.typeAnnotation = this.tsParseTypeAnnotation(false);
return this.finishNode(node, "TSTypePredicate");
}
tsParseThisTypeNode() {
const node = this.startNode();
this.next();
return this.finishNode(node, "TSThisType");
}
tsParseTypeQuery() {
const node = this.startNode();
this.expect(types._typeof);
if (this.match(types._import)) {
node.exprName = this.tsParseImportType();
} else {
node.exprName = this.tsParseEntityName(true);
}
return this.finishNode(node, "TSTypeQuery");
}
tsParseTypeParameter() {
const node = this.startNode();
node.name = this.parseIdentifierName(node.start);
node.constraint = this.tsEatThenParseType(types._extends);
node.default = this.tsEatThenParseType(types.eq);
return this.finishNode(node, "TSTypeParameter");
}
tsTryParseTypeParameters() {
if (this.isRelational("<")) {
return this.tsParseTypeParameters();
}
}
tsParseTypeParameters() {
const node = this.startNode();
if (this.isRelational("<") || this.match(types.jsxTagStart)) {
this.next();
} else {
this.unexpected();
}
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true);
return this.finishNode(node, "TSTypeParameterDeclaration");
}
tsTryNextParseConstantContext() {
if (this.lookahead().type === types._const) {
this.next();
return this.tsParseTypeReference();
}
return null;
}
tsFillSignature(returnToken, signature) {
const returnTokenRequired = returnToken === types.arrow;
signature.typeParameters = this.tsTryParseTypeParameters();
this.expect(types.parenL);
signature.parameters = this.tsParseBindingListForSignature();
if (returnTokenRequired) {
signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
} else if (this.match(returnToken)) {
signature.typeAnnotation = this.tsParseTypeOrTypePredicateAnnotation(returnToken);
}
}
tsParseBindingListForSignature() {
return this.parseBindingList(types.parenR, 41).map(pattern => {
if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") {
this.raise(pattern.start, TSErrors.UnsupportedSignatureParameterKind, pattern.type);
}
return pattern;
});
}
tsParseTypeMemberSemicolon() {
if (!this.eat(types.comma)) {
this.semicolon();
}
}
tsParseSignatureMember(kind, node) {
this.tsFillSignature(types.colon, node);
this.tsParseTypeMemberSemicolon();
return this.finishNode(node, kind);
}
tsIsUnambiguouslyIndexSignature() {
this.next();
return this.eat(types.name) && this.match(types.colon);
}
tsTryParseIndexSignature(node) {
if (!(this.match(types.bracketL) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
return undefined;
}
this.expect(types.bracketL);
const id = this.parseIdentifier();
id.typeAnnotation = this.tsParseTypeAnnotation();
this.resetEndLocation(id);
this.expect(types.bracketR);
node.parameters = [id];
const type = this.tsTryParseTypeAnnotation();
if (type) node.typeAnnotation = type;
this.tsParseTypeMemberSemicolon();
return this.finishNode(node, "TSIndexSignature");
}
tsParsePropertyOrMethodSignature(node, readonly) {
if (this.eat(types.question)) node.optional = true;
const nodeAny = node;
if (!readonly && (this.match(types.parenL) || this.isRelational("<"))) {
const method = nodeAny;
this.tsFillSignature(types.colon, method);
this.tsParseTypeMemberSemicolon();
return this.finishNode(method, "TSMethodSignature");
} else {
const property = nodeAny;
if (readonly) property.readonly = true;
const type = this.tsTryParseTypeAnnotation();
if (type) property.typeAnnotation = type;
this.tsParseTypeMemberSemicolon();
return this.finishNode(property, "TSPropertySignature");
}
}
tsParseTypeMember() {
const node = this.startNode();
if (this.match(types.parenL) || this.isRelational("<")) {
return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
}
if (this.match(types._new)) {
const id = this.startNode();
this.next();
if (this.match(types.parenL) || this.isRelational("<")) {
return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
} else {
node.key = this.createIdentifier(id, "new");
return this.tsParsePropertyOrMethodSignature(node, false);
}
}
const readonly = !!this.tsParseModifier(["readonly"]);
const idx = this.tsTryParseIndexSignature(node);
if (idx) {
if (readonly) node.readonly = true;
return idx;
}
this.parsePropertyName(node, false);
return this.tsParsePropertyOrMethodSignature(node, readonly);
}
tsParseTypeLiteral() {
const node = this.startNode();
node.members = this.tsParseObjectTypeMembers();
return this.finishNode(node, "TSTypeLiteral");
}
tsParseObjectTypeMembers() {
this.expect(types.braceL);
const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
this.expect(types.braceR);
return members;
}
tsIsStartOfMappedType() {
this.next();
if (this.eat(types.plusMin)) {
return this.isContextual("readonly");
}
if (this.isContextual("readonly")) {
this.next();
}
if (!this.match(types.bracketL)) {
return false;
}
this.next();
if (!this.tsIsIdentifier()) {
return false;
}
this.next();
return this.match(types._in);
}
tsParseMappedTypeParameter() {
const node = this.startNode();
node.name = this.parseIdentifierName(node.start);
node.constraint = this.tsExpectThenParseType(types._in);
return this.finishNode(node, "TSTypeParameter");
}
tsParseMappedType() {
const node = this.startNode();
this.expect(types.braceL);
if (this.match(types.plusMin)) {
node.readonly = this.state.value;
this.next();
this.expectContextual("readonly");
} else if (this.eatContextual("readonly")) {
node.readonly = true;
}
this.expect(types.bracketL);
node.typeParameter = this.tsParseMappedTypeParameter();
this.expect(types.bracketR);
if (this.match(types.plusMin)) {
node.optional = this.state.value;
this.next();
this.expect(types.question);
} else if (this.eat(types.question)) {
node.optional = true;
}
node.typeAnnotation = this.tsTryParseType();
this.semicolon();
this.expect(types.braceR);
return this.finishNode(node, "TSMappedType");
}
tsParseTupleType() {
const node = this.startNode();
node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
let seenOptionalElement = false;
node.elementTypes.forEach(elementNode => {
if (elementNode.type === "TSOptionalType") {
seenOptionalElement = true;
} else if (seenOptionalElement && elementNode.type !== "TSRestType") {
this.raise(elementNode.start, TSErrors.OptionalTypeBeforeRequired);
}
});
return this.finishNode(node, "TSTupleType");
}
tsParseTupleElementType() {
if (this.match(types.ellipsis)) {
const restNode = this.startNode();
this.next();
restNode.typeAnnotation = this.tsParseType();
if (this.match(types.comma) && this.lookaheadCharCode() !== 93) {
this.raiseRestNotLast(this.state.start);
}
return this.finishNode(restNode, "TSRestType");
}
const type = this.tsParseType();
if (this.eat(types.question)) {
const optionalTypeNode = this.startNodeAtNode(type);
optionalTypeNode.typeAnnotation = type;
return this.finishNode(optionalTypeNode, "TSOptionalType");
}
return type;
}
tsParseParenthesizedType() {
const node = this.startNode();
this.expect(types.parenL);
node.typeAnnotation = this.tsParseType();
this.expect(types.parenR);
return this.finishNode(node, "TSParenthesizedType");
}
tsParseFunctionOrConstructorType(type) {
const node = this.startNode();
if (type === "TSConstructorType") {
this.expect(types._new);
}
this.tsFillSignature(types.arrow, node);
return this.finishNode(node, type);
}
tsParseLiteralTypeNode() {
const node = this.startNode();
node.literal = (() => {
switch (this.state.type) {
case types.num:
case types.bigint:
case types.string:
case types._true:
case types._false:
return this.parseExprAtom();
default:
throw this.unexpected();
}
})();
return this.finishNode(node, "TSLiteralType");
}
tsParseTemplateLiteralType() {
const node = this.startNode();
const templateNode = this.parseTemplate(false);
if (templateNode.expressions.length > 0) {
this.raise(templateNode.expressions[0].start, TSErrors.TemplateTypeHasSubstitution);
}
node.literal = templateNode;
return this.finishNode(node, "TSLiteralType");
}
tsParseThisTypeOrThisTypePredicate() {
const thisKeyword = this.tsParseThisTypeNode();
if (this.isContextual("is") && !this.hasPrecedingLineBreak()) {
return this.tsParseThisTypePredicate(thisKeyword);
} else {
return thisKeyword;
}
}
tsParseNonArrayType() {
switch (this.state.type) {
case types.name:
case types._void:
case types._null:
{
const type = this.match(types._void) ? "TSVoidKeyword" : this.match(types._null) ? "TSNullKeyword" : keywordTypeFromName(this.state.value);
if (type !== undefined && this.lookaheadCharCode() !== 46) {
const node = this.startNode();
this.next();
return this.finishNode(node, type);
}
return this.tsParseTypeReference();
}
case types.string:
case types.num:
case types.bigint:
case types._true:
case types._false:
return this.tsParseLiteralTypeNode();
case types.plusMin:
if (this.state.value === "-") {
const node = this.startNode();
const nextToken = this.lookahead();
if (nextToken.type !== types.num && nextToken.type !== types.bigint) {
throw this.unexpected();
}
node.literal = this.parseMaybeUnary();
return this.finishNode(node, "TSLiteralType");
}
break;
case types._this:
return this.tsParseThisTypeOrThisTypePredicate();
case types._typeof:
return this.tsParseTypeQuery();
case types._import:
return this.tsParseImportType();
case types.braceL:
return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
case types.bracketL:
return this.tsParseTupleType();
case types.parenL:
return this.tsParseParenthesizedType();
case types.backQuote:
return this.tsParseTemplateLiteralType();
}
throw this.unexpected();
}
tsParseArrayTypeOrHigher() {
let type = this.tsParseNonArrayType();
while (!this.hasPrecedingLineBreak() && this.eat(types.bracketL)) {
if (this.match(types.bracketR)) {
const node = this.startNodeAtNode(type);
node.elementType = type;
this.expect(types.bracketR);
type = this.finishNode(node, "TSArrayType");
} else {
const node = this.startNodeAtNode(type);
node.objectType = type;
node.indexType = this.tsParseType();
this.expect(types.bracketR);
type = this.finishNode(node, "TSIndexedAccessType");
}
}
return type;
}
tsParseTypeOperator(operator) {
const node = this.startNode();
this.expectContextual(operator);
node.operator = operator;
node.typeAnnotation = this.tsParseTypeOperatorOrHigher();
if (operator === "readonly") {
this.tsCheckTypeAnnotationForReadOnly(node);
}
return this.finishNode(node, "TSTypeOperator");
}
tsCheckTypeAnnotationForReadOnly(node) {
switch (node.typeAnnotation.type) {
case "TSTupleType":
case "TSArrayType":
return;
default:
this.raise(node.start, TSErrors.UnexpectedReadonly);
}
}
tsParseInferType() {
const node = this.startNode();
this.expectContextual("infer");
const typeParameter = this.startNode();
typeParameter.name = this.parseIdentifierName(typeParameter.start);
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
return this.finishNode(node, "TSInferType");
}
tsParseTypeOperatorOrHigher() {
const operator = ["keyof", "unique", "readonly"].find(kw => this.isContextual(kw));
return operator ? this.tsParseTypeOperator(operator) : this.isContextual("infer") ? this.tsParseInferType() : this.tsParseArrayTypeOrHigher();
}
tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) {
this.eat(operator);
let type = parseConstituentType();
if (this.match(operator)) {
const types = [type];
while (this.eat(operator)) {
types.push(parseConstituentType());
}
const node = this.startNodeAtNode(type);
node.types = types;
type = this.finishNode(node, kind);
}
return type;
}
tsParseIntersectionTypeOrHigher() {
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), types.bitwiseAND);
}
tsParseUnionTypeOrHigher() {
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), types.bitwiseOR);
}
tsIsStartOfFunctionType() {
if (this.isRelational("<")) {
return true;
}
return this.match(types.parenL) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
}
tsSkipParameterStart() {
if (this.match(types.name) || this.match(types._this)) {
this.next();
return true;
}
if (this.match(types.braceL)) {
let braceStackCounter = 1;
this.next();
while (braceStackCounter > 0) {
if (this.match(types.braceL)) {
++braceStackCounter;
} else if (this.match(types.braceR)) {
--braceStackCounter;
}
this.next();
}
return true;
}
if (this.match(types.bracketL)) {
let braceStackCounter = 1;
this.next();
while (braceStackCounter > 0) {
if (this.match(types.bracketL)) {
++braceStackCounter;
} else if (this.match(types.bracketR)) {
--braceStackCounter;
}
this.next();
}
return true;
}
return false;
}
tsIsUnambiguouslyStartOfFunctionType() {
this.next();
if (this.match(types.parenR) || this.match(types.ellipsis)) {
return true;
}
if (this.tsSkipParameterStart()) {
if (this.match(types.colon) || this.match(types.comma) || this.match(types.question) || this.match(types.eq)) {
return true;
}
if (this.match(types.parenR)) {
this.next();
if (this.match(types.arrow)) {
return true;
}
}
}
return false;
}
tsParseTypeOrTypePredicateAnnotation(returnToken) {
return this.tsInType(() => {
const t = this.startNode();
this.expect(returnToken);
const asserts = this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
if (asserts && this.match(types._this)) {
let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
if (thisTypePredicate.type === "TSThisType") {
const node = this.startNodeAtNode(t);
node.parameterName = thisTypePredicate;
node.asserts = true;
thisTypePredicate = this.finishNode(node, "TSTypePredicate");
} else {
thisTypePredicate.asserts = true;
}
t.typeAnnotation = thisTypePredicate;
return this.finishNode(t, "TSTypeAnnotation");
}
const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));
if (!typePredicateVariable) {
if (!asserts) {
return this.tsParseTypeAnnotation(false, t);
}
const node = this.startNodeAtNode(t);
node.parameterName = this.parseIdentifier();
node.asserts = asserts;
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
return this.finishNode(t, "TSTypeAnnotation");
}
const type = this.tsParseTypeAnnotation(false);
const node = this.startNodeAtNode(t);
node.parameterName = typePredicateVariable;
node.typeAnnotation = type;
node.asserts = asserts;
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
return this.finishNode(t, "TSTypeAnnotation");
});
}
tsTryParseTypeOrTypePredicateAnnotation() {
return this.match(types.colon) ? this.tsParseTypeOrTypePredicateAnnotation(types.colon) : undefined;
}
tsTryParseTypeAnnotation() {
return this.match(types.colon) ? this.tsParseTypeAnnotation() : undefined;
}
tsTryParseType() {
return this.tsEatThenParseType(types.colon);
}
tsParseTypePredicatePrefix() {
const id = this.parseIdentifier();
if (this.isContextual("is") && !this.hasPrecedingLineBreak()) {
this.next();
return id;
}
}
tsParseTypePredicateAsserts() {
if (!this.match(types.name) || this.state.value !== "asserts" || this.hasPrecedingLineBreak()) {
return false;
}
const containsEsc = this.state.containsEsc;
this.next();
if (!this.match(types.name) && !this.match(types._this)) {
return false;
}
if (containsEsc) {
this.raise(this.state.lastTokStart, ErrorMessages.InvalidEscapedReservedWord, "asserts");
}
return true;
}
tsParseTypeAnnotation(eatColon = true, t = this.startNode()) {
this.tsInType(() => {
if (eatColon) this.expect(types.colon);
t.typeAnnotation = this.tsParseType();
});
return this.finishNode(t, "TSTypeAnnotation");
}
tsParseType() {
assert(this.state.inType);
const type = this.tsParseNonConditionalType();
if (this.hasPrecedingLineBreak() || !this.eat(types._extends)) {
return type;
}
const node = this.startNodeAtNode(type);
node.checkType = type;
node.extendsType = this.tsParseNonConditionalType();
this.expect(types.question);
node.trueType = this.tsParseType();
this.expect(types.colon);
node.falseType = this.tsParseType();
return this.finishNode(node, "TSConditionalType");
}
tsParseNonConditionalType() {
if (this.tsIsStartOfFunctionType()) {
return this.tsParseFunctionOrConstructorType("TSFunctionType");
}
if (this.match(types._new)) {
return this.tsParseFunctionOrConstructorType("TSConstructorType");
}
return this.tsParseUnionTypeOrHigher();
}
tsParseTypeAssertion() {
const node = this.startNode();
const _const = this.tsTryNextParseConstantContext();
node.typeAnnotation = _const || this.tsNextThenParseType();
this.expectRelational(">");
node.expression = this.parseMaybeUnary();
return this.finishNode(node, "TSTypeAssertion");
}
tsParseHeritageClause(descriptor) {
const originalStart = this.state.start;
const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", this.tsParseExpressionWithTypeArguments.bind(this));
if (!delimitedList.length) {
this.raise(originalStart, TSErrors.EmptyHeritageClauseType, descriptor);
}
return delimitedList;
}
tsParseExpressionWithTypeArguments() {
const node = this.startNode();
node.expression = this.tsParseEntityName(false);
if (this.isRelational("<")) {
node.typeParameters = this.tsParseTypeArguments();
}
return this.finishNode(node, "TSExpressionWithTypeArguments");
}
tsParseInterfaceDeclaration(node) {
node.id = this.parseIdentifier();
this.checkLVal(node.id, BIND_TS_INTERFACE, undefined, "typescript interface declaration");
node.typeParameters = this.tsTryParseTypeParameters();
if (this.eat(types._extends)) {
node.extends = this.tsParseHeritageClause("extends");
}
const body = this.startNode();
body.body = this.tsInType(this.tsParseObjectTypeMembers.bind(this));
node.body = this.finishNode(body, "TSInterfaceBody");
return this.finishNode(node, "TSInterfaceDeclaration");
}
tsParseTypeAliasDeclaration(node) {
node.id = this.parseIdentifier();
this.checkLVal(node.id, BIND_TS_TYPE, undefined, "typescript type alias");
node.typeParameters = this.tsTryParseTypeParameters();
node.typeAnnotation = this.tsExpectThenParseType(types.eq);
this.semicolon();
return this.finishNode(node, "TSTypeAliasDeclaration");
}
tsInNoContext(cb) {
const oldContext = this.state.context;
this.state.context = [oldContext[0]];
try {
return cb();
} finally {
this.state.context = oldContext;
}
}
tsInType(cb) {
const oldInType = this.state.inType;
this.state.inType = true;
try {
return cb();
} finally {
this.state.inType = oldInType;
}
}
tsEatThenParseType(token) {
return !this.match(token) ? undefined : this.tsNextThenParseType();
}
tsExpectThenParseType(token) {
return this.tsDoThenParseType(() => this.expect(token));
}
tsNextThenParseType() {
return this.tsDoThenParseType(() => this.next());
}
tsDoThenParseType(cb) {
return this.tsInType(() => {
cb();
return this.tsParseType();
});
}
tsParseEnumMember() {
const node = this.startNode();
node.id = this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
if (this.eat(types.eq)) {
node.initializer = this.parseMaybeAssign();
}
return this.finishNode(node, "TSEnumMember");
}
tsParseEnumDeclaration(node, isConst) {
if (isConst) node.const = true;
node.id = this.parseIdentifier();
this.checkLVal(node.id, isConst ? BIND_TS_CONST_ENUM : BIND_TS_ENUM, undefined, "typescript enum declaration");
this.expect(types.braceL);
node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
this.expect(types.braceR);
return this.finishNode(node, "TSEnumDeclaration");
}
tsParseModuleBlock() {
const node = this.startNode();
this.scope.enter(SCOPE_OTHER);
this.expect(types.braceL);
this.parseBlockOrModuleBlockBody(node.body = [], undefined, true, types.braceR);
this.scope.exit();
return this.finishNode(node, "TSModuleBlock");
}
tsParseModuleOrNamespaceDeclaration(node, nested = false) {
node.id = this.parseIdentifier();
if (!nested) {
this.checkLVal(node.id, BIND_TS_NAMESPACE, null, "module or namespace declaration");
}
if (this.eat(types.dot)) {
const inner = this.startNode();
this.tsParseModuleOrNamespaceDeclaration(inner, true);
node.body = inner;
} else {
this.scope.enter(SCOPE_TS_MODULE);
this.prodParam.enter(PARAM);
node.body = this.tsParseModuleBlock();
this.prodParam.exit();
this.scope.exit();
}
return this.finishNode(node, "TSModuleDeclaration");
}
tsParseAmbientExternalModuleDeclaration(node) {
if (this.isContextual("global")) {
node.global = true;
node.id = this.parseIdentifier();
} else if (this.match(types.string)) {
node.id = this.parseExprAtom();
} else {
this.unexpected();
}
if (this.match(types.braceL)) {
this.scope.enter(SCOPE_TS_MODULE);
this.prodParam.enter(PARAM);
node.body = this.tsParseModuleBlock();
this.prodParam.exit();
this.scope.exit();
} else {
this.semicolon();
}
return this.finishNode(node, "TSModuleDeclaration");
}
tsParseImportEqualsDeclaration(node, isExport) {
node.isExport = isExport || false;
node.id = this.parseIdentifier();
this.checkLVal(node.id, BIND_LEXICAL, undefined, "import equals declaration");
this.expect(types.eq);
node.moduleReference = this.tsParseModuleReference();
this.semicolon();
return this.finishNode(node, "TSImportEqualsDeclaration");
}
tsIsExternalModuleReference() {
return this.isContextual("require") && this.lookaheadCharCode() === 40;
}
tsParseModuleReference() {
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(false);
}
tsParseExternalModuleReference() {
const node = this.startNode();
this.expectContextual("require");
this.expect(types.parenL);
if (!this.match(types.string)) {
throw this.unexpected();
}
node.expression = this.parseExprAtom();
this.expect(types.parenR);
return this.finishNode(node, "TSExternalModuleReference");
}
tsLookAhead(f) {
const state = this.state.clone();
const res = f();
this.state = state;
return res;
}
tsTryParseAndCatch(f) {
const result = this.tryParse(abort => f() || abort());
if (result.aborted || !result.node) return undefined;
if (result.error) this.state = result.failState;
return result.node;
}
tsTryParse(f) {
const state = this.state.clone();
const result = f();
if (result !== undefined && result !== false) {
return result;
} else {
this.state = state;
return undefined;
}
}
tsTryParseDeclare(nany) {
if (this.isLineTerminator()) {
return;
}
let starttype = this.state.type;
let kind;
if (this.isContextual("let")) {
starttype = types._var;
kind = "let";
}
switch (starttype) {
case types._function:
return this.parseFunctionStatement(nany, false, true);
case types._class:
nany.declare = true;
return this.parseClass(nany, true, false);
case types._const:
if (this.match(types._const) && this.isLookaheadContextual("enum")) {
this.expect(types._const);
this.expectContextual("enum");
return this.tsParseEnumDeclaration(nany, true);
}
case types._var:
kind = kind || this.state.value;
return this.parseVarStatement(nany, kind);
case types.name:
{
const value = this.state.value;
if (value === "global") {
return this.tsParseAmbientExternalModuleDeclaration(nany);
} else {
return this.tsParseDeclaration(nany, value, true);
}
}
}
}
tsTryParseExportDeclaration() {
return this.tsParseDeclaration(this.startNode(), this.state.value, true);
}
tsParseExpressionStatement(node, expr) {
switch (expr.name) {
case "declare":
{
const declaration = this.tsTryParseDeclare(node);
if (declaration) {
declaration.declare = true;
return declaration;
}
break;
}
case "global":
if (this.match(types.braceL)) {
this.scope.enter(SCOPE_TS_MODULE);
this.prodParam.enter(PARAM);
const mod = node;
mod.global = true;
mod.id = expr;
mod.body = this.tsParseModuleBlock();
this.scope.exit();
this.prodParam.exit();
return this.finishNode(mod, "TSModuleDeclaration");
}
break;
default:
return this.tsParseDeclaration(node, expr.name, false);
}
}
tsParseDeclaration(node, value, next) {
switch (value) {
case "abstract":
if (this.tsCheckLineTerminatorAndMatch(types._class, next)) {
const cls = node;
cls.abstract = true;
if (next) {
this.next();
if (!this.match(types._class)) {
this.unexpected(null, types._class);
}
}
return this.parseClass(cls, true, false);
}
break;
case "enum":
if (next || this.match(types.name)) {
if (next) this.next();
return this.tsParseEnumDeclaration(node, false);
}
break;
case "interface":
if (this.tsCheckLineTerminatorAndMatch(types.name, next)) {
if (next) this.next();
return this.tsParseInterfaceDeclaration(node);
}
break;
case "module":
if (next) this.next();
if (this.match(types.string)) {
return this.tsParseAmbientExternalModuleDeclaration(node);
} else if (this.tsCheckLineTerminatorAndMatch(types.name, next)) {
return this.tsParseModuleOrNamespaceDeclaration(node);
}
break;
case "namespace":
if (this.tsCheckLineTerminatorAndMatch(types.name, next)) {
if (next) this.next();
return this.tsParseModuleOrNamespaceDeclaration(node);
}
break;
case "type":
if (this.tsCheckLineTerminatorAndMatch(types.name, next)) {
if (next) this.next();
return this.tsParseTypeAliasDeclaration(node);
}
break;
}
}
tsCheckLineTerminatorAndMatch(tokenType, next) {
return (next || this.match(tokenType)) && !this.isLineTerminator();
}
tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
if (!this.isRelational("<")) {
return undefined;
}
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
this.state.maybeInArrowParameters = true;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
const res = this.tsTryParseAndCatch(() => {
const node = this.startNodeAt(startPos, startLoc);
node.typeParameters = this.tsParseTypeParameters();
super.parseFunctionParams(node);
node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation();
this.expect(types.arrow);
return node;
});
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
if (!res) {
return undefined;
}
return this.parseArrowExpression(res, null, true);
}
tsParseTypeArguments() {
const node = this.startNode();
node.params = this.tsInType(() => this.tsInNoContext(() => {
this.expectRelational("<");
return this.tsParseDelimitedList("TypeParametersOrArguments", this.tsParseType.bind(this));
}));
this.state.exprAllowed = false;
this.expectRelational(">");
return this.finishNode(node, "TSTypeParameterInstantiation");
}
tsIsDeclarationStart() {
if (this.match(types.name)) {
switch (this.state.value) {
case "abstract":
case "declare":
case "enum":
case "interface":
case "module":
case "namespace":
case "type":
return true;
}
}
return false;
}
isExportDefaultSpecifier() {
if (this.tsIsDeclarationStart()) return false;
return super.isExportDefaultSpecifier();
}
parseAssignableListItem(allowModifiers, decorators) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let accessibility;
let readonly = false;
if (allowModifiers) {
accessibility = this.parseAccessModifier();
readonly = !!this.tsParseModifier(["readonly"]);
}
const left = this.parseMaybeDefault();
this.parseAssignableListItemTypes(left);
const elt = this.parseMaybeDefault(left.start, left.loc.start, left);
if (accessibility || readonly) {
const pp = this.startNodeAt(startPos, startLoc);
if (decorators.length) {
pp.decorators = decorators;
}
if (accessibility) pp.accessibility = accessibility;
if (readonly) pp.readonly = readonly;
if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") {
this.raise(pp.start, TSErrors.UnsupportedParameterPropertyKind);
}
pp.parameter = elt;
return this.finishNode(pp, "TSParameterProperty");
}
if (decorators.length) {
left.decorators = decorators;
}
return elt;
}
parseFunctionBodyAndFinish(node, type, isMethod = false) {
if (this.match(types.colon)) {
node.returnType = this.tsParseTypeOrTypePredicateAnnotation(types.colon);
}
const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" ? "TSDeclareMethod" : undefined;
if (bodilessType && !this.match(types.braceL) && this.isLineTerminator()) {
this.finishNode(node, bodilessType);
return;
}
super.parseFunctionBodyAndFinish(node, type, isMethod);
}
registerFunctionStatementId(node) {
if (!node.body && node.id) {
this.checkLVal(node.id, BIND_TS_AMBIENT, null, "function name");
} else {
super.registerFunctionStatementId(...arguments);
}
}
parseSubscript(base, startPos, startLoc, noCalls, state) {
if (!this.hasPrecedingLineBreak() && this.match(types.bang)) {
this.state.exprAllowed = false;
this.next();
const nonNullExpression = this.startNodeAt(startPos, startLoc);
nonNullExpression.expression = base;
return this.finishNode(nonNullExpression, "TSNonNullExpression");
}
if (this.isRelational("<")) {
const result = this.tsTryParseAndCatch(() => {
if (!noCalls && this.atPossibleAsyncArrow(base)) {
const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startPos, startLoc);
if (asyncArrowFn) {
return asyncArrowFn;
}
}
const node = this.startNodeAt(startPos, startLoc);
node.callee = base;
const typeArguments = this.tsParseTypeArguments();
if (typeArguments) {
if (!noCalls && this.eat(types.parenL)) {
node.arguments = this.parseCallExpressionArguments(types.parenR, false);
node.typeParameters = typeArguments;
return this.finishCallExpression(node, state.optionalChainMember);
} else if (this.match(types.backQuote)) {
return this.parseTaggedTemplateExpression(startPos, startLoc, base, state, typeArguments);
}
}
this.unexpected();
});
if (result) return result;
}
return super.parseSubscript(base, startPos, startLoc, noCalls, state);
}
parseNewArguments(node) {
if (this.isRelational("<")) {
const typeParameters = this.tsTryParseAndCatch(() => {
const args = this.tsParseTypeArguments();
if (!this.match(types.parenL)) this.unexpected();
return args;
});
if (typeParameters) {
node.typeParameters = typeParameters;
}
}
super.parseNewArguments(node);
}
parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn) {
if (nonNull(types._in.binop) > minPrec && !this.hasPrecedingLineBreak() && this.isContextual("as")) {
const node = this.startNodeAt(leftStartPos, leftStartLoc);
node.expression = left;
const _const = this.tsTryNextParseConstantContext();
if (_const) {
node.typeAnnotation = _const;
} else {
node.typeAnnotation = this.tsNextThenParseType();
}
this.finishNode(node, "TSAsExpression");
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
}
return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn);
}
checkReservedWord(word, startLoc, checkKeywords, isBinding) {}
checkDuplicateExports() {}
parseImport(node) {
if (this.match(types.name) || this.match(types.star) || this.match(types.braceL)) {
const ahead = this.lookahead();
if (this.match(types.name) && ahead.type === types.eq) {
return this.tsParseImportEqualsDeclaration(node);
}
if (this.isContextual("type") && ahead.type !== types.comma && !(ahead.type === types.name && ahead.value === "from")) {
node.importKind = "type";
this.next();
} else {
node.importKind = "value";
}
}
const importNode = super.parseImport(node);
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
this.raise(importNode.start, "A type-only import can specify a default import or named bindings, but not both.");
}
return importNode;
}
parseExport(node) {
if (this.match(types._import)) {
this.expect(types._import);
return this.tsParseImportEqualsDeclaration(node, true);
} else if (this.eat(types.eq)) {
const assign = node;
assign.expression = this.parseExpression();
this.semicolon();
return this.finishNode(assign, "TSExportAssignment");
} else if (this.eatContextual("as")) {
const decl = node;
this.expectContextual("namespace");
decl.id = this.parseIdentifier();
this.semicolon();
return this.finishNode(decl, "TSNamespaceExportDeclaration");
} else {
if (this.isContextual("type") && this.lookahead().type === types.braceL) {
this.next();
node.exportKind = "type";
} else {
node.exportKind = "value";
}
return super.parseExport(node);
}
}
isAbstractClass() {
return this.isContextual("abstract") && this.lookahead().type === types._class;
}
parseExportDefaultExpression() {
if (this.isAbstractClass()) {
const cls = this.startNode();
this.next();
this.parseClass(cls, true, true);
cls.abstract = true;
return cls;
}
if (this.state.value === "interface") {
const result = this.tsParseDeclaration(this.startNode(), this.state.value, true);
if (result) return result;
}
return super.parseExportDefaultExpression();
}
parseStatementContent(context, topLevel) {
if (this.state.type === types._const) {
const ahead = this.lookahead();
if (ahead.type === types.name && ahead.value === "enum") {
const node = this.startNode();
this.expect(types._const);
this.expectContextual("enum");
return this.tsParseEnumDeclaration(node, true);
}
}
return super.parseStatementContent(context, topLevel);
}
parseAccessModifier() {
return this.tsParseModifier(["public", "protected", "private"]);
}
parseClassMember(classBody, member, state, constructorAllowsSuper) {
this.tsParseModifiers(member, ["declare"]);
const accessibility = this.parseAccessModifier();
if (accessibility) member.accessibility = accessibility;
this.tsParseModifiers(member, ["declare"]);
super.parseClassMember(classBody, member, state, constructorAllowsSuper);
}
parseClassMemberWithIsStatic(classBody, member, state, isStatic, constructorAllowsSuper) {
this.tsParseModifiers(member, ["abstract", "readonly", "declare"]);
const idx = this.tsTryParseIndexSignature(member);
if (idx) {
classBody.body.push(idx);
if (member.abstract) {
this.raise(member.start, TSErrors.IndexSignatureHasAbstract);
}
if (isStatic) {
this.raise(member.start, TSErrors.IndexSignatureHasStatic);
}
if (member.accessibility) {
this.raise(member.start, TSErrors.IndexSignatureHasAccessibility, member.accessibility);
}
return;
}
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic, constructorAllowsSuper);
}
parsePostMemberNameModifiers(methodOrProp) {
const optional = this.eat(types.question);
if (optional) methodOrProp.optional = true;
if (methodOrProp.readonly && this.match(types.parenL)) {
this.raise(methodOrProp.start, TSErrors.ClassMethodHasReadonly);
}
if (methodOrProp.declare && this.match(types.parenL)) {
this.raise(methodOrProp.start, TSErrors.ClassMethodHasDeclare);
}
}
parseExpressionStatement(node, expr) {
const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr) : undefined;
return decl || super.parseExpressionStatement(node, expr);
}
shouldParseExportDeclaration() {
if (this.tsIsDeclarationStart()) return true;
return super.shouldParseExportDeclaration();
}
parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
if (!refNeedsArrowPos || !this.match(types.question)) {
return super.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
}
const result = this.tryParse(() => super.parseConditional(expr, noIn, startPos, startLoc));
if (!result.node) {
refNeedsArrowPos.start = result.error.pos || this.state.start;
return expr;
}
if (result.error) this.state = result.failState;
return result.node;
}
parseParenItem(node, startPos, startLoc) {
node = super.parseParenItem(node, startPos, startLoc);
if (this.eat(types.question)) {
node.optional = true;
this.resetEndLocation(node);
}
if (this.match(types.colon)) {
const typeCastNode = this.startNodeAt(startPos, startLoc);
typeCastNode.expression = node;
typeCastNode.typeAnnotation = this.tsParseTypeAnnotation();
return this.finishNode(typeCastNode, "TSTypeCastExpression");
}
return node;
}
parseExportDeclaration(node) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const isDeclare = this.eatContextual("declare");
let declaration;
if (this.match(types.name)) {
declaration = this.tsTryParseExportDeclaration();
}
if (!declaration) {
declaration = super.parseExportDeclaration(node);
}
if (declaration && (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare)) {
node.exportKind = "type";
}
if (declaration && isDeclare) {
this.resetStartLocation(declaration, startPos, startLoc);
declaration.declare = true;
}
return declaration;
}
parseClassId(node, isStatement, optionalId) {
if ((!isStatement || optionalId) && this.isContextual("implements")) {
return;
}
super.parseClassId(node, isStatement, optionalId, node.declare ? BIND_TS_AMBIENT : BIND_CLASS);
const typeParameters = this.tsTryParseTypeParameters();
if (typeParameters) node.typeParameters = typeParameters;
}
parseClassPropertyAnnotation(node) {
if (!node.optional && this.eat(types.bang)) {
node.definite = true;
}
const type = this.tsTryParseTypeAnnotation();
if (type) node.typeAnnotation = type;
}
parseClassProperty(node) {
this.parseClassPropertyAnnotation(node);
if (node.declare && this.match(types.equal)) {
this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer);
}
return super.parseClassProperty(node);
}
parseClassPrivateProperty(node) {
if (node.abstract) {
this.raise(node.start, TSErrors.PrivateElementHasAbstract);
}
if (node.accessibility) {
this.raise(node.start, TSErrors.PrivateElementHasAccessibility, node.accessibility);
}
this.parseClassPropertyAnnotation(node);
return super.parseClassPrivateProperty(node);
}
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
const typeParameters = this.tsTryParseTypeParameters();
if (typeParameters) method.typeParameters = typeParameters;
super.pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper);
}
pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
const typeParameters = this.tsTryParseTypeParameters();
if (typeParameters) method.typeParameters = typeParameters;
super.pushClassPrivateMethod(classBody, method, isGenerator, isAsync);
}
parseClassSuper(node) {
super.parseClassSuper(node);
if (node.superClass && this.isRelational("<")) {
node.superTypeParameters = this.tsParseTypeArguments();
}
if (this.eatContextual("implements")) {
node.implements = this.tsParseHeritageClause("implements");
}
}
parseObjPropValue(prop, ...args) {
const typeParameters = this.tsTryParseTypeParameters();
if (typeParameters) prop.typeParameters = typeParameters;
super.parseObjPropValue(prop, ...args);
}
parseFunctionParams(node, allowModifiers) {
const typeParameters = this.tsTryParseTypeParameters();
if (typeParameters) node.typeParameters = typeParameters;
super.parseFunctionParams(node, allowModifiers);
}
parseVarId(decl, kind) {
super.parseVarId(decl, kind);
if (decl.id.type === "Identifier" && this.eat(types.bang)) {
decl.definite = true;
}
const type = this.tsTryParseTypeAnnotation();
if (type) {
decl.id.typeAnnotation = type;
this.resetEndLocation(decl.id);
}
}
parseAsyncArrowFromCallExpression(node, call) {
if (this.match(types.colon)) {
node.returnType = this.tsParseTypeAnnotation();
}
return super.parseAsyncArrowFromCallExpression(node, call);
}
parseMaybeAssign(...args) {
var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2, _jsx4, _typeCast3;
let state;
let jsx;
let typeCast;
if (this.match(types.jsxTagStart)) {
state = this.state.clone();
jsx = this.tryParse(() => super.parseMaybeAssign(...args), state);
if (!jsx.error) return jsx.node;
const {
context
} = this.state;
if (context[context.length - 1] === types$1.j_oTag) {
context.length -= 2;
} else if (context[context.length - 1] === types$1.j_expr) {
context.length -= 1;
}
}
if (!((_jsx = jsx) == null ? void 0 : _jsx.error) && !this.isRelational("<")) {
return super.parseMaybeAssign(...args);
}
let typeParameters;
state = state || this.state.clone();
const arrow = this.tryParse(abort => {
var _typeParameters;
typeParameters = this.tsParseTypeParameters();
const expr = super.parseMaybeAssign(...args);
if (expr.type !== "ArrowFunctionExpression" || expr.extra && expr.extra.parenthesized) {
abort();
}
if (((_typeParameters = typeParameters) == null ? void 0 : _typeParameters.params.length) !== 0) {
this.resetStartLocationFromNode(expr, typeParameters);
}
expr.typeParameters = typeParameters;
return expr;
}, state);
if (!arrow.error && !arrow.aborted) return arrow.node;
if (!jsx) {
assert(!this.hasPlugin("jsx"));
typeCast = this.tryParse(() => super.parseMaybeAssign(...args), state);
if (!typeCast.error) return typeCast.node;
}
if ((_jsx2 = jsx) == null ? void 0 : _jsx2.node) {
this.state = jsx.failState;
return jsx.node;
}
if (arrow.node) {
this.state = arrow.failState;
return arrow.node;
}
if ((_typeCast = typeCast) == null ? void 0 : _typeCast.node) {
this.state = typeCast.failState;
return typeCast.node;
}
if ((_jsx3 = jsx) == null ? void 0 : _jsx3.thrown) throw jsx.error;
if (arrow.thrown) throw arrow.error;
if ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.thrown) throw typeCast.error;
throw ((_jsx4 = jsx) == null ? void 0 : _jsx4.error) || arrow.error || ((_typeCast3 = typeCast) == null ? void 0 : _typeCast3.error);
}
parseMaybeUnary(refExpressionErrors) {
if (!this.hasPlugin("jsx") && this.isRelational("<")) {
return this.tsParseTypeAssertion();
} else {
return super.parseMaybeUnary(refExpressionErrors);
}
}
parseArrow(node) {
if (this.match(types.colon)) {
const result = this.tryParse(abort => {
const returnType = this.tsParseTypeOrTypePredicateAnnotation(types.colon);
if (this.canInsertSemicolon() || !this.match(types.arrow)) abort();
return returnType;
});
if (result.aborted) return;
if (!result.thrown) {
if (result.error) this.state = result.failState;
node.returnType = result.node;
}
}
return super.parseArrow(node);
}
parseAssignableListItemTypes(param) {
if (this.eat(types.question)) {
if (param.type !== "Identifier") {
this.raise(param.start, TSErrors.PatternIsOptional);
}
param.optional = true;
}
const type = this.tsTryParseTypeAnnotation();
if (type) param.typeAnnotation = type;
this.resetEndLocation(param);
return param;
}
toAssignable(node) {
switch (node.type) {
case "TSTypeCastExpression":
return super.toAssignable(this.typeCastToParameter(node));
case "TSParameterProperty":
return super.toAssignable(node);
case "TSAsExpression":
case "TSNonNullExpression":
case "TSTypeAssertion":
node.expression = this.toAssignable(node.expression);
return node;
default:
return super.toAssignable(node);
}
}
checkLVal(expr, bindingType = BIND_NONE, checkClashes, contextDescription) {
switch (expr.type) {
case "TSTypeCastExpression":
return;
case "TSParameterProperty":
this.checkLVal(expr.parameter, bindingType, checkClashes, "parameter property");
return;
case "TSAsExpression":
case "TSNonNullExpression":
case "TSTypeAssertion":
this.checkLVal(expr.expression, bindingType, checkClashes, contextDescription);
return;
default:
super.checkLVal(expr, bindingType, checkClashes, contextDescription);
return;
}
}
parseBindingAtom() {
switch (this.state.type) {
case types._this:
return this.parseIdentifier(true);
default:
return super.parseBindingAtom();
}
}
parseMaybeDecoratorArguments(expr) {
if (this.isRelational("<")) {
const typeArguments = this.tsParseTypeArguments();
if (this.match(types.parenL)) {
const call = super.parseMaybeDecoratorArguments(expr);
call.typeParameters = typeArguments;
return call;
}
this.unexpected(this.state.start, types.parenL);
}
return super.parseMaybeDecoratorArguments(expr);
}
isClassMethod() {
return this.isRelational("<") || super.isClassMethod();
}
isClassProperty() {
return this.match(types.bang) || this.match(types.colon) || super.isClassProperty();
}
parseMaybeDefault(...args) {
const node = super.parseMaybeDefault(...args);
if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
this.raise(node.typeAnnotation.start, TSErrors.TypeAnnotationAfterAssign);
}
return node;
}
getTokenFromCode(code) {
if (this.state.inType && (code === 62 || code === 60)) {
return this.finishOp(types.relational, 1);
} else {
return super.getTokenFromCode(code);
}
}
toAssignableList(exprList) {
for (let i = 0; i < exprList.length; i++) {
const expr = exprList[i];
if (!expr) continue;
switch (expr.type) {
case "TSTypeCastExpression":
exprList[i] = this.typeCastToParameter(expr);
break;
case "TSAsExpression":
case "TSTypeAssertion":
if (!this.state.maybeInArrowParameters) {
exprList[i] = this.typeCastToParameter(expr);
} else {
this.raise(expr.start, TSErrors.UnexpectedTypeCastInParameter);
}
break;
}
}
return super.toAssignableList(...arguments);
}
typeCastToParameter(node) {
node.expression.typeAnnotation = node.typeAnnotation;
this.resetEndLocation(node.expression, node.typeAnnotation.end, node.typeAnnotation.loc.end);
return node.expression;
}
toReferencedList(exprList, isInParens) {
for (let i = 0; i < exprList.length; i++) {
const expr = exprList[i];
if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") {
this.raise(expr.start, TSErrors.UnexpectedTypeAnnotation);
}
}
return exprList;
}
shouldParseArrow() {
return this.match(types.colon) || super.shouldParseArrow();
}
shouldParseAsyncArrow() {
return this.match(types.colon) || super.shouldParseAsyncArrow();
}
canHaveLeadingDecorator() {
return super.canHaveLeadingDecorator() || this.isAbstractClass();
}
jsxParseOpeningElementAfterName(node) {
if (this.isRelational("<")) {
const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArguments());
if (typeArguments) node.typeParameters = typeArguments;
}
return super.jsxParseOpeningElementAfterName(node);
}
getGetterSetterExpectedParamCount(method) {
const baseCount = super.getGetterSetterExpectedParamCount(method);
const firstParam = method.params[0];
const hasContextParam = firstParam && firstParam.type === "Identifier" && firstParam.name === "this";
return hasContextParam ? baseCount + 1 : baseCount;
}
});
types.placeholder = new TokenType("%%", {
startsExpr: true
});
var placeholders = (superClass => class extends superClass {
parsePlaceholder(expectedNode) {
if (this.match(types.placeholder)) {
const node = this.startNode();
this.next();
this.assertNoSpace("Unexpected space in placeholder.");
node.name = super.parseIdentifier(true);
this.assertNoSpace("Unexpected space in placeholder.");
this.expect(types.placeholder);
return this.finishPlaceholder(node, expectedNode);
}
}
finishPlaceholder(node, expectedNode) {
const isFinished = !!(node.expectedNode && node.type === "Placeholder");
node.expectedNode = expectedNode;
return isFinished ? node : this.finishNode(node, "Placeholder");
}
getTokenFromCode(code) {
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
return this.finishOp(types.placeholder, 2);
}
return super.getTokenFromCode(...arguments);
}
parseExprAtom() {
return this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments);
}
parseIdentifier() {
return this.parsePlaceholder("Identifier") || super.parseIdentifier(...arguments);
}
checkReservedWord(word) {
if (word !== undefined) super.checkReservedWord(...arguments);
}
parseBindingAtom() {
return this.parsePlaceholder("Pattern") || super.parseBindingAtom(...arguments);
}
checkLVal(expr) {
if (expr.type !== "Placeholder") super.checkLVal(...arguments);
}
toAssignable(node) {
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
node.expectedNode = "Pattern";
return node;
}
return super.toAssignable(...arguments);
}
verifyBreakContinue(node) {
if (node.label && node.label.type === "Placeholder") return;
super.verifyBreakContinue(...arguments);
}
parseExpressionStatement(node, expr) {
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
return super.parseExpressionStatement(...arguments);
}
if (this.match(types.colon)) {
const stmt = node;
stmt.label = this.finishPlaceholder(expr, "Identifier");
this.next();
stmt.body = this.parseStatement("label");
return this.finishNode(stmt, "LabeledStatement");
}
this.semicolon();
node.name = expr.name;
return this.finishPlaceholder(node, "Statement");
}
parseBlock() {
return this.parsePlaceholder("BlockStatement") || super.parseBlock(...arguments);
}
parseFunctionId() {
return this.parsePlaceholder("Identifier") || super.parseFunctionId(...arguments);
}
parseClass(node, isStatement, optionalId) {
const type = isStatement ? "ClassDeclaration" : "ClassExpression";
this.next();
this.takeDecorators(node);
const placeholder = this.parsePlaceholder("Identifier");
if (placeholder) {
if (this.match(types._extends) || this.match(types.placeholder) || this.match(types.braceL)) {
node.id = placeholder;
} else if (optionalId || !isStatement) {
node.id = null;
node.body = this.finishPlaceholder(placeholder, "ClassBody");
return this.finishNode(node, type);
} else {
this.unexpected(null, "A class name is required");
}
} else {
this.parseClassId(node, isStatement, optionalId);
}
this.parseClassSuper(node);
node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass);
return this.finishNode(node, type);
}
parseExport(node) {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseExport(...arguments);
if (!this.isContextual("from") && !this.match(types.comma)) {
node.specifiers = [];
node.source = null;
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
return this.finishNode(node, "ExportNamedDeclaration");
}
this.expectPlugin("exportDefaultFrom");
const specifier = this.startNode();
specifier.exported = placeholder;
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
return super.parseExport(node);
}
isExportDefaultSpecifier() {
if (this.match(types._default)) {
const next = this.nextTokenStart();
if (this.isUnparsedContextual(next, "from")) {
if (this.input.startsWith(types.placeholder.label, this.nextTokenStartSince(next + 4))) {
return true;
}
}
}
return super.isExportDefaultSpecifier();
}
maybeParseExportDefaultSpecifier(node) {
if (node.specifiers && node.specifiers.length > 0) {
return true;
}
return super.maybeParseExportDefaultSpecifier(...arguments);
}
checkExport(node) {
const {
specifiers
} = node;
if (specifiers == null ? void 0 : specifiers.length) {
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
}
super.checkExport(node);
node.specifiers = specifiers;
}
parseImport(node) {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseImport(...arguments);
node.specifiers = [];
if (!this.isContextual("from") && !this.match(types.comma)) {
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
const specifier = this.startNodeAtNode(placeholder);
specifier.local = placeholder;
this.finishNode(specifier, "ImportDefaultSpecifier");
node.specifiers.push(specifier);
if (this.eat(types.comma)) {
const hasStarImport = this.maybeParseStarImportSpecifier(node);
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
}
this.expectContextual("from");
node.source = this.parseImportSource();
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
parseImportSource() {
return this.parsePlaceholder("StringLiteral") || super.parseImportSource(...arguments);
}
});
var v8intrinsic = (superClass => class extends superClass {
parseV8Intrinsic() {
if (this.match(types.modulo)) {
const v8IntrinsicStart = this.state.start;
const node = this.startNode();
this.eat(types.modulo);
if (this.match(types.name)) {
const name = this.parseIdentifierName(this.state.start);
const identifier = this.createIdentifier(node, name);
identifier.type = "V8IntrinsicIdentifier";
if (this.match(types.parenL)) {
return identifier;
}
}
this.unexpected(v8IntrinsicStart);
}
}
parseExprAtom() {
return this.parseV8Intrinsic() || super.parseExprAtom(...arguments);
}
});
function hasPlugin(plugins, name) {
return plugins.some(plugin => {
if (Array.isArray(plugin)) {
return plugin[0] === name;
} else {
return plugin === name;
}
});
}
function getPluginOption(plugins, name, option) {
const plugin = plugins.find(plugin => {
if (Array.isArray(plugin)) {
return plugin[0] === name;
} else {
return plugin === name;
}
});
if (plugin && Array.isArray(plugin)) {
return plugin[1][option];
}
return null;
}
const PIPELINE_PROPOSALS = ["minimal", "smart", "fsharp"];
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
function validatePlugins(plugins) {
if (hasPlugin(plugins, "decorators")) {
if (hasPlugin(plugins, "decorators-legacy")) {
throw new Error("Cannot use the decorators and decorators-legacy plugin together");
}
const decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");
if (decoratorsBeforeExport == null) {
throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you are migrating from" + " Babylon/Babel 6 or want to use the old decorators proposal, you" + " should use the 'decorators-legacy' plugin instead of 'decorators'.");
} else if (typeof decoratorsBeforeExport !== "boolean") {
throw new Error("'decoratorsBeforeExport' must be a boolean.");
}
}
if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
throw new Error("Cannot combine flow and typescript plugins.");
}
if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) {
throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
}
if (hasPlugin(plugins, "pipelineOperator") && !PIPELINE_PROPOSALS.includes(getPluginOption(plugins, "pipelineOperator", "proposal"))) {
throw new Error("'pipelineOperator' requires 'proposal' option whose value should be one of: " + PIPELINE_PROPOSALS.map(p => `'${p}'`).join(", "));
}
if (hasPlugin(plugins, "moduleAttributes")) {
const moduleAttributesVerionPluginOption = getPluginOption(plugins, "moduleAttributes", "version");
if (moduleAttributesVerionPluginOption !== "may-2020") {
throw new Error("The 'moduleAttributes' plugin requires a 'version' option," + " representing the last proposal update. Currently, the" + " only supported value is 'may-2020'.");
}
}
if (hasPlugin(plugins, "recordAndTuple") && !RECORD_AND_TUPLE_SYNTAX_TYPES.includes(getPluginOption(plugins, "recordAndTuple", "syntaxType"))) {
throw new Error("'recordAndTuple' requires 'syntaxType' option whose value should be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
}
}
const mixinPlugins = {
estree,
jsx,
flow,
typescript,
v8intrinsic,
placeholders
};
const mixinPluginNames = Object.keys(mixinPlugins);
const defaultOptions = {
sourceType: "script",
sourceFilename: undefined,
startLine: 1,
allowAwaitOutsideFunction: false,
allowReturnOutsideFunction: false,
allowImportExportEverywhere: false,
allowSuperOutsideMethod: false,
allowUndeclaredExports: false,
plugins: [],
strictMode: null,
ranges: false,
tokens: false,
createParenthesizedExpressions: false,
errorRecovery: false
};
function getOptions(opts) {
const options = {};
for (let _i = 0, _Object$keys = Object.keys(defaultOptions); _i < _Object$keys.length; _i++) {
const key = _Object$keys[_i];
options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key];
}
return options;
}
class State {
constructor() {
this.errors = [];
this.potentialArrowAt = -1;
this.noArrowAt = [];
this.noArrowParamsConversionAt = [];
this.inParameters = false;
this.maybeInArrowParameters = false;
this.maybeInAsyncArrowHead = false;
this.inPipeline = false;
this.inType = false;
this.noAnonFunctionType = false;
this.inPropertyName = false;
this.hasFlowComment = false;
this.isIterator = false;
this.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null
};
this.soloAwait = false;
this.inFSharpPipelineDirectBody = false;
this.labels = [];
this.decoratorStack = [[]];
this.yieldPos = -1;
this.awaitPos = -1;
this.comments = [];
this.trailingComments = [];
this.leadingComments = [];
this.commentStack = [];
this.commentPreviousNode = null;
this.pos = 0;
this.lineStart = 0;
this.type = types.eof;
this.value = null;
this.start = 0;
this.end = 0;
this.lastTokEndLoc = null;
this.lastTokStartLoc = null;
this.lastTokStart = 0;
this.lastTokEnd = 0;
this.context = [types$1.braceStatement];
this.exprAllowed = true;
this.containsEsc = false;
this.octalPositions = [];
this.exportedIdentifiers = [];
this.tokensLength = 0;
}
init(options) {
this.strict = options.strictMode === false ? false : options.sourceType === "module";
this.curLine = options.startLine;
this.startLoc = this.endLoc = this.curPosition();
}
curPosition() {
return new Position(this.curLine, this.pos - this.lineStart);
}
clone(skipArrays) {
const state = new State();
const keys = Object.keys(this);
for (let i = 0, length = keys.length; i < length; i++) {
const key = keys[i];
let val = this[key];
if (!skipArrays && Array.isArray(val)) {
val = val.slice();
}
state[key] = val;
}
return state;
}
}
var _isDigit = function isDigit(code) {
return code >= 48 && code <= 57;
};
const VALID_REGEX_FLAGS = new Set(["g", "m", "s", "i", "y", "u"]);
const forbiddenNumericSeparatorSiblings = {
decBinOct: [46, 66, 69, 79, 95, 98, 101, 111],
hex: [46, 88, 95, 120]
};
const allowedNumericSeparatorSiblings = {};
allowedNumericSeparatorSiblings.bin = [48, 49];
allowedNumericSeparatorSiblings.oct = [...allowedNumericSeparatorSiblings.bin, 50, 51, 52, 53, 54, 55];
allowedNumericSeparatorSiblings.dec = [...allowedNumericSeparatorSiblings.oct, 56, 57];
allowedNumericSeparatorSiblings.hex = [...allowedNumericSeparatorSiblings.dec, 65, 66, 67, 68, 69, 70, 97, 98, 99, 100, 101, 102];
class Token {
constructor(state) {
this.type = state.type;
this.value = state.value;
this.start = state.start;
this.end = state.end;
this.loc = new SourceLocation(state.startLoc, state.endLoc);
}
}
class Tokenizer extends ParserError {
constructor(options, input) {
super();
this.tokens = [];
this.state = new State();
this.state.init(options);
this.input = input;
this.length = input.length;
this.isLookahead = false;
}
pushToken(token) {
this.tokens.length = this.state.tokensLength;
this.tokens.push(token);
++this.state.tokensLength;
}
next() {
if (!this.isLookahead) {
this.checkKeywordEscapes();
if (this.options.tokens) {
this.pushToken(new Token(this.state));
}
}
this.state.lastTokEnd = this.state.end;
this.state.lastTokStart = this.state.start;
this.state.lastTokEndLoc = this.state.endLoc;
this.state.lastTokStartLoc = this.state.startLoc;
this.nextToken();
}
eat(type) {
if (this.match(type)) {
this.next();
return true;
} else {
return false;
}
}
match(type) {
return this.state.type === type;
}
lookahead() {
const old = this.state;
this.state = old.clone(true);
this.isLookahead = true;
this.next();
this.isLookahead = false;
const curr = this.state;
this.state = old;
return curr;
}
nextTokenStart() {
return this.nextTokenStartSince(this.state.pos);
}
nextTokenStartSince(pos) {
skipWhiteSpace.lastIndex = pos;
const skip = skipWhiteSpace.exec(this.input);
return pos + skip[0].length;
}
lookaheadCharCode() {
return this.input.charCodeAt(this.nextTokenStart());
}
setStrict(strict) {
this.state.strict = strict;
if (!this.match(types.num) && !this.match(types.string)) return;
this.state.pos = this.state.start;
while (this.state.pos < this.state.lineStart) {
this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1;
--this.state.curLine;
}
this.nextToken();
}
curContext() {
return this.state.context[this.state.context.length - 1];
}
nextToken() {
const curContext = this.curContext();
if (!(curContext == null ? void 0 : curContext.preserveSpace)) this.skipSpace();
this.state.octalPositions = [];
this.state.start = this.state.pos;
this.state.startLoc = this.state.curPosition();
if (this.state.pos >= this.length) {
this.finishToken(types.eof);
return;
}
const override = curContext == null ? void 0 : curContext.override;
if (override) {
override(this);
} else {
this.getTokenFromCode(this.input.codePointAt(this.state.pos));
}
}
pushComment(block, text, start, end, startLoc, endLoc) {
const comment = {
type: block ? "CommentBlock" : "CommentLine",
value: text,
start: start,
end: end,
loc: new SourceLocation(startLoc, endLoc)
};
if (this.options.tokens) this.pushToken(comment);
this.state.comments.push(comment);
this.addComment(comment);
}
skipBlockComment() {
const startLoc = this.state.curPosition();
const start = this.state.pos;
const end = this.input.indexOf("*/", this.state.pos + 2);
if (end === -1) throw this.raise(start, ErrorMessages.UnterminatedComment);
this.state.pos = end + 2;
lineBreakG.lastIndex = start;
let match;
while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) {
++this.state.curLine;
this.state.lineStart = match.index + match[0].length;
}
if (this.isLookahead) return;
this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition());
}
skipLineComment(startSkip) {
const start = this.state.pos;
const startLoc = this.state.curPosition();
let ch = this.input.charCodeAt(this.state.pos += startSkip);
if (this.state.pos < this.length) {
while (!isNewLine(ch) && ++this.state.pos < this.length) {
ch = this.input.charCodeAt(this.state.pos);
}
}
if (this.isLookahead) return;
this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition());
}
skipSpace() {
loop: while (this.state.pos < this.length) {
const ch = this.input.charCodeAt(this.state.pos);
switch (ch) {
case 32:
case 160:
case 9:
++this.state.pos;
break;
case 13:
if (this.input.charCodeAt(this.state.pos + 1) === 10) {
++this.state.pos;
}
case 10:
case 8232:
case 8233:
++this.state.pos;
++this.state.curLine;
this.state.lineStart = this.state.pos;
break;
case 47:
switch (this.input.charCodeAt(this.state.pos + 1)) {
case 42:
this.skipBlockComment();
break;
case 47:
this.skipLineComment(2);
break;
default:
break loop;
}
break;
default:
if (isWhitespace(ch)) {
++this.state.pos;
} else {
break loop;
}
}
}
}
finishToken(type, val) {
this.state.end = this.state.pos;
this.state.endLoc = this.state.curPosition();
const prevType = this.state.type;
this.state.type = type;
this.state.value = val;
if (!this.isLookahead) this.updateContext(prevType);
}
readToken_numberSign() {
if (this.state.pos === 0 && this.readToken_interpreter()) {
return;
}
const nextPos = this.state.pos + 1;
const next = this.input.charCodeAt(nextPos);
if (next >= 48 && next <= 57) {
throw this.raise(this.state.pos, ErrorMessages.UnexpectedDigitAfterHash);
}
if (next === 123 || next === 91 && this.hasPlugin("recordAndTuple")) {
this.expectPlugin("recordAndTuple");
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "hash") {
throw this.raise(this.state.pos, next === 123 ? ErrorMessages.RecordExpressionHashIncorrectStartSyntaxType : ErrorMessages.TupleExpressionHashIncorrectStartSyntaxType);
}
if (next === 123) {
this.finishToken(types.braceHashL);
} else {
this.finishToken(types.bracketHashL);
}
this.state.pos += 2;
} else {
this.finishOp(types.hash, 1);
}
}
readToken_dot() {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next >= 48 && next <= 57) {
this.readNumber(true);
return;
}
if (next === 46 && this.input.charCodeAt(this.state.pos + 2) === 46) {
this.state.pos += 3;
this.finishToken(types.ellipsis);
} else {
++this.state.pos;
this.finishToken(types.dot);
}
}
readToken_slash() {
if (this.state.exprAllowed && !this.state.inType) {
++this.state.pos;
this.readRegexp();
return;
}
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
this.finishOp(types.assign, 2);
} else {
this.finishOp(types.slash, 1);
}
}
readToken_interpreter() {
if (this.state.pos !== 0 || this.length < 2) return false;
let ch = this.input.charCodeAt(this.state.pos + 1);
if (ch !== 33) return false;
const start = this.state.pos;
this.state.pos += 1;
while (!isNewLine(ch) && ++this.state.pos < this.length) {
ch = this.input.charCodeAt(this.state.pos);
}
const value = this.input.slice(start + 2, this.state.pos);
this.finishToken(types.interpreterDirective, value);
return true;
}
readToken_mult_modulo(code) {
let type = code === 42 ? types.star : types.modulo;
let width = 1;
let next = this.input.charCodeAt(this.state.pos + 1);
const exprAllowed = this.state.exprAllowed;
if (code === 42 && next === 42) {
width++;
next = this.input.charCodeAt(this.state.pos + 2);
type = types.exponent;
}
if (next === 61 && !exprAllowed) {
width++;
type = types.assign;
}
this.finishOp(type, width);
}
readToken_pipe_amp(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === code) {
if (this.input.charCodeAt(this.state.pos + 2) === 61) {
this.finishOp(types.assign, 3);
} else {
this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2);
}
return;
}
if (code === 124) {
if (next === 62) {
this.finishOp(types.pipeline, 2);
return;
}
if (this.hasPlugin("recordAndTuple") && next === 125) {
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(this.state.pos, ErrorMessages.RecordExpressionBarIncorrectEndSyntaxType);
}
this.finishOp(types.braceBarR, 2);
return;
}
if (this.hasPlugin("recordAndTuple") && next === 93) {
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(this.state.pos, ErrorMessages.TupleExpressionBarIncorrectEndSyntaxType);
}
this.finishOp(types.bracketBarR, 2);
return;
}
}
if (next === 61) {
this.finishOp(types.assign, 2);
return;
}
this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1);
}
readToken_caret() {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
this.finishOp(types.assign, 2);
} else {
this.finishOp(types.bitwiseXOR, 1);
}
}
readToken_plus_min(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === code) {
if (next === 45 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 62 && (this.state.lastTokEnd === 0 || lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos)))) {
this.skipLineComment(3);
this.skipSpace();
this.nextToken();
return;
}
this.finishOp(types.incDec, 2);
return;
}
if (next === 61) {
this.finishOp(types.assign, 2);
} else {
this.finishOp(types.plusMin, 1);
}
}
readToken_lt_gt(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
let size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.state.pos + size) === 61) {
this.finishOp(types.assign, size + 1);
return;
}
this.finishOp(types.bitShift, size);
return;
}
if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) {
this.skipLineComment(4);
this.skipSpace();
this.nextToken();
return;
}
if (next === 61) {
size = 2;
}
this.finishOp(types.relational, size);
}
readToken_eq_excl(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
this.finishOp(types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
return;
}
if (code === 61 && next === 62) {
this.state.pos += 2;
this.finishToken(types.arrow);
return;
}
this.finishOp(code === 61 ? types.eq : types.bang, 1);
}
readToken_question() {
const next = this.input.charCodeAt(this.state.pos + 1);
const next2 = this.input.charCodeAt(this.state.pos + 2);
if (next === 63 && !this.state.inType) {
if (next2 === 61) {
this.finishOp(types.assign, 3);
} else {
this.finishOp(types.nullishCoalescing, 2);
}
} else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
this.state.pos += 2;
this.finishToken(types.questionDot);
} else {
++this.state.pos;
this.finishToken(types.question);
}
}
getTokenFromCode(code) {
switch (code) {
case 46:
this.readToken_dot();
return;
case 40:
++this.state.pos;
this.finishToken(types.parenL);
return;
case 41:
++this.state.pos;
this.finishToken(types.parenR);
return;
case 59:
++this.state.pos;
this.finishToken(types.semi);
return;
case 44:
++this.state.pos;
this.finishToken(types.comma);
return;
case 91:
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(this.state.pos, ErrorMessages.TupleExpressionBarIncorrectStartSyntaxType);
}
this.finishToken(types.bracketBarL);
this.state.pos += 2;
} else {
++this.state.pos;
this.finishToken(types.bracketL);
}
return;
case 93:
++this.state.pos;
this.finishToken(types.bracketR);
return;
case 123:
if (this.hasPlugin("recordAndTuple") && this.input.charCodeAt(this.state.pos + 1) === 124) {
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(this.state.pos, ErrorMessages.RecordExpressionBarIncorrectStartSyntaxType);
}
this.finishToken(types.braceBarL);
this.state.pos += 2;
} else {
++this.state.pos;
this.finishToken(types.braceL);
}
return;
case 125:
++this.state.pos;
this.finishToken(types.braceR);
return;
case 58:
if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
this.finishOp(types.doubleColon, 2);
} else {
++this.state.pos;
this.finishToken(types.colon);
}
return;
case 63:
this.readToken_question();
return;
case 96:
++this.state.pos;
this.finishToken(types.backQuote);
return;
case 48:
{
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 120 || next === 88) {
this.readRadixNumber(16);
return;
}
if (next === 111 || next === 79) {
this.readRadixNumber(8);
return;
}
if (next === 98 || next === 66) {
this.readRadixNumber(2);
return;
}
}
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
this.readNumber(false);
return;
case 34:
case 39:
this.readString(code);
return;
case 47:
this.readToken_slash();
return;
case 37:
case 42:
this.readToken_mult_modulo(code);
return;
case 124:
case 38:
this.readToken_pipe_amp(code);
return;
case 94:
this.readToken_caret();
return;
case 43:
case 45:
this.readToken_plus_min(code);
return;
case 60:
case 62:
this.readToken_lt_gt(code);
return;
case 61:
case 33:
this.readToken_eq_excl(code);
return;
case 126:
this.finishOp(types.tilde, 1);
return;
case 64:
++this.state.pos;
this.finishToken(types.at);
return;
case 35:
this.readToken_numberSign();
return;
case 92:
this.readWord();
return;
default:
if (isIdentifierStart(code)) {
this.readWord();
return;
}
}
throw this.raise(this.state.pos, ErrorMessages.InvalidOrUnexpectedToken, String.fromCodePoint(code));
}
finishOp(type, size) {
const str = this.input.slice(this.state.pos, this.state.pos + size);
this.state.pos += size;
this.finishToken(type, str);
}
readRegexp() {
const start = this.state.pos;
let escaped, inClass;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(start, ErrorMessages.UnterminatedRegExp);
}
const ch = this.input.charAt(this.state.pos);
if (lineBreak.test(ch)) {
throw this.raise(start, ErrorMessages.UnterminatedRegExp);
}
if (escaped) {
escaped = false;
} else {
if (ch === "[") {
inClass = true;
} else if (ch === "]" && inClass) {
inClass = false;
} else if (ch === "/" && !inClass) {
break;
}
escaped = ch === "\\";
}
++this.state.pos;
}
const content = this.input.slice(start, this.state.pos);
++this.state.pos;
let mods = "";
while (this.state.pos < this.length) {
const char = this.input[this.state.pos];
const charCode = this.input.codePointAt(this.state.pos);
if (VALID_REGEX_FLAGS.has(char)) {
if (mods.indexOf(char) > -1) {
this.raise(this.state.pos + 1, ErrorMessages.DuplicateRegExpFlags);
}
} else if (isIdentifierChar(charCode) || charCode === 92) {
this.raise(this.state.pos + 1, ErrorMessages.MalformedRegExpFlags);
} else {
break;
}
++this.state.pos;
mods += char;
}
this.finishToken(types.regexp, {
pattern: content,
flags: mods
});
}
readInt(radix, len, forceLen, allowNumSeparator = true) {
const start = this.state.pos;
const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
const allowedSiblings = radix === 16 ? allowedNumericSeparatorSiblings.hex : radix === 10 ? allowedNumericSeparatorSiblings.dec : radix === 8 ? allowedNumericSeparatorSiblings.oct : allowedNumericSeparatorSiblings.bin;
let invalid = false;
let total = 0;
for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
const code = this.input.charCodeAt(this.state.pos);
let val;
if (this.hasPlugin("numericSeparator")) {
if (code === 95) {
const prev = this.input.charCodeAt(this.state.pos - 1);
const next = this.input.charCodeAt(this.state.pos + 1);
if (allowedSiblings.indexOf(next) === -1) {
this.raise(this.state.pos, ErrorMessages.UnexpectedNumericSeparator);
} else if (forbiddenSiblings.indexOf(prev) > -1 || forbiddenSiblings.indexOf(next) > -1 || Number.isNaN(next)) {
this.raise(this.state.pos, ErrorMessages.UnexpectedNumericSeparator);
}
if (!allowNumSeparator) {
this.raise(this.state.pos, ErrorMessages.NumericSeparatorInEscapeSequence);
}
++this.state.pos;
continue;
}
}
if (code >= 97) {
val = code - 97 + 10;
} else if (code >= 65) {
val = code - 65 + 10;
} else if (_isDigit(code)) {
val = code - 48;
} else {
val = Infinity;
}
if (val >= radix) {
if (this.options.errorRecovery && val <= 9) {
val = 0;
this.raise(this.state.start + i + 2, ErrorMessages.InvalidDigit, radix);
} else if (forceLen) {
val = 0;
invalid = true;
} else {
break;
}
}
++this.state.pos;
total = total * radix + val;
}
if (this.state.pos === start || len != null && this.state.pos - start !== len || invalid) {
return null;
}
return total;
}
readRadixNumber(radix) {
const start = this.state.pos;
let isBigInt = false;
this.state.pos += 2;
const val = this.readInt(radix);
if (val == null) {
this.raise(this.state.start + 2, ErrorMessages.InvalidDigit, radix);
}
const next = this.input.charCodeAt(this.state.pos);
if (next === 95) {
this.expectPlugin("numericSeparator", this.state.pos);
}
if (next === 110) {
++this.state.pos;
isBigInt = true;
}
if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
throw this.raise(this.state.pos, ErrorMessages.NumberIdentifier);
}
if (isBigInt) {
const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
this.finishToken(types.bigint, str);
return;
}
this.finishToken(types.num, val);
}
readNumber(startsWithDot) {
const start = this.state.pos;
let isFloat = false;
let isBigInt = false;
let isNonOctalDecimalInt = false;
if (!startsWithDot && this.readInt(10) === null) {
this.raise(start, ErrorMessages.InvalidNumber);
}
let octal = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (octal) {
if (this.state.strict) {
this.raise(start, ErrorMessages.StrictOctalLiteral);
}
if (/[89]/.test(this.input.slice(start, this.state.pos))) {
octal = false;
isNonOctalDecimalInt = true;
}
}
let next = this.input.charCodeAt(this.state.pos);
if (next === 46 && !octal) {
++this.state.pos;
this.readInt(10);
isFloat = true;
next = this.input.charCodeAt(this.state.pos);
}
if ((next === 69 || next === 101) && !octal) {
next = this.input.charCodeAt(++this.state.pos);
if (next === 43 || next === 45) {
++this.state.pos;
}
if (this.readInt(10) === null) this.raise(start, ErrorMessages.InvalidNumber);
isFloat = true;
next = this.input.charCodeAt(this.state.pos);
}
if (this.hasPlugin("numericSeparator") && (octal || isNonOctalDecimalInt)) {
const underscorePos = this.input.slice(start, this.state.pos).indexOf("_");
if (underscorePos > 0) {
this.raise(underscorePos + start, ErrorMessages.ZeroDigitNumericSeparator);
}
}
if (next === 95) {
this.expectPlugin("numericSeparator", this.state.pos);
}
if (next === 110) {
if (isFloat || octal || isNonOctalDecimalInt) {
this.raise(start, ErrorMessages.InvalidBigIntLiteral);
}
++this.state.pos;
isBigInt = true;
}
if (isIdentifierStart(this.input.codePointAt(this.state.pos))) {
throw this.raise(this.state.pos, ErrorMessages.NumberIdentifier);
}
const str = this.input.slice(start, this.state.pos).replace(/[_n]/g, "");
if (isBigInt) {
this.finishToken(types.bigint, str);
return;
}
const val = octal ? parseInt(str, 8) : parseFloat(str);
this.finishToken(types.num, val);
}
readCodePoint(throwOnInvalid) {
const ch = this.input.charCodeAt(this.state.pos);
let code;
if (ch === 123) {
const codePos = ++this.state.pos;
code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, true, throwOnInvalid);
++this.state.pos;
if (code !== null && code > 0x10ffff) {
if (throwOnInvalid) {
this.raise(codePos, ErrorMessages.InvalidCodePoint);
} else {
return null;
}
}
} else {
code = this.readHexChar(4, false, throwOnInvalid);
}
return code;
}
readString(quote) {
let out = "",
chunkStart = ++this.state.pos;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(this.state.start, ErrorMessages.UnterminatedString);
}
const ch = this.input.charCodeAt(this.state.pos);
if (ch === quote) break;
if (ch === 92) {
out += this.input.slice(chunkStart, this.state.pos);
out += this.readEscapedChar(false);
chunkStart = this.state.pos;
} else if (ch === 8232 || ch === 8233) {
++this.state.pos;
++this.state.curLine;
this.state.lineStart = this.state.pos;
} else if (isNewLine(ch)) {
throw this.raise(this.state.start, ErrorMessages.UnterminatedString);
} else {
++this.state.pos;
}
}
out += this.input.slice(chunkStart, this.state.pos++);
this.finishToken(types.string, out);
}
readTmplToken() {
let out = "",
chunkStart = this.state.pos,
containsInvalid = false;
for (;;) {
if (this.state.pos >= this.length) {
throw this.raise(this.state.start, ErrorMessages.UnterminatedTemplate);
}
const ch = this.input.charCodeAt(this.state.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
if (this.state.pos === this.state.start && this.match(types.template)) {
if (ch === 36) {
this.state.pos += 2;
this.finishToken(types.dollarBraceL);
return;
} else {
++this.state.pos;
this.finishToken(types.backQuote);
return;
}
}
out += this.input.slice(chunkStart, this.state.pos);
this.finishToken(types.template, containsInvalid ? null : out);
return;
}
if (ch === 92) {
out += this.input.slice(chunkStart, this.state.pos);
const escaped = this.readEscapedChar(true);
if (escaped === null) {
containsInvalid = true;
} else {
out += escaped;
}
chunkStart = this.state.pos;
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.state.pos);
++this.state.pos;
switch (ch) {
case 13:
if (this.input.charCodeAt(this.state.pos) === 10) {
++this.state.pos;
}
case 10:
out += "\n";
break;
default:
out += String.fromCharCode(ch);
break;
}
++this.state.curLine;
this.state.lineStart = this.state.pos;
chunkStart = this.state.pos;
} else {
++this.state.pos;
}
}
}
readEscapedChar(inTemplate) {
const throwOnInvalid = !inTemplate;
const ch = this.input.charCodeAt(++this.state.pos);
++this.state.pos;
switch (ch) {
case 110:
return "\n";
case 114:
return "\r";
case 120:
{
const code = this.readHexChar(2, false, throwOnInvalid);
return code === null ? null : String.fromCharCode(code);
}
case 117:
{
const code = this.readCodePoint(throwOnInvalid);
return code === null ? null : String.fromCodePoint(code);
}
case 116:
return "\t";
case 98:
return "\b";
case 118:
return "\u000b";
case 102:
return "\f";
case 13:
if (this.input.charCodeAt(this.state.pos) === 10) {
++this.state.pos;
}
case 10:
this.state.lineStart = this.state.pos;
++this.state.curLine;
case 8232:
case 8233:
return "";
case 56:
case 57:
if (inTemplate) {
return null;
}
default:
if (ch >= 48 && ch <= 55) {
const codePos = this.state.pos - 1;
const match = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/);
let octalStr = match[0];
let octal = parseInt(octalStr, 8);
if (octal > 255) {
octalStr = octalStr.slice(0, -1);
octal = parseInt(octalStr, 8);
}
this.state.pos += octalStr.length - 1;
const next = this.input.charCodeAt(this.state.pos);
if (octalStr !== "0" || next === 56 || next === 57) {
if (inTemplate) {
return null;
} else if (this.state.strict) {
this.raise(codePos, ErrorMessages.StrictOctalLiteral);
} else {
this.state.octalPositions.push(codePos);
}
}
return String.fromCharCode(octal);
}
return String.fromCharCode(ch);
}
}
readHexChar(len, forceLen, throwOnInvalid) {
const codePos = this.state.pos;
const n = this.readInt(16, len, forceLen, false);
if (n === null) {
if (throwOnInvalid) {
this.raise(codePos, ErrorMessages.InvalidEscapeSequence);
} else {
this.state.pos = codePos - 1;
}
}
return n;
}
readWord1() {
let word = "";
this.state.containsEsc = false;
const start = this.state.pos;
let chunkStart = this.state.pos;
while (this.state.pos < this.length) {
const ch = this.input.codePointAt(this.state.pos);
if (isIdentifierChar(ch)) {
this.state.pos += ch <= 0xffff ? 1 : 2;
} else if (this.state.isIterator && ch === 64) {
++this.state.pos;
} else if (ch === 92) {
this.state.containsEsc = true;
word += this.input.slice(chunkStart, this.state.pos);
const escStart = this.state.pos;
const identifierCheck = this.state.pos === start ? isIdentifierStart : isIdentifierChar;
if (this.input.charCodeAt(++this.state.pos) !== 117) {
this.raise(this.state.pos, ErrorMessages.MissingUnicodeEscape);
continue;
}
++this.state.pos;
const esc = this.readCodePoint(true);
if (esc !== null) {
if (!identifierCheck(esc)) {
this.raise(escStart, ErrorMessages.EscapedCharNotAnIdentifier);
}
word += String.fromCodePoint(esc);
}
chunkStart = this.state.pos;
} else {
break;
}
}
return word + this.input.slice(chunkStart, this.state.pos);
}
isIterator(word) {
return word === "@@iterator" || word === "@@asyncIterator";
}
readWord() {
const word = this.readWord1();
const type = keywords.get(word) || types.name;
if (this.state.isIterator && (!this.isIterator(word) || !this.state.inType)) {
this.raise(this.state.pos, ErrorMessages.InvalidIdentifier, word);
}
this.finishToken(type, word);
}
checkKeywordEscapes() {
const kw = this.state.type.keyword;
if (kw && this.state.containsEsc) {
this.raise(this.state.start, ErrorMessages.InvalidEscapedReservedWord, kw);
}
}
braceIsBlock(prevType) {
const parent = this.curContext();
if (parent === types$1.functionExpression || parent === types$1.functionStatement) {
return true;
}
if (prevType === types.colon && (parent === types$1.braceStatement || parent === types$1.braceExpression)) {
return !parent.isExpr;
}
if (prevType === types._return || prevType === types.name && this.state.exprAllowed) {
return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
}
if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow) {
return true;
}
if (prevType === types.braceL) {
return parent === types$1.braceStatement;
}
if (prevType === types._var || prevType === types._const || prevType === types.name) {
return false;
}
if (prevType === types.relational) {
return true;
}
return !this.state.exprAllowed;
}
updateContext(prevType) {
const type = this.state.type;
let update;
if (type.keyword && (prevType === types.dot || prevType === types.questionDot)) {
this.state.exprAllowed = false;
} else if (update = type.updateContext) {
update.call(this, prevType);
} else {
this.state.exprAllowed = type.beforeExpr;
}
}
}
class UtilParser extends Tokenizer {
addExtra(node, key, val) {
if (!node) return;
const extra = node.extra = node.extra || {};
extra[key] = val;
}
isRelational(op) {
return this.match(types.relational) && this.state.value === op;
}
isLookaheadRelational(op) {
const next = this.nextTokenStart();
if (this.input.charAt(next) === op) {
if (next + 1 === this.input.length) {
return true;
}
const afterNext = this.input.charCodeAt(next + 1);
return afterNext !== op.charCodeAt(0) && afterNext !== 61;
}
return false;
}
expectRelational(op) {
if (this.isRelational(op)) {
this.next();
} else {
this.unexpected(null, types.relational);
}
}
isContextual(name) {
return this.match(types.name) && this.state.value === name && !this.state.containsEsc;
}
isUnparsedContextual(nameStart, name) {
const nameEnd = nameStart + name.length;
return this.input.slice(nameStart, nameEnd) === name && (nameEnd === this.input.length || !isIdentifierChar(this.input.charCodeAt(nameEnd)));
}
isLookaheadContextual(name) {
const next = this.nextTokenStart();
return this.isUnparsedContextual(next, name);
}
eatContextual(name) {
return this.isContextual(name) && this.eat(types.name);
}
expectContextual(name, message) {
if (!this.eatContextual(name)) this.unexpected(null, message);
}
canInsertSemicolon() {
return this.match(types.eof) || this.match(types.braceR) || this.hasPrecedingLineBreak();
}
hasPrecedingLineBreak() {
return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
}
isLineTerminator() {
return this.eat(types.semi) || this.canInsertSemicolon();
}
semicolon() {
if (!this.isLineTerminator()) this.unexpected(null, types.semi);
}
expect(type, pos) {
this.eat(type) || this.unexpected(pos, type);
}
assertNoSpace(message = "Unexpected space.") {
if (this.state.start > this.state.lastTokEnd) {
this.raise(this.state.lastTokEnd, message);
}
}
unexpected(pos, messageOrType = "Unexpected token") {
if (typeof messageOrType !== "string") {
messageOrType = `Unexpected token, expected "${messageOrType.label}"`;
}
throw this.raise(pos != null ? pos : this.state.start, messageOrType);
}
expectPlugin(name, pos) {
if (!this.hasPlugin(name)) {
throw this.raiseWithData(pos != null ? pos : this.state.start, {
missingPlugin: [name]
}, `This experimental syntax requires enabling the parser plugin: '${name}'`);
}
return true;
}
expectOnePlugin(names, pos) {
if (!names.some(n => this.hasPlugin(n))) {
throw this.raiseWithData(pos != null ? pos : this.state.start, {
missingPlugin: names
}, `This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(", ")}'`);
}
}
checkYieldAwaitInDefaultParams() {
if (this.state.yieldPos !== -1 && (this.state.awaitPos === -1 || this.state.yieldPos < this.state.awaitPos)) {
this.raise(this.state.yieldPos, ErrorMessages.YieldBindingIdentifier);
}
if (this.state.awaitPos !== -1) {
this.raise(this.state.awaitPos, ErrorMessages.AwaitBindingIdentifier);
}
}
tryParse(fn, oldState = this.state.clone()) {
const abortSignal = {
node: null
};
try {
const node = fn((node = null) => {
abortSignal.node = node;
throw abortSignal;
});
if (this.state.errors.length > oldState.errors.length) {
const failState = this.state;
this.state = oldState;
return {
node,
error: failState.errors[oldState.errors.length],
thrown: false,
aborted: false,
failState
};
}
return {
node,
error: null,
thrown: false,
aborted: false,
failState: null
};
} catch (error) {
const failState = this.state;
this.state = oldState;
if (error instanceof SyntaxError) {
return {
node: null,
error,
thrown: true,
aborted: false,
failState
};
}
if (error === abortSignal) {
return {
node: abortSignal.node,
error: null,
thrown: false,
aborted: true,
failState
};
}
throw error;
}
}
checkExpressionErrors(refExpressionErrors, andThrow) {
if (!refExpressionErrors) return false;
const {
shorthandAssign,
doubleProto
} = refExpressionErrors;
if (!andThrow) return shorthandAssign >= 0 || doubleProto >= 0;
if (shorthandAssign >= 0) {
this.unexpected(shorthandAssign);
}
if (doubleProto >= 0) {
this.raise(doubleProto, ErrorMessages.DuplicateProto);
}
}
isLiteralPropertyName() {
return this.match(types.name) || !!this.state.type.keyword || this.match(types.string) || this.match(types.num) || this.match(types.bigint);
}
}
class ExpressionErrors {
constructor() {
this.shorthandAssign = -1;
this.doubleProto = -1;
}
}
class Node {
constructor(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
this.loc = new SourceLocation(loc);
if (parser == null ? void 0 : parser.options.ranges) this.range = [pos, 0];
if (parser == null ? void 0 : parser.filename) this.loc.filename = parser.filename;
}
__clone() {
const newNode = new Node();
const keys = Object.keys(this);
for (let i = 0, length = keys.length; i < length; i++) {
const key = keys[i];
if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") {
newNode[key] = this[key];
}
}
return newNode;
}
}
class NodeUtils extends UtilParser {
startNode() {
return new Node(this, this.state.start, this.state.startLoc);
}
startNodeAt(pos, loc) {
return new Node(this, pos, loc);
}
startNodeAtNode(type) {
return this.startNodeAt(type.start, type.loc.start);
}
finishNode(node, type) {
return this.finishNodeAt(node, type, this.state.lastTokEnd, this.state.lastTokEndLoc);
}
finishNodeAt(node, type, pos, loc) {
node.type = type;
node.end = pos;
node.loc.end = loc;
if (this.options.ranges) node.range[1] = pos;
this.processComment(node);
return node;
}
resetStartLocation(node, start, startLoc) {
node.start = start;
node.loc.start = startLoc;
if (this.options.ranges) node.range[0] = start;
}
resetEndLocation(node, end = this.state.lastTokEnd, endLoc = this.state.lastTokEndLoc) {
node.end = end;
node.loc.end = endLoc;
if (this.options.ranges) node.range[1] = end;
}
resetStartLocationFromNode(node, locationNode) {
this.resetStartLocation(node, locationNode.start, locationNode.loc.start);
}
}
const unwrapParenthesizedExpression = node => {
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
};
class LValParser extends NodeUtils {
toAssignable(node) {
var _node$extra, _node$extra3;
let parenthesized = undefined;
if (node.type === "ParenthesizedExpression" || ((_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized)) {
parenthesized = unwrapParenthesizedExpression(node);
if (parenthesized.type !== "Identifier" && parenthesized.type !== "MemberExpression") {
this.raise(node.start, ErrorMessages.InvalidParenthesizedAssignment);
}
}
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
var _node$extra2;
const prop = node.properties[i];
const isLast = i === last;
this.toAssignableObjectExpressionProp(prop, isLast);
if (isLast && prop.type === "RestElement" && ((_node$extra2 = node.extra) == null ? void 0 : _node$extra2.trailingComma)) {
this.raiseRestNotLast(node.extra.trailingComma);
}
}
break;
case "ObjectProperty":
this.toAssignable(node.value);
break;
case "SpreadElement":
{
this.checkToRestConversion(node);
node.type = "RestElement";
const arg = node.argument;
this.toAssignable(arg);
break;
}
case "ArrayExpression":
node.type = "ArrayPattern";
this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingComma);
break;
case "AssignmentExpression":
if (node.operator !== "=") {
this.raise(node.left.end, ErrorMessages.MissingEqInAssignment);
}
node.type = "AssignmentPattern";
delete node.operator;
this.toAssignable(node.left);
break;
case "ParenthesizedExpression":
this.toAssignable(parenthesized);
break;
}
return node;
}
toAssignableObjectExpressionProp(prop, isLast) {
if (prop.type === "ObjectMethod") {
const error = prop.kind === "get" || prop.kind === "set" ? ErrorMessages.PatternHasAccessor : ErrorMessages.PatternHasMethod;
this.raise(prop.key.start, error);
} else if (prop.type === "SpreadElement" && !isLast) {
this.raiseRestNotLast(prop.start);
} else {
this.toAssignable(prop);
}
}
toAssignableList(exprList, trailingCommaPos) {
let end = exprList.length;
if (end) {
const last = exprList[end - 1];
if ((last == null ? void 0 : last.type) === "RestElement") {
--end;
} else if ((last == null ? void 0 : last.type) === "SpreadElement") {
last.type = "RestElement";
const arg = last.argument;
this.toAssignable(arg);
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern") {
this.unexpected(arg.start);
}
if (trailingCommaPos) {
this.raiseTrailingCommaAfterRest(trailingCommaPos);
}
--end;
}
}
for (let i = 0; i < end; i++) {
const elt = exprList[i];
if (elt) {
this.toAssignable(elt);
if (elt.type === "RestElement") {
this.raiseRestNotLast(elt.start);
}
}
}
return exprList;
}
toReferencedList(exprList, isParenthesizedExpr) {
return exprList;
}
toReferencedListDeep(exprList, isParenthesizedExpr) {
this.toReferencedList(exprList, isParenthesizedExpr);
for (let _i = 0; _i < exprList.length; _i++) {
const expr = exprList[_i];
if ((expr == null ? void 0 : expr.type) === "ArrayExpression") {
this.toReferencedListDeep(expr.elements);
}
}
}
parseSpread(refExpressionErrors, refNeedsArrowPos) {
const node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(false, refExpressionErrors, undefined, refNeedsArrowPos);
return this.finishNode(node, "SpreadElement");
}
parseRestBinding() {
const node = this.startNode();
this.next();
node.argument = this.parseBindingAtom();
return this.finishNode(node, "RestElement");
}
parseBindingAtom() {
switch (this.state.type) {
case types.bracketL:
{
const node = this.startNode();
this.next();
node.elements = this.parseBindingList(types.bracketR, 93, true);
return this.finishNode(node, "ArrayPattern");
}
case types.braceL:
return this.parseObj(types.braceR, true);
}
return this.parseIdentifier();
}
parseBindingList(close, closeCharCode, allowEmpty, allowModifiers) {
const elts = [];
let first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types.comma);
}
if (allowEmpty && this.match(types.comma)) {
elts.push(null);
} else if (this.eat(close)) {
break;
} else if (this.match(types.ellipsis)) {
elts.push(this.parseAssignableListItemTypes(this.parseRestBinding()));
this.checkCommaAfterRest(closeCharCode);
this.expect(close);
break;
} else {
const decorators = [];
if (this.match(types.at) && this.hasPlugin("decorators")) {
this.raise(this.state.start, ErrorMessages.UnsupportedParameterDecorator);
}
while (this.match(types.at)) {
decorators.push(this.parseDecorator());
}
elts.push(this.parseAssignableListItem(allowModifiers, decorators));
}
}
return elts;
}
parseAssignableListItem(allowModifiers, decorators) {
const left = this.parseMaybeDefault();
this.parseAssignableListItemTypes(left);
const elt = this.parseMaybeDefault(left.start, left.loc.start, left);
if (decorators.length) {
left.decorators = decorators;
}
return elt;
}
parseAssignableListItemTypes(param) {
return param;
}
parseMaybeDefault(startPos, startLoc, left) {
startLoc = startLoc || this.state.startLoc;
startPos = startPos || this.state.start;
left = left || this.parseBindingAtom();
if (!this.eat(types.eq)) return left;
const node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
}
checkLVal(expr, bindingType = BIND_NONE, checkClashes, contextDescription, disallowLetBinding, strictModeChanged = false) {
switch (expr.type) {
case "Identifier":
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(expr.name, this.inModule) : isStrictBindOnlyReservedWord(expr.name))) {
this.raise(expr.start, bindingType === BIND_NONE ? ErrorMessages.StrictEvalArguments : ErrorMessages.StrictEvalArgumentsBinding, expr.name);
}
if (checkClashes) {
const key = `_${expr.name}`;
if (checkClashes[key]) {
this.raise(expr.start, ErrorMessages.ParamDupe);
} else {
checkClashes[key] = true;
}
}
if (disallowLetBinding && expr.name === "let") {
this.raise(expr.start, ErrorMessages.LetInLexicalBinding);
}
if (!(bindingType & BIND_NONE)) {
this.scope.declareName(expr.name, bindingType, expr.start);
}
break;
case "MemberExpression":
if (bindingType !== BIND_NONE) {
this.raise(expr.start, ErrorMessages.InvalidPropertyBindingPattern);
}
break;
case "ObjectPattern":
for (let _i2 = 0, _expr$properties = expr.properties; _i2 < _expr$properties.length; _i2++) {
let prop = _expr$properties[_i2];
if (prop.type === "ObjectProperty") prop = prop.value;else if (prop.type === "ObjectMethod") continue;
this.checkLVal(prop, bindingType, checkClashes, "object destructuring pattern", disallowLetBinding);
}
break;
case "ArrayPattern":
for (let _i3 = 0, _expr$elements = expr.elements; _i3 < _expr$elements.length; _i3++) {
const elem = _expr$elements[_i3];
if (elem) {
this.checkLVal(elem, bindingType, checkClashes, "array destructuring pattern", disallowLetBinding);
}
}
break;
case "AssignmentPattern":
this.checkLVal(expr.left, bindingType, checkClashes, "assignment pattern");
break;
case "RestElement":
this.checkLVal(expr.argument, bindingType, checkClashes, "rest element");
break;
case "ParenthesizedExpression":
this.checkLVal(expr.expression, bindingType, checkClashes, "parenthesized expression");
break;
default:
{
this.raise(expr.start, bindingType === BIND_NONE ? ErrorMessages.InvalidLhs : ErrorMessages.InvalidLhsBinding, contextDescription);
}
}
}
checkToRestConversion(node) {
if (node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression") {
this.raise(node.argument.start, ErrorMessages.InvalidRestAssignmentPattern);
}
}
checkCommaAfterRest(close) {
if (this.match(types.comma)) {
if (this.lookaheadCharCode() === close) {
this.raiseTrailingCommaAfterRest(this.state.start);
} else {
this.raiseRestNotLast(this.state.start);
}
}
}
raiseRestNotLast(pos) {
throw this.raise(pos, ErrorMessages.ElementAfterRest);
}
raiseTrailingCommaAfterRest(pos) {
this.raise(pos, ErrorMessages.RestTrailingComma);
}
}
class ExpressionParser extends LValParser {
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
if (prop.type === "SpreadElement" || prop.type === "ObjectMethod" || prop.computed || prop.shorthand) {
return;
}
const key = prop.key;
const name = key.type === "Identifier" ? key.name : key.value;
if (name === "__proto__") {
if (isRecord) {
this.raise(key.start, ErrorMessages.RecordNoProto);
return;
}
if (protoRef.used) {
if (refExpressionErrors) {
if (refExpressionErrors.doubleProto === -1) {
refExpressionErrors.doubleProto = key.start;
}
} else {
this.raise(key.start, ErrorMessages.DuplicateProto);
}
}
protoRef.used = true;
}
}
getExpression() {
let paramFlags = PARAM;
if (this.hasPlugin("topLevelAwait") && this.inModule) {
paramFlags |= PARAM_AWAIT;
}
this.scope.enter(SCOPE_PROGRAM);
this.prodParam.enter(paramFlags);
this.nextToken();
const expr = this.parseExpression();
if (!this.match(types.eof)) {
this.unexpected();
}
expr.comments = this.state.comments;
expr.errors = this.state.errors;
return expr;
}
parseExpression(noIn, refExpressionErrors) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const expr = this.parseMaybeAssign(noIn, refExpressionErrors);
if (this.match(types.comma)) {
const node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(types.comma)) {
node.expressions.push(this.parseMaybeAssign(noIn, refExpressionErrors));
}
this.toReferencedList(node.expressions);
return this.finishNode(node, "SequenceExpression");
}
return expr;
}
parseMaybeAssign(noIn, refExpressionErrors, afterLeftParse, refNeedsArrowPos) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
if (this.isContextual("yield")) {
if (this.prodParam.hasYield) {
let left = this.parseYield(noIn);
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
return left;
} else {
this.state.exprAllowed = false;
}
}
let ownExpressionErrors;
if (refExpressionErrors) {
ownExpressionErrors = false;
} else {
refExpressionErrors = new ExpressionErrors();
ownExpressionErrors = true;
}
if (this.match(types.parenL) || this.match(types.name)) {
this.state.potentialArrowAt = this.state.start;
}
let left = this.parseMaybeConditional(noIn, refExpressionErrors, refNeedsArrowPos);
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
if (this.state.type.isAssign) {
const node = this.startNodeAt(startPos, startLoc);
const operator = this.state.value;
node.operator = operator;
if (operator === "??=") {
this.expectPlugin("logicalAssignment");
}
if (operator === "||=" || operator === "&&=") {
this.expectPlugin("logicalAssignment");
}
if (this.match(types.eq)) {
node.left = this.toAssignable(left);
refExpressionErrors.doubleProto = -1;
} else {
node.left = left;
}
if (refExpressionErrors.shorthandAssign >= node.left.start) {
refExpressionErrors.shorthandAssign = -1;
}
this.checkLVal(left, undefined, undefined, "assignment expression");
this.next();
node.right = this.parseMaybeAssign(noIn);
return this.finishNode(node, "AssignmentExpression");
} else if (ownExpressionErrors) {
this.checkExpressionErrors(refExpressionErrors, true);
}
return left;
}
parseMaybeConditional(noIn, refExpressionErrors, refNeedsArrowPos) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const potentialArrowAt = this.state.potentialArrowAt;
const expr = this.parseExprOps(noIn, refExpressionErrors);
if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
return expr;
}
if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
}
parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos) {
if (this.eat(types.question)) {
const node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(types.colon);
node.alternate = this.parseMaybeAssign(noIn);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
}
parseExprOps(noIn, refExpressionErrors) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const potentialArrowAt = this.state.potentialArrowAt;
const expr = this.parseMaybeUnary(refExpressionErrors);
if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
return expr;
}
if (this.checkExpressionErrors(refExpressionErrors, false)) {
return expr;
}
return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
}
parseExprOp(left, leftStartPos, leftStartLoc, minPrec, noIn) {
let prec = this.state.type.binop;
if (prec != null && (!noIn || !this.match(types._in))) {
if (prec > minPrec) {
const operator = this.state.value;
if (operator === "|>" && this.state.inFSharpPipelineDirectBody) {
return left;
}
const node = this.startNodeAt(leftStartPos, leftStartLoc);
node.left = left;
node.operator = operator;
if (operator === "**" && left.type === "UnaryExpression" && (this.options.createParenthesizedExpressions || !(left.extra && left.extra.parenthesized))) {
this.raise(left.argument.start, ErrorMessages.UnexpectedTokenUnaryExponentiation);
}
const op = this.state.type;
const logical = op === types.logicalOR || op === types.logicalAND;
const coalesce = op === types.nullishCoalescing;
if (op === types.pipeline) {
this.expectPlugin("pipelineOperator");
this.state.inPipeline = true;
this.checkPipelineAtInfixOperator(left, leftStartPos);
} else if (coalesce) {
prec = types.logicalAND.binop;
}
this.next();
if (op === types.pipeline && this.getPluginOption("pipelineOperator", "proposal") === "minimal") {
if (this.match(types.name) && this.state.value === "await" && this.prodParam.hasAwait) {
throw this.raise(this.state.start, ErrorMessages.UnexpectedAwaitAfterPipelineBody);
}
}
node.right = this.parseExprOpRightExpr(op, prec, noIn);
this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
const nextOp = this.state.type;
if (coalesce && (nextOp === types.logicalOR || nextOp === types.logicalAND) || logical && nextOp === types.nullishCoalescing) {
throw this.raise(this.state.start, ErrorMessages.MixingCoalesceWithLogical);
}
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
}
}
return left;
}
parseExprOpRightExpr(op, prec, noIn) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
switch (op) {
case types.pipeline:
switch (this.getPluginOption("pipelineOperator", "proposal")) {
case "smart":
return this.withTopicPermittingContext(() => {
return this.parseSmartPipelineBody(this.parseExprOpBaseRightExpr(op, prec, noIn), startPos, startLoc);
});
case "fsharp":
return this.withSoloAwaitPermittingContext(() => {
return this.parseFSharpPipelineBody(prec, noIn);
});
}
default:
return this.parseExprOpBaseRightExpr(op, prec, noIn);
}
}
parseExprOpBaseRightExpr(op, prec, noIn) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
return this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn);
}
parseMaybeUnary(refExpressionErrors) {
if (this.isContextual("await") && this.isAwaitAllowed()) {
return this.parseAwait();
} else if (this.state.type.prefix) {
const node = this.startNode();
const update = this.match(types.incDec);
node.operator = this.state.value;
node.prefix = true;
if (node.operator === "throw") {
this.expectPlugin("throwExpressions");
}
this.next();
node.argument = this.parseMaybeUnary();
this.checkExpressionErrors(refExpressionErrors, true);
if (update) {
this.checkLVal(node.argument, undefined, undefined, "prefix operation");
} else if (this.state.strict && node.operator === "delete") {
const arg = node.argument;
if (arg.type === "Identifier") {
this.raise(node.start, ErrorMessages.StrictDelete);
} else if ((arg.type === "MemberExpression" || arg.type === "OptionalMemberExpression") && arg.property.type === "PrivateName") {
this.raise(node.start, ErrorMessages.DeletePrivateField);
}
}
return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
}
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let expr = this.parseExprSubscripts(refExpressionErrors);
if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
while (this.state.type.postfix && !this.canInsertSemicolon()) {
const node = this.startNodeAt(startPos, startLoc);
node.operator = this.state.value;
node.prefix = false;
node.argument = expr;
this.checkLVal(expr, undefined, undefined, "postfix operation");
this.next();
expr = this.finishNode(node, "UpdateExpression");
}
return expr;
}
parseExprSubscripts(refExpressionErrors) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const potentialArrowAt = this.state.potentialArrowAt;
const expr = this.parseExprAtom(refExpressionErrors);
if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
return expr;
}
return this.parseSubscripts(expr, startPos, startLoc);
}
parseSubscripts(base, startPos, startLoc, noCalls) {
const state = {
optionalChainMember: false,
maybeAsyncArrow: this.atPossibleAsyncArrow(base),
stop: false
};
do {
const oldMaybeInAsyncArrowHead = this.state.maybeInAsyncArrowHead;
if (state.maybeAsyncArrow) {
this.state.maybeInAsyncArrowHead = true;
}
base = this.parseSubscript(base, startPos, startLoc, noCalls, state);
state.maybeAsyncArrow = false;
this.state.maybeInAsyncArrowHead = oldMaybeInAsyncArrowHead;
} while (!state.stop);
return base;
}
parseSubscript(base, startPos, startLoc, noCalls, state) {
if (!noCalls && this.eat(types.doubleColon)) {
const node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.callee = this.parseNoCallExpr();
state.stop = true;
return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
}
let optional = false;
if (this.match(types.questionDot)) {
state.optionalChainMember = optional = true;
if (noCalls && this.lookaheadCharCode() === 40) {
state.stop = true;
return base;
}
this.next();
}
const computed = this.eat(types.bracketL);
if (optional && !this.match(types.parenL) && !this.match(types.backQuote) || computed || this.eat(types.dot)) {
const node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = computed ? this.parseExpression() : this.parseMaybePrivateName(true);
node.computed = computed;
if (node.property.type === "PrivateName") {
if (node.object.type === "Super") {
this.raise(startPos, ErrorMessages.SuperPrivateField);
}
this.classScope.usePrivateName(node.property.id.name, node.property.start);
}
if (computed) {
this.expect(types.bracketR);
}
if (state.optionalChainMember) {
node.optional = optional;
return this.finishNode(node, "OptionalMemberExpression");
} else {
return this.finishNode(node, "MemberExpression");
}
} else if (!noCalls && this.match(types.parenL)) {
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
this.state.maybeInArrowParameters = true;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
this.next();
let node = this.startNodeAt(startPos, startLoc);
node.callee = base;
if (optional) {
node.optional = true;
node.arguments = this.parseCallExpressionArguments(types.parenR, false);
} else {
node.arguments = this.parseCallExpressionArguments(types.parenR, state.maybeAsyncArrow, base.type === "Import", base.type !== "Super", node);
}
this.finishCallExpression(node, state.optionalChainMember);
if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
state.stop = true;
node = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node);
this.checkYieldAwaitInDefaultParams();
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
} else {
this.toReferencedListDeep(node.arguments);
if (oldYieldPos !== -1) this.state.yieldPos = oldYieldPos;
if (!this.isAwaitAllowed() && !oldMaybeInArrowParameters || oldAwaitPos !== -1) {
this.state.awaitPos = oldAwaitPos;
}
}
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
return node;
} else if (this.match(types.backQuote)) {
return this.parseTaggedTemplateExpression(startPos, startLoc, base, state);
} else {
state.stop = true;
return base;
}
}
parseTaggedTemplateExpression(startPos, startLoc, base, state, typeArguments) {
const node = this.startNodeAt(startPos, startLoc);
node.tag = base;
node.quasi = this.parseTemplate(true);
if (typeArguments) node.typeParameters = typeArguments;
if (state.optionalChainMember) {
this.raise(startPos, ErrorMessages.OptionalChainingNoTemplate);
}
return this.finishNode(node, "TaggedTemplateExpression");
}
atPossibleAsyncArrow(base) {
return base.type === "Identifier" && base.name === "async" && this.state.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.state.potentialArrowAt;
}
finishCallExpression(node, optional) {
if (node.callee.type === "Import") {
if (node.arguments.length === 2) {
this.expectPlugin("moduleAttributes");
}
if (node.arguments.length === 0 || node.arguments.length > 2) {
this.raise(node.start, ErrorMessages.ImportCallArity, this.hasPlugin("moduleAttributes") ? "one or two arguments" : "one argument");
} else {
for (let _i = 0, _node$arguments = node.arguments; _i < _node$arguments.length; _i++) {
const arg = _node$arguments[_i];
if (arg.type === "SpreadElement") {
this.raise(arg.start, ErrorMessages.ImportCallSpreadArgument);
}
}
}
}
return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
}
parseCallExpressionArguments(close, possibleAsyncArrow, dynamicImport, allowPlaceholder, nodeForExtra) {
const elts = [];
let innerParenStart;
let first = true;
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = false;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types.comma);
if (this.match(close)) {
if (dynamicImport && !this.hasPlugin("moduleAttributes")) {
this.raise(this.state.lastTokStart, ErrorMessages.ImportCallArgumentTrailingComma);
}
if (nodeForExtra) {
this.addExtra(nodeForExtra, "trailingComma", this.state.lastTokStart);
}
this.next();
break;
}
}
if (this.match(types.parenL) && !innerParenStart) {
innerParenStart = this.state.start;
}
elts.push(this.parseExprListItem(false, possibleAsyncArrow ? new ExpressionErrors() : undefined, possibleAsyncArrow ? {
start: 0
} : undefined, allowPlaceholder));
}
if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) {
this.unexpected();
}
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return elts;
}
shouldParseAsyncArrow() {
return this.match(types.arrow) && !this.canInsertSemicolon();
}
parseAsyncArrowFromCallExpression(node, call) {
var _call$extra;
this.expect(types.arrow);
this.parseArrowExpression(node, call.arguments, true, (_call$extra = call.extra) == null ? void 0 : _call$extra.trailingComma);
return node;
}
parseNoCallExpr() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
}
parseExprAtom(refExpressionErrors) {
if (this.state.type === types.slash) this.readRegexp();
const canBeArrow = this.state.potentialArrowAt === this.state.start;
let node;
switch (this.state.type) {
case types._super:
node = this.startNode();
this.next();
if (this.match(types.parenL) && !this.scope.allowDirectSuper && !this.options.allowSuperOutsideMethod) {
this.raise(node.start, ErrorMessages.SuperNotAllowed);
} else if (!this.scope.allowSuper && !this.options.allowSuperOutsideMethod) {
this.raise(node.start, ErrorMessages.UnexpectedSuper);
}
if (!this.match(types.parenL) && !this.match(types.bracketL) && !this.match(types.dot)) {
this.raise(node.start, ErrorMessages.UnsupportedSuper);
}
return this.finishNode(node, "Super");
case types._import:
node = this.startNode();
this.next();
if (this.match(types.dot)) {
return this.parseImportMetaProperty(node);
}
if (!this.match(types.parenL)) {
this.raise(this.state.lastTokStart, ErrorMessages.UnsupportedImport);
}
return this.finishNode(node, "Import");
case types._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression");
case types.name:
{
node = this.startNode();
const containsEsc = this.state.containsEsc;
const id = this.parseIdentifier();
if (!containsEsc && id.name === "async" && this.match(types._function) && !this.canInsertSemicolon()) {
const last = this.state.context.length - 1;
if (this.state.context[last] !== types$1.functionStatement) {
throw new Error("Internal error");
}
this.state.context[last] = types$1.functionExpression;
this.next();
return this.parseFunction(node, undefined, true);
} else if (canBeArrow && !containsEsc && id.name === "async" && this.match(types.name) && !this.canInsertSemicolon()) {
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldMaybeInAsyncArrowHead = this.state.maybeInAsyncArrowHead;
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
this.state.maybeInArrowParameters = true;
this.state.maybeInAsyncArrowHead = true;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
const params = [this.parseIdentifier()];
this.expect(types.arrow);
this.checkYieldAwaitInDefaultParams();
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
this.state.maybeInAsyncArrowHead = oldMaybeInAsyncArrowHead;
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
this.parseArrowExpression(node, params, true);
return node;
}
if (canBeArrow && this.match(types.arrow) && !this.canInsertSemicolon()) {
this.next();
this.parseArrowExpression(node, [id], false);
return node;
}
return id;
}
case types._do:
{
this.expectPlugin("doExpressions");
const node = this.startNode();
this.next();
const oldLabels = this.state.labels;
this.state.labels = [];
node.body = this.parseBlock();
this.state.labels = oldLabels;
return this.finishNode(node, "DoExpression");
}
case types.regexp:
{
const value = this.state.value;
node = this.parseLiteral(value.value, "RegExpLiteral");
node.pattern = value.pattern;
node.flags = value.flags;
return node;
}
case types.num:
return this.parseLiteral(this.state.value, "NumericLiteral");
case types.bigint:
return this.parseLiteral(this.state.value, "BigIntLiteral");
case types.string:
return this.parseLiteral(this.state.value, "StringLiteral");
case types._null:
node = this.startNode();
this.next();
return this.finishNode(node, "NullLiteral");
case types._true:
case types._false:
return this.parseBooleanLiteral();
case types.parenL:
return this.parseParenAndDistinguishExpression(canBeArrow);
case types.bracketBarL:
case types.bracketHashL:
{
this.expectPlugin("recordAndTuple");
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
const close = this.state.type === types.bracketBarL ? types.bracketBarR : types.bracketR;
this.state.inFSharpPipelineDirectBody = false;
node = this.startNode();
this.next();
node.elements = this.parseExprList(close, false, refExpressionErrors, node);
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return this.finishNode(node, "TupleExpression");
}
case types.bracketL:
{
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = false;
node = this.startNode();
this.next();
node.elements = this.parseExprList(types.bracketR, true, refExpressionErrors, node);
if (!this.state.maybeInArrowParameters) {
this.toReferencedList(node.elements);
}
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return this.finishNode(node, "ArrayExpression");
}
case types.braceBarL:
case types.braceHashL:
{
this.expectPlugin("recordAndTuple");
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
const close = this.state.type === types.braceBarL ? types.braceBarR : types.braceR;
this.state.inFSharpPipelineDirectBody = false;
const ret = this.parseObj(close, false, true, refExpressionErrors);
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return ret;
}
case types.braceL:
{
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = false;
const ret = this.parseObj(types.braceR, false, false, refExpressionErrors);
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return ret;
}
case types._function:
return this.parseFunctionExpression();
case types.at:
this.parseDecorators();
case types._class:
node = this.startNode();
this.takeDecorators(node);
return this.parseClass(node, false);
case types._new:
return this.parseNew();
case types.backQuote:
return this.parseTemplate(false);
case types.doubleColon:
{
node = this.startNode();
this.next();
node.object = null;
const callee = node.callee = this.parseNoCallExpr();
if (callee.type === "MemberExpression") {
return this.finishNode(node, "BindExpression");
} else {
throw this.raise(callee.start, ErrorMessages.UnsupportedBind);
}
}
case types.hash:
{
if (this.state.inPipeline) {
node = this.startNode();
if (this.getPluginOption("pipelineOperator", "proposal") !== "smart") {
this.raise(node.start, ErrorMessages.PrimaryTopicRequiresSmartPipeline);
}
this.next();
if (!this.primaryTopicReferenceIsAllowedInCurrentTopicContext()) {
this.raise(node.start, ErrorMessages.PrimaryTopicNotAllowed);
}
this.registerTopicReference();
return this.finishNode(node, "PipelinePrimaryTopicReference");
}
const nextCh = this.input.codePointAt(this.state.end);
if (isIdentifierStart(nextCh) || nextCh === 92) {
const start = this.state.start;
node = this.parseMaybePrivateName(true);
if (this.match(types._in)) {
this.expectPlugin("privateIn");
this.classScope.usePrivateName(node.id.name, node.start);
} else if (this.hasPlugin("privateIn")) {
this.raise(this.state.start, ErrorMessages.PrivateInExpectedIn, node.id.name);
} else {
throw this.unexpected(start);
}
return node;
}
}
case types.relational:
{
if (this.state.value === "<") {
throw this.expectOnePlugin(["jsx", "flow", "typescript"]);
}
}
default:
throw this.unexpected();
}
}
parseBooleanLiteral() {
const node = this.startNode();
node.value = this.match(types._true);
this.next();
return this.finishNode(node, "BooleanLiteral");
}
parseMaybePrivateName(isPrivateNameAllowed) {
const isPrivate = this.match(types.hash);
if (isPrivate) {
this.expectOnePlugin(["classPrivateProperties", "classPrivateMethods"]);
if (!isPrivateNameAllowed) {
this.raise(this.state.pos, ErrorMessages.UnexpectedPrivateField);
}
const node = this.startNode();
this.next();
this.assertNoSpace("Unexpected space between # and identifier");
node.id = this.parseIdentifier(true);
return this.finishNode(node, "PrivateName");
} else {
return this.parseIdentifier(true);
}
}
parseFunctionExpression() {
const node = this.startNode();
let meta = this.startNode();
this.next();
meta = this.createIdentifier(meta, "function");
if (this.prodParam.hasYield && this.eat(types.dot)) {
return this.parseMetaProperty(node, meta, "sent");
}
return this.parseFunction(node);
}
parseMetaProperty(node, meta, propertyName) {
node.meta = meta;
if (meta.name === "function" && propertyName === "sent") {
if (this.isContextual(propertyName)) {
this.expectPlugin("functionSent");
} else if (!this.hasPlugin("functionSent")) {
this.unexpected();
}
}
const containsEsc = this.state.containsEsc;
node.property = this.parseIdentifier(true);
if (node.property.name !== propertyName || containsEsc) {
this.raise(node.property.start, ErrorMessages.UnsupportedMetaProperty, meta.name, propertyName);
}
return this.finishNode(node, "MetaProperty");
}
parseImportMetaProperty(node) {
const id = this.createIdentifier(this.startNodeAtNode(node), "import");
this.expect(types.dot);
if (this.isContextual("meta")) {
if (!this.inModule) {
this.raiseWithData(id.start, {
code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
}, ErrorMessages.ImportMetaOutsideModule);
}
this.sawUnambiguousESM = true;
}
return this.parseMetaProperty(node, id, "meta");
}
parseLiteral(value, type, startPos, startLoc) {
startPos = startPos || this.state.start;
startLoc = startLoc || this.state.startLoc;
const node = this.startNodeAt(startPos, startLoc);
this.addExtra(node, "rawValue", value);
this.addExtra(node, "raw", this.input.slice(startPos, this.state.end));
node.value = value;
this.next();
return this.finishNode(node, type);
}
parseParenAndDistinguishExpression(canBeArrow) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let val;
this.expect(types.parenL);
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.maybeInArrowParameters = true;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
this.state.inFSharpPipelineDirectBody = false;
const innerStartPos = this.state.start;
const innerStartLoc = this.state.startLoc;
const exprList = [];
const refExpressionErrors = new ExpressionErrors();
const refNeedsArrowPos = {
start: 0
};
let first = true;
let spreadStart;
let optionalCommaStart;
while (!this.match(types.parenR)) {
if (first) {
first = false;
} else {
this.expect(types.comma, refNeedsArrowPos.start || null);
if (this.match(types.parenR)) {
optionalCommaStart = this.state.start;
break;
}
}
if (this.match(types.ellipsis)) {
const spreadNodeStartPos = this.state.start;
const spreadNodeStartLoc = this.state.startLoc;
spreadStart = this.state.start;
exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartPos, spreadNodeStartLoc));
this.checkCommaAfterRest(41);
break;
} else {
exprList.push(this.parseMaybeAssign(false, refExpressionErrors, this.parseParenItem, refNeedsArrowPos));
}
}
const innerEndPos = this.state.start;
const innerEndLoc = this.state.startLoc;
this.expect(types.parenR);
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
let arrowNode = this.startNodeAt(startPos, startLoc);
if (canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode))) {
if (!this.isAwaitAllowed() && !this.state.maybeInAsyncArrowHead) {
this.state.awaitPos = oldAwaitPos;
}
this.checkYieldAwaitInDefaultParams();
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
for (let _i2 = 0; _i2 < exprList.length; _i2++) {
const param = exprList[_i2];
if (param.extra && param.extra.parenthesized) {
this.unexpected(param.extra.parenStart);
}
}
this.parseArrowExpression(arrowNode, exprList, false);
return arrowNode;
}
if (oldYieldPos !== -1) this.state.yieldPos = oldYieldPos;
if (oldAwaitPos !== -1) this.state.awaitPos = oldAwaitPos;
if (!exprList.length) {
this.unexpected(this.state.lastTokStart);
}
if (optionalCommaStart) this.unexpected(optionalCommaStart);
if (spreadStart) this.unexpected(spreadStart);
this.checkExpressionErrors(refExpressionErrors, true);
if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start);
this.toReferencedListDeep(exprList, true);
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
if (!this.options.createParenthesizedExpressions) {
this.addExtra(val, "parenthesized", true);
this.addExtra(val, "parenStart", startPos);
return val;
}
const parenExpression = this.startNodeAt(startPos, startLoc);
parenExpression.expression = val;
this.finishNode(parenExpression, "ParenthesizedExpression");
return parenExpression;
}
shouldParseArrow() {
return !this.canInsertSemicolon();
}
parseArrow(node) {
if (this.eat(types.arrow)) {
return node;
}
}
parseParenItem(node, startPos, startLoc) {
return node;
}
parseNew() {
const node = this.startNode();
let meta = this.startNode();
this.next();
meta = this.createIdentifier(meta, "new");
if (this.eat(types.dot)) {
const metaProp = this.parseMetaProperty(node, meta, "target");
if (!this.scope.inNonArrowFunction && !this.scope.inClass) {
let error = ErrorMessages.UnexpectedNewTarget;
if (this.hasPlugin("classProperties")) {
error += " or class properties";
}
this.raise(metaProp.start, error);
}
return metaProp;
}
node.callee = this.parseNoCallExpr();
if (node.callee.type === "Import") {
this.raise(node.callee.start, ErrorMessages.ImportCallNotNewExpression);
} else if (node.callee.type === "OptionalMemberExpression" || node.callee.type === "OptionalCallExpression") {
this.raise(this.state.lastTokEnd, ErrorMessages.OptionalChainingNoNew);
} else if (this.eat(types.questionDot)) {
this.raise(this.state.start, ErrorMessages.OptionalChainingNoNew);
}
this.parseNewArguments(node);
return this.finishNode(node, "NewExpression");
}
parseNewArguments(node) {
if (this.eat(types.parenL)) {
const args = this.parseExprList(types.parenR);
this.toReferencedList(args);
node.arguments = args;
} else {
node.arguments = [];
}
}
parseTemplateElement(isTagged) {
const elem = this.startNode();
if (this.state.value === null) {
if (!isTagged) {
this.raise(this.state.start + 1, ErrorMessages.InvalidEscapeSequenceTemplate);
}
}
elem.value = {
raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"),
cooked: this.state.value
};
this.next();
elem.tail = this.match(types.backQuote);
return this.finishNode(elem, "TemplateElement");
}
parseTemplate(isTagged) {
const node = this.startNode();
this.next();
node.expressions = [];
let curElt = this.parseTemplateElement(isTagged);
node.quasis = [curElt];
while (!curElt.tail) {
this.expect(types.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(types.braceR);
node.quasis.push(curElt = this.parseTemplateElement(isTagged));
}
this.next();
return this.finishNode(node, "TemplateLiteral");
}
parseObj(close, isPattern, isRecord, refExpressionErrors) {
const propHash = Object.create(null);
let first = true;
const node = this.startNode();
node.properties = [];
this.next();
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types.comma);
if (this.match(close)) {
this.addExtra(node, "trailingComma", this.state.lastTokStart);
this.next();
break;
}
}
const prop = this.parseObjectMember(isPattern, refExpressionErrors);
if (!isPattern) {
this.checkProto(prop, isRecord, propHash, refExpressionErrors);
}
if (isRecord && prop.type !== "ObjectProperty" && prop.type !== "SpreadElement") {
this.raise(prop.start, ErrorMessages.InvalidRecordProperty);
}
if (prop.shorthand) {
this.addExtra(prop, "shorthand", true);
}
node.properties.push(prop);
}
let type = "ObjectExpression";
if (isPattern) {
type = "ObjectPattern";
} else if (isRecord) {
type = "RecordExpression";
}
return this.finishNode(node, type);
}
isAsyncProp(prop) {
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.isLiteralPropertyName() || this.match(types.bracketL) || this.match(types.star)) && !this.hasPrecedingLineBreak();
}
parseObjectMember(isPattern, refExpressionErrors) {
let decorators = [];
if (this.match(types.at)) {
if (this.hasPlugin("decorators")) {
this.raise(this.state.start, ErrorMessages.UnsupportedPropertyDecorator);
}
while (this.match(types.at)) {
decorators.push(this.parseDecorator());
}
}
const prop = this.startNode();
let isGenerator = false;
let isAsync = false;
let startPos;
let startLoc;
if (this.match(types.ellipsis)) {
if (decorators.length) this.unexpected();
if (isPattern) {
this.next();
prop.argument = this.parseIdentifier();
this.checkCommaAfterRest(125);
return this.finishNode(prop, "RestElement");
}
return this.parseSpread();
}
if (decorators.length) {
prop.decorators = decorators;
decorators = [];
}
prop.method = false;
if (isPattern || refExpressionErrors) {
startPos = this.state.start;
startLoc = this.state.startLoc;
}
if (!isPattern) {
isGenerator = this.eat(types.star);
}
const containsEsc = this.state.containsEsc;
this.parsePropertyName(prop, false);
if (!isPattern && !containsEsc && !isGenerator && this.isAsyncProp(prop)) {
isAsync = true;
isGenerator = this.eat(types.star);
this.parsePropertyName(prop, false);
} else {
isAsync = false;
}
this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refExpressionErrors, containsEsc);
return prop;
}
isGetterOrSetterMethod(prop, isPattern) {
return !isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.isLiteralPropertyName() || this.match(types.bracketL));
}
getGetterSetterExpectedParamCount(method) {
return method.kind === "get" ? 0 : 1;
}
checkGetterSetterParams(method) {
const paramCount = this.getGetterSetterExpectedParamCount(method);
const start = method.start;
if (method.params.length !== paramCount) {
if (method.kind === "get") {
this.raise(start, ErrorMessages.BadGetterArity);
} else {
this.raise(start, ErrorMessages.BadSetterArity);
}
}
if (method.kind === "set" && method.params[method.params.length - 1].type === "RestElement") {
this.raise(start, ErrorMessages.BadSetterRestParameter);
}
}
parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) {
if (isAsync || isGenerator || this.match(types.parenL)) {
if (isPattern) this.unexpected();
prop.kind = "method";
prop.method = true;
return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod");
}
if (!containsEsc && this.isGetterOrSetterMethod(prop, isPattern)) {
if (isGenerator || isAsync) this.unexpected();
prop.kind = prop.key.name;
this.parsePropertyName(prop, false);
this.parseMethod(prop, false, false, false, false, "ObjectMethod");
this.checkGetterSetterParams(prop);
return prop;
}
}
parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors) {
prop.shorthand = false;
if (this.eat(types.colon)) {
prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refExpressionErrors);
return this.finishNode(prop, "ObjectProperty");
}
if (!prop.computed && prop.key.type === "Identifier") {
this.checkReservedWord(prop.key.name, prop.key.start, true, true);
if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
} else if (this.match(types.eq) && refExpressionErrors) {
if (refExpressionErrors.shorthandAssign === -1) {
refExpressionErrors.shorthandAssign = this.state.start;
}
prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
} else {
prop.value = prop.key.__clone();
}
prop.shorthand = true;
return this.finishNode(prop, "ObjectProperty");
}
}
parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refExpressionErrors, containsEsc) {
const node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, containsEsc) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors);
if (!node) this.unexpected();
return node;
}
parsePropertyName(prop, isPrivateNameAllowed) {
if (this.eat(types.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(types.bracketR);
} else {
const oldInPropertyName = this.state.inPropertyName;
this.state.inPropertyName = true;
prop.key = this.match(types.num) || this.match(types.string) || this.match(types.bigint) ? this.parseExprAtom() : this.parseMaybePrivateName(isPrivateNameAllowed);
if (prop.key.type !== "PrivateName") {
prop.computed = false;
}
this.state.inPropertyName = oldInPropertyName;
}
return prop.key;
}
initFunction(node, isAsync) {
node.id = null;
node.generator = false;
node.async = !!isAsync;
}
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
this.initFunction(node, isAsync);
node.generator = !!isGenerator;
const allowModifiers = isConstructor;
this.scope.enter(SCOPE_FUNCTION | SCOPE_SUPER | (inClassScope ? SCOPE_CLASS : 0) | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
this.prodParam.enter(functionFlags(isAsync, node.generator));
this.parseFunctionParams(node, allowModifiers);
this.parseFunctionBodyAndFinish(node, type, true);
this.prodParam.exit();
this.scope.exit();
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
return node;
}
parseArrowExpression(node, params, isAsync, trailingCommaPos) {
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
this.prodParam.enter(functionFlags(isAsync, false));
this.initFunction(node, isAsync);
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
if (params) {
this.state.maybeInArrowParameters = true;
this.setArrowFunctionParameters(node, params, trailingCommaPos);
}
this.state.maybeInArrowParameters = false;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
this.parseFunctionBody(node, true);
this.prodParam.exit();
this.scope.exit();
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
return this.finishNode(node, "ArrowFunctionExpression");
}
setArrowFunctionParameters(node, params, trailingCommaPos) {
node.params = this.toAssignableList(params, trailingCommaPos);
}
parseFunctionBodyAndFinish(node, type, isMethod = false) {
this.parseFunctionBody(node, false, isMethod);
this.finishNode(node, type);
}
parseFunctionBody(node, allowExpression, isMethod = false) {
const isExpression = allowExpression && !this.match(types.braceL);
const oldInParameters = this.state.inParameters;
this.state.inParameters = false;
if (isExpression) {
node.body = this.parseMaybeAssign();
this.checkParams(node, false, allowExpression, false);
} else {
const oldStrict = this.state.strict;
const oldLabels = this.state.labels;
this.state.labels = [];
this.prodParam.enter(this.prodParam.currentFlags() | PARAM_RETURN);
node.body = this.parseBlock(true, false, hasStrictModeDirective => {
const nonSimple = !this.isSimpleParamList(node.params);
if (hasStrictModeDirective && nonSimple) {
const errorPos = (node.kind === "method" || node.kind === "constructor") && !!node.key ? node.key.end : node.start;
this.raise(errorPos, ErrorMessages.IllegalLanguageModeDirective);
}
const strictModeChanged = !oldStrict && this.state.strict;
this.checkParams(node, !this.state.strict && !allowExpression && !isMethod && !nonSimple, allowExpression, strictModeChanged);
if (this.state.strict && node.id) {
this.checkLVal(node.id, BIND_OUTSIDE, undefined, "function name", undefined, strictModeChanged);
}
});
this.prodParam.exit();
this.state.labels = oldLabels;
}
this.state.inParameters = oldInParameters;
}
isSimpleParamList(params) {
for (let i = 0, len = params.length; i < len; i++) {
if (params[i].type !== "Identifier") return false;
}
return true;
}
checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged = true) {
const nameHash = Object.create(null);
for (let i = 0; i < node.params.length; i++) {
this.checkLVal(node.params[i], BIND_VAR, allowDuplicates ? null : nameHash, "function parameter list", undefined, strictModeChanged);
}
}
parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
const elts = [];
let first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types.comma);
if (this.match(close)) {
if (nodeForExtra) {
this.addExtra(nodeForExtra, "trailingComma", this.state.lastTokStart);
}
this.next();
break;
}
}
elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
}
return elts;
}
parseExprListItem(allowEmpty, refExpressionErrors, refNeedsArrowPos, allowPlaceholder) {
let elt;
if (this.match(types.comma)) {
if (!allowEmpty) {
this.raise(this.state.pos, ErrorMessages.UnexpectedToken, ",");
}
elt = null;
} else if (this.match(types.ellipsis)) {
const spreadNodeStartPos = this.state.start;
const spreadNodeStartLoc = this.state.startLoc;
elt = this.parseParenItem(this.parseSpread(refExpressionErrors, refNeedsArrowPos), spreadNodeStartPos, spreadNodeStartLoc);
} else if (this.match(types.question)) {
this.expectPlugin("partialApplication");
if (!allowPlaceholder) {
this.raise(this.state.start, ErrorMessages.UnexpectedArgumentPlaceholder);
}
const node = this.startNode();
this.next();
elt = this.finishNode(node, "ArgumentPlaceholder");
} else {
elt = this.parseMaybeAssign(false, refExpressionErrors, this.parseParenItem, refNeedsArrowPos);
}
return elt;
}
parseIdentifier(liberal) {
const node = this.startNode();
const name = this.parseIdentifierName(node.start, liberal);
return this.createIdentifier(node, name);
}
createIdentifier(node, name) {
node.name = name;
node.loc.identifierName = name;
return this.finishNode(node, "Identifier");
}
parseIdentifierName(pos, liberal) {
let name;
if (this.match(types.name)) {
name = this.state.value;
} else if (this.state.type.keyword) {
name = this.state.type.keyword;
const context = this.state.context;
if ((name === "class" || name === "function") && context[context.length - 1].token === "function") {
context.pop();
}
} else {
throw this.unexpected();
}
if (liberal) {
this.state.type = types.name;
} else {
this.checkReservedWord(name, this.state.start, !!this.state.type.keyword, false);
}
this.next();
return name;
}
checkReservedWord(word, startLoc, checkKeywords, isBinding) {
if (this.prodParam.hasYield && word === "yield") {
this.raise(startLoc, ErrorMessages.YieldBindingIdentifier);
return;
}
if (word === "await") {
if (this.prodParam.hasAwait) {
this.raise(startLoc, ErrorMessages.AwaitBindingIdentifier);
return;
}
if (this.state.awaitPos === -1 && (this.state.maybeInAsyncArrowHead || this.isAwaitAllowed())) {
this.state.awaitPos = this.state.start;
}
}
if (this.scope.inClass && !this.scope.inNonArrowFunction && word === "arguments") {
this.raise(startLoc, ErrorMessages.ArgumentsDisallowedInInitializer);
return;
}
if (checkKeywords && isKeyword(word)) {
this.raise(startLoc, ErrorMessages.UnexpectedKeyword, word);
return;
}
const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
if (reservedTest(word, this.inModule)) {
if (!this.prodParam.hasAwait && word === "await") {
this.raise(startLoc, ErrorMessages.AwaitNotInAsyncFunction);
} else {
this.raise(startLoc, ErrorMessages.UnexpectedReservedWord, word);
}
}
}
isAwaitAllowed() {
if (this.scope.inFunction) return this.prodParam.hasAwait;
if (this.options.allowAwaitOutsideFunction) return true;
if (this.hasPlugin("topLevelAwait")) {
return this.inModule && this.prodParam.hasAwait;
}
return false;
}
parseAwait() {
const node = this.startNode();
this.next();
if (this.state.inParameters) {
this.raise(node.start, ErrorMessages.AwaitExpressionFormalParameter);
} else if (this.state.awaitPos === -1) {
this.state.awaitPos = node.start;
}
if (this.eat(types.star)) {
this.raise(node.start, ErrorMessages.ObsoleteAwaitStar);
}
if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
if (this.hasPrecedingLineBreak() || this.match(types.plusMin) || this.match(types.parenL) || this.match(types.bracketL) || this.match(types.backQuote) || this.match(types.regexp) || this.match(types.slash) || this.hasPlugin("v8intrinsic") && this.match(types.modulo)) {
this.ambiguousScriptDifferentAst = true;
} else {
this.sawUnambiguousESM = true;
}
}
if (!this.state.soloAwait) {
node.argument = this.parseMaybeUnary();
}
return this.finishNode(node, "AwaitExpression");
}
parseYield(noIn) {
const node = this.startNode();
if (this.state.inParameters) {
this.raise(node.start, ErrorMessages.YieldInParameter);
} else if (this.state.yieldPos === -1) {
this.state.yieldPos = node.start;
}
this.next();
if (this.match(types.semi) || !this.match(types.star) && !this.state.type.startsExpr || this.hasPrecedingLineBreak()) {
node.delegate = false;
node.argument = null;
} else {
node.delegate = this.eat(types.star);
node.argument = this.parseMaybeAssign(noIn);
}
return this.finishNode(node, "YieldExpression");
}
checkPipelineAtInfixOperator(left, leftStartPos) {
if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
if (left.type === "SequenceExpression") {
this.raise(leftStartPos, ErrorMessages.PipelineHeadSequenceExpression);
}
}
}
parseSmartPipelineBody(childExpression, startPos, startLoc) {
const pipelineStyle = this.checkSmartPipelineBodyStyle(childExpression);
this.checkSmartPipelineBodyEarlyErrors(childExpression, pipelineStyle, startPos);
return this.parseSmartPipelineBodyInStyle(childExpression, pipelineStyle, startPos, startLoc);
}
checkSmartPipelineBodyEarlyErrors(childExpression, pipelineStyle, startPos) {
if (this.match(types.arrow)) {
throw this.raise(this.state.start, ErrorMessages.PipelineBodyNoArrow);
} else if (pipelineStyle === "PipelineTopicExpression" && childExpression.type === "SequenceExpression") {
this.raise(startPos, ErrorMessages.PipelineBodySequenceExpression);
}
}
parseSmartPipelineBodyInStyle(childExpression, pipelineStyle, startPos, startLoc) {
const bodyNode = this.startNodeAt(startPos, startLoc);
switch (pipelineStyle) {
case "PipelineBareFunction":
bodyNode.callee = childExpression;
break;
case "PipelineBareConstructor":
bodyNode.callee = childExpression.callee;
break;
case "PipelineBareAwaitedFunction":
bodyNode.callee = childExpression.argument;
break;
case "PipelineTopicExpression":
if (!this.topicReferenceWasUsedInCurrentTopicContext()) {
this.raise(startPos, ErrorMessages.PipelineTopicUnused);
}
bodyNode.expression = childExpression;
break;
default:
throw new Error(`Internal @babel/parser error: Unknown pipeline style (${pipelineStyle})`);
}
return this.finishNode(bodyNode, pipelineStyle);
}
checkSmartPipelineBodyStyle(expression) {
switch (expression.type) {
default:
return this.isSimpleReference(expression) ? "PipelineBareFunction" : "PipelineTopicExpression";
}
}
isSimpleReference(expression) {
switch (expression.type) {
case "MemberExpression":
return !expression.computed && this.isSimpleReference(expression.object);
case "Identifier":
return true;
default:
return false;
}
}
withTopicPermittingContext(callback) {
const outerContextTopicState = this.state.topicContext;
this.state.topicContext = {
maxNumOfResolvableTopics: 1,
maxTopicIndex: null
};
try {
return callback();
} finally {
this.state.topicContext = outerContextTopicState;
}
}
withTopicForbiddingContext(callback) {
const outerContextTopicState = this.state.topicContext;
this.state.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null
};
try {
return callback();
} finally {
this.state.topicContext = outerContextTopicState;
}
}
withSoloAwaitPermittingContext(callback) {
const outerContextSoloAwaitState = this.state.soloAwait;
this.state.soloAwait = true;
try {
return callback();
} finally {
this.state.soloAwait = outerContextSoloAwaitState;
}
}
registerTopicReference() {
this.state.topicContext.maxTopicIndex = 0;
}
primaryTopicReferenceIsAllowedInCurrentTopicContext() {
return this.state.topicContext.maxNumOfResolvableTopics >= 1;
}
topicReferenceWasUsedInCurrentTopicContext() {
return this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0;
}
parseFSharpPipelineBody(prec, noIn) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
this.state.potentialArrowAt = this.state.start;
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = true;
const ret = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, prec, noIn);
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return ret;
}
}
const loopLabel = {
kind: "loop"
},
switchLabel = {
kind: "switch"
};
const FUNC_NO_FLAGS = 0b000,
FUNC_STATEMENT = 0b001,
FUNC_HANGING_STATEMENT = 0b010,
FUNC_NULLABLE_ID = 0b100;
class StatementParser extends ExpressionParser {
parseTopLevel(file, program) {
program.sourceType = this.options.sourceType;
program.interpreter = this.parseInterpreterDirective();
this.parseBlockBody(program, true, true, types.eof);
if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
for (let _i = 0, _Array$from = Array.from(this.scope.undefinedExports); _i < _Array$from.length; _i++) {
const [name] = _Array$from[_i];
const pos = this.scope.undefinedExports.get(name);
this.raise(pos, ErrorMessages.ModuleExportUndefined, name);
}
}
file.program = this.finishNode(program, "Program");
file.comments = this.state.comments;
if (this.options.tokens) file.tokens = this.tokens;
return this.finishNode(file, "File");
}
stmtToDirective(stmt) {
const expr = stmt.expression;
const directiveLiteral = this.startNodeAt(expr.start, expr.loc.start);
const directive = this.startNodeAt(stmt.start, stmt.loc.start);
const raw = this.input.slice(expr.start, expr.end);
const val = directiveLiteral.value = raw.slice(1, -1);
this.addExtra(directiveLiteral, "raw", raw);
this.addExtra(directiveLiteral, "rawValue", val);
directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end);
return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end);
}
parseInterpreterDirective() {
if (!this.match(types.interpreterDirective)) {
return null;
}
const node = this.startNode();
node.value = this.state.value;
this.next();
return this.finishNode(node, "InterpreterDirective");
}
isLet(context) {
if (!this.isContextual("let")) {
return false;
}
const next = this.nextTokenStart();
const nextCh = this.input.charCodeAt(next);
if (nextCh === 91) return true;
if (context) return false;
if (nextCh === 123) return true;
if (isIdentifierStart(nextCh)) {
let pos = next + 1;
while (isIdentifierChar(this.input.charCodeAt(pos))) {
++pos;
}
const ident = this.input.slice(next, pos);
if (!keywordRelationalOperator.test(ident)) return true;
}
return false;
}
parseStatement(context, topLevel) {
if (this.match(types.at)) {
this.parseDecorators(true);
}
return this.parseStatementContent(context, topLevel);
}
parseStatementContent(context, topLevel) {
let starttype = this.state.type;
const node = this.startNode();
let kind;
if (this.isLet(context)) {
starttype = types._var;
kind = "let";
}
switch (starttype) {
case types._break:
case types._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case types._debugger:
return this.parseDebuggerStatement(node);
case types._do:
return this.parseDoStatement(node);
case types._for:
return this.parseForStatement(node);
case types._function:
if (this.lookaheadCharCode() === 46) break;
if (context) {
if (this.state.strict) {
this.raise(this.state.start, ErrorMessages.StrictFunction);
} else if (context !== "if" && context !== "label") {
this.raise(this.state.start, ErrorMessages.SloppyFunction);
}
}
return this.parseFunctionStatement(node, false, !context);
case types._class:
if (context) this.unexpected();
return this.parseClass(node, true);
case types._if:
return this.parseIfStatement(node);
case types._return:
return this.parseReturnStatement(node);
case types._switch:
return this.parseSwitchStatement(node);
case types._throw:
return this.parseThrowStatement(node);
case types._try:
return this.parseTryStatement(node);
case types._const:
case types._var:
kind = kind || this.state.value;
if (context && kind !== "var") {
this.raise(this.state.start, ErrorMessages.UnexpectedLexicalDeclaration);
}
return this.parseVarStatement(node, kind);
case types._while:
return this.parseWhileStatement(node);
case types._with:
return this.parseWithStatement(node);
case types.braceL:
return this.parseBlock();
case types.semi:
return this.parseEmptyStatement(node);
case types._export:
case types._import:
{
const nextTokenCharCode = this.lookaheadCharCode();
if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
break;
}
if (!this.options.allowImportExportEverywhere && !topLevel) {
this.raise(this.state.start, ErrorMessages.UnexpectedImportExport);
}
this.next();
let result;
if (starttype === types._import) {
result = this.parseImport(node);
if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) {
this.sawUnambiguousESM = true;
}
} else {
result = this.parseExport(node);
if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") {
this.sawUnambiguousESM = true;
}
}
this.assertModuleNodeAllowed(node);
return result;
}
default:
{
if (this.isAsyncFunction()) {
if (context) {
this.raise(this.state.start, ErrorMessages.AsyncFunctionInSingleStatementContext);
}
this.next();
return this.parseFunctionStatement(node, true, !context);
}
}
}
const maybeName = this.state.value;
const expr = this.parseExpression();
if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) {
return this.parseLabeledStatement(node, maybeName, expr, context);
} else {
return this.parseExpressionStatement(node, expr);
}
}
assertModuleNodeAllowed(node) {
if (!this.options.allowImportExportEverywhere && !this.inModule) {
this.raiseWithData(node.start, {
code: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
}, ErrorMessages.ImportOutsideModule);
}
}
takeDecorators(node) {
const decorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
if (decorators.length) {
node.decorators = decorators;
this.resetStartLocationFromNode(node, decorators[0]);
this.state.decoratorStack[this.state.decoratorStack.length - 1] = [];
}
}
canHaveLeadingDecorator() {
return this.match(types._class);
}
parseDecorators(allowExport) {
const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
while (this.match(types.at)) {
const decorator = this.parseDecorator();
currentContextDecorators.push(decorator);
}
if (this.match(types._export)) {
if (!allowExport) {
this.unexpected();
}
if (this.hasPlugin("decorators") && !this.getPluginOption("decorators", "decoratorsBeforeExport")) {
this.raise(this.state.start, ErrorMessages.DecoratorExportClass);
}
} else if (!this.canHaveLeadingDecorator()) {
throw this.raise(this.state.start, ErrorMessages.UnexpectedLeadingDecorator);
}
}
parseDecorator() {
this.expectOnePlugin(["decorators-legacy", "decorators"]);
const node = this.startNode();
this.next();
if (this.hasPlugin("decorators")) {
this.state.decoratorStack.push([]);
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let expr;
if (this.eat(types.parenL)) {
expr = this.parseExpression();
this.expect(types.parenR);
} else {
expr = this.parseIdentifier(false);
while (this.eat(types.dot)) {
const node = this.startNodeAt(startPos, startLoc);
node.object = expr;
node.property = this.parseIdentifier(true);
node.computed = false;
expr = this.finishNode(node, "MemberExpression");
}
}
node.expression = this.parseMaybeDecoratorArguments(expr);
this.state.decoratorStack.pop();
} else {
node.expression = this.parseExprSubscripts();
}
return this.finishNode(node, "Decorator");
}
parseMaybeDecoratorArguments(expr) {
if (this.eat(types.parenL)) {
const node = this.startNodeAtNode(expr);
node.callee = expr;
node.arguments = this.parseCallExpressionArguments(types.parenR, false);
this.toReferencedList(node.arguments);
return this.finishNode(node, "CallExpression");
}
return expr;
}
parseBreakContinueStatement(node, keyword) {
const isBreak = keyword === "break";
this.next();
if (this.isLineTerminator()) {
node.label = null;
} else {
node.label = this.parseIdentifier();
this.semicolon();
}
this.verifyBreakContinue(node, keyword);
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
}
verifyBreakContinue(node, keyword) {
const isBreak = keyword === "break";
let i;
for (i = 0; i < this.state.labels.length; ++i) {
const lab = this.state.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
if (node.label && isBreak) break;
}
}
if (i === this.state.labels.length) {
this.raise(node.start, ErrorMessages.IllegalBreakContinue, keyword);
}
}
parseDebuggerStatement(node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
}
parseHeaderExpression() {
this.expect(types.parenL);
const val = this.parseExpression();
this.expect(types.parenR);
return val;
}
parseDoStatement(node) {
this.next();
this.state.labels.push(loopLabel);
node.body = this.withTopicForbiddingContext(() => this.parseStatement("do"));
this.state.labels.pop();
this.expect(types._while);
node.test = this.parseHeaderExpression();
this.eat(types.semi);
return this.finishNode(node, "DoWhileStatement");
}
parseForStatement(node) {
this.next();
this.state.labels.push(loopLabel);
let awaitAt = -1;
if (this.isAwaitAllowed() && this.eatContextual("await")) {
awaitAt = this.state.lastTokStart;
}
this.scope.enter(SCOPE_OTHER);
this.expect(types.parenL);
if (this.match(types.semi)) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, null);
}
const isLet = this.isLet();
if (this.match(types._var) || this.match(types._const) || isLet) {
const init = this.startNode();
const kind = isLet ? "let" : this.state.value;
this.next();
this.parseVar(init, true, kind);
this.finishNode(init, "VariableDeclaration");
if ((this.match(types._in) || this.isContextual("of")) && init.declarations.length === 1) {
return this.parseForIn(node, init, awaitAt);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init);
}
const refExpressionErrors = new ExpressionErrors();
const init = this.parseExpression(true, refExpressionErrors);
if (this.match(types._in) || this.isContextual("of")) {
this.toAssignable(init);
const description = this.isContextual("of") ? "for-of statement" : "for-in statement";
this.checkLVal(init, undefined, undefined, description);
return this.parseForIn(node, init, awaitAt);
} else {
this.checkExpressionErrors(refExpressionErrors, true);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init);
}
parseFunctionStatement(node, isAsync, declarationPosition) {
this.next();
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), isAsync);
}
parseIfStatement(node) {
this.next();
node.test = this.parseHeaderExpression();
node.consequent = this.parseStatement("if");
node.alternate = this.eat(types._else) ? this.parseStatement("if") : null;
return this.finishNode(node, "IfStatement");
}
parseReturnStatement(node) {
if (!this.prodParam.hasReturn && !this.options.allowReturnOutsideFunction) {
this.raise(this.state.start, ErrorMessages.IllegalReturn);
}
this.next();
if (this.isLineTerminator()) {
node.argument = null;
} else {
node.argument = this.parseExpression();
this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
}
parseSwitchStatement(node) {
this.next();
node.discriminant = this.parseHeaderExpression();
const cases = node.cases = [];
this.expect(types.braceL);
this.state.labels.push(switchLabel);
this.scope.enter(SCOPE_OTHER);
let cur;
for (let sawDefault; !this.match(types.braceR);) {
if (this.match(types._case) || this.match(types._default)) {
const isCase = this.match(types._case);
if (cur) this.finishNode(cur, "SwitchCase");
cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) {
this.raise(this.state.lastTokStart, ErrorMessages.MultipleDefaultsInSwitch);
}
sawDefault = true;
cur.test = null;
}
this.expect(types.colon);
} else {
if (cur) {
cur.consequent.push(this.parseStatement(null));
} else {
this.unexpected();
}
}
}
this.scope.exit();
if (cur) this.finishNode(cur, "SwitchCase");
this.next();
this.state.labels.pop();
return this.finishNode(node, "SwitchStatement");
}
parseThrowStatement(node) {
this.next();
if (lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) {
this.raise(this.state.lastTokEnd, ErrorMessages.NewlineAfterThrow);
}
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
}
parseTryStatement(node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.match(types._catch)) {
const clause = this.startNode();
this.next();
if (this.match(types.parenL)) {
this.expect(types.parenL);
clause.param = this.parseBindingAtom();
const simple = clause.param.type === "Identifier";
this.scope.enter(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLVal(clause.param, BIND_LEXICAL, null, "catch clause");
this.expect(types.parenR);
} else {
clause.param = null;
this.scope.enter(SCOPE_OTHER);
}
clause.body = this.withTopicForbiddingContext(() => this.parseBlock(false, false));
this.scope.exit();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) {
this.raise(node.start, ErrorMessages.NoCatchOrFinally);
}
return this.finishNode(node, "TryStatement");
}
parseVarStatement(node, kind) {
this.next();
this.parseVar(node, false, kind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
}
parseWhileStatement(node) {
this.next();
node.test = this.parseHeaderExpression();
this.state.labels.push(loopLabel);
node.body = this.withTopicForbiddingContext(() => this.parseStatement("while"));
this.state.labels.pop();
return this.finishNode(node, "WhileStatement");
}
parseWithStatement(node) {
if (this.state.strict) {
this.raise(this.state.start, ErrorMessages.StrictWith);
}
this.next();
node.object = this.parseHeaderExpression();
node.body = this.withTopicForbiddingContext(() => this.parseStatement("with"));
return this.finishNode(node, "WithStatement");
}
parseEmptyStatement(node) {
this.next();
return this.finishNode(node, "EmptyStatement");
}
parseLabeledStatement(node, maybeName, expr, context) {
for (let _i2 = 0, _this$state$labels = this.state.labels; _i2 < _this$state$labels.length; _i2++) {
const label = _this$state$labels[_i2];
if (label.name === maybeName) {
this.raise(expr.start, ErrorMessages.LabelRedeclaration, maybeName);
}
}
const kind = this.state.type.isLoop ? "loop" : this.match(types._switch) ? "switch" : null;
for (let i = this.state.labels.length - 1; i >= 0; i--) {
const label = this.state.labels[i];
if (label.statementStart === node.start) {
label.statementStart = this.state.start;
label.kind = kind;
} else {
break;
}
}
this.state.labels.push({
name: maybeName,
kind: kind,
statementStart: this.state.start
});
node.body = this.parseStatement(context ? context.indexOf("label") === -1 ? context + "label" : context : "label");
this.state.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
}
parseExpressionStatement(node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
}
parseBlock(allowDirectives = false, createNewLexicalScope = true, afterBlockParse) {
const node = this.startNode();
this.expect(types.braceL);
if (createNewLexicalScope) {
this.scope.enter(SCOPE_OTHER);
}
this.parseBlockBody(node, allowDirectives, false, types.braceR, afterBlockParse);
if (createNewLexicalScope) {
this.scope.exit();
}
return this.finishNode(node, "BlockStatement");
}
isValidDirective(stmt) {
return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
}
parseBlockBody(node, allowDirectives, topLevel, end, afterBlockParse) {
const body = node.body = [];
const directives = node.directives = [];
this.parseBlockOrModuleBlockBody(body, allowDirectives ? directives : undefined, topLevel, end, afterBlockParse);
}
parseBlockOrModuleBlockBody(body, directives, topLevel, end, afterBlockParse) {
const octalPositions = [];
const oldStrict = this.state.strict;
let hasStrictModeDirective = false;
let parsedNonDirective = false;
while (!this.match(end)) {
if (!parsedNonDirective && this.state.octalPositions.length) {
octalPositions.push(...this.state.octalPositions);
}
const stmt = this.parseStatement(null, topLevel);
if (directives && !parsedNonDirective && this.isValidDirective(stmt)) {
const directive = this.stmtToDirective(stmt);
directives.push(directive);
if (!hasStrictModeDirective && directive.value.value === "use strict") {
hasStrictModeDirective = true;
this.setStrict(true);
}
continue;
}
parsedNonDirective = true;
body.push(stmt);
}
if (this.state.strict && octalPositions.length) {
for (let _i3 = 0; _i3 < octalPositions.length; _i3++) {
const pos = octalPositions[_i3];
this.raise(pos, ErrorMessages.StrictOctalLiteral);
}
}
if (afterBlockParse) {
afterBlockParse.call(this, hasStrictModeDirective);
}
if (!oldStrict) {
this.setStrict(false);
}
this.next();
}
parseFor(node, init) {
node.init = init;
this.expect(types.semi);
node.test = this.match(types.semi) ? null : this.parseExpression();
this.expect(types.semi);
node.update = this.match(types.parenR) ? null : this.parseExpression();
this.expect(types.parenR);
node.body = this.withTopicForbiddingContext(() => this.parseStatement("for"));
this.scope.exit();
this.state.labels.pop();
return this.finishNode(node, "ForStatement");
}
parseForIn(node, init, awaitAt) {
const isForIn = this.match(types._in);
this.next();
if (isForIn) {
if (awaitAt > -1) this.unexpected(awaitAt);
} else {
node.await = awaitAt > -1;
}
if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.state.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) {
this.raise(init.start, ErrorMessages.ForInOfLoopInitializer, isForIn ? "for-in" : "for-of");
} else if (init.type === "AssignmentPattern") {
this.raise(init.start, ErrorMessages.InvalidLhs, "for-loop");
}
node.left = init;
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
this.expect(types.parenR);
node.body = this.withTopicForbiddingContext(() => this.parseStatement("for"));
this.scope.exit();
this.state.labels.pop();
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
}
parseVar(node, isFor, kind) {
const declarations = node.declarations = [];
const isTypescript = this.hasPlugin("typescript");
node.kind = kind;
for (;;) {
const decl = this.startNode();
this.parseVarId(decl, kind);
if (this.eat(types.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else {
if (kind === "const" && !(this.match(types._in) || this.isContextual("of"))) {
if (!isTypescript) {
this.unexpected();
}
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(types._in) || this.isContextual("of")))) {
this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Complex binding patterns");
}
decl.init = null;
}
declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(types.comma)) break;
}
return node;
}
parseVarId(decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, undefined, "variable declaration", kind !== "var");
}
parseFunction(node, statement = FUNC_NO_FLAGS, isAsync = false) {
const isStatement = statement & FUNC_STATEMENT;
const isHangingStatement = statement & FUNC_HANGING_STATEMENT;
const requireId = !!isStatement && !(statement & FUNC_NULLABLE_ID);
this.initFunction(node, isAsync);
if (this.match(types.star) && isHangingStatement) {
this.raise(this.state.start, ErrorMessages.GeneratorInSingleStatementContext);
}
node.generator = this.eat(types.star);
if (isStatement) {
node.id = this.parseFunctionId(requireId);
}
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldYieldPos = this.state.yieldPos;
const oldAwaitPos = this.state.awaitPos;
this.state.maybeInArrowParameters = false;
this.state.yieldPos = -1;
this.state.awaitPos = -1;
this.scope.enter(SCOPE_FUNCTION);
this.prodParam.enter(functionFlags(isAsync, node.generator));
if (!isStatement) {
node.id = this.parseFunctionId();
}
this.parseFunctionParams(node);
this.withTopicForbiddingContext(() => {
this.parseFunctionBodyAndFinish(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
});
this.prodParam.exit();
this.scope.exit();
if (isStatement && !isHangingStatement) {
this.registerFunctionStatementId(node);
}
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
this.state.yieldPos = oldYieldPos;
this.state.awaitPos = oldAwaitPos;
return node;
}
parseFunctionId(requireId) {
return requireId || this.match(types.name) ? this.parseIdentifier() : null;
}
parseFunctionParams(node, allowModifiers) {
const oldInParameters = this.state.inParameters;
this.state.inParameters = true;
this.expect(types.parenL);
node.params = this.parseBindingList(types.parenR, 41, false, allowModifiers);
this.state.inParameters = oldInParameters;
this.checkYieldAwaitInDefaultParams();
}
registerFunctionStatementId(node) {
if (!node.id) return;
this.scope.declareName(node.id.name, this.state.strict || node.generator || node.async ? this.scope.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION, node.id.start);
}
parseClass(node, isStatement, optionalId) {
this.next();
this.takeDecorators(node);
const oldStrict = this.state.strict;
this.state.strict = true;
this.parseClassId(node, isStatement, optionalId);
this.parseClassSuper(node);
node.body = this.parseClassBody(!!node.superClass, oldStrict);
this.state.strict = oldStrict;
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
}
isClassProperty() {
return this.match(types.eq) || this.match(types.semi) || this.match(types.braceR);
}
isClassMethod() {
return this.match(types.parenL);
}
isNonstaticConstructor(method) {
return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
}
parseClassBody(constructorAllowsSuper, oldStrict) {
this.classScope.enter();
const state = {
hadConstructor: false
};
let decorators = [];
const classBody = this.startNode();
classBody.body = [];
this.expect(types.braceL);
this.withTopicForbiddingContext(() => {
while (!this.match(types.braceR)) {
if (this.eat(types.semi)) {
if (decorators.length > 0) {
throw this.raise(this.state.lastTokEnd, ErrorMessages.DecoratorSemicolon);
}
continue;
}
if (this.match(types.at)) {
decorators.push(this.parseDecorator());
continue;
}
const member = this.startNode();
if (decorators.length) {
member.decorators = decorators;
this.resetStartLocationFromNode(member, decorators[0]);
decorators = [];
}
this.parseClassMember(classBody, member, state, constructorAllowsSuper);
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
this.raise(member.start, ErrorMessages.DecoratorConstructor);
}
}
});
if (!oldStrict) {
this.state.strict = false;
}
this.next();
if (decorators.length) {
throw this.raise(this.state.start, ErrorMessages.TrailingDecorator);
}
this.classScope.exit();
return this.finishNode(classBody, "ClassBody");
}
parseClassMemberFromModifier(classBody, member) {
const containsEsc = this.state.containsEsc;
const key = this.parseIdentifier(true);
if (this.isClassMethod()) {
const method = member;
method.kind = "method";
method.computed = false;
method.key = key;
method.static = false;
this.pushClassMethod(classBody, method, false, false, false, false);
return true;
} else if (this.isClassProperty()) {
const prop = member;
prop.computed = false;
prop.key = key;
prop.static = false;
classBody.body.push(this.parseClassProperty(prop));
return true;
} else if (containsEsc) {
throw this.unexpected();
}
return false;
}
parseClassMember(classBody, member, state, constructorAllowsSuper) {
const isStatic = this.isContextual("static");
if (isStatic && this.parseClassMemberFromModifier(classBody, member)) {
return;
}
this.parseClassMemberWithIsStatic(classBody, member, state, isStatic, constructorAllowsSuper);
}
parseClassMemberWithIsStatic(classBody, member, state, isStatic, constructorAllowsSuper) {
const publicMethod = member;
const privateMethod = member;
const publicProp = member;
const privateProp = member;
const method = publicMethod;
const publicMember = publicMethod;
member.static = isStatic;
if (this.eat(types.star)) {
method.kind = "method";
this.parseClassPropertyName(method);
if (method.key.type === "PrivateName") {
this.pushClassPrivateMethod(classBody, privateMethod, true, false);
return;
}
if (this.isNonstaticConstructor(publicMethod)) {
this.raise(publicMethod.key.start, ErrorMessages.ConstructorIsGenerator);
}
this.pushClassMethod(classBody, publicMethod, true, false, false, false);
return;
}
const containsEsc = this.state.containsEsc;
const key = this.parseClassPropertyName(member);
const isPrivate = key.type === "PrivateName";
const isSimple = key.type === "Identifier";
const maybeQuestionTokenStart = this.state.start;
this.parsePostMemberNameModifiers(publicMember);
if (this.isClassMethod()) {
method.kind = "method";
if (isPrivate) {
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
return;
}
const isConstructor = this.isNonstaticConstructor(publicMethod);
let allowsDirectSuper = false;
if (isConstructor) {
publicMethod.kind = "constructor";
if (state.hadConstructor && !this.hasPlugin("typescript")) {
this.raise(key.start, ErrorMessages.DuplicateConstructor);
}
state.hadConstructor = true;
allowsDirectSuper = constructorAllowsSuper;
}
this.pushClassMethod(classBody, publicMethod, false, false, isConstructor, allowsDirectSuper);
} else if (this.isClassProperty()) {
if (isPrivate) {
this.pushClassPrivateProperty(classBody, privateProp);
} else {
this.pushClassProperty(classBody, publicProp);
}
} else if (isSimple && key.name === "async" && !containsEsc && !this.isLineTerminator()) {
const isGenerator = this.eat(types.star);
if (publicMember.optional) {
this.unexpected(maybeQuestionTokenStart);
}
method.kind = "method";
this.parseClassPropertyName(method);
this.parsePostMemberNameModifiers(publicMember);
if (method.key.type === "PrivateName") {
this.pushClassPrivateMethod(classBody, privateMethod, isGenerator, true);
} else {
if (this.isNonstaticConstructor(publicMethod)) {
this.raise(publicMethod.key.start, ErrorMessages.ConstructorIsAsync);
}
this.pushClassMethod(classBody, publicMethod, isGenerator, true, false, false);
}
} else if (isSimple && (key.name === "get" || key.name === "set") && !containsEsc && !(this.match(types.star) && this.isLineTerminator())) {
method.kind = key.name;
this.parseClassPropertyName(publicMethod);
if (method.key.type === "PrivateName") {
this.pushClassPrivateMethod(classBody, privateMethod, false, false);
} else {
if (this.isNonstaticConstructor(publicMethod)) {
this.raise(publicMethod.key.start, ErrorMessages.ConstructorIsAccessor);
}
this.pushClassMethod(classBody, publicMethod, false, false, false, false);
}
this.checkGetterSetterParams(publicMethod);
} else if (this.isLineTerminator()) {
if (isPrivate) {
this.pushClassPrivateProperty(classBody, privateProp);
} else {
this.pushClassProperty(classBody, publicProp);
}
} else {
this.unexpected();
}
}
parseClassPropertyName(member) {
const key = this.parsePropertyName(member, true);
if (!member.computed && member.static && (key.name === "prototype" || key.value === "prototype")) {
this.raise(key.start, ErrorMessages.StaticPrototype);
}
if (key.type === "PrivateName" && key.id.name === "constructor") {
this.raise(key.start, ErrorMessages.ConstructorClassPrivateField);
}
return key;
}
pushClassProperty(classBody, prop) {
if (!prop.computed && (prop.key.name === "constructor" || prop.key.value === "constructor")) {
this.raise(prop.key.start, ErrorMessages.ConstructorClassField);
}
classBody.body.push(this.parseClassProperty(prop));
}
pushClassPrivateProperty(classBody, prop) {
this.expectPlugin("classPrivateProperties", prop.key.start);
const node = this.parseClassPrivateProperty(prop);
classBody.body.push(node);
this.classScope.declarePrivateName(node.key.id.name, CLASS_ELEMENT_OTHER, node.key.start);
}
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
classBody.body.push(this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true));
}
pushClassPrivateMethod(classBody, method, isGenerator, isAsync) {
this.expectPlugin("classPrivateMethods", method.key.start);
const node = this.parseMethod(method, isGenerator, isAsync, false, false, "ClassPrivateMethod", true);
classBody.body.push(node);
const kind = node.kind === "get" ? node.static ? CLASS_ELEMENT_STATIC_GETTER : CLASS_ELEMENT_INSTANCE_GETTER : node.kind === "set" ? node.static ? CLASS_ELEMENT_STATIC_SETTER : CLASS_ELEMENT_INSTANCE_SETTER : CLASS_ELEMENT_OTHER;
this.classScope.declarePrivateName(node.key.id.name, kind, node.key.start);
}
parsePostMemberNameModifiers(methodOrProp) {}
parseAccessModifier() {
return undefined;
}
parseClassPrivateProperty(node) {
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
this.prodParam.enter(PARAM);
node.value = this.eat(types.eq) ? this.parseMaybeAssign() : null;
this.semicolon();
this.prodParam.exit();
this.scope.exit();
return this.finishNode(node, "ClassPrivateProperty");
}
parseClassProperty(node) {
if (!node.typeAnnotation) {
this.expectPlugin("classProperties");
}
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
this.prodParam.enter(PARAM);
if (this.match(types.eq)) {
this.expectPlugin("classProperties");
this.next();
node.value = this.parseMaybeAssign();
} else {
node.value = null;
}
this.semicolon();
this.prodParam.exit();
this.scope.exit();
return this.finishNode(node, "ClassProperty");
}
parseClassId(node, isStatement, optionalId, bindingType = BIND_CLASS) {
if (this.match(types.name)) {
node.id = this.parseIdentifier();
if (isStatement) {
this.checkLVal(node.id, bindingType, undefined, "class name");
}
} else {
if (optionalId || !isStatement) {
node.id = null;
} else {
this.unexpected(null, ErrorMessages.MissingClassName);
}
}
}
parseClassSuper(node) {
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
}
parseExport(node) {
const hasDefault = this.maybeParseExportDefaultSpecifier(node);
const parseAfterDefault = !hasDefault || this.eat(types.comma);
const hasStar = parseAfterDefault && this.eatExportStar(node);
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(types.comma));
const isFromRequired = hasDefault || hasStar;
if (hasStar && !hasNamespace) {
if (hasDefault) this.unexpected();
this.parseExportFrom(node, true);
return this.finishNode(node, "ExportAllDeclaration");
}
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
if (hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers || hasNamespace && parseAfterNamespace && !hasSpecifiers) {
throw this.unexpected(null, types.braceL);
}
let hasDeclaration;
if (isFromRequired || hasSpecifiers) {
hasDeclaration = false;
this.parseExportFrom(node, isFromRequired);
} else {
hasDeclaration = this.maybeParseExportDeclaration(node);
}
if (isFromRequired || hasSpecifiers || hasDeclaration) {
this.checkExport(node, true, false, !!node.source);
return this.finishNode(node, "ExportNamedDeclaration");
}
if (this.eat(types._default)) {
node.declaration = this.parseExportDefaultExpression();
this.checkExport(node, true, true);
return this.finishNode(node, "ExportDefaultDeclaration");
}
throw this.unexpected(null, types.braceL);
}
eatExportStar(node) {
return this.eat(types.star);
}
maybeParseExportDefaultSpecifier(node) {
if (this.isExportDefaultSpecifier()) {
this.expectPlugin("exportDefaultFrom");
const specifier = this.startNode();
specifier.exported = this.parseIdentifier(true);
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
return true;
}
return false;
}
maybeParseExportNamespaceSpecifier(node) {
if (this.isContextual("as")) {
if (!node.specifiers) node.specifiers = [];
const specifier = this.startNodeAt(this.state.lastTokStart, this.state.lastTokStartLoc);
this.next();
specifier.exported = this.parseIdentifier(true);
node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"));
return true;
}
return false;
}
maybeParseExportNamedSpecifiers(node) {
if (this.match(types.braceL)) {
if (!node.specifiers) node.specifiers = [];
node.specifiers.push(...this.parseExportSpecifiers());
node.source = null;
node.declaration = null;
return true;
}
return false;
}
maybeParseExportDeclaration(node) {
if (this.shouldParseExportDeclaration()) {
if (this.isContextual("async")) {
const next = this.nextTokenStart();
if (!this.isUnparsedContextual(next, "function")) {
this.unexpected(next, types._function);
}
}
node.specifiers = [];
node.source = null;
node.declaration = this.parseExportDeclaration(node);
return true;
}
return false;
}
isAsyncFunction() {
if (!this.isContextual("async")) return false;
const next = this.nextTokenStart();
return !lineBreak.test(this.input.slice(this.state.pos, next)) && this.isUnparsedContextual(next, "function");
}
parseExportDefaultExpression() {
const expr = this.startNode();
const isAsync = this.isAsyncFunction();
if (this.match(types._function) || isAsync) {
this.next();
if (isAsync) {
this.next();
}
return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync);
} else if (this.match(types._class)) {
return this.parseClass(expr, true, true);
} else if (this.match(types.at)) {
if (this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport")) {
this.raise(this.state.start, ErrorMessages.DecoratorBeforeExport);
}
this.parseDecorators(false);
return this.parseClass(expr, true, true);
} else if (this.match(types._const) || this.match(types._var) || this.isLet()) {
throw this.raise(this.state.start, ErrorMessages.UnsupportedDefaultExport);
} else {
const res = this.parseMaybeAssign();
this.semicolon();
return res;
}
}
parseExportDeclaration(node) {
return this.parseStatement(null);
}
isExportDefaultSpecifier() {
if (this.match(types.name)) {
const value = this.state.value;
if (value === "async" || value === "let") {
return false;
}
if ((value === "type" || value === "interface") && !this.state.containsEsc) {
const l = this.lookahead();
if (l.type === types.name && l.value !== "from" || l.type === types.braceL) {
this.expectOnePlugin(["flow", "typescript"]);
return false;
}
}
} else if (!this.match(types._default)) {
return false;
}
const next = this.nextTokenStart();
const hasFrom = this.isUnparsedContextual(next, "from");
if (this.input.charCodeAt(next) === 44 || this.match(types.name) && hasFrom) {
return true;
}
if (this.match(types._default) && hasFrom) {
const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4));
return nextAfterFrom === 34 || nextAfterFrom === 39;
}
return false;
}
parseExportFrom(node, expect) {
if (this.eatContextual("from")) {
node.source = this.parseImportSource();
this.checkExport(node);
} else {
if (expect) {
this.unexpected();
} else {
node.source = null;
}
}
this.semicolon();
}
shouldParseExportDeclaration() {
if (this.match(types.at)) {
this.expectOnePlugin(["decorators", "decorators-legacy"]);
if (this.hasPlugin("decorators")) {
if (this.getPluginOption("decorators", "decoratorsBeforeExport")) {
this.unexpected(this.state.start, ErrorMessages.DecoratorBeforeExport);
} else {
return true;
}
}
}
return this.state.type.keyword === "var" || this.state.type.keyword === "const" || this.state.type.keyword === "function" || this.state.type.keyword === "class" || this.isLet() || this.isAsyncFunction();
}
checkExport(node, checkNames, isDefault, isFrom) {
if (checkNames) {
if (isDefault) {
this.checkDuplicateExports(node, "default");
if (this.hasPlugin("exportDefaultFrom")) {
var _declaration$extra;
const declaration = node.declaration;
if (declaration.type === "Identifier" && declaration.name === "from" && declaration.end - declaration.start === 4 && !((_declaration$extra = declaration.extra) == null ? void 0 : _declaration$extra.parenthesized)) {
this.raise(declaration.start, ErrorMessages.ExportDefaultFromAsIdentifier);
}
}
} else if (node.specifiers && node.specifiers.length) {
for (let _i4 = 0, _node$specifiers = node.specifiers; _i4 < _node$specifiers.length; _i4++) {
const specifier = _node$specifiers[_i4];
this.checkDuplicateExports(specifier, specifier.exported.name);
if (!isFrom && specifier.local) {
this.checkReservedWord(specifier.local.name, specifier.local.start, true, false);
this.scope.checkLocalExport(specifier.local);
}
}
} else if (node.declaration) {
if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
const id = node.declaration.id;
if (!id) throw new Error("Assertion failure");
this.checkDuplicateExports(node, id.name);
} else if (node.declaration.type === "VariableDeclaration") {
for (let _i5 = 0, _node$declaration$dec = node.declaration.declarations; _i5 < _node$declaration$dec.length; _i5++) {
const declaration = _node$declaration$dec[_i5];
this.checkDeclaration(declaration.id);
}
}
}
}
const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
if (currentContextDecorators.length) {
const isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression");
if (!node.declaration || !isClass) {
throw this.raise(node.start, ErrorMessages.UnsupportedDecoratorExport);
}
this.takeDecorators(node.declaration);
}
}
checkDeclaration(node) {
if (node.type === "Identifier") {
this.checkDuplicateExports(node, node.name);
} else if (node.type === "ObjectPattern") {
for (let _i6 = 0, _node$properties = node.properties; _i6 < _node$properties.length; _i6++) {
const prop = _node$properties[_i6];
this.checkDeclaration(prop);
}
} else if (node.type === "ArrayPattern") {
for (let _i7 = 0, _node$elements = node.elements; _i7 < _node$elements.length; _i7++) {
const elem = _node$elements[_i7];
if (elem) {
this.checkDeclaration(elem);
}
}
} else if (node.type === "ObjectProperty") {
this.checkDeclaration(node.value);
} else if (node.type === "RestElement") {
this.checkDeclaration(node.argument);
} else if (node.type === "AssignmentPattern") {
this.checkDeclaration(node.left);
}
}
checkDuplicateExports(node, name) {
if (this.state.exportedIdentifiers.indexOf(name) > -1) {
this.raise(node.start, name === "default" ? ErrorMessages.DuplicateDefaultExport : ErrorMessages.DuplicateExport, name);
}
this.state.exportedIdentifiers.push(name);
}
parseExportSpecifiers() {
const nodes = [];
let first = true;
this.expect(types.braceL);
while (!this.eat(types.braceR)) {
if (first) {
first = false;
} else {
this.expect(types.comma);
if (this.eat(types.braceR)) break;
}
const node = this.startNode();
node.local = this.parseIdentifier(true);
node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone();
nodes.push(this.finishNode(node, "ExportSpecifier"));
}
return nodes;
}
parseImport(node) {
node.specifiers = [];
if (!this.match(types.string)) {
const hasDefault = this.maybeParseDefaultImportSpecifier(node);
const parseNext = !hasDefault || this.eat(types.comma);
const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
this.expectContextual("from");
}
node.source = this.parseImportSource();
const attributes = this.maybeParseModuleAttributes();
if (attributes) {
node.attributes = attributes;
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
parseImportSource() {
if (!this.match(types.string)) this.unexpected();
return this.parseExprAtom();
}
shouldParseDefaultImport(node) {
return this.match(types.name);
}
parseImportSpecifierLocal(node, specifier, type, contextDescription) {
specifier.local = this.parseIdentifier();
this.checkLVal(specifier.local, BIND_LEXICAL, undefined, contextDescription);
node.specifiers.push(this.finishNode(specifier, type));
}
maybeParseModuleAttributes() {
if (this.match(types._with) && !this.hasPrecedingLineBreak()) {
this.expectPlugin("moduleAttributes");
this.next();
} else {
if (this.hasPlugin("moduleAttributes")) return [];
return null;
}
const attrs = [];
const attributes = new Set();
do {
const node = this.startNode();
node.key = this.parseIdentifier(true);
if (node.key.name !== "type") {
this.raise(node.key.start, ErrorMessages.ModuleAttributeDifferentFromType, node.key.name);
}
if (attributes.has(node.key.name)) {
this.raise(node.key.start, ErrorMessages.ModuleAttributesWithDuplicateKeys, node.key.name);
}
attributes.add(node.key.name);
this.expect(types.colon);
if (!this.match(types.string)) {
throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
}
node.value = this.parseLiteral(this.state.value, "StringLiteral");
this.finishNode(node, "ImportAttribute");
attrs.push(node);
} while (this.eat(types.comma));
return attrs;
}
maybeParseDefaultImportSpecifier(node) {
if (this.shouldParseDefaultImport(node)) {
this.parseImportSpecifierLocal(node, this.startNode(), "ImportDefaultSpecifier", "default import specifier");
return true;
}
return false;
}
maybeParseStarImportSpecifier(node) {
if (this.match(types.star)) {
const specifier = this.startNode();
this.next();
this.expectContextual("as");
this.parseImportSpecifierLocal(node, specifier, "ImportNamespaceSpecifier", "import namespace specifier");
return true;
}
return false;
}
parseNamedImportSpecifiers(node) {
let first = true;
this.expect(types.braceL);
while (!this.eat(types.braceR)) {
if (first) {
first = false;
} else {
if (this.eat(types.colon)) {
throw this.raise(this.state.start, ErrorMessages.DestructureNamedImport);
}
this.expect(types.comma);
if (this.eat(types.braceR)) break;
}
this.parseImportSpecifier(node);
}
}
parseImportSpecifier(node) {
const specifier = this.startNode();
specifier.imported = this.parseIdentifier(true);
if (this.eatContextual("as")) {
specifier.local = this.parseIdentifier();
} else {
this.checkReservedWord(specifier.imported.name, specifier.start, true, true);
specifier.local = specifier.imported.__clone();
}
this.checkLVal(specifier.local, BIND_LEXICAL, undefined, "import specifier");
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
}
}
class ClassScope {
constructor() {
this.privateNames = new Set();
this.loneAccessors = new Map();
this.undefinedPrivateNames = new Map();
}
}
class ClassScopeHandler {
constructor(raise) {
this.stack = [];
this.undefinedPrivateNames = new Map();
this.raise = raise;
}
current() {
return this.stack[this.stack.length - 1];
}
enter() {
this.stack.push(new ClassScope());
}
exit() {
const oldClassScope = this.stack.pop();
const current = this.current();
for (let _i = 0, _Array$from = Array.from(oldClassScope.undefinedPrivateNames); _i < _Array$from.length; _i++) {
const [name, pos] = _Array$from[_i];
if (current) {
if (!current.undefinedPrivateNames.has(name)) {
current.undefinedPrivateNames.set(name, pos);
}
} else {
this.raise(pos, ErrorMessages.InvalidPrivateFieldResolution, name);
}
}
}
declarePrivateName(name, elementType, pos) {
const classScope = this.current();
let redefined = classScope.privateNames.has(name);
if (elementType & CLASS_ELEMENT_KIND_ACCESSOR) {
const accessor = redefined && classScope.loneAccessors.get(name);
if (accessor) {
const oldStatic = accessor & CLASS_ELEMENT_FLAG_STATIC;
const newStatic = elementType & CLASS_ELEMENT_FLAG_STATIC;
const oldKind = accessor & CLASS_ELEMENT_KIND_ACCESSOR;
const newKind = elementType & CLASS_ELEMENT_KIND_ACCESSOR;
redefined = oldKind === newKind || oldStatic !== newStatic;
if (!redefined) classScope.loneAccessors.delete(name);
} else if (!redefined) {
classScope.loneAccessors.set(name, elementType);
}
}
if (redefined) {
this.raise(pos, ErrorMessages.PrivateNameRedeclaration, name);
}
classScope.privateNames.add(name);
classScope.undefinedPrivateNames.delete(name);
}
usePrivateName(name, pos) {
let classScope;
for (let _i2 = 0, _this$stack = this.stack; _i2 < _this$stack.length; _i2++) {
classScope = _this$stack[_i2];
if (classScope.privateNames.has(name)) return;
}
if (classScope) {
classScope.undefinedPrivateNames.set(name, pos);
} else {
this.raise(pos, ErrorMessages.InvalidPrivateFieldResolution, name);
}
}
}
class Parser extends StatementParser {
constructor(options, input) {
options = getOptions(options);
super(options, input);
const ScopeHandler = this.getScopeHandler();
this.options = options;
this.inModule = this.options.sourceType === "module";
this.scope = new ScopeHandler(this.raise.bind(this), this.inModule);
this.prodParam = new ProductionParameterHandler();
this.classScope = new ClassScopeHandler(this.raise.bind(this));
this.plugins = pluginsMap(this.options.plugins);
this.filename = options.sourceFilename;
}
getScopeHandler() {
return ScopeHandler;
}
parse() {
let paramFlags = PARAM;
if (this.hasPlugin("topLevelAwait") && this.inModule) {
paramFlags |= PARAM_AWAIT;
}
this.scope.enter(SCOPE_PROGRAM);
this.prodParam.enter(paramFlags);
const file = this.startNode();
const program = this.startNode();
this.nextToken();
file.errors = null;
this.parseTopLevel(file, program);
file.errors = this.state.errors;
return file;
}
}
function pluginsMap(plugins) {
const pluginMap = new Map();
for (let _i = 0; _i < plugins.length; _i++) {
const plugin = plugins[_i];
const [name, options] = Array.isArray(plugin) ? plugin : [plugin, {}];
if (!pluginMap.has(name)) pluginMap.set(name, options || {});
}
return pluginMap;
}
function parse(input, options) {
var _options;
if (((_options = options) == null ? void 0 : _options.sourceType) === "unambiguous") {
options = Object.assign({}, options);
try {
options.sourceType = "module";
const parser = getParser(options, input);
const ast = parser.parse();
if (parser.sawUnambiguousESM) {
return ast;
}
if (parser.ambiguousScriptDifferentAst) {
try {
options.sourceType = "script";
return getParser(options, input).parse();
} catch (_unused) {}
} else {
ast.program.sourceType = "script";
}
return ast;
} catch (moduleError) {
try {
options.sourceType = "script";
return getParser(options, input).parse();
} catch (_unused2) {}
throw moduleError;
}
} else {
return getParser(options, input).parse();
}
}
function parseExpression(input, options) {
const parser = getParser(options, input);
if (parser.options.strictMode) {
parser.state.strict = true;
}
return parser.getExpression();
}
function getParser(options, input) {
let cls = Parser;
if (options == null ? void 0 : options.plugins) {
validatePlugins(options.plugins);
cls = getParserClass(options.plugins);
}
return new cls(options, input);
}
const parserClassCache = {};
function getParserClass(pluginsFromOptions) {
const pluginList = mixinPluginNames.filter(name => hasPlugin(pluginsFromOptions, name));
const key = pluginList.join("/");
let cls = parserClassCache[key];
if (!cls) {
cls = Parser;
for (let _i = 0; _i < pluginList.length; _i++) {
const plugin = pluginList[_i];
cls = mixinPlugins[plugin](cls);
}
parserClassCache[key] = cls;
}
return cls;
}
exports.parse = parse;
exports.parseExpression = parseExpression;
exports.tokTypes = types;
//# sourceMappingURL=index.js.map
/***/ }),
/* 686 */
/***/ (function(module, exports, __webpack_require__) {
var baseKeys = __webpack_require__(656),
getTag = __webpack_require__(578),
isArguments = __webpack_require__(618),
isArray = __webpack_require__(563),
isArrayLike = __webpack_require__(599),
isBuffer = __webpack_require__(595),
isPrototype = __webpack_require__(598),
isTypedArray = __webpack_require__(621);
/** `Object#toString` result references. */
var mapTag = '[object Map]',
setTag = '[object Set]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* jQuery-like collections are considered empty if they have a `length` of `0`.
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
* @example
*
* _.isEmpty(null);
* // => true
*
* _.isEmpty(true);
* // => true
*
* _.isEmpty(1);
* // => true
*
* _.isEmpty([1, 2, 3]);
* // => false
*
* _.isEmpty({ 'a': 1 });
* // => false
*/
function isEmpty(value) {
if (value == null) {
return true;
}
if (isArrayLike(value) &&
(isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
return !value.length;
}
var tag = getTag(value);
if (tag == mapTag || tag == setTag) {
return !value.size;
}
if (isPrototype(value)) {
return !baseKeys(value).length;
}
for (var key in value) {
if (hasOwnProperty.call(value, key)) {
return false;
}
}
return true;
}
module.exports = isEmpty;
/***/ }),
/* 687 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.setSource = setSource;
exports.getSource = getSource;
exports.clearSources = clearSources;
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
const cachedSources = new Map();
function setSource(source) {
cachedSources.set(source.id, source);
}
function getSource(sourceId) {
const source = cachedSources.get(sourceId);
if (!source) {
throw new Error(`Parser: source ${sourceId} was not provided.`);
}
return source;
}
function clearSources() {
cachedSources.clear();
}
/***/ }),
/* 688 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsParens = needsParens;
var whitespace = _interopRequireWildcard(__webpack_require__(850));
var parens = _interopRequireWildcard(__webpack_require__(851));
var t = _interopRequireWildcard(__webpack_require__(2));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function expandAliases(obj) {
const newObj = {};
function add(type, func) {
const fn = newObj[type];
newObj[type] = fn ? function (node, parent, stack) {
const result = fn(node, parent, stack);
return result == null ? func(node, parent, stack) : result;
} : func;
}
for (const type of Object.keys(obj)) {
const aliases = t.FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (const alias of aliases) {
add(alias, obj[type]);
}
} else {
add(type, obj[type]);
}
}
return newObj;
}
const expandedParens = expandAliases(parens);
const expandedWhitespaceNodes = expandAliases(whitespace.nodes);
const expandedWhitespaceList = expandAliases(whitespace.list);
function find(obj, node, parent, printStack) {
const fn = obj[node.type];
return fn ? fn(node, parent, printStack) : null;
}
function isOrHasCallExpression(node) {
if (t.isCallExpression(node)) {
return true;
}
return t.isMemberExpression(node) && isOrHasCallExpression(node.object);
}
function needsWhitespace(node, parent, type) {
if (!node) return 0;
if (t.isExpressionStatement(node)) {
node = node.expression;
}
let linesInfo = find(expandedWhitespaceNodes, node, parent);
if (!linesInfo) {
const items = find(expandedWhitespaceList, node, parent);
if (items) {
for (let i = 0; i < items.length; i++) {
linesInfo = needsWhitespace(items[i], node, type);
if (linesInfo) break;
}
}
}
if (typeof linesInfo === "object" && linesInfo !== null) {
return linesInfo[type] || 0;
}
return 0;
}
function needsWhitespaceBefore(node, parent) {
return needsWhitespace(node, parent, "before");
}
function needsWhitespaceAfter(node, parent) {
return needsWhitespace(node, parent, "after");
}
function needsParens(node, parent, printStack) {
if (!parent) return false;
if (t.isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
return find(expandedParens, node, parent, printStack);
}
/***/ }),
/* 689 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ImportSpecifier = ImportSpecifier;
exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
exports.ExportSpecifier = ExportSpecifier;
exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
exports.ExportAllDeclaration = ExportAllDeclaration;
exports.ExportNamedDeclaration = ExportNamedDeclaration;
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
exports.ImportDeclaration = ImportDeclaration;
exports.ImportAttribute = ImportAttribute;
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
var t = _interopRequireWildcard(__webpack_require__(2));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ImportSpecifier(node) {
if (node.importKind === "type" || node.importKind === "typeof") {
this.word(node.importKind);
this.space();
}
this.print(node.imported, node);
if (node.local && node.local.name !== node.imported.name) {
this.space();
this.word("as");
this.space();
this.print(node.local, node);
}
}
function ImportDefaultSpecifier(node) {
this.print(node.local, node);
}
function ExportDefaultSpecifier(node) {
this.print(node.exported, node);
}
function ExportSpecifier(node) {
this.print(node.local, node);
if (node.exported && node.local.name !== node.exported.name) {
this.space();
this.word("as");
this.space();
this.print(node.exported, node);
}
}
function ExportNamespaceSpecifier(node) {
this.token("*");
this.space();
this.word("as");
this.space();
this.print(node.exported, node);
}
function ExportAllDeclaration(node) {
this.word("export");
this.space();
if (node.exportKind === "type") {
this.word("type");
this.space();
}
this.token("*");
this.space();
this.word("from");
this.space();
this.print(node.source, node);
this.semicolon();
}
function ExportNamedDeclaration(node) {
if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);
}
this.word("export");
this.space();
ExportDeclaration.apply(this, arguments);
}
function ExportDefaultDeclaration(node) {
if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node);
}
this.word("export");
this.space();
this.word("default");
this.space();
ExportDeclaration.apply(this, arguments);
}
function ExportDeclaration(node) {
if (node.declaration) {
const declar = node.declaration;
this.print(declar, node);
if (!t.isStatement(declar)) this.semicolon();
} else {
if (node.exportKind === "type") {
this.word("type");
this.space();
}
const specifiers = node.specifiers.slice(0);
let hasSpecial = false;
for (;;) {
const first = specifiers[0];
if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
hasSpecial = true;
this.print(specifiers.shift(), node);
if (specifiers.length) {
this.token(",");
this.space();
}
} else {
break;
}
}
if (specifiers.length || !specifiers.length && !hasSpecial) {
this.token("{");
if (specifiers.length) {
this.space();
this.printList(specifiers, node);
this.space();
}
this.token("}");
}
if (node.source) {
this.space();
this.word("from");
this.space();
this.print(node.source, node);
}
this.semicolon();
}
}
function ImportDeclaration(node) {
var _node$attributes;
this.word("import");
this.space();
if (node.importKind === "type" || node.importKind === "typeof") {
this.word(node.importKind);
this.space();
}
const specifiers = node.specifiers.slice(0);
if (specifiers == null ? void 0 : specifiers.length) {
for (;;) {
const first = specifiers[0];
if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
this.print(specifiers.shift(), node);
if (specifiers.length) {
this.token(",");
this.space();
}
} else {
break;
}
}
if (specifiers.length) {
this.token("{");
this.space();
this.printList(specifiers, node);
this.space();
this.token("}");
}
this.space();
this.word("from");
this.space();
}
this.print(node.source, node);
if ((_node$attributes = node.attributes) == null ? void 0 : _node$attributes.length) {
this.space();
this.word("with");
this.space();
this.printList(node.attributes, node);
}
this.semicolon();
}
function ImportAttribute(node) {
this.print(node.key);
this.token(":");
this.space();
this.print(node.value);
}
function ImportNamespaceSpecifier(node) {
this.token("*");
this.space();
this.word("as");
this.space();
this.print(node.local, node);
}
/***/ }),
/* 690 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Identifier = Identifier;
exports.ArgumentPlaceholder = ArgumentPlaceholder;
exports.SpreadElement = exports.RestElement = RestElement;
exports.ObjectPattern = exports.ObjectExpression = ObjectExpression;
exports.ObjectMethod = ObjectMethod;
exports.ObjectProperty = ObjectProperty;
exports.ArrayPattern = exports.ArrayExpression = ArrayExpression;
exports.RecordExpression = RecordExpression;
exports.TupleExpression = TupleExpression;
exports.RegExpLiteral = RegExpLiteral;
exports.BooleanLiteral = BooleanLiteral;
exports.NullLiteral = NullLiteral;
exports.NumericLiteral = NumericLiteral;
exports.StringLiteral = StringLiteral;
exports.BigIntLiteral = BigIntLiteral;
exports.PipelineTopicExpression = PipelineTopicExpression;
exports.PipelineBareFunction = PipelineBareFunction;
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
var t = _interopRequireWildcard(__webpack_require__(2));
var _jsesc = _interopRequireDefault(__webpack_require__(858));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function Identifier(node) {
this.exactSource(node.loc, () => {
this.word(node.name);
});
}
function ArgumentPlaceholder() {
this.token("?");
}
function RestElement(node) {
this.token("...");
this.print(node.argument, node);
}
function ObjectExpression(node) {
const props = node.properties;
this.token("{");
this.printInnerComments(node);
if (props.length) {
this.space();
this.printList(props, node, {
indent: true,
statement: true
});
this.space();
}
this.token("}");
}
function ObjectMethod(node) {
this.printJoin(node.decorators, node);
this._methodHead(node);
this.space();
this.print(node.body, node);
}
function ObjectProperty(node) {
this.printJoin(node.decorators, node);
if (node.computed) {
this.token("[");
this.print(node.key, node);
this.token("]");
} else {
if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
this.print(node.value, node);
return;
}
this.print(node.key, node);
if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
return;
}
}
this.token(":");
this.space();
this.print(node.value, node);
}
function ArrayExpression(node) {
const elems = node.elements;
const len = elems.length;
this.token("[");
this.printInnerComments(node);
for (let i = 0; i < elems.length; i++) {
const elem = elems[i];
if (elem) {
if (i > 0) this.space();
this.print(elem, node);
if (i < len - 1) this.token(",");
} else {
this.token(",");
}
}
this.token("]");
}
function RecordExpression(node) {
const props = node.properties;
let startToken;
let endToken;
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "{|";
endToken = "|}";
} else if (this.format.recordAndTupleSyntaxType === "hash") {
startToken = "#{";
endToken = "}";
} else {
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
}
this.token(startToken);
this.printInnerComments(node);
if (props.length) {
this.space();
this.printList(props, node, {
indent: true,
statement: true
});
this.space();
}
this.token(endToken);
}
function TupleExpression(node) {
const elems = node.elements;
const len = elems.length;
let startToken;
let endToken;
if (this.format.recordAndTupleSyntaxType === "bar") {
startToken = "[|";
endToken = "|]";
} else if (this.format.recordAndTupleSyntaxType === "hash") {
startToken = "#[";
endToken = "]";
} else {
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
}
this.token(startToken);
this.printInnerComments(node);
for (let i = 0; i < elems.length; i++) {
const elem = elems[i];
if (elem) {
if (i > 0) this.space();
this.print(elem, node);
if (i < len - 1) this.token(",");
}
}
this.token(endToken);
}
function RegExpLiteral(node) {
this.word(`/${node.pattern}/${node.flags}`);
}
function BooleanLiteral(node) {
this.word(node.value ? "true" : "false");
}
function NullLiteral() {
this.word("null");
}
function NumericLiteral(node) {
const raw = this.getPossibleRaw(node);
const opts = this.format.jsescOption;
const value = node.value + "";
if (opts.numbers) {
this.number((0, _jsesc.default)(node.value, opts));
} else if (raw == null) {
this.number(value);
} else if (this.format.minified) {
this.number(raw.length < value.length ? raw : value);
} else {
this.number(raw);
}
}
function StringLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
return;
}
const opts = this.format.jsescOption;
if (this.format.jsonCompatibleStrings) {
opts.json = true;
}
const val = (0, _jsesc.default)(node.value, opts);
return this.token(val);
}
function BigIntLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.token(raw);
return;
}
this.token(node.value + "n");
}
function PipelineTopicExpression(node) {
this.print(node.expression, node);
}
function PipelineBareFunction(node) {
this.print(node.callee, node);
}
function PipelinePrimaryTopicReference() {
this.token("#");
}
/***/ }),
/* 691 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getFunctionName;
var t = _interopRequireWildcard(__webpack_require__(2));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
// Perform ES6's anonymous function name inference for all
// locations where static analysis is possible.
// eslint-disable-next-line complexity
function getFunctionName(node, parent) {
if (t.isIdentifier(node.id)) {
return node.id.name;
}
if (t.isObjectMethod(node, {
computed: false
}) || t.isClassMethod(node, {
computed: false
})) {
const {
key
} = node;
if (t.isIdentifier(key)) {
return key.name;
}
if (t.isStringLiteral(key)) {
return key.value;
}
if (t.isNumericLiteral(key)) {
return `${key.value}`;
}
}
if (t.isObjectProperty(parent, {
computed: false,
value: node
}) || // TODO: Babylon 6 doesn't support computed class props. It is included
// here so that it is most flexible. Once Babylon 7 is used, this
// can change to use computed: false like ObjectProperty.
t.isClassProperty(parent, {
value: node
}) && !parent.computed) {
const {
key
} = parent;
if (t.isIdentifier(key)) {
return key.name;
}
if (t.isStringLiteral(key)) {
return key.value;
}
if (t.isNumericLiteral(key)) {
return `${key.value}`;
}
}
if (t.isAssignmentExpression(parent, {
operator: "=",
right: node
})) {
if (t.isIdentifier(parent.left)) {
return parent.left.name;
} // This case is not supported in standard ES6 name inference, but it
// is included here since it is still a helpful case during debugging.
if (t.isMemberExpression(parent.left, {
computed: false
})) {
return parent.left.property.name;
}
}
if (t.isAssignmentPattern(parent, {
right: node
}) && t.isIdentifier(parent.left)) {
return parent.left.name;
}
if (t.isVariableDeclarator(parent, {
init: node
}) && t.isIdentifier(parent.id)) {
return parent.id.name;
}
if (t.isExportDefaultDeclaration(parent, {
declaration: node
}) && t.isFunctionDeclaration(node)) {
return "default";
}
return "anonymous";
}
/***/ }),
/* 692 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getScopes;
exports.clearScopes = clearScopes;
Object.defineProperty(exports, "buildScopeList", {
enumerable: true,
get: function () {
return _visitor.buildScopeList;
}
});
var _visitor = __webpack_require__(869);
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
let parsedScopesCache = new Map();
function getScopes(location) {
const {
sourceId
} = location;
let parsedScopes = parsedScopesCache.get(sourceId);
if (!parsedScopes) {
parsedScopes = (0, _visitor.parseSourceScopes)(sourceId);
parsedScopesCache.set(sourceId, parsedScopes);
}
return parsedScopes ? findScopes(parsedScopes, location) : [];
}
function clearScopes() {
parsedScopesCache = new Map();
}
/**
* Searches all scopes and their bindings at the specific location.
*/
function findScopes(scopes, location) {
// Find inner most in the tree structure.
let searchInScopes = scopes;
const found = [];
while (searchInScopes) {
const foundOne = searchInScopes.some(s => {
if (compareLocations(s.start, location) <= 0 && compareLocations(location, s.end) < 0) {
// Found the next scope, trying to search recusevly in its children.
found.unshift(s);
searchInScopes = s.children;
return true;
}
return false;
});
if (!foundOne) {
break;
}
}
return found.map(i => ({
type: i.type,
scopeKind: i.scopeKind,
displayName: i.displayName,
start: i.start,
end: i.end,
bindings: i.bindings
}));
}
function compareLocations(a, b) {
// According to type of Location.column can be undefined, if will not be the
// case here, ignoring flow error.
// $FlowIgnore
return a.line == b.line ? a.column - b.column : a.line - b.line;
}
/***/ }),
/* 693 */
/***/ (function(module, exports, __webpack_require__) {
var baseMatches = __webpack_require__(872),
baseMatchesProperty = __webpack_require__(880),
identity = __webpack_require__(888),
isArray = __webpack_require__(563),
property = __webpack_require__(889);
/**
* The base implementation of `_.iteratee`.
*
* @private
* @param {*} [value=_.identity] The value to convert to an iteratee.
* @returns {Function} Returns the iteratee.
*/
function baseIteratee(value) {
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
if (typeof value == 'function') {
return value;
}
if (value == null) {
return identity;
}
if (typeof value == 'object') {
return isArray(value)
? baseMatchesProperty(value[0], value[1])
: baseMatches(value);
}
return property(value);
}
module.exports = baseIteratee;
/***/ }),
/* 694 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsEqualDeep = __webpack_require__(874),
isObjectLike = __webpack_require__(565);
/**
* The base implementation of `_.isEqual` which supports partial comparisons
* and tracks traversed objects.
*
* @private
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @param {boolean} bitmask The bitmask flags.
* 1 - Unordered comparison
* 2 - Partial comparison
* @param {Function} [customizer] The function to customize comparisons.
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
*/
function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) {
return true;
}
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other;
}
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
}
module.exports = baseIsEqual;
/***/ }),
/* 695 */
/***/ (function(module, exports, __webpack_require__) {
var SetCache = __webpack_require__(673),
arraySome = __webpack_require__(875),
cacheHas = __webpack_require__(674);
/** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1,
COMPARE_UNORDERED_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for arrays with support for
* partial deep comparisons.
*
* @private
* @param {Array} array The array to compare.
* @param {Array} other The other array to compare.
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
* @param {Function} customizer The function to customize comparisons.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Object} stack Tracks traversed `array` and `other` objects.
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
*/
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
arrLength = array.length,
othLength = other.length;
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
return false;
}
// Assume cyclic values are equal.
var stacked = stack.get(array);
if (stacked && stack.get(other)) {
return stacked == other;
}
var index = -1,
result = true,
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
stack.set(array, other);
stack.set(other, array);
// Ignore non-index properties.
while (++index < arrLength) {
var arrValue = array[index],
othValue = other[index];
if (customizer) {
var compared = isPartial
? customizer(othValue, arrValue, index, other, array, stack)
: customizer(arrValue, othValue, index, array, other, stack);
}
if (compared !== undefined) {
if (compared) {
continue;
}
result = false;
break;
}
// Recursively compare arrays (susceptible to call stack limits).
if (seen) {
if (!arraySome(other, function(othValue, othIndex) {
if (!cacheHas(seen, othIndex) &&
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
return seen.push(othIndex);
}
})) {
result = false;
break;
}
} else if (!(
arrValue === othValue ||
equalFunc(arrValue, othValue, bitmask, customizer, stack)
)) {
result = false;
break;
}
}
stack['delete'](array);
stack['delete'](other);
return result;
}
module.exports = equalArrays;
/***/ }),
/* 696 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(573);
/**
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` if suitable for strict
* equality comparisons, else `false`.
*/
function isStrictComparable(value) {
return value === value && !isObject(value);
}
module.exports = isStrictComparable;
/***/ }),
/* 697 */
/***/ (function(module, exports) {
/**
* A specialized version of `matchesProperty` for source values suitable
* for strict equality comparisons, i.e. `===`.
*
* @private
* @param {string} key The key of the property to get.
* @param {*} srcValue The value to match.
* @returns {Function} Returns the new spec function.
*/
function matchesStrictComparable(key, srcValue) {
return function(object) {
if (object == null) {
return false;
}
return object[key] === srcValue &&
(srcValue !== undefined || (key in Object(object)));
};
}
module.exports = matchesStrictComparable;
/***/ }),
/* 698 */
/***/ (function(module, exports, __webpack_require__) {
var castPath = __webpack_require__(699),
toKey = __webpack_require__(606);
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = castPath(path, object);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
module.exports = baseGet;
/***/ }),
/* 699 */
/***/ (function(module, exports, __webpack_require__) {
var isArray = __webpack_require__(563),
isKey = __webpack_require__(641),
stringToPath = __webpack_require__(882),
toString = __webpack_require__(605);
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
}
module.exports = castPath;
/***/ }),
/* 700 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.containsPosition = containsPosition;
exports.containsLocation = containsLocation;
exports.nodeContainsPosition = nodeContainsPosition;
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
function startsBefore(a, b) {
let before = a.start.line < b.line;
if (a.start.line === b.line) {
before = a.start.column >= 0 && b.column >= 0 ? a.start.column <= b.column : true;
}
return before;
}
function endsAfter(a, b) {
let after = a.end.line > b.line;
if (a.end.line === b.line) {
after = a.end.column >= 0 && b.column >= 0 ? a.end.column >= b.column : true;
}
return after;
}
function containsPosition(a, b) {
return startsBefore(a, b) && endsAfter(a, b);
}
function containsLocation(a, b) {
return containsPosition(a, b.start) && containsPosition(a, b.end);
}
function nodeContainsPosition(node, position) {
return containsPosition(node.loc, position);
}
/***/ }),
/* 701 */,
/* 702 */,
/* 703 */,
/* 704 */,
/* 705 */,
/* 706 */,
/* 707 */,
/* 708 */,
/* 709 */,
/* 710 */,
/* 711 */,
/* 712 */,
/* 713 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(714);
/***/ }),
/* 714 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _getSymbols = __webpack_require__(648);
var _ast = __webpack_require__(572);
var _getScopes = _interopRequireWildcard(__webpack_require__(692));
var _sources = __webpack_require__(687);
var _findOutOfScopeLocations = _interopRequireDefault(__webpack_require__(870));
var _steps = __webpack_require__(893);
var _validate = __webpack_require__(895);
var _mapExpression = _interopRequireDefault(__webpack_require__(896));
var _devtoolsUtils = __webpack_require__(560);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at . */
const {
workerHandler
} = _devtoolsUtils.workerUtils;
function clearState() {
(0, _ast.clearASTs)();
(0, _getScopes.clearScopes)();
(0, _sources.clearSources)();
(0, _getSymbols.clearSymbols)();
}
self.onmessage = workerHandler({
findOutOfScopeLocations: _findOutOfScopeLocations.default,
getSymbols: _getSymbols.getSymbols,
getScopes: _getScopes.default,
clearState,
getNextStep: _steps.getNextStep,
hasSyntaxError: _validate.hasSyntaxError,
mapExpression: _mapExpression.default,
setSource: _sources.setSource
});
/***/ }),
/* 715 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _buildMatchMemberExpression = _interopRequireDefault(__webpack_require__(649));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component");
var _default = isReactComponent;
exports.default = _default;
/***/ }),
/* 716 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isCompatTag;
function isCompatTag(tagName) {
return !!tagName && /^[a-z]/.test(tagName);
}
/***/ }),
/* 717 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = buildChildren;
var _generated = __webpack_require__(559);
var _cleanJSXElementLiteralChild = _interopRequireDefault(__webpack_require__(718));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function buildChildren(node) {
const elements = [];
for (let i = 0; i < node.children.length; i++) {
let child = node.children[i];
if ((0, _generated.isJSXText)(child)) {
(0, _cleanJSXElementLiteralChild.default)(child, elements);
continue;
}
if ((0, _generated.isJSXExpressionContainer)(child)) child = child.expression;
if ((0, _generated.isJSXEmptyExpression)(child)) continue;
elements.push(child);
}
return elements;
}
/***/ }),
/* 718 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cleanJSXElementLiteralChild;
var _generated = __webpack_require__(561);
function cleanJSXElementLiteralChild(child, args) {
const lines = child.value.split(/\r\n|\n|\r/);
let lastNonEmptyLine = 0;
for (let i = 0; i < lines.length; i++) {
if (lines[i].match(/[^ \t]/)) {
lastNonEmptyLine = i;
}
}
let str = "";
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const isFirstLine = i === 0;
const isLastLine = i === lines.length - 1;
const isLastNonEmptyLine = i === lastNonEmptyLine;
let trimmedLine = line.replace(/\t/g, " ");
if (!isFirstLine) {
trimmedLine = trimmedLine.replace(/^[ ]+/, "");
}
if (!isLastLine) {
trimmedLine = trimmedLine.replace(/[ ]+$/, "");
}
if (trimmedLine) {
if (!isLastNonEmptyLine) {
trimmedLine += " ";
}
str += trimmedLine;
}
}
if (str) args.push((0, _generated.stringLiteral)(str));
}
/***/ }),
/* 719 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = builder;
var _clone = _interopRequireDefault(__webpack_require__(720));
var _definitions = __webpack_require__(564);
var _validate = _interopRequireDefault(__webpack_require__(627));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function builder(type, ...args) {
const keys = _definitions.BUILDER_KEYS[type];
const countArgs = args.length;
if (countArgs > keys.length) {
throw new Error(`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`);
}
const node = {
type
};
let i = 0;
keys.forEach(key => {
const field = _definitions.NODE_FIELDS[type][key];
let arg;
if (i < countArgs) arg = args[i];
if (arg === undefined) arg = (0, _clone.default)(field.default);
node[key] = arg;
i++;
});
for (const key of Object.keys(node)) {
(0, _validate.default)(node, key, node[key]);
}
return node;
}
/***/ }),
/* 720 */
/***/ (function(module, exports, __webpack_require__) {
var baseClone = __webpack_require__(721);
/** Used to compose bitmasks for cloning. */
var CLONE_SYMBOLS_FLAG = 4;
/**
* Creates a shallow clone of `value`.
*
* **Note:** This method is loosely based on the
* [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
* and supports cloning arrays, array buffers, booleans, date objects, maps,
* numbers, `Object` objects, regexes, sets, strings, symbols, and typed
* arrays. The own enumerable properties of `arguments` objects are cloned
* as plain objects. An empty object is returned for uncloneable values such
* as error objects, functions, DOM nodes, and WeakMaps.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to clone.
* @returns {*} Returns the cloned value.
* @see _.cloneDeep
* @example
*
* var objects = [{ 'a': 1 }, { 'b': 2 }];
*
* var shallow = _.clone(objects);
* console.log(shallow[0] === objects[0]);
* // => true
*/
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
}
module.exports = clone;
/***/ }),
/* 721 */
/***/ (function(module, exports, __webpack_require__) {
var Stack = __webpack_require__(613),
arrayEach = __webpack_require__(748),
assignValue = __webpack_require__(653),
baseAssign = __webpack_require__(750),
baseAssignIn = __webpack_require__(756),
cloneBuffer = __webpack_require__(759),
copyArray = __webpack_require__(760),
copySymbols = __webpack_require__(761),
copySymbolsIn = __webpack_require__(763),
getAllKeys = __webpack_require__(662),
getAllKeysIn = __webpack_require__(764),
getTag = __webpack_require__(578),
initCloneArray = __webpack_require__(768),
initCloneByTag = __webpack_require__(769),
initCloneObject = __webpack_require__(774),
isArray = __webpack_require__(563),
isBuffer = __webpack_require__(595),
isMap = __webpack_require__(776),
isObject = __webpack_require__(573),
isSet = __webpack_require__(778),
keys = __webpack_require__(594);
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] =
cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
cloneableTags[boolTag] = cloneableTags[dateTag] =
cloneableTags[float32Tag] = cloneableTags[float64Tag] =
cloneableTags[int8Tag] = cloneableTags[int16Tag] =
cloneableTags[int32Tag] = cloneableTags[mapTag] =
cloneableTags[numberTag] = cloneableTags[objectTag] =
cloneableTags[regexpTag] = cloneableTags[setTag] =
cloneableTags[stringTag] = cloneableTags[symbolTag] =
cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] =
cloneableTags[weakMapTag] = false;
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} bitmask The bitmask flags.
* 1 - Deep clone
* 2 - Flatten inherited properties
* 4 - Clone symbols
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
result = (isFlat || isFunc) ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat
? copySymbolsIn(value, baseAssignIn(result, value))
: copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack);
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet(value)) {
value.forEach(function(subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap(value)) {
value.forEach(function(subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
}
var keysFunc = isFull
? (isFlat ? getAllKeysIn : getAllKeys)
: (isFlat ? keysIn : keys);
var props = isArr ? undefined : keysFunc(value);
arrayEach(props || value, function(subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
module.exports = baseClone;
/***/ }),
/* 722 */
/***/ (function(module, exports) {
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
module.exports = listCacheClear;
/***/ }),
/* 723 */
/***/ (function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(587);
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
module.exports = listCacheDelete;
/***/ }),
/* 724 */
/***/ (function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(587);
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
module.exports = listCacheGet;
/***/ }),
/* 725 */
/***/ (function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(587);
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
module.exports = listCacheHas;
/***/ }),
/* 726 */
/***/ (function(module, exports, __webpack_require__) {
var assocIndexOf = __webpack_require__(587);
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
module.exports = listCacheSet;
/***/ }),
/* 727 */
/***/ (function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(586);
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache;
this.size = 0;
}
module.exports = stackClear;
/***/ }),
/* 728 */
/***/ (function(module, exports) {
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
module.exports = stackDelete;
/***/ }),
/* 729 */
/***/ (function(module, exports) {
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
module.exports = stackGet;
/***/ }),
/* 730 */
/***/ (function(module, exports) {
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
module.exports = stackHas;
/***/ }),
/* 731 */
/***/ (function(module, exports, __webpack_require__) {
var ListCache = __webpack_require__(586),
Map = __webpack_require__(614),
MapCache = __webpack_require__(617);
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
module.exports = stackSet;
/***/ }),
/* 732 */
/***/ (function(module, exports, __webpack_require__) {
var isFunction = __webpack_require__(651),
isMasked = __webpack_require__(733),
isObject = __webpack_require__(573),
toSource = __webpack_require__(652);
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
module.exports = baseIsNative;
/***/ }),
/* 733 */
/***/ (function(module, exports, __webpack_require__) {
var coreJsData = __webpack_require__(734);
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
module.exports = isMasked;
/***/ }),
/* 734 */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(562);
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
module.exports = coreJsData;
/***/ }),
/* 735 */
/***/ (function(module, exports) {
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
module.exports = getValue;
/***/ }),
/* 736 */
/***/ (function(module, exports, __webpack_require__) {
var Hash = __webpack_require__(737),
ListCache = __webpack_require__(586),
Map = __webpack_require__(614);
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.size = 0;
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
module.exports = mapCacheClear;
/***/ }),
/* 737 */
/***/ (function(module, exports, __webpack_require__) {
var hashClear = __webpack_require__(738),
hashDelete = __webpack_require__(739),
hashGet = __webpack_require__(740),
hashHas = __webpack_require__(741),
hashSet = __webpack_require__(742);
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
module.exports = Hash;
/***/ }),
/* 738 */
/***/ (function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(591);
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
this.size = 0;
}
module.exports = hashClear;
/***/ }),
/* 739 */
/***/ (function(module, exports) {
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
var result = this.has(key) && delete this.__data__[key];
this.size -= result ? 1 : 0;
return result;
}
module.exports = hashDelete;
/***/ }),
/* 740 */
/***/ (function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(591);
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
module.exports = hashGet;
/***/ }),
/* 741 */
/***/ (function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(591);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
}
module.exports = hashHas;
/***/ }),
/* 742 */
/***/ (function(module, exports, __webpack_require__) {
var nativeCreate = __webpack_require__(591);
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
this.size += this.has(key) ? 0 : 1;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
module.exports = hashSet;
/***/ }),
/* 743 */
/***/ (function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(592);
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
var result = getMapData(this, key)['delete'](key);
this.size -= result ? 1 : 0;
return result;
}
module.exports = mapCacheDelete;
/***/ }),
/* 744 */
/***/ (function(module, exports) {
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
module.exports = isKeyable;
/***/ }),
/* 745 */
/***/ (function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(592);
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
module.exports = mapCacheGet;
/***/ }),
/* 746 */
/***/ (function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(592);
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
module.exports = mapCacheHas;
/***/ }),
/* 747 */
/***/ (function(module, exports, __webpack_require__) {
var getMapData = __webpack_require__(592);
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
module.exports = mapCacheSet;
/***/ }),
/* 748 */
/***/ (function(module, exports) {
/**
* A specialized version of `_.forEach` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns `array`.
*/
function arrayEach(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (iteratee(array[index], index, array) === false) {
break;
}
}
return array;
}
module.exports = arrayEach;
/***/ }),
/* 749 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574);
var defineProperty = (function() {
try {
var func = getNative(Object, 'defineProperty');
func({}, '', {});
return func;
} catch (e) {}
}());
module.exports = defineProperty;
/***/ }),
/* 750 */
/***/ (function(module, exports, __webpack_require__) {
var copyObject = __webpack_require__(593),
keys = __webpack_require__(594);
/**
* The base implementation of `_.assign` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssign(object, source) {
return object && copyObject(source, keys(source), object);
}
module.exports = baseAssign;
/***/ }),
/* 751 */
/***/ (function(module, exports) {
/**
* The base implementation of `_.times` without support for iteratee shorthands
* or max array length checks.
*
* @private
* @param {number} n The number of times to invoke `iteratee`.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the array of results.
*/
function baseTimes(n, iteratee) {
var index = -1,
result = Array(n);
while (++index < n) {
result[index] = iteratee(index);
}
return result;
}
module.exports = baseTimes;
/***/ }),
/* 752 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(569),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]';
/**
* The base implementation of `_.isArguments`.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
*/
function baseIsArguments(value) {
return isObjectLike(value) && baseGetTag(value) == argsTag;
}
module.exports = baseIsArguments;
/***/ }),
/* 753 */
/***/ (function(module, exports) {
/**
* This method returns `false`.
*
* @static
* @memberOf _
* @since 4.13.0
* @category Util
* @returns {boolean} Returns `false`.
* @example
*
* _.times(2, _.stubFalse);
* // => [false, false]
*/
function stubFalse() {
return false;
}
module.exports = stubFalse;
/***/ }),
/* 754 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(569),
isLength = __webpack_require__(622),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values of typed arrays. */
var typedArrayTags = {};
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
typedArrayTags[uint32Tag] = true;
typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
typedArrayTags[setTag] = typedArrayTags[stringTag] =
typedArrayTags[weakMapTag] = false;
/**
* The base implementation of `_.isTypedArray` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
*/
function baseIsTypedArray(value) {
return isObjectLike(value) &&
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
}
module.exports = baseIsTypedArray;
/***/ }),
/* 755 */
/***/ (function(module, exports, __webpack_require__) {
var overArg = __webpack_require__(657);
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeKeys = overArg(Object.keys, Object);
module.exports = nativeKeys;
/***/ }),
/* 756 */
/***/ (function(module, exports, __webpack_require__) {
var copyObject = __webpack_require__(593),
keysIn = __webpack_require__(658);
/**
* The base implementation of `_.assignIn` without support for multiple sources
* or `customizer` functions.
*
* @private
* @param {Object} object The destination object.
* @param {Object} source The source object.
* @returns {Object} Returns `object`.
*/
function baseAssignIn(object, source) {
return object && copyObject(source, keysIn(source), object);
}
module.exports = baseAssignIn;
/***/ }),
/* 757 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(573),
isPrototype = __webpack_require__(598),
nativeKeysIn = __webpack_require__(758);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function baseKeysIn(object) {
if (!isObject(object)) {
return nativeKeysIn(object);
}
var isProto = isPrototype(object),
result = [];
for (var key in object) {
if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
result.push(key);
}
}
return result;
}
module.exports = baseKeysIn;
/***/ }),
/* 758 */
/***/ (function(module, exports) {
/**
* This function is like
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
* except that it includes inherited enumerable properties.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names.
*/
function nativeKeysIn(object) {
var result = [];
if (object != null) {
for (var key in Object(object)) {
result.push(key);
}
}
return result;
}
module.exports = nativeKeysIn;
/***/ }),
/* 759 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var root = __webpack_require__(562);
/** Detect free variable `exports`. */
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
/** Detect free variable `module`. */
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
/** Detect the popular CommonJS extension `module.exports`. */
var moduleExports = freeModule && freeModule.exports === freeExports;
/** Built-in value references. */
var Buffer = moduleExports ? root.Buffer : undefined,
allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
/**
* Creates a clone of `buffer`.
*
* @private
* @param {Buffer} buffer The buffer to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Buffer} Returns the cloned buffer.
*/
function cloneBuffer(buffer, isDeep) {
if (isDeep) {
return buffer.slice();
}
var length = buffer.length,
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
buffer.copy(result);
return result;
}
module.exports = cloneBuffer;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(619)(module)))
/***/ }),
/* 760 */
/***/ (function(module, exports) {
/**
* Copies the values of `source` to `array`.
*
* @private
* @param {Array} source The array to copy values from.
* @param {Array} [array=[]] The array to copy values to.
* @returns {Array} Returns `array`.
*/
function copyArray(source, array) {
var index = -1,
length = source.length;
array || (array = Array(length));
while (++index < length) {
array[index] = source[index];
}
return array;
}
module.exports = copyArray;
/***/ }),
/* 761 */
/***/ (function(module, exports, __webpack_require__) {
var copyObject = __webpack_require__(593),
getSymbols = __webpack_require__(623);
/**
* Copies own symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbols(source, object) {
return copyObject(source, getSymbols(source), object);
}
module.exports = copySymbols;
/***/ }),
/* 762 */
/***/ (function(module, exports) {
/**
* A specialized version of `_.filter` for arrays without support for
* iteratee shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} predicate The function invoked per iteration.
* @returns {Array} Returns the new filtered array.
*/
function arrayFilter(array, predicate) {
var index = -1,
length = array == null ? 0 : array.length,
resIndex = 0,
result = [];
while (++index < length) {
var value = array[index];
if (predicate(value, index, array)) {
result[resIndex++] = value;
}
}
return result;
}
module.exports = arrayFilter;
/***/ }),
/* 763 */
/***/ (function(module, exports, __webpack_require__) {
var copyObject = __webpack_require__(593),
getSymbolsIn = __webpack_require__(660);
/**
* Copies own and inherited symbols of `source` to `object`.
*
* @private
* @param {Object} source The object to copy symbols from.
* @param {Object} [object={}] The object to copy symbols to.
* @returns {Object} Returns `object`.
*/
function copySymbolsIn(source, object) {
return copyObject(source, getSymbolsIn(source), object);
}
module.exports = copySymbolsIn;
/***/ }),
/* 764 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetAllKeys = __webpack_require__(663),
getSymbolsIn = __webpack_require__(660),
keysIn = __webpack_require__(658);
/**
* Creates an array of own and inherited enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
module.exports = getAllKeysIn;
/***/ }),
/* 765 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574),
root = __webpack_require__(562);
/* Built-in method references that are verified to be native. */
var DataView = getNative(root, 'DataView');
module.exports = DataView;
/***/ }),
/* 766 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574),
root = __webpack_require__(562);
/* Built-in method references that are verified to be native. */
var Promise = getNative(root, 'Promise');
module.exports = Promise;
/***/ }),
/* 767 */
/***/ (function(module, exports, __webpack_require__) {
var getNative = __webpack_require__(574),
root = __webpack_require__(562);
/* Built-in method references that are verified to be native. */
var WeakMap = getNative(root, 'WeakMap');
module.exports = WeakMap;
/***/ }),
/* 768 */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Initializes an array clone.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the initialized clone.
*/
function initCloneArray(array) {
var length = array.length,
result = new array.constructor(length);
// Add properties assigned by `RegExp#exec`.
if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
result.index = array.index;
result.input = array.input;
}
return result;
}
module.exports = initCloneArray;
/***/ }),
/* 769 */
/***/ (function(module, exports, __webpack_require__) {
var cloneArrayBuffer = __webpack_require__(625),
cloneDataView = __webpack_require__(770),
cloneRegExp = __webpack_require__(771),
cloneSymbol = __webpack_require__(772),
cloneTypedArray = __webpack_require__(773);
/** `Object#toString` result references. */
var boolTag = '[object Boolean]',
dateTag = '[object Date]',
mapTag = '[object Map]',
numberTag = '[object Number]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/**
* Initializes an object clone based on its `toStringTag`.
*
* **Note:** This function only supports cloning values with tags of
* `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
*
* @private
* @param {Object} object The object to clone.
* @param {string} tag The `toStringTag` of the object to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneByTag(object, tag, isDeep) {
var Ctor = object.constructor;
switch (tag) {
case arrayBufferTag:
return cloneArrayBuffer(object);
case boolTag:
case dateTag:
return new Ctor(+object);
case dataViewTag:
return cloneDataView(object, isDeep);
case float32Tag: case float64Tag:
case int8Tag: case int16Tag: case int32Tag:
case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
return cloneTypedArray(object, isDeep);
case mapTag:
return new Ctor;
case numberTag:
case stringTag:
return new Ctor(object);
case regexpTag:
return cloneRegExp(object);
case setTag:
return new Ctor;
case symbolTag:
return cloneSymbol(object);
}
}
module.exports = initCloneByTag;
/***/ }),
/* 770 */
/***/ (function(module, exports, __webpack_require__) {
var cloneArrayBuffer = __webpack_require__(625);
/**
* Creates a clone of `dataView`.
*
* @private
* @param {Object} dataView The data view to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned data view.
*/
function cloneDataView(dataView, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
}
module.exports = cloneDataView;
/***/ }),
/* 771 */
/***/ (function(module, exports) {
/** Used to match `RegExp` flags from their coerced string values. */
var reFlags = /\w*$/;
/**
* Creates a clone of `regexp`.
*
* @private
* @param {Object} regexp The regexp to clone.
* @returns {Object} Returns the cloned regexp.
*/
function cloneRegExp(regexp) {
var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
result.lastIndex = regexp.lastIndex;
return result;
}
module.exports = cloneRegExp;
/***/ }),
/* 772 */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(570);
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
/**
* Creates a clone of the `symbol` object.
*
* @private
* @param {Object} symbol The symbol object to clone.
* @returns {Object} Returns the cloned symbol object.
*/
function cloneSymbol(symbol) {
return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
}
module.exports = cloneSymbol;
/***/ }),
/* 773 */
/***/ (function(module, exports, __webpack_require__) {
var cloneArrayBuffer = __webpack_require__(625);
/**
* Creates a clone of `typedArray`.
*
* @private
* @param {Object} typedArray The typed array to clone.
* @param {boolean} [isDeep] Specify a deep clone.
* @returns {Object} Returns the cloned typed array.
*/
function cloneTypedArray(typedArray, isDeep) {
var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
}
module.exports = cloneTypedArray;
/***/ }),
/* 774 */
/***/ (function(module, exports, __webpack_require__) {
var baseCreate = __webpack_require__(775),
getPrototype = __webpack_require__(624),
isPrototype = __webpack_require__(598);
/**
* Initializes an object clone.
*
* @private
* @param {Object} object The object to clone.
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
return (typeof object.constructor == 'function' && !isPrototype(object))
? baseCreate(getPrototype(object))
: {};
}
module.exports = initCloneObject;
/***/ }),
/* 775 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(573);
/** Built-in value references. */
var objectCreate = Object.create;
/**
* The base implementation of `_.create` without support for assigning
* properties to the created object.
*
* @private
* @param {Object} proto The object to inherit from.
* @returns {Object} Returns the new object.
*/
var baseCreate = (function() {
function object() {}
return function(proto) {
if (!isObject(proto)) {
return {};
}
if (objectCreate) {
return objectCreate(proto);
}
object.prototype = proto;
var result = new object;
object.prototype = undefined;
return result;
};
}());
module.exports = baseCreate;
/***/ }),
/* 776 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsMap = __webpack_require__(777),
baseUnary = __webpack_require__(596),
nodeUtil = __webpack_require__(597);
/* Node.js helper references. */
var nodeIsMap = nodeUtil && nodeUtil.isMap;
/**
* Checks if `value` is classified as a `Map` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
* @example
*
* _.isMap(new Map);
* // => true
*
* _.isMap(new WeakMap);
* // => false
*/
var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
module.exports = isMap;
/***/ }),
/* 777 */
/***/ (function(module, exports, __webpack_require__) {
var getTag = __webpack_require__(578),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var mapTag = '[object Map]';
/**
* The base implementation of `_.isMap` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a map, else `false`.
*/
function baseIsMap(value) {
return isObjectLike(value) && getTag(value) == mapTag;
}
module.exports = baseIsMap;
/***/ }),
/* 778 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsSet = __webpack_require__(779),
baseUnary = __webpack_require__(596),
nodeUtil = __webpack_require__(597);
/* Node.js helper references. */
var nodeIsSet = nodeUtil && nodeUtil.isSet;
/**
* Checks if `value` is classified as a `Set` object.
*
* @static
* @memberOf _
* @since 4.3.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
* @example
*
* _.isSet(new Set);
* // => true
*
* _.isSet(new WeakSet);
* // => false
*/
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
module.exports = isSet;
/***/ }),
/* 779 */
/***/ (function(module, exports, __webpack_require__) {
var getTag = __webpack_require__(578),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var setTag = '[object Set]';
/**
* The base implementation of `_.isSet` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a set, else `false`.
*/
function baseIsSet(value) {
return isObjectLike(value) && getTag(value) == setTag;
}
module.exports = baseIsSet;
/***/ }),
/* 780 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
let fastProto = null;
// Creates an object with permanently fast properties in V8. See Toon Verwaest's
// post https://medium.com/@tverwaes/setting-up-prototypes-in-v8-ec9c9491dfe2#5f62
// for more details. Use %HasFastProperties(object) and the Node.js flag
// --allow-natives-syntax to check whether an object has fast properties.
function FastObject(o) {
// A prototype object will have "fast properties" enabled once it is checked
// against the inline property cache of a function, e.g. fastProto.property:
// https://github.com/v8/v8/blob/6.0.122/test/mjsunit/fast-prototype.js#L48-L63
if (fastProto !== null && typeof fastProto.property) {
const result = fastProto;
fastProto = FastObject.prototype = null;
return result;
}
fastProto = FastObject.prototype = o == null ? Object.create(null) : o;
return new FastObject;
}
// Initialize the inline property cache of FastObject
FastObject();
module.exports = function toFastproperties(o) {
return FastObject(o);
};
/***/ }),
/* 781 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isIdentifierStart = isIdentifierStart;
exports.isIdentifierChar = isIdentifierChar;
exports.isIdentifierName = isIdentifierName;
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
function isInAstralSet(code, set) {
let pos = 0x10000;
for (let i = 0, length = set.length; i < length; i += 2) {
pos += set[i];
if (pos > code) return false;
pos += set[i + 1];
if (pos >= code) return true;
}
return false;
}
function isIdentifierStart(code) {
if (code < 65) return code === 36;
if (code <= 90) return true;
if (code < 97) return code === 95;
if (code <= 122) return true;
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
return isInAstralSet(code, astralIdentifierStartCodes);
}
function isIdentifierChar(code) {
if (code < 48) return code === 36;
if (code < 58) return true;
if (code < 65) return false;
if (code <= 90) return true;
if (code < 97) return code === 95;
if (code <= 122) return true;
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
}
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
function isIdentifierName(name) {
let isFirst = true;
for (let _i = 0, _Array$from = Array.from(name); _i < _Array$from.length; _i++) {
const char = _Array$from[_i];
const cp = char.codePointAt(0);
if (isFirst) {
if (!isIdentifierStart(cp)) {
return false;
}
isFirst = false;
} else if (!isIdentifierChar(cp)) {
return false;
}
}
return !isFirst;
}
/***/ }),
/* 782 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isReservedWord = isReservedWord;
exports.isStrictReservedWord = isStrictReservedWord;
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
exports.isStrictBindReservedWord = isStrictBindReservedWord;
exports.isKeyword = isKeyword;
const reservedWords = {
keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
strictBind: ["eval", "arguments"]
};
const keywords = new Set(reservedWords.keyword);
const reservedWordsStrictSet = new Set(reservedWords.strict);
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
function isReservedWord(word, inModule) {
return inModule && word === "await" || word === "enum";
}
function isStrictReservedWord(word, inModule) {
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
}
function isStrictBindOnlyReservedWord(word) {
return reservedWordsStrictBindSet.has(word);
}
function isStrictBindReservedWord(word, inModule) {
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
}
function isKeyword(word) {
return keywords.has(word);
}
/***/ }),
/* 783 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = _interopRequireWildcard(__webpack_require__(571));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const defineInterfaceishType = (name, typeParameterType = "TypeParameterDeclaration") => {
(0, _utils.default)(name, {
builder: ["id", "typeParameters", "extends", "body"],
visitor: ["id", "typeParameters", "extends", "mixins", "implements", "body"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)(typeParameterType),
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")),
body: (0, _utils.validateType)("ObjectTypeAnnotation")
}
});
};
(0, _utils.default)("AnyTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("ArrayTypeAnnotation", {
visitor: ["elementType"],
aliases: ["Flow", "FlowType"],
fields: {
elementType: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("BooleanTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("BooleanLiteralTypeAnnotation", {
builder: ["value"],
aliases: ["Flow", "FlowType"],
fields: {
value: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("NullLiteralTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("ClassImplements", {
visitor: ["id", "typeParameters"],
aliases: ["Flow"],
fields: {
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
}
});
defineInterfaceishType("DeclareClass");
(0, _utils.default)("DeclareFunction", {
visitor: ["id"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier"),
predicate: (0, _utils.validateOptionalType)("DeclaredPredicate")
}
});
defineInterfaceishType("DeclareInterface");
(0, _utils.default)("DeclareModule", {
builder: ["id", "body", "kind"],
visitor: ["id", "body"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
body: (0, _utils.validateType)("BlockStatement"),
kind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("CommonJS", "ES"))
}
});
(0, _utils.default)("DeclareModuleExports", {
visitor: ["typeAnnotation"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
}
});
(0, _utils.default)("DeclareTypeAlias", {
visitor: ["id", "typeParameters", "right"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
right: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("DeclareOpaqueType", {
visitor: ["id", "typeParameters", "supertype"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
supertype: (0, _utils.validateOptionalType)("FlowType")
}
});
(0, _utils.default)("DeclareVariable", {
visitor: ["id"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier")
}
});
(0, _utils.default)("DeclareExportDeclaration", {
visitor: ["declaration", "specifiers", "source"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
declaration: (0, _utils.validateOptionalType)("Flow"),
specifiers: (0, _utils.validateOptional)((0, _utils.arrayOfType)(["ExportSpecifier", "ExportNamespaceSpecifier"])),
source: (0, _utils.validateOptionalType)("StringLiteral"),
default: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("DeclareExportAllDeclaration", {
visitor: ["source"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
source: (0, _utils.validateType)("StringLiteral"),
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value"))
}
});
(0, _utils.default)("DeclaredPredicate", {
visitor: ["value"],
aliases: ["Flow", "FlowPredicate"],
fields: {
value: (0, _utils.validateType)("Flow")
}
});
(0, _utils.default)("ExistsTypeAnnotation", {
aliases: ["Flow", "FlowType"]
});
(0, _utils.default)("FunctionTypeAnnotation", {
visitor: ["typeParameters", "params", "rest", "returnType"],
aliases: ["Flow", "FlowType"],
fields: {
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
params: (0, _utils.validate)((0, _utils.arrayOfType)("FunctionTypeParam")),
rest: (0, _utils.validateOptionalType)("FunctionTypeParam"),
returnType: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("FunctionTypeParam", {
visitor: ["name", "typeAnnotation"],
aliases: ["Flow"],
fields: {
name: (0, _utils.validateOptionalType)("Identifier"),
typeAnnotation: (0, _utils.validateType)("FlowType"),
optional: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("GenericTypeAnnotation", {
visitor: ["id", "typeParameters"],
aliases: ["Flow", "FlowType"],
fields: {
id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
}
});
(0, _utils.default)("InferredPredicate", {
aliases: ["Flow", "FlowPredicate"]
});
(0, _utils.default)("InterfaceExtends", {
visitor: ["id", "typeParameters"],
aliases: ["Flow"],
fields: {
id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
}
});
defineInterfaceishType("InterfaceDeclaration");
(0, _utils.default)("InterfaceTypeAnnotation", {
visitor: ["extends", "body"],
aliases: ["Flow", "FlowType"],
fields: {
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
body: (0, _utils.validateType)("ObjectTypeAnnotation")
}
});
(0, _utils.default)("IntersectionTypeAnnotation", {
visitor: ["types"],
aliases: ["Flow", "FlowType"],
fields: {
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
}
});
(0, _utils.default)("MixedTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("EmptyTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("NullableTypeAnnotation", {
visitor: ["typeAnnotation"],
aliases: ["Flow", "FlowType"],
fields: {
typeAnnotation: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("NumberLiteralTypeAnnotation", {
builder: ["value"],
aliases: ["Flow", "FlowType"],
fields: {
value: (0, _utils.validate)((0, _utils.assertValueType)("number"))
}
});
(0, _utils.default)("NumberTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("ObjectTypeAnnotation", {
visitor: ["properties", "indexers", "callProperties", "internalSlots"],
aliases: ["Flow", "FlowType"],
builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"],
fields: {
properties: (0, _utils.validate)((0, _utils.arrayOfType)(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])),
indexers: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeIndexer")),
callProperties: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeCallProperty")),
internalSlots: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeInternalSlot")),
exact: {
validate: (0, _utils.assertValueType)("boolean"),
default: false
},
inexact: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("ObjectTypeInternalSlot", {
visitor: ["id", "value", "optional", "static", "method"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
id: (0, _utils.validateType)("Identifier"),
value: (0, _utils.validateType)("FlowType"),
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
method: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("ObjectTypeCallProperty", {
visitor: ["value"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
value: (0, _utils.validateType)("FlowType"),
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("ObjectTypeIndexer", {
visitor: ["id", "key", "value", "variance"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
id: (0, _utils.validateOptionalType)("Identifier"),
key: (0, _utils.validateType)("FlowType"),
value: (0, _utils.validateType)("FlowType"),
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
variance: (0, _utils.validateOptionalType)("Variance")
}
});
(0, _utils.default)("ObjectTypeProperty", {
visitor: ["key", "value", "variance"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
key: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
value: (0, _utils.validateType)("FlowType"),
kind: (0, _utils.validate)((0, _utils.assertOneOf)("init", "get", "set")),
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
variance: (0, _utils.validateOptionalType)("Variance")
}
});
(0, _utils.default)("ObjectTypeSpreadProperty", {
visitor: ["argument"],
aliases: ["Flow", "UserWhitespacable"],
fields: {
argument: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("OpaqueType", {
visitor: ["id", "typeParameters", "supertype", "impltype"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
supertype: (0, _utils.validateOptionalType)("FlowType"),
impltype: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("QualifiedTypeIdentifier", {
visitor: ["id", "qualification"],
aliases: ["Flow"],
fields: {
id: (0, _utils.validateType)("Identifier"),
qualification: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"])
}
});
(0, _utils.default)("StringLiteralTypeAnnotation", {
builder: ["value"],
aliases: ["Flow", "FlowType"],
fields: {
value: (0, _utils.validate)((0, _utils.assertValueType)("string"))
}
});
(0, _utils.default)("StringTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("SymbolTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("ThisTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("TupleTypeAnnotation", {
visitor: ["types"],
aliases: ["Flow", "FlowType"],
fields: {
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
}
});
(0, _utils.default)("TypeofTypeAnnotation", {
visitor: ["argument"],
aliases: ["Flow", "FlowType"],
fields: {
argument: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("TypeAlias", {
visitor: ["id", "typeParameters", "right"],
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
fields: {
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
right: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("TypeAnnotation", {
aliases: ["Flow"],
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("TypeCastExpression", {
visitor: ["expression", "typeAnnotation"],
aliases: ["Flow", "ExpressionWrapper", "Expression"],
fields: {
expression: (0, _utils.validateType)("Expression"),
typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
}
});
(0, _utils.default)("TypeParameter", {
aliases: ["Flow"],
visitor: ["bound", "default", "variance"],
fields: {
name: (0, _utils.validate)((0, _utils.assertValueType)("string")),
bound: (0, _utils.validateOptionalType)("TypeAnnotation"),
default: (0, _utils.validateOptionalType)("FlowType"),
variance: (0, _utils.validateOptionalType)("Variance")
}
});
(0, _utils.default)("TypeParameterDeclaration", {
aliases: ["Flow"],
visitor: ["params"],
fields: {
params: (0, _utils.validate)((0, _utils.arrayOfType)("TypeParameter"))
}
});
(0, _utils.default)("TypeParameterInstantiation", {
aliases: ["Flow"],
visitor: ["params"],
fields: {
params: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
}
});
(0, _utils.default)("UnionTypeAnnotation", {
visitor: ["types"],
aliases: ["Flow", "FlowType"],
fields: {
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
}
});
(0, _utils.default)("Variance", {
aliases: ["Flow"],
builder: ["kind"],
fields: {
kind: (0, _utils.validate)((0, _utils.assertOneOf)("minus", "plus"))
}
});
(0, _utils.default)("VoidTypeAnnotation", {
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
});
(0, _utils.default)("EnumDeclaration", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "body"],
fields: {
id: (0, _utils.validateType)("Identifier"),
body: (0, _utils.validateType)(["EnumBooleanBody", "EnumNumberBody", "EnumStringBody", "EnumSymbolBody"])
}
});
(0, _utils.default)("EnumBooleanBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
members: (0, _utils.validateArrayOfType)("EnumBooleanMember")
}
});
(0, _utils.default)("EnumNumberBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
members: (0, _utils.validateArrayOfType)("EnumNumberMember")
}
});
(0, _utils.default)("EnumStringBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
members: (0, _utils.validateArrayOfType)(["EnumStringMember", "EnumDefaultedMember"])
}
});
(0, _utils.default)("EnumSymbolBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
members: (0, _utils.validateArrayOfType)("EnumDefaultedMember")
}
});
(0, _utils.default)("EnumBooleanMember", {
aliases: ["EnumMember"],
visitor: ["id"],
fields: {
id: (0, _utils.validateType)("Identifier"),
init: (0, _utils.validateType)("BooleanLiteral")
}
});
(0, _utils.default)("EnumNumberMember", {
aliases: ["EnumMember"],
visitor: ["id", "init"],
fields: {
id: (0, _utils.validateType)("Identifier"),
init: (0, _utils.validateType)("NumericLiteral")
}
});
(0, _utils.default)("EnumStringMember", {
aliases: ["EnumMember"],
visitor: ["id", "init"],
fields: {
id: (0, _utils.validateType)("Identifier"),
init: (0, _utils.validateType)("StringLiteral")
}
});
(0, _utils.default)("EnumDefaultedMember", {
aliases: ["EnumMember"],
visitor: ["id"],
fields: {
id: (0, _utils.validateType)("Identifier")
}
});
/***/ }),
/* 784 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = _interopRequireWildcard(__webpack_require__(571));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
(0, _utils.default)("JSXAttribute", {
visitor: ["name", "value"],
aliases: ["JSX", "Immutable"],
fields: {
name: {
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXNamespacedName")
},
value: {
optional: true,
validate: (0, _utils.assertNodeType)("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer")
}
}
});
(0, _utils.default)("JSXClosingElement", {
visitor: ["name"],
aliases: ["JSX", "Immutable"],
fields: {
name: {
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
}
}
});
(0, _utils.default)("JSXElement", {
builder: ["openingElement", "closingElement", "children", "selfClosing"],
visitor: ["openingElement", "children", "closingElement"],
aliases: ["JSX", "Immutable", "Expression"],
fields: {
openingElement: {
validate: (0, _utils.assertNodeType)("JSXOpeningElement")
},
closingElement: {
optional: true,
validate: (0, _utils.assertNodeType)("JSXClosingElement")
},
children: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
},
selfClosing: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
}
});
(0, _utils.default)("JSXEmptyExpression", {
aliases: ["JSX"]
});
(0, _utils.default)("JSXExpressionContainer", {
visitor: ["expression"],
aliases: ["JSX", "Immutable"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression", "JSXEmptyExpression")
}
}
});
(0, _utils.default)("JSXSpreadChild", {
visitor: ["expression"],
aliases: ["JSX", "Immutable"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("JSXIdentifier", {
builder: ["name"],
aliases: ["JSX"],
fields: {
name: {
validate: (0, _utils.assertValueType)("string")
}
}
});
(0, _utils.default)("JSXMemberExpression", {
visitor: ["object", "property"],
aliases: ["JSX"],
fields: {
object: {
validate: (0, _utils.assertNodeType)("JSXMemberExpression", "JSXIdentifier")
},
property: {
validate: (0, _utils.assertNodeType)("JSXIdentifier")
}
}
});
(0, _utils.default)("JSXNamespacedName", {
visitor: ["namespace", "name"],
aliases: ["JSX"],
fields: {
namespace: {
validate: (0, _utils.assertNodeType)("JSXIdentifier")
},
name: {
validate: (0, _utils.assertNodeType)("JSXIdentifier")
}
}
});
(0, _utils.default)("JSXOpeningElement", {
builder: ["name", "attributes", "selfClosing"],
visitor: ["name", "attributes"],
aliases: ["JSX", "Immutable"],
fields: {
name: {
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
},
selfClosing: {
default: false
},
attributes: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
optional: true
}
}
});
(0, _utils.default)("JSXSpreadAttribute", {
visitor: ["argument"],
aliases: ["JSX"],
fields: {
argument: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("JSXText", {
aliases: ["JSX", "Immutable"],
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
}
});
(0, _utils.default)("JSXFragment", {
builder: ["openingFragment", "closingFragment", "children"],
visitor: ["openingFragment", "children", "closingFragment"],
aliases: ["JSX", "Immutable", "Expression"],
fields: {
openingFragment: {
validate: (0, _utils.assertNodeType)("JSXOpeningFragment")
},
closingFragment: {
validate: (0, _utils.assertNodeType)("JSXClosingFragment")
},
children: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
}
}
});
(0, _utils.default)("JSXOpeningFragment", {
aliases: ["JSX", "Immutable"]
});
(0, _utils.default)("JSXClosingFragment", {
aliases: ["JSX", "Immutable"]
});
/***/ }),
/* 785 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = _interopRequireWildcard(__webpack_require__(571));
var _placeholders = __webpack_require__(668);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
(0, _utils.default)("Noop", {
visitor: []
});
(0, _utils.default)("Placeholder", {
visitor: [],
builder: ["expectedNode", "name"],
fields: {
name: {
validate: (0, _utils.assertNodeType)("Identifier")
},
expectedNode: {
validate: (0, _utils.assertOneOf)(..._placeholders.PLACEHOLDERS)
}
}
});
(0, _utils.default)("V8IntrinsicIdentifier", {
builder: ["name"],
fields: {
name: {
validate: (0, _utils.assertValueType)("string")
}
}
});
/***/ }),
/* 786 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = _interopRequireWildcard(__webpack_require__(571));
var _es = __webpack_require__(628);
var _core = __webpack_require__(600);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
(0, _utils.default)("ArgumentPlaceholder", {});
(0, _utils.default)("AwaitExpression", {
builder: ["argument"],
visitor: ["argument"],
aliases: ["Expression", "Terminatorless"],
fields: {
argument: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("BindExpression", {
visitor: ["object", "callee"],
aliases: ["Expression"],
fields: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? {
object: {
validate: Object.assign(() => {}, {
oneOfNodeTypes: ["Expression"]
})
},
callee: {
validate: Object.assign(() => {}, {
oneOfNodeTypes: ["Expression"]
})
}
} : {
object: {
validate: (0, _utils.assertNodeType)("Expression")
},
callee: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("ClassProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
aliases: ["Property"],
fields: Object.assign({}, _es.classMethodOrPropertyCommon, {
value: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
},
definite: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
typeAnnotation: {
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
},
readonly: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
declare: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
})
});
(0, _utils.default)("OptionalMemberExpression", {
builder: ["object", "property", "computed", "optional"],
visitor: ["object", "property"],
aliases: ["Expression"],
fields: {
object: {
validate: (0, _utils.assertNodeType)("Expression")
},
property: {
validate: function () {
const normal = (0, _utils.assertNodeType)("Identifier");
const computed = (0, _utils.assertNodeType)("Expression");
const validator = function (node, key, val) {
const validator = node.computed ? computed : normal;
validator(node, key, val);
};
validator.oneOfNodeTypes = ["Expression", "Identifier"];
return validator;
}()
},
computed: {
default: false
},
optional: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? (0, _utils.assertValueType)("boolean") : (0, _utils.chain)((0, _utils.assertValueType)("boolean"), (0, _utils.assertOptionalChainStart)())
}
}
});
(0, _utils.default)("PipelineTopicExpression", {
builder: ["expression"],
visitor: ["expression"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("PipelineBareFunction", {
builder: ["callee"],
visitor: ["callee"],
fields: {
callee: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("PipelinePrimaryTopicReference", {
aliases: ["Expression"]
});
(0, _utils.default)("OptionalCallExpression", {
visitor: ["callee", "arguments", "typeParameters", "typeArguments"],
builder: ["callee", "arguments", "optional"],
aliases: ["Expression"],
fields: {
callee: {
validate: (0, _utils.assertNodeType)("Expression")
},
arguments: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement", "JSXNamespacedName")))
},
optional: {
validate: !Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? (0, _utils.assertValueType)("boolean") : (0, _utils.chain)((0, _utils.assertValueType)("boolean"), (0, _utils.assertOptionalChainStart)())
},
typeArguments: {
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TSTypeParameterInstantiation"),
optional: true
}
}
});
(0, _utils.default)("ClassPrivateProperty", {
visitor: ["key", "value", "decorators"],
builder: ["key", "value", "decorators"],
aliases: ["Property", "Private"],
fields: {
key: {
validate: (0, _utils.assertNodeType)("PrivateName")
},
value: {
validate: (0, _utils.assertNodeType)("Expression"),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
}
});
(0, _utils.default)("ClassPrivateMethod", {
builder: ["kind", "key", "params", "body", "static"],
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"],
fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, _core.functionTypeAnnotationCommon, {
key: {
validate: (0, _utils.assertNodeType)("PrivateName")
},
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
})
});
(0, _utils.default)("Import", {
aliases: ["Expression"]
});
(0, _utils.default)("ImportAttribute", {
visitor: ["key", "value"],
fields: {
key: {
validate: (0, _utils.assertNodeType)("Identifier")
},
value: {
validate: (0, _utils.assertNodeType)("StringLiteral")
}
}
});
(0, _utils.default)("Decorator", {
visitor: ["expression"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("DoExpression", {
visitor: ["body"],
aliases: ["Expression"],
fields: {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
}
});
(0, _utils.default)("ExportDefaultSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("ExportNamespaceSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("PrivateName", {
visitor: ["id"],
aliases: ["Private"],
fields: {
id: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(0, _utils.default)("BigIntLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("RecordExpression", {
visitor: ["properties"],
aliases: ["Expression"],
fields: {
properties: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ObjectProperty", "SpreadElement")))
}
}
});
(0, _utils.default)("TupleExpression", {
fields: {
elements: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "SpreadElement"))),
default: []
}
},
visitor: ["elements"],
aliases: ["Expression"]
});
/***/ }),
/* 787 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = _interopRequireWildcard(__webpack_require__(571));
var _core = __webpack_require__(600);
var _es = __webpack_require__(628);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
const bool = (0, _utils.assertValueType)("boolean");
const tSFunctionTypeAnnotationCommon = {
returnType: {
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
optional: true
},
typeParameters: {
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
optional: true
}
};
(0, _utils.default)("TSParameterProperty", {
aliases: ["LVal"],
visitor: ["parameter"],
fields: {
accessibility: {
validate: (0, _utils.assertOneOf)("public", "private", "protected"),
optional: true
},
readonly: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
parameter: {
validate: (0, _utils.assertNodeType)("Identifier", "AssignmentPattern")
}
}
});
(0, _utils.default)("TSDeclareFunction", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "typeParameters", "params", "returnType"],
fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
});
(0, _utils.default)("TSDeclareMethod", {
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
fields: Object.assign({}, _es.classMethodOrDeclareMethodCommon, tSFunctionTypeAnnotationCommon)
});
(0, _utils.default)("TSQualifiedName", {
aliases: ["TSEntityName"],
visitor: ["left", "right"],
fields: {
left: (0, _utils.validateType)("TSEntityName"),
right: (0, _utils.validateType)("Identifier")
}
});
const signatureDeclarationCommon = {
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
parameters: (0, _utils.validateArrayOfType)(["Identifier", "RestElement"]),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
};
const callConstructSignatureDeclaration = {
aliases: ["TSTypeElement"],
visitor: ["typeParameters", "parameters", "typeAnnotation"],
fields: signatureDeclarationCommon
};
(0, _utils.default)("TSCallSignatureDeclaration", callConstructSignatureDeclaration);
(0, _utils.default)("TSConstructSignatureDeclaration", callConstructSignatureDeclaration);
const namedTypeElementCommon = {
key: (0, _utils.validateType)("Expression"),
computed: (0, _utils.validate)(bool),
optional: (0, _utils.validateOptional)(bool)
};
(0, _utils.default)("TSPropertySignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeAnnotation", "initializer"],
fields: Object.assign({}, namedTypeElementCommon, {
readonly: (0, _utils.validateOptional)(bool),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
initializer: (0, _utils.validateOptionalType)("Expression")
})
});
(0, _utils.default)("TSMethodSignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon)
});
(0, _utils.default)("TSIndexSignature", {
aliases: ["TSTypeElement"],
visitor: ["parameters", "typeAnnotation"],
fields: {
readonly: (0, _utils.validateOptional)(bool),
parameters: (0, _utils.validateArrayOfType)("Identifier"),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
}
});
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"];
for (const type of tsKeywordTypes) {
(0, _utils.default)(type, {
aliases: ["TSType", "TSBaseType"],
visitor: [],
fields: {}
});
}
(0, _utils.default)("TSThisType", {
aliases: ["TSType", "TSBaseType"],
visitor: [],
fields: {}
});
const fnOrCtr = {
aliases: ["TSType"],
visitor: ["typeParameters", "parameters", "typeAnnotation"],
fields: signatureDeclarationCommon
};
(0, _utils.default)("TSFunctionType", fnOrCtr);
(0, _utils.default)("TSConstructorType", fnOrCtr);
(0, _utils.default)("TSTypeReference", {
aliases: ["TSType"],
visitor: ["typeName", "typeParameters"],
fields: {
typeName: (0, _utils.validateType)("TSEntityName"),
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
}
});
(0, _utils.default)("TSTypePredicate", {
aliases: ["TSType"],
visitor: ["parameterName", "typeAnnotation"],
builder: ["parameterName", "typeAnnotation", "asserts"],
fields: {
parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
asserts: (0, _utils.validateOptional)(bool)
}
});
(0, _utils.default)("TSTypeQuery", {
aliases: ["TSType"],
visitor: ["exprName"],
fields: {
exprName: (0, _utils.validateType)(["TSEntityName", "TSImportType"])
}
});
(0, _utils.default)("TSTypeLiteral", {
aliases: ["TSType"],
visitor: ["members"],
fields: {
members: (0, _utils.validateArrayOfType)("TSTypeElement")
}
});
(0, _utils.default)("TSArrayType", {
aliases: ["TSType"],
visitor: ["elementType"],
fields: {
elementType: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSTupleType", {
aliases: ["TSType"],
visitor: ["elementTypes"],
fields: {
elementTypes: (0, _utils.validateArrayOfType)("TSType")
}
});
(0, _utils.default)("TSOptionalType", {
aliases: ["TSType"],
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSRestType", {
aliases: ["TSType"],
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
const unionOrIntersection = {
aliases: ["TSType"],
visitor: ["types"],
fields: {
types: (0, _utils.validateArrayOfType)("TSType")
}
};
(0, _utils.default)("TSUnionType", unionOrIntersection);
(0, _utils.default)("TSIntersectionType", unionOrIntersection);
(0, _utils.default)("TSConditionalType", {
aliases: ["TSType"],
visitor: ["checkType", "extendsType", "trueType", "falseType"],
fields: {
checkType: (0, _utils.validateType)("TSType"),
extendsType: (0, _utils.validateType)("TSType"),
trueType: (0, _utils.validateType)("TSType"),
falseType: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSInferType", {
aliases: ["TSType"],
visitor: ["typeParameter"],
fields: {
typeParameter: (0, _utils.validateType)("TSTypeParameter")
}
});
(0, _utils.default)("TSParenthesizedType", {
aliases: ["TSType"],
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSTypeOperator", {
aliases: ["TSType"],
visitor: ["typeAnnotation"],
fields: {
operator: (0, _utils.validate)((0, _utils.assertValueType)("string")),
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSIndexedAccessType", {
aliases: ["TSType"],
visitor: ["objectType", "indexType"],
fields: {
objectType: (0, _utils.validateType)("TSType"),
indexType: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSMappedType", {
aliases: ["TSType"],
visitor: ["typeParameter", "typeAnnotation"],
fields: {
readonly: (0, _utils.validateOptional)(bool),
typeParameter: (0, _utils.validateType)("TSTypeParameter"),
optional: (0, _utils.validateOptional)(bool),
typeAnnotation: (0, _utils.validateOptionalType)("TSType")
}
});
(0, _utils.default)("TSLiteralType", {
aliases: ["TSType", "TSBaseType"],
visitor: ["literal"],
fields: {
literal: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral"])
}
});
(0, _utils.default)("TSExpressionWithTypeArguments", {
aliases: ["TSType"],
visitor: ["expression", "typeParameters"],
fields: {
expression: (0, _utils.validateType)("TSEntityName"),
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
}
});
(0, _utils.default)("TSInterfaceDeclaration", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "typeParameters", "extends", "body"],
fields: {
declare: (0, _utils.validateOptional)(bool),
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("TSExpressionWithTypeArguments")),
body: (0, _utils.validateType)("TSInterfaceBody")
}
});
(0, _utils.default)("TSInterfaceBody", {
visitor: ["body"],
fields: {
body: (0, _utils.validateArrayOfType)("TSTypeElement")
}
});
(0, _utils.default)("TSTypeAliasDeclaration", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "typeParameters", "typeAnnotation"],
fields: {
declare: (0, _utils.validateOptional)(bool),
id: (0, _utils.validateType)("Identifier"),
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSAsExpression", {
aliases: ["Expression"],
visitor: ["expression", "typeAnnotation"],
fields: {
expression: (0, _utils.validateType)("Expression"),
typeAnnotation: (0, _utils.validateType)("TSType")
}
});
(0, _utils.default)("TSTypeAssertion", {
aliases: ["Expression"],
visitor: ["typeAnnotation", "expression"],
fields: {
typeAnnotation: (0, _utils.validateType)("TSType"),
expression: (0, _utils.validateType)("Expression")
}
});
(0, _utils.default)("TSEnumDeclaration", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "members"],
fields: {
declare: (0, _utils.validateOptional)(bool),
const: (0, _utils.validateOptional)(bool),
id: (0, _utils.validateType)("Identifier"),
members: (0, _utils.validateArrayOfType)("TSEnumMember"),
initializer: (0, _utils.validateOptionalType)("Expression")
}
});
(0, _utils.default)("TSEnumMember", {
visitor: ["id", "initializer"],
fields: {
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
initializer: (0, _utils.validateOptionalType)("Expression")
}
});
(0, _utils.default)("TSModuleDeclaration", {
aliases: ["Statement", "Declaration"],
visitor: ["id", "body"],
fields: {
declare: (0, _utils.validateOptional)(bool),
global: (0, _utils.validateOptional)(bool),
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
body: (0, _utils.validateType)(["TSModuleBlock", "TSModuleDeclaration"])
}
});
(0, _utils.default)("TSModuleBlock", {
aliases: ["Scopable", "Block", "BlockParent"],
visitor: ["body"],
fields: {
body: (0, _utils.validateArrayOfType)("Statement")
}
});
(0, _utils.default)("TSImportType", {
aliases: ["TSType"],
visitor: ["argument", "qualifier", "typeParameters"],
fields: {
argument: (0, _utils.validateType)("StringLiteral"),
qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
}
});
(0, _utils.default)("TSImportEqualsDeclaration", {
aliases: ["Statement"],
visitor: ["id", "moduleReference"],
fields: {
isExport: (0, _utils.validate)(bool),
id: (0, _utils.validateType)("Identifier"),
moduleReference: (0, _utils.validateType)(["TSEntityName", "TSExternalModuleReference"])
}
});
(0, _utils.default)("TSExternalModuleReference", {
visitor: ["expression"],
fields: {
expression: (0, _utils.validateType)("StringLiteral")
}
});
(0, _utils.default)("TSNonNullExpression", {
aliases: ["Expression"],
visitor: ["expression"],
fields: {
expression: (0, _utils.validateType)("Expression")
}
});
(0, _utils.default)("TSExportAssignment", {
aliases: ["Statement"],
visitor: ["expression"],
fields: {
expression: (0, _utils.validateType)("Expression")
}
});
(0, _utils.default)("TSNamespaceExportDeclaration", {
aliases: ["Statement"],
visitor: ["id"],
fields: {
id: (0, _utils.validateType)("Identifier")
}
});
(0, _utils.default)("TSTypeAnnotation", {
visitor: ["typeAnnotation"],
fields: {
typeAnnotation: {
validate: (0, _utils.assertNodeType)("TSType")
}
}
});
(0, _utils.default)("TSTypeParameterInstantiation", {
visitor: ["params"],
fields: {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSType")))
}
}
});
(0, _utils.default)("TSTypeParameterDeclaration", {
visitor: ["params"],
fields: {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSTypeParameter")))
}
}
});
(0, _utils.default)("TSTypeParameter", {
builder: ["constraint", "default", "name"],
visitor: ["constraint", "default"],
fields: {
name: {
validate: (0, _utils.assertValueType)("string")
},
constraint: {
validate: (0, _utils.assertNodeType)("TSType"),
optional: true
},
default: {
validate: (0, _utils.assertNodeType)("TSType"),
optional: true
}
}
});
/***/ }),
/* 788 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = assertNode;
var _isNode = _interopRequireDefault(__webpack_require__(669));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function assertNode(node) {
if (!(0, _isNode.default)(node)) {
var _node$type;
const type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node);
throw new TypeError(`Not a valid node of type "${type}"`);
}
}
/***/ }),
/* 789 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.assertArrayExpression = assertArrayExpression;
exports.assertAssignmentExpression = assertAssignmentExpression;
exports.assertBinaryExpression = assertBinaryExpression;
exports.assertInterpreterDirective = assertInterpreterDirective;
exports.assertDirective = assertDirective;
exports.assertDirectiveLiteral = assertDirectiveLiteral;
exports.assertBlockStatement = assertBlockStatement;
exports.assertBreakStatement = assertBreakStatement;
exports.assertCallExpression = assertCallExpression;
exports.assertCatchClause = assertCatchClause;
exports.assertConditionalExpression = assertConditionalExpression;
exports.assertContinueStatement = assertContinueStatement;
exports.assertDebuggerStatement = assertDebuggerStatement;
exports.assertDoWhileStatement = assertDoWhileStatement;
exports.assertEmptyStatement = assertEmptyStatement;
exports.assertExpressionStatement = assertExpressionStatement;
exports.assertFile = assertFile;
exports.assertForInStatement = assertForInStatement;
exports.assertForStatement = assertForStatement;
exports.assertFunctionDeclaration = assertFunctionDeclaration;
exports.assertFunctionExpression = assertFunctionExpression;
exports.assertIdentifier = assertIdentifier;
exports.assertIfStatement = assertIfStatement;
exports.assertLabeledStatement = assertLabeledStatement;
exports.assertStringLiteral = assertStringLiteral;
exports.assertNumericLiteral = assertNumericLiteral;
exports.assertNullLiteral = assertNullLiteral;
exports.assertBooleanLiteral = assertBooleanLiteral;
exports.assertRegExpLiteral = assertRegExpLiteral;
exports.assertLogicalExpression = assertLogicalExpression;
exports.assertMemberExpression = assertMemberExpression;
exports.assertNewExpression = assertNewExpression;
exports.assertProgram = assertProgram;
exports.assertObjectExpression = assertObjectExpression;
exports.assertObjectMethod = assertObjectMethod;
exports.assertObjectProperty = assertObjectProperty;
exports.assertRestElement = assertRestElement;
exports.assertReturnStatement = assertReturnStatement;
exports.assertSequenceExpression = assertSequenceExpression;
exports.assertParenthesizedExpression = assertParenthesizedExpression;
exports.assertSwitchCase = assertSwitchCase;
exports.assertSwitchStatement = assertSwitchStatement;
exports.assertThisExpression = assertThisExpression;
exports.assertThrowStatement = assertThrowStatement;
exports.assertTryStatement = assertTryStatement;
exports.assertUnaryExpression = assertUnaryExpression;
exports.assertUpdateExpression = assertUpdateExpression;
exports.assertVariableDeclaration = assertVariableDeclaration;
exports.assertVariableDeclarator = assertVariableDeclarator;
exports.assertWhileStatement = assertWhileStatement;
exports.assertWithStatement = assertWithStatement;
exports.assertAssignmentPattern = assertAssignmentPattern;
exports.assertArrayPattern = assertArrayPattern;
exports.assertArrowFunctionExpression = assertArrowFunctionExpression;
exports.assertClassBody = assertClassBody;
exports.assertClassExpression = assertClassExpression;
exports.assertClassDeclaration = assertClassDeclaration;
exports.assertExportAllDeclaration = assertExportAllDeclaration;
exports.assertExportDefaultDeclaration = assertExportDefaultDeclaration;
exports.assertExportNamedDeclaration = assertExportNamedDeclaration;
exports.assertExportSpecifier = assertExportSpecifier;
exports.assertForOfStatement = assertForOfStatement;
exports.assertImportDeclaration = assertImportDeclaration;
exports.assertImportDefaultSpecifier = assertImportDefaultSpecifier;
exports.assertImportNamespaceSpecifier = assertImportNamespaceSpecifier;
exports.assertImportSpecifier = assertImportSpecifier;
exports.assertMetaProperty = assertMetaProperty;
exports.assertClassMethod = assertClassMethod;
exports.assertObjectPattern = assertObjectPattern;
exports.assertSpreadElement = assertSpreadElement;
exports.assertSuper = assertSuper;
exports.assertTaggedTemplateExpression = assertTaggedTemplateExpression;
exports.assertTemplateElement = assertTemplateElement;
exports.assertTemplateLiteral = assertTemplateLiteral;
exports.assertYieldExpression = assertYieldExpression;
exports.assertAnyTypeAnnotation = assertAnyTypeAnnotation;
exports.assertArrayTypeAnnotation = assertArrayTypeAnnotation;
exports.assertBooleanTypeAnnotation = assertBooleanTypeAnnotation;
exports.assertBooleanLiteralTypeAnnotation = assertBooleanLiteralTypeAnnotation;
exports.assertNullLiteralTypeAnnotation = assertNullLiteralTypeAnnotation;
exports.assertClassImplements = assertClassImplements;
exports.assertDeclareClass = assertDeclareClass;
exports.assertDeclareFunction = assertDeclareFunction;
exports.assertDeclareInterface = assertDeclareInterface;
exports.assertDeclareModule = assertDeclareModule;
exports.assertDeclareModuleExports = assertDeclareModuleExports;
exports.assertDeclareTypeAlias = assertDeclareTypeAlias;
exports.assertDeclareOpaqueType = assertDeclareOpaqueType;
exports.assertDeclareVariable = assertDeclareVariable;
exports.assertDeclareExportDeclaration = assertDeclareExportDeclaration;
exports.assertDeclareExportAllDeclaration = assertDeclareExportAllDeclaration;
exports.assertDeclaredPredicate = assertDeclaredPredicate;
exports.assertExistsTypeAnnotation = assertExistsTypeAnnotation;
exports.assertFunctionTypeAnnotation = assertFunctionTypeAnnotation;
exports.assertFunctionTypeParam = assertFunctionTypeParam;
exports.assertGenericTypeAnnotation = assertGenericTypeAnnotation;
exports.assertInferredPredicate = assertInferredPredicate;
exports.assertInterfaceExtends = assertInterfaceExtends;
exports.assertInterfaceDeclaration = assertInterfaceDeclaration;
exports.assertInterfaceTypeAnnotation = assertInterfaceTypeAnnotation;
exports.assertIntersectionTypeAnnotation = assertIntersectionTypeAnnotation;
exports.assertMixedTypeAnnotation = assertMixedTypeAnnotation;
exports.assertEmptyTypeAnnotation = assertEmptyTypeAnnotation;
exports.assertNullableTypeAnnotation = assertNullableTypeAnnotation;
exports.assertNumberLiteralTypeAnnotation = assertNumberLiteralTypeAnnotation;
exports.assertNumberTypeAnnotation = assertNumberTypeAnnotation;
exports.assertObjectTypeAnnotation = assertObjectTypeAnnotation;
exports.assertObjectTypeInternalSlot = assertObjectTypeInternalSlot;
exports.assertObjectTypeCallProperty = assertObjectTypeCallProperty;
exports.assertObjectTypeIndexer = assertObjectTypeIndexer;
exports.assertObjectTypeProperty = assertObjectTypeProperty;
exports.assertObjectTypeSpreadProperty = assertObjectTypeSpreadProperty;
exports.assertOpaqueType = assertOpaqueType;
exports.assertQualifiedTypeIdentifier = assertQualifiedTypeIdentifier;
exports.assertStringLiteralTypeAnnotation = assertStringLiteralTypeAnnotation;
exports.assertStringTypeAnnotation = assertStringTypeAnnotation;
exports.assertSymbolTypeAnnotation = assertSymbolTypeAnnotation;
exports.assertThisTypeAnnotation = assertThisTypeAnnotation;
exports.assertTupleTypeAnnotation = assertTupleTypeAnnotation;
exports.assertTypeofTypeAnnotation = assertTypeofTypeAnnotation;
exports.assertTypeAlias = assertTypeAlias;
exports.assertTypeAnnotation = assertTypeAnnotation;
exports.assertTypeCastExpression = assertTypeCastExpression;
exports.assertTypeParameter = assertTypeParameter;
exports.assertTypeParameterDeclaration = assertTypeParameterDeclaration;
exports.assertTypeParameterInstantiation = assertTypeParameterInstantiation;
exports.assertUnionTypeAnnotation = assertUnionTypeAnnotation;
exports.assertVariance = assertVariance;
exports.assertVoidTypeAnnotation = assertVoidTypeAnnotation;
exports.assertEnumDeclaration = assertEnumDeclaration;
exports.assertEnumBooleanBody = assertEnumBooleanBody;
exports.assertEnumNumberBody = assertEnumNumberBody;
exports.assertEnumStringBody = assertEnumStringBody;
exports.assertEnumSymbolBody = assertEnumSymbolBody;
exports.assertEnumBooleanMember = assertEnumBooleanMember;
exports.assertEnumNumberMember = assertEnumNumberMember;
exports.assertEnumStringMember = assertEnumStringMember;
exports.assertEnumDefaultedMember = assertEnumDefaultedMember;
exports.assertJSXAttribute = assertJSXAttribute;
exports.assertJSXClosingElement = assertJSXClosingElement;
exports.assertJSXElement = assertJSXElement;
exports.assertJSXEmptyExpression = assertJSXEmptyExpression;
exports.assertJSXExpressionContainer = assertJSXExpressionContainer;
exports.assertJSXSpreadChild = assertJSXSpreadChild;
exports.assertJSXIdentifier = assertJSXIdentifier;
exports.assertJSXMemberExpression = assertJSXMemberExpression;
exports.assertJSXNamespacedName = assertJSXNamespacedName;
exports.assertJSXOpeningElement = assertJSXOpeningElement;
exports.assertJSXSpreadAttribute = assertJSXSpreadAttribute;
exports.assertJSXText = assertJSXText;
exports.assertJSXFragment = assertJSXFragment;
exports.assertJSXOpeningFragment = assertJSXOpeningFragment;
exports.assertJSXClosingFragment = assertJSXClosingFragment;
exports.assertNoop = assertNoop;
exports.assertPlaceholder = assertPlaceholder;
exports.assertV8IntrinsicIdentifier = assertV8IntrinsicIdentifier;
exports.assertArgumentPlaceholder = assertArgumentPlaceholder;
exports.assertAwaitExpression = assertAwaitExpression;
exports.assertBindExpression = assertBindExpression;
exports.assertClassProperty = assertClassProperty;
exports.assertOptionalMemberExpression = assertOptionalMemberExpression;
exports.assertPipelineTopicExpression = assertPipelineTopicExpression;
exports.assertPipelineBareFunction = assertPipelineBareFunction;
exports.assertPipelinePrimaryTopicReference = assertPipelinePrimaryTopicReference;
exports.assertOptionalCallExpression = assertOptionalCallExpression;
exports.assertClassPrivateProperty = assertClassPrivateProperty;
exports.assertClassPrivateMethod = assertClassPrivateMethod;
exports.assertImport = assertImport;
exports.assertImportAttribute = assertImportAttribute;
exports.assertDecorator = assertDecorator;
exports.assertDoExpression = assertDoExpression;
exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier;
exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier;
exports.assertPrivateName = assertPrivateName;
exports.assertBigIntLiteral = assertBigIntLiteral;
exports.assertRecordExpression = assertRecordExpression;
exports.assertTupleExpression = assertTupleExpression;
exports.assertTSParameterProperty = assertTSParameterProperty;
exports.assertTSDeclareFunction = assertTSDeclareFunction;
exports.assertTSDeclareMethod = assertTSDeclareMethod;
exports.assertTSQualifiedName = assertTSQualifiedName;
exports.assertTSCallSignatureDeclaration = assertTSCallSignatureDeclaration;
exports.assertTSConstructSignatureDeclaration = assertTSConstructSignatureDeclaration;
exports.assertTSPropertySignature = assertTSPropertySignature;
exports.assertTSMethodSignature = assertTSMethodSignature;
exports.assertTSIndexSignature = assertTSIndexSignature;
exports.assertTSAnyKeyword = assertTSAnyKeyword;
exports.assertTSBooleanKeyword = assertTSBooleanKeyword;
exports.assertTSBigIntKeyword = assertTSBigIntKeyword;
exports.assertTSNeverKeyword = assertTSNeverKeyword;
exports.assertTSNullKeyword = assertTSNullKeyword;
exports.assertTSNumberKeyword = assertTSNumberKeyword;
exports.assertTSObjectKeyword = assertTSObjectKeyword;
exports.assertTSStringKeyword = assertTSStringKeyword;
exports.assertTSSymbolKeyword = assertTSSymbolKeyword;
exports.assertTSUndefinedKeyword = assertTSUndefinedKeyword;
exports.assertTSUnknownKeyword = assertTSUnknownKeyword;
exports.assertTSVoidKeyword = assertTSVoidKeyword;
exports.assertTSThisType = assertTSThisType;
exports.assertTSFunctionType = assertTSFunctionType;
exports.assertTSConstructorType = assertTSConstructorType;
exports.assertTSTypeReference = assertTSTypeReference;
exports.assertTSTypePredicate = assertTSTypePredicate;
exports.assertTSTypeQuery = assertTSTypeQuery;
exports.assertTSTypeLiteral = assertTSTypeLiteral;
exports.assertTSArrayType = assertTSArrayType;
exports.assertTSTupleType = assertTSTupleType;
exports.assertTSOptionalType = assertTSOptionalType;
exports.assertTSRestType = assertTSRestType;
exports.assertTSUnionType = assertTSUnionType;
exports.assertTSIntersectionType = assertTSIntersectionType;
exports.assertTSConditionalType = assertTSConditionalType;
exports.assertTSInferType = assertTSInferType;
exports.assertTSParenthesizedType = assertTSParenthesizedType;
exports.assertTSTypeOperator = assertTSTypeOperator;
exports.assertTSIndexedAccessType = assertTSIndexedAccessType;
exports.assertTSMappedType = assertTSMappedType;
exports.assertTSLiteralType = assertTSLiteralType;
exports.assertTSExpressionWithTypeArguments = assertTSExpressionWithTypeArguments;
exports.assertTSInterfaceDeclaration = assertTSInterfaceDeclaration;
exports.assertTSInterfaceBody = assertTSInterfaceBody;
exports.assertTSTypeAliasDeclaration = assertTSTypeAliasDeclaration;
exports.assertTSAsExpression = assertTSAsExpression;
exports.assertTSTypeAssertion = assertTSTypeAssertion;
exports.assertTSEnumDeclaration = assertTSEnumDeclaration;
exports.assertTSEnumMember = assertTSEnumMember;
exports.assertTSModuleDeclaration = assertTSModuleDeclaration;
exports.assertTSModuleBlock = assertTSModuleBlock;
exports.assertTSImportType = assertTSImportType;
exports.assertTSImportEqualsDeclaration = assertTSImportEqualsDeclaration;
exports.assertTSExternalModuleReference = assertTSExternalModuleReference;
exports.assertTSNonNullExpression = assertTSNonNullExpression;
exports.assertTSExportAssignment = assertTSExportAssignment;
exports.assertTSNamespaceExportDeclaration = assertTSNamespaceExportDeclaration;
exports.assertTSTypeAnnotation = assertTSTypeAnnotation;
exports.assertTSTypeParameterInstantiation = assertTSTypeParameterInstantiation;
exports.assertTSTypeParameterDeclaration = assertTSTypeParameterDeclaration;
exports.assertTSTypeParameter = assertTSTypeParameter;
exports.assertExpression = assertExpression;
exports.assertBinary = assertBinary;
exports.assertScopable = assertScopable;
exports.assertBlockParent = assertBlockParent;
exports.assertBlock = assertBlock;
exports.assertStatement = assertStatement;
exports.assertTerminatorless = assertTerminatorless;
exports.assertCompletionStatement = assertCompletionStatement;
exports.assertConditional = assertConditional;
exports.assertLoop = assertLoop;
exports.assertWhile = assertWhile;
exports.assertExpressionWrapper = assertExpressionWrapper;
exports.assertFor = assertFor;
exports.assertForXStatement = assertForXStatement;
exports.assertFunction = assertFunction;
exports.assertFunctionParent = assertFunctionParent;
exports.assertPureish = assertPureish;
exports.assertDeclaration = assertDeclaration;
exports.assertPatternLike = assertPatternLike;
exports.assertLVal = assertLVal;
exports.assertTSEntityName = assertTSEntityName;
exports.assertLiteral = assertLiteral;
exports.assertImmutable = assertImmutable;
exports.assertUserWhitespacable = assertUserWhitespacable;
exports.assertMethod = assertMethod;
exports.assertObjectMember = assertObjectMember;
exports.assertProperty = assertProperty;
exports.assertUnaryLike = assertUnaryLike;
exports.assertPattern = assertPattern;
exports.assertClass = assertClass;
exports.assertModuleDeclaration = assertModuleDeclaration;
exports.assertExportDeclaration = assertExportDeclaration;
exports.assertModuleSpecifier = assertModuleSpecifier;
exports.assertFlow = assertFlow;
exports.assertFlowType = assertFlowType;
exports.assertFlowBaseAnnotation = assertFlowBaseAnnotation;
exports.assertFlowDeclaration = assertFlowDeclaration;
exports.assertFlowPredicate = assertFlowPredicate;
exports.assertEnumBody = assertEnumBody;
exports.assertEnumMember = assertEnumMember;
exports.assertJSX = assertJSX;
exports.assertPrivate = assertPrivate;
exports.assertTSTypeElement = assertTSTypeElement;
exports.assertTSType = assertTSType;
exports.assertTSBaseType = assertTSBaseType;
exports.assertNumberLiteral = assertNumberLiteral;
exports.assertRegexLiteral = assertRegexLiteral;
exports.assertRestProperty = assertRestProperty;
exports.assertSpreadProperty = assertSpreadProperty;
var _is = _interopRequireDefault(__webpack_require__(579));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function assert(type, node, opts) {
if (!(0, _is.default)(type, node, opts)) {
throw new Error(`Expected type "${type}" with option ${JSON.stringify(opts)}, ` + `but instead got "${node.type}".`);
}
}
function assertArrayExpression(node, opts = {}) {
assert("ArrayExpression", node, opts);
}
function assertAssignmentExpression(node, opts = {}) {
assert("AssignmentExpression", node, opts);
}
function assertBinaryExpression(node, opts = {}) {
assert("BinaryExpression", node, opts);
}
function assertInterpreterDirective(node, opts = {}) {
assert("InterpreterDirective", node, opts);
}
function assertDirective(node, opts = {}) {
assert("Directive", node, opts);
}
function assertDirectiveLiteral(node, opts = {}) {
assert("DirectiveLiteral", node, opts);
}
function assertBlockStatement(node, opts = {}) {
assert("BlockStatement", node, opts);
}
function assertBreakStatement(node, opts = {}) {
assert("BreakStatement", node, opts);
}
function assertCallExpression(node, opts = {}) {
assert("CallExpression", node, opts);
}
function assertCatchClause(node, opts = {}) {
assert("CatchClause", node, opts);
}
function assertConditionalExpression(node, opts = {}) {
assert("ConditionalExpression", node, opts);
}
function assertContinueStatement(node, opts = {}) {
assert("ContinueStatement", node, opts);
}
function assertDebuggerStatement(node, opts = {}) {
assert("DebuggerStatement", node, opts);
}
function assertDoWhileStatement(node, opts = {}) {
assert("DoWhileStatement", node, opts);
}
function assertEmptyStatement(node, opts = {}) {
assert("EmptyStatement", node, opts);
}
function assertExpressionStatement(node, opts = {}) {
assert("ExpressionStatement", node, opts);
}
function assertFile(node, opts = {}) {
assert("File", node, opts);
}
function assertForInStatement(node, opts = {}) {
assert("ForInStatement", node, opts);
}
function assertForStatement(node, opts = {}) {
assert("ForStatement", node, opts);
}
function assertFunctionDeclaration(node, opts = {}) {
assert("FunctionDeclaration", node, opts);
}
function assertFunctionExpression(node, opts = {}) {
assert("FunctionExpression", node, opts);
}
function assertIdentifier(node, opts = {}) {
assert("Identifier", node, opts);
}
function assertIfStatement(node, opts = {}) {
assert("IfStatement", node, opts);
}
function assertLabeledStatement(node, opts = {}) {
assert("LabeledStatement", node, opts);
}
function assertStringLiteral(node, opts = {}) {
assert("StringLiteral", node, opts);
}
function assertNumericLiteral(node, opts = {}) {
assert("NumericLiteral", node, opts);
}
function assertNullLiteral(node, opts = {}) {
assert("NullLiteral", node, opts);
}
function assertBooleanLiteral(node, opts = {}) {
assert("BooleanLiteral", node, opts);
}
function assertRegExpLiteral(node, opts = {}) {
assert("RegExpLiteral", node, opts);
}
function assertLogicalExpression(node, opts = {}) {
assert("LogicalExpression", node, opts);
}
function assertMemberExpression(node, opts = {}) {
assert("MemberExpression", node, opts);
}
function assertNewExpression(node, opts = {}) {
assert("NewExpression", node, opts);
}
function assertProgram(node, opts = {}) {
assert("Program", node, opts);
}
function assertObjectExpression(node, opts = {}) {
assert("ObjectExpression", node, opts);
}
function assertObjectMethod(node, opts = {}) {
assert("ObjectMethod", node, opts);
}
function assertObjectProperty(node, opts = {}) {
assert("ObjectProperty", node, opts);
}
function assertRestElement(node, opts = {}) {
assert("RestElement", node, opts);
}
function assertReturnStatement(node, opts = {}) {
assert("ReturnStatement", node, opts);
}
function assertSequenceExpression(node, opts = {}) {
assert("SequenceExpression", node, opts);
}
function assertParenthesizedExpression(node, opts = {}) {
assert("ParenthesizedExpression", node, opts);
}
function assertSwitchCase(node, opts = {}) {
assert("SwitchCase", node, opts);
}
function assertSwitchStatement(node, opts = {}) {
assert("SwitchStatement", node, opts);
}
function assertThisExpression(node, opts = {}) {
assert("ThisExpression", node, opts);
}
function assertThrowStatement(node, opts = {}) {
assert("ThrowStatement", node, opts);
}
function assertTryStatement(node, opts = {}) {
assert("TryStatement", node, opts);
}
function assertUnaryExpression(node, opts = {}) {
assert("UnaryExpression", node, opts);
}
function assertUpdateExpression(node, opts = {}) {
assert("UpdateExpression", node, opts);
}
function assertVariableDeclaration(node, opts = {}) {
assert("VariableDeclaration", node, opts);
}
function assertVariableDeclarator(node, opts = {}) {
assert("VariableDeclarator", node, opts);
}
function assertWhileStatement(node, opts = {}) {
assert("WhileStatement", node, opts);
}
function assertWithStatement(node, opts = {}) {
assert("WithStatement", node, opts);
}
function assertAssignmentPattern(node, opts = {}) {
assert("AssignmentPattern", node, opts);
}
function assertArrayPattern(node, opts = {}) {
assert("ArrayPattern", node, opts);
}
function assertArrowFunctionExpression(node, opts = {}) {
assert("ArrowFunctionExpression", node, opts);
}
function assertClassBody(node, opts = {}) {
assert("ClassBody", node, opts);
}
function assertClassExpression(node, opts = {}) {
assert("ClassExpression", node, opts);
}
function assertClassDeclaration(node, opts = {}) {
assert("ClassDeclaration", node, opts);
}
function assertExportAllDeclaration(node, opts = {}) {
assert("ExportAllDeclaration", node, opts);
}
function assertExportDefaultDeclaration(node, opts = {}) {
assert("ExportDefaultDeclaration", node, opts);
}
function assertExportNamedDeclaration(node, opts = {}) {
assert("ExportNamedDeclaration", node, opts);
}
function assertExportSpecifier(node, opts = {}) {
assert("ExportSpecifier", node, opts);
}
function assertForOfStatement(node, opts = {}) {
assert("ForOfStatement", node, opts);
}
function assertImportDeclaration(node, opts = {}) {
assert("ImportDeclaration", node, opts);
}
function assertImportDefaultSpecifier(node, opts = {}) {
assert("ImportDefaultSpecifier", node, opts);
}
function assertImportNamespaceSpecifier(node, opts = {}) {
assert("ImportNamespaceSpecifier", node, opts);
}
function assertImportSpecifier(node, opts = {}) {
assert("ImportSpecifier", node, opts);
}
function assertMetaProperty(node, opts = {}) {
assert("MetaProperty", node, opts);
}
function assertClassMethod(node, opts = {}) {
assert("ClassMethod", node, opts);
}
function assertObjectPattern(node, opts = {}) {
assert("ObjectPattern", node, opts);
}
function assertSpreadElement(node, opts = {}) {
assert("SpreadElement", node, opts);
}
function assertSuper(node, opts = {}) {
assert("Super", node, opts);
}
function assertTaggedTemplateExpression(node, opts = {}) {
assert("TaggedTemplateExpression", node, opts);
}
function assertTemplateElement(node, opts = {}) {
assert("TemplateElement", node, opts);
}
function assertTemplateLiteral(node, opts = {}) {
assert("TemplateLiteral", node, opts);
}
function assertYieldExpression(node, opts = {}) {
assert("YieldExpression", node, opts);
}
function assertAnyTypeAnnotation(node, opts = {}) {
assert("AnyTypeAnnotation", node, opts);
}
function assertArrayTypeAnnotation(node, opts = {}) {
assert("ArrayTypeAnnotation", node, opts);
}
function assertBooleanTypeAnnotation(node, opts = {}) {
assert("BooleanTypeAnnotation", node, opts);
}
function assertBooleanLiteralTypeAnnotation(node, opts = {}) {
assert("BooleanLiteralTypeAnnotation", node, opts);
}
function assertNullLiteralTypeAnnotation(node, opts = {}) {
assert("NullLiteralTypeAnnotation", node, opts);
}
function assertClassImplements(node, opts = {}) {
assert("ClassImplements", node, opts);
}
function assertDeclareClass(node, opts = {}) {
assert("DeclareClass", node, opts);
}
function assertDeclareFunction(node, opts = {}) {
assert("DeclareFunction", node, opts);
}
function assertDeclareInterface(node, opts = {}) {
assert("DeclareInterface", node, opts);
}
function assertDeclareModule(node, opts = {}) {
assert("DeclareModule", node, opts);
}
function assertDeclareModuleExports(node, opts = {}) {
assert("DeclareModuleExports", node, opts);
}
function assertDeclareTypeAlias(node, opts = {}) {
assert("DeclareTypeAlias", node, opts);
}
function assertDeclareOpaqueType(node, opts = {}) {
assert("DeclareOpaqueType", node, opts);
}
function assertDeclareVariable(node, opts = {}) {
assert("DeclareVariable", node, opts);
}
function assertDeclareExportDeclaration(node, opts = {}) {
assert("DeclareExportDeclaration", node, opts);
}
function assertDeclareExportAllDeclaration(node, opts = {}) {
assert("DeclareExportAllDeclaration", node, opts);
}
function assertDeclaredPredicate(node, opts = {}) {
assert("DeclaredPredicate", node, opts);
}
function assertExistsTypeAnnotation(node, opts = {}) {
assert("ExistsTypeAnnotation", node, opts);
}
function assertFunctionTypeAnnotation(node, opts = {}) {
assert("FunctionTypeAnnotation", node, opts);
}
function assertFunctionTypeParam(node, opts = {}) {
assert("FunctionTypeParam", node, opts);
}
function assertGenericTypeAnnotation(node, opts = {}) {
assert("GenericTypeAnnotation", node, opts);
}
function assertInferredPredicate(node, opts = {}) {
assert("InferredPredicate", node, opts);
}
function assertInterfaceExtends(node, opts = {}) {
assert("InterfaceExtends", node, opts);
}
function assertInterfaceDeclaration(node, opts = {}) {
assert("InterfaceDeclaration", node, opts);
}
function assertInterfaceTypeAnnotation(node, opts = {}) {
assert("InterfaceTypeAnnotation", node, opts);
}
function assertIntersectionTypeAnnotation(node, opts = {}) {
assert("IntersectionTypeAnnotation", node, opts);
}
function assertMixedTypeAnnotation(node, opts = {}) {
assert("MixedTypeAnnotation", node, opts);
}
function assertEmptyTypeAnnotation(node, opts = {}) {
assert("EmptyTypeAnnotation", node, opts);
}
function assertNullableTypeAnnotation(node, opts = {}) {
assert("NullableTypeAnnotation", node, opts);
}
function assertNumberLiteralTypeAnnotation(node, opts = {}) {
assert("NumberLiteralTypeAnnotation", node, opts);
}
function assertNumberTypeAnnotation(node, opts = {}) {
assert("NumberTypeAnnotation", node, opts);
}
function assertObjectTypeAnnotation(node, opts = {}) {
assert("ObjectTypeAnnotation", node, opts);
}
function assertObjectTypeInternalSlot(node, opts = {}) {
assert("ObjectTypeInternalSlot", node, opts);
}
function assertObjectTypeCallProperty(node, opts = {}) {
assert("ObjectTypeCallProperty", node, opts);
}
function assertObjectTypeIndexer(node, opts = {}) {
assert("ObjectTypeIndexer", node, opts);
}
function assertObjectTypeProperty(node, opts = {}) {
assert("ObjectTypeProperty", node, opts);
}
function assertObjectTypeSpreadProperty(node, opts = {}) {
assert("ObjectTypeSpreadProperty", node, opts);
}
function assertOpaqueType(node, opts = {}) {
assert("OpaqueType", node, opts);
}
function assertQualifiedTypeIdentifier(node, opts = {}) {
assert("QualifiedTypeIdentifier", node, opts);
}
function assertStringLiteralTypeAnnotation(node, opts = {}) {
assert("StringLiteralTypeAnnotation", node, opts);
}
function assertStringTypeAnnotation(node, opts = {}) {
assert("StringTypeAnnotation", node, opts);
}
function assertSymbolTypeAnnotation(node, opts = {}) {
assert("SymbolTypeAnnotation", node, opts);
}
function assertThisTypeAnnotation(node, opts = {}) {
assert("ThisTypeAnnotation", node, opts);
}
function assertTupleTypeAnnotation(node, opts = {}) {
assert("TupleTypeAnnotation", node, opts);
}
function assertTypeofTypeAnnotation(node, opts = {}) {
assert("TypeofTypeAnnotation", node, opts);
}
function assertTypeAlias(node, opts = {}) {
assert("TypeAlias", node, opts);
}
function assertTypeAnnotation(node, opts = {}) {
assert("TypeAnnotation", node, opts);
}
function assertTypeCastExpression(node, opts = {}) {
assert("TypeCastExpression", node, opts);
}
function assertTypeParameter(node, opts = {}) {
assert("TypeParameter", node, opts);
}
function assertTypeParameterDeclaration(node, opts = {}) {
assert("TypeParameterDeclaration", node, opts);
}
function assertTypeParameterInstantiation(node, opts = {}) {
assert("TypeParameterInstantiation", node, opts);
}
function assertUnionTypeAnnotation(node, opts = {}) {
assert("UnionTypeAnnotation", node, opts);
}
function assertVariance(node, opts = {}) {
assert("Variance", node, opts);
}
function assertVoidTypeAnnotation(node, opts = {}) {
assert("VoidTypeAnnotation", node, opts);
}
function assertEnumDeclaration(node, opts = {}) {
assert("EnumDeclaration", node, opts);
}
function assertEnumBooleanBody(node, opts = {}) {
assert("EnumBooleanBody", node, opts);
}
function assertEnumNumberBody(node, opts = {}) {
assert("EnumNumberBody", node, opts);
}
function assertEnumStringBody(node, opts = {}) {
assert("EnumStringBody", node, opts);
}
function assertEnumSymbolBody(node, opts = {}) {
assert("EnumSymbolBody", node, opts);
}
function assertEnumBooleanMember(node, opts = {}) {
assert("EnumBooleanMember", node, opts);
}
function assertEnumNumberMember(node, opts = {}) {
assert("EnumNumberMember", node, opts);
}
function assertEnumStringMember(node, opts = {}) {
assert("EnumStringMember", node, opts);
}
function assertEnumDefaultedMember(node, opts = {}) {
assert("EnumDefaultedMember", node, opts);
}
function assertJSXAttribute(node, opts = {}) {
assert("JSXAttribute", node, opts);
}
function assertJSXClosingElement(node, opts = {}) {
assert("JSXClosingElement", node, opts);
}
function assertJSXElement(node, opts = {}) {
assert("JSXElement", node, opts);
}
function assertJSXEmptyExpression(node, opts = {}) {
assert("JSXEmptyExpression", node, opts);
}
function assertJSXExpressionContainer(node, opts = {}) {
assert("JSXExpressionContainer", node, opts);
}
function assertJSXSpreadChild(node, opts = {}) {
assert("JSXSpreadChild", node, opts);
}
function assertJSXIdentifier(node, opts = {}) {
assert("JSXIdentifier", node, opts);
}
function assertJSXMemberExpression(node, opts = {}) {
assert("JSXMemberExpression", node, opts);
}
function assertJSXNamespacedName(node, opts = {}) {
assert("JSXNamespacedName", node, opts);
}
function assertJSXOpeningElement(node, opts = {}) {
assert("JSXOpeningElement", node, opts);
}
function assertJSXSpreadAttribute(node, opts = {}) {
assert("JSXSpreadAttribute", node, opts);
}
function assertJSXText(node, opts = {}) {
assert("JSXText", node, opts);
}
function assertJSXFragment(node, opts = {}) {
assert("JSXFragment", node, opts);
}
function assertJSXOpeningFragment(node, opts = {}) {
assert("JSXOpeningFragment", node, opts);
}
function assertJSXClosingFragment(node, opts = {}) {
assert("JSXClosingFragment", node, opts);
}
function assertNoop(node, opts = {}) {
assert("Noop", node, opts);
}
function assertPlaceholder(node, opts = {}) {
assert("Placeholder", node, opts);
}
function assertV8IntrinsicIdentifier(node, opts = {}) {
assert("V8IntrinsicIdentifier", node, opts);
}
function assertArgumentPlaceholder(node, opts = {}) {
assert("ArgumentPlaceholder", node, opts);
}
function assertAwaitExpression(node, opts = {}) {
assert("AwaitExpression", node, opts);
}
function assertBindExpression(node, opts = {}) {
assert("BindExpression", node, opts);
}
function assertClassProperty(node, opts = {}) {
assert("ClassProperty", node, opts);
}
function assertOptionalMemberExpression(node, opts = {}) {
assert("OptionalMemberExpression", node, opts);
}
function assertPipelineTopicExpression(node, opts = {}) {
assert("PipelineTopicExpression", node, opts);
}
function assertPipelineBareFunction(node, opts = {}) {
assert("PipelineBareFunction", node, opts);
}
function assertPipelinePrimaryTopicReference(node, opts = {}) {
assert("PipelinePrimaryTopicReference", node, opts);
}
function assertOptionalCallExpression(node, opts = {}) {
assert("OptionalCallExpression", node, opts);
}
function assertClassPrivateProperty(node, opts = {}) {
assert("ClassPrivateProperty", node, opts);
}
function assertClassPrivateMethod(node, opts = {}) {
assert("ClassPrivateMethod", node, opts);
}
function assertImport(node, opts = {}) {
assert("Import", node, opts);
}
function assertImportAttribute(node, opts = {}) {
assert("ImportAttribute", node, opts);
}
function assertDecorator(node, opts = {}) {
assert("Decorator", node, opts);
}
function assertDoExpression(node, opts = {}) {
assert("DoExpression", node, opts);
}
function assertExportDefaultSpecifier(node, opts = {}) {
assert("ExportDefaultSpecifier", node, opts);
}
function assertExportNamespaceSpecifier(node, opts = {}) {
assert("ExportNamespaceSpecifier", node, opts);
}
function assertPrivateName(node, opts = {}) {
assert("PrivateName", node, opts);
}
function assertBigIntLiteral(node, opts = {}) {
assert("BigIntLiteral", node, opts);
}
function assertRecordExpression(node, opts = {}) {
assert("RecordExpression", node, opts);
}
function assertTupleExpression(node, opts = {}) {
assert("TupleExpression", node, opts);
}
function assertTSParameterProperty(node, opts = {}) {
assert("TSParameterProperty", node, opts);
}
function assertTSDeclareFunction(node, opts = {}) {
assert("TSDeclareFunction", node, opts);
}
function assertTSDeclareMethod(node, opts = {}) {
assert("TSDeclareMethod", node, opts);
}
function assertTSQualifiedName(node, opts = {}) {
assert("TSQualifiedName", node, opts);
}
function assertTSCallSignatureDeclaration(node, opts = {}) {
assert("TSCallSignatureDeclaration", node, opts);
}
function assertTSConstructSignatureDeclaration(node, opts = {}) {
assert("TSConstructSignatureDeclaration", node, opts);
}
function assertTSPropertySignature(node, opts = {}) {
assert("TSPropertySignature", node, opts);
}
function assertTSMethodSignature(node, opts = {}) {
assert("TSMethodSignature", node, opts);
}
function assertTSIndexSignature(node, opts = {}) {
assert("TSIndexSignature", node, opts);
}
function assertTSAnyKeyword(node, opts = {}) {
assert("TSAnyKeyword", node, opts);
}
function assertTSBooleanKeyword(node, opts = {}) {
assert("TSBooleanKeyword", node, opts);
}
function assertTSBigIntKeyword(node, opts = {}) {
assert("TSBigIntKeyword", node, opts);
}
function assertTSNeverKeyword(node, opts = {}) {
assert("TSNeverKeyword", node, opts);
}
function assertTSNullKeyword(node, opts = {}) {
assert("TSNullKeyword", node, opts);
}
function assertTSNumberKeyword(node, opts = {}) {
assert("TSNumberKeyword", node, opts);
}
function assertTSObjectKeyword(node, opts = {}) {
assert("TSObjectKeyword", node, opts);
}
function assertTSStringKeyword(node, opts = {}) {
assert("TSStringKeyword", node, opts);
}
function assertTSSymbolKeyword(node, opts = {}) {
assert("TSSymbolKeyword", node, opts);
}
function assertTSUndefinedKeyword(node, opts = {}) {
assert("TSUndefinedKeyword", node, opts);
}
function assertTSUnknownKeyword(node, opts = {}) {
assert("TSUnknownKeyword", node, opts);
}
function assertTSVoidKeyword(node, opts = {}) {
assert("TSVoidKeyword", node, opts);
}
function assertTSThisType(node, opts = {}) {
assert("TSThisType", node, opts);
}
function assertTSFunctionType(node, opts = {}) {
assert("TSFunctionType", node, opts);
}
function assertTSConstructorType(node, opts = {}) {
assert("TSConstructorType", node, opts);
}
function assertTSTypeReference(node, opts = {}) {
assert("TSTypeReference", node, opts);
}
function assertTSTypePredicate(node, opts = {}) {
assert("TSTypePredicate", node, opts);
}
function assertTSTypeQuery(node, opts = {}) {
assert("TSTypeQuery", node, opts);
}
function assertTSTypeLiteral(node, opts = {}) {
assert("TSTypeLiteral", node, opts);
}
function assertTSArrayType(node, opts = {}) {
assert("TSArrayType", node, opts);
}
function assertTSTupleType(node, opts = {}) {
assert("TSTupleType", node, opts);
}
function assertTSOptionalType(node, opts = {}) {
assert("TSOptionalType", node, opts);
}
function assertTSRestType(node, opts = {}) {
assert("TSRestType", node, opts);
}
function assertTSUnionType(node, opts = {}) {
assert("TSUnionType", node, opts);
}
function assertTSIntersectionType(node, opts = {}) {
assert("TSIntersectionType", node, opts);
}
function assertTSConditionalType(node, opts = {}) {
assert("TSConditionalType", node, opts);
}
function assertTSInferType(node, opts = {}) {
assert("TSInferType", node, opts);
}
function assertTSParenthesizedType(node, opts = {}) {
assert("TSParenthesizedType", node, opts);
}
function assertTSTypeOperator(node, opts = {}) {
assert("TSTypeOperator", node, opts);
}
function assertTSIndexedAccessType(node, opts = {}) {
assert("TSIndexedAccessType", node, opts);
}
function assertTSMappedType(node, opts = {}) {
assert("TSMappedType", node, opts);
}
function assertTSLiteralType(node, opts = {}) {
assert("TSLiteralType", node, opts);
}
function assertTSExpressionWithTypeArguments(node, opts = {}) {
assert("TSExpressionWithTypeArguments", node, opts);
}
function assertTSInterfaceDeclaration(node, opts = {}) {
assert("TSInterfaceDeclaration", node, opts);
}
function assertTSInterfaceBody(node, opts = {}) {
assert("TSInterfaceBody", node, opts);
}
function assertTSTypeAliasDeclaration(node, opts = {}) {
assert("TSTypeAliasDeclaration", node, opts);
}
function assertTSAsExpression(node, opts = {}) {
assert("TSAsExpression", node, opts);
}
function assertTSTypeAssertion(node, opts = {}) {
assert("TSTypeAssertion", node, opts);
}
function assertTSEnumDeclaration(node, opts = {}) {
assert("TSEnumDeclaration", node, opts);
}
function assertTSEnumMember(node, opts = {}) {
assert("TSEnumMember", node, opts);
}
function assertTSModuleDeclaration(node, opts = {}) {
assert("TSModuleDeclaration", node, opts);
}
function assertTSModuleBlock(node, opts = {}) {
assert("TSModuleBlock", node, opts);
}
function assertTSImportType(node, opts = {}) {
assert("TSImportType", node, opts);
}
function assertTSImportEqualsDeclaration(node, opts = {}) {
assert("TSImportEqualsDeclaration", node, opts);
}
function assertTSExternalModuleReference(node, opts = {}) {
assert("TSExternalModuleReference", node, opts);
}
function assertTSNonNullExpression(node, opts = {}) {
assert("TSNonNullExpression", node, opts);
}
function assertTSExportAssignment(node, opts = {}) {
assert("TSExportAssignment", node, opts);
}
function assertTSNamespaceExportDeclaration(node, opts = {}) {
assert("TSNamespaceExportDeclaration", node, opts);
}
function assertTSTypeAnnotation(node, opts = {}) {
assert("TSTypeAnnotation", node, opts);
}
function assertTSTypeParameterInstantiation(node, opts = {}) {
assert("TSTypeParameterInstantiation", node, opts);
}
function assertTSTypeParameterDeclaration(node, opts = {}) {
assert("TSTypeParameterDeclaration", node, opts);
}
function assertTSTypeParameter(node, opts = {}) {
assert("TSTypeParameter", node, opts);
}
function assertExpression(node, opts = {}) {
assert("Expression", node, opts);
}
function assertBinary(node, opts = {}) {
assert("Binary", node, opts);
}
function assertScopable(node, opts = {}) {
assert("Scopable", node, opts);
}
function assertBlockParent(node, opts = {}) {
assert("BlockParent", node, opts);
}
function assertBlock(node, opts = {}) {
assert("Block", node, opts);
}
function assertStatement(node, opts = {}) {
assert("Statement", node, opts);
}
function assertTerminatorless(node, opts = {}) {
assert("Terminatorless", node, opts);
}
function assertCompletionStatement(node, opts = {}) {
assert("CompletionStatement", node, opts);
}
function assertConditional(node, opts = {}) {
assert("Conditional", node, opts);
}
function assertLoop(node, opts = {}) {
assert("Loop", node, opts);
}
function assertWhile(node, opts = {}) {
assert("While", node, opts);
}
function assertExpressionWrapper(node, opts = {}) {
assert("ExpressionWrapper", node, opts);
}
function assertFor(node, opts = {}) {
assert("For", node, opts);
}
function assertForXStatement(node, opts = {}) {
assert("ForXStatement", node, opts);
}
function assertFunction(node, opts = {}) {
assert("Function", node, opts);
}
function assertFunctionParent(node, opts = {}) {
assert("FunctionParent", node, opts);
}
function assertPureish(node, opts = {}) {
assert("Pureish", node, opts);
}
function assertDeclaration(node, opts = {}) {
assert("Declaration", node, opts);
}
function assertPatternLike(node, opts = {}) {
assert("PatternLike", node, opts);
}
function assertLVal(node, opts = {}) {
assert("LVal", node, opts);
}
function assertTSEntityName(node, opts = {}) {
assert("TSEntityName", node, opts);
}
function assertLiteral(node, opts = {}) {
assert("Literal", node, opts);
}
function assertImmutable(node, opts = {}) {
assert("Immutable", node, opts);
}
function assertUserWhitespacable(node, opts = {}) {
assert("UserWhitespacable", node, opts);
}
function assertMethod(node, opts = {}) {
assert("Method", node, opts);
}
function assertObjectMember(node, opts = {}) {
assert("ObjectMember", node, opts);
}
function assertProperty(node, opts = {}) {
assert("Property", node, opts);
}
function assertUnaryLike(node, opts = {}) {
assert("UnaryLike", node, opts);
}
function assertPattern(node, opts = {}) {
assert("Pattern", node, opts);
}
function assertClass(node, opts = {}) {
assert("Class", node, opts);
}
function assertModuleDeclaration(node, opts = {}) {
assert("ModuleDeclaration", node, opts);
}
function assertExportDeclaration(node, opts = {}) {
assert("ExportDeclaration", node, opts);
}
function assertModuleSpecifier(node, opts = {}) {
assert("ModuleSpecifier", node, opts);
}
function assertFlow(node, opts = {}) {
assert("Flow", node, opts);
}
function assertFlowType(node, opts = {}) {
assert("FlowType", node, opts);
}
function assertFlowBaseAnnotation(node, opts = {}) {
assert("FlowBaseAnnotation", node, opts);
}
function assertFlowDeclaration(node, opts = {}) {
assert("FlowDeclaration", node, opts);
}
function assertFlowPredicate(node, opts = {}) {
assert("FlowPredicate", node, opts);
}
function assertEnumBody(node, opts = {}) {
assert("EnumBody", node, opts);
}
function assertEnumMember(node, opts = {}) {
assert("EnumMember", node, opts);
}
function assertJSX(node, opts = {}) {
assert("JSX", node, opts);
}
function assertPrivate(node, opts = {}) {
assert("Private", node, opts);
}
function assertTSTypeElement(node, opts = {}) {
assert("TSTypeElement", node, opts);
}
function assertTSType(node, opts = {}) {
assert("TSType", node, opts);
}
function assertTSBaseType(node, opts = {}) {
assert("TSBaseType", node, opts);
}
function assertNumberLiteral(node, opts) {
console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
assert("NumberLiteral", node, opts);
}
function assertRegexLiteral(node, opts) {
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
assert("RegexLiteral", node, opts);
}
function assertRestProperty(node, opts) {
console.trace("The node type RestProperty has been renamed to RestElement");
assert("RestProperty", node, opts);
}
function assertSpreadProperty(node, opts) {
console.trace("The node type SpreadProperty has been renamed to SpreadElement");
assert("SpreadProperty", node, opts);
}
/***/ }),
/* 790 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createTypeAnnotationBasedOnTypeof;
var _generated = __webpack_require__(561);
function createTypeAnnotationBasedOnTypeof(type) {
if (type === "string") {
return (0, _generated.stringTypeAnnotation)();
} else if (type === "number") {
return (0, _generated.numberTypeAnnotation)();
} else if (type === "undefined") {
return (0, _generated.voidTypeAnnotation)();
} else if (type === "boolean") {
return (0, _generated.booleanTypeAnnotation)();
} else if (type === "function") {
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Function"));
} else if (type === "object") {
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Object"));
} else if (type === "symbol") {
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Symbol"));
} else {
throw new Error("Invalid typeof value");
}
}
/***/ }),
/* 791 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createFlowUnionType;
var _generated = __webpack_require__(561);
var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(670));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createFlowUnionType(types) {
const flattened = (0, _removeTypeDuplicates.default)(types);
if (flattened.length === 1) {
return flattened[0];
} else {
return (0, _generated.unionTypeAnnotation)(flattened);
}
}
/***/ }),
/* 792 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createTSUnionType;
var _generated = __webpack_require__(561);
var _removeTypeDuplicates = _interopRequireDefault(__webpack_require__(793));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createTSUnionType(typeAnnotations) {
const types = typeAnnotations.map(type => type.typeAnnotations);
const flattened = (0, _removeTypeDuplicates.default)(types);
if (flattened.length === 1) {
return flattened[0];
} else {
return (0, _generated.TSUnionType)(flattened);
}
}
/***/ }),
/* 793 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = removeTypeDuplicates;
var _generated = __webpack_require__(559);
function removeTypeDuplicates(nodes) {
const generics = {};
const bases = {};
const typeGroups = [];
const types = [];
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (!node) continue;
if (types.indexOf(node) >= 0) {
continue;
}
if ((0, _generated.isTSAnyKeyword)(node.type)) {
return [node];
}
if ((0, _generated.isTSBaseType)(node)) {
bases[node.type] = node;
continue;
}
if ((0, _generated.isTSUnionType)(node)) {
if (typeGroups.indexOf(node.types) < 0) {
nodes = nodes.concat(node.types);
typeGroups.push(node.types);
}
continue;
}
types.push(node);
}
for (const type of Object.keys(bases)) {
types.push(bases[type]);
}
for (const name of Object.keys(generics)) {
types.push(generics[name]);
}
return types;
}
/***/ }),
/* 794 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = clone;
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function clone(node) {
return (0, _cloneNode.default)(node, false);
}
/***/ }),
/* 795 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cloneDeep;
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function cloneDeep(node) {
return (0, _cloneNode.default)(node);
}
/***/ }),
/* 796 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cloneDeepWithoutLoc;
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function cloneDeepWithoutLoc(node) {
return (0, _cloneNode.default)(node, true, true);
}
/***/ }),
/* 797 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = cloneWithoutLoc;
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function cloneWithoutLoc(node) {
return (0, _cloneNode.default)(node, false, true);
}
/***/ }),
/* 798 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = addComment;
var _addComments = _interopRequireDefault(__webpack_require__(671));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function addComment(node, type, content, line) {
return (0, _addComments.default)(node, type, [{
type: line ? "CommentLine" : "CommentBlock",
value: content
}]);
}
/***/ }),
/* 799 */
/***/ (function(module, exports, __webpack_require__) {
var baseUniq = __webpack_require__(800);
/**
* Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons, in which only the first occurrence of each element
* is kept. The order of result values is determined by the order they occur
* in the array.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {Array} array The array to inspect.
* @returns {Array} Returns the new duplicate free array.
* @example
*
* _.uniq([2, 1, 2]);
* // => [2, 1]
*/
function uniq(array) {
return (array && array.length) ? baseUniq(array) : [];
}
module.exports = uniq;
/***/ }),
/* 800 */
/***/ (function(module, exports, __webpack_require__) {
var SetCache = __webpack_require__(673),
arrayIncludes = __webpack_require__(803),
arrayIncludesWith = __webpack_require__(807),
cacheHas = __webpack_require__(674),
createSet = __webpack_require__(808),
setToArray = __webpack_require__(631);
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* The base implementation of `_.uniqBy` without support for iteratee shorthands.
*
* @private
* @param {Array} array The array to inspect.
* @param {Function} [iteratee] The iteratee invoked per element.
* @param {Function} [comparator] The comparator invoked per element.
* @returns {Array} Returns the new duplicate free array.
*/
function baseUniq(array, iteratee, comparator) {
var index = -1,
includes = arrayIncludes,
length = array.length,
isCommon = true,
result = [],
seen = result;
if (comparator) {
isCommon = false;
includes = arrayIncludesWith;
}
else if (length >= LARGE_ARRAY_SIZE) {
var set = iteratee ? null : createSet(array);
if (set) {
return setToArray(set);
}
isCommon = false;
includes = cacheHas;
seen = new SetCache;
}
else {
seen = iteratee ? [] : result;
}
outer:
while (++index < length) {
var value = array[index],
computed = iteratee ? iteratee(value) : value;
value = (comparator || value !== 0) ? value : 0;
if (isCommon && computed === computed) {
var seenIndex = seen.length;
while (seenIndex--) {
if (seen[seenIndex] === computed) {
continue outer;
}
}
if (iteratee) {
seen.push(computed);
}
result.push(value);
}
else if (!includes(seen, computed, comparator)) {
if (seen !== result) {
seen.push(computed);
}
result.push(value);
}
}
return result;
}
module.exports = baseUniq;
/***/ }),
/* 801 */
/***/ (function(module, exports) {
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/**
* Adds `value` to the array cache.
*
* @private
* @name add
* @memberOf SetCache
* @alias push
* @param {*} value The value to cache.
* @returns {Object} Returns the cache instance.
*/
function setCacheAdd(value) {
this.__data__.set(value, HASH_UNDEFINED);
return this;
}
module.exports = setCacheAdd;
/***/ }),
/* 802 */
/***/ (function(module, exports) {
/**
* Checks if `value` is in the array cache.
*
* @private
* @name has
* @memberOf SetCache
* @param {*} value The value to search for.
* @returns {number} Returns `true` if `value` is found, else `false`.
*/
function setCacheHas(value) {
return this.__data__.has(value);
}
module.exports = setCacheHas;
/***/ }),
/* 803 */
/***/ (function(module, exports, __webpack_require__) {
var baseIndexOf = __webpack_require__(804);
/**
* A specialized version of `_.includes` for arrays without support for
* specifying an index to search from.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludes(array, value) {
var length = array == null ? 0 : array.length;
return !!length && baseIndexOf(array, value, 0) > -1;
}
module.exports = arrayIncludes;
/***/ }),
/* 804 */
/***/ (function(module, exports, __webpack_require__) {
var baseFindIndex = __webpack_require__(630),
baseIsNaN = __webpack_require__(805),
strictIndexOf = __webpack_require__(806);
/**
* The base implementation of `_.indexOf` without `fromIndex` bounds checks.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function baseIndexOf(array, value, fromIndex) {
return value === value
? strictIndexOf(array, value, fromIndex)
: baseFindIndex(array, baseIsNaN, fromIndex);
}
module.exports = baseIndexOf;
/***/ }),
/* 805 */
/***/ (function(module, exports) {
/**
* The base implementation of `_.isNaN` without support for number objects.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
*/
function baseIsNaN(value) {
return value !== value;
}
module.exports = baseIsNaN;
/***/ }),
/* 806 */
/***/ (function(module, exports) {
/**
* A specialized version of `_.indexOf` which performs strict equality
* comparisons of values, i.e. `===`.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} value The value to search for.
* @param {number} fromIndex The index to search from.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function strictIndexOf(array, value, fromIndex) {
var index = fromIndex - 1,
length = array.length;
while (++index < length) {
if (array[index] === value) {
return index;
}
}
return -1;
}
module.exports = strictIndexOf;
/***/ }),
/* 807 */
/***/ (function(module, exports) {
/**
* This function is like `arrayIncludes` except that it accepts a comparator.
*
* @private
* @param {Array} [array] The array to inspect.
* @param {*} target The value to search for.
* @param {Function} comparator The comparator invoked per element.
* @returns {boolean} Returns `true` if `target` is found, else `false`.
*/
function arrayIncludesWith(array, value, comparator) {
var index = -1,
length = array == null ? 0 : array.length;
while (++index < length) {
if (comparator(value, array[index])) {
return true;
}
}
return false;
}
module.exports = arrayIncludesWith;
/***/ }),
/* 808 */
/***/ (function(module, exports, __webpack_require__) {
var Set = __webpack_require__(664),
noop = __webpack_require__(809),
setToArray = __webpack_require__(631);
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/**
* Creates a set object of `values`.
*
* @private
* @param {Array} values The values to add to the set.
* @returns {Object} Returns the new set.
*/
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
return new Set(values);
};
module.exports = createSet;
/***/ }),
/* 809 */
/***/ (function(module, exports) {
/**
* This method returns `undefined`.
*
* @static
* @memberOf _
* @since 2.3.0
* @category Util
* @example
*
* _.times(2, _.noop);
* // => [undefined, undefined]
*/
function noop() {
// No operation performed.
}
module.exports = noop;
/***/ }),
/* 810 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = removeComments;
var _constants = __webpack_require__(575);
function removeComments(node) {
_constants.COMMENT_KEYS.forEach(key => {
node[key] = null;
});
return node;
}
/***/ }),
/* 811 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TSBASETYPE_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.PRIVATE_TYPES = exports.JSX_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOWTYPE_TYPES = exports.FLOW_TYPES = exports.MODULESPECIFIER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = exports.CLASS_TYPES = exports.PATTERN_TYPES = exports.UNARYLIKE_TYPES = exports.PROPERTY_TYPES = exports.OBJECTMEMBER_TYPES = exports.METHOD_TYPES = exports.USERWHITESPACABLE_TYPES = exports.IMMUTABLE_TYPES = exports.LITERAL_TYPES = exports.TSENTITYNAME_TYPES = exports.LVAL_TYPES = exports.PATTERNLIKE_TYPES = exports.DECLARATION_TYPES = exports.PUREISH_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTION_TYPES = exports.FORXSTATEMENT_TYPES = exports.FOR_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.WHILE_TYPES = exports.LOOP_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.SCOPABLE_TYPES = exports.BINARY_TYPES = exports.EXPRESSION_TYPES = void 0;
var _definitions = __webpack_require__(564);
const EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"];
exports.EXPRESSION_TYPES = EXPRESSION_TYPES;
const BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"];
exports.BINARY_TYPES = BINARY_TYPES;
const SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"];
exports.SCOPABLE_TYPES = SCOPABLE_TYPES;
const BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"];
exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES;
const BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"];
exports.BLOCK_TYPES = BLOCK_TYPES;
const STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"];
exports.STATEMENT_TYPES = STATEMENT_TYPES;
const TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"];
exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES;
const COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"];
exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES;
const CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"];
exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES;
const LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"];
exports.LOOP_TYPES = LOOP_TYPES;
const WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"];
exports.WHILE_TYPES = WHILE_TYPES;
const EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"];
exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES;
const FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"];
exports.FOR_TYPES = FOR_TYPES;
const FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"];
exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES;
const FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"];
exports.FUNCTION_TYPES = FUNCTION_TYPES;
const FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"];
exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES;
const PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"];
exports.PUREISH_TYPES = PUREISH_TYPES;
const DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"];
exports.DECLARATION_TYPES = DECLARATION_TYPES;
const PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"];
exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES;
const LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"];
exports.LVAL_TYPES = LVAL_TYPES;
const TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"];
exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES;
const LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"];
exports.LITERAL_TYPES = LITERAL_TYPES;
const IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"];
exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES;
const USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"];
exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES;
const METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"];
exports.METHOD_TYPES = METHOD_TYPES;
const OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"];
exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES;
const PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"];
exports.PROPERTY_TYPES = PROPERTY_TYPES;
const UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"];
exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES;
const PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"];
exports.PATTERN_TYPES = PATTERN_TYPES;
const CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"];
exports.CLASS_TYPES = CLASS_TYPES;
const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"];
exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES;
const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"];
exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES;
const MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"];
exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES;
const FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"];
exports.FLOW_TYPES = FLOW_TYPES;
const FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"];
exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES;
const FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"];
exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES;
const FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"];
exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES;
const FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"];
exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES;
const ENUMBODY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["EnumBody"];
exports.ENUMBODY_TYPES = ENUMBODY_TYPES;
const ENUMMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["EnumMember"];
exports.ENUMMEMBER_TYPES = ENUMMEMBER_TYPES;
const JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"];
exports.JSX_TYPES = JSX_TYPES;
const PRIVATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Private"];
exports.PRIVATE_TYPES = PRIVATE_TYPES;
const TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"];
exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES;
const TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"];
exports.TSTYPE_TYPES = TSTYPE_TYPES;
const TSBASETYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSBaseType"];
exports.TSBASETYPE_TYPES = TSBASETYPE_TYPES;
/***/ }),
/* 812 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ensureBlock;
var _toBlock = _interopRequireDefault(__webpack_require__(678));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function ensureBlock(node, key = "body") {
return node[key] = (0, _toBlock.default)(node[key], node);
}
/***/ }),
/* 813 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toBindingIdentifierName;
var _toIdentifier = _interopRequireDefault(__webpack_require__(679));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toBindingIdentifierName(name) {
name = (0, _toIdentifier.default)(name);
if (name === "eval" || name === "arguments") name = "_" + name;
return name;
}
/***/ }),
/* 814 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toComputedKey;
var _generated = __webpack_require__(559);
var _generated2 = __webpack_require__(561);
function toComputedKey(node, key = node.key || node.property) {
if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name);
return key;
}
/***/ }),
/* 815 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toExpression;
var _generated = __webpack_require__(559);
function toExpression(node) {
if ((0, _generated.isExpressionStatement)(node)) {
node = node.expression;
}
if ((0, _generated.isExpression)(node)) {
return node;
}
if ((0, _generated.isClass)(node)) {
node.type = "ClassExpression";
} else if ((0, _generated.isFunction)(node)) {
node.type = "FunctionExpression";
}
if (!(0, _generated.isExpression)(node)) {
throw new Error(`cannot turn ${node.type} to an expression`);
}
return node;
}
/***/ }),
/* 816 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toKeyAlias;
var _generated = __webpack_require__(559);
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
var _removePropertiesDeep = _interopRequireDefault(__webpack_require__(680));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toKeyAlias(node, key = node.key) {
let alias;
if (node.kind === "method") {
return toKeyAlias.increment() + "";
} else if ((0, _generated.isIdentifier)(key)) {
alias = key.name;
} else if ((0, _generated.isStringLiteral)(key)) {
alias = JSON.stringify(key.value);
} else {
alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key)));
}
if (node.computed) {
alias = `[${alias}]`;
}
if (node.static) {
alias = `static:${alias}`;
}
return alias;
}
toKeyAlias.uid = 0;
toKeyAlias.increment = function () {
if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) {
return toKeyAlias.uid = 0;
} else {
return toKeyAlias.uid++;
}
};
/***/ }),
/* 817 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toSequenceExpression;
var _gatherSequenceExpressions = _interopRequireDefault(__webpack_require__(818));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function toSequenceExpression(nodes, scope) {
if (!(nodes == null ? void 0 : nodes.length)) return;
const declars = [];
const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars);
if (!result) return;
for (const declar of declars) {
scope.push(declar);
}
return result;
}
/***/ }),
/* 818 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = gatherSequenceExpressions;
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(601));
var _generated = __webpack_require__(559);
var _generated2 = __webpack_require__(561);
var _cloneNode = _interopRequireDefault(__webpack_require__(576));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function gatherSequenceExpressions(nodes, scope, declars) {
const exprs = [];
let ensureLastUndefined = true;
for (const node of nodes) {
if (!(0, _generated.isEmptyStatement)(node)) {
ensureLastUndefined = false;
}
if ((0, _generated.isExpression)(node)) {
exprs.push(node);
} else if ((0, _generated.isExpressionStatement)(node)) {
exprs.push(node.expression);
} else if ((0, _generated.isVariableDeclaration)(node)) {
if (node.kind !== "var") return;
for (const declar of node.declarations) {
const bindings = (0, _getBindingIdentifiers.default)(declar);
for (const key of Object.keys(bindings)) {
declars.push({
kind: node.kind,
id: (0, _cloneNode.default)(bindings[key])
});
}
if (declar.init) {
exprs.push((0, _generated2.assignmentExpression)("=", declar.id, declar.init));
}
}
ensureLastUndefined = true;
} else if ((0, _generated.isIfStatement)(node)) {
const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode();
const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode();
if (!consequent || !alternate) return;
exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate));
} else if ((0, _generated.isBlockStatement)(node)) {
const body = gatherSequenceExpressions(node.body, scope, declars);
if (!body) return;
exprs.push(body);
} else if ((0, _generated.isEmptyStatement)(node)) {
if (nodes.indexOf(node) === 0) {
ensureLastUndefined = true;
}
} else {
return;
}
}
if (ensureLastUndefined) {
exprs.push(scope.buildUndefinedNode());
}
if (exprs.length === 1) {
return exprs[0];
} else {
return (0, _generated2.sequenceExpression)(exprs);
}
}
/***/ }),
/* 819 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = toStatement;
var _generated = __webpack_require__(559);
var _generated2 = __webpack_require__(561);
function toStatement(node, ignore) {
if ((0, _generated.isStatement)(node)) {
return node;
}
let mustHaveId = false;
let newType;
if ((0, _generated.isClass)(node)) {
mustHaveId = true;
newType = "ClassDeclaration";
} else if ((0, _generated.isFunction)(node)) {
mustHaveId = true;
newType = "FunctionDeclaration";
} else if ((0, _generated.isAssignmentExpression)(node)) {
return (0, _generated2.expressionStatement)(node);
}
if (mustHaveId && !node.id) {
newType = false;
}
if (!newType) {
if (ignore) {
return false;
} else {
throw new Error(`cannot turn ${node.type} to a statement`);
}
}
node.type = newType;
return node;
}
/***/ }),
/* 820 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = valueToNode;
var _isPlainObject = _interopRequireDefault(__webpack_require__(821));
var _isRegExp = _interopRequireDefault(__webpack_require__(822));
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(580));
var _generated = __webpack_require__(561);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function valueToNode(value) {
if (value === undefined) {
return (0, _generated.identifier)("undefined");
}
if (value === true || value === false) {
return (0, _generated.booleanLiteral)(value);
}
if (value === null) {
return (0, _generated.nullLiteral)();
}
if (typeof value === "string") {
return (0, _generated.stringLiteral)(value);
}
if (typeof value === "number") {
let result;
if (Number.isFinite(value)) {
result = (0, _generated.numericLiteral)(Math.abs(value));
} else {
let numerator;
if (Number.isNaN(value)) {
numerator = (0, _generated.numericLiteral)(0);
} else {
numerator = (0, _generated.numericLiteral)(1);
}
result = (0, _generated.binaryExpression)("/", numerator, (0, _generated.numericLiteral)(0));
}
if (value < 0 || Object.is(value, -0)) {
result = (0, _generated.unaryExpression)("-", result);
}
return result;
}
if ((0, _isRegExp.default)(value)) {
const pattern = value.source;
const flags = value.toString().match(/\/([a-z]+|)$/)[1];
return (0, _generated.regExpLiteral)(pattern, flags);
}
if (Array.isArray(value)) {
return (0, _generated.arrayExpression)(value.map(valueToNode));
}
if ((0, _isPlainObject.default)(value)) {
const props = [];
for (const key of Object.keys(value)) {
let nodeKey;
if ((0, _isValidIdentifier.default)(key)) {
nodeKey = (0, _generated.identifier)(key);
} else {
nodeKey = (0, _generated.stringLiteral)(key);
}
props.push((0, _generated.objectProperty)(nodeKey, valueToNode(value[key])));
}
return (0, _generated.objectExpression)(props);
}
throw new Error("don't know how to turn this value into a node");
}
/***/ }),
/* 821 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(569),
getPrototype = __webpack_require__(624),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* Checks if `value` is a plain object, that is, an object created by the
* `Object` constructor or one with a `[[Prototype]]` of `null`.
*
* @static
* @memberOf _
* @since 0.8.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
* @example
*
* function Foo() {
* this.a = 1;
* }
*
* _.isPlainObject(new Foo);
* // => false
*
* _.isPlainObject([1, 2, 3]);
* // => false
*
* _.isPlainObject({ 'x': 0, 'y': 0 });
* // => true
*
* _.isPlainObject(Object.create(null));
* // => true
*/
function isPlainObject(value) {
if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
return false;
}
var proto = getPrototype(value);
if (proto === null) {
return true;
}
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
return typeof Ctor == 'function' && Ctor instanceof Ctor &&
funcToString.call(Ctor) == objectCtorString;
}
module.exports = isPlainObject;
/***/ }),
/* 822 */
/***/ (function(module, exports, __webpack_require__) {
var baseIsRegExp = __webpack_require__(823),
baseUnary = __webpack_require__(596),
nodeUtil = __webpack_require__(597);
/* Node.js helper references. */
var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
/**
* Checks if `value` is classified as a `RegExp` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
* @example
*
* _.isRegExp(/abc/);
* // => true
*
* _.isRegExp('/abc/');
* // => false
*/
var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
module.exports = isRegExp;
/***/ }),
/* 823 */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(569),
isObjectLike = __webpack_require__(565);
/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';
/**
* The base implementation of `_.isRegExp` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
*/
function baseIsRegExp(value) {
return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
module.exports = baseIsRegExp;
/***/ }),
/* 824 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = appendToMemberExpression;
var _generated = __webpack_require__(561);
function appendToMemberExpression(member, append, computed = false) {
member.object = (0, _generated.memberExpression)(member.object, member.property, member.computed);
member.property = append;
member.computed = !!computed;
return member;
}
/***/ }),
/* 825 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inherits;
var _constants = __webpack_require__(575);
var _inheritsComments = _interopRequireDefault(__webpack_require__(676));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function inherits(child, parent) {
if (!child || !parent) return child;
for (const key of _constants.INHERIT_KEYS.optional) {
if (child[key] == null) {
child[key] = parent[key];
}
}
for (const key of Object.keys(parent)) {
if (key[0] === "_" && key !== "__clone") child[key] = parent[key];
}
for (const key of _constants.INHERIT_KEYS.force) {
child[key] = parent[key];
}
(0, _inheritsComments.default)(child, parent);
return child;
}
/***/ }),
/* 826 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = prependToMemberExpression;
var _generated = __webpack_require__(561);
function prependToMemberExpression(member, prepend) {
member.object = (0, _generated.memberExpression)(prepend, member.object);
return member;
}
/***/ }),
/* 827 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getOuterBindingIdentifiers;
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(601));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getOuterBindingIdentifiers(node, duplicates) {
return (0, _getBindingIdentifiers.default)(node, duplicates, true);
}
/***/ }),
/* 828 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = traverse;
var _definitions = __webpack_require__(564);
function traverse(node, handlers, state) {
if (typeof handlers === "function") {
handlers = {
enter: handlers
};
}
const {
enter,
exit
} = handlers;
traverseSimpleImpl(node, enter, exit, state, []);
}
function traverseSimpleImpl(node, enter, exit, state, ancestors) {
const keys = _definitions.VISITOR_KEYS[node.type];
if (!keys) return;
if (enter) enter(node, ancestors, state);
for (const key of keys) {
const subNode = node[key];
if (Array.isArray(subNode)) {
for (let i = 0; i < subNode.length; i++) {
const child = subNode[i];
if (!child) continue;
ancestors.push({
node,
key,
index: i
});
traverseSimpleImpl(child, enter, exit, state, ancestors);
ancestors.pop();
}
} else if (subNode) {
ancestors.push({
node,
key
});
traverseSimpleImpl(subNode, enter, exit, state, ancestors);
ancestors.pop();
}
}
if (exit) exit(node, ancestors, state);
}
/***/ }),
/* 829 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isBinding;
var _getBindingIdentifiers = _interopRequireDefault(__webpack_require__(601));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isBinding(node, parent, grandparent) {
if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") {
return false;
}
const keys = _getBindingIdentifiers.default.keys[parent.type];
if (keys) {
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const val = parent[key];
if (Array.isArray(val)) {
if (val.indexOf(node) >= 0) return true;
} else {
if (val === node) return true;
}
}
}
return false;
}
/***/ }),
/* 830 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isBlockScoped;
var _generated = __webpack_require__(559);
var _isLet = _interopRequireDefault(__webpack_require__(683));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isBlockScoped(node) {
return (0, _generated.isFunctionDeclaration)(node) || (0, _generated.isClassDeclaration)(node) || (0, _isLet.default)(node);
}
/***/ }),
/* 831 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isImmutable;
var _isType = _interopRequireDefault(__webpack_require__(626));
var _generated = __webpack_require__(559);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isImmutable(node) {
if ((0, _isType.default)(node.type, "Immutable")) return true;
if ((0, _generated.isIdentifier)(node)) {
if (node.name === "undefined") {
return true;
} else {
return false;
}
}
return false;
}
/***/ }),
/* 832 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isNodesEquivalent;
var _definitions = __webpack_require__(564);
function isNodesEquivalent(a, b) {
if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) {
return a === b;
}
if (a.type !== b.type) {
return false;
}
const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type);
const visitorKeys = _definitions.VISITOR_KEYS[a.type];
for (const field of fields) {
if (typeof a[field] !== typeof b[field]) {
return false;
}
if (a[field] == null && b[field] == null) {
continue;
} else if (a[field] == null || b[field] == null) {
return false;
}
if (Array.isArray(a[field])) {
if (!Array.isArray(b[field])) {
return false;
}
if (a[field].length !== b[field].length) {
return false;
}
for (let i = 0; i < a[field].length; i++) {
if (!isNodesEquivalent(a[field][i], b[field][i])) {
return false;
}
}
continue;
}
if (typeof a[field] === "object" && !(visitorKeys == null ? void 0 : visitorKeys.includes(field))) {
for (const key of Object.keys(a[field])) {
if (a[field][key] !== b[field][key]) {
return false;
}
}
continue;
}
if (!isNodesEquivalent(a[field], b[field])) {
return false;
}
}
return true;
}
/***/ }),
/* 833 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isReferenced;
function isReferenced(node, parent, grandparent) {
switch (parent.type) {
case "MemberExpression":
case "JSXMemberExpression":
case "OptionalMemberExpression":
if (parent.property === node) {
return !!parent.computed;
}
return parent.object === node;
case "VariableDeclarator":
return parent.init === node;
case "ArrowFunctionExpression":
return parent.body === node;
case "ExportSpecifier":
if (parent.source) {
return false;
}
return parent.local === node;
case "PrivateName":
return false;
case "ClassMethod":
case "ClassPrivateMethod":
case "ObjectMethod":
if (parent.params.includes(node)) {
return false;
}
case "ObjectProperty":
case "ClassProperty":
case "ClassPrivateProperty":
if (parent.key === node) {
return !!parent.computed;
}
if (parent.value === node) {
return !grandparent || grandparent.type !== "ObjectPattern";
}
return true;
case "ClassDeclaration":
case "ClassExpression":
return parent.superClass === node;
case "AssignmentExpression":
return parent.right === node;
case "AssignmentPattern":
return parent.right === node;
case "LabeledStatement":
return false;
case "CatchClause":
return false;
case "RestElement":
return false;
case "BreakStatement":
case "ContinueStatement":
return false;
case "FunctionDeclaration":
case "FunctionExpression":
return false;
case "ExportNamespaceSpecifier":
case "ExportDefaultSpecifier":
return false;
case "ImportDefaultSpecifier":
case "ImportNamespaceSpecifier":
case "ImportSpecifier":
return false;
case "JSXAttribute":
return false;
case "ObjectPattern":
case "ArrayPattern":
return false;
case "MetaProperty":
return false;
case "ObjectTypeProperty":
return parent.key !== node;
case "TSEnumMember":
return parent.id !== node;
case "TSPropertySignature":
if (parent.key === node) {
return !!parent.computed;
}
return true;
}
return true;
}
/***/ }),
/* 834 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isScope;
var _generated = __webpack_require__(559);
function isScope(node, parent) {
if ((0, _generated.isBlockStatement)(node) && (0, _generated.isFunction)(parent, {
body: node
})) {
return false;
}
if ((0, _generated.isBlockStatement)(node) && (0, _generated.isCatchClause)(parent, {
body: node
})) {
return false;
}
if ((0, _generated.isPattern)(node) && (0, _generated.isFunction)(parent)) {
return true;
}
return (0, _generated.isScopable)(node);
}
/***/ }),
/* 835 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isSpecifierDefault;
var _generated = __webpack_require__(559);
function isSpecifierDefault(specifier) {
return (0, _generated.isImportDefaultSpecifier)(specifier) || (0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
name: "default"
});
}
/***/ }),
/* 836 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isValidES3Identifier;
var _isValidIdentifier = _interopRequireDefault(__webpack_require__(580));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]);
function isValidES3Identifier(name) {
return (0, _isValidIdentifier.default)(name) && !RESERVED_WORDS_ES3_ONLY.has(name);
}
/***/ }),
/* 837 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isVar;
var _generated = __webpack_require__(559);
var _constants = __webpack_require__(575);
function isVar(node) {
return (0, _generated.isVariableDeclaration)(node, {
kind: "var"
}) && !node[_constants.BLOCK_SCOPED_SYMBOL];
}
/***/ }),
/* 838 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseScriptTags = exports.parseScripts = exports.parseScript = exports.getCandidateScriptLocations = exports.generateWhitespace = exports.extractScriptTags = undefined;
var _types = __webpack_require__(2);
var types = _interopRequireWildcard(_types);
var _parser = __webpack_require__(685);
var parser = _interopRequireWildcard(_parser);
var _customParse = __webpack_require__(839);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function parseScript(_ref) {
var source = _ref.source,
line = _ref.line;
// remove empty or only whitespace scripts
if (source.length === 0 || /^\s+$/.test(source)) {
return null;
}
try {
return parser.parse(source, {
sourceType: "script",
startLine: line
});
} catch (e) {
return null;
}
}
function parseScripts(locations) {
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript;
return (0, _customParse.parseScripts)(locations, parser);
}
function extractScriptTags(source) {
return parseScripts((0, _customParse.getCandidateScriptLocations)(source), function (loc) {
var ast = parseScript(loc);
if (ast) {
return loc;
}
return null;
}).filter(types.isFile);
}
function parseScriptTags(source) {
var parser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseScript;
return (0, _customParse.parseScriptTags)(source, parser);
}
exports.default = parseScriptTags;
exports.extractScriptTags = extractScriptTags;
exports.generateWhitespace = _customParse.generateWhitespace;
exports.getCandidateScriptLocations = _customParse.getCandidateScriptLocations;
exports.parseScript = parseScript;
exports.parseScripts = parseScripts;
exports.parseScriptTags = parseScriptTags;
/***/ }),
/* 839 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseScriptTags = exports.parseScripts = exports.getCandidateScriptLocations = exports.generateWhitespace = undefined;
var _types = __webpack_require__(2);
var types = _interopRequireWildcard(_types);
var _parseScriptFragment = __webpack_require__(840);
var _parseScriptFragment2 = _interopRequireDefault(_parseScriptFragment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var startScript = /