/* 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 = __webpack_require__(715);
var _isCompatTag = __webpack_require__(716);
var _buildChildren = __webpack_require__(717);
var _assertNode = __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;
if (key in exports && exports[key] === _generated[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated[key];
}
});
});
var _createTypeAnnotationBasedOnTypeof = __webpack_require__(790);
var _createFlowUnionType = __webpack_require__(791);
var _createTSUnionType = __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;
if (key in exports && exports[key] === _generated2[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated2[key];
}
});
});
var _uppercase = __webpack_require__(1004);
Object.keys(_uppercase).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _uppercase[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _uppercase[key];
}
});
});
var _cloneNode = __webpack_require__(576);
var _clone = __webpack_require__(794);
var _cloneDeep = __webpack_require__(795);
var _cloneDeepWithoutLoc = __webpack_require__(796);
var _cloneWithoutLoc = __webpack_require__(797);
var _addComment = __webpack_require__(798);
var _addComments = __webpack_require__(671);
var _inheritInnerComments = __webpack_require__(672);
var _inheritLeadingComments = __webpack_require__(675);
var _inheritsComments = __webpack_require__(676);
var _inheritTrailingComments = __webpack_require__(677);
var _removeComments = __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;
if (key in exports && exports[key] === _generated3[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;
if (key in exports && exports[key] === _constants[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _constants[key];
}
});
});
var _ensureBlock = __webpack_require__(812);
var _toBindingIdentifierName = __webpack_require__(813);
var _toBlock = __webpack_require__(678);
var _toComputedKey = __webpack_require__(814);
var _toExpression = __webpack_require__(815);
var _toIdentifier = __webpack_require__(679);
var _toKeyAlias = __webpack_require__(816);
var _toSequenceExpression = __webpack_require__(817);
var _toStatement = __webpack_require__(819);
var _valueToNode = __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;
if (key in exports && exports[key] === _definitions[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _definitions[key];
}
});
});
var _appendToMemberExpression = __webpack_require__(824);
var _inherits = __webpack_require__(825);
var _prependToMemberExpression = __webpack_require__(826);
var _removeProperties = __webpack_require__(682);
var _removePropertiesDeep = __webpack_require__(680);
var _removeTypeDuplicates = __webpack_require__(670);
var _getBindingIdentifiers = __webpack_require__(601);
var _getOuterBindingIdentifiers = __webpack_require__(827);
var _traverse = __webpack_require__(828);
Object.keys(_traverse).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _traverse[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _traverse[key];
}
});
});
var _traverseFast = __webpack_require__(681);
var _shallowEqual = __webpack_require__(612);
var _is = __webpack_require__(579);
var _isBinding = __webpack_require__(829);
var _isBlockScoped = __webpack_require__(830);
var _isImmutable = __webpack_require__(831);
var _isLet = __webpack_require__(683);
var _isNode = __webpack_require__(669);
var _isNodesEquivalent = __webpack_require__(832);
var _isPlaceholderType = __webpack_require__(666);
var _isReferenced = __webpack_require__(833);
var _isScope = __webpack_require__(834);
var _isSpecifierDefault = __webpack_require__(835);
var _isType = __webpack_require__(626);
var _isValidES3Identifier = __webpack_require__(836);
var _isValidIdentifier = __webpack_require__(580);
var _isVar = __webpack_require__(837);
var _matchesPattern = __webpack_require__(650);
var _validate = __webpack_require__(627);
var _buildMatchMemberExpression = __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;
if (key in exports && exports[key] === _generated4[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated4[key];
}
});
});
var _generated5 = __webpack_require__(1005);
Object.keys(_generated5).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _generated5[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function () {
return _generated5[key];
}
});
});
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.isAwaitExpression = isAwaitExpression;
exports.isImport = isImport;
exports.isBigIntLiteral = isBigIntLiteral;
exports.isExportNamespaceSpecifier = isExportNamespaceSpecifier;
exports.isOptionalMemberExpression = isOptionalMemberExpression;
exports.isOptionalCallExpression = isOptionalCallExpression;
exports.isClassProperty = isClassProperty;
exports.isClassPrivateProperty = isClassPrivateProperty;
exports.isClassPrivateMethod = isClassPrivateMethod;
exports.isPrivateName = isPrivateName;
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.isIndexedAccessType = isIndexedAccessType;
exports.isOptionalIndexedAccessType = isOptionalIndexedAccessType;
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.isBindExpression = isBindExpression;
exports.isImportAttribute = isImportAttribute;
exports.isDecorator = isDecorator;
exports.isDoExpression = isDoExpression;
exports.isExportDefaultSpecifier = isExportDefaultSpecifier;
exports.isRecordExpression = isRecordExpression;
exports.isTupleExpression = isTupleExpression;
exports.isDecimalLiteral = isDecimalLiteral;
exports.isStaticBlock = isStaticBlock;
exports.isModuleExpression = isModuleExpression;
exports.isTopicReference = isTopicReference;
exports.isPipelineTopicExpression = isPipelineTopicExpression;
exports.isPipelineBareFunction = isPipelineBareFunction;
exports.isPipelinePrimaryTopicReference = isPipelinePrimaryTopicReference;
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.isTSIntrinsicKeyword = isTSIntrinsicKeyword;
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.isTSNamedTupleMember = isTSNamedTupleMember;
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.isPrivate = isPrivate;
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.isTSTypeElement = isTSTypeElement;
exports.isTSType = isTSType;
exports.isTSBaseType = isTSBaseType;
exports.isNumberLiteral = isNumberLiteral;
exports.isRegexLiteral = isRegexLiteral;
exports.isRestProperty = isRestProperty;
exports.isSpreadProperty = isSpreadProperty;
var _shallowEqual = __webpack_require__(612);
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 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 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 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 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 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 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 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 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 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 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 isIndexedAccessType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "IndexedAccessType") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isOptionalIndexedAccessType(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "OptionalIndexedAccessType") {
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 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 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 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 isDecimalLiteral(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "DecimalLiteral") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isStaticBlock(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "StaticBlock") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isModuleExpression(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "ModuleExpression") {
if (typeof opts === "undefined") {
return true;
} else {
return (0, _shallowEqual.default)(node, opts);
}
}
return false;
}
function isTopicReference(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TopicReference") {
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 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 isTSIntrinsicKeyword(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSIntrinsicKeyword") {
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 isTSNamedTupleMember(node, opts) {
if (!node) return false;
const nodeType = node.type;
if (nodeType === "TSNamedTupleMember") {
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 ("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 || "AwaitExpression" === nodeType || "Import" === nodeType || "BigIntLiteral" === nodeType || "OptionalMemberExpression" === nodeType || "OptionalCallExpression" === nodeType || "TypeCastExpression" === nodeType || "JSXElement" === nodeType || "JSXFragment" === nodeType || "BindExpression" === nodeType || "DoExpression" === nodeType || "RecordExpression" === nodeType || "TupleExpression" === nodeType || "DecimalLiteral" === nodeType || "ModuleExpression" === nodeType || "TopicReference" === nodeType || "PipelineTopicExpression" === nodeType || "PipelineBareFunction" === nodeType || "PipelinePrimaryTopicReference" === 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 ("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 ("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 || "StaticBlock" === 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 ("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 || "StaticBlock" === 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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("FunctionDeclaration" === nodeType || "FunctionExpression" === nodeType || "StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "ArrowFunctionExpression" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === 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 ("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 ("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 ("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 ("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 ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "RegExpLiteral" === nodeType || "TemplateLiteral" === nodeType || "BigIntLiteral" === nodeType || "DecimalLiteral" === 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 ("StringLiteral" === nodeType || "NumericLiteral" === nodeType || "NullLiteral" === nodeType || "BooleanLiteral" === nodeType || "BigIntLiteral" === nodeType || "JSXAttribute" === nodeType || "JSXClosingElement" === nodeType || "JSXElement" === nodeType || "JSXExpressionContainer" === nodeType || "JSXSpreadChild" === nodeType || "JSXOpeningElement" === nodeType || "JSXText" === nodeType || "JSXFragment" === nodeType || "JSXOpeningFragment" === nodeType || "JSXClosingFragment" === nodeType || "DecimalLiteral" === 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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("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 ("ExportSpecifier" === nodeType || "ImportDefaultSpecifier" === nodeType || "ImportNamespaceSpecifier" === nodeType || "ImportSpecifier" === nodeType || "ExportNamespaceSpecifier" === nodeType || "ExportDefaultSpecifier" === 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 ("ClassPrivateProperty" === nodeType || "ClassPrivateMethod" === nodeType || "PrivateName" === 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 ("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 || "IndexedAccessType" === nodeType || "OptionalIndexedAccessType" === 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 ("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 || "IndexedAccessType" === nodeType || "OptionalIndexedAccessType" === 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 ("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 ("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 ("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 ("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 ("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 ("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 isTSTypeElement(node, opts) {
if (!node) return false;
const nodeType = node.type;
if ("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 ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === 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 ("TSAnyKeyword" === nodeType || "TSBooleanKeyword" === nodeType || "TSBigIntKeyword" === nodeType || "TSIntrinsicKeyword" === 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 */,
/* 561 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.arrayExpression = arrayExpression;
exports.assignmentExpression = assignmentExpression;
exports.binaryExpression = binaryExpression;
exports.interpreterDirective = interpreterDirective;
exports.directive = directive;
exports.directiveLiteral = directiveLiteral;
exports.blockStatement = blockStatement;
exports.breakStatement = breakStatement;
exports.callExpression = callExpression;
exports.catchClause = catchClause;
exports.conditionalExpression = conditionalExpression;
exports.continueStatement = continueStatement;
exports.debuggerStatement = debuggerStatement;
exports.doWhileStatement = doWhileStatement;
exports.emptyStatement = emptyStatement;
exports.expressionStatement = expressionStatement;
exports.file = file;
exports.forInStatement = forInStatement;
exports.forStatement = forStatement;
exports.functionDeclaration = functionDeclaration;
exports.functionExpression = functionExpression;
exports.identifier = identifier;
exports.ifStatement = ifStatement;
exports.labeledStatement = labeledStatement;
exports.stringLiteral = stringLiteral;
exports.numericLiteral = numericLiteral;
exports.nullLiteral = nullLiteral;
exports.booleanLiteral = booleanLiteral;
exports.regExpLiteral = regExpLiteral;
exports.logicalExpression = logicalExpression;
exports.memberExpression = memberExpression;
exports.newExpression = newExpression;
exports.program = program;
exports.objectExpression = objectExpression;
exports.objectMethod = objectMethod;
exports.objectProperty = objectProperty;
exports.restElement = restElement;
exports.returnStatement = returnStatement;
exports.sequenceExpression = sequenceExpression;
exports.parenthesizedExpression = parenthesizedExpression;
exports.switchCase = switchCase;
exports.switchStatement = switchStatement;
exports.thisExpression = thisExpression;
exports.throwStatement = throwStatement;
exports.tryStatement = tryStatement;
exports.unaryExpression = unaryExpression;
exports.updateExpression = updateExpression;
exports.variableDeclaration = variableDeclaration;
exports.variableDeclarator = variableDeclarator;
exports.whileStatement = whileStatement;
exports.withStatement = withStatement;
exports.assignmentPattern = assignmentPattern;
exports.arrayPattern = arrayPattern;
exports.arrowFunctionExpression = arrowFunctionExpression;
exports.classBody = classBody;
exports.classExpression = classExpression;
exports.classDeclaration = classDeclaration;
exports.exportAllDeclaration = exportAllDeclaration;
exports.exportDefaultDeclaration = exportDefaultDeclaration;
exports.exportNamedDeclaration = exportNamedDeclaration;
exports.exportSpecifier = exportSpecifier;
exports.forOfStatement = forOfStatement;
exports.importDeclaration = importDeclaration;
exports.importDefaultSpecifier = importDefaultSpecifier;
exports.importNamespaceSpecifier = importNamespaceSpecifier;
exports.importSpecifier = importSpecifier;
exports.metaProperty = metaProperty;
exports.classMethod = classMethod;
exports.objectPattern = objectPattern;
exports.spreadElement = spreadElement;
exports.super = _super;
exports.taggedTemplateExpression = taggedTemplateExpression;
exports.templateElement = templateElement;
exports.templateLiteral = templateLiteral;
exports.yieldExpression = yieldExpression;
exports.awaitExpression = awaitExpression;
exports.import = _import;
exports.bigIntLiteral = bigIntLiteral;
exports.exportNamespaceSpecifier = exportNamespaceSpecifier;
exports.optionalMemberExpression = optionalMemberExpression;
exports.optionalCallExpression = optionalCallExpression;
exports.classProperty = classProperty;
exports.classPrivateProperty = classPrivateProperty;
exports.classPrivateMethod = classPrivateMethod;
exports.privateName = privateName;
exports.anyTypeAnnotation = anyTypeAnnotation;
exports.arrayTypeAnnotation = arrayTypeAnnotation;
exports.booleanTypeAnnotation = booleanTypeAnnotation;
exports.booleanLiteralTypeAnnotation = booleanLiteralTypeAnnotation;
exports.nullLiteralTypeAnnotation = nullLiteralTypeAnnotation;
exports.classImplements = classImplements;
exports.declareClass = declareClass;
exports.declareFunction = declareFunction;
exports.declareInterface = declareInterface;
exports.declareModule = declareModule;
exports.declareModuleExports = declareModuleExports;
exports.declareTypeAlias = declareTypeAlias;
exports.declareOpaqueType = declareOpaqueType;
exports.declareVariable = declareVariable;
exports.declareExportDeclaration = declareExportDeclaration;
exports.declareExportAllDeclaration = declareExportAllDeclaration;
exports.declaredPredicate = declaredPredicate;
exports.existsTypeAnnotation = existsTypeAnnotation;
exports.functionTypeAnnotation = functionTypeAnnotation;
exports.functionTypeParam = functionTypeParam;
exports.genericTypeAnnotation = genericTypeAnnotation;
exports.inferredPredicate = inferredPredicate;
exports.interfaceExtends = interfaceExtends;
exports.interfaceDeclaration = interfaceDeclaration;
exports.interfaceTypeAnnotation = interfaceTypeAnnotation;
exports.intersectionTypeAnnotation = intersectionTypeAnnotation;
exports.mixedTypeAnnotation = mixedTypeAnnotation;
exports.emptyTypeAnnotation = emptyTypeAnnotation;
exports.nullableTypeAnnotation = nullableTypeAnnotation;
exports.numberLiteralTypeAnnotation = numberLiteralTypeAnnotation;
exports.numberTypeAnnotation = numberTypeAnnotation;
exports.objectTypeAnnotation = objectTypeAnnotation;
exports.objectTypeInternalSlot = objectTypeInternalSlot;
exports.objectTypeCallProperty = objectTypeCallProperty;
exports.objectTypeIndexer = objectTypeIndexer;
exports.objectTypeProperty = objectTypeProperty;
exports.objectTypeSpreadProperty = objectTypeSpreadProperty;
exports.opaqueType = opaqueType;
exports.qualifiedTypeIdentifier = qualifiedTypeIdentifier;
exports.stringLiteralTypeAnnotation = stringLiteralTypeAnnotation;
exports.stringTypeAnnotation = stringTypeAnnotation;
exports.symbolTypeAnnotation = symbolTypeAnnotation;
exports.thisTypeAnnotation = thisTypeAnnotation;
exports.tupleTypeAnnotation = tupleTypeAnnotation;
exports.typeofTypeAnnotation = typeofTypeAnnotation;
exports.typeAlias = typeAlias;
exports.typeAnnotation = typeAnnotation;
exports.typeCastExpression = typeCastExpression;
exports.typeParameter = typeParameter;
exports.typeParameterDeclaration = typeParameterDeclaration;
exports.typeParameterInstantiation = typeParameterInstantiation;
exports.unionTypeAnnotation = unionTypeAnnotation;
exports.variance = variance;
exports.voidTypeAnnotation = voidTypeAnnotation;
exports.enumDeclaration = enumDeclaration;
exports.enumBooleanBody = enumBooleanBody;
exports.enumNumberBody = enumNumberBody;
exports.enumStringBody = enumStringBody;
exports.enumSymbolBody = enumSymbolBody;
exports.enumBooleanMember = enumBooleanMember;
exports.enumNumberMember = enumNumberMember;
exports.enumStringMember = enumStringMember;
exports.enumDefaultedMember = enumDefaultedMember;
exports.indexedAccessType = indexedAccessType;
exports.optionalIndexedAccessType = optionalIndexedAccessType;
exports.jSXAttribute = exports.jsxAttribute = jsxAttribute;
exports.jSXClosingElement = exports.jsxClosingElement = jsxClosingElement;
exports.jSXElement = exports.jsxElement = jsxElement;
exports.jSXEmptyExpression = exports.jsxEmptyExpression = jsxEmptyExpression;
exports.jSXExpressionContainer = exports.jsxExpressionContainer = jsxExpressionContainer;
exports.jSXSpreadChild = exports.jsxSpreadChild = jsxSpreadChild;
exports.jSXIdentifier = exports.jsxIdentifier = jsxIdentifier;
exports.jSXMemberExpression = exports.jsxMemberExpression = jsxMemberExpression;
exports.jSXNamespacedName = exports.jsxNamespacedName = jsxNamespacedName;
exports.jSXOpeningElement = exports.jsxOpeningElement = jsxOpeningElement;
exports.jSXSpreadAttribute = exports.jsxSpreadAttribute = jsxSpreadAttribute;
exports.jSXText = exports.jsxText = jsxText;
exports.jSXFragment = exports.jsxFragment = jsxFragment;
exports.jSXOpeningFragment = exports.jsxOpeningFragment = jsxOpeningFragment;
exports.jSXClosingFragment = exports.jsxClosingFragment = jsxClosingFragment;
exports.noop = noop;
exports.placeholder = placeholder;
exports.v8IntrinsicIdentifier = v8IntrinsicIdentifier;
exports.argumentPlaceholder = argumentPlaceholder;
exports.bindExpression = bindExpression;
exports.importAttribute = importAttribute;
exports.decorator = decorator;
exports.doExpression = doExpression;
exports.exportDefaultSpecifier = exportDefaultSpecifier;
exports.recordExpression = recordExpression;
exports.tupleExpression = tupleExpression;
exports.decimalLiteral = decimalLiteral;
exports.staticBlock = staticBlock;
exports.moduleExpression = moduleExpression;
exports.topicReference = topicReference;
exports.pipelineTopicExpression = pipelineTopicExpression;
exports.pipelineBareFunction = pipelineBareFunction;
exports.pipelinePrimaryTopicReference = pipelinePrimaryTopicReference;
exports.tSParameterProperty = exports.tsParameterProperty = tsParameterProperty;
exports.tSDeclareFunction = exports.tsDeclareFunction = tsDeclareFunction;
exports.tSDeclareMethod = exports.tsDeclareMethod = tsDeclareMethod;
exports.tSQualifiedName = exports.tsQualifiedName = tsQualifiedName;
exports.tSCallSignatureDeclaration = exports.tsCallSignatureDeclaration = tsCallSignatureDeclaration;
exports.tSConstructSignatureDeclaration = exports.tsConstructSignatureDeclaration = tsConstructSignatureDeclaration;
exports.tSPropertySignature = exports.tsPropertySignature = tsPropertySignature;
exports.tSMethodSignature = exports.tsMethodSignature = tsMethodSignature;
exports.tSIndexSignature = exports.tsIndexSignature = tsIndexSignature;
exports.tSAnyKeyword = exports.tsAnyKeyword = tsAnyKeyword;
exports.tSBooleanKeyword = exports.tsBooleanKeyword = tsBooleanKeyword;
exports.tSBigIntKeyword = exports.tsBigIntKeyword = tsBigIntKeyword;
exports.tSIntrinsicKeyword = exports.tsIntrinsicKeyword = tsIntrinsicKeyword;
exports.tSNeverKeyword = exports.tsNeverKeyword = tsNeverKeyword;
exports.tSNullKeyword = exports.tsNullKeyword = tsNullKeyword;
exports.tSNumberKeyword = exports.tsNumberKeyword = tsNumberKeyword;
exports.tSObjectKeyword = exports.tsObjectKeyword = tsObjectKeyword;
exports.tSStringKeyword = exports.tsStringKeyword = tsStringKeyword;
exports.tSSymbolKeyword = exports.tsSymbolKeyword = tsSymbolKeyword;
exports.tSUndefinedKeyword = exports.tsUndefinedKeyword = tsUndefinedKeyword;
exports.tSUnknownKeyword = exports.tsUnknownKeyword = tsUnknownKeyword;
exports.tSVoidKeyword = exports.tsVoidKeyword = tsVoidKeyword;
exports.tSThisType = exports.tsThisType = tsThisType;
exports.tSFunctionType = exports.tsFunctionType = tsFunctionType;
exports.tSConstructorType = exports.tsConstructorType = tsConstructorType;
exports.tSTypeReference = exports.tsTypeReference = tsTypeReference;
exports.tSTypePredicate = exports.tsTypePredicate = tsTypePredicate;
exports.tSTypeQuery = exports.tsTypeQuery = tsTypeQuery;
exports.tSTypeLiteral = exports.tsTypeLiteral = tsTypeLiteral;
exports.tSArrayType = exports.tsArrayType = tsArrayType;
exports.tSTupleType = exports.tsTupleType = tsTupleType;
exports.tSOptionalType = exports.tsOptionalType = tsOptionalType;
exports.tSRestType = exports.tsRestType = tsRestType;
exports.tSNamedTupleMember = exports.tsNamedTupleMember = tsNamedTupleMember;
exports.tSUnionType = exports.tsUnionType = tsUnionType;
exports.tSIntersectionType = exports.tsIntersectionType = tsIntersectionType;
exports.tSConditionalType = exports.tsConditionalType = tsConditionalType;
exports.tSInferType = exports.tsInferType = tsInferType;
exports.tSParenthesizedType = exports.tsParenthesizedType = tsParenthesizedType;
exports.tSTypeOperator = exports.tsTypeOperator = tsTypeOperator;
exports.tSIndexedAccessType = exports.tsIndexedAccessType = tsIndexedAccessType;
exports.tSMappedType = exports.tsMappedType = tsMappedType;
exports.tSLiteralType = exports.tsLiteralType = tsLiteralType;
exports.tSExpressionWithTypeArguments = exports.tsExpressionWithTypeArguments = tsExpressionWithTypeArguments;
exports.tSInterfaceDeclaration = exports.tsInterfaceDeclaration = tsInterfaceDeclaration;
exports.tSInterfaceBody = exports.tsInterfaceBody = tsInterfaceBody;
exports.tSTypeAliasDeclaration = exports.tsTypeAliasDeclaration = tsTypeAliasDeclaration;
exports.tSAsExpression = exports.tsAsExpression = tsAsExpression;
exports.tSTypeAssertion = exports.tsTypeAssertion = tsTypeAssertion;
exports.tSEnumDeclaration = exports.tsEnumDeclaration = tsEnumDeclaration;
exports.tSEnumMember = exports.tsEnumMember = tsEnumMember;
exports.tSModuleDeclaration = exports.tsModuleDeclaration = tsModuleDeclaration;
exports.tSModuleBlock = exports.tsModuleBlock = tsModuleBlock;
exports.tSImportType = exports.tsImportType = tsImportType;
exports.tSImportEqualsDeclaration = exports.tsImportEqualsDeclaration = tsImportEqualsDeclaration;
exports.tSExternalModuleReference = exports.tsExternalModuleReference = tsExternalModuleReference;
exports.tSNonNullExpression = exports.tsNonNullExpression = tsNonNullExpression;
exports.tSExportAssignment = exports.tsExportAssignment = tsExportAssignment;
exports.tSNamespaceExportDeclaration = exports.tsNamespaceExportDeclaration = tsNamespaceExportDeclaration;
exports.tSTypeAnnotation = exports.tsTypeAnnotation = tsTypeAnnotation;
exports.tSTypeParameterInstantiation = exports.tsTypeParameterInstantiation = tsTypeParameterInstantiation;
exports.tSTypeParameterDeclaration = exports.tsTypeParameterDeclaration = tsTypeParameterDeclaration;
exports.tSTypeParameter = exports.tsTypeParameter = tsTypeParameter;
exports.numberLiteral = NumberLiteral;
exports.regexLiteral = RegexLiteral;
exports.restProperty = RestProperty;
exports.spreadProperty = SpreadProperty;
var _builder = __webpack_require__(719);
function arrayExpression(elements) {
return (0, _builder.default)("ArrayExpression", ...arguments);
}
function assignmentExpression(operator, left, right) {
return (0, _builder.default)("AssignmentExpression", ...arguments);
}
function binaryExpression(operator, left, right) {
return (0, _builder.default)("BinaryExpression", ...arguments);
}
function interpreterDirective(value) {
return (0, _builder.default)("InterpreterDirective", ...arguments);
}
function directive(value) {
return (0, _builder.default)("Directive", ...arguments);
}
function directiveLiteral(value) {
return (0, _builder.default)("DirectiveLiteral", ...arguments);
}
function blockStatement(body, directives) {
return (0, _builder.default)("BlockStatement", ...arguments);
}
function breakStatement(label) {
return (0, _builder.default)("BreakStatement", ...arguments);
}
function callExpression(callee, _arguments) {
return (0, _builder.default)("CallExpression", ...arguments);
}
function catchClause(param, body) {
return (0, _builder.default)("CatchClause", ...arguments);
}
function conditionalExpression(test, consequent, alternate) {
return (0, _builder.default)("ConditionalExpression", ...arguments);
}
function continueStatement(label) {
return (0, _builder.default)("ContinueStatement", ...arguments);
}
function debuggerStatement() {
return (0, _builder.default)("DebuggerStatement", ...arguments);
}
function doWhileStatement(test, body) {
return (0, _builder.default)("DoWhileStatement", ...arguments);
}
function emptyStatement() {
return (0, _builder.default)("EmptyStatement", ...arguments);
}
function expressionStatement(expression) {
return (0, _builder.default)("ExpressionStatement", ...arguments);
}
function file(program, comments, tokens) {
return (0, _builder.default)("File", ...arguments);
}
function forInStatement(left, right, body) {
return (0, _builder.default)("ForInStatement", ...arguments);
}
function forStatement(init, test, update, body) {
return (0, _builder.default)("ForStatement", ...arguments);
}
function functionDeclaration(id, params, body, generator, async) {
return (0, _builder.default)("FunctionDeclaration", ...arguments);
}
function functionExpression(id, params, body, generator, async) {
return (0, _builder.default)("FunctionExpression", ...arguments);
}
function identifier(name) {
return (0, _builder.default)("Identifier", ...arguments);
}
function ifStatement(test, consequent, alternate) {
return (0, _builder.default)("IfStatement", ...arguments);
}
function labeledStatement(label, body) {
return (0, _builder.default)("LabeledStatement", ...arguments);
}
function stringLiteral(value) {
return (0, _builder.default)("StringLiteral", ...arguments);
}
function numericLiteral(value) {
return (0, _builder.default)("NumericLiteral", ...arguments);
}
function nullLiteral() {
return (0, _builder.default)("NullLiteral", ...arguments);
}
function booleanLiteral(value) {
return (0, _builder.default)("BooleanLiteral", ...arguments);
}
function regExpLiteral(pattern, flags) {
return (0, _builder.default)("RegExpLiteral", ...arguments);
}
function logicalExpression(operator, left, right) {
return (0, _builder.default)("LogicalExpression", ...arguments);
}
function memberExpression(object, property, computed, optional) {
return (0, _builder.default)("MemberExpression", ...arguments);
}
function newExpression(callee, _arguments) {
return (0, _builder.default)("NewExpression", ...arguments);
}
function program(body, directives, sourceType, interpreter) {
return (0, _builder.default)("Program", ...arguments);
}
function objectExpression(properties) {
return (0, _builder.default)("ObjectExpression", ...arguments);
}
function objectMethod(kind, key, params, body, computed, generator, async) {
return (0, _builder.default)("ObjectMethod", ...arguments);
}
function objectProperty(key, value, computed, shorthand, decorators) {
return (0, _builder.default)("ObjectProperty", ...arguments);
}
function restElement(argument) {
return (0, _builder.default)("RestElement", ...arguments);
}
function returnStatement(argument) {
return (0, _builder.default)("ReturnStatement", ...arguments);
}
function sequenceExpression(expressions) {
return (0, _builder.default)("SequenceExpression", ...arguments);
}
function parenthesizedExpression(expression) {
return (0, _builder.default)("ParenthesizedExpression", ...arguments);
}
function switchCase(test, consequent) {
return (0, _builder.default)("SwitchCase", ...arguments);
}
function switchStatement(discriminant, cases) {
return (0, _builder.default)("SwitchStatement", ...arguments);
}
function thisExpression() {
return (0, _builder.default)("ThisExpression", ...arguments);
}
function throwStatement(argument) {
return (0, _builder.default)("ThrowStatement", ...arguments);
}
function tryStatement(block, handler, finalizer) {
return (0, _builder.default)("TryStatement", ...arguments);
}
function unaryExpression(operator, argument, prefix) {
return (0, _builder.default)("UnaryExpression", ...arguments);
}
function updateExpression(operator, argument, prefix) {
return (0, _builder.default)("UpdateExpression", ...arguments);
}
function variableDeclaration(kind, declarations) {
return (0, _builder.default)("VariableDeclaration", ...arguments);
}
function variableDeclarator(id, init) {
return (0, _builder.default)("VariableDeclarator", ...arguments);
}
function whileStatement(test, body) {
return (0, _builder.default)("WhileStatement", ...arguments);
}
function withStatement(object, body) {
return (0, _builder.default)("WithStatement", ...arguments);
}
function assignmentPattern(left, right) {
return (0, _builder.default)("AssignmentPattern", ...arguments);
}
function arrayPattern(elements) {
return (0, _builder.default)("ArrayPattern", ...arguments);
}
function arrowFunctionExpression(params, body, async) {
return (0, _builder.default)("ArrowFunctionExpression", ...arguments);
}
function classBody(body) {
return (0, _builder.default)("ClassBody", ...arguments);
}
function classExpression(id, superClass, body, decorators) {
return (0, _builder.default)("ClassExpression", ...arguments);
}
function classDeclaration(id, superClass, body, decorators) {
return (0, _builder.default)("ClassDeclaration", ...arguments);
}
function exportAllDeclaration(source) {
return (0, _builder.default)("ExportAllDeclaration", ...arguments);
}
function exportDefaultDeclaration(declaration) {
return (0, _builder.default)("ExportDefaultDeclaration", ...arguments);
}
function exportNamedDeclaration(declaration, specifiers, source) {
return (0, _builder.default)("ExportNamedDeclaration", ...arguments);
}
function exportSpecifier(local, exported) {
return (0, _builder.default)("ExportSpecifier", ...arguments);
}
function forOfStatement(left, right, body, _await) {
return (0, _builder.default)("ForOfStatement", ...arguments);
}
function importDeclaration(specifiers, source) {
return (0, _builder.default)("ImportDeclaration", ...arguments);
}
function importDefaultSpecifier(local) {
return (0, _builder.default)("ImportDefaultSpecifier", ...arguments);
}
function importNamespaceSpecifier(local) {
return (0, _builder.default)("ImportNamespaceSpecifier", ...arguments);
}
function importSpecifier(local, imported) {
return (0, _builder.default)("ImportSpecifier", ...arguments);
}
function metaProperty(meta, property) {
return (0, _builder.default)("MetaProperty", ...arguments);
}
function classMethod(kind, key, params, body, computed, _static, generator, async) {
return (0, _builder.default)("ClassMethod", ...arguments);
}
function objectPattern(properties) {
return (0, _builder.default)("ObjectPattern", ...arguments);
}
function spreadElement(argument) {
return (0, _builder.default)("SpreadElement", ...arguments);
}
function _super() {
return (0, _builder.default)("Super", ...arguments);
}
function taggedTemplateExpression(tag, quasi) {
return (0, _builder.default)("TaggedTemplateExpression", ...arguments);
}
function templateElement(value, tail) {
return (0, _builder.default)("TemplateElement", ...arguments);
}
function templateLiteral(quasis, expressions) {
return (0, _builder.default)("TemplateLiteral", ...arguments);
}
function yieldExpression(argument, delegate) {
return (0, _builder.default)("YieldExpression", ...arguments);
}
function awaitExpression(argument) {
return (0, _builder.default)("AwaitExpression", ...arguments);
}
function _import() {
return (0, _builder.default)("Import", ...arguments);
}
function bigIntLiteral(value) {
return (0, _builder.default)("BigIntLiteral", ...arguments);
}
function exportNamespaceSpecifier(exported) {
return (0, _builder.default)("ExportNamespaceSpecifier", ...arguments);
}
function optionalMemberExpression(object, property, computed, optional) {
return (0, _builder.default)("OptionalMemberExpression", ...arguments);
}
function optionalCallExpression(callee, _arguments, optional) {
return (0, _builder.default)("OptionalCallExpression", ...arguments);
}
function classProperty(key, value, typeAnnotation, decorators, computed, _static) {
return (0, _builder.default)("ClassProperty", ...arguments);
}
function classPrivateProperty(key, value, decorators, _static) {
return (0, _builder.default)("ClassPrivateProperty", ...arguments);
}
function classPrivateMethod(kind, key, params, body, _static) {
return (0, _builder.default)("ClassPrivateMethod", ...arguments);
}
function privateName(id) {
return (0, _builder.default)("PrivateName", ...arguments);
}
function anyTypeAnnotation() {
return (0, _builder.default)("AnyTypeAnnotation", ...arguments);
}
function arrayTypeAnnotation(elementType) {
return (0, _builder.default)("ArrayTypeAnnotation", ...arguments);
}
function booleanTypeAnnotation() {
return (0, _builder.default)("BooleanTypeAnnotation", ...arguments);
}
function booleanLiteralTypeAnnotation(value) {
return (0, _builder.default)("BooleanLiteralTypeAnnotation", ...arguments);
}
function nullLiteralTypeAnnotation() {
return (0, _builder.default)("NullLiteralTypeAnnotation", ...arguments);
}
function classImplements(id, typeParameters) {
return (0, _builder.default)("ClassImplements", ...arguments);
}
function declareClass(id, typeParameters, _extends, body) {
return (0, _builder.default)("DeclareClass", ...arguments);
}
function declareFunction(id) {
return (0, _builder.default)("DeclareFunction", ...arguments);
}
function declareInterface(id, typeParameters, _extends, body) {
return (0, _builder.default)("DeclareInterface", ...arguments);
}
function declareModule(id, body, kind) {
return (0, _builder.default)("DeclareModule", ...arguments);
}
function declareModuleExports(typeAnnotation) {
return (0, _builder.default)("DeclareModuleExports", ...arguments);
}
function declareTypeAlias(id, typeParameters, right) {
return (0, _builder.default)("DeclareTypeAlias", ...arguments);
}
function declareOpaqueType(id, typeParameters, supertype) {
return (0, _builder.default)("DeclareOpaqueType", ...arguments);
}
function declareVariable(id) {
return (0, _builder.default)("DeclareVariable", ...arguments);
}
function declareExportDeclaration(declaration, specifiers, source) {
return (0, _builder.default)("DeclareExportDeclaration", ...arguments);
}
function declareExportAllDeclaration(source) {
return (0, _builder.default)("DeclareExportAllDeclaration", ...arguments);
}
function declaredPredicate(value) {
return (0, _builder.default)("DeclaredPredicate", ...arguments);
}
function existsTypeAnnotation() {
return (0, _builder.default)("ExistsTypeAnnotation", ...arguments);
}
function functionTypeAnnotation(typeParameters, params, rest, returnType) {
return (0, _builder.default)("FunctionTypeAnnotation", ...arguments);
}
function functionTypeParam(name, typeAnnotation) {
return (0, _builder.default)("FunctionTypeParam", ...arguments);
}
function genericTypeAnnotation(id, typeParameters) {
return (0, _builder.default)("GenericTypeAnnotation", ...arguments);
}
function inferredPredicate() {
return (0, _builder.default)("InferredPredicate", ...arguments);
}
function interfaceExtends(id, typeParameters) {
return (0, _builder.default)("InterfaceExtends", ...arguments);
}
function interfaceDeclaration(id, typeParameters, _extends, body) {
return (0, _builder.default)("InterfaceDeclaration", ...arguments);
}
function interfaceTypeAnnotation(_extends, body) {
return (0, _builder.default)("InterfaceTypeAnnotation", ...arguments);
}
function intersectionTypeAnnotation(types) {
return (0, _builder.default)("IntersectionTypeAnnotation", ...arguments);
}
function mixedTypeAnnotation() {
return (0, _builder.default)("MixedTypeAnnotation", ...arguments);
}
function emptyTypeAnnotation() {
return (0, _builder.default)("EmptyTypeAnnotation", ...arguments);
}
function nullableTypeAnnotation(typeAnnotation) {
return (0, _builder.default)("NullableTypeAnnotation", ...arguments);
}
function numberLiteralTypeAnnotation(value) {
return (0, _builder.default)("NumberLiteralTypeAnnotation", ...arguments);
}
function numberTypeAnnotation() {
return (0, _builder.default)("NumberTypeAnnotation", ...arguments);
}
function objectTypeAnnotation(properties, indexers, callProperties, internalSlots, exact) {
return (0, _builder.default)("ObjectTypeAnnotation", ...arguments);
}
function objectTypeInternalSlot(id, value, optional, _static, method) {
return (0, _builder.default)("ObjectTypeInternalSlot", ...arguments);
}
function objectTypeCallProperty(value) {
return (0, _builder.default)("ObjectTypeCallProperty", ...arguments);
}
function objectTypeIndexer(id, key, value, variance) {
return (0, _builder.default)("ObjectTypeIndexer", ...arguments);
}
function objectTypeProperty(key, value, variance) {
return (0, _builder.default)("ObjectTypeProperty", ...arguments);
}
function objectTypeSpreadProperty(argument) {
return (0, _builder.default)("ObjectTypeSpreadProperty", ...arguments);
}
function opaqueType(id, typeParameters, supertype, impltype) {
return (0, _builder.default)("OpaqueType", ...arguments);
}
function qualifiedTypeIdentifier(id, qualification) {
return (0, _builder.default)("QualifiedTypeIdentifier", ...arguments);
}
function stringLiteralTypeAnnotation(value) {
return (0, _builder.default)("StringLiteralTypeAnnotation", ...arguments);
}
function stringTypeAnnotation() {
return (0, _builder.default)("StringTypeAnnotation", ...arguments);
}
function symbolTypeAnnotation() {
return (0, _builder.default)("SymbolTypeAnnotation", ...arguments);
}
function thisTypeAnnotation() {
return (0, _builder.default)("ThisTypeAnnotation", ...arguments);
}
function tupleTypeAnnotation(types) {
return (0, _builder.default)("TupleTypeAnnotation", ...arguments);
}
function typeofTypeAnnotation(argument) {
return (0, _builder.default)("TypeofTypeAnnotation", ...arguments);
}
function typeAlias(id, typeParameters, right) {
return (0, _builder.default)("TypeAlias", ...arguments);
}
function typeAnnotation(typeAnnotation) {
return (0, _builder.default)("TypeAnnotation", ...arguments);
}
function typeCastExpression(expression, typeAnnotation) {
return (0, _builder.default)("TypeCastExpression", ...arguments);
}
function typeParameter(bound, _default, variance) {
return (0, _builder.default)("TypeParameter", ...arguments);
}
function typeParameterDeclaration(params) {
return (0, _builder.default)("TypeParameterDeclaration", ...arguments);
}
function typeParameterInstantiation(params) {
return (0, _builder.default)("TypeParameterInstantiation", ...arguments);
}
function unionTypeAnnotation(types) {
return (0, _builder.default)("UnionTypeAnnotation", ...arguments);
}
function variance(kind) {
return (0, _builder.default)("Variance", ...arguments);
}
function voidTypeAnnotation() {
return (0, _builder.default)("VoidTypeAnnotation", ...arguments);
}
function enumDeclaration(id, body) {
return (0, _builder.default)("EnumDeclaration", ...arguments);
}
function enumBooleanBody(members) {
return (0, _builder.default)("EnumBooleanBody", ...arguments);
}
function enumNumberBody(members) {
return (0, _builder.default)("EnumNumberBody", ...arguments);
}
function enumStringBody(members) {
return (0, _builder.default)("EnumStringBody", ...arguments);
}
function enumSymbolBody(members) {
return (0, _builder.default)("EnumSymbolBody", ...arguments);
}
function enumBooleanMember(id) {
return (0, _builder.default)("EnumBooleanMember", ...arguments);
}
function enumNumberMember(id, init) {
return (0, _builder.default)("EnumNumberMember", ...arguments);
}
function enumStringMember(id, init) {
return (0, _builder.default)("EnumStringMember", ...arguments);
}
function enumDefaultedMember(id) {
return (0, _builder.default)("EnumDefaultedMember", ...arguments);
}
function indexedAccessType(objectType, indexType) {
return (0, _builder.default)("IndexedAccessType", ...arguments);
}
function optionalIndexedAccessType(objectType, indexType) {
return (0, _builder.default)("OptionalIndexedAccessType", ...arguments);
}
function jsxAttribute(name, value) {
return (0, _builder.default)("JSXAttribute", ...arguments);
}
function jsxClosingElement(name) {
return (0, _builder.default)("JSXClosingElement", ...arguments);
}
function jsxElement(openingElement, closingElement, children, selfClosing) {
return (0, _builder.default)("JSXElement", ...arguments);
}
function jsxEmptyExpression() {
return (0, _builder.default)("JSXEmptyExpression", ...arguments);
}
function jsxExpressionContainer(expression) {
return (0, _builder.default)("JSXExpressionContainer", ...arguments);
}
function jsxSpreadChild(expression) {
return (0, _builder.default)("JSXSpreadChild", ...arguments);
}
function jsxIdentifier(name) {
return (0, _builder.default)("JSXIdentifier", ...arguments);
}
function jsxMemberExpression(object, property) {
return (0, _builder.default)("JSXMemberExpression", ...arguments);
}
function jsxNamespacedName(namespace, name) {
return (0, _builder.default)("JSXNamespacedName", ...arguments);
}
function jsxOpeningElement(name, attributes, selfClosing) {
return (0, _builder.default)("JSXOpeningElement", ...arguments);
}
function jsxSpreadAttribute(argument) {
return (0, _builder.default)("JSXSpreadAttribute", ...arguments);
}
function jsxText(value) {
return (0, _builder.default)("JSXText", ...arguments);
}
function jsxFragment(openingFragment, closingFragment, children) {
return (0, _builder.default)("JSXFragment", ...arguments);
}
function jsxOpeningFragment() {
return (0, _builder.default)("JSXOpeningFragment", ...arguments);
}
function jsxClosingFragment() {
return (0, _builder.default)("JSXClosingFragment", ...arguments);
}
function noop() {
return (0, _builder.default)("Noop", ...arguments);
}
function placeholder(expectedNode, name) {
return (0, _builder.default)("Placeholder", ...arguments);
}
function v8IntrinsicIdentifier(name) {
return (0, _builder.default)("V8IntrinsicIdentifier", ...arguments);
}
function argumentPlaceholder() {
return (0, _builder.default)("ArgumentPlaceholder", ...arguments);
}
function bindExpression(object, callee) {
return (0, _builder.default)("BindExpression", ...arguments);
}
function importAttribute(key, value) {
return (0, _builder.default)("ImportAttribute", ...arguments);
}
function decorator(expression) {
return (0, _builder.default)("Decorator", ...arguments);
}
function doExpression(body, async) {
return (0, _builder.default)("DoExpression", ...arguments);
}
function exportDefaultSpecifier(exported) {
return (0, _builder.default)("ExportDefaultSpecifier", ...arguments);
}
function recordExpression(properties) {
return (0, _builder.default)("RecordExpression", ...arguments);
}
function tupleExpression(elements) {
return (0, _builder.default)("TupleExpression", ...arguments);
}
function decimalLiteral(value) {
return (0, _builder.default)("DecimalLiteral", ...arguments);
}
function staticBlock(body) {
return (0, _builder.default)("StaticBlock", ...arguments);
}
function moduleExpression(body) {
return (0, _builder.default)("ModuleExpression", ...arguments);
}
function topicReference() {
return (0, _builder.default)("TopicReference", ...arguments);
}
function pipelineTopicExpression(expression) {
return (0, _builder.default)("PipelineTopicExpression", ...arguments);
}
function pipelineBareFunction(callee) {
return (0, _builder.default)("PipelineBareFunction", ...arguments);
}
function pipelinePrimaryTopicReference() {
return (0, _builder.default)("PipelinePrimaryTopicReference", ...arguments);
}
function tsParameterProperty(parameter) {
return (0, _builder.default)("TSParameterProperty", ...arguments);
}
function tsDeclareFunction(id, typeParameters, params, returnType) {
return (0, _builder.default)("TSDeclareFunction", ...arguments);
}
function tsDeclareMethod(decorators, key, typeParameters, params, returnType) {
return (0, _builder.default)("TSDeclareMethod", ...arguments);
}
function tsQualifiedName(left, right) {
return (0, _builder.default)("TSQualifiedName", ...arguments);
}
function tsCallSignatureDeclaration(typeParameters, parameters, typeAnnotation) {
return (0, _builder.default)("TSCallSignatureDeclaration", ...arguments);
}
function tsConstructSignatureDeclaration(typeParameters, parameters, typeAnnotation) {
return (0, _builder.default)("TSConstructSignatureDeclaration", ...arguments);
}
function tsPropertySignature(key, typeAnnotation, initializer) {
return (0, _builder.default)("TSPropertySignature", ...arguments);
}
function tsMethodSignature(key, typeParameters, parameters, typeAnnotation) {
return (0, _builder.default)("TSMethodSignature", ...arguments);
}
function tsIndexSignature(parameters, typeAnnotation) {
return (0, _builder.default)("TSIndexSignature", ...arguments);
}
function tsAnyKeyword() {
return (0, _builder.default)("TSAnyKeyword", ...arguments);
}
function tsBooleanKeyword() {
return (0, _builder.default)("TSBooleanKeyword", ...arguments);
}
function tsBigIntKeyword() {
return (0, _builder.default)("TSBigIntKeyword", ...arguments);
}
function tsIntrinsicKeyword() {
return (0, _builder.default)("TSIntrinsicKeyword", ...arguments);
}
function tsNeverKeyword() {
return (0, _builder.default)("TSNeverKeyword", ...arguments);
}
function tsNullKeyword() {
return (0, _builder.default)("TSNullKeyword", ...arguments);
}
function tsNumberKeyword() {
return (0, _builder.default)("TSNumberKeyword", ...arguments);
}
function tsObjectKeyword() {
return (0, _builder.default)("TSObjectKeyword", ...arguments);
}
function tsStringKeyword() {
return (0, _builder.default)("TSStringKeyword", ...arguments);
}
function tsSymbolKeyword() {
return (0, _builder.default)("TSSymbolKeyword", ...arguments);
}
function tsUndefinedKeyword() {
return (0, _builder.default)("TSUndefinedKeyword", ...arguments);
}
function tsUnknownKeyword() {
return (0, _builder.default)("TSUnknownKeyword", ...arguments);
}
function tsVoidKeyword() {
return (0, _builder.default)("TSVoidKeyword", ...arguments);
}
function tsThisType() {
return (0, _builder.default)("TSThisType", ...arguments);
}
function tsFunctionType(typeParameters, parameters, typeAnnotation) {
return (0, _builder.default)("TSFunctionType", ...arguments);
}
function tsConstructorType(typeParameters, parameters, typeAnnotation) {
return (0, _builder.default)("TSConstructorType", ...arguments);
}
function tsTypeReference(typeName, typeParameters) {
return (0, _builder.default)("TSTypeReference", ...arguments);
}
function tsTypePredicate(parameterName, typeAnnotation, asserts) {
return (0, _builder.default)("TSTypePredicate", ...arguments);
}
function tsTypeQuery(exprName) {
return (0, _builder.default)("TSTypeQuery", ...arguments);
}
function tsTypeLiteral(members) {
return (0, _builder.default)("TSTypeLiteral", ...arguments);
}
function tsArrayType(elementType) {
return (0, _builder.default)("TSArrayType", ...arguments);
}
function tsTupleType(elementTypes) {
return (0, _builder.default)("TSTupleType", ...arguments);
}
function tsOptionalType(typeAnnotation) {
return (0, _builder.default)("TSOptionalType", ...arguments);
}
function tsRestType(typeAnnotation) {
return (0, _builder.default)("TSRestType", ...arguments);
}
function tsNamedTupleMember(label, elementType, optional) {
return (0, _builder.default)("TSNamedTupleMember", ...arguments);
}
function tsUnionType(types) {
return (0, _builder.default)("TSUnionType", ...arguments);
}
function tsIntersectionType(types) {
return (0, _builder.default)("TSIntersectionType", ...arguments);
}
function tsConditionalType(checkType, extendsType, trueType, falseType) {
return (0, _builder.default)("TSConditionalType", ...arguments);
}
function tsInferType(typeParameter) {
return (0, _builder.default)("TSInferType", ...arguments);
}
function tsParenthesizedType(typeAnnotation) {
return (0, _builder.default)("TSParenthesizedType", ...arguments);
}
function tsTypeOperator(typeAnnotation) {
return (0, _builder.default)("TSTypeOperator", ...arguments);
}
function tsIndexedAccessType(objectType, indexType) {
return (0, _builder.default)("TSIndexedAccessType", ...arguments);
}
function tsMappedType(typeParameter, typeAnnotation, nameType) {
return (0, _builder.default)("TSMappedType", ...arguments);
}
function tsLiteralType(literal) {
return (0, _builder.default)("TSLiteralType", ...arguments);
}
function tsExpressionWithTypeArguments(expression, typeParameters) {
return (0, _builder.default)("TSExpressionWithTypeArguments", ...arguments);
}
function tsInterfaceDeclaration(id, typeParameters, _extends, body) {
return (0, _builder.default)("TSInterfaceDeclaration", ...arguments);
}
function tsInterfaceBody(body) {
return (0, _builder.default)("TSInterfaceBody", ...arguments);
}
function tsTypeAliasDeclaration(id, typeParameters, typeAnnotation) {
return (0, _builder.default)("TSTypeAliasDeclaration", ...arguments);
}
function tsAsExpression(expression, typeAnnotation) {
return (0, _builder.default)("TSAsExpression", ...arguments);
}
function tsTypeAssertion(typeAnnotation, expression) {
return (0, _builder.default)("TSTypeAssertion", ...arguments);
}
function tsEnumDeclaration(id, members) {
return (0, _builder.default)("TSEnumDeclaration", ...arguments);
}
function tsEnumMember(id, initializer) {
return (0, _builder.default)("TSEnumMember", ...arguments);
}
function tsModuleDeclaration(id, body) {
return (0, _builder.default)("TSModuleDeclaration", ...arguments);
}
function tsModuleBlock(body) {
return (0, _builder.default)("TSModuleBlock", ...arguments);
}
function tsImportType(argument, qualifier, typeParameters) {
return (0, _builder.default)("TSImportType", ...arguments);
}
function tsImportEqualsDeclaration(id, moduleReference) {
return (0, _builder.default)("TSImportEqualsDeclaration", ...arguments);
}
function tsExternalModuleReference(expression) {
return (0, _builder.default)("TSExternalModuleReference", ...arguments);
}
function tsNonNullExpression(expression) {
return (0, _builder.default)("TSNonNullExpression", ...arguments);
}
function tsExportAssignment(expression) {
return (0, _builder.default)("TSExportAssignment", ...arguments);
}
function tsNamespaceExportDeclaration(id) {
return (0, _builder.default)("TSNamespaceExportDeclaration", ...arguments);
}
function tsTypeAnnotation(typeAnnotation) {
return (0, _builder.default)("TSTypeAnnotation", ...arguments);
}
function tsTypeParameterInstantiation(params) {
return (0, _builder.default)("TSTypeParameterInstantiation", ...arguments);
}
function tsTypeParameterDeclaration(params) {
return (0, _builder.default)("TSTypeParameterDeclaration", ...arguments);
}
function tsTypeParameter(constraint, _default, name) {
return (0, _builder.default)("TSTypeParameter", ...arguments);
}
function NumberLiteral(...args) {
console.trace("The node type NumberLiteral has been renamed to NumericLiteral");
return (0, _builder.default)("NumberLiteral", ...args);
}
function RegexLiteral(...args) {
console.trace("The node type RegexLiteral has been renamed to RegExpLiteral");
return (0, _builder.default)("RegexLiteral", ...args);
}
function RestProperty(...args) {
console.trace("The node type RestProperty has been renamed to RestElement");
return (0, _builder.default)("RestProperty", ...args);
}
function SpreadProperty(...args) {
console.trace("The node type SpreadProperty has been renamed to SpreadElement");
return (0, _builder.default)("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 = __webpack_require__(780);
__webpack_require__(600);
__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);
_toFastProperties(_utils.VISITOR_KEYS);
_toFastProperties(_utils.ALIAS_KEYS);
_toFastProperties(_utils.FLIPPED_ALIAS_KEYS);
_toFastProperties(_utils.NODE_FIELDS);
_toFastProperties(_utils.BUILDER_KEYS);
_toFastProperties(_utils.DEPRECATED_KEYS);
_toFastProperties(_placeholders.PLACEHOLDERS_ALIAS);
_toFastProperties(_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 */,
/* 568 */,
/* 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 = __webpack_require__(579);
var _validate = __webpack_require__(627);
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;
if (fns.length >= 2 && "type" in fns[0] && fns[0].type === "array" && !("each" in fns[1])) {
throw new Error(`An assertValueType("array") validator can only be followed by an assertEach(...) validator.`);
}
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];
const def = field.default;
if (Array.isArray(def) ? def.length > 0 : def && typeof def === "object") {
throw new Error("field defaults can only be primitives or empty arrays currently");
}
fields[key] = {
default: Array.isArray(def) ? [] : def,
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 _sources = __webpack_require__(687);
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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: ["classStaticBlock", "classPrivateProperties", "classPrivateMethods", "classProperties", "objectRestSpread", "optionalChaining", "privateIn", "nullishCoalescingOperator"]
},
original: {
sourceType: "unambiguous",
tokens: true,
plugins: ["jsx", "flow", "doExpressions", "optionalChaining", "nullishCoalescingOperator", "decorators-legacy", "objectRestSpread", "classStaticBlock", "classPrivateProperties", "classPrivateMethods", "classProperties", "exportDefaultFrom", "exportNamespaceFrom", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "react-jsx"]
}
};
function parse(text, opts) {
let ast = {};
if (!text) {
return ast;
}
try {
ast = _parse(text, opts);
} catch (error) {
console.error(error);
}
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: ["classStaticBlock", "classPrivateProperties", "classPrivateMethods", "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 (!ast || !Object.keys(ast).length) {
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);
var _generated = __webpack_require__(559);
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: node.type
};
if ((0, _generated.isIdentifier)(node)) {
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] = (0, _generated.isFile)(node) && 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 maybeCloneComments(comments, deep, withoutLoc) {
if (!comments || !deep) {
return comments;
}
return comments.map(({
type,
value,
loc
}) => {
if (withoutLoc) {
return {
type,
value,
loc: null
};
}
return {
type,
value,
loc
};
});
}
/***/ }),
/* 577 */,
/* 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 = __webpack_require__(612);
var _isType = __webpack_require__(626);
var _isPlaceholderType = __webpack_require__(666);
var _definitions = __webpack_require__(564);
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, true)) {
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.classMethodOrDeclareMethodCommon = exports.classMethodOrPropertyCommon = exports.patternLikeCommon = exports.functionDeclarationCommon = exports.functionTypeAnnotationCommon = exports.functionCommon = void 0;
var _is = __webpack_require__(579);
var _isValidIdentifier = __webpack_require__(580);
var _helperValidatorIdentifier = __webpack_require__(667);
var _constants = __webpack_require__(575);
var _utils = __webpack_require__(571);
(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")))
},
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, false)) && 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", ...(!Object({"NODE_ENV":"production"}).BABEL_TYPES_8_BREAKING ? ["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", "ArrayPattern", "ObjectPattern", "MemberExpression")
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
}
}),
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")
}
}
});
(0, _utils.default)("AssignmentPattern", {
visitor: ["left", "right", "decorators"],
builder: ["left", "right"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, 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({}, 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
},
optional: {
validate: (0, _utils.assertValueType)("boolean"),
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({}, functionCommon, 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")
},
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value")),
assertions: {
optional: true,
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute")))
}
}
});
(0, _utils.default)("ExportDefaultDeclaration", {
visitor: ["declaration"],
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
fields: {
declaration: {
validate: (0, _utils.assertNodeType)("FunctionDeclaration", "TSDeclareFunction", "ClassDeclaration", "Expression")
},
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("value"))
}
});
(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");
}
})
},
assertions: {
optional: true,
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute")))
},
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", "StringLiteral")
}
}
});
(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: {
assertions: {
optional: true,
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("ImportAttribute")))
},
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", "StringLiteral")
},
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
},
override: {
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({}, functionCommon, classMethodOrPropertyCommon, {
params: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty")))
},
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, functionTypeAnnotationCommon, {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
})
});
(0, _utils.default)("ObjectPattern", {
visitor: ["properties", "typeAnnotation", "decorators"],
builder: ["properties"],
aliases: ["Pattern", "PatternLike", "LVal"],
fields: Object.assign({}, 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", "typeParameters"],
builder: ["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", "TSType")), 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")
}
}
});
(0, _utils.default)("AwaitExpression", {
builder: ["argument"],
visitor: ["argument"],
aliases: ["Expression", "Terminatorless"],
fields: {
argument: {
validate: (0, _utils.assertNodeType)("Expression")
}
}
});
(0, _utils.default)("Import", {
aliases: ["Expression"]
});
(0, _utils.default)("BigIntLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("ExportNamespaceSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(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)("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", "ArgumentPlaceholder")))
},
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)("ClassProperty", {
visitor: ["key", "value", "typeAnnotation", "decorators"],
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
aliases: ["Property"],
fields: Object.assign({}, 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
},
variance: {
validate: (0, _utils.assertNodeType)("Variance"),
optional: true
}
})
});
(0, _utils.default)("ClassPrivateProperty", {
visitor: ["key", "value", "decorators", "typeAnnotation"],
builder: ["key", "value", "decorators", "static"],
aliases: ["Property", "Private"],
fields: {
key: {
validate: (0, _utils.assertNodeType)("PrivateName")
},
value: {
validate: (0, _utils.assertNodeType)("Expression"),
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
},
definite: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
variance: {
validate: (0, _utils.assertNodeType)("Variance"),
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({}, classMethodOrDeclareMethodCommon, functionTypeAnnotationCommon, {
key: {
validate: (0, _utils.assertNodeType)("PrivateName")
},
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
}
})
});
(0, _utils.default)("PrivateName", {
visitor: ["id"],
aliases: ["Private"],
fields: {
id: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
/***/ }),
/* 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) && !(0, _generated.isExportAllDeclaration)(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"],
ClassPrivateMethod: ["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(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 null;
});
}
return [];
}
/***/ }),
/* 603 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = generate;
exports.CodeGenerator = void 0;
var _sourceMap = __webpack_require__(841);
var _printer = __webpack_require__(842);
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 = void 0;
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,
indent: {
adjustMultilineComment: true,
style: " ",
base: 0
},
decoratorsBeforeExport: !!opts.decoratorsBeforeExport,
jsescOption: Object.assign({
quotes: "double",
wrap: true,
minimal: false
}, opts.jsescOption),
recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType,
topicToken: opts.topicToken
};
{
format.jsonCompatibleStrings = opts.jsonCompatibleStrings;
}
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 = void 0;
this._generator = new Generator(ast, opts, code);
}
generate() {
return this._generator.generate();
}
}
exports.CodeGenerator = CodeGenerator;
function generate(ast, opts, code) {
const gen = new Generator(ast, opts, code);
return gen.generate();
}
/***/ }),
/* 604 */,
/* 605 */,
/* 606 */,
/* 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 && 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 */,
/* 629 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inherit;
function inherit(key, child, parent) {
if (child && parent) {
child[key] = Array.from(new Set([].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 */,
/* 640 */,
/* 641 */,
/* 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(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 extractFunctionSymbol(path, state, symbols) {
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
});
}
function extractSymbol(path, symbols, state) {
if ((0, _helpers.isFunction)(path)) {
extractFunctionSymbol(path, state, symbols);
}
if (t.isJSXElement(path)) {
symbols.hasJsx = true;
}
if (t.isGenericTypeAnnotation(path)) {
symbols.hasTypes = true;
}
if (t.isClassDeclaration(path)) {
symbols.classes.push(getClassDeclarationSymbol(path.node));
}
if (t.isImportDeclaration(path)) {
symbols.imports.push(getImportDeclarationSymbol(path.node));
}
if (t.isObjectProperty(path)) {
symbols.objectProperties.push(getObjectPropertySymbol(path));
}
if (t.isMemberExpression(path) || t.isOptionalMemberExpression(path)) {
symbols.memberExpressions.push(getMemberExpressionSymbol(path));
}
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)) {
symbols.callExpressions.push(getCallExpressionSymbol(path.node));
}
symbols.identifiers.push(...getIdentifierSymbols(path));
}
function extractSymbols(sourceId) {
const symbols = {
functions: [],
callExpressions: [],
memberExpressions: [],
objectProperties: [],
comments: [],
identifiers: [],
classes: [],
imports: [],
literals: [],
hasJsx: false,
hasTypes: 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 = t.isPrivateName(node.property) ? `#${node.property.id.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;
}
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;
}
function getMemberExpressionSymbol(path) {
const {
start,
end
} = path.node.property.loc;
return {
name: t.isPrivateName(path.node.property) ? `#${path.node.property.id.name}` : path.node.property.name,
location: {
start,
end
},
expression: getSnippet(path),
computed: path.node.computed
};
}
function getImportDeclarationSymbol(node) {
return {
source: node.source.value,
location: node.loc,
specifiers: (0, _helpers.getSpecifiers)(node.specifiers)
};
}
function getObjectPropertySymbol(path) {
const {
start,
end,
identifierName
} = path.node.key.loc;
return {
name: identifierName,
location: {
start,
end
},
expression: getSnippet(path)
};
}
function getCallExpressionSymbol(node) {
const {
callee,
arguments: args
} = node;
const values = args.filter(arg => arg.value).map(arg => arg.value);
if (t.isMemberExpression(callee)) {
const {
property: {
name,
loc
}
} = callee;
return {
name,
values,
location: loc
};
}
const {
start,
end,
identifierName
} = callee.loc;
return {
name: identifierName,
values,
location: {
start,
end
}
};
}
function getClassParentName(superClass) {
return t.isMemberExpression(superClass) ? (0, _helpers.getCode)(superClass) : superClass.name;
}
function getClassParentSymbol(superClass) {
if (!superClass) {
return null;
}
return {
name: getClassParentName(superClass),
location: superClass.loc
};
}
function getClassDeclarationSymbol(node) {
const {
loc,
superClass
} = node;
return {
name: node.id.name,
parent: getClassParentSymbol(superClass),
location: loc
};
}
/**
* Get a list of identifiers that are part of the given path.
*
* @param {Object} path
* @returns {Array.} a list of identifiers
*/
function getIdentifierSymbols(path) {
if (t.isStringLiteral(path) && t.isProperty(path.parentPath)) {
const {
start,
end
} = path.node.loc;
return [{
name: path.node.value,
expression: (0, _helpers.getObjectExpressionValue)(path.parent),
location: {
start,
end
}
}];
}
const identifiers = [];
if (t.isIdentifier(path) && !t.isGenericTypeAnnotation(path.parent)) {
// 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)) {
const {
start,
end
} = path.node.loc;
return [{
name: path.node.name,
expression: (0, _helpers.getObjectExpressionValue)(path.parent),
location: {
start,
end
}
}];
}
let {
start,
end
} = path.node.loc;
if (path.node.typeAnnotation) {
const {
column
} = path.node.typeAnnotation.loc.start;
end = { ...end,
column
};
}
identifiers.push({
name: path.node.name,
expression: path.node.name,
location: {
start,
end
}
});
}
if (t.isThisExpression(path.node)) {
const {
start,
end
} = path.node.loc;
identifiers.push({
name: "this",
location: {
start,
end
},
expression: "this"
});
}
if (t.isVariableDeclarator(path)) {
const nodeId = path.node.id;
identifiers.push(...(0, _helpers.getPatternIdentifiers)(nodeId));
}
return identifiers;
}
/***/ }),
/* 649 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = buildMatchMemberExpression;
var _matchesPattern = __webpack_require__(650);
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 if ((0, _generated.isThisExpression)(node)) {
value = "this";
} 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 && 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 getQualifiedName(node) {
return (0, _generated.isIdentifier)(node) ? node.name : `${node.id.name}.${getQualifiedName(node.qualification)}`;
}
function removeTypeDuplicates(nodes) {
const generics = {};
const bases = {};
const typeGroups = new Set();
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.has(node.types)) {
nodes = nodes.concat(node.types);
typeGroups.add(node.types);
}
continue;
}
if ((0, _generated.isGenericTypeAnnotation)(node)) {
const name = getQualifiedName(node.id);
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].push(...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 = __webpack_require__(629);
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 = __webpack_require__(629);
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 = __webpack_require__(677);
var _inheritLeadingComments = __webpack_require__(675);
var _inheritInnerComments = __webpack_require__(672);
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 = __webpack_require__(629);
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 = __webpack_require__(580);
var _helperValidatorIdentifier = __webpack_require__(667);
function toIdentifier(input) {
input = input + "";
let name = "";
for (const c of input) {
name += (0, _helperValidatorIdentifier.isIdentifierChar)(c.codePointAt(0)) ? c : "-";
}
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 = __webpack_require__(681);
var _removeProperties = __webpack_require__(682);
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;
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return 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 . */
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) {
_defineProperty(this, "_index", void 0);
_defineProperty(this, "_ancestors", void 0);
_defineProperty(this, "_ancestor", void 0);
_defineProperty(this, "_parentPath", void 0);
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 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;
const skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/y;
const skipWhiteSpaceToLineBreak = new RegExp("(?=(" + skipWhiteSpaceInLine.source + "))\\1" + /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, "y");
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 = void 0;
this.column = void 0;
this.line = line;
this.column = col;
}
}
class SourceLocation {
constructor(start, end) {
this.start = void 0;
this.end = void 0;
this.filename = void 0;
this.identifierName = void 0;
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 setTrailingComments(node, comments) {
if (node.trailingComments === undefined) {
node.trailingComments = comments;
} else {
node.trailingComments.unshift(...comments);
}
}
function setInnerComments(node, comments) {
if (node.innerComments === undefined) {
node.innerComments = comments;
} else if (comments !== undefined) {
node.innerComments.unshift(...comments);
}
}
function adjustInnerComments(node, elements, commentWS) {
let lastElement = null;
let i = elements.length;
while (lastElement === null && i > 0) {
lastElement = elements[--i];
}
if (lastElement === null || lastElement.start > commentWS.start) {
setInnerComments(node, commentWS.comments);
} else {
setTrailingComments(lastElement, commentWS.comments);
}
}
class CommentsParser extends BaseParser {
addComment(comment) {
if (this.filename) comment.loc.filename = this.filename;
this.state.comments.push(comment);
}
processComment(node) {
const {
commentStack
} = this.state;
const commentStackLength = commentStack.length;
if (commentStackLength === 0) return;
let i = commentStackLength - 1;
const lastCommentWS = commentStack[i];
if (lastCommentWS.start === node.end) {
lastCommentWS.leadingNode = node;
i--;
}
const {
start: nodeStart
} = node;
for (; i >= 0; i--) {
const commentWS = commentStack[i];
const commentEnd = commentWS.end;
if (commentEnd > nodeStart) {
commentWS.containingNode = node;
this.finalizeComment(commentWS);
commentStack.splice(i, 1);
} else {
if (commentEnd === nodeStart) {
commentWS.trailingNode = node;
}
break;
}
}
}
finalizeComment(commentWS) {
const {
comments
} = commentWS;
if (commentWS.leadingNode !== null || commentWS.trailingNode !== null) {
if (commentWS.leadingNode !== null) {
setTrailingComments(commentWS.leadingNode, comments);
}
if (commentWS.trailingNode !== null) {
commentWS.trailingNode.leadingComments = comments;
}
} else {
const {
containingNode: node,
start: commentStart
} = commentWS;
if (this.input.charCodeAt(commentStart - 1) === 44) {
switch (node.type) {
case "ObjectExpression":
case "ObjectPattern":
case "RecordExpression":
adjustInnerComments(node, node.properties, commentWS);
break;
case "CallExpression":
case "OptionalCallExpression":
adjustInnerComments(node, node.arguments, commentWS);
break;
case "FunctionDeclaration":
case "FunctionExpression":
case "ArrowFunctionExpression":
case "ObjectMethod":
case "ClassMethod":
case "ClassPrivateMethod":
adjustInnerComments(node, node.params, commentWS);
break;
case "ArrayExpression":
case "ArrayPattern":
case "TupleExpression":
adjustInnerComments(node, node.elements, commentWS);
break;
case "ExportNamedDeclaration":
case "ImportDeclaration":
adjustInnerComments(node, node.specifiers, commentWS);
break;
default:
{
setInnerComments(node, comments);
}
}
} else {
setInnerComments(node, comments);
}
}
}
finalizeRemainingComments() {
const {
commentStack
} = this.state;
for (let i = commentStack.length - 1; i >= 0; i--) {
this.finalizeComment(commentStack[i]);
}
this.state.commentStack = [];
}
resetPreviousNodeTrailingComments(node) {
const {
commentStack
} = this.state;
const {
length
} = commentStack;
if (length === 0) return;
const commentWS = commentStack[length - 1];
if (commentWS.leadingNode === node) {
commentWS.leadingNode = null;
}
}
}
const ErrorCodes = Object.freeze({
SyntaxError: "BABEL_PARSER_SYNTAX_ERROR",
SourceTypeModuleError: "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED"
});
const ErrorMessages = makeErrorTemplates({
AccessorIsGenerator: "A %0ter cannot be a generator.",
ArgumentsInClass: "'arguments' is only allowed in functions and class methods.",
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.",
AwaitBindingIdentifierInStaticBlock: "Can not use 'await' as identifier inside a static block.",
AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.",
AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.",
AwaitNotInAsyncFunction: "'await' is only allowed within async functions.",
BadGetterArity: "A 'get' accesor must not have any formal parameters.",
BadSetterArity: "A 'set' accesor must have exactly one formal parameter.",
BadSetterRestParameter: "A 'set' accesor 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.",
DecoratorStaticBlock: "Decorators can't be used with a static block.",
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.",
ExportBindingIsString: "A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '%0' as '%1' } from 'some-module'`?",
ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
ForInOfLoopInitializer: "'%0' loop variable declaration may not have an initializer.",
ForOfAsync: "The left-hand side of a for-of loop may not be 'async'.",
ForOfLet: "The left-hand side of a for-of loop may not start with 'let'.",
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.",
ImportBindingIsString: 'A string literal cannot be used as an imported binding.\n- Did you mean `import { "%0" as foo }`?',
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()`.",
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
InvalidCodePoint: "Code point out of bounds.",
InvalidDecimal: "Invalid decimal.",
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.",
InvalidOrMissingExponent: "Floating-point numbers require a valid exponent after the 'e'.",
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.",
LineTerminatorBeforeArrow: "No line break is allowed before '=>'.",
MalformedRegExpFlags: "Invalid regular expression flag.",
MissingClassName: "A class name is required.",
MissingEqInAssignment: "Only '=' operator can be used for specifying default value.",
MissingSemicolon: "Missing semicolon.",
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.',
ModuleExportNameHasLoneSurrogate: "An export name cannot include a lone surrogate, found '\\u%0'.",
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.",
OverrideOnConstructor: "'override' modifier cannot appear on a constructor declaration.",
ParamDupe: "Argument name clash.",
PatternHasAccessor: "Object pattern can't contain getter or setter.",
PatternHasMethod: "Object pattern can't contain methods.",
PipeBodyIsTighter: "Unexpected %0 after pipeline body; any %0 expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
PipeTopicUnconfiguredToken: 'Invalid topic token %0. In order to use %0 as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "%0" }.',
PipeTopicUnused: "Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",
PipeUnparenthesizedBody: "Hack-style pipe body cannot be an unparenthesized %0 expression; please wrap it in parentheses.",
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: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" 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.",
StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
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 or class properties.",
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 expression is not allowed in formal parameters.",
ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0."
}, ErrorCodes.SyntaxError);
const SourceTypeModuleErrorMessages = makeErrorTemplates({
ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`,
ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: "module"'`
}, ErrorCodes.SourceTypeModuleError);
function keepReasonCodeCompat(reasonCode, syntaxPlugin) {
{
if (syntaxPlugin === "flow" && reasonCode === "PatternIsOptional") {
return "OptionalBindingPattern";
}
}
return reasonCode;
}
function makeErrorTemplates(messages, code, syntaxPlugin) {
const templates = {};
Object.keys(messages).forEach(reasonCode => {
templates[reasonCode] = Object.freeze({
code,
reasonCode: keepReasonCodeCompat(reasonCode, syntaxPlugin),
template: messages[reasonCode]
});
});
return Object.freeze(templates);
}
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, {
code,
reasonCode,
template
}, ...params) {
return this.raiseWithData(pos, {
code,
reasonCode
}, template, ...params);
}
raiseOverwrite(pos, {
code,
template
}, ...params) {
const loc = this.getLocationForPosition(pos);
const message = template.replace(/%(\d+)/g, (_, i) => params[i]) + ` (${loc.line}:${loc.column})`;
if (this.options.errorRecovery) {
const errors = this.state.errors;
for (let i = errors.length - 1; i >= 0; i--) {
const error = errors[i];
if (error.pos === pos) {
return Object.assign(error, {
message
});
} else if (error.pos < pos) {
break;
}
}
}
return this._raise({
code,
loc,
pos
}, message);
}
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;
}
}
}
var estree = (superClass => class extends superClass {
parseRegExpLiteral({
pattern,
flags
}) {
let regex = null;
try {
regex = new RegExp(pattern, flags);
} catch (e) {}
const node = this.estreeParseLiteral(regex);
node.regex = {
pattern,
flags
};
return node;
}
parseBigIntLiteral(value) {
let bigInt;
try {
bigInt = BigInt(value);
} catch (_unused) {
bigInt = null;
}
const node = this.estreeParseLiteral(bigInt);
node.bigint = String(node.value || value);
return node;
}
parseDecimalLiteral(value) {
const decimal = null;
const node = this.estreeParseLiteral(decimal);
node.decimal = String(node.value || value);
return node;
}
estreeParseLiteral(value) {
return this.parseLiteral(value, "Literal");
}
parseStringLiteral(value) {
return this.estreeParseLiteral(value);
}
parseNumericLiteral(value) {
return this.estreeParseLiteral(value);
}
parseNullLiteral() {
return this.estreeParseLiteral(null);
}
parseBooleanLiteral(value) {
return this.estreeParseLiteral(value);
}
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.extra.expressionValue;
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 (node != null && this.isObjectProperty(node)) {
this.checkDeclaration(node.value);
} else {
super.checkDeclaration(node);
}
}
getObjectOrClassMethodParams(method) {
return method.value.params;
}
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 && _stmt$expression$extr.parenthesized);
}
stmtToDirective(stmt) {
const value = stmt.expression.value;
const directive = super.stmtToDirective(stmt);
this.addExtra(directive.value, "expressionValue", value);
return directive;
}
parseBlockBody(node, ...args) {
super.parseBlockBody(node, ...args);
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);
}
parsePrivateName() {
const node = super.parsePrivateName();
if (!this.getPluginOption("estree", "classFeatures")) {
return node;
}
return this.convertPrivateNameToPrivateIdentifier(node);
}
convertPrivateNameToPrivateIdentifier(node) {
const name = super.getPrivateNameSV(node);
node = node;
delete node.id;
node.name = name;
node.type = "PrivateIdentifier";
return node;
}
isPrivateName(node) {
if (!this.getPluginOption("estree", "classFeatures")) {
return super.isPrivateName(node);
}
return node.type === "PrivateIdentifier";
}
getPrivateNameSV(node) {
if (!this.getPluginOption("estree", "classFeatures")) {
return super.getPrivateNameSV(node);
}
return node.name;
}
parseLiteral(value, type) {
const node = super.parseLiteral(value, type);
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;
if (type === "ClassPrivateMethod") {
node.computed = false;
}
type = "MethodDefinition";
return this.finishNode(node, type);
}
parseClassProperty(...args) {
const propertyNode = super.parseClassProperty(...args);
if (this.getPluginOption("estree", "classFeatures")) {
propertyNode.type = "PropertyDefinition";
}
return propertyNode;
}
parseClassPrivateProperty(...args) {
const propertyNode = super.parseClassPrivateProperty(...args);
if (this.getPluginOption("estree", "classFeatures")) {
propertyNode.type = "PropertyDefinition";
propertyNode.computed = false;
}
return propertyNode;
}
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor);
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;
}
isAssignable(node, isBinding) {
if (node != null && this.isObjectProperty(node)) {
return this.isAssignable(node.value, isBinding);
}
return super.isAssignable(node, isBinding);
}
toAssignable(node, isLHS = false) {
if (node != null && this.isObjectProperty(node)) {
this.toAssignable(node.value, isLHS);
return node;
}
return super.toAssignable(node, isLHS);
}
toAssignableObjectExpressionProp(prop, ...args) {
if (prop.kind === "get" || prop.kind === "set") {
this.raise(prop.key.start, ErrorMessages.PatternHasAccessor);
} else if (prop.method) {
this.raise(prop.key.start, ErrorMessages.PatternHasMethod);
} else {
super.toAssignableObjectExpressionProp(prop, ...args);
}
}
finishCallExpression(node, optional) {
super.finishCallExpression(node, optional);
if (node.callee.type === "Import") {
node.type = "ImportExpression";
node.source = node.arguments[0];
if (this.hasPlugin("importAssertions")) {
var _node$arguments$;
node.attributes = (_node$arguments$ = node.arguments[1]) != null ? _node$arguments$ : null;
}
delete node.arguments;
delete node.callee;
}
return node;
}
toReferencedArguments(node) {
if (node.type === "ImportExpression") {
return;
}
super.toReferencedArguments(node);
}
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(base, startPos, startLoc, noCalls, state) {
const node = super.parseSubscript(base, startPos, startLoc, noCalls, state);
if (state.optionalChainMember) {
if (node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression") {
node.type = node.type.substring(8);
}
if (state.stop) {
const chain = this.startNodeAtNode(node);
chain.expression = node;
return this.finishNode(chain, "ChainExpression");
}
} else if (node.type === "MemberExpression" || node.type === "CallExpression") {
node.optional = false;
}
return node;
}
hasPropertyAsPrivateName(node) {
if (node.type === "ChainExpression") {
node = node.expression;
}
return super.hasPropertyAsPrivateName(node);
}
isOptionalChain(node) {
return node.type === "ChainExpression";
}
isObjectProperty(node) {
return node.type === "Property" && node.kind === "init" && !node.method;
}
isObjectMethod(node) {
return node.method || node.kind === "get" || node.kind === "set";
}
});
class TokContext {
constructor(token, preserveSpace) {
this.token = void 0;
this.preserveSpace = void 0;
this.token = token;
this.preserveSpace = !!preserveSpace;
}
}
const types = {
brace: new TokContext("{"),
template: new TokContext("`", true)
};
const beforeExpr = true;
const startsExpr = true;
const isLoop = true;
const isAssign = true;
const prefix = true;
const postfix = true;
class ExportedTokenType {
constructor(label, conf = {}) {
this.label = void 0;
this.keyword = void 0;
this.beforeExpr = void 0;
this.startsExpr = void 0;
this.rightAssociative = void 0;
this.isLoop = void 0;
this.isAssign = void 0;
this.prefix = void 0;
this.postfix = void 0;
this.binop = void 0;
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$1 = new Map();
function createKeyword(name, options = {}) {
options.keyword = name;
const token = createToken(name, options);
keywords$1.set(name, token);
return token;
}
function createBinop(name, binop) {
return createToken(name, {
beforeExpr,
binop
});
}
let tokenTypeCounter = -1;
const tokenTypes = [];
const tokenLabels = [];
const tokenBinops = [];
const tokenBeforeExprs = [];
const tokenStartsExprs = [];
const tokenPrefixes = [];
function createToken(name, options = {}) {
var _options$binop, _options$beforeExpr, _options$startsExpr, _options$prefix;
++tokenTypeCounter;
tokenLabels.push(name);
tokenBinops.push((_options$binop = options.binop) != null ? _options$binop : -1);
tokenBeforeExprs.push((_options$beforeExpr = options.beforeExpr) != null ? _options$beforeExpr : false);
tokenStartsExprs.push((_options$startsExpr = options.startsExpr) != null ? _options$startsExpr : false);
tokenPrefixes.push((_options$prefix = options.prefix) != null ? _options$prefix : false);
tokenTypes.push(new ExportedTokenType(name, options));
return tokenTypeCounter;
}
const tt = {
num: createToken("num", {
startsExpr
}),
bigint: createToken("bigint", {
startsExpr
}),
decimal: createToken("decimal", {
startsExpr
}),
regexp: createToken("regexp", {
startsExpr
}),
string: createToken("string", {
startsExpr
}),
name: createToken("name", {
startsExpr
}),
privateName: createToken("#name", {
startsExpr
}),
eof: createToken("eof"),
bracketL: createToken("[", {
beforeExpr,
startsExpr
}),
bracketHashL: createToken("#[", {
beforeExpr,
startsExpr
}),
bracketBarL: createToken("[|", {
beforeExpr,
startsExpr
}),
bracketR: createToken("]"),
bracketBarR: createToken("|]"),
braceL: createToken("{", {
beforeExpr,
startsExpr
}),
braceBarL: createToken("{|", {
beforeExpr,
startsExpr
}),
braceHashL: createToken("#{", {
beforeExpr,
startsExpr
}),
braceR: createToken("}", {
beforeExpr
}),
braceBarR: createToken("|}"),
parenL: createToken("(", {
beforeExpr,
startsExpr
}),
parenR: createToken(")"),
comma: createToken(",", {
beforeExpr
}),
semi: createToken(";", {
beforeExpr
}),
colon: createToken(":", {
beforeExpr
}),
doubleColon: createToken("::", {
beforeExpr
}),
dot: createToken("."),
question: createToken("?", {
beforeExpr
}),
questionDot: createToken("?."),
arrow: createToken("=>", {
beforeExpr
}),
template: createToken("template"),
ellipsis: createToken("...", {
beforeExpr
}),
backQuote: createToken("`", {
startsExpr
}),
dollarBraceL: createToken("${", {
beforeExpr,
startsExpr
}),
at: createToken("@"),
hash: createToken("#", {
startsExpr
}),
interpreterDirective: createToken("#!..."),
eq: createToken("=", {
beforeExpr,
isAssign
}),
assign: createToken("_=", {
beforeExpr,
isAssign
}),
slashAssign: createToken("_=", {
beforeExpr,
isAssign
}),
moduloAssign: createToken("_=", {
beforeExpr,
isAssign
}),
incDec: createToken("++/--", {
prefix,
postfix,
startsExpr
}),
bang: createToken("!", {
beforeExpr,
prefix,
startsExpr
}),
tilde: createToken("~", {
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: createToken("+/-", {
beforeExpr,
binop: 9,
prefix,
startsExpr
}),
modulo: createToken("%", {
binop: 10,
startsExpr
}),
star: createToken("*", {
binop: 10
}),
slash: createBinop("/", 10),
exponent: createToken("**", {
beforeExpr,
binop: 11,
rightAssociative: true
}),
_in: createKeyword("in", {
beforeExpr,
binop: 7
}),
_instanceof: createKeyword("instanceof", {
beforeExpr,
binop: 7
}),
_break: createKeyword("break"),
_case: createKeyword("case", {
beforeExpr
}),
_catch: createKeyword("catch"),
_continue: createKeyword("continue"),
_debugger: createKeyword("debugger"),
_default: createKeyword("default", {
beforeExpr
}),
_else: createKeyword("else", {
beforeExpr
}),
_finally: createKeyword("finally"),
_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"),
_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
}),
_typeof: createKeyword("typeof", {
beforeExpr,
prefix,
startsExpr
}),
_void: createKeyword("void", {
beforeExpr,
prefix,
startsExpr
}),
_delete: createKeyword("delete", {
beforeExpr,
prefix,
startsExpr
}),
_do: createKeyword("do", {
isLoop,
beforeExpr
}),
_for: createKeyword("for", {
isLoop
}),
_while: createKeyword("while", {
isLoop
}),
jsxName: createToken("jsxName"),
jsxText: createToken("jsxText", {
beforeExpr: true
}),
jsxTagStart: createToken("jsxTagStart", {
startsExpr: true
}),
jsxTagEnd: createToken("jsxTagEnd"),
placeholder: createToken("%%", {
startsExpr: true
})
};
function tokenComesBeforeExpression(token) {
return tokenBeforeExprs[token];
}
function tokenCanStartExpression(token) {
return tokenStartsExprs[token];
}
function tokenIsAssignment(token) {
return token >= 35 && token <= 38;
}
function tokenIsLoop(token) {
return token >= 89 && token <= 91;
}
function tokenIsKeyword(token) {
return token >= 57 && token <= 91;
}
function tokenIsOperator(token) {
return token >= 42 && token <= 58;
}
function tokenIsPostfix(token) {
return token === 39;
}
function tokenIsPrefix(token) {
return tokenPrefixes[token];
}
function tokenLabelName(token) {
return tokenLabels[token];
}
function tokenOperatorPrecedence(token) {
return tokenBinops[token];
}
function tokenIsRightAssociative(token) {
return token === 56;
}
function getExportedToken(token) {
return tokenTypes[token];
}
function isTokenType(obj) {
return typeof obj === "number";
}
{
tokenTypes[16].updateContext = context => {
context.pop();
};
tokenTypes[13].updateContext = tokenTypes[15].updateContext = tokenTypes[31].updateContext = context => {
context.push(types.brace);
};
tokenTypes[30].updateContext = context => {
if (context[context.length - 1] === types.template) {
context.pop();
} else {
context.push(types.template);
}
};
tokenTypes[94].updateContext = context => {
context.push(types.j_expr, types.j_oTag);
};
}
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\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\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-\u1711\u171f-\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-\u1b4c\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-\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-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\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\u0898-\u089f\u08ca-\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\u0c3c\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\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-\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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 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, 38, 6, 186, 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, 19, 72, 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, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 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, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 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, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 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, 42719, 33, 4152, 8, 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, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 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, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 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, 357, 0, 62, 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 = 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);
}
function isIteratorStart(current, next) {
return current === 64 && next === 64;
}
const reservedWordLikeSet = new Set(["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", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield", "eval", "arguments", "enum", "await"]);
function canBeReservedWord(word) {
return reservedWordLikeSet.has(word);
}
const SCOPE_OTHER = 0b000000000,
SCOPE_PROGRAM = 0b000000001,
SCOPE_FUNCTION = 0b000000010,
SCOPE_ARROW = 0b000000100,
SCOPE_SIMPLE_CATCH = 0b000001000,
SCOPE_SUPER = 0b000010000,
SCOPE_DIRECT_SUPER = 0b000100000,
SCOPE_CLASS = 0b001000000,
SCOPE_STATIC_BLOCK = 0b010000000,
SCOPE_TS_MODULE = 0b100000000,
SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE;
const BIND_KIND_VALUE = 0b000000000001,
BIND_KIND_TYPE = 0b000000000010,
BIND_SCOPE_VAR = 0b000000000100,
BIND_SCOPE_LEXICAL = 0b000000001000,
BIND_SCOPE_FUNCTION = 0b000000010000,
BIND_FLAGS_NONE = 0b000001000000,
BIND_FLAGS_CLASS = 0b000010000000,
BIND_FLAGS_TS_ENUM = 0b000100000000,
BIND_FLAGS_TS_CONST_ENUM = 0b001000000000,
BIND_FLAGS_TS_EXPORT_ONLY = 0b010000000000,
BIND_FLAGS_FLOW_DECLARE_FN = 0b100000000000;
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,
BIND_FLOW_DECLARE_FN = BIND_FLAGS_FLOW_DECLARE_FN;
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;
class Scope {
constructor(flags) {
this.var = new Set();
this.lexical = new Set();
this.functions = new Set();
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.currentVarScopeFlags() & SCOPE_FUNCTION) > 0;
}
get allowSuper() {
return (this.currentThisScopeFlags() & SCOPE_SUPER) > 0;
}
get allowDirectSuper() {
return (this.currentThisScopeFlags() & SCOPE_DIRECT_SUPER) > 0;
}
get inClass() {
return (this.currentThisScopeFlags() & SCOPE_CLASS) > 0;
}
get inClassAndNotInNonArrowFunction() {
const flags = this.currentThisScopeFlags();
return (flags & SCOPE_CLASS) > 0 && (flags & SCOPE_FUNCTION) === 0;
}
get inStaticBlock() {
for (let i = this.scopeStack.length - 1;; i--) {
const {
flags
} = this.scopeStack[i];
if (flags & SCOPE_STATIC_BLOCK) {
return true;
}
if (flags & (SCOPE_VAR | SCOPE_CLASS)) {
return false;
}
}
}
get inNonArrowFunction() {
return (this.currentThisScopeFlags() & 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.add(name);
} else {
scope.lexical.add(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.add(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.has(name) || scope.functions.has(name) || scope.var.has(name);
}
if (bindingType & BIND_SCOPE_FUNCTION) {
return scope.lexical.has(name) || !this.treatFunctionsAsVarInScope(scope) && scope.var.has(name);
}
return scope.lexical.has(name) && !(scope.flags & SCOPE_SIMPLE_CATCH && scope.lexical.values().next().value === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.has(name);
}
checkLocalExport(id) {
const {
name
} = id;
const topLevelScope = this.scopeStack[0];
if (!topLevelScope.lexical.has(name) && !topLevelScope.var.has(name) && !topLevelScope.functions.has(name)) {
this.undefinedExports.set(name, id.start);
}
}
currentScope() {
return this.scopeStack[this.scopeStack.length - 1];
}
currentVarScopeFlags() {
for (let i = this.scopeStack.length - 1;; i--) {
const {
flags
} = this.scopeStack[i];
if (flags & SCOPE_VAR) {
return flags;
}
}
}
currentThisScopeFlags() {
for (let i = this.scopeStack.length - 1;; i--) {
const {
flags
} = this.scopeStack[i];
if (flags & (SCOPE_VAR | SCOPE_CLASS) && !(flags & SCOPE_ARROW)) {
return flags;
}
}
}
}
class FlowScope extends Scope {
constructor(...args) {
super(...args);
this.declareFunctions = new Set();
}
}
class FlowScopeHandler extends ScopeHandler {
createScope(flags) {
return new FlowScope(flags);
}
declareName(name, bindingType, pos) {
const scope = this.currentScope();
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
this.checkRedeclarationInScope(scope, name, bindingType, pos);
this.maybeExportDefined(scope, name);
scope.declareFunctions.add(name);
return;
}
super.declareName(...arguments);
}
isRedeclaredInScope(scope, name, bindingType) {
if (super.isRedeclaredInScope(...arguments)) return true;
if (bindingType & BIND_FLAGS_FLOW_DECLARE_FN) {
return !scope.declareFunctions.has(name) && (scope.lexical.has(name) || scope.functions.has(name));
}
return false;
}
checkLocalExport(id) {
if (!this.scopeStack[0].declareFunctions.has(id.name)) {
super.checkLocalExport(id);
}
}
}
class State {
constructor() {
this.strict = void 0;
this.curLine = void 0;
this.startLoc = void 0;
this.endLoc = void 0;
this.errors = [];
this.potentialArrowAt = -1;
this.noArrowAt = [];
this.noArrowParamsConversionAt = [];
this.maybeInArrowParameters = false;
this.inType = false;
this.noAnonFunctionType = false;
this.inPropertyName = false;
this.hasFlowComment = false;
this.isAmbientContext = false;
this.inAbstractClass = false;
this.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null
};
this.soloAwait = false;
this.inFSharpPipelineDirectBody = false;
this.labels = [];
this.decoratorStack = [[]];
this.comments = [];
this.commentStack = [];
this.pos = 0;
this.lineStart = 0;
this.type = 7;
this.value = null;
this.start = 0;
this.end = 0;
this.lastTokEndLoc = null;
this.lastTokStartLoc = null;
this.lastTokStart = 0;
this.lastTokEnd = 0;
this.context = [types.brace];
this.exprAllowed = true;
this.containsEsc = false;
this.strictErrors = new Map();
this.tokensLength = 0;
}
init(options) {
this.strict = options.strictMode === false ? false : options.strictMode === true ? true : 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([103, 109, 115, 105, 121, 117, 100]);
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.isLookahead = void 0;
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() {
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;
}
createLookaheadState(state) {
return {
pos: state.pos,
value: null,
type: state.type,
start: state.start,
end: state.end,
lastTokEnd: state.end,
context: [this.curContext()],
inType: state.inType
};
}
lookahead() {
const old = this.state;
this.state = this.createLookaheadState(old);
this.isLookahead = true;
this.nextToken();
this.isLookahead = false;
const curr = this.state;
this.state = old;
return curr;
}
nextTokenStart() {
return this.nextTokenStartSince(this.state.pos);
}
nextTokenStartSince(pos) {
skipWhiteSpace.lastIndex = pos;
return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos;
}
lookaheadCharCode() {
return this.input.charCodeAt(this.nextTokenStart());
}
codePointAtPos(pos) {
let cp = this.input.charCodeAt(pos);
if ((cp & 0xfc00) === 0xd800 && ++pos < this.input.length) {
const trail = this.input.charCodeAt(pos);
if ((trail & 0xfc00) === 0xdc00) {
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
}
}
return cp;
}
setStrict(strict) {
this.state.strict = strict;
if (strict) {
this.state.strictErrors.forEach((message, pos) => this.raise(pos, message));
this.state.strictErrors.clear();
}
}
curContext() {
return this.state.context[this.state.context.length - 1];
}
nextToken() {
const curContext = this.curContext();
if (!curContext.preserveSpace) this.skipSpace();
this.state.start = this.state.pos;
if (!this.isLookahead) this.state.startLoc = this.state.curPosition();
if (this.state.pos >= this.length) {
this.finishToken(7);
return;
}
if (curContext === types.template) {
this.readTmplToken();
} else {
this.getTokenFromCode(this.codePointAtPos(this.state.pos));
}
}
skipBlockComment() {
let startLoc;
if (!this.isLookahead) startLoc = this.state.curPosition();
const start = this.state.pos;
const end = this.input.indexOf("*/", start + 2);
if (end === -1) throw this.raise(start, ErrorMessages.UnterminatedComment);
this.state.pos = end + 2;
lineBreakG.lastIndex = start + 2;
while (lineBreakG.test(this.input) && lineBreakG.lastIndex <= end) {
++this.state.curLine;
this.state.lineStart = lineBreakG.lastIndex;
}
if (this.isLookahead) return;
const comment = {
type: "CommentBlock",
value: this.input.slice(start + 2, end),
start,
end: end + 2,
loc: new SourceLocation(startLoc, this.state.curPosition())
};
if (this.options.tokens) this.pushToken(comment);
return comment;
}
skipLineComment(startSkip) {
const start = this.state.pos;
let startLoc;
if (!this.isLookahead) 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;
const end = this.state.pos;
const value = this.input.slice(start + startSkip, end);
const comment = {
type: "CommentLine",
value,
start,
end,
loc: new SourceLocation(startLoc, this.state.curPosition())
};
if (this.options.tokens) this.pushToken(comment);
return comment;
}
skipSpace() {
const spaceStart = this.state.pos;
const comments = [];
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:
{
const comment = this.skipBlockComment();
if (comment !== undefined) {
this.addComment(comment);
if (this.options.attachComment) comments.push(comment);
}
break;
}
case 47:
{
const comment = this.skipLineComment(2);
if (comment !== undefined) {
this.addComment(comment);
if (this.options.attachComment) comments.push(comment);
}
break;
}
default:
break loop;
}
break;
default:
if (isWhitespace(ch)) {
++this.state.pos;
} else if (ch === 45 && !this.inModule) {
const pos = this.state.pos;
if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) {
const comment = this.skipLineComment(3);
if (comment !== undefined) {
this.addComment(comment);
if (this.options.attachComment) comments.push(comment);
}
} else {
break loop;
}
} else if (ch === 60 && !this.inModule) {
const pos = this.state.pos;
if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) {
const comment = this.skipLineComment(4);
if (comment !== undefined) {
this.addComment(comment);
if (this.options.attachComment) comments.push(comment);
}
} else {
break loop;
}
} else {
break loop;
}
}
}
if (comments.length > 0) {
const end = this.state.pos;
const CommentWhitespace = {
start: spaceStart,
end,
comments,
leadingNode: null,
trailingNode: null,
containingNode: null
};
this.state.commentStack.push(CommentWhitespace);
}
}
finishToken(type, val) {
this.state.end = this.state.pos;
const prevType = this.state.type;
this.state.type = type;
this.state.value = val;
if (!this.isLookahead) {
this.state.endLoc = this.state.curPosition();
this.updateContext(prevType);
}
}
readToken_numberSign() {
if (this.state.pos === 0 && this.readToken_interpreter()) {
return;
}
const nextPos = this.state.pos + 1;
const next = this.codePointAtPos(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);
}
this.state.pos += 2;
if (next === 123) {
this.finishToken(15);
} else {
this.finishToken(9);
}
} else if (isIdentifierStart(next)) {
++this.state.pos;
this.finishToken(6, this.readWord1(next));
} else if (next === 92) {
++this.state.pos;
this.finishToken(6, this.readWord1());
} else {
this.finishOp(33, 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(29);
} else {
++this.state.pos;
this.finishToken(24);
}
}
readToken_slash() {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
this.finishOp(37, 2);
} else {
this.finishOp(55, 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(34, value);
return true;
}
readToken_mult_modulo(code) {
let type = code === 42 ? 54 : 53;
let width = 1;
let next = this.input.charCodeAt(this.state.pos + 1);
if (code === 42 && next === 42) {
width++;
next = this.input.charCodeAt(this.state.pos + 2);
type = 56;
}
if (next === 61 && !this.state.inType) {
width++;
type = code === 37 ? 38 : 36;
}
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(36, 3);
} else {
this.finishOp(code === 124 ? 44 : 45, 2);
}
return;
}
if (code === 124) {
if (next === 62) {
this.finishOp(42, 2);
return;
}
if (this.hasPlugin("recordAndTuple") && next === 125) {
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(this.state.pos, ErrorMessages.RecordExpressionBarIncorrectEndSyntaxType);
}
this.state.pos += 2;
this.finishToken(17);
return;
}
if (this.hasPlugin("recordAndTuple") && next === 93) {
if (this.getPluginOption("recordAndTuple", "syntaxType") !== "bar") {
throw this.raise(this.state.pos, ErrorMessages.TupleExpressionBarIncorrectEndSyntaxType);
}
this.state.pos += 2;
this.finishToken(12);
return;
}
}
if (next === 61) {
this.finishOp(36, 2);
return;
}
this.finishOp(code === 124 ? 46 : 48, 1);
}
readToken_caret() {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
this.finishOp(36, 2);
} else {
this.finishOp(47, 1);
}
}
readToken_plus_min(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === code) {
this.finishOp(39, 2);
return;
}
if (next === 61) {
this.finishOp(36, 2);
} else {
this.finishOp(52, 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(36, size + 1);
return;
}
this.finishOp(51, size);
return;
}
if (next === 61) {
size = 2;
}
this.finishOp(50, size);
}
readToken_eq_excl(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (next === 61) {
this.finishOp(49, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
return;
}
if (code === 61 && next === 62) {
this.state.pos += 2;
this.finishToken(27);
return;
}
this.finishOp(code === 61 ? 35 : 40, 1);
}
readToken_question() {
const next = this.input.charCodeAt(this.state.pos + 1);
const next2 = this.input.charCodeAt(this.state.pos + 2);
if (next === 63) {
if (next2 === 61) {
this.finishOp(36, 3);
} else {
this.finishOp(43, 2);
}
} else if (next === 46 && !(next2 >= 48 && next2 <= 57)) {
this.state.pos += 2;
this.finishToken(26);
} else {
++this.state.pos;
this.finishToken(25);
}
}
getTokenFromCode(code) {
switch (code) {
case 46:
this.readToken_dot();
return;
case 40:
++this.state.pos;
this.finishToken(18);
return;
case 41:
++this.state.pos;
this.finishToken(19);
return;
case 59:
++this.state.pos;
this.finishToken(21);
return;
case 44:
++this.state.pos;
this.finishToken(20);
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.state.pos += 2;
this.finishToken(10);
} else {
++this.state.pos;
this.finishToken(8);
}
return;
case 93:
++this.state.pos;
this.finishToken(11);
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.state.pos += 2;
this.finishToken(14);
} else {
++this.state.pos;
this.finishToken(13);
}
return;
case 125:
++this.state.pos;
this.finishToken(16);
return;
case 58:
if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
this.finishOp(23, 2);
} else {
++this.state.pos;
this.finishToken(22);
}
return;
case 63:
this.readToken_question();
return;
case 96:
++this.state.pos;
this.finishToken(30);
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(41, 1);
return;
case 64:
++this.state.pos;
this.finishToken(32);
return;
case 35:
this.readToken_numberSign();
return;
case 92:
this.readWord();
return;
default:
if (isIdentifierStart(code)) {
this.readWord(code);
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.start + 1;
let escaped, inClass;
let {
pos
} = this.state;
for (;; ++pos) {
if (pos >= this.length) {
throw this.raise(start, ErrorMessages.UnterminatedRegExp);
}
const ch = this.input.charCodeAt(pos);
if (isNewLine(ch)) {
throw this.raise(start, ErrorMessages.UnterminatedRegExp);
}
if (escaped) {
escaped = false;
} else {
if (ch === 91) {
inClass = true;
} else if (ch === 93 && inClass) {
inClass = false;
} else if (ch === 47 && !inClass) {
break;
}
escaped = ch === 92;
}
}
const content = this.input.slice(start, pos);
++pos;
let mods = "";
while (pos < this.length) {
const cp = this.codePointAtPos(pos);
const char = String.fromCharCode(cp);
if (VALID_REGEX_FLAGS.has(cp)) {
if (mods.includes(char)) {
this.raise(pos + 1, ErrorMessages.DuplicateRegExpFlags);
}
} else if (isIdentifierChar(cp) || cp === 92) {
this.raise(pos + 1, ErrorMessages.MalformedRegExpFlags);
} else {
break;
}
++pos;
mods += char;
}
this.state.pos = pos;
this.finishToken(3, {
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 (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 === 110) {
++this.state.pos;
isBigInt = true;
} else if (next === 109) {
throw this.raise(start, ErrorMessages.InvalidDecimal);
}
if (isIdentifierStart(this.codePointAtPos(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(1, str);
return;
}
this.finishToken(0, val);
}
readNumber(startsWithDot) {
const start = this.state.pos;
let isFloat = false;
let isBigInt = false;
let isDecimal = false;
let hasExponent = false;
let isOctal = false;
if (!startsWithDot && this.readInt(10) === null) {
this.raise(start, ErrorMessages.InvalidNumber);
}
const hasLeadingZero = this.state.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (hasLeadingZero) {
const integer = this.input.slice(start, this.state.pos);
this.recordStrictModeErrors(start, ErrorMessages.StrictOctalLiteral);
if (!this.state.strict) {
const underscorePos = integer.indexOf("_");
if (underscorePos > 0) {
this.raise(underscorePos + start, ErrorMessages.ZeroDigitNumericSeparator);
}
}
isOctal = hasLeadingZero && !/[89]/.test(integer);
}
let next = this.input.charCodeAt(this.state.pos);
if (next === 46 && !isOctal) {
++this.state.pos;
this.readInt(10);
isFloat = true;
next = this.input.charCodeAt(this.state.pos);
}
if ((next === 69 || next === 101) && !isOctal) {
next = this.input.charCodeAt(++this.state.pos);
if (next === 43 || next === 45) {
++this.state.pos;
}
if (this.readInt(10) === null) {
this.raise(start, ErrorMessages.InvalidOrMissingExponent);
}
isFloat = true;
hasExponent = true;
next = this.input.charCodeAt(this.state.pos);
}
if (next === 110) {
if (isFloat || hasLeadingZero) {
this.raise(start, ErrorMessages.InvalidBigIntLiteral);
}
++this.state.pos;
isBigInt = true;
}
if (next === 109) {
this.expectPlugin("decimal", this.state.pos);
if (hasExponent || hasLeadingZero) {
this.raise(start, ErrorMessages.InvalidDecimal);
}
++this.state.pos;
isDecimal = true;
}
if (isIdentifierStart(this.codePointAtPos(this.state.pos))) {
throw this.raise(this.state.pos, ErrorMessages.NumberIdentifier);
}
const str = this.input.slice(start, this.state.pos).replace(/[_mn]/g, "");
if (isBigInt) {
this.finishToken(1, str);
return;
}
if (isDecimal) {
this.finishToken(2, str);
return;
}
const val = isOctal ? parseInt(str, 8) : parseFloat(str);
this.finishToken(0, 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(4, 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(28)) {
if (ch === 36) {
this.state.pos += 2;
this.finishToken(31);
return;
} else {
++this.state.pos;
this.finishToken(30);
return;
}
}
out += this.input.slice(chunkStart, this.state.pos);
this.finishToken(28, 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;
}
}
}
recordStrictModeErrors(pos, message) {
if (this.state.strict && !this.state.strictErrors.has(pos)) {
this.raise(pos, message);
} else {
this.state.strictErrors.set(pos, message);
}
}
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;
} else {
this.recordStrictModeErrors(this.state.pos - 1, ErrorMessages.StrictNumericEscape);
}
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 {
this.recordStrictModeErrors(codePos, ErrorMessages.StrictNumericEscape);
}
}
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(firstCode) {
this.state.containsEsc = false;
let word = "";
const start = this.state.pos;
let chunkStart = this.state.pos;
if (firstCode !== undefined) {
this.state.pos += firstCode <= 0xffff ? 1 : 2;
}
while (this.state.pos < this.length) {
const ch = this.codePointAtPos(this.state.pos);
if (isIdentifierChar(ch)) {
this.state.pos += ch <= 0xffff ? 1 : 2;
} 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);
chunkStart = this.state.pos - 1;
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);
}
readWord(firstCode) {
const word = this.readWord1(firstCode);
const type = keywords$1.get(word) || 5;
this.finishToken(type, word);
}
checkKeywordEscapes() {
const {
type
} = this.state;
if (tokenIsKeyword(type) && this.state.containsEsc) {
this.raise(this.state.start, ErrorMessages.InvalidEscapedReservedWord, tokenLabelName(type));
}
}
updateContext(prevType) {
const {
context,
type
} = this.state;
switch (type) {
case 16:
context.pop();
break;
case 13:
case 15:
case 31:
context.push(types.brace);
break;
case 30:
if (context[context.length - 1] === types.template) {
context.pop();
} else {
context.push(types.template);
}
break;
}
}
}
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 (const [name, pos] of Array.from(oldClassScope.undefinedPrivateNames)) {
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 (classScope of this.stack) {
if (classScope.privateNames.has(name)) return;
}
if (classScope) {
classScope.undefinedPrivateNames.set(name, pos);
} else {
this.raise(pos, ErrorMessages.InvalidPrivateFieldResolution, name);
}
}
}
const kExpression = 0,
kMaybeArrowParameterDeclaration = 1,
kMaybeAsyncArrowParameterDeclaration = 2,
kParameterDeclaration = 3;
class ExpressionScope {
constructor(type = kExpression) {
this.type = void 0;
this.type = type;
}
canBeArrowParameterDeclaration() {
return this.type === kMaybeAsyncArrowParameterDeclaration || this.type === kMaybeArrowParameterDeclaration;
}
isCertainlyParameterDeclaration() {
return this.type === kParameterDeclaration;
}
}
class ArrowHeadParsingScope extends ExpressionScope {
constructor(type) {
super(type);
this.errors = new Map();
}
recordDeclarationError(pos, template) {
this.errors.set(pos, template);
}
clearDeclarationError(pos) {
this.errors.delete(pos);
}
iterateErrors(iterator) {
this.errors.forEach(iterator);
}
}
class ExpressionScopeHandler {
constructor(raise) {
this.stack = [new ExpressionScope()];
this.raise = raise;
}
enter(scope) {
this.stack.push(scope);
}
exit() {
this.stack.pop();
}
recordParameterInitializerError(pos, template) {
const {
stack
} = this;
let i = stack.length - 1;
let scope = stack[i];
while (!scope.isCertainlyParameterDeclaration()) {
if (scope.canBeArrowParameterDeclaration()) {
scope.recordDeclarationError(pos, template);
} else {
return;
}
scope = stack[--i];
}
this.raise(pos, template);
}
recordParenthesizedIdentifierError(pos, template) {
const {
stack
} = this;
const scope = stack[stack.length - 1];
if (scope.isCertainlyParameterDeclaration()) {
this.raise(pos, template);
} else if (scope.canBeArrowParameterDeclaration()) {
scope.recordDeclarationError(pos, template);
} else {
return;
}
}
recordAsyncArrowParametersError(pos, template) {
const {
stack
} = this;
let i = stack.length - 1;
let scope = stack[i];
while (scope.canBeArrowParameterDeclaration()) {
if (scope.type === kMaybeAsyncArrowParameterDeclaration) {
scope.recordDeclarationError(pos, template);
}
scope = stack[--i];
}
}
validateAsPattern() {
const {
stack
} = this;
const currentScope = stack[stack.length - 1];
if (!currentScope.canBeArrowParameterDeclaration()) return;
currentScope.iterateErrors((template, pos) => {
this.raise(pos, template);
let i = stack.length - 2;
let scope = stack[i];
while (scope.canBeArrowParameterDeclaration()) {
scope.clearDeclarationError(pos);
scope = stack[--i];
}
});
}
}
function newParameterDeclarationScope() {
return new ExpressionScope(kParameterDeclaration);
}
function newArrowHeadScope() {
return new ArrowHeadParsingScope(kMaybeArrowParameterDeclaration);
}
function newAsyncArrowScope() {
return new ArrowHeadParsingScope(kMaybeAsyncArrowParameterDeclaration);
}
function newExpressionScope() {
return new ExpressionScope();
}
const PARAM = 0b0000,
PARAM_YIELD = 0b0001,
PARAM_AWAIT = 0b0010,
PARAM_RETURN = 0b0100,
PARAM_IN = 0b1000;
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;
}
get hasIn() {
return (this.currentFlags() & PARAM_IN) > 0;
}
}
function functionFlags(isAsync, isGenerator) {
return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);
}
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(50) && this.state.value === op;
}
expectRelational(op) {
if (this.isRelational(op)) {
this.next();
} else {
this.unexpected(null, 50);
}
}
isContextual(name) {
return this.match(5) && this.state.value === name && !this.state.containsEsc;
}
isUnparsedContextual(nameStart, name) {
const nameEnd = nameStart + name.length;
if (this.input.slice(nameStart, nameEnd) === name) {
const nextCh = this.input.charCodeAt(nameEnd);
return !(isIdentifierChar(nextCh) || (nextCh & 0xfc00) === 0xd800);
}
return false;
}
isLookaheadContextual(name) {
const next = this.nextTokenStart();
return this.isUnparsedContextual(next, name);
}
eatContextual(name) {
return this.isContextual(name) && this.eat(5);
}
expectContextual(name, template) {
if (!this.eatContextual(name)) this.unexpected(null, template);
}
canInsertSemicolon() {
return this.match(7) || this.match(16) || this.hasPrecedingLineBreak();
}
hasPrecedingLineBreak() {
return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
}
hasFollowingLineBreak() {
skipWhiteSpaceToLineBreak.lastIndex = this.state.end;
return skipWhiteSpaceToLineBreak.test(this.input);
}
isLineTerminator() {
return this.eat(21) || this.canInsertSemicolon();
}
semicolon(allowAsi = true) {
if (allowAsi ? this.isLineTerminator() : this.eat(21)) return;
this.raise(this.state.lastTokEnd, ErrorMessages.MissingSemicolon);
}
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, {
code: ErrorCodes.SyntaxError,
reasonCode: "UnexpectedSpace",
template: message
});
}
}
unexpected(pos, messageOrType = {
code: ErrorCodes.SyntaxError,
reasonCode: "UnexpectedToken",
template: "Unexpected token"
}) {
if (isTokenType(messageOrType)) {
messageOrType = {
code: ErrorCodes.SyntaxError,
reasonCode: "UnexpectedToken",
template: `Unexpected token, expected "${tokenLabelName(messageOrType)}"`
};
}
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(", ")}'`);
}
}
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;
this.state.tokensLength = failState.tokensLength;
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,
optionalParameters
} = refExpressionErrors;
if (!andThrow) {
return shorthandAssign >= 0 || doubleProto >= 0 || optionalParameters >= 0;
}
if (shorthandAssign >= 0) {
this.unexpected(shorthandAssign);
}
if (doubleProto >= 0) {
this.raise(doubleProto, ErrorMessages.DuplicateProto);
}
if (optionalParameters >= 0) {
this.unexpected(optionalParameters);
}
}
isLiteralPropertyName() {
return this.match(5) || tokenIsKeyword(this.state.type) || this.match(4) || this.match(0) || this.match(1) || this.match(2);
}
isPrivateName(node) {
return node.type === "PrivateName";
}
getPrivateNameSV(node) {
return node.id.name;
}
hasPropertyAsPrivateName(node) {
return (node.type === "MemberExpression" || node.type === "OptionalMemberExpression") && this.isPrivateName(node.property);
}
isOptionalChain(node) {
return node.type === "OptionalMemberExpression" || node.type === "OptionalCallExpression";
}
isObjectProperty(node) {
return node.type === "ObjectProperty";
}
isObjectMethod(node) {
return node.type === "ObjectMethod";
}
initializeScopes(inModule = this.options.sourceType === "module") {
const oldLabels = this.state.labels;
this.state.labels = [];
const oldExportedIdentifiers = this.exportedIdentifiers;
this.exportedIdentifiers = new Set();
const oldInModule = this.inModule;
this.inModule = inModule;
const oldScope = this.scope;
const ScopeHandler = this.getScopeHandler();
this.scope = new ScopeHandler(this.raise.bind(this), this.inModule);
const oldProdParam = this.prodParam;
this.prodParam = new ProductionParameterHandler();
const oldClassScope = this.classScope;
this.classScope = new ClassScopeHandler(this.raise.bind(this));
const oldExpressionScope = this.expressionScope;
this.expressionScope = new ExpressionScopeHandler(this.raise.bind(this));
return () => {
this.state.labels = oldLabels;
this.exportedIdentifiers = oldExportedIdentifiers;
this.inModule = oldInModule;
this.scope = oldScope;
this.prodParam = oldProdParam;
this.classScope = oldClassScope;
this.expressionScope = oldExpressionScope;
};
}
enterInitialScopes() {
let paramFlags = PARAM;
if (this.inModule) {
paramFlags |= PARAM_AWAIT;
}
this.scope.enter(SCOPE_PROGRAM);
this.prodParam.enter(paramFlags);
}
}
class ExpressionErrors {
constructor() {
this.shorthandAssign = -1;
this.doubleProto = -1;
this.optionalParameters = -1;
}
}
class Node {
constructor(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
this.loc = new SourceLocation(loc);
if (parser != null && parser.options.ranges) this.range = [pos, 0];
if (parser != null && parser.filename) this.loc.filename = parser.filename;
}
}
const NodePrototype = Node.prototype;
{
NodePrototype.__clone = function () {
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;
};
}
function clonePlaceholder(node) {
return cloneIdentifier(node);
}
function cloneIdentifier(node) {
const {
type,
start,
end,
loc,
range,
extra,
name
} = node;
const cloned = Object.create(NodePrototype);
cloned.type = type;
cloned.start = start;
cloned.end = end;
cloned.loc = loc;
cloned.range = range;
cloned.extra = extra;
cloned.name = name;
if (type === "Placeholder") {
cloned.expectedNode = node.expectedNode;
}
return cloned;
}
function cloneStringLiteral(node) {
const {
type,
start,
end,
loc,
range,
extra
} = node;
if (type === "Placeholder") {
return clonePlaceholder(node);
}
const cloned = Object.create(NodePrototype);
cloned.type = "StringLiteral";
cloned.start = start;
cloned.end = end;
cloned.loc = loc;
cloned.range = range;
cloned.extra = extra;
cloned.value = node.value;
return cloned;
}
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;
if (this.options.attachComment) 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 reservedTypes = new Set(["_", "any", "bool", "boolean", "empty", "extends", "false", "interface", "mixed", "null", "number", "static", "string", "true", "typeof", "void"]);
const FlowErrors = makeErrorTemplates({
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`.",
GetterMayNotHaveThisParam: "A getter cannot have a `this` parameter.",
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.",
PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
SetterMayNotHaveThisParam: "A setter cannot have a `this` parameter.",
SpreadVariance: "Spread properties cannot have variance.",
ThisParamAnnotationRequired: "A type annotation is required for the `this` parameter.",
ThisParamBannedInConstructor: "Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",
ThisParamMayNotBeOptional: "The `this` parameter cannot be optional.",
ThisParamMustBeFirst: "The `this` parameter must be the first function parameter.",
ThisParamNoDefault: "The `this` parameter may not have a default value.",
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.",
UnexpectedTypeParameterBeforeAsyncArrowFunction: "Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.",
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."
}, ErrorCodes.SyntaxError, "flow");
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 === 5 || tokenIsKeyword(state.type)) && 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(...args) {
super(...args);
this.flowPragma = undefined;
}
getScopeHandler() {
return FlowScopeHandler;
}
shouldParseTypes() {
return this.getPluginOption("flow", "all") || this.flowPragma === "flow";
}
shouldParseEnums() {
return !!this.getPluginOption("flow", "enums");
}
finishToken(type, val) {
if (type !== 4 && type !== 21 && type !== 34) {
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 || 22);
const type = this.flowParseType();
this.state.inType = oldInType;
return type;
}
flowParsePredicate() {
const node = this.startNode();
const moduloPos = this.state.start;
this.next();
this.expectContextual("checks");
if (this.state.lastTokStart > moduloPos + 1) {
this.raise(moduloPos, FlowErrors.UnexpectedSpaceBetweenModuloChecks);
}
if (this.eat(18)) {
node.value = this.parseExpression();
this.expect(19);
return this.finishNode(node, "DeclaredPredicate");
} else {
return this.finishNode(node, "InferredPredicate");
}
}
flowParseTypeAndPredicateInitialiser() {
const oldInType = this.state.inType;
this.state.inType = true;
this.expect(22);
let type = null;
let predicate = null;
if (this.match(53)) {
this.state.inType = oldInType;
predicate = this.flowParsePredicate();
} else {
type = this.flowParseType();
this.state.inType = oldInType;
if (this.match(53)) {
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(18);
const tmp = this.flowParseFunctionTypeParams();
typeNode.params = tmp.params;
typeNode.rest = tmp.rest;
typeNode.this = tmp._this;
this.expect(19);
[typeNode.returnType, node.predicate] = this.flowParseTypeAndPredicateInitialiser();
typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
this.resetEndLocation(id);
this.semicolon();
this.scope.declareName(node.id.name, BIND_FLOW_DECLARE_FN, node.id.start);
return this.finishNode(node, "DeclareFunction");
}
flowParseDeclare(node, insideModule) {
if (this.match(79)) {
return this.flowParseDeclareClass(node);
} else if (this.match(67)) {
return this.flowParseDeclareFunction(node);
} else if (this.match(73)) {
return this.flowParseDeclareVariable(node);
} else if (this.eatContextual("module")) {
if (this.match(24)) {
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(81)) {
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(4)) {
node.id = this.parseExprAtom();
} else {
node.id = this.parseIdentifier();
}
const bodyNode = node.body = this.startNode();
const body = bodyNode.body = [];
this.expect(13);
while (!this.match(16)) {
let bodyNode = this.startNode();
if (this.match(82)) {
this.next();
if (!this.isContextual("type") && !this.match(86)) {
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(16);
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(81);
if (this.eat(64)) {
if (this.match(67) || this.match(79)) {
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(74) || 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(73) || this.match(67) || this.match(79) || this.isContextual("opaque")) {
node.declaration = this.flowParseDeclare(this.startNode());
node.default = false;
return this.finishNode(node, "DeclareExportDeclaration");
} else if (this.match(54) || this.match(13) || 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(80)) {
do {
node.extends.push(this.flowParseInterfaceExtends());
} while (!isClass && this.eat(20));
}
if (this.isContextual("mixins")) {
this.next();
do {
node.mixins.push(this.flowParseInterfaceExtends());
} while (this.eat(20));
}
if (this.isContextual("implements")) {
this.next();
do {
node.implements.push(this.flowParseInterfaceExtends());
} while (this.eat(20));
}
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(35);
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(22)) {
node.supertype = this.flowParseTypeInitialiser(22);
}
node.impltype = null;
if (!declare) {
node.impltype = this.flowParseTypeInitialiser(35);
}
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(35)) {
this.eat(35);
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(94)) {
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(20);
}
} 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(20);
}
}
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(20);
}
}
this.expectRelational(">");
this.state.inType = oldInType;
return this.finishNode(node, "TypeParameterInstantiation");
}
flowParseInterfaceType() {
const node = this.startNode();
this.expectContextual("interface");
node.extends = [];
if (this.eat(80)) {
do {
node.extends.push(this.flowParseInterfaceExtends());
} while (this.eat(20));
}
node.body = this.flowParseObjectType({
allowStatic: false,
allowExact: false,
allowSpread: false,
allowProto: false,
allowInexact: false
});
return this.finishNode(node, "InterfaceTypeAnnotation");
}
flowParseObjectPropertyKey() {
return this.match(0) || this.match(4) ? this.parseExprAtom() : this.parseIdentifier(true);
}
flowParseObjectTypeIndexer(node, isStatic, variance) {
node.static = isStatic;
if (this.lookahead().type === 22) {
node.id = this.flowParseObjectPropertyKey();
node.key = this.flowParseTypeInitialiser();
} else {
node.id = null;
node.key = this.flowParseType();
}
this.expect(11);
node.value = this.flowParseTypeInitialiser();
node.variance = variance;
return this.finishNode(node, "ObjectTypeIndexer");
}
flowParseObjectTypeInternalSlot(node, isStatic) {
node.static = isStatic;
node.id = this.flowParseObjectPropertyKey();
this.expect(11);
this.expect(11);
if (this.isRelational("<") || this.match(18)) {
node.method = true;
node.optional = false;
node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(node.start, node.loc.start));
} else {
node.method = false;
if (this.eat(25)) {
node.optional = true;
}
node.value = this.flowParseTypeInitialiser();
}
return this.finishNode(node, "ObjectTypeInternalSlot");
}
flowParseObjectTypeMethodish(node) {
node.params = [];
node.rest = null;
node.typeParameters = null;
node.this = null;
if (this.isRelational("<")) {
node.typeParameters = this.flowParseTypeParameterDeclaration();
}
this.expect(18);
if (this.match(77)) {
node.this = this.flowParseFunctionTypeParam(true);
node.this.name = null;
if (!this.match(19)) {
this.expect(20);
}
}
while (!this.match(19) && !this.match(29)) {
node.params.push(this.flowParseFunctionTypeParam(false));
if (!this.match(19)) {
this.expect(20);
}
}
if (this.eat(29)) {
node.rest = this.flowParseFunctionTypeParam(false);
}
this.expect(19);
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(14)) {
this.expect(14);
endDelim = 17;
exact = true;
} else {
this.expect(13);
endDelim = 16;
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 !== 22 && lookahead.type !== 25) {
this.next();
protoStart = this.state.start;
allowStatic = false;
}
}
if (allowStatic && this.isContextual("static")) {
const lookahead = this.lookahead();
if (lookahead.type !== 22 && lookahead.type !== 25) {
this.next();
isStatic = true;
}
}
const variance = this.flowParseVariance();
if (this.eat(8)) {
if (protoStart != null) {
this.unexpected(protoStart);
}
if (this.eat(8)) {
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(18) || 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 === 5 || lookahead.type === 4 || lookahead.type === 0) {
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(16) && !this.match(17)) {
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(29)) {
const isInexactToken = this.match(20) || this.match(21) || this.match(16) || this.match(17);
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(18)) {
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);
}
if (!allowSpread && node.key.name === "constructor" && node.value.this) {
this.raise(node.value.this.start, FlowErrors.ThisParamBannedInConstructor);
}
} else {
if (kind !== "init") this.unexpected();
node.method = false;
if (this.eat(25)) {
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 (property.value.this) {
this.raise(property.value.this.start, property.kind === "get" ? FlowErrors.GetterMayNotHaveThisParam : FlowErrors.SetterMayNotHaveThisParam);
}
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(21) && !this.eat(20) && !this.match(16) && !this.match(17)) {
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(24)) {
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(86);
node.argument = this.flowParsePrimaryType();
return this.finishNode(node, "TypeofTypeAnnotation");
}
flowParseTupleType() {
const node = this.startNode();
node.types = [];
this.expect(8);
while (this.state.pos < this.length && !this.match(11)) {
node.types.push(this.flowParseType());
if (this.match(11)) break;
this.expect(20);
}
this.expect(11);
return this.finishNode(node, "TupleTypeAnnotation");
}
flowParseFunctionTypeParam(first) {
let name = null;
let optional = false;
let typeAnnotation = null;
const node = this.startNode();
const lh = this.lookahead();
const isThis = this.state.type === 77;
if (lh.type === 22 || lh.type === 25) {
if (isThis && !first) {
this.raise(node.start, FlowErrors.ThisParamMustBeFirst);
}
name = this.parseIdentifier(isThis);
if (this.eat(25)) {
optional = true;
if (isThis) {
this.raise(node.start, FlowErrors.ThisParamMayNotBeOptional);
}
}
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;
let _this = null;
if (this.match(77)) {
_this = this.flowParseFunctionTypeParam(true);
_this.name = null;
if (!this.match(19)) {
this.expect(20);
}
}
while (!this.match(19) && !this.match(29)) {
params.push(this.flowParseFunctionTypeParam(false));
if (!this.match(19)) {
this.expect(20);
}
}
if (this.eat(29)) {
rest = this.flowParseFunctionTypeParam(false);
}
return {
params,
rest,
_this
};
}
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 5:
if (this.isContextual("interface")) {
return this.flowParseInterfaceType();
}
return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
case 13:
return this.flowParseObjectType({
allowStatic: false,
allowExact: false,
allowSpread: true,
allowProto: false,
allowInexact: true
});
case 14:
return this.flowParseObjectType({
allowStatic: false,
allowExact: true,
allowSpread: true,
allowProto: false,
allowInexact: false
});
case 8:
this.state.noAnonFunctionType = false;
type = this.flowParseTupleType();
this.state.noAnonFunctionType = oldNoAnonFunctionType;
return type;
case 50:
if (this.state.value === "<") {
node.typeParameters = this.flowParseTypeParameterDeclaration();
this.expect(18);
tmp = this.flowParseFunctionTypeParams();
node.params = tmp.params;
node.rest = tmp.rest;
node.this = tmp._this;
this.expect(19);
this.expect(27);
node.returnType = this.flowParseType();
return this.finishNode(node, "FunctionTypeAnnotation");
}
break;
case 18:
this.next();
if (!this.match(19) && !this.match(29)) {
if (this.match(5) || this.match(77)) {
const token = this.lookahead().type;
isGroupedType = token !== 25 && token !== 22;
} else {
isGroupedType = true;
}
}
if (isGroupedType) {
this.state.noAnonFunctionType = false;
type = this.flowParseType();
this.state.noAnonFunctionType = oldNoAnonFunctionType;
if (this.state.noAnonFunctionType || !(this.match(20) || this.match(19) && this.lookahead().type === 27)) {
this.expect(19);
return type;
} else {
this.eat(20);
}
}
if (type) {
tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
} else {
tmp = this.flowParseFunctionTypeParams();
}
node.params = tmp.params;
node.rest = tmp.rest;
node.this = tmp._this;
this.expect(19);
this.expect(27);
node.returnType = this.flowParseType();
node.typeParameters = null;
return this.finishNode(node, "FunctionTypeAnnotation");
case 4:
return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
case 84:
case 85:
node.value = this.match(84);
this.next();
return this.finishNode(node, "BooleanLiteralTypeAnnotation");
case 52:
if (this.state.value === "-") {
this.next();
if (this.match(0)) {
return this.parseLiteralAtNode(-this.state.value, "NumberLiteralTypeAnnotation", node);
}
if (this.match(1)) {
return this.parseLiteralAtNode(-this.state.value, "BigIntLiteralTypeAnnotation", node);
}
throw this.raise(this.state.start, FlowErrors.UnexpectedSubtractionOperand);
}
throw this.unexpected();
case 0:
return this.parseLiteral(this.state.value, "NumberLiteralTypeAnnotation");
case 1:
return this.parseLiteral(this.state.value, "BigIntLiteralTypeAnnotation");
case 87:
this.next();
return this.finishNode(node, "VoidTypeAnnotation");
case 83:
this.next();
return this.finishNode(node, "NullLiteralTypeAnnotation");
case 77:
this.next();
return this.finishNode(node, "ThisTypeAnnotation");
case 54:
this.next();
return this.finishNode(node, "ExistsTypeAnnotation");
case 86:
return this.flowParseTypeofType();
default:
if (tokenIsKeyword(this.state.type)) {
const label = tokenLabelName(this.state.type);
this.next();
return super.createIdentifier(node, label);
}
}
throw this.unexpected();
}
flowParsePostfixType() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let type = this.flowParsePrimaryType();
let seenOptionalIndexedAccess = false;
while ((this.match(8) || this.match(26)) && !this.canInsertSemicolon()) {
const node = this.startNodeAt(startPos, startLoc);
const optional = this.eat(26);
seenOptionalIndexedAccess = seenOptionalIndexedAccess || optional;
this.expect(8);
if (!optional && this.match(11)) {
node.elementType = type;
this.next();
type = this.finishNode(node, "ArrayTypeAnnotation");
} else {
node.objectType = type;
node.indexType = this.flowParseType();
this.expect(11);
if (seenOptionalIndexedAccess) {
node.optional = optional;
type = this.finishNode(node, "OptionalIndexedAccessType");
} else {
type = this.finishNode(node, "IndexedAccessType");
}
}
}
return type;
}
flowParsePrefixType() {
const node = this.startNode();
if (this.eat(25)) {
node.typeAnnotation = this.flowParsePrefixType();
return this.finishNode(node, "NullableTypeAnnotation");
} else {
return this.flowParsePostfixType();
}
}
flowParseAnonFunctionWithoutParens() {
const param = this.flowParsePrefixType();
if (!this.state.noAnonFunctionType && this.eat(27)) {
const node = this.startNodeAt(param.start, param.loc.start);
node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
node.rest = null;
node.this = null;
node.returnType = this.flowParseType();
node.typeParameters = null;
return this.finishNode(node, "FunctionTypeAnnotation");
}
return param;
}
flowParseIntersectionType() {
const node = this.startNode();
this.eat(48);
const type = this.flowParseAnonFunctionWithoutParens();
node.types = [type];
while (this.eat(48)) {
node.types.push(this.flowParseAnonFunctionWithoutParens());
}
return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
}
flowParseUnionType() {
const node = this.startNode();
this.eat(46);
const type = this.flowParseIntersectionType();
node.types = [type];
while (this.eat(46)) {
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;
return type;
}
flowParseTypeOrImplicitInstantiation() {
if (this.state.type === 5 && 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(22)) {
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(52)) {
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(22)) {
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(5) && this.state.value === "interface") {
const lookahead = this.lookahead();
if (lookahead.type === 5 || isKeyword(lookahead.value)) {
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);
}
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(79) || this.match(5) || this.match(67) || this.match(73) || this.match(81)) {
return this.flowParseDeclare(node);
}
} else if (this.match(5)) {
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(5) && (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, startPos, startLoc, refExpressionErrors) {
if (!this.match(25)) return expr;
if (this.state.maybeInArrowParameters) {
const nextCh = this.lookaheadCharCode();
if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) {
this.setOptionalParametersError(refExpressionErrors);
return expr;
}
}
this.expect(25);
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;
noArrowAt.push(valid[0].start);
this.state.noArrowAt = noArrowAt;
({
consequent,
failed
} = this.tryParseConditionalConsequent());
}
}
this.getArrowLikeExpressions(consequent, true);
this.state.noArrowAt = originalNoArrowAt;
this.expect(22);
node.test = expr;
node.consequent = consequent;
node.alternate = this.forwardNoArrowParamsConversionAt(node, () => this.parseMaybeAssign(undefined, undefined));
return this.finishNode(node, "ConditionalExpression");
}
tryParseConditionalConsequent() {
this.state.noArrowParamsConversionAt.push(this.state.start);
const consequent = this.parseMaybeAssignAllowIn();
const failed = !this.match(22);
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, false);
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(25)) {
node.optional = true;
this.resetEndLocation(node);
}
if (this.match(22)) {
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(13)) {
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 === 54) {
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) {
const pos = this.state.start;
if (this.isContextual("declare")) {
if (this.parseClassMemberFromModifier(classBody, member)) {
return;
}
member.declare = true;
}
super.parseClassMember(classBody, member, state);
if (member.declare) {
if (member.type !== "ClassProperty" && member.type !== "ClassPrivateProperty" && member.type !== "PropertyDefinition") {
this.raise(pos, FlowErrors.DeclareClassElement);
} else if (member.value) {
this.raise(member.value.start, FlowErrors.DeclareClassFieldInitializer);
}
}
}
isIterator(word) {
return word === "iterator" || word === "asyncIterator";
}
readIterator() {
const word = super.readWord1();
const fullWord = "@@" + word;
if (!this.isIterator(word) || !this.state.inType) {
this.raise(this.state.pos, ErrorMessages.InvalidIdentifier, fullWord);
}
this.finishToken(5, fullWord);
}
getTokenFromCode(code) {
const next = this.input.charCodeAt(this.state.pos + 1);
if (code === 123 && next === 124) {
return this.finishOp(14, 2);
} else if (this.state.inType && (code === 62 || code === 60)) {
return this.finishOp(50, 1);
} else if (this.state.inType && code === 63) {
if (next === 46) {
return this.finishOp(26, 2);
}
return this.finishOp(25, 1);
} else if (isIteratorStart(code, next)) {
this.state.pos += 2;
return this.readIterator();
} else {
return super.getTokenFromCode(code);
}
}
isAssignable(node, isBinding) {
if (node.type === "TypeCastExpression") {
return this.isAssignable(node.expression, isBinding);
} else {
return super.isAssignable(node, isBinding);
}
}
toAssignable(node, isLHS = false) {
if (node.type === "TypeCastExpression") {
return super.toAssignable(this.typeCastToParameter(node), isLHS);
} else {
return super.toAssignable(node, isLHS);
}
}
toAssignableList(exprList, trailingCommaPos, isLHS) {
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, isLHS);
}
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 && _expr$extra.parenthesized) && (exprList.length > 1 || !isParenthesizedExpr)) {
this.raise(expr.typeAnnotation.start, FlowErrors.TypeCastInPattern);
}
}
return exprList;
}
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
const node = super.parseArrayLike(close, canBePattern, isTuple, refExpressionErrors);
if (canBePattern && !this.state.maybeInArrowParameters) {
this.toReferencedList(node.elements);
}
return node;
}
checkLVal(expr, ...args) {
if (expr.type !== "TypeCastExpression") {
return super.checkLVal(expr, ...args);
}
}
parseClassProperty(node) {
if (this.match(22)) {
node.typeAnnotation = this.flowParseTypeAnnotation();
}
return super.parseClassProperty(node);
}
parseClassPrivateProperty(node) {
if (this.match(22)) {
node.typeAnnotation = this.flowParseTypeAnnotation();
}
return super.parseClassPrivateProperty(node);
}
isClassMethod() {
return this.isRelational("<") || super.isClassMethod();
}
isClassProperty() {
return this.match(22) || super.isClassProperty();
}
isNonstaticConstructor(method) {
return !this.match(22) && 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);
if (method.params && isConstructor) {
const params = method.params;
if (params.length > 0 && this.isThisParam(params[0])) {
this.raise(method.start, FlowErrors.ThisParamBannedInConstructor);
}
} else if (method.type === "MethodDefinition" && isConstructor && method.value.params) {
const params = method.value.params;
if (params.length > 0 && this.isThisParam(params[0])) {
this.raise(method.start, FlowErrors.ThisParamBannedInConstructor);
}
}
}
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(20));
}
}
checkGetterSetterParams(method) {
super.checkGetterSetterParams(method);
const params = this.getObjectOrClassMethodParams(method);
if (params.length > 0) {
const param = params[0];
if (this.isThisParam(param) && method.kind === "get") {
this.raise(param.start, FlowErrors.GetterMayNotHaveThisParam);
} else if (this.isThisParam(param)) {
this.raise(param.start, FlowErrors.SetterMayNotHaveThisParam);
}
}
}
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, isAccessor, refExpressionErrors) {
if (prop.variance) {
this.unexpected(prop.variance.start);
}
delete prop.variance;
let typeParameters;
if (this.isRelational("<") && !isAccessor) {
typeParameters = this.flowParseTypeParameterDeclaration();
if (!this.match(18)) this.unexpected();
}
super.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
if (typeParameters) {
(prop.value || prop).typeParameters = typeParameters;
}
}
parseAssignableListItemTypes(param) {
if (this.eat(25)) {
if (param.type !== "Identifier") {
this.raise(param.start, FlowErrors.PatternIsOptional);
}
if (this.isThisParam(param)) {
this.raise(param.start, FlowErrors.ThisParamMayNotBeOptional);
}
param.optional = true;
}
if (this.match(22)) {
param.typeAnnotation = this.flowParseTypeAnnotation();
} else if (this.isThisParam(param)) {
this.raise(param.start, FlowErrors.ThisParamAnnotationRequired);
}
if (this.match(35) && this.isThisParam(param)) {
this.raise(param.start, FlowErrors.ThisParamNoDefault);
}
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, contextDescription, BIND_LEXICAL);
node.specifiers.push(this.finishNode(specifier, type));
}
maybeParseDefaultImportSpecifier(node) {
node.importKind = "value";
let kind = null;
if (this.match(86)) {
kind = "typeof";
} else if (this.isContextual("type")) {
kind = "type";
}
if (kind) {
const lh = this.lookahead();
if (kind === "type" && lh.type === 54) {
this.unexpected(lh.start);
}
if (isMaybeDefaultImport(lh) || lh.type === 13 || lh.type === 54) {
this.next();
node.importKind = kind;
}
}
return super.maybeParseDefaultImportSpecifier(node);
}
parseImportSpecifier(node) {
const specifier = this.startNode();
const firstIdentIsString = this.match(4);
const firstIdent = this.parseModuleExportName();
let specifierTypeKind = null;
if (firstIdent.type === "Identifier") {
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(5) && !tokenIsKeyword(this.state.type)) {
specifier.imported = as_ident;
specifier.importKind = specifierTypeKind;
specifier.local = cloneIdentifier(as_ident);
} else {
specifier.imported = firstIdent;
specifier.importKind = null;
specifier.local = this.parseIdentifier();
}
} else {
if (specifierTypeKind !== null && (this.match(5) || tokenIsKeyword(this.state.type))) {
specifier.imported = this.parseIdentifier(true);
specifier.importKind = specifierTypeKind;
} else {
if (firstIdentIsString) {
throw this.raise(specifier.start, ErrorMessages.ImportBindingIsString, firstIdent.value);
}
specifier.imported = firstIdent;
specifier.importKind = null;
}
if (this.eatContextual("as")) {
specifier.local = this.parseIdentifier();
} else {
isBinding = true;
specifier.local = cloneIdentifier(specifier.imported);
}
}
const nodeIsTypeImport = hasTypeImportKind(node);
const specifierIsTypeImport = hasTypeImportKind(specifier);
if (nodeIsTypeImport && specifierIsTypeImport) {
this.raise(specifier.start, 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, "import specifier", BIND_LEXICAL);
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
}
parseBindingAtom() {
switch (this.state.type) {
case 77:
return this.parseIdentifier(true);
default:
return super.parseBindingAtom();
}
}
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(22)) {
decl.id.typeAnnotation = this.flowParseTypeAnnotation();
this.resetEndLocation(decl.id);
}
}
parseAsyncArrowFromCallExpression(node, call) {
if (this.match(22)) {
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(22) || super.shouldParseAsyncArrow();
}
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
var _jsx;
let state = null;
let jsx;
if (this.hasPlugin("jsx") && (this.match(94) || this.isRelational("<"))) {
state = this.state.clone();
jsx = this.tryParse(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), state);
if (!jsx.error) return jsx.node;
const {
context
} = this.state;
const curContext = context[context.length - 1];
if (curContext === types.j_oTag) {
context.length -= 2;
} else if (curContext === types.j_expr) {
context.length -= 1;
}
}
if ((_jsx = jsx) != null && _jsx.error || this.isRelational("<")) {
var _jsx2, _jsx3;
state = state || this.state.clone();
let typeParameters;
const arrow = this.tryParse(abort => {
var _arrowExpression$extr;
typeParameters = this.flowParseTypeParameterDeclaration();
const arrowExpression = this.forwardNoArrowParamsConversionAt(typeParameters, () => {
const result = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
this.resetStartLocationFromNode(result, typeParameters);
return result;
});
if ((_arrowExpression$extr = arrowExpression.extra) != null && _arrowExpression$extr.parenthesized) abort();
const expr = this.maybeUnwrapTypeCastExpression(arrowExpression);
if (expr.type !== "ArrowFunctionExpression") abort();
expr.typeParameters = typeParameters;
this.resetStartLocationFromNode(expr, typeParameters);
return arrowExpression;
}, state);
let arrowExpression = null;
if (arrow.node && this.maybeUnwrapTypeCastExpression(arrow.node).type === "ArrowFunctionExpression") {
if (!arrow.error && !arrow.aborted) {
if (arrow.node.async) {
this.raise(typeParameters.start, FlowErrors.UnexpectedTypeParameterBeforeAsyncArrowFunction);
}
return arrow.node;
}
arrowExpression = arrow.node;
}
if ((_jsx2 = jsx) != null && _jsx2.node) {
this.state = jsx.failState;
return jsx.node;
}
if (arrowExpression) {
this.state = arrow.failState;
return arrowExpression;
}
if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
if (arrow.thrown) throw arrow.error;
throw this.raise(typeParameters.start, FlowErrors.UnexpectedTokenAfterTypeParameter);
}
return super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
}
parseArrow(node) {
if (this.match(22)) {
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(27)) 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(params) {
return this.match(22) || super.shouldParseArrow(params);
}
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;
}
for (let i = 0; i < node.params.length; i++) {
if (this.isThisParam(node.params[i]) && i > 0) {
this.raise(node.params[i].start, FlowErrors.ThisParamMustBeFirst);
}
}
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(19, 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(26) && this.isLookaheadToken_lt()) {
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(18);
node.arguments = this.parseCallExpressionArguments(19, 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(18);
node.arguments = this.parseCallExpressionArguments(19, 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(17, 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;
}
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(20) || this.match(16);
switch (this.state.type) {
case 0:
{
const literal = this.parseNumericLiteral(this.state.value);
if (endOfInit()) {
return {
type: "number",
pos: literal.start,
value: literal
};
}
return {
type: "invalid",
pos: startPos
};
}
case 4:
{
const literal = this.parseStringLiteral(this.state.value);
if (endOfInit()) {
return {
type: "string",
pos: literal.start,
value: literal
};
}
return {
type: "invalid",
pos: startPos
};
}
case 84:
case 85:
{
const literal = this.parseBooleanLiteral(this.match(84));
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(35) ? 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: []
};
let hasUnknownMembers = false;
while (!this.match(16)) {
if (this.eat(29)) {
hasUnknownMembers = true;
break;
}
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(16)) {
this.expect(20);
}
}
return {
members,
hasUnknownMembers
};
}
flowEnumStringMembers(initializedMembers, defaultedMembers, {
enumName
}) {
if (initializedMembers.length === 0) {
return defaultedMembers;
} else if (defaultedMembers.length === 0) {
return initializedMembers;
} else if (defaultedMembers.length > initializedMembers.length) {
for (const member of initializedMembers) {
this.flowEnumErrorStringMemberInconsistentlyInitailized(member.start, {
enumName
});
}
return defaultedMembers;
} else {
for (const member of defaultedMembers) {
this.flowEnumErrorStringMemberInconsistentlyInitailized(member.start, {
enumName
});
}
return initializedMembers;
}
}
flowEnumParseExplicitType({
enumName
}) {
if (this.eatContextual("of")) {
if (!this.match(5)) {
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(13);
const {
members,
hasUnknownMembers
} = this.flowEnumMembers({
enumName,
explicitType
});
node.hasUnknownMembers = hasUnknownMembers;
switch (explicitType) {
case "boolean":
node.explicitType = true;
node.members = members.booleanMembers;
this.expect(16);
return this.finishNode(node, "EnumBooleanBody");
case "number":
node.explicitType = true;
node.members = members.numberMembers;
this.expect(16);
return this.finishNode(node, "EnumNumberBody");
case "string":
node.explicitType = true;
node.members = this.flowEnumStringMembers(members.stringMembers, members.defaultedMembers, {
enumName
});
this.expect(16);
return this.finishNode(node, "EnumStringBody");
case "symbol":
node.members = members.defaultedMembers;
this.expect(16);
return this.finishNode(node, "EnumSymbolBody");
default:
{
const empty = () => {
node.members = [];
this.expect(16);
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(16);
return this.finishNode(node, "EnumStringBody");
} else if (!numsLen && !strsLen && boolsLen >= defaultedLen) {
for (const member of members.defaultedMembers) {
this.flowEnumErrorBooleanMemberNotInitialized(member.start, {
enumName,
memberName: member.id.name
});
}
node.members = members.booleanMembers;
this.expect(16);
return this.finishNode(node, "EnumBooleanBody");
} else if (!boolsLen && !strsLen && numsLen >= defaultedLen) {
for (const member of members.defaultedMembers) {
this.flowEnumErrorNumberMemberNotInitialized(member.start, {
enumName,
memberName: member.id.name
});
}
node.members = members.numberMembers;
this.expect(16);
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");
}
isLookaheadToken_lt() {
const next = this.nextTokenStart();
if (this.input.charCodeAt(next) === 60) {
const afterNext = this.input.charCodeAt(next + 1);
return afterNext !== 60 && afterNext !== 61;
}
return false;
}
maybeUnwrapTypeCastExpression(node) {
return node.type === "TypeCastExpression" ? node.expression : node;
}
});
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 = makeErrorTemplates({
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression.",
MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>.",
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>.",
UnexpectedSequenceExpression: "Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",
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 <>...>?"
}, ErrorCodes.SyntaxError, "jsx");
types.j_oTag = new TokContext("... ", 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(94);
}
return super.getTokenFromCode(ch);
}
out += this.input.slice(chunkStart, this.state.pos);
return this.finishToken(93, out);
case 38:
out += this.input.slice(chunkStart, this.state.pos);
out += this.jsxReadEntity();
chunkStart = this.state.pos;
break;
case 62:
case 125:
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(4, 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(92, this.input.slice(start, this.state.pos));
}
jsxParseIdentifier() {
const node = this.startNode();
if (this.match(92)) {
node.name = this.state.value;
} else if (tokenIsKeyword(this.state.type)) {
node.name = tokenLabelName(this.state.type);
} 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(22)) 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(24)) {
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 13:
node = this.startNode();
this.next();
node = this.jsxParseExpressionContainer(node);
if (node.expression.type === "JSXEmptyExpression") {
this.raise(node.start, JsxErrors.AttributeIsEmpty);
}
return node;
case 94:
case 4:
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(16);
return this.finishNode(node, "JSXSpreadChild");
}
jsxParseExpressionContainer(node) {
if (this.match(16)) {
node.expression = this.jsxParseEmptyExpression();
} else {
const expression = this.parseExpression();
node.expression = expression;
}
this.expect(16);
return this.finishNode(node, "JSXExpressionContainer");
}
jsxParseAttribute() {
const node = this.startNode();
if (this.eat(13)) {
this.expect(29);
node.argument = this.parseMaybeAssignAllowIn();
this.expect(16);
return this.finishNode(node, "JSXSpreadAttribute");
}
node.name = this.jsxParseNamespacedName();
node.value = this.eat(35) ? this.jsxParseAttributeValue() : null;
return this.finishNode(node, "JSXAttribute");
}
jsxParseOpeningElementAt(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
if (this.match(95)) {
this.expect(95);
return this.finishNode(node, "JSXOpeningFragment");
}
node.name = this.jsxParseElementName();
return this.jsxParseOpeningElementAfterName(node);
}
jsxParseOpeningElementAfterName(node) {
const attributes = [];
while (!this.match(55) && !this.match(95)) {
attributes.push(this.jsxParseAttribute());
}
node.attributes = attributes;
node.selfClosing = this.eat(55);
this.expect(95);
return this.finishNode(node, "JSXOpeningElement");
}
jsxParseClosingElementAt(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
if (this.match(95)) {
this.expect(95);
return this.finishNode(node, "JSXClosingFragment");
}
node.name = this.jsxParseElementName();
this.expect(95);
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 94:
startPos = this.state.start;
startLoc = this.state.startLoc;
this.next();
if (this.eat(55)) {
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
break contents;
}
children.push(this.jsxParseElementAt(startPos, startLoc));
break;
case 93:
children.push(this.parseExprAtom());
break;
case 13:
{
const node = this.startNode();
this.next();
if (this.match(29)) {
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(93)) {
return this.parseLiteral(this.state.value, "JSXText");
} else if (this.match(94)) {
return this.jsxParseElement();
} else if (this.isRelational("<") && this.input.charCodeAt(this.state.pos) !== 33) {
this.finishToken(94);
return this.jsxParseElement();
} else {
return super.parseExprAtom(refExpressionErrors);
}
}
createLookaheadState(state) {
const lookaheadState = super.createLookaheadState(state);
lookaheadState.inPropertyName = state.inPropertyName;
return lookaheadState;
}
getTokenFromCode(code) {
if (this.state.inPropertyName) return super.getTokenFromCode(code);
const context = this.curContext();
if (context === types.j_expr) {
return this.jsxReadToken();
}
if (context === types.j_oTag || context === types.j_cTag) {
if (isIdentifierStart(code)) {
return this.jsxReadWord();
}
if (code === 62) {
++this.state.pos;
return this.finishToken(95);
}
if ((code === 34 || code === 39) && context === types.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(94);
}
return super.getTokenFromCode(code);
}
updateContext(prevType) {
super.updateContext(prevType);
const {
context,
type
} = this.state;
if (type === 55 && prevType === 94) {
context.splice(-2, 2, types.j_cTag);
this.state.exprAllowed = false;
} else if (type === 94) {
context.push(types.j_expr, types.j_oTag);
} else if (type === 95) {
const out = context.pop();
if (out === types.j_oTag && prevType === 55 || out === types.j_cTag) {
context.pop();
this.state.exprAllowed = context[context.length - 1] === types.j_expr;
} else {
this.state.exprAllowed = true;
}
} else if (tokenIsKeyword(type) && (prevType === 24 || prevType === 26)) {
this.state.exprAllowed = false;
} else {
this.state.exprAllowed = tokenComesBeforeExpression(type);
}
}
});
class TypeScriptScope extends Scope {
constructor(...args) {
super(...args);
this.types = new Set();
this.enums = new Set();
this.constEnums = new Set();
this.classes = new Set();
this.exportOnlyBindings = new Set();
}
}
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.add(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.add(name);
}
if (bindingType & BIND_FLAGS_TS_ENUM) scope.enums.add(name);
if (bindingType & BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.add(name);
if (bindingType & BIND_FLAGS_CLASS) scope.classes.add(name);
}
isRedeclaredInScope(scope, name, bindingType) {
if (scope.enums.has(name)) {
if (bindingType & BIND_FLAGS_TS_ENUM) {
const isConst = !!(bindingType & BIND_FLAGS_TS_CONST_ENUM);
const wasConst = scope.constEnums.has(name);
return isConst !== wasConst;
}
return true;
}
if (bindingType & BIND_FLAGS_CLASS && scope.classes.has(name)) {
if (scope.lexical.has(name)) {
return !!(bindingType & BIND_KIND_VALUE);
} else {
return false;
}
}
if (bindingType & BIND_KIND_TYPE && scope.types.has(name)) {
return true;
}
return super.isRedeclaredInScope(...arguments);
}
checkLocalExport(id) {
const topLevelScope = this.scopeStack[0];
const {
name
} = id;
if (!topLevelScope.types.has(name) && !topLevelScope.exportOnlyBindings.has(name)) {
super.checkLocalExport(id);
}
}
}
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 = makeErrorTemplates({
AbstractMethodHasImplementation: "Method '%0' cannot have an implementation because it is marked abstract.",
AbstractPropertyHasInitializer: "Property '%0' cannot have an initializer because it is marked abstract.",
AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
DeclareAccessor: "'declare' is not allowed in %0ters.",
DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.",
DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
DuplicateAccessibilityModifier: "Accessibility modifier already seen.",
DuplicateModifier: "Duplicate modifier: '%0'.",
EmptyHeritageClauseType: "'%0' list cannot be empty.",
EmptyTypeArguments: "Type argument list cannot be empty.",
EmptyTypeParameters: "Type parameter list cannot be empty.",
ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.",
ImportAliasHasImportType: "An import alias can not use 'import type'.",
IncompatibleModifiers: "'%0' modifier cannot be used with '%1' modifier.",
IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.",
IndexSignatureHasAccessibility: "Index signatures cannot have an accessibility modifier ('%0').",
IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.",
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
InvalidModifierOnTypeMember: "'%0' modifier cannot appear on a type member.",
InvalidModifiersOrder: "'%0' modifier must precede '%1' modifier.",
InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
MixedLabeledAndUnlabeledElements: "Tuple members must all have names or all not have names.",
NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
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').",
ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.",
TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",
TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.",
UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.",
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."
}, ErrorCodes.SyntaxError, "typescript");
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;
}
}
function tsIsAccessModifier(modifier) {
return modifier === "private" || modifier === "public" || modifier === "protected";
}
var typescript = (superClass => class extends superClass {
getScopeHandler() {
return TypeScriptScopeHandler;
}
tsIsIdentifier() {
return this.match(5);
}
tsTokenCanFollowModifier() {
return (this.match(8) || this.match(13) || this.match(54) || this.match(29) || this.match(6) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
}
tsNextTokenCanFollowModifier() {
this.next();
return this.tsTokenCanFollowModifier();
}
tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
if (!this.match(5)) {
return undefined;
}
const modifier = this.state.value;
if (allowedModifiers.indexOf(modifier) !== -1) {
if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) {
return undefined;
}
if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) {
return modifier;
}
}
return undefined;
}
tsParseModifiers(modified, allowedModifiers, disallowedModifiers, errorTemplate, stopOnStartOfClassStaticBlock) {
const enforceOrder = (pos, modifier, before, after) => {
if (modifier === before && modified[after]) {
this.raise(pos, TSErrors.InvalidModifiersOrder, before, after);
}
};
const incompatible = (pos, modifier, mod1, mod2) => {
if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) {
this.raise(pos, TSErrors.IncompatibleModifiers, mod1, mod2);
}
};
for (;;) {
const startPos = this.state.start;
const modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers != null ? disallowedModifiers : []), stopOnStartOfClassStaticBlock);
if (!modifier) break;
if (tsIsAccessModifier(modifier)) {
if (modified.accessibility) {
this.raise(startPos, TSErrors.DuplicateAccessibilityModifier);
} else {
enforceOrder(startPos, modifier, modifier, "override");
enforceOrder(startPos, modifier, modifier, "static");
enforceOrder(startPos, modifier, modifier, "readonly");
modified.accessibility = modifier;
}
} else {
if (Object.hasOwnProperty.call(modified, modifier)) {
this.raise(startPos, TSErrors.DuplicateModifier, modifier);
} else {
enforceOrder(startPos, modifier, "static", "readonly");
enforceOrder(startPos, modifier, "static", "override");
enforceOrder(startPos, modifier, "override", "readonly");
enforceOrder(startPos, modifier, "abstract", "override");
incompatible(startPos, modifier, "declare", "override");
incompatible(startPos, modifier, "static", "abstract");
}
modified[modifier] = true;
}
if (disallowedModifiers != null && disallowedModifiers.includes(modifier)) {
this.raise(startPos, errorTemplate, modifier);
}
}
}
tsIsListTerminator(kind) {
switch (kind) {
case "EnumMembers":
case "TypeMembers":
return this.match(16);
case "HeritageClauseElement":
return this.match(13);
case "TupleElementTypes":
return this.match(11);
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(20)) {
continue;
}
if (this.tsIsListTerminator(kind)) {
break;
}
if (expectSuccess) {
this.expect(20);
}
return undefined;
}
return result;
}
tsParseBracketedList(kind, parseElement, bracket, skipFirstToken) {
if (!skipFirstToken) {
if (bracket) {
this.expect(8);
} else {
this.expectRelational("<");
}
}
const result = this.tsParseDelimitedList(kind, parseElement);
if (bracket) {
this.expect(11);
} else {
this.expectRelational(">");
}
return result;
}
tsParseImportType() {
const node = this.startNode();
this.expect(82);
this.expect(18);
if (!this.match(4)) {
this.raise(this.state.start, TSErrors.UnsupportedImportTypeArgument);
}
node.argument = this.parseExprAtom();
this.expect(19);
if (this.eat(24)) {
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(24)) {
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);
node.asserts = 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(86);
if (this.match(82)) {
node.exprName = this.tsParseImportType();
} else {
node.exprName = this.tsParseEntityName(true);
}
return this.finishNode(node, "TSTypeQuery");
}
tsParseTypeParameter() {
const node = this.startNode();
node.name = this.tsParseTypeParameterName();
node.constraint = this.tsEatThenParseType(80);
node.default = this.tsEatThenParseType(35);
return this.finishNode(node, "TSTypeParameter");
}
tsTryParseTypeParameters() {
if (this.isRelational("<")) {
return this.tsParseTypeParameters();
}
}
tsParseTypeParameters() {
const node = this.startNode();
if (this.isRelational("<") || this.match(94)) {
this.next();
} else {
this.unexpected();
}
node.params = this.tsParseBracketedList("TypeParametersOrArguments", this.tsParseTypeParameter.bind(this), false, true);
if (node.params.length === 0) {
this.raise(node.start, TSErrors.EmptyTypeParameters);
}
return this.finishNode(node, "TSTypeParameterDeclaration");
}
tsTryNextParseConstantContext() {
if (this.lookahead().type === 74) {
this.next();
return this.tsParseTypeReference();
}
return null;
}
tsFillSignature(returnToken, signature) {
const returnTokenRequired = returnToken === 27;
signature.typeParameters = this.tsTryParseTypeParameters();
this.expect(18);
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(19, 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(20) && !this.isLineTerminator()) {
this.expect(21);
}
}
tsParseSignatureMember(kind, node) {
this.tsFillSignature(22, node);
this.tsParseTypeMemberSemicolon();
return this.finishNode(node, kind);
}
tsIsUnambiguouslyIndexSignature() {
this.next();
return this.eat(5) && this.match(22);
}
tsTryParseIndexSignature(node) {
if (!(this.match(8) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) {
return undefined;
}
this.expect(8);
const id = this.parseIdentifier();
id.typeAnnotation = this.tsParseTypeAnnotation();
this.resetEndLocation(id);
this.expect(11);
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(25)) node.optional = true;
const nodeAny = node;
if (this.match(18) || this.isRelational("<")) {
if (readonly) {
this.raise(node.start, TSErrors.ReadonlyForMethodSignature);
}
const method = nodeAny;
if (method.kind && this.isRelational("<")) {
this.raise(this.state.pos, TSErrors.AccesorCannotHaveTypeParameters);
}
this.tsFillSignature(22, method);
this.tsParseTypeMemberSemicolon();
if (method.kind === "get") {
if (method.parameters.length > 0) {
this.raise(this.state.pos, ErrorMessages.BadGetterArity);
if (this.isThisParam(method.parameters[0])) {
this.raise(this.state.pos, TSErrors.AccesorCannotDeclareThisParameter);
}
}
} else if (method.kind === "set") {
if (method.parameters.length !== 1) {
this.raise(this.state.pos, ErrorMessages.BadSetterArity);
} else {
const firstParameter = method.parameters[0];
if (this.isThisParam(firstParameter)) {
this.raise(this.state.pos, TSErrors.AccesorCannotDeclareThisParameter);
}
if (firstParameter.type === "Identifier" && firstParameter.optional) {
this.raise(this.state.pos, TSErrors.SetAccesorCannotHaveOptionalParameter);
}
if (firstParameter.type === "RestElement") {
this.raise(this.state.pos, TSErrors.SetAccesorCannotHaveRestParameter);
}
}
if (method.typeAnnotation) {
this.raise(method.typeAnnotation.start, TSErrors.SetAccesorCannotHaveReturnType);
}
} else {
method.kind = "method";
}
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(18) || this.isRelational("<")) {
return this.tsParseSignatureMember("TSCallSignatureDeclaration", node);
}
if (this.match(76)) {
const id = this.startNode();
this.next();
if (this.match(18) || this.isRelational("<")) {
return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node);
} else {
node.key = this.createIdentifier(id, "new");
return this.tsParsePropertyOrMethodSignature(node, false);
}
}
this.tsParseModifiers(node, ["readonly"], ["declare", "abstract", "private", "protected", "public", "static", "override"], TSErrors.InvalidModifierOnTypeMember);
const idx = this.tsTryParseIndexSignature(node);
if (idx) {
return idx;
}
this.parsePropertyName(node, false);
if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) {
node.kind = node.key.name;
this.parsePropertyName(node, false);
}
return this.tsParsePropertyOrMethodSignature(node, !!node.readonly);
}
tsParseTypeLiteral() {
const node = this.startNode();
node.members = this.tsParseObjectTypeMembers();
return this.finishNode(node, "TSTypeLiteral");
}
tsParseObjectTypeMembers() {
this.expect(13);
const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this));
this.expect(16);
return members;
}
tsIsStartOfMappedType() {
this.next();
if (this.eat(52)) {
return this.isContextual("readonly");
}
if (this.isContextual("readonly")) {
this.next();
}
if (!this.match(8)) {
return false;
}
this.next();
if (!this.tsIsIdentifier()) {
return false;
}
this.next();
return this.match(57);
}
tsParseMappedTypeParameter() {
const node = this.startNode();
node.name = this.tsParseTypeParameterName();
node.constraint = this.tsExpectThenParseType(57);
return this.finishNode(node, "TSTypeParameter");
}
tsParseMappedType() {
const node = this.startNode();
this.expect(13);
if (this.match(52)) {
node.readonly = this.state.value;
this.next();
this.expectContextual("readonly");
} else if (this.eatContextual("readonly")) {
node.readonly = true;
}
this.expect(8);
node.typeParameter = this.tsParseMappedTypeParameter();
node.nameType = this.eatContextual("as") ? this.tsParseType() : null;
this.expect(11);
if (this.match(52)) {
node.optional = this.state.value;
this.next();
this.expect(25);
} else if (this.eat(25)) {
node.optional = true;
}
node.typeAnnotation = this.tsTryParseType();
this.semicolon();
this.expect(16);
return this.finishNode(node, "TSMappedType");
}
tsParseTupleType() {
const node = this.startNode();
node.elementTypes = this.tsParseBracketedList("TupleElementTypes", this.tsParseTupleElementType.bind(this), true, false);
let seenOptionalElement = false;
let labeledElements = null;
node.elementTypes.forEach(elementNode => {
var _labeledElements;
let {
type
} = elementNode;
if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) {
this.raise(elementNode.start, TSErrors.OptionalTypeBeforeRequired);
}
seenOptionalElement = seenOptionalElement || type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType";
if (type === "TSRestType") {
elementNode = elementNode.typeAnnotation;
type = elementNode.type;
}
const isLabeled = type === "TSNamedTupleMember";
labeledElements = (_labeledElements = labeledElements) != null ? _labeledElements : isLabeled;
if (labeledElements !== isLabeled) {
this.raise(elementNode.start, TSErrors.MixedLabeledAndUnlabeledElements);
}
});
return this.finishNode(node, "TSTupleType");
}
tsParseTupleElementType() {
const {
start: startPos,
startLoc
} = this.state;
const rest = this.eat(29);
let type = this.tsParseType();
const optional = this.eat(25);
const labeled = this.eat(22);
if (labeled) {
const labeledNode = this.startNodeAtNode(type);
labeledNode.optional = optional;
if (type.type === "TSTypeReference" && !type.typeParameters && type.typeName.type === "Identifier") {
labeledNode.label = type.typeName;
} else {
this.raise(type.start, TSErrors.InvalidTupleMemberLabel);
labeledNode.label = type;
}
labeledNode.elementType = this.tsParseType();
type = this.finishNode(labeledNode, "TSNamedTupleMember");
} else if (optional) {
const optionalTypeNode = this.startNodeAtNode(type);
optionalTypeNode.typeAnnotation = type;
type = this.finishNode(optionalTypeNode, "TSOptionalType");
}
if (rest) {
const restNode = this.startNodeAt(startPos, startLoc);
restNode.typeAnnotation = type;
type = this.finishNode(restNode, "TSRestType");
}
return type;
}
tsParseParenthesizedType() {
const node = this.startNode();
this.expect(18);
node.typeAnnotation = this.tsParseType();
this.expect(19);
return this.finishNode(node, "TSParenthesizedType");
}
tsParseFunctionOrConstructorType(type, abstract) {
const node = this.startNode();
if (type === "TSConstructorType") {
node.abstract = !!abstract;
if (abstract) this.next();
this.next();
}
this.tsFillSignature(27, node);
return this.finishNode(node, type);
}
tsParseLiteralTypeNode() {
const node = this.startNode();
node.literal = (() => {
switch (this.state.type) {
case 0:
case 1:
case 4:
case 84:
case 85:
return this.parseExprAtom();
default:
throw this.unexpected();
}
})();
return this.finishNode(node, "TSLiteralType");
}
tsParseTemplateLiteralType() {
const node = this.startNode();
node.literal = this.parseTemplate(false);
return this.finishNode(node, "TSLiteralType");
}
parseTemplateSubstitution() {
if (this.state.inType) return this.tsParseType();
return super.parseTemplateSubstitution();
}
tsParseThisTypeOrThisTypePredicate() {
const thisKeyword = this.tsParseThisTypeNode();
if (this.isContextual("is") && !this.hasPrecedingLineBreak()) {
return this.tsParseThisTypePredicate(thisKeyword);
} else {
return thisKeyword;
}
}
tsParseNonArrayType() {
switch (this.state.type) {
case 5:
case 87:
case 83:
{
const type = this.match(87) ? "TSVoidKeyword" : this.match(83) ? "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 4:
case 0:
case 1:
case 84:
case 85:
return this.tsParseLiteralTypeNode();
case 52:
if (this.state.value === "-") {
const node = this.startNode();
const nextToken = this.lookahead();
if (nextToken.type !== 0 && nextToken.type !== 1) {
throw this.unexpected();
}
node.literal = this.parseMaybeUnary();
return this.finishNode(node, "TSLiteralType");
}
break;
case 77:
return this.tsParseThisTypeOrThisTypePredicate();
case 86:
return this.tsParseTypeQuery();
case 82:
return this.tsParseImportType();
case 13:
return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral();
case 8:
return this.tsParseTupleType();
case 18:
return this.tsParseParenthesizedType();
case 30:
return this.tsParseTemplateLiteralType();
}
throw this.unexpected();
}
tsParseArrayTypeOrHigher() {
let type = this.tsParseNonArrayType();
while (!this.hasPrecedingLineBreak() && this.eat(8)) {
if (this.match(11)) {
const node = this.startNodeAtNode(type);
node.elementType = type;
this.expect(11);
type = this.finishNode(node, "TSArrayType");
} else {
const node = this.startNodeAtNode(type);
node.objectType = type;
node.indexType = this.tsParseType();
this.expect(11);
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.tsParseTypeParameterName();
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) {
const node = this.startNode();
const hasLeadingOperator = this.eat(operator);
const types = [];
do {
types.push(parseConstituentType());
} while (this.eat(operator));
if (types.length === 1 && !hasLeadingOperator) {
return types[0];
}
node.types = types;
return this.finishNode(node, kind);
}
tsParseIntersectionTypeOrHigher() {
return this.tsParseUnionOrIntersectionType("TSIntersectionType", this.tsParseTypeOperatorOrHigher.bind(this), 48);
}
tsParseUnionTypeOrHigher() {
return this.tsParseUnionOrIntersectionType("TSUnionType", this.tsParseIntersectionTypeOrHigher.bind(this), 46);
}
tsIsStartOfFunctionType() {
if (this.isRelational("<")) {
return true;
}
return this.match(18) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this));
}
tsSkipParameterStart() {
if (this.match(5) || this.match(77)) {
this.next();
return true;
}
if (this.match(13)) {
let braceStackCounter = 1;
this.next();
while (braceStackCounter > 0) {
if (this.match(13)) {
++braceStackCounter;
} else if (this.match(16)) {
--braceStackCounter;
}
this.next();
}
return true;
}
if (this.match(8)) {
let braceStackCounter = 1;
this.next();
while (braceStackCounter > 0) {
if (this.match(8)) {
++braceStackCounter;
} else if (this.match(11)) {
--braceStackCounter;
}
this.next();
}
return true;
}
return false;
}
tsIsUnambiguouslyStartOfFunctionType() {
this.next();
if (this.match(19) || this.match(29)) {
return true;
}
if (this.tsSkipParameterStart()) {
if (this.match(22) || this.match(20) || this.match(25) || this.match(35)) {
return true;
}
if (this.match(19)) {
this.next();
if (this.match(27)) {
return true;
}
}
}
return false;
}
tsParseTypeOrTypePredicateAnnotation(returnToken) {
return this.tsInType(() => {
const t = this.startNode();
this.expect(returnToken);
const node = this.startNode();
const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));
if (asserts && this.match(77)) {
let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate();
if (thisTypePredicate.type === "TSThisType") {
node.parameterName = thisTypePredicate;
node.asserts = true;
node.typeAnnotation = null;
thisTypePredicate = this.finishNode(node, "TSTypePredicate");
} else {
this.resetStartLocationFromNode(thisTypePredicate, node);
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);
}
node.parameterName = this.parseIdentifier();
node.asserts = asserts;
node.typeAnnotation = null;
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
return this.finishNode(t, "TSTypeAnnotation");
}
const type = this.tsParseTypeAnnotation(false);
node.parameterName = typePredicateVariable;
node.typeAnnotation = type;
node.asserts = asserts;
t.typeAnnotation = this.finishNode(node, "TSTypePredicate");
return this.finishNode(t, "TSTypeAnnotation");
});
}
tsTryParseTypeOrTypePredicateAnnotation() {
return this.match(22) ? this.tsParseTypeOrTypePredicateAnnotation(22) : undefined;
}
tsTryParseTypeAnnotation() {
return this.match(22) ? this.tsParseTypeAnnotation() : undefined;
}
tsTryParseType() {
return this.tsEatThenParseType(22);
}
tsParseTypePredicatePrefix() {
const id = this.parseIdentifier();
if (this.isContextual("is") && !this.hasPrecedingLineBreak()) {
this.next();
return id;
}
}
tsParseTypePredicateAsserts() {
if (!this.match(5) || this.state.value !== "asserts") {
return false;
}
const containsEsc = this.state.containsEsc;
this.next();
if (!this.match(5) && !this.match(77)) {
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(22);
t.typeAnnotation = this.tsParseType();
});
return this.finishNode(t, "TSTypeAnnotation");
}
tsParseType() {
assert(this.state.inType);
const type = this.tsParseNonConditionalType();
if (this.hasPrecedingLineBreak() || !this.eat(80)) {
return type;
}
const node = this.startNodeAtNode(type);
node.checkType = type;
node.extendsType = this.tsParseNonConditionalType();
this.expect(25);
node.trueType = this.tsParseType();
this.expect(22);
node.falseType = this.tsParseType();
return this.finishNode(node, "TSConditionalType");
}
isAbstractConstructorSignature() {
return this.isContextual("abstract") && this.lookahead().type === 76;
}
tsParseNonConditionalType() {
if (this.tsIsStartOfFunctionType()) {
return this.tsParseFunctionOrConstructorType("TSFunctionType");
}
if (this.match(76)) {
return this.tsParseFunctionOrConstructorType("TSConstructorType");
} else if (this.isAbstractConstructorSignature()) {
return this.tsParseFunctionOrConstructorType("TSConstructorType", true);
}
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) {
if (this.match(5)) {
node.id = this.parseIdentifier();
this.checkLVal(node.id, "typescript interface declaration", BIND_TS_INTERFACE);
} else {
node.id = null;
this.raise(this.state.start, TSErrors.MissingInterfaceName);
}
node.typeParameters = this.tsTryParseTypeParameters();
if (this.eat(80)) {
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, "typescript type alias", BIND_TS_TYPE);
node.typeParameters = this.tsTryParseTypeParameters();
node.typeAnnotation = this.tsInType(() => {
this.expect(35);
if (this.isContextual("intrinsic") && this.lookahead().type !== 24) {
const node = this.startNode();
this.next();
return this.finishNode(node, "TSIntrinsicKeyword");
}
return this.tsParseType();
});
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(4) ? this.parseExprAtom() : this.parseIdentifier(true);
if (this.eat(35)) {
node.initializer = this.parseMaybeAssignAllowIn();
}
return this.finishNode(node, "TSEnumMember");
}
tsParseEnumDeclaration(node, isConst) {
if (isConst) node.const = true;
node.id = this.parseIdentifier();
this.checkLVal(node.id, "typescript enum declaration", isConst ? BIND_TS_CONST_ENUM : BIND_TS_ENUM);
this.expect(13);
node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
this.expect(16);
return this.finishNode(node, "TSEnumDeclaration");
}
tsParseModuleBlock() {
const node = this.startNode();
this.scope.enter(SCOPE_OTHER);
this.expect(13);
this.parseBlockOrModuleBlockBody(node.body = [], undefined, true, 16);
this.scope.exit();
return this.finishNode(node, "TSModuleBlock");
}
tsParseModuleOrNamespaceDeclaration(node, nested = false) {
node.id = this.parseIdentifier();
if (!nested) {
this.checkLVal(node.id, "module or namespace declaration", BIND_TS_NAMESPACE);
}
if (this.eat(24)) {
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(4)) {
node.id = this.parseExprAtom();
} else {
this.unexpected();
}
if (this.match(13)) {
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, "import equals declaration", BIND_LEXICAL);
this.expect(35);
const moduleReference = this.tsParseModuleReference();
if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") {
this.raise(moduleReference.start, TSErrors.ImportAliasHasImportType);
}
node.moduleReference = moduleReference;
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(18);
if (!this.match(4)) {
throw this.unexpected();
}
node.expression = this.parseExprAtom();
this.expect(19);
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 = 73;
kind = "let";
}
return this.tsInAmbientContext(() => {
switch (starttype) {
case 67:
nany.declare = true;
return this.parseFunctionStatement(nany, false, true);
case 79:
nany.declare = true;
return this.parseClass(nany, true, false);
case 74:
if (this.match(74) && this.isLookaheadContextual("enum")) {
this.expect(74);
this.expectContextual("enum");
return this.tsParseEnumDeclaration(nany, true);
}
case 73:
kind = kind || this.state.value;
return this.parseVarStatement(nany, kind);
case 5:
{
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(13)) {
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.tsCheckLineTerminator(next) && (this.match(79) || this.match(5))) {
return this.tsParseAbstractDeclaration(node);
}
break;
case "enum":
if (next || this.match(5)) {
if (next) this.next();
return this.tsParseEnumDeclaration(node, false);
}
break;
case "interface":
if (this.tsCheckLineTerminator(next) && this.match(5)) {
return this.tsParseInterfaceDeclaration(node);
}
break;
case "module":
if (this.tsCheckLineTerminator(next)) {
if (this.match(4)) {
return this.tsParseAmbientExternalModuleDeclaration(node);
} else if (this.match(5)) {
return this.tsParseModuleOrNamespaceDeclaration(node);
}
}
break;
case "namespace":
if (this.tsCheckLineTerminator(next) && this.match(5)) {
return this.tsParseModuleOrNamespaceDeclaration(node);
}
break;
case "type":
if (this.tsCheckLineTerminator(next) && this.match(5)) {
return this.tsParseTypeAliasDeclaration(node);
}
break;
}
}
tsCheckLineTerminator(next) {
if (next) {
if (this.hasFollowingLineBreak()) return false;
this.next();
return true;
}
return !this.isLineTerminator();
}
tsTryParseGenericAsyncArrowFunction(startPos, startLoc) {
if (!this.isRelational("<")) {
return undefined;
}
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
this.state.maybeInArrowParameters = true;
const res = this.tsTryParseAndCatch(() => {
const node = this.startNodeAt(startPos, startLoc);
node.typeParameters = this.tsParseTypeParameters();
super.parseFunctionParams(node);
node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation();
this.expect(27);
return node;
});
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
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));
}));
if (node.params.length === 0) {
this.raise(node.start, TSErrors.EmptyTypeArguments);
}
this.expectRelational(">");
return this.finishNode(node, "TSTypeParameterInstantiation");
}
tsIsDeclarationStart() {
if (this.match(5)) {
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;
let override = false;
if (allowModifiers !== undefined) {
const modified = {};
this.tsParseModifiers(modified, ["public", "private", "protected", "override", "readonly"]);
accessibility = modified.accessibility;
override = modified.override;
readonly = modified.readonly;
if (allowModifiers === false && (accessibility || readonly || override)) {
this.raise(startPos, TSErrors.UnexpectedParameterModifier);
}
}
const left = this.parseMaybeDefault();
this.parseAssignableListItemTypes(left);
const elt = this.parseMaybeDefault(left.start, left.loc.start, left);
if (accessibility || readonly || override) {
const pp = this.startNodeAt(startPos, startLoc);
if (decorators.length) {
pp.decorators = decorators;
}
if (accessibility) pp.accessibility = accessibility;
if (readonly) pp.readonly = readonly;
if (override) pp.override = override;
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(22)) {
node.returnType = this.tsParseTypeOrTypePredicateAnnotation(22);
}
const bodilessType = type === "FunctionDeclaration" ? "TSDeclareFunction" : type === "ClassMethod" ? "TSDeclareMethod" : undefined;
if (bodilessType && !this.match(13) && this.isLineTerminator()) {
this.finishNode(node, bodilessType);
return;
}
if (bodilessType === "TSDeclareFunction" && this.state.isAmbientContext) {
this.raise(node.start, TSErrors.DeclareFunctionHasImplementation);
if (node.declare) {
super.parseFunctionBodyAndFinish(node, bodilessType, isMethod);
return;
}
}
super.parseFunctionBodyAndFinish(node, type, isMethod);
}
registerFunctionStatementId(node) {
if (!node.body && node.id) {
this.checkLVal(node.id, "function name", BIND_TS_AMBIENT);
} else {
super.registerFunctionStatementId(...arguments);
}
}
tsCheckForInvalidTypeCasts(items) {
items.forEach(node => {
if ((node == null ? void 0 : node.type) === "TSTypeCastExpression") {
this.raise(node.typeAnnotation.start, TSErrors.UnexpectedTypeAnnotation);
}
});
}
toReferencedList(exprList, isInParens) {
this.tsCheckForInvalidTypeCasts(exprList);
return exprList;
}
parseArrayLike(...args) {
const node = super.parseArrayLike(...args);
if (node.type === "ArrayExpression") {
this.tsCheckForInvalidTypeCasts(node.elements);
}
return node;
}
parseSubscript(base, startPos, startLoc, noCalls, state) {
if (!this.hasPrecedingLineBreak() && this.match(40)) {
this.state.exprAllowed = false;
this.next();
const nonNullExpression = this.startNodeAt(startPos, startLoc);
nonNullExpression.expression = base;
return this.finishNode(nonNullExpression, "TSNonNullExpression");
}
let isOptionalCall = false;
if (this.match(26) && this.lookaheadCharCode() === 60) {
if (noCalls) {
state.stop = true;
return base;
}
state.optionalChainMember = isOptionalCall = true;
this.next();
}
if (this.isRelational("<")) {
let missingParenErrorPos;
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 (isOptionalCall && !this.match(18)) {
missingParenErrorPos = this.state.pos;
this.unexpected();
}
if (!noCalls && this.eat(18)) {
node.arguments = this.parseCallExpressionArguments(19, false);
this.tsCheckForInvalidTypeCasts(node.arguments);
node.typeParameters = typeArguments;
if (state.optionalChainMember) {
node.optional = isOptionalCall;
}
return this.finishCallExpression(node, state.optionalChainMember);
} else if (this.match(30)) {
const result = this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
result.typeParameters = typeArguments;
return result;
}
}
this.unexpected();
});
if (missingParenErrorPos) {
this.unexpected(missingParenErrorPos, 18);
}
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(18)) this.unexpected();
return args;
});
if (typeParameters) {
node.typeParameters = typeParameters;
}
}
super.parseNewArguments(node);
}
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
if (tokenOperatorPrecedence(57) > 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");
this.reScan_lt_gt();
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec);
}
return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec);
}
checkReservedWord(word, startLoc, checkKeywords, isBinding) {}
checkDuplicateExports() {}
parseImport(node) {
node.importKind = "value";
if (this.match(5) || this.match(54) || this.match(13)) {
let ahead = this.lookahead();
if (this.isContextual("type") && ahead.type !== 20 && !(ahead.type === 5 && ahead.value === "from") && ahead.type !== 35) {
node.importKind = "type";
this.next();
ahead = this.lookahead();
}
if (this.match(5) && ahead.type === 35) {
return this.tsParseImportEqualsDeclaration(node);
}
}
const importNode = super.parseImport(node);
if (importNode.importKind === "type" && importNode.specifiers.length > 1 && importNode.specifiers[0].type === "ImportDefaultSpecifier") {
this.raise(importNode.start, TSErrors.TypeImportCannotSpecifyDefaultAndNamed);
}
return importNode;
}
parseExport(node) {
if (this.match(82)) {
this.next();
if (this.isContextual("type") && this.lookaheadCharCode() !== 61) {
node.importKind = "type";
this.next();
} else {
node.importKind = "value";
}
return this.tsParseImportEqualsDeclaration(node, true);
} else if (this.eat(35)) {
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 === 13) {
this.next();
node.exportKind = "type";
} else {
node.exportKind = "value";
}
return super.parseExport(node);
}
}
isAbstractClass() {
return this.isContextual("abstract") && this.lookahead().type === 79;
}
parseExportDefaultExpression() {
if (this.isAbstractClass()) {
const cls = this.startNode();
this.next();
cls.abstract = true;
this.parseClass(cls, true, true);
return cls;
}
if (this.state.value === "interface") {
const interfaceNode = this.startNode();
this.next();
const result = this.tsParseInterfaceDeclaration(interfaceNode);
if (result) return result;
}
return super.parseExportDefaultExpression();
}
parseStatementContent(context, topLevel) {
if (this.state.type === 74) {
const ahead = this.lookahead();
if (ahead.type === 5 && ahead.value === "enum") {
const node = this.startNode();
this.expect(74);
this.expectContextual("enum");
return this.tsParseEnumDeclaration(node, true);
}
}
return super.parseStatementContent(context, topLevel);
}
parseAccessModifier() {
return this.tsParseModifier(["public", "protected", "private"]);
}
tsHasSomeModifiers(member, modifiers) {
return modifiers.some(modifier => {
if (tsIsAccessModifier(modifier)) {
return member.accessibility === modifier;
}
return !!member[modifier];
});
}
tsIsStartOfStaticBlocks() {
return this.isContextual("static") && this.lookaheadCharCode() === 123;
}
parseClassMember(classBody, member, state) {
const modifiers = ["declare", "private", "public", "protected", "override", "abstract", "readonly", "static"];
this.tsParseModifiers(member, modifiers, undefined, undefined, true);
const callParseClassMemberWithIsStatic = () => {
if (this.tsIsStartOfStaticBlocks()) {
this.next();
this.next();
if (this.tsHasSomeModifiers(member, modifiers)) {
this.raise(this.state.pos, TSErrors.StaticBlockCannotHaveModifier);
}
this.parseClassStaticBlock(classBody, member);
} else {
this.parseClassMemberWithIsStatic(classBody, member, state, !!member.static);
}
};
if (member.declare) {
this.tsInAmbientContext(callParseClassMemberWithIsStatic);
} else {
callParseClassMemberWithIsStatic();
}
}
parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
const idx = this.tsTryParseIndexSignature(member);
if (idx) {
classBody.body.push(idx);
if (member.abstract) {
this.raise(member.start, TSErrors.IndexSignatureHasAbstract);
}
if (member.accessibility) {
this.raise(member.start, TSErrors.IndexSignatureHasAccessibility, member.accessibility);
}
if (member.declare) {
this.raise(member.start, TSErrors.IndexSignatureHasDeclare);
}
if (member.override) {
this.raise(member.start, TSErrors.IndexSignatureHasOverride);
}
return;
}
if (!this.state.inAbstractClass && member.abstract) {
this.raise(member.start, TSErrors.NonAbstractClassHasAbstractMethod);
}
if (member.override) {
if (!state.hadSuperClass) {
this.raise(member.start, TSErrors.OverrideNotInSubClass);
}
}
super.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
}
parsePostMemberNameModifiers(methodOrProp) {
const optional = this.eat(25);
if (optional) methodOrProp.optional = true;
if (methodOrProp.readonly && this.match(18)) {
this.raise(methodOrProp.start, TSErrors.ClassMethodHasReadonly);
}
if (methodOrProp.declare && this.match(18)) {
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, startPos, startLoc, refExpressionErrors) {
if (!this.state.maybeInArrowParameters || !this.match(25)) {
return super.parseConditional(expr, startPos, startLoc, refExpressionErrors);
}
const result = this.tryParse(() => super.parseConditional(expr, startPos, startLoc));
if (!result.node) {
if (result.error) {
super.setOptionalParametersError(refExpressionErrors, result.error);
}
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(25)) {
node.optional = true;
this.resetEndLocation(node);
}
if (this.match(22)) {
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");
if (isDeclare && (this.isContextual("declare") || !this.shouldParseExportDeclaration())) {
throw this.raise(this.state.start, TSErrors.ExpectedAmbientAfterExportDeclare);
}
let declaration;
if (this.match(5)) {
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(40)) {
node.definite = true;
}
const type = this.tsTryParseTypeAnnotation();
if (type) node.typeAnnotation = type;
}
parseClassProperty(node) {
this.parseClassPropertyAnnotation(node);
if (this.state.isAmbientContext && this.match(35)) {
this.raise(this.state.start, TSErrors.DeclareClassFieldHasInitializer);
}
if (node.abstract && this.match(35)) {
const {
key
} = node;
this.raise(this.state.start, TSErrors.AbstractPropertyHasInitializer, key.type === "Identifier" && !node.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`);
}
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 && isConstructor) {
this.raise(typeParameters.start, TSErrors.ConstructorHasTypeParameters);
}
if (method.declare && (method.kind === "get" || method.kind === "set")) {
this.raise(method.start, TSErrors.DeclareAccessor, method.kind);
}
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(40)) {
decl.definite = true;
}
const type = this.tsTryParseTypeAnnotation();
if (type) {
decl.id.typeAnnotation = type;
this.resetEndLocation(decl.id);
}
}
parseAsyncArrowFromCallExpression(node, call) {
if (this.match(22)) {
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.hasPlugin("jsx") && (this.match(94) || this.isRelational("<"))) {
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.j_oTag) {
context.length -= 2;
} else if (context[context.length - 1] === types.j_expr) {
context.length -= 1;
}
}
if (!((_jsx = jsx) != null && _jsx.error) && !this.isRelational("<")) {
return super.parseMaybeAssign(...args);
}
let typeParameters;
state = state || this.state.clone();
const arrow = this.tryParse(abort => {
var _expr$extra, _typeParameters;
typeParameters = this.tsParseTypeParameters();
const expr = super.parseMaybeAssign(...args);
if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _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 && _jsx2.node) {
this.state = jsx.failState;
return jsx.node;
}
if (arrow.node) {
this.state = arrow.failState;
return arrow.node;
}
if ((_typeCast = typeCast) != null && _typeCast.node) {
this.state = typeCast.failState;
return typeCast.node;
}
if ((_jsx3 = jsx) != null && _jsx3.thrown) throw jsx.error;
if (arrow.thrown) throw arrow.error;
if ((_typeCast2 = typeCast) != null && _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(22)) {
const result = this.tryParse(abort => {
const returnType = this.tsParseTypeOrTypePredicateAnnotation(22);
if (this.canInsertSemicolon() || !this.match(27)) 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(25)) {
if (param.type !== "Identifier" && !this.state.isAmbientContext && !this.state.inType) {
this.raise(param.start, TSErrors.PatternIsOptional);
}
param.optional = true;
}
const type = this.tsTryParseTypeAnnotation();
if (type) param.typeAnnotation = type;
this.resetEndLocation(param);
return param;
}
isAssignable(node, isBinding) {
switch (node.type) {
case "TSTypeCastExpression":
return this.isAssignable(node.expression, isBinding);
case "TSParameterProperty":
return true;
default:
return super.isAssignable(node, isBinding);
}
}
toAssignable(node, isLHS = false) {
switch (node.type) {
case "TSTypeCastExpression":
return super.toAssignable(this.typeCastToParameter(node), isLHS);
case "TSParameterProperty":
return super.toAssignable(node, isLHS);
case "ParenthesizedExpression":
return this.toAssignableParenthesizedExpression(node, isLHS);
case "TSAsExpression":
case "TSNonNullExpression":
case "TSTypeAssertion":
node.expression = this.toAssignable(node.expression, isLHS);
return node;
default:
return super.toAssignable(node, isLHS);
}
}
toAssignableParenthesizedExpression(node, isLHS) {
switch (node.expression.type) {
case "TSAsExpression":
case "TSNonNullExpression":
case "TSTypeAssertion":
case "ParenthesizedExpression":
node.expression = this.toAssignable(node.expression, isLHS);
return node;
default:
return super.toAssignable(node, isLHS);
}
}
checkLVal(expr, contextDescription, ...args) {
var _expr$extra2;
switch (expr.type) {
case "TSTypeCastExpression":
return;
case "TSParameterProperty":
this.checkLVal(expr.parameter, "parameter property", ...args);
return;
case "TSAsExpression":
case "TSTypeAssertion":
if (!args[0] && contextDescription !== "parenthesized expression" && !((_expr$extra2 = expr.extra) != null && _expr$extra2.parenthesized)) {
this.raise(expr.start, ErrorMessages.InvalidLhs, contextDescription);
break;
}
this.checkLVal(expr.expression, "parenthesized expression", ...args);
return;
case "TSNonNullExpression":
this.checkLVal(expr.expression, contextDescription, ...args);
return;
default:
super.checkLVal(expr, contextDescription, ...args);
return;
}
}
parseBindingAtom() {
switch (this.state.type) {
case 77:
return this.parseIdentifier(true);
default:
return super.parseBindingAtom();
}
}
parseMaybeDecoratorArguments(expr) {
if (this.isRelational("<")) {
const typeArguments = this.tsParseTypeArguments();
if (this.match(18)) {
const call = super.parseMaybeDecoratorArguments(expr);
call.typeParameters = typeArguments;
return call;
}
this.unexpected(this.state.start, 18);
}
return super.parseMaybeDecoratorArguments(expr);
}
checkCommaAfterRest(close) {
if (this.state.isAmbientContext && this.match(20) && this.lookaheadCharCode() === close) {
this.next();
} else {
super.checkCommaAfterRest(close);
}
}
isClassMethod() {
return this.isRelational("<") || super.isClassMethod();
}
isClassProperty() {
return this.match(40) || this.match(22) || 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(50, 1);
} else {
return super.getTokenFromCode(code);
}
}
reScan_lt_gt() {
if (this.match(50)) {
const code = this.input.charCodeAt(this.state.start);
if (code === 60 || code === 62) {
this.state.pos -= 1;
this.readToken_lt_gt(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;
}
shouldParseArrow(params) {
if (this.match(22)) {
return params.every(expr => this.isAssignable(expr, true));
}
return super.shouldParseArrow(params);
}
shouldParseAsyncArrow() {
return this.match(22) || 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 params = this.getObjectOrClassMethodParams(method);
const firstParam = params[0];
const hasContextParam = firstParam && this.isThisParam(firstParam);
return hasContextParam ? baseCount + 1 : baseCount;
}
parseCatchClauseParam() {
const param = super.parseCatchClauseParam();
const type = this.tsTryParseTypeAnnotation();
if (type) {
param.typeAnnotation = type;
this.resetEndLocation(param);
}
return param;
}
tsInAmbientContext(cb) {
const oldIsAmbientContext = this.state.isAmbientContext;
this.state.isAmbientContext = true;
try {
return cb();
} finally {
this.state.isAmbientContext = oldIsAmbientContext;
}
}
parseClass(node, ...args) {
const oldInAbstractClass = this.state.inAbstractClass;
this.state.inAbstractClass = !!node.abstract;
try {
return super.parseClass(node, ...args);
} finally {
this.state.inAbstractClass = oldInAbstractClass;
}
}
tsParseAbstractDeclaration(node) {
if (this.match(79)) {
node.abstract = true;
return this.parseClass(node, true, false);
} else if (this.isContextual("interface")) {
if (!this.hasFollowingLineBreak()) {
node.abstract = true;
this.raise(node.start, TSErrors.NonClassMethodPropertyHasAbstractModifer);
this.next();
return this.tsParseInterfaceDeclaration(node);
}
} else {
this.unexpected(null, 79);
}
}
parseMethod(...args) {
const method = super.parseMethod(...args);
if (method.abstract) {
const hasBody = this.hasPlugin("estree") ? !!method.value.body : !!method.body;
if (hasBody) {
const {
key
} = method;
this.raise(method.start, TSErrors.AbstractMethodHasImplementation, key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]`);
}
}
return method;
}
tsParseTypeParameterName() {
const typeName = this.parseIdentifier();
return typeName.name;
}
shouldParseAsAmbientContext() {
return !!this.getPluginOption("typescript", "dts");
}
parse() {
if (this.shouldParseAsAmbientContext()) {
this.state.isAmbientContext = true;
}
return super.parse();
}
getExpression() {
if (this.shouldParseAsAmbientContext()) {
this.state.isAmbientContext = true;
}
return super.getExpression();
}
});
const PlaceHolderErrors = makeErrorTemplates({
ClassNameIsRequired: "A class name is required."
}, ErrorCodes.SyntaxError);
var placeholders = (superClass => class extends superClass {
parsePlaceholder(expectedNode) {
if (this.match(96)) {
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(96);
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(96, 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);
}
isLet(context) {
if (super.isLet(context)) {
return true;
}
if (!this.isContextual("let")) {
return false;
}
if (context) return false;
const nextToken = this.lookahead();
if (nextToken.type === 96) {
return true;
}
return false;
}
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(22)) {
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 oldStrict = this.state.strict;
const placeholder = this.parsePlaceholder("Identifier");
if (placeholder) {
if (this.match(80) || this.match(96) || this.match(13)) {
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, PlaceHolderErrors.ClassNameIsRequired);
}
} else {
this.parseClassId(node, isStatement, optionalId);
}
this.parseClassSuper(node);
node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass, oldStrict);
return this.finishNode(node, type);
}
parseExport(node) {
const placeholder = this.parsePlaceholder("Identifier");
if (!placeholder) return super.parseExport(...arguments);
if (!this.isContextual("from") && !this.match(20)) {
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(64)) {
const next = this.nextTokenStart();
if (this.isUnparsedContextual(next, "from")) {
if (this.input.startsWith(tokenLabelName(96), 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 && 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(20)) {
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(20)) {
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(53)) {
const v8IntrinsicStart = this.state.start;
const node = this.startNode();
this.eat(53);
if (this.match(5)) {
const name = this.parseIdentifierName(this.state.start);
const identifier = this.createIdentifier(node, name);
identifier.type = "V8IntrinsicIdentifier";
if (this.match(18)) {
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", "fsharp", "hack", "smart"];
const TOPIC_TOKENS = ["%", "#"];
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")) {
const proposal = getPluginOption(plugins, "pipelineOperator", "proposal");
if (!PIPELINE_PROPOSALS.includes(proposal)) {
const proposalList = PIPELINE_PROPOSALS.map(p => `"${p}"`).join(", ");
throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
}
const tupleSyntaxIsHash = hasPlugin(plugins, "recordAndTuple") && getPluginOption(plugins, "recordAndTuple", "syntaxType") === "hash";
if (proposal === "hack") {
if (hasPlugin(plugins, "placeholders")) {
throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
}
if (hasPlugin(plugins, "v8intrinsic")) {
throw new Error("Cannot combine v8intrinsic plugin and Hack-style pipes.");
}
const topicToken = getPluginOption(plugins, "pipelineOperator", "topicToken");
if (!TOPIC_TOKENS.includes(topicToken)) {
const tokenList = TOPIC_TOKENS.map(t => `"${t}"`).join(", ");
throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
}
if (topicToken === "#" && tupleSyntaxIsHash) {
throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "hack", topicToken: "#" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
}
} else if (proposal === "smart" && tupleSyntaxIsHash) {
throw new Error('Plugin conflict between `["pipelineOperator", { proposal: "smart" }]` and `["recordAndtuple", { syntaxType: "hash"}]`.');
}
}
if (hasPlugin(plugins, "moduleAttributes")) {
{
if (hasPlugin(plugins, "importAssertions")) {
throw new Error("Cannot combine importAssertions and moduleAttributes plugins.");
}
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(", "));
}
if (hasPlugin(plugins, "asyncDoExpressions") && !hasPlugin(plugins, "doExpressions")) {
const error = new Error("'asyncDoExpressions' requires 'doExpressions', please add 'doExpressions' to parser plugins.");
error.missingPlugins = "doExpressions";
throw error;
}
}
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,
attachComment: true
};
function getOptions(opts) {
const options = {};
for (const key of Object.keys(defaultOptions)) {
options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key];
}
return options;
}
const unwrapParenthesizedExpression = node => {
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
};
class LValParser extends NodeUtils {
toAssignable(node, isLHS = false) {
var _node$extra, _node$extra3;
let parenthesized = undefined;
if (node.type === "ParenthesizedExpression" || (_node$extra = node.extra) != null && _node$extra.parenthesized) {
parenthesized = unwrapParenthesizedExpression(node);
if (isLHS) {
if (parenthesized.type === "Identifier") {
this.expressionScope.recordParenthesizedIdentifierError(node.start, ErrorMessages.InvalidParenthesizedAssignment);
} else if (parenthesized.type !== "MemberExpression") {
this.raise(node.start, ErrorMessages.InvalidParenthesizedAssignment);
}
} else {
this.raise(node.start, ErrorMessages.InvalidParenthesizedAssignment);
}
}
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
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, isLHS);
if (isLast && prop.type === "RestElement" && (_node$extra2 = node.extra) != null && _node$extra2.trailingComma) {
this.raiseRestNotLast(node.extra.trailingComma);
}
}
break;
case "ObjectProperty":
this.toAssignable(node.value, isLHS);
break;
case "SpreadElement":
{
this.checkToRestConversion(node);
node.type = "RestElement";
const arg = node.argument;
this.toAssignable(arg, isLHS);
break;
}
case "ArrayExpression":
node.type = "ArrayPattern";
this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingComma, isLHS);
break;
case "AssignmentExpression":
if (node.operator !== "=") {
this.raise(node.left.end, ErrorMessages.MissingEqInAssignment);
}
node.type = "AssignmentPattern";
delete node.operator;
this.toAssignable(node.left, isLHS);
break;
case "ParenthesizedExpression":
this.toAssignable(parenthesized, isLHS);
break;
}
return node;
}
toAssignableObjectExpressionProp(prop, isLast, isLHS) {
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, isLHS);
}
}
toAssignableList(exprList, trailingCommaPos, isLHS) {
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";
let arg = last.argument;
this.toAssignable(arg, isLHS);
arg = unwrapParenthesizedExpression(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, isLHS);
if (elt.type === "RestElement") {
this.raiseRestNotLast(elt.start);
}
}
}
return exprList;
}
isAssignable(node, isBinding) {
switch (node.type) {
case "Identifier":
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
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 => element === null || this.isAssignable(element));
case "AssignmentExpression":
return node.operator === "=";
case "ParenthesizedExpression":
return this.isAssignable(node.expression);
case "MemberExpression":
case "OptionalMemberExpression":
return !isBinding;
default:
return false;
}
}
toReferencedList(exprList, isParenthesizedExpr) {
return exprList;
}
toReferencedListDeep(exprList, isParenthesizedExpr) {
this.toReferencedList(exprList, isParenthesizedExpr);
for (const expr of exprList) {
if ((expr == null ? void 0 : expr.type) === "ArrayExpression") {
this.toReferencedListDeep(expr.elements);
}
}
}
parseSpread(refExpressionErrors, refNeedsArrowPos) {
const node = this.startNode();
this.next();
node.argument = this.parseMaybeAssignAllowIn(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 8:
{
const node = this.startNode();
this.next();
node.elements = this.parseBindingList(11, 93, true);
return this.finishNode(node, "ArrayPattern");
}
case 13:
return this.parseObjectLike(16, 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(20);
}
if (allowEmpty && this.match(20)) {
elts.push(null);
} else if (this.eat(close)) {
break;
} else if (this.match(29)) {
elts.push(this.parseAssignableListItemTypes(this.parseRestBinding()));
this.checkCommaAfterRest(closeCharCode);
this.expect(close);
break;
} else {
const decorators = [];
if (this.match(32) && this.hasPlugin("decorators")) {
this.raise(this.state.start, ErrorMessages.UnsupportedParameterDecorator);
}
while (this.match(32)) {
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) {
var _startLoc, _startPos, _left;
startLoc = (_startLoc = startLoc) != null ? _startLoc : this.state.startLoc;
startPos = (_startPos = startPos) != null ? _startPos : this.state.start;
left = (_left = left) != null ? _left : this.parseBindingAtom();
if (!this.eat(35)) return left;
const node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssignAllowIn();
return this.finishNode(node, "AssignmentPattern");
}
checkLVal(expr, contextDescription, bindingType = BIND_NONE, checkClashes, disallowLetBinding, strictModeChanged = false) {
switch (expr.type) {
case "Identifier":
{
const {
name
} = expr;
if (this.state.strict && (strictModeChanged ? isStrictBindReservedWord(name, this.inModule) : isStrictBindOnlyReservedWord(name))) {
this.raise(expr.start, bindingType === BIND_NONE ? ErrorMessages.StrictEvalArguments : ErrorMessages.StrictEvalArgumentsBinding, name);
}
if (checkClashes) {
if (checkClashes.has(name)) {
this.raise(expr.start, ErrorMessages.ParamDupe);
} else {
checkClashes.add(name);
}
}
if (disallowLetBinding && name === "let") {
this.raise(expr.start, ErrorMessages.LetInLexicalBinding);
}
if (!(bindingType & BIND_NONE)) {
this.scope.declareName(name, bindingType, expr.start);
}
break;
}
case "MemberExpression":
if (bindingType !== BIND_NONE) {
this.raise(expr.start, ErrorMessages.InvalidPropertyBindingPattern);
}
break;
case "ObjectPattern":
for (let prop of expr.properties) {
if (this.isObjectProperty(prop)) prop = prop.value;else if (this.isObjectMethod(prop)) continue;
this.checkLVal(prop, "object destructuring pattern", bindingType, checkClashes, disallowLetBinding);
}
break;
case "ArrayPattern":
for (const elem of expr.elements) {
if (elem) {
this.checkLVal(elem, "array destructuring pattern", bindingType, checkClashes, disallowLetBinding);
}
}
break;
case "AssignmentPattern":
this.checkLVal(expr.left, "assignment pattern", bindingType, checkClashes);
break;
case "RestElement":
this.checkLVal(expr.argument, "rest element", bindingType, checkClashes);
break;
case "ParenthesizedExpression":
this.checkLVal(expr.expression, "parenthesized expression", bindingType, checkClashes);
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(20)) {
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);
}
}
const invalidHackPipeBodies = new Map([["ArrowFunctionExpression", "arrow function"], ["AssignmentExpression", "assignment"], ["ConditionalExpression", "conditional"], ["YieldExpression", "yield"]]);
class ExpressionParser extends LValParser {
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || 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;
}
}
shouldExitDescending(expr, potentialArrowAt) {
return expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt;
}
getExpression() {
this.enterInitialScopes();
this.nextToken();
const expr = this.parseExpression();
if (!this.match(7)) {
this.unexpected();
}
this.finalizeRemainingComments();
expr.comments = this.state.comments;
expr.errors = this.state.errors;
if (this.options.tokens) {
expr.tokens = this.tokens;
}
return expr;
}
parseExpression(disallowIn, refExpressionErrors) {
if (disallowIn) {
return this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors));
}
return this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors));
}
parseExpressionBase(refExpressionErrors) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const expr = this.parseMaybeAssign(refExpressionErrors);
if (this.match(20)) {
const node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(20)) {
node.expressions.push(this.parseMaybeAssign(refExpressionErrors));
}
this.toReferencedList(node.expressions);
return this.finishNode(node, "SequenceExpression");
}
return expr;
}
parseMaybeAssignDisallowIn(refExpressionErrors, afterLeftParse) {
return this.disallowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
}
parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
}
setOptionalParametersError(refExpressionErrors, resultError) {
var _resultError$pos;
refExpressionErrors.optionalParameters = (_resultError$pos = resultError == null ? void 0 : resultError.pos) != null ? _resultError$pos : this.state.start;
}
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
if (this.isContextual("yield")) {
if (this.prodParam.hasYield) {
let left = this.parseYield();
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
return left;
}
}
let ownExpressionErrors;
if (refExpressionErrors) {
ownExpressionErrors = false;
} else {
refExpressionErrors = new ExpressionErrors();
ownExpressionErrors = true;
}
if (this.match(18) || this.match(5)) {
this.state.potentialArrowAt = this.state.start;
}
let left = this.parseMaybeConditional(refExpressionErrors);
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
if (tokenIsAssignment(this.state.type)) {
const node = this.startNodeAt(startPos, startLoc);
const operator = this.state.value;
node.operator = operator;
if (this.match(35)) {
node.left = this.toAssignable(left, true);
refExpressionErrors.doubleProto = -1;
} else {
node.left = left;
}
if (refExpressionErrors.shorthandAssign >= node.left.start) {
refExpressionErrors.shorthandAssign = -1;
}
this.checkLVal(left, "assignment expression");
this.next();
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentExpression");
} else if (ownExpressionErrors) {
this.checkExpressionErrors(refExpressionErrors, true);
}
return left;
}
parseMaybeConditional(refExpressionErrors) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const potentialArrowAt = this.state.potentialArrowAt;
const expr = this.parseExprOps(refExpressionErrors);
if (this.shouldExitDescending(expr, potentialArrowAt)) {
return expr;
}
return this.parseConditional(expr, startPos, startLoc, refExpressionErrors);
}
parseConditional(expr, startPos, startLoc, refExpressionErrors) {
if (this.eat(25)) {
const node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssignAllowIn();
this.expect(22);
node.alternate = this.parseMaybeAssign();
return this.finishNode(node, "ConditionalExpression");
}
return expr;
}
parseMaybeUnaryOrPrivate(refExpressionErrors) {
return this.match(6) ? this.parsePrivateName() : this.parseMaybeUnary(refExpressionErrors);
}
parseExprOps(refExpressionErrors) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const potentialArrowAt = this.state.potentialArrowAt;
const expr = this.parseMaybeUnaryOrPrivate(refExpressionErrors);
if (this.shouldExitDescending(expr, potentialArrowAt)) {
return expr;
}
return this.parseExprOp(expr, startPos, startLoc, -1);
}
parseExprOp(left, leftStartPos, leftStartLoc, minPrec) {
if (this.isPrivateName(left)) {
const value = this.getPrivateNameSV(left);
const {
start
} = left;
if (minPrec >= tokenOperatorPrecedence(57) || !this.prodParam.hasIn || !this.match(57)) {
this.raise(start, ErrorMessages.PrivateInExpectedIn, value);
}
this.classScope.usePrivateName(value, start);
}
const op = this.state.type;
if (tokenIsOperator(op) && (this.prodParam.hasIn || !this.match(57))) {
let prec = tokenOperatorPrecedence(op);
if (prec > minPrec) {
if (op === 42) {
this.expectPlugin("pipelineOperator");
if (this.state.inFSharpPipelineDirectBody) {
return left;
}
this.checkPipelineAtInfixOperator(left, leftStartPos);
}
const node = this.startNodeAt(leftStartPos, leftStartLoc);
node.left = left;
node.operator = this.state.value;
const logical = op === 44 || op === 45;
const coalesce = op === 43;
if (coalesce) {
prec = tokenOperatorPrecedence(45);
}
this.next();
if (op === 42 && this.getPluginOption("pipelineOperator", "proposal") === "minimal") {
if (this.match(5) && this.state.value === "await" && this.prodParam.hasAwait) {
throw this.raise(this.state.start, ErrorMessages.UnexpectedAwaitAfterPipelineBody);
}
}
node.right = this.parseExprOpRightExpr(op, prec);
this.finishNode(node, logical || coalesce ? "LogicalExpression" : "BinaryExpression");
const nextOp = this.state.type;
if (coalesce && (nextOp === 44 || nextOp === 45) || logical && nextOp === 43) {
throw this.raise(this.state.start, ErrorMessages.MixingCoalesceWithLogical);
}
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec);
}
}
return left;
}
parseExprOpRightExpr(op, prec) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
switch (op) {
case 42:
switch (this.getPluginOption("pipelineOperator", "proposal")) {
case "hack":
return this.withTopicBindingContext(() => {
return this.parseHackPipeBody();
});
case "smart":
return this.withTopicBindingContext(() => {
if (this.prodParam.hasYield && this.isContextual("yield")) {
throw this.raise(this.state.start, ErrorMessages.PipeBodyIsTighter, this.state.value);
}
return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startPos, startLoc);
});
case "fsharp":
return this.withSoloAwaitPermittingContext(() => {
return this.parseFSharpPipelineBody(prec);
});
}
default:
return this.parseExprOpBaseRightExpr(op, prec);
}
}
parseExprOpBaseRightExpr(op, prec) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
return this.parseExprOp(this.parseMaybeUnaryOrPrivate(), startPos, startLoc, tokenIsRightAssociative(op) ? prec - 1 : prec);
}
parseHackPipeBody() {
var _body$extra;
const {
start
} = this.state;
const body = this.parseMaybeAssign();
if (invalidHackPipeBodies.has(body.type) && !((_body$extra = body.extra) != null && _body$extra.parenthesized)) {
this.raise(start, ErrorMessages.PipeUnparenthesizedBody, invalidHackPipeBodies.get(body.type));
}
if (!this.topicReferenceWasUsedInCurrentContext()) {
this.raise(start, ErrorMessages.PipeTopicUnused);
}
return body;
}
checkExponentialAfterUnary(node) {
if (this.match(56)) {
this.raise(node.argument.start, ErrorMessages.UnexpectedTokenUnaryExponentiation);
}
}
parseMaybeUnary(refExpressionErrors, sawUnary) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
const isAwait = this.isContextual("await");
if (isAwait && this.isAwaitAllowed()) {
this.next();
const expr = this.parseAwait(startPos, startLoc);
if (!sawUnary) this.checkExponentialAfterUnary(expr);
return expr;
}
const update = this.match(39);
const node = this.startNode();
if (tokenIsPrefix(this.state.type)) {
node.operator = this.state.value;
node.prefix = true;
if (this.match(71)) {
this.expectPlugin("throwExpressions");
}
const isDelete = this.match(88);
this.next();
node.argument = this.parseMaybeUnary(null, true);
this.checkExpressionErrors(refExpressionErrors, true);
if (this.state.strict && isDelete) {
const arg = node.argument;
if (arg.type === "Identifier") {
this.raise(node.start, ErrorMessages.StrictDelete);
} else if (this.hasPropertyAsPrivateName(arg)) {
this.raise(node.start, ErrorMessages.DeletePrivateField);
}
}
if (!update) {
if (!sawUnary) this.checkExponentialAfterUnary(node);
return this.finishNode(node, "UnaryExpression");
}
}
const expr = this.parseUpdate(node, update, refExpressionErrors);
if (isAwait) {
const {
type
} = this.state;
const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(53);
if (startsExpr && !this.isAmbiguousAwait()) {
this.raiseOverwrite(startPos, ErrorMessages.AwaitNotInAsyncContext);
return this.parseAwait(startPos, startLoc);
}
}
return expr;
}
parseUpdate(node, update, refExpressionErrors) {
if (update) {
this.checkLVal(node.argument, "prefix operation");
return this.finishNode(node, "UpdateExpression");
}
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let expr = this.parseExprSubscripts(refExpressionErrors);
if (this.checkExpressionErrors(refExpressionErrors, false)) return expr;
while (tokenIsPostfix(this.state.type) && !this.canInsertSemicolon()) {
const node = this.startNodeAt(startPos, startLoc);
node.operator = this.state.value;
node.prefix = false;
node.argument = expr;
this.checkLVal(expr, "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 (this.shouldExitDescending(expr, 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 {
base = this.parseSubscript(base, startPos, startLoc, noCalls, state);
state.maybeAsyncArrow = false;
} while (!state.stop);
return base;
}
parseSubscript(base, startPos, startLoc, noCalls, state) {
if (!noCalls && this.eat(23)) {
return this.parseBind(base, startPos, startLoc, noCalls, state);
} else if (this.match(30)) {
return this.parseTaggedTemplateExpression(base, startPos, startLoc, state);
}
let optional = false;
if (this.match(26)) {
if (noCalls && this.lookaheadCharCode() === 40) {
state.stop = true;
return base;
}
state.optionalChainMember = optional = true;
this.next();
}
if (!noCalls && this.match(18)) {
return this.parseCoverCallAndAsyncArrowHead(base, startPos, startLoc, state, optional);
} else {
const computed = this.eat(8);
if (computed || optional || this.eat(24)) {
return this.parseMember(base, startPos, startLoc, state, computed, optional);
} else {
state.stop = true;
return base;
}
}
}
parseMember(base, startPos, startLoc, state, computed, optional) {
const node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.computed = computed;
const privateName = !computed && this.match(6) && this.state.value;
const property = computed ? this.parseExpression() : privateName ? this.parsePrivateName() : this.parseIdentifier(true);
if (privateName !== false) {
if (node.object.type === "Super") {
this.raise(startPos, ErrorMessages.SuperPrivateField);
}
this.classScope.usePrivateName(privateName, property.start);
}
node.property = property;
if (computed) {
this.expect(11);
}
if (state.optionalChainMember) {
node.optional = optional;
return this.finishNode(node, "OptionalMemberExpression");
} else {
return this.finishNode(node, "MemberExpression");
}
}
parseBind(base, startPos, startLoc, noCalls, state) {
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);
}
parseCoverCallAndAsyncArrowHead(base, startPos, startLoc, state, optional) {
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
let refExpressionErrors = null;
this.state.maybeInArrowParameters = true;
this.next();
let node = this.startNodeAt(startPos, startLoc);
node.callee = base;
if (state.maybeAsyncArrow) {
this.expressionScope.enter(newAsyncArrowScope());
refExpressionErrors = new ExpressionErrors();
}
if (state.optionalChainMember) {
node.optional = optional;
}
if (optional) {
node.arguments = this.parseCallExpressionArguments(19);
} else {
node.arguments = this.parseCallExpressionArguments(19, base.type === "Import", base.type !== "Super", node, refExpressionErrors);
}
this.finishCallExpression(node, state.optionalChainMember);
if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
state.stop = true;
this.expressionScope.validateAsPattern();
this.expressionScope.exit();
node = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), node);
} else {
if (state.maybeAsyncArrow) {
this.checkExpressionErrors(refExpressionErrors, true);
this.expressionScope.exit();
}
this.toReferencedArguments(node);
}
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
return node;
}
toReferencedArguments(node, isParenthesizedExpr) {
this.toReferencedListDeep(node.arguments, isParenthesizedExpr);
}
parseTaggedTemplateExpression(base, startPos, startLoc, state) {
const node = this.startNodeAt(startPos, startLoc);
node.tag = base;
node.quasi = this.parseTemplate(true);
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) {
{
if (!this.hasPlugin("moduleAttributes")) {
this.expectPlugin("importAssertions");
}
}
}
if (node.arguments.length === 0 || node.arguments.length > 2) {
this.raise(node.start, ErrorMessages.ImportCallArity, this.hasPlugin("importAssertions") || this.hasPlugin("moduleAttributes") ? "one or two arguments" : "one argument");
} else {
for (const arg of node.arguments) {
if (arg.type === "SpreadElement") {
this.raise(arg.start, ErrorMessages.ImportCallSpreadArgument);
}
}
}
}
return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
}
parseCallExpressionArguments(close, dynamicImport, allowPlaceholder, nodeForExtra, refExpressionErrors) {
const elts = [];
let first = true;
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = false;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(20);
if (this.match(close)) {
if (dynamicImport && !this.hasPlugin("importAssertions") && !this.hasPlugin("moduleAttributes")) {
this.raise(this.state.lastTokStart, ErrorMessages.ImportCallArgumentTrailingComma);
}
if (nodeForExtra) {
this.addExtra(nodeForExtra, "trailingComma", this.state.lastTokStart);
}
this.next();
break;
}
}
elts.push(this.parseExprListItem(false, refExpressionErrors, allowPlaceholder));
}
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return elts;
}
shouldParseAsyncArrow() {
return this.match(27) && !this.canInsertSemicolon();
}
parseAsyncArrowFromCallExpression(node, call) {
var _call$extra;
this.resetPreviousNodeTrailingComments(call);
this.expect(27);
this.parseArrowExpression(node, call.arguments, true, (_call$extra = call.extra) == null ? void 0 : _call$extra.trailingComma);
setInnerComments(node, call.innerComments);
setInnerComments(node, call.callee.trailingComments);
return node;
}
parseNoCallExpr() {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
}
parseExprAtom(refExpressionErrors) {
let node;
switch (this.state.type) {
case 78:
return this.parseSuper();
case 82:
node = this.startNode();
this.next();
if (this.match(24)) {
return this.parseImportMetaProperty(node);
}
if (!this.match(18)) {
this.raise(this.state.lastTokStart, ErrorMessages.UnsupportedImport);
}
return this.finishNode(node, "Import");
case 77:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression");
case 5:
{
if (this.isContextual("module") && this.lookaheadCharCode() === 123 && !this.hasFollowingLineBreak()) {
return this.parseModuleExpression();
}
const canBeArrow = this.state.potentialArrowAt === this.state.start;
const containsEsc = this.state.containsEsc;
const id = this.parseIdentifier();
if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) {
if (this.match(67)) {
this.resetPreviousNodeTrailingComments(id);
this.next();
return this.parseFunction(this.startNodeAtNode(id), undefined, true);
} else if (this.match(5)) {
if (this.lookaheadCharCode() === 61) {
return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));
} else {
return id;
}
} else if (this.match(89)) {
this.resetPreviousNodeTrailingComments(id);
return this.parseDo(this.startNodeAtNode(id), true);
}
}
if (canBeArrow && this.match(27) && !this.canInsertSemicolon()) {
this.next();
return this.parseArrowExpression(this.startNodeAtNode(id), [id], false);
}
return id;
}
case 89:
{
return this.parseDo(this.startNode(), false);
}
case 55:
case 37:
{
this.readRegexp();
return this.parseRegExpLiteral(this.state.value);
}
case 0:
return this.parseNumericLiteral(this.state.value);
case 1:
return this.parseBigIntLiteral(this.state.value);
case 2:
return this.parseDecimalLiteral(this.state.value);
case 4:
return this.parseStringLiteral(this.state.value);
case 83:
return this.parseNullLiteral();
case 84:
return this.parseBooleanLiteral(true);
case 85:
return this.parseBooleanLiteral(false);
case 18:
{
const canBeArrow = this.state.potentialArrowAt === this.state.start;
return this.parseParenAndDistinguishExpression(canBeArrow);
}
case 10:
case 9:
{
return this.parseArrayLike(this.state.type === 10 ? 12 : 11, false, true, refExpressionErrors);
}
case 8:
{
return this.parseArrayLike(11, true, false, refExpressionErrors);
}
case 14:
case 15:
{
return this.parseObjectLike(this.state.type === 14 ? 17 : 16, false, true, refExpressionErrors);
}
case 13:
{
return this.parseObjectLike(16, false, false, refExpressionErrors);
}
case 67:
return this.parseFunctionOrFunctionSent();
case 32:
this.parseDecorators();
case 79:
node = this.startNode();
this.takeDecorators(node);
return this.parseClass(node, false);
case 76:
return this.parseNewOrNewTarget();
case 30:
return this.parseTemplate(false);
case 23:
{
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 6:
{
this.raise(this.state.start, ErrorMessages.PrivateInExpectedIn, this.state.value);
return this.parsePrivateName();
}
case 38:
if (this.getPluginOption("pipelineOperator", "proposal") === "hack" && this.getPluginOption("pipelineOperator", "topicToken") === "%") {
this.state.value = "%";
this.state.type = 53;
this.state.pos--;
this.state.end--;
this.state.endLoc.column--;
} else {
throw this.unexpected();
}
case 53:
case 33:
{
const pipeProposal = this.getPluginOption("pipelineOperator", "proposal");
if (pipeProposal) {
node = this.startNode();
const start = this.state.start;
const tokenType = this.state.type;
this.next();
return this.finishTopicReference(node, start, pipeProposal, tokenType);
}
}
case 50:
{
if (this.state.value === "<") {
const lookaheadCh = this.input.codePointAt(this.nextTokenStart());
if (isIdentifierStart(lookaheadCh) || lookaheadCh === 62) {
this.expectOnePlugin(["jsx", "flow", "typescript"]);
}
}
}
default:
throw this.unexpected();
}
}
finishTopicReference(node, start, pipeProposal, tokenType) {
if (this.testTopicReferenceConfiguration(pipeProposal, start, tokenType)) {
let nodeType;
if (pipeProposal === "smart") {
nodeType = "PipelinePrimaryTopicReference";
} else {
nodeType = "TopicReference";
}
if (!this.topicReferenceIsAllowedInCurrentContext()) {
if (pipeProposal === "smart") {
this.raise(start, ErrorMessages.PrimaryTopicNotAllowed);
} else {
this.raise(start, ErrorMessages.PipeTopicUnbound);
}
}
this.registerTopicReference();
return this.finishNode(node, nodeType);
} else {
throw this.raise(start, ErrorMessages.PipeTopicUnconfiguredToken, tokenLabelName(tokenType));
}
}
testTopicReferenceConfiguration(pipeProposal, start, tokenType) {
switch (pipeProposal) {
case "hack":
{
const pluginTopicToken = this.getPluginOption("pipelineOperator", "topicToken");
return tokenLabelName(tokenType) === pluginTopicToken;
}
case "smart":
return tokenType === 33;
default:
throw this.raise(start, ErrorMessages.PipeTopicRequiresHackPipes);
}
}
parseAsyncArrowUnaryFunction(node) {
this.prodParam.enter(functionFlags(true, this.prodParam.hasYield));
const params = [this.parseIdentifier()];
this.prodParam.exit();
if (this.hasPrecedingLineBreak()) {
this.raise(this.state.pos, ErrorMessages.LineTerminatorBeforeArrow);
}
this.expect(27);
this.parseArrowExpression(node, params, true);
return node;
}
parseDo(node, isAsync) {
this.expectPlugin("doExpressions");
if (isAsync) {
this.expectPlugin("asyncDoExpressions");
}
node.async = isAsync;
this.next();
const oldLabels = this.state.labels;
this.state.labels = [];
if (isAsync) {
this.prodParam.enter(PARAM_AWAIT);
node.body = this.parseBlock();
this.prodParam.exit();
} else {
node.body = this.parseBlock();
}
this.state.labels = oldLabels;
return this.finishNode(node, "DoExpression");
}
parseSuper() {
const node = this.startNode();
this.next();
if (this.match(18) && !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(18) && !this.match(8) && !this.match(24)) {
this.raise(node.start, ErrorMessages.UnsupportedSuper);
}
return this.finishNode(node, "Super");
}
parseMaybePrivateName(isPrivateNameAllowed) {
const isPrivate = this.match(6);
if (isPrivate) {
if (!isPrivateNameAllowed) {
this.raise(this.state.start + 1, ErrorMessages.UnexpectedPrivateField);
}
return this.parsePrivateName();
} else {
return this.parseIdentifier(true);
}
}
parsePrivateName() {
const node = this.startNode();
const id = this.startNodeAt(this.state.start + 1, new Position(this.state.curLine, this.state.start + 1 - this.state.lineStart));
const name = this.state.value;
this.next();
node.id = this.createIdentifier(id, name);
return this.finishNode(node, "PrivateName");
}
parseFunctionOrFunctionSent() {
const node = this.startNode();
this.next();
if (this.prodParam.hasYield && this.match(24)) {
const meta = this.createIdentifier(this.startNodeAtNode(node), "function");
this.next();
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.next();
if (this.isContextual("meta")) {
if (!this.inModule) {
this.raise(id.start, SourceTypeModuleErrorMessages.ImportMetaOutsideModule);
}
this.sawUnambiguousESM = true;
}
return this.parseMetaProperty(node, id, "meta");
}
parseLiteralAtNode(value, type, node) {
this.addExtra(node, "rawValue", value);
this.addExtra(node, "raw", this.input.slice(node.start, this.state.end));
node.value = value;
this.next();
return this.finishNode(node, type);
}
parseLiteral(value, type) {
const node = this.startNode();
return this.parseLiteralAtNode(value, type, node);
}
parseStringLiteral(value) {
return this.parseLiteral(value, "StringLiteral");
}
parseNumericLiteral(value) {
return this.parseLiteral(value, "NumericLiteral");
}
parseBigIntLiteral(value) {
return this.parseLiteral(value, "BigIntLiteral");
}
parseDecimalLiteral(value) {
return this.parseLiteral(value, "DecimalLiteral");
}
parseRegExpLiteral(value) {
const node = this.parseLiteral(value.value, "RegExpLiteral");
node.pattern = value.pattern;
node.flags = value.flags;
return node;
}
parseBooleanLiteral(value) {
const node = this.startNode();
node.value = value;
this.next();
return this.finishNode(node, "BooleanLiteral");
}
parseNullLiteral() {
const node = this.startNode();
this.next();
return this.finishNode(node, "NullLiteral");
}
parseParenAndDistinguishExpression(canBeArrow) {
const startPos = this.state.start;
const startLoc = this.state.startLoc;
let val;
this.next();
this.expressionScope.enter(newArrowHeadScope());
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.maybeInArrowParameters = true;
this.state.inFSharpPipelineDirectBody = false;
const innerStartPos = this.state.start;
const innerStartLoc = this.state.startLoc;
const exprList = [];
const refExpressionErrors = new ExpressionErrors();
let first = true;
let spreadStart;
let optionalCommaStart;
while (!this.match(19)) {
if (first) {
first = false;
} else {
this.expect(20, refExpressionErrors.optionalParameters === -1 ? null : refExpressionErrors.optionalParameters);
if (this.match(19)) {
optionalCommaStart = this.state.start;
break;
}
}
if (this.match(29)) {
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.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
}
}
const innerEndPos = this.state.lastTokEnd;
const innerEndLoc = this.state.lastTokEndLoc;
this.expect(19);
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
let arrowNode = this.startNodeAt(startPos, startLoc);
if (canBeArrow && this.shouldParseArrow(exprList) && (arrowNode = this.parseArrow(arrowNode))) {
this.expressionScope.validateAsPattern();
this.expressionScope.exit();
this.parseArrowExpression(arrowNode, exprList, false);
return arrowNode;
}
this.expressionScope.exit();
if (!exprList.length) {
this.unexpected(this.state.lastTokStart);
}
if (optionalCommaStart) this.unexpected(optionalCommaStart);
if (spreadStart) this.unexpected(spreadStart);
this.checkExpressionErrors(refExpressionErrors, true);
this.toReferencedListDeep(exprList, true);
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNode(val, "SequenceExpression");
this.resetEndLocation(val, 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(params) {
return !this.canInsertSemicolon();
}
parseArrow(node) {
if (this.eat(27)) {
return node;
}
}
parseParenItem(node, startPos, startLoc) {
return node;
}
parseNewOrNewTarget() {
const node = this.startNode();
this.next();
if (this.match(24)) {
const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
this.next();
const metaProp = this.parseMetaProperty(node, meta, "target");
if (!this.scope.inNonArrowFunction && !this.scope.inClass) {
this.raise(metaProp.start, ErrorMessages.UnexpectedNewTarget);
}
return metaProp;
}
return this.parseNew(node);
}
parseNew(node) {
node.callee = this.parseNoCallExpr();
if (node.callee.type === "Import") {
this.raise(node.callee.start, ErrorMessages.ImportCallNotNewExpression);
} else if (this.isOptionalChain(node.callee)) {
this.raise(this.state.lastTokEnd, ErrorMessages.OptionalChainingNoNew);
} else if (this.eat(26)) {
this.raise(this.state.start, ErrorMessages.OptionalChainingNoNew);
}
this.parseNewArguments(node);
return this.finishNode(node, "NewExpression");
}
parseNewArguments(node) {
if (this.eat(18)) {
const args = this.parseExprList(19);
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(30);
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(31);
node.expressions.push(this.parseTemplateSubstitution());
this.expect(16);
node.quasis.push(curElt = this.parseTemplateElement(isTagged));
}
this.next();
return this.finishNode(node, "TemplateLiteral");
}
parseTemplateSubstitution() {
return this.parseExpression();
}
parseObjectLike(close, isPattern, isRecord, refExpressionErrors) {
if (isRecord) {
this.expectPlugin("recordAndTuple");
}
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = false;
const propHash = Object.create(null);
let first = true;
const node = this.startNode();
node.properties = [];
this.next();
while (!this.match(close)) {
if (first) {
first = false;
} else {
this.expect(20);
if (this.match(close)) {
this.addExtra(node, "trailingComma", this.state.lastTokStart);
break;
}
}
const prop = this.parsePropertyDefinition(isPattern, refExpressionErrors);
if (!isPattern) {
this.checkProto(prop, isRecord, propHash, refExpressionErrors);
}
if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
this.raise(prop.start, ErrorMessages.InvalidRecordProperty);
}
if (prop.shorthand) {
this.addExtra(prop, "shorthand", true);
}
node.properties.push(prop);
}
this.next();
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
let type = "ObjectExpression";
if (isPattern) {
type = "ObjectPattern";
} else if (isRecord) {
type = "RecordExpression";
}
return this.finishNode(node, type);
}
maybeAsyncOrAccessorProp(prop) {
return !prop.computed && prop.key.type === "Identifier" && (this.isLiteralPropertyName() || this.match(8) || this.match(54));
}
parsePropertyDefinition(isPattern, refExpressionErrors) {
let decorators = [];
if (this.match(32)) {
if (this.hasPlugin("decorators")) {
this.raise(this.state.start, ErrorMessages.UnsupportedPropertyDecorator);
}
while (this.match(32)) {
decorators.push(this.parseDecorator());
}
}
const prop = this.startNode();
let isGenerator = false;
let isAsync = false;
let isAccessor = false;
let startPos;
let startLoc;
if (this.match(29)) {
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(54);
}
const containsEsc = this.state.containsEsc;
const key = this.parsePropertyName(prop, false);
if (!isPattern && !isGenerator && !containsEsc && this.maybeAsyncOrAccessorProp(prop)) {
const keyName = key.name;
if (keyName === "async" && !this.hasPrecedingLineBreak()) {
isAsync = true;
this.resetPreviousNodeTrailingComments(key);
isGenerator = this.eat(54);
this.parsePropertyName(prop, false);
}
if (keyName === "get" || keyName === "set") {
isAccessor = true;
this.resetPreviousNodeTrailingComments(key);
prop.kind = keyName;
if (this.match(54)) {
isGenerator = true;
this.raise(this.state.pos, ErrorMessages.AccessorIsGenerator, keyName);
this.next();
}
this.parsePropertyName(prop, false);
}
}
this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors);
return prop;
}
getGetterSetterExpectedParamCount(method) {
return method.kind === "get" ? 0 : 1;
}
getObjectOrClassMethodParams(method) {
return method.params;
}
checkGetterSetterParams(method) {
var _params;
const paramCount = this.getGetterSetterExpectedParamCount(method);
const params = this.getObjectOrClassMethodParams(method);
const start = method.start;
if (params.length !== paramCount) {
if (method.kind === "get") {
this.raise(start, ErrorMessages.BadGetterArity);
} else {
this.raise(start, ErrorMessages.BadSetterArity);
}
}
if (method.kind === "set" && ((_params = params[params.length - 1]) == null ? void 0 : _params.type) === "RestElement") {
this.raise(start, ErrorMessages.BadSetterRestParameter);
}
}
parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) {
if (isAccessor) {
this.parseMethod(prop, isGenerator, false, false, false, "ObjectMethod");
this.checkGetterSetterParams(prop);
return prop;
}
if (isAsync || isGenerator || this.match(18)) {
if (isPattern) this.unexpected();
prop.kind = "method";
prop.method = true;
return this.parseMethod(prop, isGenerator, isAsync, false, false, "ObjectMethod");
}
}
parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors) {
prop.shorthand = false;
if (this.eat(22)) {
prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors);
return this.finishNode(prop, "ObjectProperty");
}
if (!prop.computed && prop.key.type === "Identifier") {
this.checkReservedWord(prop.key.name, prop.key.start, true, false);
if (isPattern) {
prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
} else if (this.match(35) && refExpressionErrors) {
if (refExpressionErrors.shorthandAssign === -1) {
refExpressionErrors.shorthandAssign = this.state.start;
}
prop.value = this.parseMaybeDefault(startPos, startLoc, cloneIdentifier(prop.key));
} else {
prop.value = cloneIdentifier(prop.key);
}
prop.shorthand = true;
return this.finishNode(prop, "ObjectProperty");
}
}
parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, isAccessor, refExpressionErrors) {
const node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refExpressionErrors);
if (!node) this.unexpected();
return node;
}
parsePropertyName(prop, isPrivateNameAllowed) {
if (this.eat(8)) {
prop.computed = true;
prop.key = this.parseMaybeAssignAllowIn();
this.expect(11);
} else {
const oldInPropertyName = this.state.inPropertyName;
this.state.inPropertyName = true;
const type = this.state.type;
prop.key = type === 0 || type === 4 || type === 1 || type === 2 ? this.parseExprAtom() : this.parseMaybePrivateName(isPrivateNameAllowed);
if (type !== 6) {
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) {
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();
return node;
}
parseArrayLike(close, canBePattern, isTuple, refExpressionErrors) {
if (isTuple) {
this.expectPlugin("recordAndTuple");
}
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
this.state.inFSharpPipelineDirectBody = false;
const node = this.startNode();
this.next();
node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node);
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
}
parseArrowExpression(node, params, isAsync, trailingCommaPos) {
this.scope.enter(SCOPE_FUNCTION | SCOPE_ARROW);
let flags = functionFlags(isAsync, false);
if (!this.match(8) && this.prodParam.hasIn) {
flags |= PARAM_IN;
}
this.prodParam.enter(flags);
this.initFunction(node, isAsync);
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
if (params) {
this.state.maybeInArrowParameters = true;
this.setArrowFunctionParameters(node, params, trailingCommaPos);
}
this.state.maybeInArrowParameters = false;
this.parseFunctionBody(node, true);
this.prodParam.exit();
this.scope.exit();
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
return this.finishNode(node, "ArrowFunctionExpression");
}
setArrowFunctionParameters(node, params, trailingCommaPos) {
node.params = this.toAssignableList(params, trailingCommaPos, false);
}
parseFunctionBodyAndFinish(node, type, isMethod = false) {
this.parseFunctionBody(node, false, isMethod);
this.finishNode(node, type);
}
parseFunctionBody(node, allowExpression, isMethod = false) {
const isExpression = allowExpression && !this.match(13);
this.expressionScope.enter(newExpressionScope());
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, "function name", BIND_OUTSIDE, undefined, undefined, strictModeChanged);
}
});
this.prodParam.exit();
this.expressionScope.exit();
this.state.labels = oldLabels;
}
}
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 checkClashes = new Set();
for (const param of node.params) {
this.checkLVal(param, "function parameter list", BIND_VAR, allowDuplicates ? null : checkClashes, undefined, strictModeChanged);
}
}
parseExprList(close, allowEmpty, refExpressionErrors, nodeForExtra) {
const elts = [];
let first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(20);
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, allowPlaceholder) {
let elt;
if (this.match(20)) {
if (!allowEmpty) {
this.raise(this.state.pos, ErrorMessages.UnexpectedToken, ",");
}
elt = null;
} else if (this.match(29)) {
const spreadNodeStartPos = this.state.start;
const spreadNodeStartLoc = this.state.startLoc;
elt = this.parseParenItem(this.parseSpread(refExpressionErrors), spreadNodeStartPos, spreadNodeStartLoc);
} else if (this.match(25)) {
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.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
}
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;
const {
start,
type
} = this.state;
if (type === 5) {
name = this.state.value;
} else if (tokenIsKeyword(type)) {
name = tokenLabelName(type);
} else {
throw this.unexpected();
}
if (liberal) {
this.state.type = 5;
} else {
this.checkReservedWord(name, start, tokenIsKeyword(type), false);
}
this.next();
return name;
}
checkReservedWord(word, startLoc, checkKeywords, isBinding) {
if (word.length > 10) {
return;
}
if (!canBeReservedWord(word)) {
return;
}
if (word === "yield") {
if (this.prodParam.hasYield) {
this.raise(startLoc, ErrorMessages.YieldBindingIdentifier);
return;
}
} else if (word === "await") {
if (this.prodParam.hasAwait) {
this.raise(startLoc, ErrorMessages.AwaitBindingIdentifier);
return;
} else if (this.scope.inStaticBlock) {
this.raise(startLoc, ErrorMessages.AwaitBindingIdentifierInStaticBlock);
return;
} else {
this.expressionScope.recordAsyncArrowParametersError(startLoc, ErrorMessages.AwaitBindingIdentifier);
}
} else if (word === "arguments") {
if (this.scope.inClassAndNotInNonArrowFunction) {
this.raise(startLoc, ErrorMessages.ArgumentsInClass);
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)) {
this.raise(startLoc, ErrorMessages.UnexpectedReservedWord, word);
}
}
isAwaitAllowed() {
if (this.prodParam.hasAwait) return true;
if (this.options.allowAwaitOutsideFunction && !this.scope.inFunction) {
return true;
}
return false;
}
parseAwait(startPos, startLoc) {
const node = this.startNodeAt(startPos, startLoc);
this.expressionScope.recordParameterInitializerError(node.start, ErrorMessages.AwaitExpressionFormalParameter);
if (this.eat(54)) {
this.raise(node.start, ErrorMessages.ObsoleteAwaitStar);
}
if (!this.scope.inFunction && !this.options.allowAwaitOutsideFunction) {
if (this.isAmbiguousAwait()) {
this.ambiguousScriptDifferentAst = true;
} else {
this.sawUnambiguousESM = true;
}
}
if (!this.state.soloAwait) {
node.argument = this.parseMaybeUnary(null, true);
}
return this.finishNode(node, "AwaitExpression");
}
isAmbiguousAwait() {
return this.hasPrecedingLineBreak() || this.match(52) || this.match(18) || this.match(8) || this.match(30) || this.match(3) || this.match(55) || this.hasPlugin("v8intrinsic") && this.match(53);
}
parseYield() {
const node = this.startNode();
this.expressionScope.recordParameterInitializerError(node.start, ErrorMessages.YieldInParameter);
this.next();
let delegating = false;
let argument = null;
if (!this.hasPrecedingLineBreak()) {
delegating = this.eat(54);
switch (this.state.type) {
case 21:
case 7:
case 16:
case 19:
case 11:
case 17:
case 22:
case 20:
if (!delegating) break;
default:
argument = this.parseMaybeAssign();
}
}
node.delegate = delegating;
node.argument = argument;
return this.finishNode(node, "YieldExpression");
}
checkPipelineAtInfixOperator(left, leftStartPos) {
if (this.getPluginOption("pipelineOperator", "proposal") === "smart") {
if (left.type === "SequenceExpression") {
this.raise(leftStartPos, ErrorMessages.PipelineHeadSequenceExpression);
}
}
}
checkHackPipeBodyEarlyErrors(startPos) {
if (!this.topicReferenceWasUsedInCurrentContext()) {
this.raise(startPos, ErrorMessages.PipeTopicUnused);
}
}
parseSmartPipelineBodyInStyle(childExpr, startPos, startLoc) {
const bodyNode = this.startNodeAt(startPos, startLoc);
if (this.isSimpleReference(childExpr)) {
bodyNode.callee = childExpr;
return this.finishNode(bodyNode, "PipelineBareFunction");
} else {
this.checkSmartPipeTopicBodyEarlyErrors(startPos);
bodyNode.expression = childExpr;
return this.finishNode(bodyNode, "PipelineTopicExpression");
}
}
isSimpleReference(expression) {
switch (expression.type) {
case "MemberExpression":
return !expression.computed && this.isSimpleReference(expression.object);
case "Identifier":
return true;
default:
return false;
}
}
checkSmartPipeTopicBodyEarlyErrors(startPos) {
if (this.match(27)) {
throw this.raise(this.state.start, ErrorMessages.PipelineBodyNoArrow);
} else if (!this.topicReferenceWasUsedInCurrentContext()) {
this.raise(startPos, ErrorMessages.PipelineTopicUnused);
}
}
withTopicBindingContext(callback) {
const outerContextTopicState = this.state.topicContext;
this.state.topicContext = {
maxNumOfResolvableTopics: 1,
maxTopicIndex: null
};
try {
return callback();
} finally {
this.state.topicContext = outerContextTopicState;
}
}
withSmartMixTopicForbiddingContext(callback) {
const proposal = this.getPluginOption("pipelineOperator", "proposal");
if (proposal === "smart") {
const outerContextTopicState = this.state.topicContext;
this.state.topicContext = {
maxNumOfResolvableTopics: 0,
maxTopicIndex: null
};
try {
return callback();
} finally {
this.state.topicContext = outerContextTopicState;
}
} else {
return callback();
}
}
withSoloAwaitPermittingContext(callback) {
const outerContextSoloAwaitState = this.state.soloAwait;
this.state.soloAwait = true;
try {
return callback();
} finally {
this.state.soloAwait = outerContextSoloAwaitState;
}
}
allowInAnd(callback) {
const flags = this.prodParam.currentFlags();
const prodParamToSet = PARAM_IN & ~flags;
if (prodParamToSet) {
this.prodParam.enter(flags | PARAM_IN);
try {
return callback();
} finally {
this.prodParam.exit();
}
}
return callback();
}
disallowInAnd(callback) {
const flags = this.prodParam.currentFlags();
const prodParamToClear = PARAM_IN & flags;
if (prodParamToClear) {
this.prodParam.enter(flags & ~PARAM_IN);
try {
return callback();
} finally {
this.prodParam.exit();
}
}
return callback();
}
registerTopicReference() {
this.state.topicContext.maxTopicIndex = 0;
}
topicReferenceIsAllowedInCurrentContext() {
return this.state.topicContext.maxNumOfResolvableTopics >= 1;
}
topicReferenceWasUsedInCurrentContext() {
return this.state.topicContext.maxTopicIndex != null && this.state.topicContext.maxTopicIndex >= 0;
}
parseFSharpPipelineBody(prec) {
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.parseMaybeUnaryOrPrivate(), startPos, startLoc, prec);
this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
return ret;
}
parseModuleExpression() {
this.expectPlugin("moduleBlocks");
const node = this.startNode();
this.next();
this.eat(13);
const revertScopes = this.initializeScopes(true);
this.enterInitialScopes();
const program = this.startNode();
try {
node.body = this.parseProgram(program, 16, "module");
} finally {
revertScopes();
}
this.eat(16);
return this.finishNode(node, "ModuleExpression");
}
}
const loopLabel = {
kind: "loop"
},
switchLabel = {
kind: "switch"
};
const FUNC_NO_FLAGS = 0b000,
FUNC_STATEMENT = 0b001,
FUNC_HANGING_STATEMENT = 0b010,
FUNC_NULLABLE_ID = 0b100;
const loneSurrogate = /[\uD800-\uDFFF]/u;
const keywordRelationalOperator = /in(?:stanceof)?/y;
function babel7CompatTokens(tokens) {
for (let i = 0; i < tokens.length; i++) {
const token = tokens[i];
const {
type
} = token;
if (type === 6) {
{
const {
loc,
start,
value,
end
} = token;
const hashEndPos = start + 1;
const hashEndLoc = new Position(loc.start.line, loc.start.column + 1);
tokens.splice(i, 1, new Token({
type: getExportedToken(33),
value: "#",
start: start,
end: hashEndPos,
startLoc: loc.start,
endLoc: hashEndLoc
}), new Token({
type: getExportedToken(5),
value: value,
start: hashEndPos,
end: end,
startLoc: hashEndLoc,
endLoc: loc.end
}));
i++;
continue;
}
}
if (typeof type === "number") {
token.type = getExportedToken(type);
}
}
return tokens;
}
class StatementParser extends ExpressionParser {
parseTopLevel(file, program) {
file.program = this.parseProgram(program);
file.comments = this.state.comments;
if (this.options.tokens) file.tokens = babel7CompatTokens(this.tokens);
return this.finishNode(file, "File");
}
parseProgram(program, end = 7, sourceType = this.options.sourceType) {
program.sourceType = sourceType;
program.interpreter = this.parseInterpreterDirective();
this.parseBlockBody(program, true, true, end);
if (this.inModule && !this.options.allowUndeclaredExports && this.scope.undefinedExports.size > 0) {
for (const [name] of Array.from(this.scope.undefinedExports)) {
const pos = this.scope.undefinedExports.get(name);
this.raise(pos, ErrorMessages.ModuleExportUndefined, name);
}
}
return this.finishNode(program, "Program");
}
stmtToDirective(stmt) {
const directive = stmt;
directive.type = "Directive";
directive.value = directive.expression;
delete directive.expression;
const directiveLiteral = directive.value;
const raw = this.input.slice(directiveLiteral.start, directiveLiteral.end);
const val = directiveLiteral.value = raw.slice(1, -1);
this.addExtra(directiveLiteral, "raw", raw);
this.addExtra(directiveLiteral, "rawValue", val);
directiveLiteral.type = "DirectiveLiteral";
return directive;
}
parseInterpreterDirective() {
if (!this.match(34)) {
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;
}
return this.isLetKeyword(context);
}
isLetKeyword(context) {
const next = this.nextTokenStart();
const nextCh = this.codePointAtPos(next);
if (nextCh === 92 || nextCh === 91) {
return true;
}
if (context) return false;
if (nextCh === 123) return true;
if (isIdentifierStart(nextCh)) {
keywordRelationalOperator.lastIndex = next;
if (keywordRelationalOperator.test(this.input)) {
const endCh = this.codePointAtPos(keywordRelationalOperator.lastIndex);
if (!isIdentifierChar(endCh) && endCh !== 92) {
return false;
}
}
return true;
}
return false;
}
parseStatement(context, topLevel) {
if (this.match(32)) {
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 = 73;
kind = "let";
}
switch (starttype) {
case 59:
return this.parseBreakContinueStatement(node, true);
case 62:
return this.parseBreakContinueStatement(node, false);
case 63:
return this.parseDebuggerStatement(node);
case 89:
return this.parseDoStatement(node);
case 90:
return this.parseForStatement(node);
case 67:
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 79:
if (context) this.unexpected();
return this.parseClass(node, true);
case 68:
return this.parseIfStatement(node);
case 69:
return this.parseReturnStatement(node);
case 70:
return this.parseSwitchStatement(node);
case 71:
return this.parseThrowStatement(node);
case 72:
return this.parseTryStatement(node);
case 74:
case 73:
kind = kind || this.state.value;
if (context && kind !== "var") {
this.raise(this.state.start, ErrorMessages.UnexpectedLexicalDeclaration);
}
return this.parseVarStatement(node, kind);
case 91:
return this.parseWhileStatement(node);
case 75:
return this.parseWithStatement(node);
case 13:
return this.parseBlock();
case 21:
return this.parseEmptyStatement(node);
case 82:
{
const nextTokenCharCode = this.lookaheadCharCode();
if (nextTokenCharCode === 40 || nextTokenCharCode === 46) {
break;
}
}
case 81:
{
if (!this.options.allowImportExportEverywhere && !topLevel) {
this.raise(this.state.start, ErrorMessages.UnexpectedImportExport);
}
this.next();
let result;
if (starttype === 82) {
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 === 5 && expr.type === "Identifier" && this.eat(22)) {
return this.parseLabeledStatement(node, maybeName, expr, context);
} else {
return this.parseExpressionStatement(node, expr);
}
}
assertModuleNodeAllowed(node) {
if (!this.options.allowImportExportEverywhere && !this.inModule) {
this.raise(node.start, SourceTypeModuleErrorMessages.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(79);
}
parseDecorators(allowExport) {
const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
while (this.match(32)) {
const decorator = this.parseDecorator();
currentContextDecorators.push(decorator);
}
if (this.match(81)) {
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(18)) {
expr = this.parseExpression();
this.expect(19);
} else {
expr = this.parseIdentifier(false);
while (this.eat(24)) {
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(18)) {
const node = this.startNodeAtNode(expr);
node.callee = expr;
node.arguments = this.parseCallExpressionArguments(19, false);
this.toReferencedList(node.arguments);
return this.finishNode(node, "CallExpression");
}
return expr;
}
parseBreakContinueStatement(node, isBreak) {
this.next();
if (this.isLineTerminator()) {
node.label = null;
} else {
node.label = this.parseIdentifier();
this.semicolon();
}
this.verifyBreakContinue(node, isBreak);
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
}
verifyBreakContinue(node, isBreak) {
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, isBreak ? "break" : "continue");
}
}
parseDebuggerStatement(node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
}
parseHeaderExpression() {
this.expect(18);
const val = this.parseExpression();
this.expect(19);
return val;
}
parseDoStatement(node) {
this.next();
this.state.labels.push(loopLabel);
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("do"));
this.state.labels.pop();
this.expect(91);
node.test = this.parseHeaderExpression();
this.eat(21);
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(18);
if (this.match(21)) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, null);
}
const startsWithLet = this.isContextual("let");
const isLet = startsWithLet && this.isLetKeyword();
if (this.match(73) || this.match(74) || 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(57) || 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 startsWithUnescapedName = this.match(5) && !this.state.containsEsc;
const refExpressionErrors = new ExpressionErrors();
const init = this.parseExpression(true, refExpressionErrors);
const isForOf = this.isContextual("of");
if (isForOf) {
if (startsWithLet) {
this.raise(init.start, ErrorMessages.ForOfLet);
} else if (awaitAt === -1 && startsWithUnescapedName && init.type === "Identifier" && init.name === "async") {
this.raise(init.start, ErrorMessages.ForOfAsync);
}
}
if (isForOf || this.match(57)) {
this.toAssignable(init, true);
const description = isForOf ? "for-of statement" : "for-in statement";
this.checkLVal(init, 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(65) ? 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(13);
this.state.labels.push(switchLabel);
this.scope.enter(SCOPE_OTHER);
let cur;
for (let sawDefault; !this.match(16);) {
if (this.match(60) || this.match(64)) {
const isCase = this.match(60);
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(22);
} 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 (this.hasPrecedingLineBreak()) {
this.raise(this.state.lastTokEnd, ErrorMessages.NewlineAfterThrow);
}
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
}
parseCatchClauseParam() {
const param = this.parseBindingAtom();
const simple = param.type === "Identifier";
this.scope.enter(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLVal(param, "catch clause", BIND_LEXICAL);
return param;
}
parseTryStatement(node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.match(61)) {
const clause = this.startNode();
this.next();
if (this.match(18)) {
this.expect(18);
clause.param = this.parseCatchClauseParam();
this.expect(19);
} else {
clause.param = null;
this.scope.enter(SCOPE_OTHER);
}
clause.body = this.withSmartMixTopicForbiddingContext(() => this.parseBlock(false, false));
this.scope.exit();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(66) ? 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.withSmartMixTopicForbiddingContext(() => 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.withSmartMixTopicForbiddingContext(() => this.parseStatement("with"));
return this.finishNode(node, "WithStatement");
}
parseEmptyStatement(node) {
this.next();
return this.finishNode(node, "EmptyStatement");
}
parseLabeledStatement(node, maybeName, expr, context) {
for (const label of this.state.labels) {
if (label.name === maybeName) {
this.raise(expr.start, ErrorMessages.LabelRedeclaration, maybeName);
}
}
const kind = tokenIsLoop(this.state.type) ? "loop" : this.match(70) ? "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();
if (allowDirectives) {
this.state.strictErrors.clear();
}
this.expect(13);
if (createNewLexicalScope) {
this.scope.enter(SCOPE_OTHER);
}
this.parseBlockBody(node, allowDirectives, false, 16, 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 oldStrict = this.state.strict;
let hasStrictModeDirective = false;
let parsedNonDirective = false;
while (!this.match(end)) {
const stmt = this.parseStatement(null, topLevel);
if (directives && !parsedNonDirective) {
if (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;
this.state.strictErrors.clear();
}
body.push(stmt);
}
if (afterBlockParse) {
afterBlockParse.call(this, hasStrictModeDirective);
}
if (!oldStrict) {
this.setStrict(false);
}
this.next();
}
parseFor(node, init) {
node.init = init;
this.semicolon(false);
node.test = this.match(21) ? null : this.parseExpression();
this.semicolon(false);
node.update = this.match(19) ? null : this.parseExpression();
this.expect(19);
node.body = this.withSmartMixTopicForbiddingContext(() => this.parseStatement("for"));
this.scope.exit();
this.state.labels.pop();
return this.finishNode(node, "ForStatement");
}
parseForIn(node, init, awaitAt) {
const isForIn = this.match(57);
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.parseMaybeAssignAllowIn();
this.expect(19);
node.body = this.withSmartMixTopicForbiddingContext(() => 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(35)) {
decl.init = isFor ? this.parseMaybeAssignDisallowIn() : this.parseMaybeAssignAllowIn();
} else {
if (kind === "const" && !(this.match(57) || this.isContextual("of"))) {
if (!isTypescript) {
this.raise(this.state.lastTokEnd, ErrorMessages.DeclarationMissingInitializer, "Const declarations");
}
} else if (decl.id.type !== "Identifier" && !(isFor && (this.match(57) || 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(20)) break;
}
return node;
}
parseVarId(decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLVal(decl.id, "variable declaration", kind === "var" ? BIND_VAR : BIND_LEXICAL, undefined, 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(54) && isHangingStatement) {
this.raise(this.state.start, ErrorMessages.GeneratorInSingleStatementContext);
}
node.generator = this.eat(54);
if (isStatement) {
node.id = this.parseFunctionId(requireId);
}
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
this.state.maybeInArrowParameters = false;
this.scope.enter(SCOPE_FUNCTION);
this.prodParam.enter(functionFlags(isAsync, node.generator));
if (!isStatement) {
node.id = this.parseFunctionId();
}
this.parseFunctionParams(node, false);
this.withSmartMixTopicForbiddingContext(() => {
this.parseFunctionBodyAndFinish(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
});
this.prodParam.exit();
this.scope.exit();
if (isStatement && !isHangingStatement) {
this.registerFunctionStatementId(node);
}
this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
return node;
}
parseFunctionId(requireId) {
return requireId || this.match(5) ? this.parseIdentifier() : null;
}
parseFunctionParams(node, allowModifiers) {
this.expect(18);
this.expressionScope.enter(newParameterDeclarationScope());
node.params = this.parseBindingList(19, 41, false, allowModifiers);
this.expressionScope.exit();
}
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);
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
}
isClassProperty() {
return this.match(35) || this.match(21) || this.match(16);
}
isClassMethod() {
return this.match(18);
}
isNonstaticConstructor(method) {
return !method.computed && !method.static && (method.key.name === "constructor" || method.key.value === "constructor");
}
parseClassBody(hadSuperClass, oldStrict) {
this.classScope.enter();
const state = {
hadConstructor: false,
hadSuperClass
};
let decorators = [];
const classBody = this.startNode();
classBody.body = [];
this.expect(13);
this.withSmartMixTopicForbiddingContext(() => {
while (!this.match(16)) {
if (this.eat(21)) {
if (decorators.length > 0) {
throw this.raise(this.state.lastTokEnd, ErrorMessages.DecoratorSemicolon);
}
continue;
}
if (this.match(32)) {
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);
if (member.kind === "constructor" && member.decorators && member.decorators.length > 0) {
this.raise(member.start, ErrorMessages.DecoratorConstructor);
}
}
});
this.state.strict = oldStrict;
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 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;
}
this.resetPreviousNodeTrailingComments(key);
return false;
}
parseClassMember(classBody, member, state) {
const isStatic = this.isContextual("static");
if (isStatic) {
if (this.parseClassMemberFromModifier(classBody, member)) {
return;
}
if (this.eat(13)) {
this.parseClassStaticBlock(classBody, member);
return;
}
}
this.parseClassMemberWithIsStatic(classBody, member, state, isStatic);
}
parseClassMemberWithIsStatic(classBody, member, state, isStatic) {
const publicMethod = member;
const privateMethod = member;
const publicProp = member;
const privateProp = member;
const method = publicMethod;
const publicMember = publicMethod;
member.static = isStatic;
if (this.eat(54)) {
method.kind = "method";
const isPrivateName = this.match(6);
this.parseClassElementName(method);
if (isPrivateName) {
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 isContextual = this.match(5) && !this.state.containsEsc;
const isPrivate = this.match(6);
const key = this.parseClassElementName(member);
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);
}
if (isConstructor && this.hasPlugin("typescript") && member.override) {
this.raise(key.start, ErrorMessages.OverrideOnConstructor);
}
state.hadConstructor = true;
allowsDirectSuper = state.hadSuperClass;
}
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 (isContextual && key.name === "async" && !this.isLineTerminator()) {
this.resetPreviousNodeTrailingComments(key);
const isGenerator = this.eat(54);
if (publicMember.optional) {
this.unexpected(maybeQuestionTokenStart);
}
method.kind = "method";
const isPrivate = this.match(6);
this.parseClassElementName(method);
this.parsePostMemberNameModifiers(publicMember);
if (isPrivate) {
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 (isContextual && (key.name === "get" || key.name === "set") && !(this.match(54) && this.isLineTerminator())) {
this.resetPreviousNodeTrailingComments(key);
method.kind = key.name;
const isPrivate = this.match(6);
this.parseClassElementName(publicMethod);
if (isPrivate) {
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();
}
}
parseClassElementName(member) {
const {
type,
value,
start
} = this.state;
if ((type === 5 || type === 4) && member.static && value === "prototype") {
this.raise(start, ErrorMessages.StaticPrototype);
}
if (type === 6 && value === "constructor") {
this.raise(start, ErrorMessages.ConstructorClassPrivateField);
}
return this.parsePropertyName(member, true);
}
parseClassStaticBlock(classBody, member) {
var _member$decorators;
this.expectPlugin("classStaticBlock", member.start);
this.scope.enter(SCOPE_CLASS | SCOPE_STATIC_BLOCK | SCOPE_SUPER);
const oldLabels = this.state.labels;
this.state.labels = [];
this.prodParam.enter(PARAM);
const body = member.body = [];
this.parseBlockOrModuleBlockBody(body, undefined, false, 16);
this.prodParam.exit();
this.scope.exit();
this.state.labels = oldLabels;
classBody.body.push(this.finishNode(member, "StaticBlock"));
if ((_member$decorators = member.decorators) != null && _member$decorators.length) {
this.raise(member.start, ErrorMessages.DecoratorStaticBlock);
}
}
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) {
const node = this.parseClassPrivateProperty(prop);
classBody.body.push(node);
this.classScope.declarePrivateName(this.getPrivateNameSV(node.key), 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) {
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(this.getPrivateNameSV(node.key), kind, node.key.start);
}
parsePostMemberNameModifiers(methodOrProp) {}
parseClassPrivateProperty(node) {
this.parseInitializer(node);
this.semicolon();
return this.finishNode(node, "ClassPrivateProperty");
}
parseClassProperty(node) {
this.parseInitializer(node);
this.semicolon();
return this.finishNode(node, "ClassProperty");
}
parseInitializer(node) {
this.scope.enter(SCOPE_CLASS | SCOPE_SUPER);
this.expressionScope.enter(newExpressionScope());
this.prodParam.enter(PARAM);
node.value = this.eat(35) ? this.parseMaybeAssignAllowIn() : null;
this.expressionScope.exit();
this.prodParam.exit();
this.scope.exit();
}
parseClassId(node, isStatement, optionalId, bindingType = BIND_CLASS) {
if (this.match(5)) {
node.id = this.parseIdentifier();
if (isStatement) {
this.checkLVal(node.id, "class name", bindingType);
}
} else {
if (optionalId || !isStatement) {
node.id = null;
} else {
this.unexpected(null, ErrorMessages.MissingClassName);
}
}
}
parseClassSuper(node) {
node.superClass = this.eat(80) ? this.parseExprSubscripts() : null;
}
parseExport(node) {
const hasDefault = this.maybeParseExportDefaultSpecifier(node);
const parseAfterDefault = !hasDefault || this.eat(20);
const hasStar = parseAfterDefault && this.eatExportStar(node);
const hasNamespace = hasStar && this.maybeParseExportNamespaceSpecifier(node);
const parseAfterNamespace = parseAfterDefault && (!hasNamespace || this.eat(20));
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, 13);
}
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(64)) {
node.declaration = this.parseExportDefaultExpression();
this.checkExport(node, true, true);
return this.finishNode(node, "ExportDefaultDeclaration");
}
throw this.unexpected(null, 13);
}
eatExportStar(node) {
return this.eat(54);
}
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.parseModuleExportName();
node.specifiers.push(this.finishNode(specifier, "ExportNamespaceSpecifier"));
return true;
}
return false;
}
maybeParseExportNamedSpecifiers(node) {
if (this.match(13)) {
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()) {
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(67) || isAsync) {
this.next();
if (isAsync) {
this.next();
}
return this.parseFunction(expr, FUNC_STATEMENT | FUNC_NULLABLE_ID, isAsync);
} else if (this.match(79)) {
return this.parseClass(expr, true, true);
} else if (this.match(32)) {
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(74) || this.match(73) || this.isLet()) {
throw this.raise(this.state.start, ErrorMessages.UnsupportedDefaultExport);
} else {
const res = this.parseMaybeAssignAllowIn();
this.semicolon();
return res;
}
}
parseExportDeclaration(node) {
return this.parseStatement(null);
}
isExportDefaultSpecifier() {
if (this.match(5)) {
const value = this.state.value;
if (value === "async" && !this.state.containsEsc || value === "let") {
return false;
}
if ((value === "type" || value === "interface") && !this.state.containsEsc) {
const l = this.lookahead();
if (l.type === 5 && l.value !== "from" || l.type === 13) {
this.expectOnePlugin(["flow", "typescript"]);
return false;
}
}
} else if (!this.match(64)) {
return false;
}
const next = this.nextTokenStart();
const hasFrom = this.isUnparsedContextual(next, "from");
if (this.input.charCodeAt(next) === 44 || this.match(5) && hasFrom) {
return true;
}
if (this.match(64) && 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);
const assertions = this.maybeParseImportAssertions();
if (assertions) {
node.assertions = assertions;
}
} else {
if (expect) {
this.unexpected();
} else {
node.source = null;
}
}
this.semicolon();
}
shouldParseExportDeclaration() {
const {
type
} = this.state;
if (type === 32) {
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 type === 73 || type === 74 || type === 67 || type === 79 || 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 && _declaration$extra.parenthesized)) {
this.raise(declaration.start, ErrorMessages.ExportDefaultFromAsIdentifier);
}
}
} else if (node.specifiers && node.specifiers.length) {
for (const specifier of node.specifiers) {
const {
exported
} = specifier;
const exportedName = exported.type === "Identifier" ? exported.name : exported.value;
this.checkDuplicateExports(specifier, exportedName);
if (!isFrom && specifier.local) {
const {
local
} = specifier;
if (local.type !== "Identifier") {
this.raise(specifier.start, ErrorMessages.ExportBindingIsString, local.value, exportedName);
} else {
this.checkReservedWord(local.name, local.start, true, false);
this.scope.checkLocalExport(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 (const declaration of node.declaration.declarations) {
this.checkDeclaration(declaration.id);
}
}
}
}
const currentContextDecorators = this.state.decoratorStack[this.state.decoratorStack.length - 1];
if (currentContextDecorators.length) {
throw this.raise(node.start, ErrorMessages.UnsupportedDecoratorExport);
}
}
checkDeclaration(node) {
if (node.type === "Identifier") {
this.checkDuplicateExports(node, node.name);
} else if (node.type === "ObjectPattern") {
for (const prop of node.properties) {
this.checkDeclaration(prop);
}
} else if (node.type === "ArrayPattern") {
for (const elem of node.elements) {
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.exportedIdentifiers.has(name)) {
this.raise(node.start, name === "default" ? ErrorMessages.DuplicateDefaultExport : ErrorMessages.DuplicateExport, name);
}
this.exportedIdentifiers.add(name);
}
parseExportSpecifiers() {
const nodes = [];
let first = true;
this.expect(13);
while (!this.eat(16)) {
if (first) {
first = false;
} else {
this.expect(20);
if (this.eat(16)) break;
}
const node = this.startNode();
const isString = this.match(4);
const local = this.parseModuleExportName();
node.local = local;
if (this.eatContextual("as")) {
node.exported = this.parseModuleExportName();
} else if (isString) {
node.exported = cloneStringLiteral(local);
} else {
node.exported = cloneIdentifier(local);
}
nodes.push(this.finishNode(node, "ExportSpecifier"));
}
return nodes;
}
parseModuleExportName() {
if (this.match(4)) {
const result = this.parseStringLiteral(this.state.value);
const surrogate = result.value.match(loneSurrogate);
if (surrogate) {
this.raise(result.start, ErrorMessages.ModuleExportNameHasLoneSurrogate, surrogate[0].charCodeAt(0).toString(16));
}
return result;
}
return this.parseIdentifier(true);
}
parseImport(node) {
node.specifiers = [];
if (!this.match(4)) {
const hasDefault = this.maybeParseDefaultImportSpecifier(node);
const parseNext = !hasDefault || this.eat(20);
const hasStar = parseNext && this.maybeParseStarImportSpecifier(node);
if (parseNext && !hasStar) this.parseNamedImportSpecifiers(node);
this.expectContextual("from");
}
node.source = this.parseImportSource();
const assertions = this.maybeParseImportAssertions();
if (assertions) {
node.assertions = assertions;
} else {
const attributes = this.maybeParseModuleAttributes();
if (attributes) {
node.attributes = attributes;
}
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
}
parseImportSource() {
if (!this.match(4)) this.unexpected();
return this.parseExprAtom();
}
shouldParseDefaultImport(node) {
return this.match(5);
}
parseImportSpecifierLocal(node, specifier, type, contextDescription) {
specifier.local = this.parseIdentifier();
this.checkLVal(specifier.local, contextDescription, BIND_LEXICAL);
node.specifiers.push(this.finishNode(specifier, type));
}
parseAssertEntries() {
const attrs = [];
const attrNames = new Set();
do {
if (this.match(16)) {
break;
}
const node = this.startNode();
const keyName = this.state.value;
if (attrNames.has(keyName)) {
this.raise(this.state.start, ErrorMessages.ModuleAttributesWithDuplicateKeys, keyName);
}
attrNames.add(keyName);
if (this.match(4)) {
node.key = this.parseStringLiteral(keyName);
} else {
node.key = this.parseIdentifier(true);
}
this.expect(22);
if (!this.match(4)) {
throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
}
node.value = this.parseStringLiteral(this.state.value);
this.finishNode(node, "ImportAttribute");
attrs.push(node);
} while (this.eat(20));
return attrs;
}
maybeParseModuleAttributes() {
if (this.match(75) && !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(22);
if (!this.match(4)) {
throw this.unexpected(this.state.start, ErrorMessages.ModuleAttributeInvalidValue);
}
node.value = this.parseStringLiteral(this.state.value);
this.finishNode(node, "ImportAttribute");
attrs.push(node);
} while (this.eat(20));
return attrs;
}
maybeParseImportAssertions() {
if (this.isContextual("assert") && !this.hasPrecedingLineBreak()) {
this.expectPlugin("importAssertions");
this.next();
} else {
if (this.hasPlugin("importAssertions")) return [];
return null;
}
this.eat(13);
const attrs = this.parseAssertEntries();
this.eat(16);
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(54)) {
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(13);
while (!this.eat(16)) {
if (first) {
first = false;
} else {
if (this.eat(22)) {
throw this.raise(this.state.start, ErrorMessages.DestructureNamedImport);
}
this.expect(20);
if (this.eat(16)) break;
}
this.parseImportSpecifier(node);
}
}
parseImportSpecifier(node) {
const specifier = this.startNode();
const importedIsString = this.match(4);
specifier.imported = this.parseModuleExportName();
if (this.eatContextual("as")) {
specifier.local = this.parseIdentifier();
} else {
const {
imported
} = specifier;
if (importedIsString) {
throw this.raise(specifier.start, ErrorMessages.ImportBindingIsString, imported.value);
}
this.checkReservedWord(imported.name, specifier.start, true, true);
specifier.local = cloneIdentifier(imported);
}
this.checkLVal(specifier.local, "import specifier", BIND_LEXICAL);
node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
}
isThisParam(param) {
return param.type === "Identifier" && param.name === "this";
}
}
class Parser extends StatementParser {
constructor(options, input) {
options = getOptions(options);
super(options, input);
this.options = options;
this.initializeScopes();
this.plugins = pluginsMap(this.options.plugins);
this.filename = options.sourceFilename;
}
getScopeHandler() {
return ScopeHandler;
}
parse() {
this.enterInitialScopes();
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 (const plugin of plugins) {
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 generateExportedTokenTypes(internalTokenTypes) {
const tokenTypes = {};
for (const typeName of Object.keys(internalTokenTypes)) {
tokenTypes[typeName] = getExportedToken(internalTokenTypes[typeName]);
}
return tokenTypes;
}
const tokTypes = generateExportedTokenTypes(tt);
function getParser(options, input) {
let cls = Parser;
if (options != null && 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 (const plugin of pluginList) {
cls = mixinPlugins[plugin](cls);
}
parserClassCache[key] = cls;
}
return cls;
}
exports.parse = parse;
exports.parseExpression = parseExpression;
exports.tokTypes = tokTypes;
//# sourceMappingURL=index.js.map
/***/ }),
/* 686 */,
/* 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 = __webpack_require__(850);
var parens = __webpack_require__(851);
var _t = __webpack_require__(2);
const {
FLIPPED_ALIAS_KEYS,
isCallExpression,
isExpressionStatement,
isMemberExpression,
isNewExpression
} = _t;
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 = 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 (isCallExpression(node)) {
return true;
}
return isMemberExpression(node) && isOrHasCallExpression(node.object);
}
function needsWhitespace(node, parent, type) {
if (!node) return 0;
if (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 (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 = __webpack_require__(2);
const {
isClassDeclaration,
isExportDefaultSpecifier,
isExportNamespaceSpecifier,
isImportDefaultSpecifier,
isImportNamespaceSpecifier,
isStatement
} = _t;
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.printAssertions(node);
this.semicolon();
}
function ExportNamedDeclaration(node) {
if (this.format.decoratorsBeforeExport && 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 && 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 (!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 (isExportDefaultSpecifier(first) || 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.printAssertions(node);
}
this.semicolon();
}
}
function ImportDeclaration(node) {
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 && specifiers.length) {
for (;;) {
const first = specifiers[0];
if (isImportDefaultSpecifier(first) || 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);
this.printAssertions(node);
{
var _node$attributes;
if ((_node$attributes = node.attributes) != null && _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.DecimalLiteral = DecimalLiteral;
exports.TopicReference = TopicReference;
exports.PipelineTopicExpression = PipelineTopicExpression;
exports.PipelineBareFunction = PipelineBareFunction;
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
var _t = __webpack_require__(2);
var _jsesc = __webpack_require__(858);
const {
isAssignmentPattern,
isIdentifier
} = _t;
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 (isAssignmentPattern(node.value) && isIdentifier(node.key) && node.key.name === node.value.left.name) {
this.print(node.value, node);
return;
}
this.print(node.key, node);
if (node.shorthand && isIdentifier(node.key) && 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(_jsesc(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 val = _jsesc(node.value, Object.assign(this.format.jsescOption, this.format.jsonCompatibleStrings && {
json: true
}));
return this.token(val);
}
function BigIntLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.word(raw);
return;
}
this.word(node.value + "n");
}
function DecimalLiteral(node) {
const raw = this.getPossibleRaw(node);
if (!this.format.minified && raw != null) {
this.word(raw);
return;
}
this.word(node.value + "m");
}
function TopicReference() {
const {
topicToken
} = this.format;
switch (topicToken) {
case "#":
this.token("#");
break;
default:
{
const givenTopicTokenJSON = JSON.stringify(topicToken);
const message = `The "topicToken" generator option must be "#" (${givenTopicTokenJSON} received instead).`;
throw new Error(message);
}
}
}
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(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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
}) || t.isClassPrivateMethod(node)) {
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.isPrivateName(key)) {
return `#${key.id.name}`;
}
}
if (t.isObjectProperty(parent, {
computed: false,
value: node
}) || t.isClassProperty(parent, {
value: node
}) && !parent.computed || t.isClassPrivateProperty(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.isPrivateName(key)) {
return `#${key.id.name}`;
}
}
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.
return a.line == b.line ? a.column - b.column : a.line - b.line;
}
/***/ }),
/* 693 */,
/* 694 */,
/* 695 */,
/* 696 */,
/* 697 */,
/* 698 */,
/* 699 */,
/* 700 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.containsPosition = containsPosition;
exports.containsLocation = containsLocation;
/* 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);
}
/***/ }),
/* 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 _validate = __webpack_require__(895);
var _mapExpression = _interopRequireDefault(__webpack_require__(896));
var _workerUtils = __webpack_require__(1059);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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 clearState() {
(0, _ast.clearASTs)();
(0, _getScopes.clearScopes)();
(0, _sources.clearSources)();
(0, _getSymbols.clearSymbols)();
}
self.onmessage = (0, _workerUtils.workerHandler)({
findOutOfScopeLocations: _findOutOfScopeLocations.default,
getSymbols: _getSymbols.getSymbols,
getScopes: _getScopes.default,
clearState,
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 = __webpack_require__(649);
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 = __webpack_require__(718);
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 _definitions = __webpack_require__(564);
var _validate = __webpack_require__(627);
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 = Array.isArray(field.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\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\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-\u1711\u171f-\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-\u1b4c\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-\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-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\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\u0898-\u089f\u08ca-\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\u0c3c\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-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\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-\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, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 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, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 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, 38, 6, 186, 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, 19, 72, 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, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 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, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 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, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 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, 42719, 33, 4152, 8, 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, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 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, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 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, 357, 0, 62, 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; i < name.length; i++) {
let cp = name.charCodeAt(i);
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
const trail = name.charCodeAt(++i);
if ((trail & 0xfc00) === 0xdc00) {
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
}
}
if (isFirst) {
isFirst = false;
if (!isIdentifierStart(cp)) {
return 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 = __webpack_require__(571);
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"),
impltype: (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"),
this: (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"),
method: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(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: {
explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
members: (0, _utils.validateArrayOfType)("EnumBooleanMember"),
hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("EnumNumberBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
members: (0, _utils.validateArrayOfType)("EnumNumberMember"),
hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("EnumStringBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
explicitType: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
members: (0, _utils.validateArrayOfType)(["EnumStringMember", "EnumDefaultedMember"]),
hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(0, _utils.default)("EnumSymbolBody", {
aliases: ["EnumBody"],
visitor: ["members"],
fields: {
members: (0, _utils.validateArrayOfType)("EnumDefaultedMember"),
hasUnknownMembers: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
(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")
}
});
(0, _utils.default)("IndexedAccessType", {
visitor: ["objectType", "indexType"],
aliases: ["Flow", "FlowType"],
fields: {
objectType: (0, _utils.validateType)("FlowType"),
indexType: (0, _utils.validateType)("FlowType")
}
});
(0, _utils.default)("OptionalIndexedAccessType", {
visitor: ["objectType", "indexType"],
aliases: ["Flow", "FlowType"],
fields: {
objectType: (0, _utils.validateType)("FlowType"),
indexType: (0, _utils.validateType)("FlowType"),
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
}
});
/***/ }),
/* 784 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = __webpack_require__(571);
(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 = __webpack_require__(571);
var _placeholders = __webpack_require__(668);
{
(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 = __webpack_require__(571);
(0, _utils.default)("ArgumentPlaceholder", {});
(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)("ImportAttribute", {
visitor: ["key", "value"],
fields: {
key: {
validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral")
},
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"],
builder: ["body", "async"],
aliases: ["Expression"],
fields: {
body: {
validate: (0, _utils.assertNodeType)("BlockStatement")
},
async: {
validate: (0, _utils.assertValueType)("boolean"),
default: false
}
}
});
(0, _utils.default)("ExportDefaultSpecifier", {
visitor: ["exported"],
aliases: ["ModuleSpecifier"],
fields: {
exported: {
validate: (0, _utils.assertNodeType)("Identifier")
}
}
});
(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"]
});
(0, _utils.default)("DecimalLiteral", {
builder: ["value"],
fields: {
value: {
validate: (0, _utils.assertValueType)("string")
}
},
aliases: ["Expression", "Pureish", "Literal", "Immutable"]
});
(0, _utils.default)("StaticBlock", {
visitor: ["body"],
fields: {
body: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Statement")))
}
},
aliases: ["Scopable", "BlockParent"]
});
(0, _utils.default)("ModuleExpression", {
visitor: ["body"],
fields: {
body: {
validate: (0, _utils.assertNodeType)("Program")
}
},
aliases: ["Expression"]
});
(0, _utils.default)("TopicReference", {
aliases: ["Expression"]
});
(0, _utils.default)("PipelineTopicExpression", {
builder: ["expression"],
visitor: ["expression"],
fields: {
expression: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
aliases: ["Expression"]
});
(0, _utils.default)("PipelineBareFunction", {
builder: ["callee"],
visitor: ["callee"],
fields: {
callee: {
validate: (0, _utils.assertNodeType)("Expression")
}
},
aliases: ["Expression"]
});
(0, _utils.default)("PipelinePrimaryTopicReference", {
aliases: ["Expression"]
});
/***/ }),
/* 787 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _utils = __webpack_require__(571);
var _core = __webpack_require__(600);
var _is = __webpack_require__(579);
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")
},
override: {
validate: (0, _utils.assertValueType)("boolean"),
optional: true
},
decorators: {
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
optional: true
}
}
});
(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({}, _core.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"),
kind: {
validate: (0, _utils.assertOneOf)("get", "set")
}
})
});
(0, _utils.default)("TSMethodSignature", {
aliases: ["TSTypeElement"],
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon, {
kind: {
validate: (0, _utils.assertOneOf)("method", "get", "set")
}
})
});
(0, _utils.default)("TSIndexSignature", {
aliases: ["TSTypeElement"],
visitor: ["parameters", "typeAnnotation"],
fields: {
readonly: (0, _utils.validateOptional)(bool),
static: (0, _utils.validateOptional)(bool),
parameters: (0, _utils.validateArrayOfType)("Identifier"),
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
}
});
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSIntrinsicKeyword", "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 fnOrCtrBase = {
aliases: ["TSType"],
visitor: ["typeParameters", "parameters", "typeAnnotation"]
};
(0, _utils.default)("TSFunctionType", Object.assign({}, fnOrCtrBase, {
fields: signatureDeclarationCommon
}));
(0, _utils.default)("TSConstructorType", Object.assign({}, fnOrCtrBase, {
fields: Object.assign({}, signatureDeclarationCommon, {
abstract: (0, _utils.validateOptional)(bool)
})
}));
(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", "TSNamedTupleMember"])
}
});
(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")
}
});
(0, _utils.default)("TSNamedTupleMember", {
visitor: ["label", "elementType"],
builder: ["label", "elementType", "optional"],
fields: {
label: (0, _utils.validateType)("Identifier"),
optional: {
validate: bool,
default: false
},
elementType: (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", "nameType"],
fields: {
readonly: (0, _utils.validateOptional)(bool),
typeParameter: (0, _utils.validateType)("TSTypeParameter"),
optional: (0, _utils.validateOptional)(bool),
typeAnnotation: (0, _utils.validateOptionalType)("TSType"),
nameType: (0, _utils.validateOptionalType)("TSType")
}
});
(0, _utils.default)("TSLiteralType", {
aliases: ["TSType", "TSBaseType"],
visitor: ["literal"],
fields: {
literal: {
validate: function () {
const unaryExpression = (0, _utils.assertNodeType)("NumericLiteral", "BigIntLiteral");
const unaryOperator = (0, _utils.assertOneOf)("-");
const literal = (0, _utils.assertNodeType)("NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral");
function validator(parent, key, node) {
if ((0, _is.default)("UnaryExpression", node)) {
unaryOperator(node, "operator", node.operator);
unaryExpression(node, "argument", node.argument);
} else {
literal(parent, key, node);
}
}
validator.oneOfNodeTypes = ["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "UnaryExpression"];
return validator;
}()
}
}
});
(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"]),
importKind: {
validate: (0, _utils.assertOneOf)("type", "value"),
optional: true
}
}
});
(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 = __webpack_require__(669);
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.assertAwaitExpression = assertAwaitExpression;
exports.assertImport = assertImport;
exports.assertBigIntLiteral = assertBigIntLiteral;
exports.assertExportNamespaceSpecifier = assertExportNamespaceSpecifier;
exports.assertOptionalMemberExpression = assertOptionalMemberExpression;
exports.assertOptionalCallExpression = assertOptionalCallExpression;
exports.assertClassProperty = assertClassProperty;
exports.assertClassPrivateProperty = assertClassPrivateProperty;
exports.assertClassPrivateMethod = assertClassPrivateMethod;
exports.assertPrivateName = assertPrivateName;
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.assertIndexedAccessType = assertIndexedAccessType;
exports.assertOptionalIndexedAccessType = assertOptionalIndexedAccessType;
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.assertBindExpression = assertBindExpression;
exports.assertImportAttribute = assertImportAttribute;
exports.assertDecorator = assertDecorator;
exports.assertDoExpression = assertDoExpression;
exports.assertExportDefaultSpecifier = assertExportDefaultSpecifier;
exports.assertRecordExpression = assertRecordExpression;
exports.assertTupleExpression = assertTupleExpression;
exports.assertDecimalLiteral = assertDecimalLiteral;
exports.assertStaticBlock = assertStaticBlock;
exports.assertModuleExpression = assertModuleExpression;
exports.assertTopicReference = assertTopicReference;
exports.assertPipelineTopicExpression = assertPipelineTopicExpression;
exports.assertPipelineBareFunction = assertPipelineBareFunction;
exports.assertPipelinePrimaryTopicReference = assertPipelinePrimaryTopicReference;
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.assertTSIntrinsicKeyword = assertTSIntrinsicKeyword;
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.assertTSNamedTupleMember = assertTSNamedTupleMember;
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.assertPrivate = assertPrivate;
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.assertTSTypeElement = assertTSTypeElement;
exports.assertTSType = assertTSType;
exports.assertTSBaseType = assertTSBaseType;
exports.assertNumberLiteral = assertNumberLiteral;
exports.assertRegexLiteral = assertRegexLiteral;
exports.assertRestProperty = assertRestProperty;
exports.assertSpreadProperty = assertSpreadProperty;
var _is = __webpack_require__(579);
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 assertAwaitExpression(node, opts) {
assert("AwaitExpression", node, opts);
}
function assertImport(node, opts) {
assert("Import", node, opts);
}
function assertBigIntLiteral(node, opts) {
assert("BigIntLiteral", node, opts);
}
function assertExportNamespaceSpecifier(node, opts) {
assert("ExportNamespaceSpecifier", node, opts);
}
function assertOptionalMemberExpression(node, opts) {
assert("OptionalMemberExpression", node, opts);
}
function assertOptionalCallExpression(node, opts) {
assert("OptionalCallExpression", node, opts);
}
function assertClassProperty(node, opts) {
assert("ClassProperty", node, opts);
}
function assertClassPrivateProperty(node, opts) {
assert("ClassPrivateProperty", node, opts);
}
function assertClassPrivateMethod(node, opts) {
assert("ClassPrivateMethod", node, opts);
}
function assertPrivateName(node, opts) {
assert("PrivateName", 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 assertIndexedAccessType(node, opts) {
assert("IndexedAccessType", node, opts);
}
function assertOptionalIndexedAccessType(node, opts) {
assert("OptionalIndexedAccessType", 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 assertBindExpression(node, opts) {
assert("BindExpression", 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 assertRecordExpression(node, opts) {
assert("RecordExpression", node, opts);
}
function assertTupleExpression(node, opts) {
assert("TupleExpression", node, opts);
}
function assertDecimalLiteral(node, opts) {
assert("DecimalLiteral", node, opts);
}
function assertStaticBlock(node, opts) {
assert("StaticBlock", node, opts);
}
function assertModuleExpression(node, opts) {
assert("ModuleExpression", node, opts);
}
function assertTopicReference(node, opts) {
assert("TopicReference", 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 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 assertTSIntrinsicKeyword(node, opts) {
assert("TSIntrinsicKeyword", 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 assertTSNamedTupleMember(node, opts) {
assert("TSNamedTupleMember", 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 assertPrivate(node, opts) {
assert("Private", 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 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 if (type === "bigint") {
return (0, _generated.anyTypeAnnotation)();
} else {
throw new Error("Invalid typeof value: " + type);
}
}
/***/ }),
/* 791 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createFlowUnionType;
var _generated = __webpack_require__(561);
var _removeTypeDuplicates = __webpack_require__(670);
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 = __webpack_require__(793);
function createTSUnionType(typeAnnotations) {
const types = typeAnnotations.map(type => type.typeAnnotation);
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 = new Set();
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)) {
return [node];
}
if ((0, _generated.isTSBaseType)(node)) {
bases[node.type] = node;
continue;
}
if ((0, _generated.isTSUnionType)(node)) {
if (!typeGroups.has(node.types)) {
nodes.push(...node.types);
typeGroups.add(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 = __webpack_require__(576);
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 = __webpack_require__(576);
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 = __webpack_require__(576);
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 = __webpack_require__(576);
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 = __webpack_require__(671);
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.JSX_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOWTYPE_TYPES = exports.FLOW_TYPES = exports.PRIVATE_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 PRIVATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Private"];
exports.PRIVATE_TYPES = PRIVATE_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 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 = __webpack_require__(678);
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 = __webpack_require__(679);
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 = void 0;
var _generated = __webpack_require__(559);
var _default = toExpression;
exports.default = _default;
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 = __webpack_require__(576);
var _removePropertiesDeep = __webpack_require__(680);
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 = __webpack_require__(818);
function toSequenceExpression(nodes, scope) {
if (!(nodes != null && 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 = __webpack_require__(601);
var _generated = __webpack_require__(559);
var _generated2 = __webpack_require__(561);
var _cloneNode = __webpack_require__(576);
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 = void 0;
var _generated = __webpack_require__(559);
var _generated2 = __webpack_require__(561);
var _default = toStatement;
exports.default = _default;
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 = void 0;
var _isValidIdentifier = __webpack_require__(580);
var _generated = __webpack_require__(561);
var _default = valueToNode;
exports.default = _default;
const objectToString = Function.call.bind(Object.prototype.toString);
function isRegExp(value) {
return objectToString(value) === "[object RegExp]";
}
function isPlainObject(value) {
if (typeof value !== "object" || value === null || Object.prototype.toString.call(value) !== "[object Object]") {
return false;
}
const proto = Object.getPrototypeOf(value);
return proto === null || Object.getPrototypeOf(proto) === null;
}
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 (isRegExp(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 (isPlainObject(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 = __webpack_require__(676);
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 = void 0;
var _getBindingIdentifiers = __webpack_require__(601);
var _default = getOuterBindingIdentifiers;
exports.default = _default;
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 = __webpack_require__(601);
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 = __webpack_require__(683);
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 = __webpack_require__(626);
var _generated = __webpack_require__(559);
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 && 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 "OptionalMemberExpression":
if (parent.property === node) {
return !!parent.computed;
}
return parent.object === node;
case "JSXMemberExpression":
return parent.object === node;
case "VariableDeclarator":
return parent.init === node;
case "ArrowFunctionExpression":
return parent.body === node;
case "PrivateName":
return false;
case "ClassMethod":
case "ClassPrivateMethod":
case "ObjectMethod":
if (parent.key === node) {
return !!parent.computed;
}
return false;
case "ObjectProperty":
if (parent.key === node) {
return !!parent.computed;
}
return !grandparent || grandparent.type !== "ObjectPattern";
case "ClassProperty":
if (parent.key === node) {
return !!parent.computed;
}
return true;
case "ClassPrivateProperty":
return parent.key !== node;
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 "ExportSpecifier":
if (grandparent != null && grandparent.source) {
return false;
}
return parent.local === node;
case "ImportDefaultSpecifier":
case "ImportNamespaceSpecifier":
case "ImportSpecifier":
return false;
case "ImportAttribute":
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) || (0, _generated.isCatchClause)(parent))) {
return false;
}
if ((0, _generated.isPattern)(node) && ((0, _generated.isFunction)(parent) || (0, _generated.isCatchClause)(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 = __webpack_require__(580);
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__(985);
var types = _interopRequireWildcard(_types);
var _parser = __webpack_require__(1054);
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__(985);
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 = /