mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2026-01-20 16:53:37 +08:00
docs:更新文档
This commit is contained in:
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/code-frame --dev
|
||||
```
|
||||
167
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
167
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = _default;
|
||||
|
||||
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
gutter: chalk.grey,
|
||||
marker: chalk.red.bold,
|
||||
message: chalk.red.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
|
||||
function getMarkerLines(loc, source, opts) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||
const {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
|
||||
const lineDiff = endLine - startLine;
|
||||
const markerLines = {};
|
||||
|
||||
if (lineDiff) {
|
||||
for (let i = 0; i <= lineDiff; i++) {
|
||||
const lineNumber = i + startLine;
|
||||
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
const sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
};
|
||||
}
|
||||
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
||||
const chalk = (0, _highlight.getChalk)(opts);
|
||||
const defs = getDefs(chalk);
|
||||
|
||||
const maybeHighlight = (chalkFn, string) => {
|
||||
return highlighted ? chalkFn(string) : string;
|
||||
};
|
||||
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} | `;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
if (hasMarker) {
|
||||
let markerLine = "";
|
||||
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||
}
|
||||
}
|
||||
|
||||
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
||||
} else {
|
||||
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
||||
}
|
||||
}).join("\n");
|
||||
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||
}
|
||||
|
||||
if (highlighted) {
|
||||
return chalk.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
const deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
const location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
||||
62
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
62
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/code-frame@7.10.4",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/code-frame@7.10.4",
|
||||
"_id": "@babel/code-frame@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Fo2ho26Q2miujUnA8bSMfGJJITo=",
|
||||
"_location": "/@babel/code-frame",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/code-frame@7.10.4",
|
||||
"name": "@babel/code-frame",
|
||||
"escapedName": "@babel%2fcode-frame",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/parse-json",
|
||||
"/rollup-plugin-terser"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@babel%2fcode-frame/-/code-frame-7.10.4.tgz",
|
||||
"_spec": "7.10.4",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/highlight": "^7.10.4"
|
||||
},
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"devDependencies": {
|
||||
"chalk": "^2.0.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/code-frame",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
}
|
||||
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-validator-identifier/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-validator-identifier/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-validator-identifier
|
||||
|
||||
> Validate identifier/keywords name
|
||||
|
||||
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/en/next/babel-helper-validator-identifier.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-validator-identifier
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-validator-identifier --dev
|
||||
```
|
||||
77
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
Normal file
77
node_modules/@babel/helper-validator-identifier/lib/identifier.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isIdentifierStart = isIdentifierStart;
|
||||
exports.isIdentifierChar = isIdentifierChar;
|
||||
exports.isIdentifierName = isIdentifierName;
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u08a0-\u08b4\u08b6-\u08c7\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
||||
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08d3-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f";
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
||||
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
||||
const astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 107, 20, 28, 22, 13, 52, 76, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 230, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 35, 56, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8952, 286, 50, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
||||
const astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
||||
|
||||
function isInAstralSet(code, set) {
|
||||
let pos = 0x10000;
|
||||
|
||||
for (let i = 0, length = set.length; i < length; i += 2) {
|
||||
pos += set[i];
|
||||
if (pos > code) return false;
|
||||
pos += set[i + 1];
|
||||
if (pos >= code) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isIdentifierStart(code) {
|
||||
if (code < 65) return code === 36;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
||||
}
|
||||
|
||||
return isInAstralSet(code, astralIdentifierStartCodes);
|
||||
}
|
||||
|
||||
function isIdentifierChar(code) {
|
||||
if (code < 48) return code === 36;
|
||||
if (code < 58) return true;
|
||||
if (code < 65) return false;
|
||||
if (code <= 90) return true;
|
||||
if (code < 97) return code === 95;
|
||||
if (code <= 122) return true;
|
||||
|
||||
if (code <= 0xffff) {
|
||||
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
||||
}
|
||||
|
||||
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
||||
}
|
||||
|
||||
function isIdentifierName(name) {
|
||||
let isFirst = true;
|
||||
|
||||
for (let _i = 0, _Array$from = Array.from(name); _i < _Array$from.length; _i++) {
|
||||
const char = _Array$from[_i];
|
||||
const cp = char.codePointAt(0);
|
||||
|
||||
if (isFirst) {
|
||||
if (!isIdentifierStart(cp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
isFirst = false;
|
||||
} else if (!isIdentifierChar(cp)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !isFirst;
|
||||
}
|
||||
57
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
Normal file
57
node_modules/@babel/helper-validator-identifier/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"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 = require("./identifier");
|
||||
|
||||
var _keyword = require("./keyword");
|
||||
38
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
Normal file
38
node_modules/@babel/helper-validator-identifier/lib/keyword.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
"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);
|
||||
}
|
||||
56
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
Normal file
56
node_modules/@babel/helper-validator-identifier/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/helper-validator-identifier@7.10.4",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/helper-validator-identifier@7.10.4",
|
||||
"_id": "@babel/helper-validator-identifier@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-p4x6clHgH2FlEtMbEK3PUq2l4NI=",
|
||||
"_location": "/@babel/helper-validator-identifier",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-validator-identifier@7.10.4",
|
||||
"name": "@babel/helper-validator-identifier",
|
||||
"escapedName": "@babel%2fhelper-validator-identifier",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/highlight",
|
||||
"/@babel/types"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@babel%2fhelper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz",
|
||||
"_spec": "7.10.4",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"description": "Validate identifier/keywords name",
|
||||
"devDependencies": {
|
||||
"charcodes": "^0.2.0",
|
||||
"unicode-13.0.0": "^0.8.0"
|
||||
},
|
||||
"exports": "./lib/index.js",
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://github.com/babel/babel#readme",
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "@babel/helper-validator-identifier",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-validator-identifier"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
}
|
||||
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
Normal file
75
node_modules/@babel/helper-validator-identifier/scripts/generate-identifier-regex.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
// Always use the latest available version of Unicode!
|
||||
// https://tc39.github.io/ecma262/#sec-conformance
|
||||
const version = "13.0.0";
|
||||
|
||||
const start = require("unicode-" +
|
||||
version +
|
||||
"/Binary_Property/ID_Start/code-points.js").filter(function (ch) {
|
||||
return ch > 0x7f;
|
||||
});
|
||||
let last = -1;
|
||||
const cont = [0x200c, 0x200d].concat(
|
||||
require("unicode-" +
|
||||
version +
|
||||
"/Binary_Property/ID_Continue/code-points.js").filter(function (ch) {
|
||||
return ch > 0x7f && search(start, ch, last + 1) == -1;
|
||||
})
|
||||
);
|
||||
|
||||
function search(arr, ch, starting) {
|
||||
for (let i = starting; arr[i] <= ch && i < arr.length; last = i++) {
|
||||
if (arr[i] === ch) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function pad(str, width) {
|
||||
while (str.length < width) str = "0" + str;
|
||||
return str;
|
||||
}
|
||||
|
||||
function esc(code) {
|
||||
const hex = code.toString(16);
|
||||
if (hex.length <= 2) return "\\x" + pad(hex, 2);
|
||||
else return "\\u" + pad(hex, 4);
|
||||
}
|
||||
|
||||
function generate(chars) {
|
||||
const astral = [];
|
||||
let re = "";
|
||||
for (let i = 0, at = 0x10000; i < chars.length; i++) {
|
||||
const from = chars[i];
|
||||
let to = from;
|
||||
while (i < chars.length - 1 && chars[i + 1] == to + 1) {
|
||||
i++;
|
||||
to++;
|
||||
}
|
||||
if (to <= 0xffff) {
|
||||
if (from == to) re += esc(from);
|
||||
else if (from + 1 == to) re += esc(from) + esc(to);
|
||||
else re += esc(from) + "-" + esc(to);
|
||||
} else {
|
||||
astral.push(from - at, to - from);
|
||||
at = to;
|
||||
}
|
||||
}
|
||||
return { nonASCII: re, astral: astral };
|
||||
}
|
||||
|
||||
const startData = generate(start);
|
||||
const contData = generate(cont);
|
||||
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log('let nonASCIIidentifierStartChars = "' + startData.nonASCII + '";');
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log('let nonASCIIidentifierChars = "' + contData.nonASCII + '";');
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log(
|
||||
"const astralIdentifierStartCodes = " + JSON.stringify(startData.astral) + ";"
|
||||
);
|
||||
console.log("/* prettier-ignore */");
|
||||
console.log(
|
||||
"const astralIdentifierCodes = " + JSON.stringify(contData.astral) + ";"
|
||||
);
|
||||
22
node_modules/@babel/highlight/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/highlight/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/highlight/README.md
generated
vendored
Normal file
19
node_modules/@babel/highlight/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/highlight
|
||||
|
||||
> Syntax highlight JavaScript strings for output in terminals.
|
||||
|
||||
See our website [@babel/highlight](https://babeljs.io/docs/en/next/babel-highlight.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/highlight
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/highlight --dev
|
||||
```
|
||||
107
node_modules/@babel/highlight/lib/index.js
generated
vendored
Normal file
107
node_modules/@babel/highlight/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.shouldHighlight = shouldHighlight;
|
||||
exports.getChalk = getChalk;
|
||||
exports.default = highlight;
|
||||
|
||||
var _jsTokens = _interopRequireWildcard(require("js-tokens"));
|
||||
|
||||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||
|
||||
var _chalk = _interopRequireDefault(require("chalk"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
keyword: chalk.cyan,
|
||||
capitalized: chalk.yellow,
|
||||
jsx_tag: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold
|
||||
};
|
||||
}
|
||||
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
|
||||
function getTokenType(match) {
|
||||
const [offset, text] = match.slice(-2);
|
||||
const token = (0, _jsTokens.matchToToken)(match);
|
||||
|
||||
if (token.type === "name") {
|
||||
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isReservedWord)(token.value)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
|
||||
return "jsx_tag";
|
||||
}
|
||||
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
|
||||
return token.type;
|
||||
}
|
||||
|
||||
function highlightTokens(defs, text) {
|
||||
return text.replace(_jsTokens.default, function (...args) {
|
||||
const type = getTokenType(args);
|
||||
const colorize = defs[type];
|
||||
|
||||
if (colorize) {
|
||||
return args[0].split(NEWLINE).map(str => colorize(str)).join("\n");
|
||||
} else {
|
||||
return args[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function shouldHighlight(options) {
|
||||
return _chalk.default.supportsColor || options.forceColor;
|
||||
}
|
||||
|
||||
function getChalk(options) {
|
||||
let chalk = _chalk.default;
|
||||
|
||||
if (options.forceColor) {
|
||||
chalk = new _chalk.default.constructor({
|
||||
enabled: true,
|
||||
level: 1
|
||||
});
|
||||
}
|
||||
|
||||
return chalk;
|
||||
}
|
||||
|
||||
function highlight(code, options = {}) {
|
||||
if (shouldHighlight(options)) {
|
||||
const chalk = getChalk(options);
|
||||
const defs = getDefs(chalk);
|
||||
return highlightTokens(defs, code);
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
62
node_modules/@babel/highlight/package.json
generated
vendored
Normal file
62
node_modules/@babel/highlight/package.json
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/highlight@7.10.4",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/highlight@7.10.4",
|
||||
"_id": "@babel/highlight@7.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-fRvf1ldTU4+r5sOFls23bZrGAUM=",
|
||||
"_location": "/@babel/highlight",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/highlight@7.10.4",
|
||||
"name": "@babel/highlight",
|
||||
"escapedName": "@babel%2fhighlight",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.10.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.10.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/code-frame"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@babel%2fhighlight/-/highlight-7.10.4.tgz",
|
||||
"_spec": "7.10.4",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "suchipi",
|
||||
"email": "me@suchipi.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.10.4",
|
||||
"chalk": "^2.0.0",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||
"devDependencies": {
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/highlight",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-highlight"
|
||||
},
|
||||
"version": "7.10.4"
|
||||
}
|
||||
1073
node_modules/@babel/parser/CHANGELOG.md
generated
vendored
Normal file
1073
node_modules/@babel/parser/CHANGELOG.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
node_modules/@babel/parser/LICENSE
generated
vendored
Normal file
19
node_modules/@babel/parser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (C) 2012-2014 by various contributors (see AUTHORS)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
19
node_modules/@babel/parser/README.md
generated
vendored
Normal file
19
node_modules/@babel/parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/parser
|
||||
|
||||
> A JavaScript parser
|
||||
|
||||
See our website [@babel/parser](https://babeljs.io/docs/en/babel-parser) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20parser%20(babylon)%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/parser
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/parser --dev
|
||||
```
|
||||
15
node_modules/@babel/parser/bin/babel-parser.js
generated
vendored
Normal file
15
node_modules/@babel/parser/bin/babel-parser.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint no-var: 0 */
|
||||
|
||||
var parser = require("..");
|
||||
var fs = require("fs");
|
||||
|
||||
var filename = process.argv[2];
|
||||
if (!filename) {
|
||||
console.error("no filename specified");
|
||||
} else {
|
||||
var file = fs.readFileSync(filename, "utf8");
|
||||
var ast = parser.parse(file);
|
||||
|
||||
console.log(JSON.stringify(ast, null, " "));
|
||||
}
|
||||
13482
node_modules/@babel/parser/lib/index.js
generated
vendored
Normal file
13482
node_modules/@babel/parser/lib/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@babel/parser/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/parser/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
35
node_modules/@babel/parser/lib/options.js
generated
vendored
Normal file
35
node_modules/@babel/parser/lib/options.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getOptions = getOptions;
|
||||
exports.defaultOptions = void 0;
|
||||
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
|
||||
};
|
||||
exports.defaultOptions = defaultOptions;
|
||||
|
||||
function getOptions(opts) {
|
||||
const options = {};
|
||||
|
||||
for (let _i = 0, _Object$keys = Object.keys(defaultOptions); _i < _Object$keys.length; _i++) {
|
||||
const key = _Object$keys[_i];
|
||||
options[key] = opts && opts[key] != null ? opts[key] : defaultOptions[key];
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
24
node_modules/@babel/parser/lib/parser/base.js
generated
vendored
Normal file
24
node_modules/@babel/parser/lib/parser/base.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = BaseParser;
|
||||
205
node_modules/@babel/parser/lib/parser/comments.js
generated
vendored
Normal file
205
node_modules/@babel/parser/lib/parser/comments.js
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _base = _interopRequireDefault(require("./base"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function last(stack) {
|
||||
return stack[stack.length - 1];
|
||||
}
|
||||
|
||||
class CommentsParser extends _base.default {
|
||||
addComment(comment) {
|
||||
if (this.filename) comment.loc.filename = this.filename;
|
||||
this.state.trailingComments.push(comment);
|
||||
this.state.leadingComments.push(comment);
|
||||
}
|
||||
|
||||
adjustCommentsAfterTrailingComma(node, elements, takeAllComments) {
|
||||
if (this.state.leadingComments.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let lastElement = null;
|
||||
let i = elements.length;
|
||||
|
||||
while (lastElement === null && i > 0) {
|
||||
lastElement = elements[--i];
|
||||
}
|
||||
|
||||
if (lastElement === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let j = 0; j < this.state.leadingComments.length; j++) {
|
||||
if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
|
||||
this.state.leadingComments.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
|
||||
const newTrailingComments = [];
|
||||
|
||||
for (let i = 0; i < this.state.leadingComments.length; i++) {
|
||||
const leadingComment = this.state.leadingComments[i];
|
||||
|
||||
if (leadingComment.end < node.end) {
|
||||
newTrailingComments.push(leadingComment);
|
||||
|
||||
if (!takeAllComments) {
|
||||
this.state.leadingComments.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
} else {
|
||||
if (node.trailingComments === undefined) {
|
||||
node.trailingComments = [];
|
||||
}
|
||||
|
||||
node.trailingComments.push(leadingComment);
|
||||
}
|
||||
}
|
||||
|
||||
if (takeAllComments) this.state.leadingComments = [];
|
||||
|
||||
if (newTrailingComments.length > 0) {
|
||||
lastElement.trailingComments = newTrailingComments;
|
||||
} else if (lastElement.trailingComments !== undefined) {
|
||||
lastElement.trailingComments = [];
|
||||
}
|
||||
}
|
||||
|
||||
processComment(node) {
|
||||
if (node.type === "Program" && node.body.length > 0) return;
|
||||
const stack = this.state.commentStack;
|
||||
let firstChild, lastChild, trailingComments, i, j;
|
||||
|
||||
if (this.state.trailingComments.length > 0) {
|
||||
if (this.state.trailingComments[0].start >= node.end) {
|
||||
trailingComments = this.state.trailingComments;
|
||||
this.state.trailingComments = [];
|
||||
} else {
|
||||
this.state.trailingComments.length = 0;
|
||||
}
|
||||
} else if (stack.length > 0) {
|
||||
const lastInStack = last(stack);
|
||||
|
||||
if (lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) {
|
||||
trailingComments = lastInStack.trailingComments;
|
||||
delete lastInStack.trailingComments;
|
||||
}
|
||||
}
|
||||
|
||||
if (stack.length > 0 && last(stack).start >= node.start) {
|
||||
firstChild = stack.pop();
|
||||
}
|
||||
|
||||
while (stack.length > 0 && last(stack).start >= node.start) {
|
||||
lastChild = stack.pop();
|
||||
}
|
||||
|
||||
if (!lastChild && firstChild) lastChild = firstChild;
|
||||
|
||||
if (firstChild) {
|
||||
switch (node.type) {
|
||||
case "ObjectExpression":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.properties);
|
||||
break;
|
||||
|
||||
case "ObjectPattern":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.properties, true);
|
||||
break;
|
||||
|
||||
case "CallExpression":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.arguments);
|
||||
break;
|
||||
|
||||
case "ArrayExpression":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.elements);
|
||||
break;
|
||||
|
||||
case "ArrayPattern":
|
||||
this.adjustCommentsAfterTrailingComma(node, node.elements, true);
|
||||
break;
|
||||
}
|
||||
} else if (this.state.commentPreviousNode && (this.state.commentPreviousNode.type === "ImportSpecifier" && node.type !== "ImportSpecifier" || this.state.commentPreviousNode.type === "ExportSpecifier" && node.type !== "ExportSpecifier")) {
|
||||
this.adjustCommentsAfterTrailingComma(node, [this.state.commentPreviousNode]);
|
||||
}
|
||||
|
||||
if (lastChild) {
|
||||
if (lastChild.leadingComments) {
|
||||
if (lastChild !== node && lastChild.leadingComments.length > 0 && last(lastChild.leadingComments).end <= node.start) {
|
||||
node.leadingComments = lastChild.leadingComments;
|
||||
delete lastChild.leadingComments;
|
||||
} else {
|
||||
for (i = lastChild.leadingComments.length - 2; i >= 0; --i) {
|
||||
if (lastChild.leadingComments[i].end <= node.start) {
|
||||
node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.state.leadingComments.length > 0) {
|
||||
if (last(this.state.leadingComments).end <= node.start) {
|
||||
if (this.state.commentPreviousNode) {
|
||||
for (j = 0; j < this.state.leadingComments.length; j++) {
|
||||
if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
|
||||
this.state.leadingComments.splice(j, 1);
|
||||
j--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.state.leadingComments.length > 0) {
|
||||
node.leadingComments = this.state.leadingComments;
|
||||
this.state.leadingComments = [];
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < this.state.leadingComments.length; i++) {
|
||||
if (this.state.leadingComments[i].end > node.start) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const leadingComments = this.state.leadingComments.slice(0, i);
|
||||
|
||||
if (leadingComments.length) {
|
||||
node.leadingComments = leadingComments;
|
||||
}
|
||||
|
||||
trailingComments = this.state.leadingComments.slice(i);
|
||||
|
||||
if (trailingComments.length === 0) {
|
||||
trailingComments = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.state.commentPreviousNode = node;
|
||||
|
||||
if (trailingComments) {
|
||||
if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
|
||||
node.innerComments = trailingComments;
|
||||
} else {
|
||||
const firstTrailingCommentIndex = trailingComments.findIndex(comment => comment.end >= node.end);
|
||||
|
||||
if (firstTrailingCommentIndex > 0) {
|
||||
node.innerComments = trailingComments.slice(0, firstTrailingCommentIndex);
|
||||
node.trailingComments = trailingComments.slice(firstTrailingCommentIndex);
|
||||
} else {
|
||||
node.trailingComments = trailingComments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stack.push(node);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = CommentsParser;
|
||||
154
node_modules/@babel/parser/lib/parser/error-message.js
generated
vendored
Normal file
154
node_modules/@babel/parser/lib/parser/error-message.js
generated
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ErrorMessages = void 0;
|
||||
const ErrorMessages = Object.freeze({
|
||||
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",
|
||||
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: "getter must not have any formal parameters",
|
||||
BadSetterArity: "setter must have exactly one formal parameter",
|
||||
BadSetterRestParameter: "setter function argument must not be a rest parameter",
|
||||
ConstructorClassField: "Classes may not have a field named 'constructor'",
|
||||
ConstructorClassPrivateField: "Classes may not have a private field named '#constructor'",
|
||||
ConstructorIsAccessor: "Class constructor may not be an accessor",
|
||||
ConstructorIsAsync: "Constructor can't be an async function",
|
||||
ConstructorIsGenerator: "Constructor can't be a generator",
|
||||
DeclarationMissingInitializer: "%0 require an initialization value",
|
||||
DecoratorBeforeExport: "Decorators must be placed *before* the 'export' keyword. You can set the 'decoratorsBeforeExport' option to false to use the 'export @decorator class {}' syntax",
|
||||
DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",
|
||||
DecoratorExportClass: "Using the export keyword between a decorator and a class is not allowed. Please use `export @dec class` instead.",
|
||||
DecoratorSemicolon: "Decorators must not be followed by a semicolon",
|
||||
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",
|
||||
DuplicateStaticBlock: "Duplicate static block in the same class",
|
||||
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",
|
||||
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()",
|
||||
ImportMetaOutsideModule: `import.meta may appear only with 'sourceType: "module"'`,
|
||||
ImportOutsideModule: `'import' and 'export' may appear only with 'sourceType: "module"'`,
|
||||
InvalidBigIntLiteral: "Invalid BigIntLiteral",
|
||||
InvalidCodePoint: "Code point out of bounds",
|
||||
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.",
|
||||
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",
|
||||
ParamDupe: "Argument name clash",
|
||||
PatternHasAccessor: "Object pattern can't contain getter or setter",
|
||||
PatternHasMethod: "Object pattern can't contain methods",
|
||||
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized',
|
||||
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression",
|
||||
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression",
|
||||
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference",
|
||||
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding",
|
||||
PrimaryTopicRequiresSmartPipeline: "Primary Topic Reference found but pipelineOperator not passed 'smart' for 'proposal' option.",
|
||||
PrivateInExpectedIn: "Private names are only allowed in property accesses (`obj.#%0`) or in `in` expressions (`#%0 in obj`)",
|
||||
PrivateNameRedeclaration: "Duplicate private name #%0",
|
||||
RecordExpressionBarIncorrectEndSyntaxType: "Record expressions ending with '|}' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
|
||||
RecordExpressionBarIncorrectStartSyntaxType: "Record expressions starting with '{|' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'bar'",
|
||||
RecordExpressionHashIncorrectStartSyntaxType: "Record expressions starting with '#{' are only allowed when the 'syntaxType' option of the 'recordAndTuple' plugin is set to 'hash'",
|
||||
RecordNoProto: "'__proto__' is not allowed in Record expressions",
|
||||
RestTrailingComma: "Unexpected trailing comma after rest element",
|
||||
SloppyFunction: "In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement",
|
||||
StaticPrototype: "Classes may not have static property named prototype",
|
||||
StrictDelete: "Deleting local variable in strict mode",
|
||||
StrictEvalArguments: "Assigning to '%0' in strict mode",
|
||||
StrictEvalArgumentsBinding: "Binding '%0' in strict mode",
|
||||
StrictFunction: "In strict mode code, functions can only be declared at top level or inside a block",
|
||||
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",
|
||||
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"
|
||||
});
|
||||
exports.ErrorMessages = ErrorMessages;
|
||||
56
node_modules/@babel/parser/lib/parser/error.js
generated
vendored
Normal file
56
node_modules/@babel/parser/lib/parser/error.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "Errors", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _errorMessage.ErrorMessages;
|
||||
}
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _location = require("../util/location");
|
||||
|
||||
var _comments = _interopRequireDefault(require("./comments"));
|
||||
|
||||
var _errorMessage = require("./error-message.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class ParserError extends _comments.default {
|
||||
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 = (0, _location.getLineInfo)(this.input, pos);
|
||||
return loc;
|
||||
}
|
||||
|
||||
raise(pos, errorTemplate, ...params) {
|
||||
return this.raiseWithData(pos, undefined, errorTemplate, ...params);
|
||||
}
|
||||
|
||||
raiseWithData(pos, data, errorTemplate, ...params) {
|
||||
const loc = this.getLocationForPosition(pos);
|
||||
const message = errorTemplate.replace(/%(\d+)/g, (_, i) => params[i]) + ` (${loc.line}:${loc.column})`;
|
||||
return this._raise(Object.assign({
|
||||
loc,
|
||||
pos
|
||||
}, data), message);
|
||||
}
|
||||
|
||||
_raise(errorContext, message) {
|
||||
const err = new SyntaxError(message);
|
||||
Object.assign(err, errorContext);
|
||||
|
||||
if (this.options.errorRecovery) {
|
||||
if (!this.isLookahead) this.state.errors.push(err);
|
||||
return err;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ParserError;
|
||||
1835
node_modules/@babel/parser/lib/parser/expression.js
generated
vendored
Normal file
1835
node_modules/@babel/parser/lib/parser/expression.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
79
node_modules/@babel/parser/lib/parser/index.js
generated
vendored
Normal file
79
node_modules/@babel/parser/lib/parser/index.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _options = require("../options");
|
||||
|
||||
var _statement = _interopRequireDefault(require("./statement"));
|
||||
|
||||
var _scopeflags = require("../util/scopeflags");
|
||||
|
||||
var _scope = _interopRequireDefault(require("../util/scope"));
|
||||
|
||||
var _classScope = _interopRequireDefault(require("../util/class-scope"));
|
||||
|
||||
var _expressionScope = _interopRequireDefault(require("../util/expression-scope"));
|
||||
|
||||
var _productionParameter = _interopRequireWildcard(require("../util/production-parameter"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Parser extends _statement.default {
|
||||
constructor(options, input) {
|
||||
options = (0, _options.getOptions)(options);
|
||||
super(options, input);
|
||||
const ScopeHandler = this.getScopeHandler();
|
||||
this.options = options;
|
||||
this.inModule = this.options.sourceType === "module";
|
||||
this.scope = new ScopeHandler(this.raise.bind(this), this.inModule);
|
||||
this.prodParam = new _productionParameter.default();
|
||||
this.classScope = new _classScope.default(this.raise.bind(this));
|
||||
this.expressionScope = new _expressionScope.default(this.raise.bind(this));
|
||||
this.plugins = pluginsMap(this.options.plugins);
|
||||
this.filename = options.sourceFilename;
|
||||
}
|
||||
|
||||
getScopeHandler() {
|
||||
return _scope.default;
|
||||
}
|
||||
|
||||
parse() {
|
||||
let paramFlags = _productionParameter.PARAM;
|
||||
|
||||
if (this.hasPlugin("topLevelAwait") && this.inModule) {
|
||||
paramFlags |= _productionParameter.PARAM_AWAIT;
|
||||
}
|
||||
|
||||
this.scope.enter(_scopeflags.SCOPE_PROGRAM);
|
||||
this.prodParam.enter(paramFlags);
|
||||
const file = this.startNode();
|
||||
const program = this.startNode();
|
||||
this.nextToken();
|
||||
file.errors = null;
|
||||
this.parseTopLevel(file, program);
|
||||
file.errors = this.state.errors;
|
||||
return file;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = Parser;
|
||||
|
||||
function pluginsMap(plugins) {
|
||||
const pluginMap = new Map();
|
||||
|
||||
for (let _i = 0; _i < plugins.length; _i++) {
|
||||
const plugin = plugins[_i];
|
||||
const [name, options] = Array.isArray(plugin) ? plugin : [plugin, {}];
|
||||
if (!pluginMap.has(name)) pluginMap.set(name, options || {});
|
||||
}
|
||||
|
||||
return pluginMap;
|
||||
}
|
||||
358
node_modules/@babel/parser/lib/parser/lval.js
generated
vendored
Normal file
358
node_modules/@babel/parser/lib/parser/lval.js
generated
vendored
Normal file
@@ -0,0 +1,358 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var _identifier = require("../util/identifier");
|
||||
|
||||
var _node = require("./node");
|
||||
|
||||
var _scopeflags = require("../util/scopeflags");
|
||||
|
||||
var _util = require("./util");
|
||||
|
||||
var _error = require("./error");
|
||||
|
||||
const unwrapParenthesizedExpression = node => {
|
||||
return node.type === "ParenthesizedExpression" ? unwrapParenthesizedExpression(node.expression) : node;
|
||||
};
|
||||
|
||||
class LValParser extends _node.NodeUtils {
|
||||
toAssignable(node) {
|
||||
let parenthesized = undefined;
|
||||
|
||||
if (node.type === "ParenthesizedExpression" || node.extra?.parenthesized) {
|
||||
parenthesized = unwrapParenthesizedExpression(node);
|
||||
|
||||
if (parenthesized.type !== "Identifier" && parenthesized.type !== "MemberExpression") {
|
||||
this.raise(node.start, _error.Errors.InvalidParenthesizedAssignment);
|
||||
}
|
||||
}
|
||||
|
||||
switch (node.type) {
|
||||
case "Identifier":
|
||||
case "ObjectPattern":
|
||||
case "ArrayPattern":
|
||||
case "AssignmentPattern":
|
||||
break;
|
||||
|
||||
case "ObjectExpression":
|
||||
node.type = "ObjectPattern";
|
||||
|
||||
for (let i = 0, length = node.properties.length, last = length - 1; i < length; i++) {
|
||||
const prop = node.properties[i];
|
||||
const isLast = i === last;
|
||||
this.toAssignableObjectExpressionProp(prop, isLast);
|
||||
|
||||
if (isLast && prop.type === "RestElement" && node.extra?.trailingComma) {
|
||||
this.raiseRestNotLast(node.extra.trailingComma);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "ObjectProperty":
|
||||
this.toAssignable(node.value);
|
||||
break;
|
||||
|
||||
case "SpreadElement":
|
||||
{
|
||||
this.checkToRestConversion(node);
|
||||
node.type = "RestElement";
|
||||
const arg = node.argument;
|
||||
this.toAssignable(arg);
|
||||
break;
|
||||
}
|
||||
|
||||
case "ArrayExpression":
|
||||
node.type = "ArrayPattern";
|
||||
this.toAssignableList(node.elements, node.extra?.trailingComma);
|
||||
break;
|
||||
|
||||
case "AssignmentExpression":
|
||||
if (node.operator !== "=") {
|
||||
this.raise(node.left.end, _error.Errors.MissingEqInAssignment);
|
||||
}
|
||||
|
||||
node.type = "AssignmentPattern";
|
||||
delete node.operator;
|
||||
this.toAssignable(node.left);
|
||||
break;
|
||||
|
||||
case "ParenthesizedExpression":
|
||||
this.toAssignable(parenthesized);
|
||||
break;
|
||||
|
||||
default:
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
toAssignableObjectExpressionProp(prop, isLast) {
|
||||
if (prop.type === "ObjectMethod") {
|
||||
const error = prop.kind === "get" || prop.kind === "set" ? _error.Errors.PatternHasAccessor : _error.Errors.PatternHasMethod;
|
||||
this.raise(prop.key.start, error);
|
||||
} else if (prop.type === "SpreadElement" && !isLast) {
|
||||
this.raiseRestNotLast(prop.start);
|
||||
} else {
|
||||
this.toAssignable(prop);
|
||||
}
|
||||
}
|
||||
|
||||
toAssignableList(exprList, trailingCommaPos) {
|
||||
let end = exprList.length;
|
||||
|
||||
if (end) {
|
||||
const last = exprList[end - 1];
|
||||
|
||||
if (last?.type === "RestElement") {
|
||||
--end;
|
||||
} else if (last?.type === "SpreadElement") {
|
||||
last.type = "RestElement";
|
||||
const arg = last.argument;
|
||||
this.toAssignable(arg);
|
||||
|
||||
if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern" && arg.type !== "ObjectPattern") {
|
||||
this.unexpected(arg.start);
|
||||
}
|
||||
|
||||
if (trailingCommaPos) {
|
||||
this.raiseTrailingCommaAfterRest(trailingCommaPos);
|
||||
}
|
||||
|
||||
--end;
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < end; i++) {
|
||||
const elt = exprList[i];
|
||||
|
||||
if (elt) {
|
||||
this.toAssignable(elt);
|
||||
|
||||
if (elt.type === "RestElement") {
|
||||
this.raiseRestNotLast(elt.start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return exprList;
|
||||
}
|
||||
|
||||
toReferencedList(exprList, isParenthesizedExpr) {
|
||||
return exprList;
|
||||
}
|
||||
|
||||
toReferencedListDeep(exprList, isParenthesizedExpr) {
|
||||
this.toReferencedList(exprList, isParenthesizedExpr);
|
||||
|
||||
for (let _i = 0; _i < exprList.length; _i++) {
|
||||
const expr = exprList[_i];
|
||||
|
||||
if (expr?.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 _types.types.bracketL:
|
||||
{
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
node.elements = this.parseBindingList(_types.types.bracketR, 93, true);
|
||||
return this.finishNode(node, "ArrayPattern");
|
||||
}
|
||||
|
||||
case _types.types.braceL:
|
||||
return this.parseObjectLike(_types.types.braceR, true);
|
||||
}
|
||||
|
||||
return this.parseIdentifier();
|
||||
}
|
||||
|
||||
parseBindingList(close, closeCharCode, allowEmpty, allowModifiers) {
|
||||
const elts = [];
|
||||
let first = true;
|
||||
|
||||
while (!this.eat(close)) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
this.expect(_types.types.comma);
|
||||
}
|
||||
|
||||
if (allowEmpty && this.match(_types.types.comma)) {
|
||||
elts.push(null);
|
||||
} else if (this.eat(close)) {
|
||||
break;
|
||||
} else if (this.match(_types.types.ellipsis)) {
|
||||
elts.push(this.parseAssignableListItemTypes(this.parseRestBinding()));
|
||||
this.checkCommaAfterRest(closeCharCode);
|
||||
this.expect(close);
|
||||
break;
|
||||
} else {
|
||||
const decorators = [];
|
||||
|
||||
if (this.match(_types.types.at) && this.hasPlugin("decorators")) {
|
||||
this.raise(this.state.start, _error.Errors.UnsupportedParameterDecorator);
|
||||
}
|
||||
|
||||
while (this.match(_types.types.at)) {
|
||||
decorators.push(this.parseDecorator());
|
||||
}
|
||||
|
||||
elts.push(this.parseAssignableListItem(allowModifiers, decorators));
|
||||
}
|
||||
}
|
||||
|
||||
return elts;
|
||||
}
|
||||
|
||||
parseAssignableListItem(allowModifiers, decorators) {
|
||||
const left = this.parseMaybeDefault();
|
||||
this.parseAssignableListItemTypes(left);
|
||||
const elt = this.parseMaybeDefault(left.start, left.loc.start, left);
|
||||
|
||||
if (decorators.length) {
|
||||
left.decorators = decorators;
|
||||
}
|
||||
|
||||
return elt;
|
||||
}
|
||||
|
||||
parseAssignableListItemTypes(param) {
|
||||
return param;
|
||||
}
|
||||
|
||||
parseMaybeDefault(startPos, startLoc, left) {
|
||||
startLoc = startLoc ?? this.state.startLoc;
|
||||
startPos = startPos ?? this.state.start;
|
||||
left = left ?? this.parseBindingAtom();
|
||||
if (!this.eat(_types.types.eq)) return left;
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.left = left;
|
||||
node.right = this.parseMaybeAssignAllowIn();
|
||||
return this.finishNode(node, "AssignmentPattern");
|
||||
}
|
||||
|
||||
checkLVal(expr, bindingType = _scopeflags.BIND_NONE, checkClashes, contextDescription, disallowLetBinding, strictModeChanged = false) {
|
||||
switch (expr.type) {
|
||||
case "Identifier":
|
||||
if (this.state.strict && (strictModeChanged ? (0, _identifier.isStrictBindReservedWord)(expr.name, this.inModule) : (0, _identifier.isStrictBindOnlyReservedWord)(expr.name))) {
|
||||
this.raise(expr.start, bindingType === _scopeflags.BIND_NONE ? _error.Errors.StrictEvalArguments : _error.Errors.StrictEvalArgumentsBinding, expr.name);
|
||||
}
|
||||
|
||||
if (checkClashes) {
|
||||
const key = `_${expr.name}`;
|
||||
|
||||
if (checkClashes[key]) {
|
||||
this.raise(expr.start, _error.Errors.ParamDupe);
|
||||
} else {
|
||||
checkClashes[key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (disallowLetBinding && expr.name === "let") {
|
||||
this.raise(expr.start, _error.Errors.LetInLexicalBinding);
|
||||
}
|
||||
|
||||
if (!(bindingType & _scopeflags.BIND_NONE)) {
|
||||
this.scope.declareName(expr.name, bindingType, expr.start);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "MemberExpression":
|
||||
if (bindingType !== _scopeflags.BIND_NONE) {
|
||||
this.raise(expr.start, _error.Errors.InvalidPropertyBindingPattern);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "ObjectPattern":
|
||||
for (let _i2 = 0, _expr$properties = expr.properties; _i2 < _expr$properties.length; _i2++) {
|
||||
let prop = _expr$properties[_i2];
|
||||
if (prop.type === "ObjectProperty") prop = prop.value;else if (prop.type === "ObjectMethod") continue;
|
||||
this.checkLVal(prop, bindingType, checkClashes, "object destructuring pattern", disallowLetBinding);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "ArrayPattern":
|
||||
for (let _i3 = 0, _expr$elements = expr.elements; _i3 < _expr$elements.length; _i3++) {
|
||||
const elem = _expr$elements[_i3];
|
||||
|
||||
if (elem) {
|
||||
this.checkLVal(elem, bindingType, checkClashes, "array destructuring pattern", disallowLetBinding);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "AssignmentPattern":
|
||||
this.checkLVal(expr.left, bindingType, checkClashes, "assignment pattern");
|
||||
break;
|
||||
|
||||
case "RestElement":
|
||||
this.checkLVal(expr.argument, bindingType, checkClashes, "rest element");
|
||||
break;
|
||||
|
||||
case "ParenthesizedExpression":
|
||||
this.checkLVal(expr.expression, bindingType, checkClashes, "parenthesized expression");
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
this.raise(expr.start, bindingType === _scopeflags.BIND_NONE ? _error.Errors.InvalidLhs : _error.Errors.InvalidLhsBinding, contextDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkToRestConversion(node) {
|
||||
if (node.argument.type !== "Identifier" && node.argument.type !== "MemberExpression") {
|
||||
this.raise(node.argument.start, _error.Errors.InvalidRestAssignmentPattern);
|
||||
}
|
||||
}
|
||||
|
||||
checkCommaAfterRest(close) {
|
||||
if (this.match(_types.types.comma)) {
|
||||
if (this.lookaheadCharCode() === close) {
|
||||
this.raiseTrailingCommaAfterRest(this.state.start);
|
||||
} else {
|
||||
this.raiseRestNotLast(this.state.start);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
raiseRestNotLast(pos) {
|
||||
throw this.raise(pos, _error.Errors.ElementAfterRest);
|
||||
}
|
||||
|
||||
raiseTrailingCommaAfterRest(pos) {
|
||||
this.raise(pos, _error.Errors.RestTrailingComma);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = LValParser;
|
||||
98
node_modules/@babel/parser/lib/parser/node.js
generated
vendored
Normal file
98
node_modules/@babel/parser/lib/parser/node.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.NodeUtils = void 0;
|
||||
|
||||
var _util = _interopRequireDefault(require("./util"));
|
||||
|
||||
var _location = require("../util/location");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class Node {
|
||||
constructor(parser, pos, loc) {
|
||||
this.type = void 0;
|
||||
this.start = void 0;
|
||||
this.end = void 0;
|
||||
this.loc = void 0;
|
||||
this.range = void 0;
|
||||
this.leadingComments = void 0;
|
||||
this.trailingComments = void 0;
|
||||
this.innerComments = void 0;
|
||||
this.extra = void 0;
|
||||
this.type = "";
|
||||
this.start = pos;
|
||||
this.end = 0;
|
||||
this.loc = new _location.SourceLocation(loc);
|
||||
if (parser?.options.ranges) this.range = [pos, 0];
|
||||
if (parser?.filename) this.loc.filename = parser.filename;
|
||||
}
|
||||
|
||||
__clone() {
|
||||
const newNode = new Node();
|
||||
const keys = Object.keys(this);
|
||||
|
||||
for (let i = 0, length = keys.length; i < length; i++) {
|
||||
const key = keys[i];
|
||||
|
||||
if (key !== "leadingComments" && key !== "trailingComments" && key !== "innerComments") {
|
||||
newNode[key] = this[key];
|
||||
}
|
||||
}
|
||||
|
||||
return newNode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class NodeUtils extends _util.default {
|
||||
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) {
|
||||
if (process.env.NODE_ENV !== "production" && node.end > 0) {
|
||||
throw new Error("Do not call finishNode*() twice on the same node." + " Instead use resetEndLocation() or change type directly.");
|
||||
}
|
||||
|
||||
node.type = type;
|
||||
node.end = pos;
|
||||
node.loc.end = loc;
|
||||
if (this.options.ranges) node.range[1] = pos;
|
||||
this.processComment(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
resetStartLocation(node, start, startLoc) {
|
||||
node.start = start;
|
||||
node.loc.start = startLoc;
|
||||
if (this.options.ranges) node.range[0] = start;
|
||||
}
|
||||
|
||||
resetEndLocation(node, end = this.state.lastTokEnd, endLoc = this.state.lastTokEndLoc) {
|
||||
node.end = end;
|
||||
node.loc.end = endLoc;
|
||||
if (this.options.ranges) node.range[1] = end;
|
||||
}
|
||||
|
||||
resetStartLocationFromNode(node, locationNode) {
|
||||
this.resetStartLocation(node, locationNode.start, locationNode.loc.start);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.NodeUtils = NodeUtils;
|
||||
1741
node_modules/@babel/parser/lib/parser/statement.js
generated
vendored
Normal file
1741
node_modules/@babel/parser/lib/parser/statement.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
206
node_modules/@babel/parser/lib/parser/util.js
generated
vendored
Normal file
206
node_modules/@babel/parser/lib/parser/util.js
generated
vendored
Normal file
@@ -0,0 +1,206 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ExpressionErrors = exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var _tokenizer = _interopRequireDefault(require("../tokenizer"));
|
||||
|
||||
var _state = _interopRequireDefault(require("../tokenizer/state"));
|
||||
|
||||
var _whitespace = require("../util/whitespace");
|
||||
|
||||
var _identifier = require("../util/identifier");
|
||||
|
||||
var _error = require("./error");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
class UtilParser extends _tokenizer.default {
|
||||
addExtra(node, key, val) {
|
||||
if (!node) return;
|
||||
const extra = node.extra = node.extra || {};
|
||||
extra[key] = val;
|
||||
}
|
||||
|
||||
isRelational(op) {
|
||||
return this.match(_types.types.relational) && this.state.value === op;
|
||||
}
|
||||
|
||||
expectRelational(op) {
|
||||
if (this.isRelational(op)) {
|
||||
this.next();
|
||||
} else {
|
||||
this.unexpected(null, _types.types.relational);
|
||||
}
|
||||
}
|
||||
|
||||
isContextual(name) {
|
||||
return this.match(_types.types.name) && this.state.value === name && !this.state.containsEsc;
|
||||
}
|
||||
|
||||
isUnparsedContextual(nameStart, name) {
|
||||
const nameEnd = nameStart + name.length;
|
||||
return this.input.slice(nameStart, nameEnd) === name && (nameEnd === this.input.length || !(0, _identifier.isIdentifierChar)(this.input.charCodeAt(nameEnd)));
|
||||
}
|
||||
|
||||
isLookaheadContextual(name) {
|
||||
const next = this.nextTokenStart();
|
||||
return this.isUnparsedContextual(next, name);
|
||||
}
|
||||
|
||||
eatContextual(name) {
|
||||
return this.isContextual(name) && this.eat(_types.types.name);
|
||||
}
|
||||
|
||||
expectContextual(name, message) {
|
||||
if (!this.eatContextual(name)) this.unexpected(null, message);
|
||||
}
|
||||
|
||||
canInsertSemicolon() {
|
||||
return this.match(_types.types.eof) || this.match(_types.types.braceR) || this.hasPrecedingLineBreak();
|
||||
}
|
||||
|
||||
hasPrecedingLineBreak() {
|
||||
return _whitespace.lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
|
||||
}
|
||||
|
||||
isLineTerminator() {
|
||||
return this.eat(_types.types.semi) || this.canInsertSemicolon();
|
||||
}
|
||||
|
||||
semicolon() {
|
||||
if (!this.isLineTerminator()) this.unexpected(null, _types.types.semi);
|
||||
}
|
||||
|
||||
expect(type, pos) {
|
||||
this.eat(type) || this.unexpected(pos, type);
|
||||
}
|
||||
|
||||
assertNoSpace(message = "Unexpected space.") {
|
||||
if (this.state.start > this.state.lastTokEnd) {
|
||||
this.raise(this.state.lastTokEnd, message);
|
||||
}
|
||||
}
|
||||
|
||||
unexpected(pos, messageOrType = "Unexpected token") {
|
||||
if (typeof messageOrType !== "string") {
|
||||
messageOrType = `Unexpected token, expected "${messageOrType.label}"`;
|
||||
}
|
||||
|
||||
throw this.raise(pos != null ? pos : this.state.start, messageOrType);
|
||||
}
|
||||
|
||||
expectPlugin(name, pos) {
|
||||
if (!this.hasPlugin(name)) {
|
||||
throw this.raiseWithData(pos != null ? pos : this.state.start, {
|
||||
missingPlugin: [name]
|
||||
}, `This experimental syntax requires enabling the parser plugin: '${name}'`);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
expectOnePlugin(names, pos) {
|
||||
if (!names.some(n => this.hasPlugin(n))) {
|
||||
throw this.raiseWithData(pos != null ? pos : this.state.start, {
|
||||
missingPlugin: names
|
||||
}, `This experimental syntax requires enabling one of the following parser plugin(s): '${names.join(", ")}'`);
|
||||
}
|
||||
}
|
||||
|
||||
tryParse(fn, oldState = this.state.clone()) {
|
||||
const abortSignal = {
|
||||
node: null
|
||||
};
|
||||
|
||||
try {
|
||||
const node = fn((node = null) => {
|
||||
abortSignal.node = node;
|
||||
throw abortSignal;
|
||||
});
|
||||
|
||||
if (this.state.errors.length > oldState.errors.length) {
|
||||
const failState = this.state;
|
||||
this.state = oldState;
|
||||
return {
|
||||
node,
|
||||
error: failState.errors[oldState.errors.length],
|
||||
thrown: false,
|
||||
aborted: false,
|
||||
failState
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
node,
|
||||
error: null,
|
||||
thrown: false,
|
||||
aborted: false,
|
||||
failState: null
|
||||
};
|
||||
} catch (error) {
|
||||
const failState = this.state;
|
||||
this.state = oldState;
|
||||
|
||||
if (error instanceof SyntaxError) {
|
||||
return {
|
||||
node: null,
|
||||
error,
|
||||
thrown: true,
|
||||
aborted: false,
|
||||
failState
|
||||
};
|
||||
}
|
||||
|
||||
if (error === abortSignal) {
|
||||
return {
|
||||
node: abortSignal.node,
|
||||
error: null,
|
||||
thrown: false,
|
||||
aborted: true,
|
||||
failState
|
||||
};
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
checkExpressionErrors(refExpressionErrors, andThrow) {
|
||||
if (!refExpressionErrors) return false;
|
||||
const {
|
||||
shorthandAssign,
|
||||
doubleProto
|
||||
} = refExpressionErrors;
|
||||
if (!andThrow) return shorthandAssign >= 0 || doubleProto >= 0;
|
||||
|
||||
if (shorthandAssign >= 0) {
|
||||
this.unexpected(shorthandAssign);
|
||||
}
|
||||
|
||||
if (doubleProto >= 0) {
|
||||
this.raise(doubleProto, _error.Errors.DuplicateProto);
|
||||
}
|
||||
}
|
||||
|
||||
isLiteralPropertyName() {
|
||||
return this.match(_types.types.name) || !!this.state.type.keyword || this.match(_types.types.string) || this.match(_types.types.num) || this.match(_types.types.bigint) || this.match(_types.types.decimal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = UtilParser;
|
||||
|
||||
class ExpressionErrors {
|
||||
constructor() {
|
||||
this.shorthandAssign = -1;
|
||||
this.doubleProto = -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ExpressionErrors = ExpressionErrors;
|
||||
108
node_modules/@babel/parser/lib/plugin-utils.js
generated
vendored
Normal file
108
node_modules/@babel/parser/lib/plugin-utils.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasPlugin = hasPlugin;
|
||||
exports.getPluginOption = getPluginOption;
|
||||
exports.validatePlugins = validatePlugins;
|
||||
exports.mixinPluginNames = exports.mixinPlugins = void 0;
|
||||
|
||||
var _estree = _interopRequireDefault(require("./plugins/estree"));
|
||||
|
||||
var _flow = _interopRequireDefault(require("./plugins/flow"));
|
||||
|
||||
var _jsx = _interopRequireDefault(require("./plugins/jsx"));
|
||||
|
||||
var _typescript = _interopRequireDefault(require("./plugins/typescript"));
|
||||
|
||||
var _placeholders = _interopRequireDefault(require("./plugins/placeholders"));
|
||||
|
||||
var _v8intrinsic = _interopRequireDefault(require("./plugins/v8intrinsic"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function hasPlugin(plugins, name) {
|
||||
return plugins.some(plugin => {
|
||||
if (Array.isArray(plugin)) {
|
||||
return plugin[0] === name;
|
||||
} else {
|
||||
return plugin === name;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getPluginOption(plugins, name, option) {
|
||||
const plugin = plugins.find(plugin => {
|
||||
if (Array.isArray(plugin)) {
|
||||
return plugin[0] === name;
|
||||
} else {
|
||||
return plugin === name;
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin && Array.isArray(plugin)) {
|
||||
return plugin[1][option];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const PIPELINE_PROPOSALS = ["minimal", "smart", "fsharp"];
|
||||
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
||||
|
||||
function validatePlugins(plugins) {
|
||||
if (hasPlugin(plugins, "decorators")) {
|
||||
if (hasPlugin(plugins, "decorators-legacy")) {
|
||||
throw new Error("Cannot use the decorators and decorators-legacy plugin together");
|
||||
}
|
||||
|
||||
const decoratorsBeforeExport = getPluginOption(plugins, "decorators", "decoratorsBeforeExport");
|
||||
|
||||
if (decoratorsBeforeExport == null) {
|
||||
throw new Error("The 'decorators' plugin requires a 'decoratorsBeforeExport' option," + " whose value must be a boolean. If you are migrating from" + " Babylon/Babel 6 or want to use the old decorators proposal, you" + " should use the 'decorators-legacy' plugin instead of 'decorators'.");
|
||||
} else if (typeof decoratorsBeforeExport !== "boolean") {
|
||||
throw new Error("'decoratorsBeforeExport' must be a boolean.");
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "flow") && hasPlugin(plugins, "typescript")) {
|
||||
throw new Error("Cannot combine flow and typescript plugins.");
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "placeholders") && hasPlugin(plugins, "v8intrinsic")) {
|
||||
throw new Error("Cannot combine placeholders and v8intrinsic plugins.");
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "pipelineOperator") && !PIPELINE_PROPOSALS.includes(getPluginOption(plugins, "pipelineOperator", "proposal"))) {
|
||||
throw new Error("'pipelineOperator' requires 'proposal' option whose value should be one of: " + PIPELINE_PROPOSALS.map(p => `'${p}'`).join(", "));
|
||||
}
|
||||
|
||||
if (hasPlugin(plugins, "moduleAttributes")) {
|
||||
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(", "));
|
||||
}
|
||||
}
|
||||
|
||||
const mixinPlugins = {
|
||||
estree: _estree.default,
|
||||
jsx: _jsx.default,
|
||||
flow: _flow.default,
|
||||
typescript: _typescript.default,
|
||||
v8intrinsic: _v8intrinsic.default,
|
||||
placeholders: _placeholders.default
|
||||
};
|
||||
exports.mixinPlugins = mixinPlugins;
|
||||
const mixinPluginNames = Object.keys(mixinPlugins);
|
||||
exports.mixinPluginNames = mixinPluginNames;
|
||||
297
node_modules/@babel/parser/lib/plugins/estree.js
generated
vendored
Normal file
297
node_modules/@babel/parser/lib/plugins/estree.js
generated
vendored
Normal file
@@ -0,0 +1,297 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
var _scopeflags = require("../util/scopeflags");
|
||||
|
||||
var _error = require("../parser/error");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function isSimpleProperty(node) {
|
||||
return node != null && node.type === "Property" && node.kind === "init" && node.method === false;
|
||||
}
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
estreeParseRegExpLiteral({
|
||||
pattern,
|
||||
flags
|
||||
}) {
|
||||
let regex = null;
|
||||
|
||||
try {
|
||||
regex = new RegExp(pattern, flags);
|
||||
} catch (e) {}
|
||||
|
||||
const node = this.estreeParseLiteral(regex);
|
||||
node.regex = {
|
||||
pattern,
|
||||
flags
|
||||
};
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseBigIntLiteral(value) {
|
||||
const bigInt = typeof BigInt !== "undefined" ? BigInt(value) : null;
|
||||
const node = this.estreeParseLiteral(bigInt);
|
||||
node.bigint = String(node.value || value);
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseDecimalLiteral(value) {
|
||||
const decimal = null;
|
||||
const node = this.estreeParseLiteral(decimal);
|
||||
node.decimal = String(node.value || value);
|
||||
return node;
|
||||
}
|
||||
|
||||
estreeParseLiteral(value) {
|
||||
return this.parseLiteral(value, "Literal");
|
||||
}
|
||||
|
||||
directiveToStmt(directive) {
|
||||
const directiveLiteral = directive.value;
|
||||
const stmt = this.startNodeAt(directive.start, directive.loc.start);
|
||||
const expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
|
||||
expression.value = directiveLiteral.value;
|
||||
expression.raw = directiveLiteral.extra.raw;
|
||||
stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end);
|
||||
stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
|
||||
return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end);
|
||||
}
|
||||
|
||||
initFunction(node, isAsync) {
|
||||
super.initFunction(node, isAsync);
|
||||
node.expression = false;
|
||||
}
|
||||
|
||||
checkDeclaration(node) {
|
||||
if (isSimpleProperty(node)) {
|
||||
this.checkDeclaration(node.value);
|
||||
} else {
|
||||
super.checkDeclaration(node);
|
||||
}
|
||||
}
|
||||
|
||||
getObjectOrClassMethodParams(method) {
|
||||
return method.value.params;
|
||||
}
|
||||
|
||||
checkLVal(expr, bindingType = _scopeflags.BIND_NONE, checkClashes, contextDescription, disallowLetBinding) {
|
||||
switch (expr.type) {
|
||||
case "ObjectPattern":
|
||||
expr.properties.forEach(prop => {
|
||||
this.checkLVal(prop.type === "Property" ? prop.value : prop, bindingType, checkClashes, "object destructuring pattern", disallowLetBinding);
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
super.checkLVal(expr, bindingType, checkClashes, contextDescription, disallowLetBinding);
|
||||
}
|
||||
}
|
||||
|
||||
checkProto(prop, isRecord, protoRef, refExpressionErrors) {
|
||||
if (prop.method) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.checkProto(prop, isRecord, protoRef, refExpressionErrors);
|
||||
}
|
||||
|
||||
isValidDirective(stmt) {
|
||||
return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && !stmt.expression.extra?.parenthesized;
|
||||
}
|
||||
|
||||
stmtToDirective(stmt) {
|
||||
const directive = super.stmtToDirective(stmt);
|
||||
const value = stmt.expression.value;
|
||||
directive.value.value = value;
|
||||
return directive;
|
||||
}
|
||||
|
||||
parseBlockBody(node, allowDirectives, topLevel, end) {
|
||||
super.parseBlockBody(node, allowDirectives, topLevel, end);
|
||||
const directiveStatements = node.directives.map(d => this.directiveToStmt(d));
|
||||
node.body = directiveStatements.concat(node.body);
|
||||
delete node.directives;
|
||||
}
|
||||
|
||||
pushClassMethod(classBody, method, isGenerator, isAsync, isConstructor, allowsDirectSuper) {
|
||||
this.parseMethod(method, isGenerator, isAsync, isConstructor, allowsDirectSuper, "ClassMethod", true);
|
||||
|
||||
if (method.typeParameters) {
|
||||
method.value.typeParameters = method.typeParameters;
|
||||
delete method.typeParameters;
|
||||
}
|
||||
|
||||
classBody.body.push(method);
|
||||
}
|
||||
|
||||
parseExprAtom(refExpressionErrors) {
|
||||
switch (this.state.type) {
|
||||
case _types.types.num:
|
||||
case _types.types.string:
|
||||
return this.estreeParseLiteral(this.state.value);
|
||||
|
||||
case _types.types.regexp:
|
||||
return this.estreeParseRegExpLiteral(this.state.value);
|
||||
|
||||
case _types.types.bigint:
|
||||
return this.estreeParseBigIntLiteral(this.state.value);
|
||||
|
||||
case _types.types.decimal:
|
||||
return this.estreeParseDecimalLiteral(this.state.value);
|
||||
|
||||
case _types.types._null:
|
||||
return this.estreeParseLiteral(null);
|
||||
|
||||
case _types.types._true:
|
||||
return this.estreeParseLiteral(true);
|
||||
|
||||
case _types.types._false:
|
||||
return this.estreeParseLiteral(false);
|
||||
|
||||
default:
|
||||
return super.parseExprAtom(refExpressionErrors);
|
||||
}
|
||||
}
|
||||
|
||||
parseLiteral(value, type, startPos, startLoc) {
|
||||
const node = super.parseLiteral(value, type, startPos, startLoc);
|
||||
node.raw = node.extra.raw;
|
||||
delete node.extra;
|
||||
return node;
|
||||
}
|
||||
|
||||
parseFunctionBody(node, allowExpression, isMethod = false) {
|
||||
super.parseFunctionBody(node, allowExpression, isMethod);
|
||||
node.expression = node.body.type !== "BlockStatement";
|
||||
}
|
||||
|
||||
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope = false) {
|
||||
let funcNode = this.startNode();
|
||||
funcNode.kind = node.kind;
|
||||
funcNode = super.parseMethod(funcNode, isGenerator, isAsync, isConstructor, allowDirectSuper, type, inClassScope);
|
||||
funcNode.type = "FunctionExpression";
|
||||
delete funcNode.kind;
|
||||
node.value = funcNode;
|
||||
type = type === "ClassMethod" ? "MethodDefinition" : type;
|
||||
return this.finishNode(node, type);
|
||||
}
|
||||
|
||||
parseObjectMethod(prop, isGenerator, isAsync, isPattern, 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;
|
||||
}
|
||||
|
||||
toAssignable(node) {
|
||||
if (isSimpleProperty(node)) {
|
||||
this.toAssignable(node.value);
|
||||
return node;
|
||||
}
|
||||
|
||||
return super.toAssignable(node);
|
||||
}
|
||||
|
||||
toAssignableObjectExpressionProp(prop, isLast) {
|
||||
if (prop.kind === "get" || prop.kind === "set") {
|
||||
throw this.raise(prop.key.start, _error.Errors.PatternHasAccessor);
|
||||
} else if (prop.method) {
|
||||
throw this.raise(prop.key.start, _error.Errors.PatternHasMethod);
|
||||
} else {
|
||||
super.toAssignableObjectExpressionProp(prop, isLast);
|
||||
}
|
||||
}
|
||||
|
||||
finishCallExpression(node, optional) {
|
||||
super.finishCallExpression(node, optional);
|
||||
|
||||
if (node.callee.type === "Import") {
|
||||
node.type = "ImportExpression";
|
||||
node.source = node.arguments[0];
|
||||
delete node.arguments;
|
||||
delete node.callee;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
2821
node_modules/@babel/parser/lib/plugins/flow.js
generated
vendored
Normal file
2821
node_modules/@babel/parser/lib/plugins/flow.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
526
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
Normal file
526
node_modules/@babel/parser/lib/plugins/jsx/index.js
generated
vendored
Normal file
@@ -0,0 +1,526 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _xhtml = _interopRequireDefault(require("./xhtml"));
|
||||
|
||||
var _types = require("../../tokenizer/types");
|
||||
|
||||
var _context = require("../../tokenizer/context");
|
||||
|
||||
var N = _interopRequireWildcard(require("../../types"));
|
||||
|
||||
var _identifier = require("../../util/identifier");
|
||||
|
||||
var _whitespace = require("../../util/whitespace");
|
||||
|
||||
var _error = require("../../parser/error");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const HEX_NUMBER = /^[\da-fA-F]+$/;
|
||||
const DECIMAL_NUMBER = /^\d+$/;
|
||||
const JsxErrors = Object.freeze({
|
||||
AttributeIsEmpty: "JSX attributes must only be assigned a non-empty expression",
|
||||
MissingClosingTagFragment: "Expected corresponding JSX closing tag for <>",
|
||||
MissingClosingTagElement: "Expected corresponding JSX closing tag for <%0>",
|
||||
UnsupportedJsxValue: "JSX value should be either an expression or a quoted JSX text",
|
||||
UnterminatedJsxContent: "Unterminated JSX contents",
|
||||
UnwrappedAdjacentJSXElements: "Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"
|
||||
});
|
||||
_context.types.j_oTag = new _context.TokContext("<tag", false);
|
||||
_context.types.j_cTag = new _context.TokContext("</tag", false);
|
||||
_context.types.j_expr = new _context.TokContext("<tag>...</tag>", true, true);
|
||||
_types.types.jsxName = new _types.TokenType("jsxName");
|
||||
_types.types.jsxText = new _types.TokenType("jsxText", {
|
||||
beforeExpr: true
|
||||
});
|
||||
_types.types.jsxTagStart = new _types.TokenType("jsxTagStart", {
|
||||
startsExpr: true
|
||||
});
|
||||
_types.types.jsxTagEnd = new _types.TokenType("jsxTagEnd");
|
||||
|
||||
_types.types.jsxTagStart.updateContext = function () {
|
||||
this.state.context.push(_context.types.j_expr);
|
||||
this.state.context.push(_context.types.j_oTag);
|
||||
this.state.exprAllowed = false;
|
||||
};
|
||||
|
||||
_types.types.jsxTagEnd.updateContext = function (prevType) {
|
||||
const out = this.state.context.pop();
|
||||
|
||||
if (out === _context.types.j_oTag && prevType === _types.types.slash || out === _context.types.j_cTag) {
|
||||
this.state.context.pop();
|
||||
this.state.exprAllowed = this.curContext() === _context.types.j_expr;
|
||||
} else {
|
||||
this.state.exprAllowed = true;
|
||||
}
|
||||
};
|
||||
|
||||
function isFragment(object) {
|
||||
return object ? object.type === "JSXOpeningFragment" || object.type === "JSXClosingFragment" : false;
|
||||
}
|
||||
|
||||
function getQualifiedJSXName(object) {
|
||||
if (object.type === "JSXIdentifier") {
|
||||
return object.name;
|
||||
}
|
||||
|
||||
if (object.type === "JSXNamespacedName") {
|
||||
return object.namespace.name + ":" + object.name.name;
|
||||
}
|
||||
|
||||
if (object.type === "JSXMemberExpression") {
|
||||
return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
|
||||
}
|
||||
|
||||
throw new Error("Node had unexpected type: " + object.type);
|
||||
}
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
jsxReadToken() {
|
||||
let out = "";
|
||||
let chunkStart = this.state.pos;
|
||||
|
||||
for (;;) {
|
||||
if (this.state.pos >= this.length) {
|
||||
throw this.raise(this.state.start, JsxErrors.UnterminatedJsxContent);
|
||||
}
|
||||
|
||||
const ch = this.input.charCodeAt(this.state.pos);
|
||||
|
||||
switch (ch) {
|
||||
case 60:
|
||||
case 123:
|
||||
if (this.state.pos === this.state.start) {
|
||||
if (ch === 60 && this.state.exprAllowed) {
|
||||
++this.state.pos;
|
||||
return this.finishToken(_types.types.jsxTagStart);
|
||||
}
|
||||
|
||||
return super.getTokenFromCode(ch);
|
||||
}
|
||||
|
||||
out += this.input.slice(chunkStart, this.state.pos);
|
||||
return this.finishToken(_types.types.jsxText, out);
|
||||
|
||||
case 38:
|
||||
out += this.input.slice(chunkStart, this.state.pos);
|
||||
out += this.jsxReadEntity();
|
||||
chunkStart = this.state.pos;
|
||||
break;
|
||||
|
||||
default:
|
||||
if ((0, _whitespace.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, _error.Errors.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 ((0, _whitespace.isNewLine)(ch)) {
|
||||
out += this.input.slice(chunkStart, this.state.pos);
|
||||
out += this.jsxReadNewLine(false);
|
||||
chunkStart = this.state.pos;
|
||||
} else {
|
||||
++this.state.pos;
|
||||
}
|
||||
}
|
||||
|
||||
out += this.input.slice(chunkStart, this.state.pos++);
|
||||
return this.finishToken(_types.types.string, out);
|
||||
}
|
||||
|
||||
jsxReadEntity() {
|
||||
let str = "";
|
||||
let count = 0;
|
||||
let entity;
|
||||
let ch = this.input[this.state.pos];
|
||||
const startPos = ++this.state.pos;
|
||||
|
||||
while (this.state.pos < this.length && count++ < 10) {
|
||||
ch = this.input[this.state.pos++];
|
||||
|
||||
if (ch === ";") {
|
||||
if (str[0] === "#") {
|
||||
if (str[1] === "x") {
|
||||
str = str.substr(2);
|
||||
|
||||
if (HEX_NUMBER.test(str)) {
|
||||
entity = String.fromCodePoint(parseInt(str, 16));
|
||||
}
|
||||
} else {
|
||||
str = str.substr(1);
|
||||
|
||||
if (DECIMAL_NUMBER.test(str)) {
|
||||
entity = String.fromCodePoint(parseInt(str, 10));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
entity = _xhtml.default[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 ((0, _identifier.isIdentifierChar)(ch) || ch === 45);
|
||||
|
||||
return this.finishToken(_types.types.jsxName, this.input.slice(start, this.state.pos));
|
||||
}
|
||||
|
||||
jsxParseIdentifier() {
|
||||
const node = this.startNode();
|
||||
|
||||
if (this.match(_types.types.jsxName)) {
|
||||
node.name = this.state.value;
|
||||
} else if (this.state.type.keyword) {
|
||||
node.name = this.state.type.keyword;
|
||||
} else {
|
||||
this.unexpected();
|
||||
}
|
||||
|
||||
this.next();
|
||||
return this.finishNode(node, "JSXIdentifier");
|
||||
}
|
||||
|
||||
jsxParseNamespacedName() {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
const name = this.jsxParseIdentifier();
|
||||
if (!this.eat(_types.types.colon)) return name;
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
node.namespace = name;
|
||||
node.name = this.jsxParseIdentifier();
|
||||
return this.finishNode(node, "JSXNamespacedName");
|
||||
}
|
||||
|
||||
jsxParseElementName() {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
let node = this.jsxParseNamespacedName();
|
||||
|
||||
if (node.type === "JSXNamespacedName") {
|
||||
return node;
|
||||
}
|
||||
|
||||
while (this.eat(_types.types.dot)) {
|
||||
const newNode = this.startNodeAt(startPos, startLoc);
|
||||
newNode.object = node;
|
||||
newNode.property = this.jsxParseIdentifier();
|
||||
node = this.finishNode(newNode, "JSXMemberExpression");
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
jsxParseAttributeValue() {
|
||||
let node;
|
||||
|
||||
switch (this.state.type) {
|
||||
case _types.types.braceL:
|
||||
node = this.startNode();
|
||||
this.next();
|
||||
node = this.jsxParseExpressionContainer(node);
|
||||
|
||||
if (node.expression.type === "JSXEmptyExpression") {
|
||||
this.raise(node.start, JsxErrors.AttributeIsEmpty);
|
||||
}
|
||||
|
||||
return node;
|
||||
|
||||
case _types.types.jsxTagStart:
|
||||
case _types.types.string:
|
||||
return this.parseExprAtom();
|
||||
|
||||
default:
|
||||
throw this.raise(this.state.start, JsxErrors.UnsupportedJsxValue);
|
||||
}
|
||||
}
|
||||
|
||||
jsxParseEmptyExpression() {
|
||||
const node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc);
|
||||
return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc);
|
||||
}
|
||||
|
||||
jsxParseSpreadChild(node) {
|
||||
this.next();
|
||||
node.expression = this.parseExpression();
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXSpreadChild");
|
||||
}
|
||||
|
||||
jsxParseExpressionContainer(node) {
|
||||
if (this.match(_types.types.braceR)) {
|
||||
node.expression = this.jsxParseEmptyExpression();
|
||||
} else {
|
||||
node.expression = this.parseExpression();
|
||||
}
|
||||
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXExpressionContainer");
|
||||
}
|
||||
|
||||
jsxParseAttribute() {
|
||||
const node = this.startNode();
|
||||
|
||||
if (this.eat(_types.types.braceL)) {
|
||||
this.expect(_types.types.ellipsis);
|
||||
node.argument = this.parseMaybeAssignAllowIn();
|
||||
this.expect(_types.types.braceR);
|
||||
return this.finishNode(node, "JSXSpreadAttribute");
|
||||
}
|
||||
|
||||
node.name = this.jsxParseNamespacedName();
|
||||
node.value = this.eat(_types.types.eq) ? this.jsxParseAttributeValue() : null;
|
||||
return this.finishNode(node, "JSXAttribute");
|
||||
}
|
||||
|
||||
jsxParseOpeningElementAt(startPos, startLoc) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
|
||||
if (this.match(_types.types.jsxTagEnd)) {
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXOpeningFragment");
|
||||
}
|
||||
|
||||
node.name = this.jsxParseElementName();
|
||||
return this.jsxParseOpeningElementAfterName(node);
|
||||
}
|
||||
|
||||
jsxParseOpeningElementAfterName(node) {
|
||||
const attributes = [];
|
||||
|
||||
while (!this.match(_types.types.slash) && !this.match(_types.types.jsxTagEnd)) {
|
||||
attributes.push(this.jsxParseAttribute());
|
||||
}
|
||||
|
||||
node.attributes = attributes;
|
||||
node.selfClosing = this.eat(_types.types.slash);
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXOpeningElement");
|
||||
}
|
||||
|
||||
jsxParseClosingElementAt(startPos, startLoc) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
|
||||
if (this.match(_types.types.jsxTagEnd)) {
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXClosingFragment");
|
||||
}
|
||||
|
||||
node.name = this.jsxParseElementName();
|
||||
this.expect(_types.types.jsxTagEnd);
|
||||
return this.finishNode(node, "JSXClosingElement");
|
||||
}
|
||||
|
||||
jsxParseElementAt(startPos, startLoc) {
|
||||
const node = this.startNodeAt(startPos, startLoc);
|
||||
const children = [];
|
||||
const openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
|
||||
let closingElement = null;
|
||||
|
||||
if (!openingElement.selfClosing) {
|
||||
contents: for (;;) {
|
||||
switch (this.state.type) {
|
||||
case _types.types.jsxTagStart:
|
||||
startPos = this.state.start;
|
||||
startLoc = this.state.startLoc;
|
||||
this.next();
|
||||
|
||||
if (this.eat(_types.types.slash)) {
|
||||
closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
|
||||
break contents;
|
||||
}
|
||||
|
||||
children.push(this.jsxParseElementAt(startPos, startLoc));
|
||||
break;
|
||||
|
||||
case _types.types.jsxText:
|
||||
children.push(this.parseExprAtom());
|
||||
break;
|
||||
|
||||
case _types.types.braceL:
|
||||
{
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
|
||||
if (this.match(_types.types.ellipsis)) {
|
||||
children.push(this.jsxParseSpreadChild(node));
|
||||
} else {
|
||||
children.push(this.jsxParseExpressionContainer(node));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw this.unexpected();
|
||||
}
|
||||
}
|
||||
|
||||
if (isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagFragment);
|
||||
} else if (!isFragment(openingElement) && isFragment(closingElement)) {
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
|
||||
} else if (!isFragment(openingElement) && !isFragment(closingElement)) {
|
||||
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
|
||||
this.raise(closingElement.start, JsxErrors.MissingClosingTagElement, getQualifiedJSXName(openingElement.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isFragment(openingElement)) {
|
||||
node.openingFragment = openingElement;
|
||||
node.closingFragment = closingElement;
|
||||
} else {
|
||||
node.openingElement = openingElement;
|
||||
node.closingElement = closingElement;
|
||||
}
|
||||
|
||||
node.children = children;
|
||||
|
||||
if (this.isRelational("<")) {
|
||||
throw this.raise(this.state.start, JsxErrors.UnwrappedAdjacentJSXElements);
|
||||
}
|
||||
|
||||
return isFragment(openingElement) ? this.finishNode(node, "JSXFragment") : this.finishNode(node, "JSXElement");
|
||||
}
|
||||
|
||||
jsxParseElement() {
|
||||
const startPos = this.state.start;
|
||||
const startLoc = this.state.startLoc;
|
||||
this.next();
|
||||
return this.jsxParseElementAt(startPos, startLoc);
|
||||
}
|
||||
|
||||
parseExprAtom(refExpressionErrors) {
|
||||
if (this.match(_types.types.jsxText)) {
|
||||
return this.parseLiteral(this.state.value, "JSXText");
|
||||
} else if (this.match(_types.types.jsxTagStart)) {
|
||||
return this.jsxParseElement();
|
||||
} else if (this.isRelational("<") && this.input.charCodeAt(this.state.pos) !== 33) {
|
||||
this.finishToken(_types.types.jsxTagStart);
|
||||
return this.jsxParseElement();
|
||||
} else {
|
||||
return super.parseExprAtom(refExpressionErrors);
|
||||
}
|
||||
}
|
||||
|
||||
getTokenFromCode(code) {
|
||||
if (this.state.inPropertyName) return super.getTokenFromCode(code);
|
||||
const context = this.curContext();
|
||||
|
||||
if (context === _context.types.j_expr) {
|
||||
return this.jsxReadToken();
|
||||
}
|
||||
|
||||
if (context === _context.types.j_oTag || context === _context.types.j_cTag) {
|
||||
if ((0, _identifier.isIdentifierStart)(code)) {
|
||||
return this.jsxReadWord();
|
||||
}
|
||||
|
||||
if (code === 62) {
|
||||
++this.state.pos;
|
||||
return this.finishToken(_types.types.jsxTagEnd);
|
||||
}
|
||||
|
||||
if ((code === 34 || code === 39) && context === _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(_types.types.jsxTagStart);
|
||||
}
|
||||
|
||||
return super.getTokenFromCode(code);
|
||||
}
|
||||
|
||||
updateContext(prevType) {
|
||||
if (this.match(_types.types.braceL)) {
|
||||
const curContext = this.curContext();
|
||||
|
||||
if (curContext === _context.types.j_oTag) {
|
||||
this.state.context.push(_context.types.braceExpression);
|
||||
} else if (curContext === _context.types.j_expr) {
|
||||
this.state.context.push(_context.types.templateQuasi);
|
||||
} else {
|
||||
super.updateContext(prevType);
|
||||
}
|
||||
|
||||
this.state.exprAllowed = true;
|
||||
} else if (this.match(_types.types.slash) && prevType === _types.types.jsxTagStart) {
|
||||
this.state.context.length -= 2;
|
||||
this.state.context.push(_context.types.j_cTag);
|
||||
this.state.exprAllowed = false;
|
||||
} else {
|
||||
return super.updateContext(prevType);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
263
node_modules/@babel/parser/lib/plugins/jsx/xhtml.js
generated
vendored
Normal file
263
node_modules/@babel/parser/lib/plugins/jsx/xhtml.js
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
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"
|
||||
};
|
||||
var _default = entities;
|
||||
exports.default = _default;
|
||||
219
node_modules/@babel/parser/lib/plugins/placeholders.js
generated
vendored
Normal file
219
node_modules/@babel/parser/lib/plugins/placeholders.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
_types.types.placeholder = new _types.TokenType("%%", {
|
||||
startsExpr: true
|
||||
});
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
parsePlaceholder(expectedNode) {
|
||||
if (this.match(_types.types.placeholder)) {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
this.assertNoSpace("Unexpected space in placeholder.");
|
||||
node.name = super.parseIdentifier(true);
|
||||
this.assertNoSpace("Unexpected space in placeholder.");
|
||||
this.expect(_types.types.placeholder);
|
||||
return this.finishPlaceholder(node, expectedNode);
|
||||
}
|
||||
}
|
||||
|
||||
finishPlaceholder(node, expectedNode) {
|
||||
const isFinished = !!(node.expectedNode && node.type === "Placeholder");
|
||||
node.expectedNode = expectedNode;
|
||||
return isFinished ? node : this.finishNode(node, "Placeholder");
|
||||
}
|
||||
|
||||
getTokenFromCode(code) {
|
||||
if (code === 37 && this.input.charCodeAt(this.state.pos + 1) === 37) {
|
||||
return this.finishOp(_types.types.placeholder, 2);
|
||||
}
|
||||
|
||||
return super.getTokenFromCode(...arguments);
|
||||
}
|
||||
|
||||
parseExprAtom() {
|
||||
return this.parsePlaceholder("Expression") || super.parseExprAtom(...arguments);
|
||||
}
|
||||
|
||||
parseIdentifier() {
|
||||
return this.parsePlaceholder("Identifier") || super.parseIdentifier(...arguments);
|
||||
}
|
||||
|
||||
checkReservedWord(word) {
|
||||
if (word !== undefined) super.checkReservedWord(...arguments);
|
||||
}
|
||||
|
||||
parseBindingAtom() {
|
||||
return this.parsePlaceholder("Pattern") || super.parseBindingAtom(...arguments);
|
||||
}
|
||||
|
||||
checkLVal(expr) {
|
||||
if (expr.type !== "Placeholder") super.checkLVal(...arguments);
|
||||
}
|
||||
|
||||
toAssignable(node) {
|
||||
if (node && node.type === "Placeholder" && node.expectedNode === "Expression") {
|
||||
node.expectedNode = "Pattern";
|
||||
return node;
|
||||
}
|
||||
|
||||
return super.toAssignable(...arguments);
|
||||
}
|
||||
|
||||
verifyBreakContinue(node) {
|
||||
if (node.label && node.label.type === "Placeholder") return;
|
||||
super.verifyBreakContinue(...arguments);
|
||||
}
|
||||
|
||||
parseExpressionStatement(node, expr) {
|
||||
if (expr.type !== "Placeholder" || expr.extra && expr.extra.parenthesized) {
|
||||
return super.parseExpressionStatement(...arguments);
|
||||
}
|
||||
|
||||
if (this.match(_types.types.colon)) {
|
||||
const stmt = node;
|
||||
stmt.label = this.finishPlaceholder(expr, "Identifier");
|
||||
this.next();
|
||||
stmt.body = this.parseStatement("label");
|
||||
return this.finishNode(stmt, "LabeledStatement");
|
||||
}
|
||||
|
||||
this.semicolon();
|
||||
node.name = expr.name;
|
||||
return this.finishPlaceholder(node, "Statement");
|
||||
}
|
||||
|
||||
parseBlock() {
|
||||
return this.parsePlaceholder("BlockStatement") || super.parseBlock(...arguments);
|
||||
}
|
||||
|
||||
parseFunctionId() {
|
||||
return this.parsePlaceholder("Identifier") || super.parseFunctionId(...arguments);
|
||||
}
|
||||
|
||||
parseClass(node, isStatement, optionalId) {
|
||||
const type = isStatement ? "ClassDeclaration" : "ClassExpression";
|
||||
this.next();
|
||||
this.takeDecorators(node);
|
||||
const oldStrict = this.state.strict;
|
||||
const placeholder = this.parsePlaceholder("Identifier");
|
||||
|
||||
if (placeholder) {
|
||||
if (this.match(_types.types._extends) || this.match(_types.types.placeholder) || this.match(_types.types.braceL)) {
|
||||
node.id = placeholder;
|
||||
} else if (optionalId || !isStatement) {
|
||||
node.id = null;
|
||||
node.body = this.finishPlaceholder(placeholder, "ClassBody");
|
||||
return this.finishNode(node, type);
|
||||
} else {
|
||||
this.unexpected(null, "A class name is required");
|
||||
}
|
||||
} else {
|
||||
this.parseClassId(node, isStatement, optionalId);
|
||||
}
|
||||
|
||||
this.parseClassSuper(node);
|
||||
node.body = this.parsePlaceholder("ClassBody") || this.parseClassBody(!!node.superClass, 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(_types.types.comma)) {
|
||||
node.specifiers = [];
|
||||
node.source = null;
|
||||
node.declaration = this.finishPlaceholder(placeholder, "Declaration");
|
||||
return this.finishNode(node, "ExportNamedDeclaration");
|
||||
}
|
||||
|
||||
this.expectPlugin("exportDefaultFrom");
|
||||
const specifier = this.startNode();
|
||||
specifier.exported = placeholder;
|
||||
node.specifiers = [this.finishNode(specifier, "ExportDefaultSpecifier")];
|
||||
return super.parseExport(node);
|
||||
}
|
||||
|
||||
isExportDefaultSpecifier() {
|
||||
if (this.match(_types.types._default)) {
|
||||
const next = this.nextTokenStart();
|
||||
|
||||
if (this.isUnparsedContextual(next, "from")) {
|
||||
if (this.input.startsWith(_types.types.placeholder.label, this.nextTokenStartSince(next + 4))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.isExportDefaultSpecifier();
|
||||
}
|
||||
|
||||
maybeParseExportDefaultSpecifier(node) {
|
||||
if (node.specifiers && node.specifiers.length > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.maybeParseExportDefaultSpecifier(...arguments);
|
||||
}
|
||||
|
||||
checkExport(node) {
|
||||
const {
|
||||
specifiers
|
||||
} = node;
|
||||
|
||||
if (specifiers?.length) {
|
||||
node.specifiers = specifiers.filter(node => node.exported.type === "Placeholder");
|
||||
}
|
||||
|
||||
super.checkExport(node);
|
||||
node.specifiers = specifiers;
|
||||
}
|
||||
|
||||
parseImport(node) {
|
||||
const placeholder = this.parsePlaceholder("Identifier");
|
||||
if (!placeholder) return super.parseImport(...arguments);
|
||||
node.specifiers = [];
|
||||
|
||||
if (!this.isContextual("from") && !this.match(_types.types.comma)) {
|
||||
node.source = this.finishPlaceholder(placeholder, "StringLiteral");
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "ImportDeclaration");
|
||||
}
|
||||
|
||||
const specifier = this.startNodeAtNode(placeholder);
|
||||
specifier.local = placeholder;
|
||||
this.finishNode(specifier, "ImportDefaultSpecifier");
|
||||
node.specifiers.push(specifier);
|
||||
|
||||
if (this.eat(_types.types.comma)) {
|
||||
const hasStarImport = this.maybeParseStarImportSpecifier(node);
|
||||
if (!hasStarImport) this.parseNamedImportSpecifiers(node);
|
||||
}
|
||||
|
||||
this.expectContextual("from");
|
||||
node.source = this.parseImportSource();
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "ImportDeclaration");
|
||||
}
|
||||
|
||||
parseImportSource() {
|
||||
return this.parsePlaceholder("StringLiteral") || super.parseImportSource(...arguments);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
2283
node_modules/@babel/parser/lib/plugins/typescript/index.js
generated
vendored
Normal file
2283
node_modules/@babel/parser/lib/plugins/typescript/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
94
node_modules/@babel/parser/lib/plugins/typescript/scope.js
generated
vendored
Normal file
94
node_modules/@babel/parser/lib/plugins/typescript/scope.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _scope = _interopRequireWildcard(require("../../util/scope"));
|
||||
|
||||
var _scopeflags = require("../../util/scopeflags");
|
||||
|
||||
var N = _interopRequireWildcard(require("../../types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
class TypeScriptScope extends _scope.Scope {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
this.types = [];
|
||||
this.enums = [];
|
||||
this.constEnums = [];
|
||||
this.classes = [];
|
||||
this.exportOnlyBindings = [];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TypeScriptScopeHandler extends _scope.default {
|
||||
createScope(flags) {
|
||||
return new TypeScriptScope(flags);
|
||||
}
|
||||
|
||||
declareName(name, bindingType, pos) {
|
||||
const scope = this.currentScope();
|
||||
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_EXPORT_ONLY) {
|
||||
this.maybeExportDefined(scope, name);
|
||||
scope.exportOnlyBindings.push(name);
|
||||
return;
|
||||
}
|
||||
|
||||
super.declareName(...arguments);
|
||||
|
||||
if (bindingType & _scopeflags.BIND_KIND_TYPE) {
|
||||
if (!(bindingType & _scopeflags.BIND_KIND_VALUE)) {
|
||||
this.checkRedeclarationInScope(scope, name, bindingType, pos);
|
||||
this.maybeExportDefined(scope, name);
|
||||
}
|
||||
|
||||
scope.types.push(name);
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_ENUM) scope.enums.push(name);
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.push(name);
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_CLASS) scope.classes.push(name);
|
||||
}
|
||||
|
||||
isRedeclaredInScope(scope, name, bindingType) {
|
||||
if (scope.enums.indexOf(name) > -1) {
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_TS_ENUM) {
|
||||
const isConst = !!(bindingType & _scopeflags.BIND_FLAGS_TS_CONST_ENUM);
|
||||
const wasConst = scope.constEnums.indexOf(name) > -1;
|
||||
return isConst !== wasConst;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_FLAGS_CLASS && scope.classes.indexOf(name) > -1) {
|
||||
if (scope.lexical.indexOf(name) > -1) {
|
||||
return !!(bindingType & _scopeflags.BIND_KIND_VALUE);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_KIND_TYPE && scope.types.indexOf(name) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.isRedeclaredInScope(...arguments);
|
||||
}
|
||||
|
||||
checkLocalExport(id) {
|
||||
if (this.scopeStack[0].types.indexOf(id.name) === -1 && this.scopeStack[0].exportOnlyBindings.indexOf(id.name) === -1) {
|
||||
super.checkLocalExport(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = TypeScriptScopeHandler;
|
||||
43
node_modules/@babel/parser/lib/plugins/v8intrinsic.js
generated
vendored
Normal file
43
node_modules/@babel/parser/lib/plugins/v8intrinsic.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _types = require("../tokenizer/types");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
var _default = superClass => class extends superClass {
|
||||
parseV8Intrinsic() {
|
||||
if (this.match(_types.types.modulo)) {
|
||||
const v8IntrinsicStart = this.state.start;
|
||||
const node = this.startNode();
|
||||
this.eat(_types.types.modulo);
|
||||
|
||||
if (this.match(_types.types.name)) {
|
||||
const name = this.parseIdentifierName(this.state.start);
|
||||
const identifier = this.createIdentifier(node, name);
|
||||
identifier.type = "V8IntrinsicIdentifier";
|
||||
|
||||
if (this.match(_types.types.parenL)) {
|
||||
return identifier;
|
||||
}
|
||||
}
|
||||
|
||||
this.unexpected(v8IntrinsicStart);
|
||||
}
|
||||
}
|
||||
|
||||
parseExprAtom() {
|
||||
return this.parseV8Intrinsic() || super.parseExprAtom(...arguments);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports.default = _default;
|
||||
110
node_modules/@babel/parser/lib/tokenizer/context.js
generated
vendored
Normal file
110
node_modules/@babel/parser/lib/tokenizer/context.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.types = exports.TokContext = void 0;
|
||||
|
||||
var _types = require("./types");
|
||||
|
||||
class TokContext {
|
||||
constructor(token, isExpr, preserveSpace, override) {
|
||||
this.token = void 0;
|
||||
this.isExpr = void 0;
|
||||
this.preserveSpace = void 0;
|
||||
this.override = void 0;
|
||||
this.token = token;
|
||||
this.isExpr = !!isExpr;
|
||||
this.preserveSpace = !!preserveSpace;
|
||||
this.override = override;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.TokContext = TokContext;
|
||||
const types = {
|
||||
braceStatement: new TokContext("{", false),
|
||||
braceExpression: new TokContext("{", true),
|
||||
recordExpression: new TokContext("#{", true),
|
||||
templateQuasi: new TokContext("${", false),
|
||||
parenStatement: new TokContext("(", false),
|
||||
parenExpression: new TokContext("(", true),
|
||||
template: new TokContext("`", true, true, p => p.readTmplToken()),
|
||||
functionExpression: new TokContext("function", true),
|
||||
functionStatement: new TokContext("function", false)
|
||||
};
|
||||
exports.types = types;
|
||||
|
||||
_types.types.parenR.updateContext = _types.types.braceR.updateContext = function () {
|
||||
if (this.state.context.length === 1) {
|
||||
this.state.exprAllowed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
let out = this.state.context.pop();
|
||||
|
||||
if (out === types.braceStatement && this.curContext().token === "function") {
|
||||
out = this.state.context.pop();
|
||||
}
|
||||
|
||||
this.state.exprAllowed = !out.isExpr;
|
||||
};
|
||||
|
||||
_types.types.name.updateContext = function (prevType) {
|
||||
let allowed = false;
|
||||
|
||||
if (prevType !== _types.types.dot) {
|
||||
if (this.state.value === "of" && !this.state.exprAllowed && prevType !== _types.types._function && prevType !== _types.types._class) {
|
||||
allowed = true;
|
||||
}
|
||||
}
|
||||
|
||||
this.state.exprAllowed = allowed;
|
||||
|
||||
if (this.state.isIterator) {
|
||||
this.state.isIterator = false;
|
||||
}
|
||||
};
|
||||
|
||||
_types.types.braceL.updateContext = function (prevType) {
|
||||
this.state.context.push(this.braceIsBlock(prevType) ? types.braceStatement : types.braceExpression);
|
||||
this.state.exprAllowed = true;
|
||||
};
|
||||
|
||||
_types.types.dollarBraceL.updateContext = function () {
|
||||
this.state.context.push(types.templateQuasi);
|
||||
this.state.exprAllowed = true;
|
||||
};
|
||||
|
||||
_types.types.parenL.updateContext = function (prevType) {
|
||||
const statementParens = prevType === _types.types._if || prevType === _types.types._for || prevType === _types.types._with || prevType === _types.types._while;
|
||||
this.state.context.push(statementParens ? types.parenStatement : types.parenExpression);
|
||||
this.state.exprAllowed = true;
|
||||
};
|
||||
|
||||
_types.types.incDec.updateContext = function () {};
|
||||
|
||||
_types.types._function.updateContext = _types.types._class.updateContext = function (prevType) {
|
||||
if (prevType.beforeExpr && prevType !== _types.types.semi && prevType !== _types.types._else && !(prevType === _types.types._return && this.hasPrecedingLineBreak()) && !((prevType === _types.types.colon || prevType === _types.types.braceL) && this.curContext() === types.b_stat)) {
|
||||
this.state.context.push(types.functionExpression);
|
||||
} else {
|
||||
this.state.context.push(types.functionStatement);
|
||||
}
|
||||
|
||||
this.state.exprAllowed = false;
|
||||
};
|
||||
|
||||
_types.types.backQuote.updateContext = function () {
|
||||
if (this.curContext() === types.template) {
|
||||
this.state.context.pop();
|
||||
} else {
|
||||
this.state.context.push(types.template);
|
||||
}
|
||||
|
||||
this.state.exprAllowed = false;
|
||||
};
|
||||
|
||||
_types.types.braceHashL.updateContext = function () {
|
||||
this.state.context.push(types.recordExpression);
|
||||
this.state.exprAllowed = true;
|
||||
};
|
||||
1302
node_modules/@babel/parser/lib/tokenizer/index.js
generated
vendored
Normal file
1302
node_modules/@babel/parser/lib/tokenizer/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
99
node_modules/@babel/parser/lib/tokenizer/state.js
generated
vendored
Normal file
99
node_modules/@babel/parser/lib/tokenizer/state.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
var _location = require("../util/location");
|
||||
|
||||
var _context = require("./context");
|
||||
|
||||
var _types2 = require("./types");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
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.inPipeline = false;
|
||||
this.inType = false;
|
||||
this.noAnonFunctionType = false;
|
||||
this.inPropertyName = false;
|
||||
this.hasFlowComment = false;
|
||||
this.isIterator = false;
|
||||
this.isDeclareContext = false;
|
||||
this.topicContext = {
|
||||
maxNumOfResolvableTopics: 0,
|
||||
maxTopicIndex: null
|
||||
};
|
||||
this.soloAwait = false;
|
||||
this.inFSharpPipelineDirectBody = false;
|
||||
this.labels = [];
|
||||
this.decoratorStack = [[]];
|
||||
this.comments = [];
|
||||
this.trailingComments = [];
|
||||
this.leadingComments = [];
|
||||
this.commentStack = [];
|
||||
this.commentPreviousNode = null;
|
||||
this.pos = 0;
|
||||
this.lineStart = 0;
|
||||
this.type = _types2.types.eof;
|
||||
this.value = null;
|
||||
this.start = 0;
|
||||
this.end = 0;
|
||||
this.lastTokEndLoc = null;
|
||||
this.lastTokStartLoc = null;
|
||||
this.lastTokStart = 0;
|
||||
this.lastTokEnd = 0;
|
||||
this.context = [_context.types.braceStatement];
|
||||
this.exprAllowed = true;
|
||||
this.containsEsc = false;
|
||||
this.octalPositions = [];
|
||||
this.exportedIdentifiers = [];
|
||||
this.tokensLength = 0;
|
||||
}
|
||||
|
||||
init(options) {
|
||||
this.strict = options.strictMode === false ? false : options.sourceType === "module";
|
||||
this.curLine = options.startLine;
|
||||
this.startLoc = this.endLoc = this.curPosition();
|
||||
}
|
||||
|
||||
curPosition() {
|
||||
return new _location.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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = State;
|
||||
296
node_modules/@babel/parser/lib/tokenizer/types.js
generated
vendored
Normal file
296
node_modules/@babel/parser/lib/tokenizer/types.js
generated
vendored
Normal file
@@ -0,0 +1,296 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.types = exports.keywords = exports.TokenType = void 0;
|
||||
const beforeExpr = true;
|
||||
const startsExpr = true;
|
||||
const isLoop = true;
|
||||
const isAssign = true;
|
||||
const prefix = true;
|
||||
const postfix = true;
|
||||
|
||||
class TokenType {
|
||||
constructor(label, conf = {}) {
|
||||
this.label = 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.updateContext = 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.TokenType = TokenType;
|
||||
const keywords = new Map();
|
||||
exports.keywords = keywords;
|
||||
|
||||
function createKeyword(name, options = {}) {
|
||||
options.keyword = name;
|
||||
const token = new TokenType(name, options);
|
||||
keywords.set(name, token);
|
||||
return token;
|
||||
}
|
||||
|
||||
function createBinop(name, binop) {
|
||||
return new TokenType(name, {
|
||||
beforeExpr,
|
||||
binop
|
||||
});
|
||||
}
|
||||
|
||||
const types = {
|
||||
num: new TokenType("num", {
|
||||
startsExpr
|
||||
}),
|
||||
bigint: new TokenType("bigint", {
|
||||
startsExpr
|
||||
}),
|
||||
decimal: new TokenType("decimal", {
|
||||
startsExpr
|
||||
}),
|
||||
regexp: new TokenType("regexp", {
|
||||
startsExpr
|
||||
}),
|
||||
string: new TokenType("string", {
|
||||
startsExpr
|
||||
}),
|
||||
name: new TokenType("name", {
|
||||
startsExpr
|
||||
}),
|
||||
eof: new TokenType("eof"),
|
||||
bracketL: new TokenType("[", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
bracketHashL: new TokenType("#[", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
bracketBarL: new TokenType("[|", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
bracketR: new TokenType("]"),
|
||||
bracketBarR: new TokenType("|]"),
|
||||
braceL: new TokenType("{", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
braceBarL: new TokenType("{|", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
braceHashL: new TokenType("#{", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
braceR: new TokenType("}"),
|
||||
braceBarR: new TokenType("|}"),
|
||||
parenL: new TokenType("(", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
parenR: new TokenType(")"),
|
||||
comma: new TokenType(",", {
|
||||
beforeExpr
|
||||
}),
|
||||
semi: new TokenType(";", {
|
||||
beforeExpr
|
||||
}),
|
||||
colon: new TokenType(":", {
|
||||
beforeExpr
|
||||
}),
|
||||
doubleColon: new TokenType("::", {
|
||||
beforeExpr
|
||||
}),
|
||||
dot: new TokenType("."),
|
||||
question: new TokenType("?", {
|
||||
beforeExpr
|
||||
}),
|
||||
questionDot: new TokenType("?."),
|
||||
arrow: new TokenType("=>", {
|
||||
beforeExpr
|
||||
}),
|
||||
template: new TokenType("template"),
|
||||
ellipsis: new TokenType("...", {
|
||||
beforeExpr
|
||||
}),
|
||||
backQuote: new TokenType("`", {
|
||||
startsExpr
|
||||
}),
|
||||
dollarBraceL: new TokenType("${", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
at: new TokenType("@"),
|
||||
hash: new TokenType("#", {
|
||||
startsExpr
|
||||
}),
|
||||
interpreterDirective: new TokenType("#!..."),
|
||||
eq: new TokenType("=", {
|
||||
beforeExpr,
|
||||
isAssign
|
||||
}),
|
||||
assign: new TokenType("_=", {
|
||||
beforeExpr,
|
||||
isAssign
|
||||
}),
|
||||
incDec: new TokenType("++/--", {
|
||||
prefix,
|
||||
postfix,
|
||||
startsExpr
|
||||
}),
|
||||
bang: new TokenType("!", {
|
||||
beforeExpr,
|
||||
prefix,
|
||||
startsExpr
|
||||
}),
|
||||
tilde: new TokenType("~", {
|
||||
beforeExpr,
|
||||
prefix,
|
||||
startsExpr
|
||||
}),
|
||||
pipeline: createBinop("|>", 0),
|
||||
nullishCoalescing: createBinop("??", 1),
|
||||
logicalOR: createBinop("||", 1),
|
||||
logicalAND: createBinop("&&", 2),
|
||||
bitwiseOR: createBinop("|", 3),
|
||||
bitwiseXOR: createBinop("^", 4),
|
||||
bitwiseAND: createBinop("&", 5),
|
||||
equality: createBinop("==/!=/===/!==", 6),
|
||||
relational: createBinop("</>/<=/>=", 7),
|
||||
bitShift: createBinop("<</>>/>>>", 8),
|
||||
plusMin: new TokenType("+/-", {
|
||||
beforeExpr,
|
||||
binop: 9,
|
||||
prefix,
|
||||
startsExpr
|
||||
}),
|
||||
modulo: new TokenType("%", {
|
||||
beforeExpr,
|
||||
binop: 10,
|
||||
startsExpr
|
||||
}),
|
||||
star: new TokenType("*", {
|
||||
binop: 10
|
||||
}),
|
||||
slash: createBinop("/", 10),
|
||||
exponent: new TokenType("**", {
|
||||
beforeExpr,
|
||||
binop: 11,
|
||||
rightAssociative: true
|
||||
}),
|
||||
_break: createKeyword("break"),
|
||||
_case: createKeyword("case", {
|
||||
beforeExpr
|
||||
}),
|
||||
_catch: createKeyword("catch"),
|
||||
_continue: createKeyword("continue"),
|
||||
_debugger: createKeyword("debugger"),
|
||||
_default: createKeyword("default", {
|
||||
beforeExpr
|
||||
}),
|
||||
_do: createKeyword("do", {
|
||||
isLoop,
|
||||
beforeExpr
|
||||
}),
|
||||
_else: createKeyword("else", {
|
||||
beforeExpr
|
||||
}),
|
||||
_finally: createKeyword("finally"),
|
||||
_for: createKeyword("for", {
|
||||
isLoop
|
||||
}),
|
||||
_function: createKeyword("function", {
|
||||
startsExpr
|
||||
}),
|
||||
_if: createKeyword("if"),
|
||||
_return: createKeyword("return", {
|
||||
beforeExpr
|
||||
}),
|
||||
_switch: createKeyword("switch"),
|
||||
_throw: createKeyword("throw", {
|
||||
beforeExpr,
|
||||
prefix,
|
||||
startsExpr
|
||||
}),
|
||||
_try: createKeyword("try"),
|
||||
_var: createKeyword("var"),
|
||||
_const: createKeyword("const"),
|
||||
_while: createKeyword("while", {
|
||||
isLoop
|
||||
}),
|
||||
_with: createKeyword("with"),
|
||||
_new: createKeyword("new", {
|
||||
beforeExpr,
|
||||
startsExpr
|
||||
}),
|
||||
_this: createKeyword("this", {
|
||||
startsExpr
|
||||
}),
|
||||
_super: createKeyword("super", {
|
||||
startsExpr
|
||||
}),
|
||||
_class: createKeyword("class", {
|
||||
startsExpr
|
||||
}),
|
||||
_extends: createKeyword("extends", {
|
||||
beforeExpr
|
||||
}),
|
||||
_export: createKeyword("export"),
|
||||
_import: createKeyword("import", {
|
||||
startsExpr
|
||||
}),
|
||||
_null: createKeyword("null", {
|
||||
startsExpr
|
||||
}),
|
||||
_true: createKeyword("true", {
|
||||
startsExpr
|
||||
}),
|
||||
_false: createKeyword("false", {
|
||||
startsExpr
|
||||
}),
|
||||
_in: createKeyword("in", {
|
||||
beforeExpr,
|
||||
binop: 7
|
||||
}),
|
||||
_instanceof: createKeyword("instanceof", {
|
||||
beforeExpr,
|
||||
binop: 7
|
||||
}),
|
||||
_typeof: createKeyword("typeof", {
|
||||
beforeExpr,
|
||||
prefix,
|
||||
startsExpr
|
||||
}),
|
||||
_void: createKeyword("void", {
|
||||
beforeExpr,
|
||||
prefix,
|
||||
startsExpr
|
||||
}),
|
||||
_delete: createKeyword("delete", {
|
||||
beforeExpr,
|
||||
prefix,
|
||||
startsExpr
|
||||
})
|
||||
};
|
||||
exports.types = types;
|
||||
0
node_modules/@babel/parser/lib/types.js
generated
vendored
Normal file
0
node_modules/@babel/parser/lib/types.js
generated
vendored
Normal file
99
node_modules/@babel/parser/lib/util/class-scope.js
generated
vendored
Normal file
99
node_modules/@babel/parser/lib/util/class-scope.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.ClassScope = void 0;
|
||||
|
||||
var _scopeflags = require("./scopeflags");
|
||||
|
||||
var _error = require("../parser/error");
|
||||
|
||||
class ClassScope {
|
||||
constructor() {
|
||||
this.privateNames = new Set();
|
||||
this.loneAccessors = new Map();
|
||||
this.undefinedPrivateNames = new Map();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.ClassScope = ClassScope;
|
||||
|
||||
class ClassScopeHandler {
|
||||
constructor(raise) {
|
||||
this.stack = [];
|
||||
this.undefinedPrivateNames = new Map();
|
||||
this.raise = raise;
|
||||
}
|
||||
|
||||
current() {
|
||||
return this.stack[this.stack.length - 1];
|
||||
}
|
||||
|
||||
enter() {
|
||||
this.stack.push(new ClassScope());
|
||||
}
|
||||
|
||||
exit() {
|
||||
const oldClassScope = this.stack.pop();
|
||||
const current = this.current();
|
||||
|
||||
for (let _i = 0, _Array$from = Array.from(oldClassScope.undefinedPrivateNames); _i < _Array$from.length; _i++) {
|
||||
const [name, pos] = _Array$from[_i];
|
||||
|
||||
if (current) {
|
||||
if (!current.undefinedPrivateNames.has(name)) {
|
||||
current.undefinedPrivateNames.set(name, pos);
|
||||
}
|
||||
} else {
|
||||
this.raise(pos, _error.Errors.InvalidPrivateFieldResolution, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declarePrivateName(name, elementType, pos) {
|
||||
const classScope = this.current();
|
||||
let redefined = classScope.privateNames.has(name);
|
||||
|
||||
if (elementType & _scopeflags.CLASS_ELEMENT_KIND_ACCESSOR) {
|
||||
const accessor = redefined && classScope.loneAccessors.get(name);
|
||||
|
||||
if (accessor) {
|
||||
const oldStatic = accessor & _scopeflags.CLASS_ELEMENT_FLAG_STATIC;
|
||||
const newStatic = elementType & _scopeflags.CLASS_ELEMENT_FLAG_STATIC;
|
||||
const oldKind = accessor & _scopeflags.CLASS_ELEMENT_KIND_ACCESSOR;
|
||||
const newKind = elementType & _scopeflags.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, _error.Errors.PrivateNameRedeclaration, name);
|
||||
}
|
||||
|
||||
classScope.privateNames.add(name);
|
||||
classScope.undefinedPrivateNames.delete(name);
|
||||
}
|
||||
|
||||
usePrivateName(name, pos) {
|
||||
let classScope;
|
||||
|
||||
for (let _i2 = 0, _this$stack = this.stack; _i2 < _this$stack.length; _i2++) {
|
||||
classScope = _this$stack[_i2];
|
||||
if (classScope.privateNames.has(name)) return;
|
||||
}
|
||||
|
||||
if (classScope) {
|
||||
classScope.undefinedPrivateNames.set(name, pos);
|
||||
} else {
|
||||
this.raise(pos, _error.Errors.InvalidPrivateFieldResolution, name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ClassScopeHandler;
|
||||
138
node_modules/@babel/parser/lib/util/expression-scope.js
generated
vendored
Normal file
138
node_modules/@babel/parser/lib/util/expression-scope.js
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.newParameterDeclarationScope = newParameterDeclarationScope;
|
||||
exports.newArrowHeadScope = newArrowHeadScope;
|
||||
exports.newAsyncArrowScope = newAsyncArrowScope;
|
||||
exports.newExpressionScope = newExpressionScope;
|
||||
exports.default = void 0;
|
||||
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, message) {
|
||||
this.errors.set(pos, message);
|
||||
}
|
||||
|
||||
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, message) {
|
||||
const {
|
||||
stack
|
||||
} = this;
|
||||
let i = stack.length - 1;
|
||||
let scope = stack[i];
|
||||
|
||||
while (!scope.isCertainlyParameterDeclaration()) {
|
||||
if (scope.canBeArrowParameterDeclaration()) {
|
||||
scope.recordDeclarationError(pos, message);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
scope = stack[--i];
|
||||
}
|
||||
|
||||
this.raise(pos, message);
|
||||
}
|
||||
|
||||
recordAsyncArrowParametersError(pos, message) {
|
||||
const {
|
||||
stack
|
||||
} = this;
|
||||
let i = stack.length - 1;
|
||||
let scope = stack[i];
|
||||
|
||||
while (scope.canBeArrowParameterDeclaration()) {
|
||||
if (scope.type === kMaybeAsyncArrowParameterDeclaration) {
|
||||
scope.recordDeclarationError(pos, message);
|
||||
}
|
||||
|
||||
scope = stack[--i];
|
||||
}
|
||||
}
|
||||
|
||||
validateAsPattern() {
|
||||
const {
|
||||
stack
|
||||
} = this;
|
||||
const currentScope = stack[stack.length - 1];
|
||||
if (!currentScope.canBeArrowParameterDeclaration()) return;
|
||||
currentScope.iterateErrors((message, pos) => {
|
||||
this.raise(pos, message);
|
||||
let i = stack.length - 2;
|
||||
let scope = stack[i];
|
||||
|
||||
while (scope.canBeArrowParameterDeclaration()) {
|
||||
scope.clearDeclarationError(pos);
|
||||
scope = stack[--i];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ExpressionScopeHandler;
|
||||
|
||||
function newParameterDeclarationScope() {
|
||||
return new ExpressionScope(kParameterDeclaration);
|
||||
}
|
||||
|
||||
function newArrowHeadScope() {
|
||||
return new ArrowHeadParsingScope(kMaybeArrowParameterDeclaration);
|
||||
}
|
||||
|
||||
function newAsyncArrowScope() {
|
||||
return new ArrowHeadParsingScope(kMaybeAsyncArrowParameterDeclaration);
|
||||
}
|
||||
|
||||
function newExpressionScope() {
|
||||
return new ExpressionScope();
|
||||
}
|
||||
58
node_modules/@babel/parser/lib/util/identifier.js
generated
vendored
Normal file
58
node_modules/@babel/parser/lib/util/identifier.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isIteratorStart = isIteratorStart;
|
||||
Object.defineProperty(exports, "isIdentifierStart", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isIdentifierStart;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isIdentifierChar", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isIdentifierChar;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isStrictBindOnlyReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictBindReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isStrictBindReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isStrictReservedWord", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isStrictReservedWord;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "isKeyword", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _helperValidatorIdentifier.isKeyword;
|
||||
}
|
||||
});
|
||||
exports.keywordRelationalOperator = void 0;
|
||||
|
||||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||
|
||||
const keywordRelationalOperator = /^in(stanceof)?$/;
|
||||
exports.keywordRelationalOperator = keywordRelationalOperator;
|
||||
|
||||
function isIteratorStart(current, next) {
|
||||
return current === 64 && next === 64;
|
||||
}
|
||||
49
node_modules/@babel/parser/lib/util/location.js
generated
vendored
Normal file
49
node_modules/@babel/parser/lib/util/location.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getLineInfo = getLineInfo;
|
||||
exports.SourceLocation = exports.Position = void 0;
|
||||
|
||||
var _whitespace = require("./whitespace");
|
||||
|
||||
class Position {
|
||||
constructor(line, col) {
|
||||
this.line = void 0;
|
||||
this.column = void 0;
|
||||
this.line = line;
|
||||
this.column = col;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.Position = Position;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.SourceLocation = SourceLocation;
|
||||
|
||||
function getLineInfo(input, offset) {
|
||||
let line = 1;
|
||||
let lineStart = 0;
|
||||
let match;
|
||||
_whitespace.lineBreakG.lastIndex = 0;
|
||||
|
||||
while ((match = _whitespace.lineBreakG.exec(input)) && match.index < offset) {
|
||||
line++;
|
||||
lineStart = _whitespace.lineBreakG.lastIndex;
|
||||
}
|
||||
|
||||
return new Position(line, offset - lineStart);
|
||||
}
|
||||
58
node_modules/@babel/parser/lib/util/production-parameter.js
generated
vendored
Normal file
58
node_modules/@babel/parser/lib/util/production-parameter.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.functionFlags = functionFlags;
|
||||
exports.default = exports.PARAM_IN = exports.PARAM_RETURN = exports.PARAM_AWAIT = exports.PARAM_YIELD = exports.PARAM = void 0;
|
||||
const PARAM = 0b0000,
|
||||
PARAM_YIELD = 0b0001,
|
||||
PARAM_AWAIT = 0b0010,
|
||||
PARAM_RETURN = 0b0100,
|
||||
PARAM_IN = 0b1000;
|
||||
exports.PARAM_IN = PARAM_IN;
|
||||
exports.PARAM_RETURN = PARAM_RETURN;
|
||||
exports.PARAM_AWAIT = PARAM_AWAIT;
|
||||
exports.PARAM_YIELD = PARAM_YIELD;
|
||||
exports.PARAM = PARAM;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ProductionParameterHandler;
|
||||
|
||||
function functionFlags(isAsync, isGenerator) {
|
||||
return (isAsync ? PARAM_AWAIT : 0) | (isGenerator ? PARAM_YIELD : 0);
|
||||
}
|
||||
168
node_modules/@babel/parser/lib/util/scope.js
generated
vendored
Normal file
168
node_modules/@babel/parser/lib/util/scope.js
generated
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.Scope = void 0;
|
||||
|
||||
var _scopeflags = require("./scopeflags");
|
||||
|
||||
var N = _interopRequireWildcard(require("../types"));
|
||||
|
||||
var _error = require("../parser/error");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
class Scope {
|
||||
constructor(flags) {
|
||||
this.flags = void 0;
|
||||
this.var = [];
|
||||
this.lexical = [];
|
||||
this.functions = [];
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.Scope = Scope;
|
||||
|
||||
class ScopeHandler {
|
||||
constructor(raise, inModule) {
|
||||
this.scopeStack = [];
|
||||
this.undefinedExports = new Map();
|
||||
this.undefinedPrivateNames = new Map();
|
||||
this.raise = raise;
|
||||
this.inModule = inModule;
|
||||
}
|
||||
|
||||
get inFunction() {
|
||||
return (this.currentVarScope().flags & _scopeflags.SCOPE_FUNCTION) > 0;
|
||||
}
|
||||
|
||||
get allowSuper() {
|
||||
return (this.currentThisScope().flags & _scopeflags.SCOPE_SUPER) > 0;
|
||||
}
|
||||
|
||||
get allowDirectSuper() {
|
||||
return (this.currentThisScope().flags & _scopeflags.SCOPE_DIRECT_SUPER) > 0;
|
||||
}
|
||||
|
||||
get inClass() {
|
||||
return (this.currentThisScope().flags & _scopeflags.SCOPE_CLASS) > 0;
|
||||
}
|
||||
|
||||
get inNonArrowFunction() {
|
||||
return (this.currentThisScope().flags & _scopeflags.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 & _scopeflags.SCOPE_FUNCTION || !this.inModule && scope.flags & _scopeflags.SCOPE_PROGRAM);
|
||||
}
|
||||
|
||||
declareName(name, bindingType, pos) {
|
||||
let scope = this.currentScope();
|
||||
|
||||
if (bindingType & _scopeflags.BIND_SCOPE_LEXICAL || bindingType & _scopeflags.BIND_SCOPE_FUNCTION) {
|
||||
this.checkRedeclarationInScope(scope, name, bindingType, pos);
|
||||
|
||||
if (bindingType & _scopeflags.BIND_SCOPE_FUNCTION) {
|
||||
scope.functions.push(name);
|
||||
} else {
|
||||
scope.lexical.push(name);
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_SCOPE_LEXICAL) {
|
||||
this.maybeExportDefined(scope, name);
|
||||
}
|
||||
} else if (bindingType & _scopeflags.BIND_SCOPE_VAR) {
|
||||
for (let i = this.scopeStack.length - 1; i >= 0; --i) {
|
||||
scope = this.scopeStack[i];
|
||||
this.checkRedeclarationInScope(scope, name, bindingType, pos);
|
||||
scope.var.push(name);
|
||||
this.maybeExportDefined(scope, name);
|
||||
if (scope.flags & _scopeflags.SCOPE_VAR) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.inModule && scope.flags & _scopeflags.SCOPE_PROGRAM) {
|
||||
this.undefinedExports.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
maybeExportDefined(scope, name) {
|
||||
if (this.inModule && scope.flags & _scopeflags.SCOPE_PROGRAM) {
|
||||
this.undefinedExports.delete(name);
|
||||
}
|
||||
}
|
||||
|
||||
checkRedeclarationInScope(scope, name, bindingType, pos) {
|
||||
if (this.isRedeclaredInScope(scope, name, bindingType)) {
|
||||
this.raise(pos, _error.Errors.VarRedeclaration, name);
|
||||
}
|
||||
}
|
||||
|
||||
isRedeclaredInScope(scope, name, bindingType) {
|
||||
if (!(bindingType & _scopeflags.BIND_KIND_VALUE)) return false;
|
||||
|
||||
if (bindingType & _scopeflags.BIND_SCOPE_LEXICAL) {
|
||||
return scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
|
||||
}
|
||||
|
||||
if (bindingType & _scopeflags.BIND_SCOPE_FUNCTION) {
|
||||
return scope.lexical.indexOf(name) > -1 || !this.treatFunctionsAsVarInScope(scope) && scope.var.indexOf(name) > -1;
|
||||
}
|
||||
|
||||
return scope.lexical.indexOf(name) > -1 && !(scope.flags & _scopeflags.SCOPE_SIMPLE_CATCH && scope.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope) && scope.functions.indexOf(name) > -1;
|
||||
}
|
||||
|
||||
checkLocalExport(id) {
|
||||
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1 && this.scopeStack[0].functions.indexOf(id.name) === -1) {
|
||||
this.undefinedExports.set(id.name, id.start);
|
||||
}
|
||||
}
|
||||
|
||||
currentScope() {
|
||||
return this.scopeStack[this.scopeStack.length - 1];
|
||||
}
|
||||
|
||||
currentVarScope() {
|
||||
for (let i = this.scopeStack.length - 1;; i--) {
|
||||
const scope = this.scopeStack[i];
|
||||
|
||||
if (scope.flags & _scopeflags.SCOPE_VAR) {
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentThisScope() {
|
||||
for (let i = this.scopeStack.length - 1;; i--) {
|
||||
const scope = this.scopeStack[i];
|
||||
|
||||
if ((scope.flags & _scopeflags.SCOPE_VAR || scope.flags & _scopeflags.SCOPE_CLASS) && !(scope.flags & _scopeflags.SCOPE_ARROW)) {
|
||||
return scope;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.default = ScopeHandler;
|
||||
90
node_modules/@babel/parser/lib/util/scopeflags.js
generated
vendored
Normal file
90
node_modules/@babel/parser/lib/util/scopeflags.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.CLASS_ELEMENT_OTHER = exports.CLASS_ELEMENT_INSTANCE_SETTER = exports.CLASS_ELEMENT_INSTANCE_GETTER = exports.CLASS_ELEMENT_STATIC_SETTER = exports.CLASS_ELEMENT_STATIC_GETTER = exports.CLASS_ELEMENT_KIND_ACCESSOR = exports.CLASS_ELEMENT_KIND_SETTER = exports.CLASS_ELEMENT_KIND_GETTER = exports.CLASS_ELEMENT_FLAG_STATIC = exports.BIND_TS_NAMESPACE = exports.BIND_TS_CONST_ENUM = exports.BIND_OUTSIDE = exports.BIND_NONE = exports.BIND_TS_AMBIENT = exports.BIND_TS_ENUM = exports.BIND_TS_TYPE = exports.BIND_TS_INTERFACE = exports.BIND_FUNCTION = exports.BIND_VAR = exports.BIND_LEXICAL = exports.BIND_CLASS = exports.BIND_FLAGS_TS_EXPORT_ONLY = exports.BIND_FLAGS_TS_CONST_ENUM = exports.BIND_FLAGS_TS_ENUM = exports.BIND_FLAGS_CLASS = exports.BIND_FLAGS_NONE = exports.BIND_SCOPE_OUTSIDE = exports.BIND_SCOPE_FUNCTION = exports.BIND_SCOPE_LEXICAL = exports.BIND_SCOPE_VAR = exports.BIND_KIND_TYPE = exports.BIND_KIND_VALUE = exports.SCOPE_VAR = exports.SCOPE_TS_MODULE = exports.SCOPE_CLASS = exports.SCOPE_DIRECT_SUPER = exports.SCOPE_SUPER = exports.SCOPE_SIMPLE_CATCH = exports.SCOPE_ARROW = exports.SCOPE_FUNCTION = exports.SCOPE_PROGRAM = exports.SCOPE_OTHER = void 0;
|
||||
const SCOPE_OTHER = 0b00000000,
|
||||
SCOPE_PROGRAM = 0b00000001,
|
||||
SCOPE_FUNCTION = 0b00000010,
|
||||
SCOPE_ARROW = 0b00000100,
|
||||
SCOPE_SIMPLE_CATCH = 0b00001000,
|
||||
SCOPE_SUPER = 0b00010000,
|
||||
SCOPE_DIRECT_SUPER = 0b00100000,
|
||||
SCOPE_CLASS = 0b01000000,
|
||||
SCOPE_TS_MODULE = 0b10000000,
|
||||
SCOPE_VAR = SCOPE_PROGRAM | SCOPE_FUNCTION | SCOPE_TS_MODULE;
|
||||
exports.SCOPE_VAR = SCOPE_VAR;
|
||||
exports.SCOPE_TS_MODULE = SCOPE_TS_MODULE;
|
||||
exports.SCOPE_CLASS = SCOPE_CLASS;
|
||||
exports.SCOPE_DIRECT_SUPER = SCOPE_DIRECT_SUPER;
|
||||
exports.SCOPE_SUPER = SCOPE_SUPER;
|
||||
exports.SCOPE_SIMPLE_CATCH = SCOPE_SIMPLE_CATCH;
|
||||
exports.SCOPE_ARROW = SCOPE_ARROW;
|
||||
exports.SCOPE_FUNCTION = SCOPE_FUNCTION;
|
||||
exports.SCOPE_PROGRAM = SCOPE_PROGRAM;
|
||||
exports.SCOPE_OTHER = SCOPE_OTHER;
|
||||
const BIND_KIND_VALUE = 0b00000_0000_01,
|
||||
BIND_KIND_TYPE = 0b00000_0000_10,
|
||||
BIND_SCOPE_VAR = 0b00000_0001_00,
|
||||
BIND_SCOPE_LEXICAL = 0b00000_0010_00,
|
||||
BIND_SCOPE_FUNCTION = 0b00000_0100_00,
|
||||
BIND_SCOPE_OUTSIDE = 0b00000_1000_00,
|
||||
BIND_FLAGS_NONE = 0b00001_0000_00,
|
||||
BIND_FLAGS_CLASS = 0b00010_0000_00,
|
||||
BIND_FLAGS_TS_ENUM = 0b00100_0000_00,
|
||||
BIND_FLAGS_TS_CONST_ENUM = 0b01000_0000_00,
|
||||
BIND_FLAGS_TS_EXPORT_ONLY = 0b10000_0000_00;
|
||||
exports.BIND_FLAGS_TS_EXPORT_ONLY = BIND_FLAGS_TS_EXPORT_ONLY;
|
||||
exports.BIND_FLAGS_TS_CONST_ENUM = BIND_FLAGS_TS_CONST_ENUM;
|
||||
exports.BIND_FLAGS_TS_ENUM = BIND_FLAGS_TS_ENUM;
|
||||
exports.BIND_FLAGS_CLASS = BIND_FLAGS_CLASS;
|
||||
exports.BIND_FLAGS_NONE = BIND_FLAGS_NONE;
|
||||
exports.BIND_SCOPE_OUTSIDE = BIND_SCOPE_OUTSIDE;
|
||||
exports.BIND_SCOPE_FUNCTION = BIND_SCOPE_FUNCTION;
|
||||
exports.BIND_SCOPE_LEXICAL = BIND_SCOPE_LEXICAL;
|
||||
exports.BIND_SCOPE_VAR = BIND_SCOPE_VAR;
|
||||
exports.BIND_KIND_TYPE = BIND_KIND_TYPE;
|
||||
exports.BIND_KIND_VALUE = BIND_KIND_VALUE;
|
||||
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;
|
||||
exports.BIND_TS_NAMESPACE = BIND_TS_NAMESPACE;
|
||||
exports.BIND_TS_CONST_ENUM = BIND_TS_CONST_ENUM;
|
||||
exports.BIND_OUTSIDE = BIND_OUTSIDE;
|
||||
exports.BIND_NONE = BIND_NONE;
|
||||
exports.BIND_TS_AMBIENT = BIND_TS_AMBIENT;
|
||||
exports.BIND_TS_ENUM = BIND_TS_ENUM;
|
||||
exports.BIND_TS_TYPE = BIND_TS_TYPE;
|
||||
exports.BIND_TS_INTERFACE = BIND_TS_INTERFACE;
|
||||
exports.BIND_FUNCTION = BIND_FUNCTION;
|
||||
exports.BIND_VAR = BIND_VAR;
|
||||
exports.BIND_LEXICAL = BIND_LEXICAL;
|
||||
exports.BIND_CLASS = BIND_CLASS;
|
||||
const CLASS_ELEMENT_FLAG_STATIC = 0b1_00,
|
||||
CLASS_ELEMENT_KIND_GETTER = 0b0_10,
|
||||
CLASS_ELEMENT_KIND_SETTER = 0b0_01,
|
||||
CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER;
|
||||
exports.CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_ACCESSOR;
|
||||
exports.CLASS_ELEMENT_KIND_SETTER = CLASS_ELEMENT_KIND_SETTER;
|
||||
exports.CLASS_ELEMENT_KIND_GETTER = CLASS_ELEMENT_KIND_GETTER;
|
||||
exports.CLASS_ELEMENT_FLAG_STATIC = CLASS_ELEMENT_FLAG_STATIC;
|
||||
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;
|
||||
exports.CLASS_ELEMENT_OTHER = CLASS_ELEMENT_OTHER;
|
||||
exports.CLASS_ELEMENT_INSTANCE_SETTER = CLASS_ELEMENT_INSTANCE_SETTER;
|
||||
exports.CLASS_ELEMENT_INSTANCE_GETTER = CLASS_ELEMENT_INSTANCE_GETTER;
|
||||
exports.CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_STATIC_SETTER;
|
||||
exports.CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_STATIC_GETTER;
|
||||
58
node_modules/@babel/parser/lib/util/whitespace.js
generated
vendored
Normal file
58
node_modules/@babel/parser/lib/util/whitespace.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isNewLine = isNewLine;
|
||||
exports.isWhitespace = isWhitespace;
|
||||
exports.skipWhiteSpace = exports.lineBreakG = exports.lineBreak = void 0;
|
||||
const lineBreak = /\r\n?|[\n\u2028\u2029]/;
|
||||
exports.lineBreak = lineBreak;
|
||||
const lineBreakG = new RegExp(lineBreak.source, "g");
|
||||
exports.lineBreakG = lineBreakG;
|
||||
|
||||
function isNewLine(code) {
|
||||
switch (code) {
|
||||
case 10:
|
||||
case 13:
|
||||
case 8232:
|
||||
case 8233:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
|
||||
exports.skipWhiteSpace = skipWhiteSpace;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
81
node_modules/@babel/parser/package.json
generated
vendored
Normal file
81
node_modules/@babel/parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/parser@7.12.5",
|
||||
"J:\\Github\\CURD-TS"
|
||||
]
|
||||
],
|
||||
"_development": true,
|
||||
"_from": "@babel/parser@7.12.5",
|
||||
"_id": "@babel/parser@7.12.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-tK8y3dRzwL+mQ71/8HKLjnG4HqA=",
|
||||
"_location": "/@babel/parser",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/parser@7.12.5",
|
||||
"name": "@babel/parser",
|
||||
"escapedName": "@babel%2fparser",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.12.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.12.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@vue/compiler-core",
|
||||
"/@vue/compiler-sfc",
|
||||
"/vite"
|
||||
],
|
||||
"_resolved": "http://192.168.250.101:4873/@babel%2fparser/-/parser-7.12.5.tgz",
|
||||
"_spec": "7.12.5",
|
||||
"_where": "J:\\Github\\CURD-TS",
|
||||
"author": {
|
||||
"name": "Sebastian McKenzie",
|
||||
"email": "sebmck@gmail.com"
|
||||
},
|
||||
"bin": {
|
||||
"parser": "./bin/babel-parser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"description": "A JavaScript parser",
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "7.10.4",
|
||||
"@babel/helper-fixtures": "7.10.5",
|
||||
"@babel/helper-validator-identifier": "7.10.4",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"lib",
|
||||
"typings"
|
||||
],
|
||||
"homepage": "https://babeljs.io/",
|
||||
"keywords": [
|
||||
"babel",
|
||||
"javascript",
|
||||
"parser",
|
||||
"tc39",
|
||||
"ecmascript",
|
||||
"@babel/parser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/parser",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-parser"
|
||||
},
|
||||
"types": "typings/babel-parser.d.ts",
|
||||
"version": "7.12.5"
|
||||
}
|
||||
151
node_modules/@babel/parser/typings/babel-parser.d.ts
generated
vendored
Normal file
151
node_modules/@babel/parser/typings/babel-parser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
// Type definitions for @babel/parser
|
||||
// Project: https://github.com/babel/babel/tree/main/packages/babel-parser
|
||||
// Definitions by: Troy Gerwien <https://github.com/yortus>
|
||||
// Marvin Hagemeister <https://github.com/marvinhagemeister>
|
||||
// Avi Vahl <https://github.com/AviVahl>
|
||||
// TypeScript Version: 2.9
|
||||
|
||||
/**
|
||||
* Parse the provided code as an entire ECMAScript program.
|
||||
*/
|
||||
export function parse(input: string, options?: ParserOptions): import('@babel/types').File;
|
||||
|
||||
/**
|
||||
* Parse the provided code as a single expression.
|
||||
*/
|
||||
export function parseExpression(input: string, options?: ParserOptions): import('@babel/types').Expression;
|
||||
|
||||
export interface ParserOptions {
|
||||
/**
|
||||
* By default, import and export declarations can only appear at a program's top level.
|
||||
* Setting this option to true allows them anywhere where a statement is allowed.
|
||||
*/
|
||||
allowImportExportEverywhere?: boolean;
|
||||
|
||||
/**
|
||||
* By default, await use is not allowed outside of an async function.
|
||||
* Set this to true to accept such code.
|
||||
*/
|
||||
allowAwaitOutsideFunction?: boolean;
|
||||
|
||||
/**
|
||||
* By default, a return statement at the top level raises an error.
|
||||
* Set this to true to accept such code.
|
||||
*/
|
||||
allowReturnOutsideFunction?: boolean;
|
||||
|
||||
allowSuperOutsideMethod?: boolean;
|
||||
|
||||
/**
|
||||
* By default, exported identifiers must refer to a declared variable.
|
||||
* Set this to true to allow export statements to reference undeclared variables.
|
||||
*/
|
||||
allowUndeclaredExports?: boolean;
|
||||
|
||||
/**
|
||||
* Indicate the mode the code should be parsed in.
|
||||
* Can be one of "script", "module", or "unambiguous". Defaults to "script".
|
||||
* "unambiguous" will make @babel/parser attempt to guess, based on the presence
|
||||
* of ES6 import or export statements.
|
||||
* Files with ES6 imports and exports are considered "module" and are otherwise "script".
|
||||
*/
|
||||
sourceType?: 'script' | 'module' | 'unambiguous';
|
||||
|
||||
/**
|
||||
* Correlate output AST nodes with their source filename.
|
||||
* Useful when generating code and source maps from the ASTs of multiple input files.
|
||||
*/
|
||||
sourceFilename?: string;
|
||||
|
||||
/**
|
||||
* By default, the first line of code parsed is treated as line 1.
|
||||
* You can provide a line number to alternatively start with.
|
||||
* Useful for integration with other source tools.
|
||||
*/
|
||||
startLine?: number;
|
||||
|
||||
/**
|
||||
* Array containing the plugins that you want to enable.
|
||||
*/
|
||||
plugins?: ParserPlugin[];
|
||||
|
||||
/**
|
||||
* Should the parser work in strict mode.
|
||||
* Defaults to true if sourceType === 'module'. Otherwise, false.
|
||||
*/
|
||||
strictMode?: boolean;
|
||||
|
||||
/**
|
||||
* Adds a ranges property to each node: [node.start, node.end]
|
||||
*/
|
||||
ranges?: boolean;
|
||||
|
||||
/**
|
||||
* Adds all parsed tokens to a tokens property on the File node.
|
||||
*/
|
||||
tokens?: boolean;
|
||||
|
||||
/**
|
||||
* By default, the parser adds information about parentheses by setting
|
||||
* `extra.parenthesized` to `true` as needed.
|
||||
* When this option is `true` the parser creates `ParenthesizedExpression`
|
||||
* AST nodes instead of using the `extra` property.
|
||||
*/
|
||||
createParenthesizedExpressions?: boolean;
|
||||
}
|
||||
|
||||
export type ParserPlugin =
|
||||
'asyncGenerators' |
|
||||
'bigInt' |
|
||||
'classPrivateMethods' |
|
||||
'classPrivateProperties' |
|
||||
'classProperties' |
|
||||
'classStaticBlock' |
|
||||
'decimal' |
|
||||
'decorators' |
|
||||
'decorators-legacy' |
|
||||
'doExpressions' |
|
||||
'dynamicImport' |
|
||||
'estree' |
|
||||
'exportDefaultFrom' |
|
||||
'exportNamespaceFrom' | // deprecated
|
||||
'flow' |
|
||||
'flowComments' |
|
||||
'functionBind' |
|
||||
'functionSent' |
|
||||
'importMeta' |
|
||||
'jsx' |
|
||||
'logicalAssignment' |
|
||||
'importAssertions' |
|
||||
'moduleStringNames' |
|
||||
'nullishCoalescingOperator' |
|
||||
'numericSeparator' |
|
||||
'objectRestSpread' |
|
||||
'optionalCatchBinding' |
|
||||
'optionalChaining' |
|
||||
'partialApplication' |
|
||||
'pipelineOperator' |
|
||||
'placeholders' |
|
||||
'privateIn' |
|
||||
'throwExpressions' |
|
||||
'topLevelAwait' |
|
||||
'typescript' |
|
||||
'v8intrinsic' |
|
||||
ParserPluginWithOptions;
|
||||
|
||||
export type ParserPluginWithOptions =
|
||||
['decorators', DecoratorsPluginOptions] |
|
||||
['pipelineOperator', PipelineOperatorPluginOptions] |
|
||||
['flow', FlowPluginOptions];
|
||||
|
||||
export interface DecoratorsPluginOptions {
|
||||
decoratorsBeforeExport?: boolean;
|
||||
}
|
||||
|
||||
export interface PipelineOperatorPluginOptions {
|
||||
proposal: 'minimal' | 'smart';
|
||||
}
|
||||
|
||||
export interface FlowPluginOptions {
|
||||
all?: boolean;
|
||||
}
|
||||
22
node_modules/@babel/types/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/types/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
node_modules/@babel/types/README.md
generated
vendored
Normal file
19
node_modules/@babel/types/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/types
|
||||
|
||||
> Babel Types is a Lodash-esque utility library for AST nodes
|
||||
|
||||
See our website [@babel/types](https://babeljs.io/docs/en/babel-types) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20types%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/types
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/types --dev
|
||||
```
|
||||
19
node_modules/@babel/types/lib/asserts/assertNode.js
generated
vendored
Normal file
19
node_modules/@babel/types/lib/asserts/assertNode.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = assertNode;
|
||||
|
||||
var _isNode = _interopRequireDefault(require("../validators/isNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function assertNode(node) {
|
||||
if (!(0, _isNode.default)(node)) {
|
||||
var _node$type;
|
||||
|
||||
const type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node);
|
||||
throw new TypeError(`Not a valid node of type "${type}"`);
|
||||
}
|
||||
}
|
||||
1474
node_modules/@babel/types/lib/asserts/generated/index.js
generated
vendored
Normal file
1474
node_modules/@babel/types/lib/asserts/generated/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
42
node_modules/@babel/types/lib/builders/builder.js
generated
vendored
Normal file
42
node_modules/@babel/types/lib/builders/builder.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = builder;
|
||||
|
||||
var _clone = _interopRequireDefault(require("lodash/clone"));
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
var _validate = _interopRequireDefault(require("../validators/validate"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function builder(type, ...args) {
|
||||
const keys = _definitions.BUILDER_KEYS[type];
|
||||
const countArgs = args.length;
|
||||
|
||||
if (countArgs > keys.length) {
|
||||
throw new Error(`${type}: Too many arguments passed. Received ${countArgs} but can receive no more than ${keys.length}`);
|
||||
}
|
||||
|
||||
const node = {
|
||||
type
|
||||
};
|
||||
let i = 0;
|
||||
keys.forEach(key => {
|
||||
const field = _definitions.NODE_FIELDS[type][key];
|
||||
let arg;
|
||||
if (i < countArgs) arg = args[i];
|
||||
if (arg === undefined) arg = (0, _clone.default)(field.default);
|
||||
node[key] = arg;
|
||||
i++;
|
||||
});
|
||||
|
||||
for (const key of Object.keys(node)) {
|
||||
(0, _validate.default)(node, key, node[key]);
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
22
node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
generated
vendored
Normal file
22
node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = createFlowUnionType;
|
||||
|
||||
var _generated = require("../generated");
|
||||
|
||||
var _removeTypeDuplicates = _interopRequireDefault(require("../../modifications/flow/removeTypeDuplicates"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createFlowUnionType(types) {
|
||||
const flattened = (0, _removeTypeDuplicates.default)(types);
|
||||
|
||||
if (flattened.length === 1) {
|
||||
return flattened[0];
|
||||
} else {
|
||||
return (0, _generated.unionTypeAnnotation)(flattened);
|
||||
}
|
||||
}
|
||||
28
node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
generated
vendored
Normal file
28
node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = createTypeAnnotationBasedOnTypeof;
|
||||
|
||||
var _generated = require("../generated");
|
||||
|
||||
function createTypeAnnotationBasedOnTypeof(type) {
|
||||
if (type === "string") {
|
||||
return (0, _generated.stringTypeAnnotation)();
|
||||
} else if (type === "number") {
|
||||
return (0, _generated.numberTypeAnnotation)();
|
||||
} else if (type === "undefined") {
|
||||
return (0, _generated.voidTypeAnnotation)();
|
||||
} else if (type === "boolean") {
|
||||
return (0, _generated.booleanTypeAnnotation)();
|
||||
} else if (type === "function") {
|
||||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Function"));
|
||||
} else if (type === "object") {
|
||||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Object"));
|
||||
} else if (type === "symbol") {
|
||||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Symbol"));
|
||||
} else {
|
||||
throw new Error("Invalid typeof value");
|
||||
}
|
||||
}
|
||||
1243
node_modules/@babel/types/lib/builders/generated/index.js
generated
vendored
Normal file
1243
node_modules/@babel/types/lib/builders/generated/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/@babel/types/lib/builders/react/buildChildren.js
generated
vendored
Normal file
31
node_modules/@babel/types/lib/builders/react/buildChildren.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = buildChildren;
|
||||
|
||||
var _generated = require("../../validators/generated");
|
||||
|
||||
var _cleanJSXElementLiteralChild = _interopRequireDefault(require("../../utils/react/cleanJSXElementLiteralChild"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function buildChildren(node) {
|
||||
const elements = [];
|
||||
|
||||
for (let i = 0; i < node.children.length; i++) {
|
||||
let child = node.children[i];
|
||||
|
||||
if ((0, _generated.isJSXText)(child)) {
|
||||
(0, _cleanJSXElementLiteralChild.default)(child, elements);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((0, _generated.isJSXExpressionContainer)(child)) child = child.expression;
|
||||
if ((0, _generated.isJSXEmptyExpression)(child)) continue;
|
||||
elements.push(child);
|
||||
}
|
||||
|
||||
return elements;
|
||||
}
|
||||
23
node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
generated
vendored
Normal file
23
node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = createTSUnionType;
|
||||
|
||||
var _generated = require("../generated");
|
||||
|
||||
var _removeTypeDuplicates = _interopRequireDefault(require("../../modifications/typescript/removeTypeDuplicates"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function createTSUnionType(typeAnnotations) {
|
||||
const types = typeAnnotations.map(type => type.typeAnnotations);
|
||||
const flattened = (0, _removeTypeDuplicates.default)(types);
|
||||
|
||||
if (flattened.length === 1) {
|
||||
return flattened[0];
|
||||
} else {
|
||||
return (0, _generated.tsUnionType)(flattened);
|
||||
}
|
||||
}
|
||||
14
node_modules/@babel/types/lib/clone/clone.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/clone/clone.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = clone;
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function clone(node) {
|
||||
return (0, _cloneNode.default)(node, false);
|
||||
}
|
||||
14
node_modules/@babel/types/lib/clone/cloneDeep.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/clone/cloneDeep.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneDeep;
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function cloneDeep(node) {
|
||||
return (0, _cloneNode.default)(node);
|
||||
}
|
||||
14
node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneDeepWithoutLoc;
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function cloneDeepWithoutLoc(node) {
|
||||
return (0, _cloneNode.default)(node, true, true);
|
||||
}
|
||||
101
node_modules/@babel/types/lib/clone/cloneNode.js
generated
vendored
Normal file
101
node_modules/@babel/types/lib/clone/cloneNode.js
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneNode;
|
||||
|
||||
var _definitions = require("../definitions");
|
||||
|
||||
const has = Function.call.bind(Object.prototype.hasOwnProperty);
|
||||
|
||||
function cloneIfNode(obj, deep, withoutLoc) {
|
||||
if (obj && typeof obj.type === "string") {
|
||||
return cloneNode(obj, deep, withoutLoc);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function cloneIfNodeOrArray(obj, deep, withoutLoc) {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(node => cloneIfNode(node, deep, withoutLoc));
|
||||
}
|
||||
|
||||
return cloneIfNode(obj, deep, withoutLoc);
|
||||
}
|
||||
|
||||
function cloneNode(node, deep = true, withoutLoc = false) {
|
||||
if (!node) return node;
|
||||
const {
|
||||
type
|
||||
} = node;
|
||||
const newNode = {
|
||||
type
|
||||
};
|
||||
|
||||
if (type === "Identifier") {
|
||||
newNode.name = node.name;
|
||||
|
||||
if (has(node, "optional") && typeof node.optional === "boolean") {
|
||||
newNode.optional = node.optional;
|
||||
}
|
||||
|
||||
if (has(node, "typeAnnotation")) {
|
||||
newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc) : node.typeAnnotation;
|
||||
}
|
||||
} else if (!has(_definitions.NODE_FIELDS, type)) {
|
||||
throw new Error(`Unknown node type: "${type}"`);
|
||||
} else {
|
||||
for (const field of Object.keys(_definitions.NODE_FIELDS[type])) {
|
||||
if (has(node, field)) {
|
||||
if (deep) {
|
||||
newNode[field] = type === "File" && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc) : cloneIfNodeOrArray(node[field], true, withoutLoc);
|
||||
} else {
|
||||
newNode[field] = node[field];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (has(node, "loc")) {
|
||||
if (withoutLoc) {
|
||||
newNode.loc = null;
|
||||
} else {
|
||||
newNode.loc = node.loc;
|
||||
}
|
||||
}
|
||||
|
||||
if (has(node, "leadingComments")) {
|
||||
newNode.leadingComments = maybeCloneComments(node.leadingComments, deep, withoutLoc);
|
||||
}
|
||||
|
||||
if (has(node, "innerComments")) {
|
||||
newNode.innerComments = maybeCloneComments(node.innerComments, deep, withoutLoc);
|
||||
}
|
||||
|
||||
if (has(node, "trailingComments")) {
|
||||
newNode.trailingComments = maybeCloneComments(node.trailingComments, deep, withoutLoc);
|
||||
}
|
||||
|
||||
if (has(node, "extra")) {
|
||||
newNode.extra = Object.assign({}, node.extra);
|
||||
}
|
||||
|
||||
return newNode;
|
||||
}
|
||||
|
||||
function cloneCommentsWithoutLoc(comments) {
|
||||
return comments.map(({
|
||||
type,
|
||||
value
|
||||
}) => ({
|
||||
type,
|
||||
value,
|
||||
loc: null
|
||||
}));
|
||||
}
|
||||
|
||||
function maybeCloneComments(comments, deep, withoutLoc) {
|
||||
return deep && withoutLoc ? cloneCommentsWithoutLoc(comments) : comments;
|
||||
}
|
||||
14
node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/clone/cloneWithoutLoc.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = cloneWithoutLoc;
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("./cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function cloneWithoutLoc(node) {
|
||||
return (0, _cloneNode.default)(node, false, true);
|
||||
}
|
||||
17
node_modules/@babel/types/lib/comments/addComment.js
generated
vendored
Normal file
17
node_modules/@babel/types/lib/comments/addComment.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addComment;
|
||||
|
||||
var _addComments = _interopRequireDefault(require("./addComments"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function addComment(node, type, content, line) {
|
||||
return (0, _addComments.default)(node, type, [{
|
||||
type: line ? "CommentLine" : "CommentBlock",
|
||||
value: content
|
||||
}]);
|
||||
}
|
||||
23
node_modules/@babel/types/lib/comments/addComments.js
generated
vendored
Normal file
23
node_modules/@babel/types/lib/comments/addComments.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = addComments;
|
||||
|
||||
function addComments(node, type, comments) {
|
||||
if (!comments || !node) return node;
|
||||
const key = `${type}Comments`;
|
||||
|
||||
if (node[key]) {
|
||||
if (type === "leading") {
|
||||
node[key] = comments.concat(node[key]);
|
||||
} else {
|
||||
node[key] = node[key].concat(comments);
|
||||
}
|
||||
} else {
|
||||
node[key] = comments;
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
14
node_modules/@babel/types/lib/comments/inheritInnerComments.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/comments/inheritInnerComments.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritInnerComments;
|
||||
|
||||
var _inherit = _interopRequireDefault(require("../utils/inherit"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritInnerComments(child, parent) {
|
||||
(0, _inherit.default)("innerComments", child, parent);
|
||||
}
|
||||
14
node_modules/@babel/types/lib/comments/inheritLeadingComments.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/comments/inheritLeadingComments.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritLeadingComments;
|
||||
|
||||
var _inherit = _interopRequireDefault(require("../utils/inherit"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritLeadingComments(child, parent) {
|
||||
(0, _inherit.default)("leadingComments", child, parent);
|
||||
}
|
||||
14
node_modules/@babel/types/lib/comments/inheritTrailingComments.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/comments/inheritTrailingComments.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritTrailingComments;
|
||||
|
||||
var _inherit = _interopRequireDefault(require("../utils/inherit"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritTrailingComments(child, parent) {
|
||||
(0, _inherit.default)("trailingComments", child, parent);
|
||||
}
|
||||
21
node_modules/@babel/types/lib/comments/inheritsComments.js
generated
vendored
Normal file
21
node_modules/@babel/types/lib/comments/inheritsComments.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = inheritsComments;
|
||||
|
||||
var _inheritTrailingComments = _interopRequireDefault(require("./inheritTrailingComments"));
|
||||
|
||||
var _inheritLeadingComments = _interopRequireDefault(require("./inheritLeadingComments"));
|
||||
|
||||
var _inheritInnerComments = _interopRequireDefault(require("./inheritInnerComments"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function inheritsComments(child, parent) {
|
||||
(0, _inheritTrailingComments.default)(child, parent);
|
||||
(0, _inheritLeadingComments.default)(child, parent);
|
||||
(0, _inheritInnerComments.default)(child, parent);
|
||||
return child;
|
||||
}
|
||||
16
node_modules/@babel/types/lib/comments/removeComments.js
generated
vendored
Normal file
16
node_modules/@babel/types/lib/comments/removeComments.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = removeComments;
|
||||
|
||||
var _constants = require("../constants");
|
||||
|
||||
function removeComments(node) {
|
||||
_constants.COMMENT_KEYS.forEach(key => {
|
||||
node[key] = null;
|
||||
});
|
||||
|
||||
return node;
|
||||
}
|
||||
99
node_modules/@babel/types/lib/constants/generated/index.js
generated
vendored
Normal file
99
node_modules/@babel/types/lib/constants/generated/index.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.TSBASETYPE_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.PRIVATE_TYPES = exports.JSX_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.FLOWTYPE_TYPES = exports.FLOW_TYPES = exports.MODULESPECIFIER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = exports.CLASS_TYPES = exports.PATTERN_TYPES = exports.UNARYLIKE_TYPES = exports.PROPERTY_TYPES = exports.OBJECTMEMBER_TYPES = exports.METHOD_TYPES = exports.USERWHITESPACABLE_TYPES = exports.IMMUTABLE_TYPES = exports.LITERAL_TYPES = exports.TSENTITYNAME_TYPES = exports.LVAL_TYPES = exports.PATTERNLIKE_TYPES = exports.DECLARATION_TYPES = exports.PUREISH_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FUNCTION_TYPES = exports.FORXSTATEMENT_TYPES = exports.FOR_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.WHILE_TYPES = exports.LOOP_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.SCOPABLE_TYPES = exports.BINARY_TYPES = exports.EXPRESSION_TYPES = void 0;
|
||||
|
||||
var _definitions = require("../../definitions");
|
||||
|
||||
const EXPRESSION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Expression"];
|
||||
exports.EXPRESSION_TYPES = EXPRESSION_TYPES;
|
||||
const BINARY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Binary"];
|
||||
exports.BINARY_TYPES = BINARY_TYPES;
|
||||
const SCOPABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Scopable"];
|
||||
exports.SCOPABLE_TYPES = SCOPABLE_TYPES;
|
||||
const BLOCKPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["BlockParent"];
|
||||
exports.BLOCKPARENT_TYPES = BLOCKPARENT_TYPES;
|
||||
const BLOCK_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Block"];
|
||||
exports.BLOCK_TYPES = BLOCK_TYPES;
|
||||
const STATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Statement"];
|
||||
exports.STATEMENT_TYPES = STATEMENT_TYPES;
|
||||
const TERMINATORLESS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Terminatorless"];
|
||||
exports.TERMINATORLESS_TYPES = TERMINATORLESS_TYPES;
|
||||
const COMPLETIONSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["CompletionStatement"];
|
||||
exports.COMPLETIONSTATEMENT_TYPES = COMPLETIONSTATEMENT_TYPES;
|
||||
const CONDITIONAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Conditional"];
|
||||
exports.CONDITIONAL_TYPES = CONDITIONAL_TYPES;
|
||||
const LOOP_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Loop"];
|
||||
exports.LOOP_TYPES = LOOP_TYPES;
|
||||
const WHILE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["While"];
|
||||
exports.WHILE_TYPES = WHILE_TYPES;
|
||||
const EXPRESSIONWRAPPER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExpressionWrapper"];
|
||||
exports.EXPRESSIONWRAPPER_TYPES = EXPRESSIONWRAPPER_TYPES;
|
||||
const FOR_TYPES = _definitions.FLIPPED_ALIAS_KEYS["For"];
|
||||
exports.FOR_TYPES = FOR_TYPES;
|
||||
const FORXSTATEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ForXStatement"];
|
||||
exports.FORXSTATEMENT_TYPES = FORXSTATEMENT_TYPES;
|
||||
const FUNCTION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Function"];
|
||||
exports.FUNCTION_TYPES = FUNCTION_TYPES;
|
||||
const FUNCTIONPARENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FunctionParent"];
|
||||
exports.FUNCTIONPARENT_TYPES = FUNCTIONPARENT_TYPES;
|
||||
const PUREISH_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pureish"];
|
||||
exports.PUREISH_TYPES = PUREISH_TYPES;
|
||||
const DECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Declaration"];
|
||||
exports.DECLARATION_TYPES = DECLARATION_TYPES;
|
||||
const PATTERNLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["PatternLike"];
|
||||
exports.PATTERNLIKE_TYPES = PATTERNLIKE_TYPES;
|
||||
const LVAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["LVal"];
|
||||
exports.LVAL_TYPES = LVAL_TYPES;
|
||||
const TSENTITYNAME_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSEntityName"];
|
||||
exports.TSENTITYNAME_TYPES = TSENTITYNAME_TYPES;
|
||||
const LITERAL_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Literal"];
|
||||
exports.LITERAL_TYPES = LITERAL_TYPES;
|
||||
const IMMUTABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Immutable"];
|
||||
exports.IMMUTABLE_TYPES = IMMUTABLE_TYPES;
|
||||
const USERWHITESPACABLE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UserWhitespacable"];
|
||||
exports.USERWHITESPACABLE_TYPES = USERWHITESPACABLE_TYPES;
|
||||
const METHOD_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Method"];
|
||||
exports.METHOD_TYPES = METHOD_TYPES;
|
||||
const OBJECTMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ObjectMember"];
|
||||
exports.OBJECTMEMBER_TYPES = OBJECTMEMBER_TYPES;
|
||||
const PROPERTY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Property"];
|
||||
exports.PROPERTY_TYPES = PROPERTY_TYPES;
|
||||
const UNARYLIKE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["UnaryLike"];
|
||||
exports.UNARYLIKE_TYPES = UNARYLIKE_TYPES;
|
||||
const PATTERN_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Pattern"];
|
||||
exports.PATTERN_TYPES = PATTERN_TYPES;
|
||||
const CLASS_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Class"];
|
||||
exports.CLASS_TYPES = CLASS_TYPES;
|
||||
const MODULEDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleDeclaration"];
|
||||
exports.MODULEDECLARATION_TYPES = MODULEDECLARATION_TYPES;
|
||||
const EXPORTDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ExportDeclaration"];
|
||||
exports.EXPORTDECLARATION_TYPES = EXPORTDECLARATION_TYPES;
|
||||
const MODULESPECIFIER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["ModuleSpecifier"];
|
||||
exports.MODULESPECIFIER_TYPES = MODULESPECIFIER_TYPES;
|
||||
const FLOW_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Flow"];
|
||||
exports.FLOW_TYPES = FLOW_TYPES;
|
||||
const FLOWTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowType"];
|
||||
exports.FLOWTYPE_TYPES = FLOWTYPE_TYPES;
|
||||
const FLOWBASEANNOTATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowBaseAnnotation"];
|
||||
exports.FLOWBASEANNOTATION_TYPES = FLOWBASEANNOTATION_TYPES;
|
||||
const FLOWDECLARATION_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowDeclaration"];
|
||||
exports.FLOWDECLARATION_TYPES = FLOWDECLARATION_TYPES;
|
||||
const FLOWPREDICATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["FlowPredicate"];
|
||||
exports.FLOWPREDICATE_TYPES = FLOWPREDICATE_TYPES;
|
||||
const ENUMBODY_TYPES = _definitions.FLIPPED_ALIAS_KEYS["EnumBody"];
|
||||
exports.ENUMBODY_TYPES = ENUMBODY_TYPES;
|
||||
const ENUMMEMBER_TYPES = _definitions.FLIPPED_ALIAS_KEYS["EnumMember"];
|
||||
exports.ENUMMEMBER_TYPES = ENUMMEMBER_TYPES;
|
||||
const JSX_TYPES = _definitions.FLIPPED_ALIAS_KEYS["JSX"];
|
||||
exports.JSX_TYPES = JSX_TYPES;
|
||||
const PRIVATE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["Private"];
|
||||
exports.PRIVATE_TYPES = PRIVATE_TYPES;
|
||||
const TSTYPEELEMENT_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSTypeElement"];
|
||||
exports.TSTYPEELEMENT_TYPES = TSTYPEELEMENT_TYPES;
|
||||
const TSTYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSType"];
|
||||
exports.TSTYPE_TYPES = TSTYPE_TYPES;
|
||||
const TSBASETYPE_TYPES = _definitions.FLIPPED_ALIAS_KEYS["TSBaseType"];
|
||||
exports.TSBASETYPE_TYPES = TSBASETYPE_TYPES;
|
||||
49
node_modules/@babel/types/lib/constants/index.js
generated
vendored
Normal file
49
node_modules/@babel/types/lib/constants/index.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"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;
|
||||
14
node_modules/@babel/types/lib/converters/ensureBlock.js
generated
vendored
Normal file
14
node_modules/@babel/types/lib/converters/ensureBlock.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = ensureBlock;
|
||||
|
||||
var _toBlock = _interopRequireDefault(require("./toBlock"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function ensureBlock(node, key = "body") {
|
||||
return node[key] = (0, _toBlock.default)(node[key], node);
|
||||
}
|
||||
77
node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
generated
vendored
Normal file
77
node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = gatherSequenceExpressions;
|
||||
|
||||
var _getBindingIdentifiers = _interopRequireDefault(require("../retrievers/getBindingIdentifiers"));
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("../clone/cloneNode"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function gatherSequenceExpressions(nodes, scope, declars) {
|
||||
const exprs = [];
|
||||
let ensureLastUndefined = true;
|
||||
|
||||
for (const node of nodes) {
|
||||
if (!(0, _generated.isEmptyStatement)(node)) {
|
||||
ensureLastUndefined = false;
|
||||
}
|
||||
|
||||
if ((0, _generated.isExpression)(node)) {
|
||||
exprs.push(node);
|
||||
} else if ((0, _generated.isExpressionStatement)(node)) {
|
||||
exprs.push(node.expression);
|
||||
} else if ((0, _generated.isVariableDeclaration)(node)) {
|
||||
if (node.kind !== "var") return;
|
||||
|
||||
for (const declar of node.declarations) {
|
||||
const bindings = (0, _getBindingIdentifiers.default)(declar);
|
||||
|
||||
for (const key of Object.keys(bindings)) {
|
||||
declars.push({
|
||||
kind: node.kind,
|
||||
id: (0, _cloneNode.default)(bindings[key])
|
||||
});
|
||||
}
|
||||
|
||||
if (declar.init) {
|
||||
exprs.push((0, _generated2.assignmentExpression)("=", declar.id, declar.init));
|
||||
}
|
||||
}
|
||||
|
||||
ensureLastUndefined = true;
|
||||
} else if ((0, _generated.isIfStatement)(node)) {
|
||||
const consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode();
|
||||
const alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode();
|
||||
if (!consequent || !alternate) return;
|
||||
exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate));
|
||||
} else if ((0, _generated.isBlockStatement)(node)) {
|
||||
const body = gatherSequenceExpressions(node.body, scope, declars);
|
||||
if (!body) return;
|
||||
exprs.push(body);
|
||||
} else if ((0, _generated.isEmptyStatement)(node)) {
|
||||
if (nodes.indexOf(node) === 0) {
|
||||
ensureLastUndefined = true;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ensureLastUndefined) {
|
||||
exprs.push(scope.buildUndefinedNode());
|
||||
}
|
||||
|
||||
if (exprs.length === 1) {
|
||||
return exprs[0];
|
||||
} else {
|
||||
return (0, _generated2.sequenceExpression)(exprs);
|
||||
}
|
||||
}
|
||||
16
node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
generated
vendored
Normal file
16
node_modules/@babel/types/lib/converters/toBindingIdentifierName.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toBindingIdentifierName;
|
||||
|
||||
var _toIdentifier = _interopRequireDefault(require("./toIdentifier"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toBindingIdentifierName(name) {
|
||||
name = (0, _toIdentifier.default)(name);
|
||||
if (name === "eval" || name === "arguments") name = "_" + name;
|
||||
return name;
|
||||
}
|
||||
34
node_modules/@babel/types/lib/converters/toBlock.js
generated
vendored
Normal file
34
node_modules/@babel/types/lib/converters/toBlock.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toBlock;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
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);
|
||||
}
|
||||
15
node_modules/@babel/types/lib/converters/toComputedKey.js
generated
vendored
Normal file
15
node_modules/@babel/types/lib/converters/toComputedKey.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toComputedKey;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
function toComputedKey(node, key = node.key || node.property) {
|
||||
if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name);
|
||||
return key;
|
||||
}
|
||||
30
node_modules/@babel/types/lib/converters/toExpression.js
generated
vendored
Normal file
30
node_modules/@babel/types/lib/converters/toExpression.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toExpression;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
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;
|
||||
}
|
||||
25
node_modules/@babel/types/lib/converters/toIdentifier.js
generated
vendored
Normal file
25
node_modules/@babel/types/lib/converters/toIdentifier.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toIdentifier;
|
||||
|
||||
var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toIdentifier(name) {
|
||||
name = name + "";
|
||||
name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
|
||||
name = name.replace(/^[-0-9]+/, "");
|
||||
name = name.replace(/[-\s]+(.)?/g, function (match, c) {
|
||||
return c ? c.toUpperCase() : "";
|
||||
});
|
||||
|
||||
if (!(0, _isValidIdentifier.default)(name)) {
|
||||
name = `_${name}`;
|
||||
}
|
||||
|
||||
return name || "_";
|
||||
}
|
||||
48
node_modules/@babel/types/lib/converters/toKeyAlias.js
generated
vendored
Normal file
48
node_modules/@babel/types/lib/converters/toKeyAlias.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toKeyAlias;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _cloneNode = _interopRequireDefault(require("../clone/cloneNode"));
|
||||
|
||||
var _removePropertiesDeep = _interopRequireDefault(require("../modifications/removePropertiesDeep"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toKeyAlias(node, key = node.key) {
|
||||
let alias;
|
||||
|
||||
if (node.kind === "method") {
|
||||
return toKeyAlias.increment() + "";
|
||||
} else if ((0, _generated.isIdentifier)(key)) {
|
||||
alias = key.name;
|
||||
} else if ((0, _generated.isStringLiteral)(key)) {
|
||||
alias = JSON.stringify(key.value);
|
||||
} else {
|
||||
alias = JSON.stringify((0, _removePropertiesDeep.default)((0, _cloneNode.default)(key)));
|
||||
}
|
||||
|
||||
if (node.computed) {
|
||||
alias = `[${alias}]`;
|
||||
}
|
||||
|
||||
if (node.static) {
|
||||
alias = `static:${alias}`;
|
||||
}
|
||||
|
||||
return alias;
|
||||
}
|
||||
|
||||
toKeyAlias.uid = 0;
|
||||
|
||||
toKeyAlias.increment = function () {
|
||||
if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) {
|
||||
return toKeyAlias.uid = 0;
|
||||
} else {
|
||||
return toKeyAlias.uid++;
|
||||
}
|
||||
};
|
||||
23
node_modules/@babel/types/lib/converters/toSequenceExpression.js
generated
vendored
Normal file
23
node_modules/@babel/types/lib/converters/toSequenceExpression.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toSequenceExpression;
|
||||
|
||||
var _gatherSequenceExpressions = _interopRequireDefault(require("./gatherSequenceExpressions"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toSequenceExpression(nodes, scope) {
|
||||
if (!(nodes == null ? void 0 : nodes.length)) return;
|
||||
const declars = [];
|
||||
const result = (0, _gatherSequenceExpressions.default)(nodes, scope, declars);
|
||||
if (!result) return;
|
||||
|
||||
for (const declar of declars) {
|
||||
scope.push(declar);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
44
node_modules/@babel/types/lib/converters/toStatement.js
generated
vendored
Normal file
44
node_modules/@babel/types/lib/converters/toStatement.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = toStatement;
|
||||
|
||||
var _generated = require("../validators/generated");
|
||||
|
||||
var _generated2 = require("../builders/generated");
|
||||
|
||||
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;
|
||||
}
|
||||
88
node_modules/@babel/types/lib/converters/valueToNode.js
generated
vendored
Normal file
88
node_modules/@babel/types/lib/converters/valueToNode.js
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = valueToNode;
|
||||
|
||||
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
|
||||
|
||||
var _isRegExp = _interopRequireDefault(require("lodash/isRegExp"));
|
||||
|
||||
var _isValidIdentifier = _interopRequireDefault(require("../validators/isValidIdentifier"));
|
||||
|
||||
var _generated = require("../builders/generated");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function valueToNode(value) {
|
||||
if (value === undefined) {
|
||||
return (0, _generated.identifier)("undefined");
|
||||
}
|
||||
|
||||
if (value === true || value === false) {
|
||||
return (0, _generated.booleanLiteral)(value);
|
||||
}
|
||||
|
||||
if (value === null) {
|
||||
return (0, _generated.nullLiteral)();
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
return (0, _generated.stringLiteral)(value);
|
||||
}
|
||||
|
||||
if (typeof value === "number") {
|
||||
let result;
|
||||
|
||||
if (Number.isFinite(value)) {
|
||||
result = (0, _generated.numericLiteral)(Math.abs(value));
|
||||
} else {
|
||||
let numerator;
|
||||
|
||||
if (Number.isNaN(value)) {
|
||||
numerator = (0, _generated.numericLiteral)(0);
|
||||
} else {
|
||||
numerator = (0, _generated.numericLiteral)(1);
|
||||
}
|
||||
|
||||
result = (0, _generated.binaryExpression)("/", numerator, (0, _generated.numericLiteral)(0));
|
||||
}
|
||||
|
||||
if (value < 0 || Object.is(value, -0)) {
|
||||
result = (0, _generated.unaryExpression)("-", result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((0, _isRegExp.default)(value)) {
|
||||
const pattern = value.source;
|
||||
const flags = value.toString().match(/\/([a-z]+|)$/)[1];
|
||||
return (0, _generated.regExpLiteral)(pattern, flags);
|
||||
}
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
return (0, _generated.arrayExpression)(value.map(valueToNode));
|
||||
}
|
||||
|
||||
if ((0, _isPlainObject.default)(value)) {
|
||||
const props = [];
|
||||
|
||||
for (const key of Object.keys(value)) {
|
||||
let nodeKey;
|
||||
|
||||
if ((0, _isValidIdentifier.default)(key)) {
|
||||
nodeKey = (0, _generated.identifier)(key);
|
||||
} else {
|
||||
nodeKey = (0, _generated.stringLiteral)(key);
|
||||
}
|
||||
|
||||
props.push((0, _generated.objectProperty)(nodeKey, valueToNode(value[key])));
|
||||
}
|
||||
|
||||
return (0, _generated.objectExpression)(props);
|
||||
}
|
||||
|
||||
throw new Error("don't know how to turn this value into a node");
|
||||
}
|
||||
1488
node_modules/@babel/types/lib/definitions/core.js
generated
vendored
Normal file
1488
node_modules/@babel/types/lib/definitions/core.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
200
node_modules/@babel/types/lib/definitions/experimental.js
generated
vendored
Normal file
200
node_modules/@babel/types/lib/definitions/experimental.js
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _core = require("./core");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("ArgumentPlaceholder", {});
|
||||
(0, _utils.default)("BindExpression", {
|
||||
visitor: ["object", "callee"],
|
||||
aliases: ["Expression"],
|
||||
fields: !process.env.BABEL_TYPES_8_BREAKING ? {
|
||||
object: {
|
||||
validate: Object.assign(() => {}, {
|
||||
oneOfNodeTypes: ["Expression"]
|
||||
})
|
||||
},
|
||||
callee: {
|
||||
validate: Object.assign(() => {}, {
|
||||
oneOfNodeTypes: ["Expression"]
|
||||
})
|
||||
}
|
||||
} : {
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
},
|
||||
callee: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassProperty", {
|
||||
visitor: ["key", "value", "typeAnnotation", "decorators"],
|
||||
builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
|
||||
aliases: ["Property"],
|
||||
fields: Object.assign({}, _core.classMethodOrPropertyCommon, {
|
||||
value: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
definite: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
typeAnnotation: {
|
||||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
},
|
||||
readonly: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
declare: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
}
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("PipelineTopicExpression", {
|
||||
builder: ["expression"],
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PipelineBareFunction", {
|
||||
builder: ["callee"],
|
||||
visitor: ["callee"],
|
||||
fields: {
|
||||
callee: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PipelinePrimaryTopicReference", {
|
||||
aliases: ["Expression"]
|
||||
});
|
||||
(0, _utils.default)("ClassPrivateProperty", {
|
||||
visitor: ["key", "value", "decorators"],
|
||||
builder: ["key", "value", "decorators", "static"],
|
||||
aliases: ["Property", "Private"],
|
||||
fields: {
|
||||
key: {
|
||||
validate: (0, _utils.assertNodeType)("PrivateName")
|
||||
},
|
||||
value: {
|
||||
validate: (0, _utils.assertNodeType)("Expression"),
|
||||
optional: true
|
||||
},
|
||||
decorators: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Decorator"))),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ClassPrivateMethod", {
|
||||
builder: ["kind", "key", "params", "body", "static"],
|
||||
visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
|
||||
aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method", "Private"],
|
||||
fields: Object.assign({}, _core.classMethodOrDeclareMethodCommon, _core.functionTypeAnnotationCommon, {
|
||||
key: {
|
||||
validate: (0, _utils.assertNodeType)("PrivateName")
|
||||
},
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
})
|
||||
});
|
||||
(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"],
|
||||
aliases: ["Expression"],
|
||||
fields: {
|
||||
body: {
|
||||
validate: (0, _utils.assertNodeType)("BlockStatement")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExportDefaultSpecifier", {
|
||||
visitor: ["exported"],
|
||||
aliases: ["ModuleSpecifier"],
|
||||
fields: {
|
||||
exported: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("PrivateName", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Private"],
|
||||
fields: {
|
||||
id: {
|
||||
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"]
|
||||
});
|
||||
461
node_modules/@babel/types/lib/definitions/flow.js
generated
vendored
Normal file
461
node_modules/@babel/types/lib/definitions/flow.js
generated
vendored
Normal file
@@ -0,0 +1,461 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const defineInterfaceishType = (name, typeParameterType = "TypeParameterDeclaration") => {
|
||||
(0, _utils.default)(name, {
|
||||
builder: ["id", "typeParameters", "extends", "body"],
|
||||
visitor: ["id", "typeParameters", "extends", "mixins", "implements", "body"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)(typeParameterType),
|
||||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
|
||||
mixins: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
|
||||
implements: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ClassImplements")),
|
||||
body: (0, _utils.validateType)("ObjectTypeAnnotation")
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
(0, _utils.default)("AnyTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ArrayTypeAnnotation", {
|
||||
visitor: ["elementType"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
elementType: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("BooleanTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("BooleanLiteralTypeAnnotation", {
|
||||
builder: ["value"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
value: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("NullLiteralTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ClassImplements", {
|
||||
visitor: ["id", "typeParameters"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
defineInterfaceishType("DeclareClass");
|
||||
(0, _utils.default)("DeclareFunction", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
predicate: (0, _utils.validateOptionalType)("DeclaredPredicate")
|
||||
}
|
||||
});
|
||||
defineInterfaceishType("DeclareInterface");
|
||||
(0, _utils.default)("DeclareModule", {
|
||||
builder: ["id", "body", "kind"],
|
||||
visitor: ["id", "body"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
body: (0, _utils.validateType)("BlockStatement"),
|
||||
kind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("CommonJS", "ES"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareModuleExports", {
|
||||
visitor: ["typeAnnotation"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareTypeAlias", {
|
||||
visitor: ["id", "typeParameters", "right"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
right: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareOpaqueType", {
|
||||
visitor: ["id", "typeParameters", "supertype"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
supertype: (0, _utils.validateOptionalType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareVariable", {
|
||||
visitor: ["id"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareExportDeclaration", {
|
||||
visitor: ["declaration", "specifiers", "source"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
declaration: (0, _utils.validateOptionalType)("Flow"),
|
||||
specifiers: (0, _utils.validateOptional)((0, _utils.arrayOfType)(["ExportSpecifier", "ExportNamespaceSpecifier"])),
|
||||
source: (0, _utils.validateOptionalType)("StringLiteral"),
|
||||
default: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclareExportAllDeclaration", {
|
||||
visitor: ["source"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
source: (0, _utils.validateType)("StringLiteral"),
|
||||
exportKind: (0, _utils.validateOptional)((0, _utils.assertOneOf)("type", "value"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("DeclaredPredicate", {
|
||||
visitor: ["value"],
|
||||
aliases: ["Flow", "FlowPredicate"],
|
||||
fields: {
|
||||
value: (0, _utils.validateType)("Flow")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ExistsTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType"]
|
||||
});
|
||||
(0, _utils.default)("FunctionTypeAnnotation", {
|
||||
visitor: ["typeParameters", "params", "rest", "returnType"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
params: (0, _utils.validate)((0, _utils.arrayOfType)("FunctionTypeParam")),
|
||||
rest: (0, _utils.validateOptionalType)("FunctionTypeParam"),
|
||||
returnType: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("FunctionTypeParam", {
|
||||
visitor: ["name", "typeAnnotation"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
name: (0, _utils.validateOptionalType)("Identifier"),
|
||||
typeAnnotation: (0, _utils.validateType)("FlowType"),
|
||||
optional: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("GenericTypeAnnotation", {
|
||||
visitor: ["id", "typeParameters"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("InferredPredicate", {
|
||||
aliases: ["Flow", "FlowPredicate"]
|
||||
});
|
||||
(0, _utils.default)("InterfaceExtends", {
|
||||
visitor: ["id", "typeParameters"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"]),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
defineInterfaceishType("InterfaceDeclaration");
|
||||
(0, _utils.default)("InterfaceTypeAnnotation", {
|
||||
visitor: ["extends", "body"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("InterfaceExtends")),
|
||||
body: (0, _utils.validateType)("ObjectTypeAnnotation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("IntersectionTypeAnnotation", {
|
||||
visitor: ["types"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("MixedTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("EmptyTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("NullableTypeAnnotation", {
|
||||
visitor: ["typeAnnotation"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("NumberLiteralTypeAnnotation", {
|
||||
builder: ["value"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
value: (0, _utils.validate)((0, _utils.assertValueType)("number"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("NumberTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeAnnotation", {
|
||||
visitor: ["properties", "indexers", "callProperties", "internalSlots"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
builder: ["properties", "indexers", "callProperties", "internalSlots", "exact"],
|
||||
fields: {
|
||||
properties: (0, _utils.validate)((0, _utils.arrayOfType)(["ObjectTypeProperty", "ObjectTypeSpreadProperty"])),
|
||||
indexers: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeIndexer")),
|
||||
callProperties: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeCallProperty")),
|
||||
internalSlots: (0, _utils.validateOptional)((0, _utils.arrayOfType)("ObjectTypeInternalSlot")),
|
||||
exact: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
default: false
|
||||
},
|
||||
inexact: (0, _utils.validateOptional)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeInternalSlot", {
|
||||
visitor: ["id", "value", "optional", "static", "method"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
method: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeCallProperty", {
|
||||
visitor: ["value"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeIndexer", {
|
||||
visitor: ["id", "key", "value", "variance"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
id: (0, _utils.validateOptionalType)("Identifier"),
|
||||
key: (0, _utils.validateType)("FlowType"),
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
variance: (0, _utils.validateOptionalType)("Variance")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeProperty", {
|
||||
visitor: ["key", "value", "variance"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
key: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
value: (0, _utils.validateType)("FlowType"),
|
||||
kind: (0, _utils.validate)((0, _utils.assertOneOf)("init", "get", "set")),
|
||||
static: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
proto: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
optional: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
variance: (0, _utils.validateOptionalType)("Variance")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("ObjectTypeSpreadProperty", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["Flow", "UserWhitespacable"],
|
||||
fields: {
|
||||
argument: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("OpaqueType", {
|
||||
visitor: ["id", "typeParameters", "supertype", "impltype"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
supertype: (0, _utils.validateOptionalType)("FlowType"),
|
||||
impltype: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("QualifiedTypeIdentifier", {
|
||||
visitor: ["id", "qualification"],
|
||||
aliases: ["Flow"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
qualification: (0, _utils.validateType)(["Identifier", "QualifiedTypeIdentifier"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("StringLiteralTypeAnnotation", {
|
||||
builder: ["value"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
value: (0, _utils.validate)((0, _utils.assertValueType)("string"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("StringTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("SymbolTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("ThisTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("TupleTypeAnnotation", {
|
||||
visitor: ["types"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeofTypeAnnotation", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
argument: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeAlias", {
|
||||
visitor: ["id", "typeParameters", "right"],
|
||||
aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TypeParameterDeclaration"),
|
||||
right: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeAnnotation", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("FlowType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeCastExpression", {
|
||||
visitor: ["expression", "typeAnnotation"],
|
||||
aliases: ["Flow", "ExpressionWrapper", "Expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression"),
|
||||
typeAnnotation: (0, _utils.validateType)("TypeAnnotation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeParameter", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["bound", "default", "variance"],
|
||||
fields: {
|
||||
name: (0, _utils.validate)((0, _utils.assertValueType)("string")),
|
||||
bound: (0, _utils.validateOptionalType)("TypeAnnotation"),
|
||||
default: (0, _utils.validateOptionalType)("FlowType"),
|
||||
variance: (0, _utils.validateOptionalType)("Variance")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeParameterDeclaration", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: (0, _utils.validate)((0, _utils.arrayOfType)("TypeParameter"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TypeParameterInstantiation", {
|
||||
aliases: ["Flow"],
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("UnionTypeAnnotation", {
|
||||
visitor: ["types"],
|
||||
aliases: ["Flow", "FlowType"],
|
||||
fields: {
|
||||
types: (0, _utils.validate)((0, _utils.arrayOfType)("FlowType"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("Variance", {
|
||||
aliases: ["Flow"],
|
||||
builder: ["kind"],
|
||||
fields: {
|
||||
kind: (0, _utils.validate)((0, _utils.assertOneOf)("minus", "plus"))
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("VoidTypeAnnotation", {
|
||||
aliases: ["Flow", "FlowType", "FlowBaseAnnotation"]
|
||||
});
|
||||
(0, _utils.default)("EnumDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "body"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
body: (0, _utils.validateType)(["EnumBooleanBody", "EnumNumberBody", "EnumStringBody", "EnumSymbolBody"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumBooleanBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
members: (0, _utils.validateArrayOfType)("EnumBooleanMember")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumNumberBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
members: (0, _utils.validateArrayOfType)("EnumNumberMember")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumStringBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
explicit: (0, _utils.validate)((0, _utils.assertValueType)("boolean")),
|
||||
members: (0, _utils.validateArrayOfType)(["EnumStringMember", "EnumDefaultedMember"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumSymbolBody", {
|
||||
aliases: ["EnumBody"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
members: (0, _utils.validateArrayOfType)("EnumDefaultedMember")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumBooleanMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
init: (0, _utils.validateType)("BooleanLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumNumberMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id", "init"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
init: (0, _utils.validateType)("NumericLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumStringMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id", "init"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
init: (0, _utils.validateType)("StringLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("EnumDefaultedMember", {
|
||||
aliases: ["EnumMember"],
|
||||
visitor: ["id"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
97
node_modules/@babel/types/lib/definitions/index.js
generated
vendored
Normal file
97
node_modules/@babel/types/lib/definitions/index.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "VISITOR_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.VISITOR_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "ALIAS_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.ALIAS_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "FLIPPED_ALIAS_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.FLIPPED_ALIAS_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NODE_FIELDS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.NODE_FIELDS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "BUILDER_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.BUILDER_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "DEPRECATED_KEYS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.DEPRECATED_KEYS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "NODE_PARENT_VALIDATIONS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _utils.NODE_PARENT_VALIDATIONS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PLACEHOLDERS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _placeholders.PLACEHOLDERS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PLACEHOLDERS_ALIAS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _placeholders.PLACEHOLDERS_ALIAS;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "PLACEHOLDERS_FLIPPED_ALIAS", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _placeholders.PLACEHOLDERS_FLIPPED_ALIAS;
|
||||
}
|
||||
});
|
||||
exports.TYPES = void 0;
|
||||
|
||||
var _toFastProperties = _interopRequireDefault(require("to-fast-properties"));
|
||||
|
||||
require("./core");
|
||||
|
||||
require("./flow");
|
||||
|
||||
require("./jsx");
|
||||
|
||||
require("./misc");
|
||||
|
||||
require("./experimental");
|
||||
|
||||
require("./typescript");
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
var _placeholders = require("./placeholders");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
(0, _toFastProperties.default)(_utils.VISITOR_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.ALIAS_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.FLIPPED_ALIAS_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.NODE_FIELDS);
|
||||
(0, _toFastProperties.default)(_utils.BUILDER_KEYS);
|
||||
(0, _toFastProperties.default)(_utils.DEPRECATED_KEYS);
|
||||
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_ALIAS);
|
||||
(0, _toFastProperties.default)(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS);
|
||||
const TYPES = Object.keys(_utils.VISITOR_KEYS).concat(Object.keys(_utils.FLIPPED_ALIAS_KEYS)).concat(Object.keys(_utils.DEPRECATED_KEYS));
|
||||
exports.TYPES = TYPES;
|
||||
165
node_modules/@babel/types/lib/definitions/jsx.js
generated
vendored
Normal file
165
node_modules/@babel/types/lib/definitions/jsx.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("JSXAttribute", {
|
||||
visitor: ["name", "value"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXNamespacedName")
|
||||
},
|
||||
value: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("JSXElement", "JSXFragment", "StringLiteral", "JSXExpressionContainer")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXClosingElement", {
|
||||
visitor: ["name"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXElement", {
|
||||
builder: ["openingElement", "closingElement", "children", "selfClosing"],
|
||||
visitor: ["openingElement", "children", "closingElement"],
|
||||
aliases: ["JSX", "Immutable", "Expression"],
|
||||
fields: {
|
||||
openingElement: {
|
||||
validate: (0, _utils.assertNodeType)("JSXOpeningElement")
|
||||
},
|
||||
closingElement: {
|
||||
optional: true,
|
||||
validate: (0, _utils.assertNodeType)("JSXClosingElement")
|
||||
},
|
||||
children: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
|
||||
},
|
||||
selfClosing: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXEmptyExpression", {
|
||||
aliases: ["JSX"]
|
||||
});
|
||||
(0, _utils.default)("JSXExpressionContainer", {
|
||||
visitor: ["expression"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression", "JSXEmptyExpression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXSpreadChild", {
|
||||
visitor: ["expression"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
expression: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXIdentifier", {
|
||||
builder: ["name"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXMemberExpression", {
|
||||
visitor: ["object", "property"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
object: {
|
||||
validate: (0, _utils.assertNodeType)("JSXMemberExpression", "JSXIdentifier")
|
||||
},
|
||||
property: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXNamespacedName", {
|
||||
visitor: ["namespace", "name"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
namespace: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier")
|
||||
},
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXOpeningElement", {
|
||||
builder: ["name", "attributes", "selfClosing"],
|
||||
visitor: ["name", "attributes"],
|
||||
aliases: ["JSX", "Immutable"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("JSXIdentifier", "JSXMemberExpression", "JSXNamespacedName")
|
||||
},
|
||||
selfClosing: {
|
||||
default: false
|
||||
},
|
||||
attributes: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TypeParameterInstantiation", "TSTypeParameterInstantiation"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXSpreadAttribute", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["JSX"],
|
||||
fields: {
|
||||
argument: {
|
||||
validate: (0, _utils.assertNodeType)("Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXText", {
|
||||
aliases: ["JSX", "Immutable"],
|
||||
builder: ["value"],
|
||||
fields: {
|
||||
value: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXFragment", {
|
||||
builder: ["openingFragment", "closingFragment", "children"],
|
||||
visitor: ["openingFragment", "children", "closingFragment"],
|
||||
aliases: ["JSX", "Immutable", "Expression"],
|
||||
fields: {
|
||||
openingFragment: {
|
||||
validate: (0, _utils.assertNodeType)("JSXOpeningFragment")
|
||||
},
|
||||
closingFragment: {
|
||||
validate: (0, _utils.assertNodeType)("JSXClosingFragment")
|
||||
},
|
||||
children: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement", "JSXFragment")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("JSXOpeningFragment", {
|
||||
aliases: ["JSX", "Immutable"]
|
||||
});
|
||||
(0, _utils.default)("JSXClosingFragment", {
|
||||
aliases: ["JSX", "Immutable"]
|
||||
});
|
||||
33
node_modules/@babel/types/lib/definitions/misc.js
generated
vendored
Normal file
33
node_modules/@babel/types/lib/definitions/misc.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _placeholders = require("./placeholders");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
(0, _utils.default)("Noop", {
|
||||
visitor: []
|
||||
});
|
||||
(0, _utils.default)("Placeholder", {
|
||||
visitor: [],
|
||||
builder: ["expectedNode", "name"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier")
|
||||
},
|
||||
expectedNode: {
|
||||
validate: (0, _utils.assertOneOf)(..._placeholders.PLACEHOLDERS)
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("V8IntrinsicIdentifier", {
|
||||
builder: ["name"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
}
|
||||
}
|
||||
});
|
||||
33
node_modules/@babel/types/lib/definitions/placeholders.js
generated
vendored
Normal file
33
node_modules/@babel/types/lib/definitions/placeholders.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PLACEHOLDERS_FLIPPED_ALIAS = exports.PLACEHOLDERS_ALIAS = exports.PLACEHOLDERS = void 0;
|
||||
|
||||
var _utils = require("./utils");
|
||||
|
||||
const PLACEHOLDERS = ["Identifier", "StringLiteral", "Expression", "Statement", "Declaration", "BlockStatement", "ClassBody", "Pattern"];
|
||||
exports.PLACEHOLDERS = PLACEHOLDERS;
|
||||
const PLACEHOLDERS_ALIAS = {
|
||||
Declaration: ["Statement"],
|
||||
Pattern: ["PatternLike", "LVal"]
|
||||
};
|
||||
exports.PLACEHOLDERS_ALIAS = PLACEHOLDERS_ALIAS;
|
||||
|
||||
for (const type of PLACEHOLDERS) {
|
||||
const alias = _utils.ALIAS_KEYS[type];
|
||||
if (alias == null ? void 0 : alias.length) PLACEHOLDERS_ALIAS[type] = alias;
|
||||
}
|
||||
|
||||
const PLACEHOLDERS_FLIPPED_ALIAS = {};
|
||||
exports.PLACEHOLDERS_FLIPPED_ALIAS = PLACEHOLDERS_FLIPPED_ALIAS;
|
||||
Object.keys(PLACEHOLDERS_ALIAS).forEach(type => {
|
||||
PLACEHOLDERS_ALIAS[type].forEach(alias => {
|
||||
if (!Object.hasOwnProperty.call(PLACEHOLDERS_FLIPPED_ALIAS, alias)) {
|
||||
PLACEHOLDERS_FLIPPED_ALIAS[alias] = [];
|
||||
}
|
||||
|
||||
PLACEHOLDERS_FLIPPED_ALIAS[alias].push(type);
|
||||
});
|
||||
});
|
||||
428
node_modules/@babel/types/lib/definitions/typescript.js
generated
vendored
Normal file
428
node_modules/@babel/types/lib/definitions/typescript.js
generated
vendored
Normal file
@@ -0,0 +1,428 @@
|
||||
"use strict";
|
||||
|
||||
var _utils = _interopRequireWildcard(require("./utils"));
|
||||
|
||||
var _core = require("./core");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
const bool = (0, _utils.assertValueType)("boolean");
|
||||
const tSFunctionTypeAnnotationCommon = {
|
||||
returnType: {
|
||||
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"),
|
||||
optional: true
|
||||
},
|
||||
typeParameters: {
|
||||
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"),
|
||||
optional: true
|
||||
}
|
||||
};
|
||||
(0, _utils.default)("TSParameterProperty", {
|
||||
aliases: ["LVal"],
|
||||
visitor: ["parameter"],
|
||||
fields: {
|
||||
accessibility: {
|
||||
validate: (0, _utils.assertOneOf)("public", "private", "protected"),
|
||||
optional: true
|
||||
},
|
||||
readonly: {
|
||||
validate: (0, _utils.assertValueType)("boolean"),
|
||||
optional: true
|
||||
},
|
||||
parameter: {
|
||||
validate: (0, _utils.assertNodeType)("Identifier", "AssignmentPattern")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSDeclareFunction", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "typeParameters", "params", "returnType"],
|
||||
fields: Object.assign({}, _core.functionDeclarationCommon, tSFunctionTypeAnnotationCommon)
|
||||
});
|
||||
(0, _utils.default)("TSDeclareMethod", {
|
||||
visitor: ["decorators", "key", "typeParameters", "params", "returnType"],
|
||||
fields: Object.assign({}, _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")
|
||||
})
|
||||
});
|
||||
(0, _utils.default)("TSMethodSignature", {
|
||||
aliases: ["TSTypeElement"],
|
||||
visitor: ["key", "typeParameters", "parameters", "typeAnnotation"],
|
||||
fields: Object.assign({}, signatureDeclarationCommon, namedTypeElementCommon)
|
||||
});
|
||||
(0, _utils.default)("TSIndexSignature", {
|
||||
aliases: ["TSTypeElement"],
|
||||
visitor: ["parameters", "typeAnnotation"],
|
||||
fields: {
|
||||
readonly: (0, _utils.validateOptional)(bool),
|
||||
parameters: (0, _utils.validateArrayOfType)("Identifier"),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation")
|
||||
}
|
||||
});
|
||||
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "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 fnOrCtr = {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeParameters", "parameters", "typeAnnotation"],
|
||||
fields: signatureDeclarationCommon
|
||||
};
|
||||
(0, _utils.default)("TSFunctionType", fnOrCtr);
|
||||
(0, _utils.default)("TSConstructorType", fnOrCtr);
|
||||
(0, _utils.default)("TSTypeReference", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["typeName", "typeParameters"],
|
||||
fields: {
|
||||
typeName: (0, _utils.validateType)("TSEntityName"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypePredicate", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["parameterName", "typeAnnotation"],
|
||||
builder: ["parameterName", "typeAnnotation", "asserts"],
|
||||
fields: {
|
||||
parameterName: (0, _utils.validateType)(["Identifier", "TSThisType"]),
|
||||
typeAnnotation: (0, _utils.validateOptionalType)("TSTypeAnnotation"),
|
||||
asserts: (0, _utils.validateOptional)(bool)
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeQuery", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["exprName"],
|
||||
fields: {
|
||||
exprName: (0, _utils.validateType)(["TSEntityName", "TSImportType"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeLiteral", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["members"],
|
||||
fields: {
|
||||
members: (0, _utils.validateArrayOfType)("TSTypeElement")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSArrayType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["elementType"],
|
||||
fields: {
|
||||
elementType: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTupleType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["elementTypes"],
|
||||
fields: {
|
||||
elementTypes: (0, _utils.validateArrayOfType)(["TSType", "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: (0, _utils.validateType)(["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSExpressionWithTypeArguments", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["expression", "typeParameters"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("TSEntityName"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSInterfaceDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "typeParameters", "extends", "body"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
|
||||
extends: (0, _utils.validateOptional)((0, _utils.arrayOfType)("TSExpressionWithTypeArguments")),
|
||||
body: (0, _utils.validateType)("TSInterfaceBody")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSInterfaceBody", {
|
||||
visitor: ["body"],
|
||||
fields: {
|
||||
body: (0, _utils.validateArrayOfType)("TSTypeElement")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeAliasDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "typeParameters", "typeAnnotation"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"),
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSAsExpression", {
|
||||
aliases: ["Expression"],
|
||||
visitor: ["expression", "typeAnnotation"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression"),
|
||||
typeAnnotation: (0, _utils.validateType)("TSType")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeAssertion", {
|
||||
aliases: ["Expression"],
|
||||
visitor: ["typeAnnotation", "expression"],
|
||||
fields: {
|
||||
typeAnnotation: (0, _utils.validateType)("TSType"),
|
||||
expression: (0, _utils.validateType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSEnumDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "members"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
const: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
members: (0, _utils.validateArrayOfType)("TSEnumMember"),
|
||||
initializer: (0, _utils.validateOptionalType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSEnumMember", {
|
||||
visitor: ["id", "initializer"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
initializer: (0, _utils.validateOptionalType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSModuleDeclaration", {
|
||||
aliases: ["Statement", "Declaration"],
|
||||
visitor: ["id", "body"],
|
||||
fields: {
|
||||
declare: (0, _utils.validateOptional)(bool),
|
||||
global: (0, _utils.validateOptional)(bool),
|
||||
id: (0, _utils.validateType)(["Identifier", "StringLiteral"]),
|
||||
body: (0, _utils.validateType)(["TSModuleBlock", "TSModuleDeclaration"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSModuleBlock", {
|
||||
aliases: ["Scopable", "Block", "BlockParent"],
|
||||
visitor: ["body"],
|
||||
fields: {
|
||||
body: (0, _utils.validateArrayOfType)("Statement")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSImportType", {
|
||||
aliases: ["TSType"],
|
||||
visitor: ["argument", "qualifier", "typeParameters"],
|
||||
fields: {
|
||||
argument: (0, _utils.validateType)("StringLiteral"),
|
||||
qualifier: (0, _utils.validateOptionalType)("TSEntityName"),
|
||||
typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterInstantiation")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSImportEqualsDeclaration", {
|
||||
aliases: ["Statement"],
|
||||
visitor: ["id", "moduleReference"],
|
||||
fields: {
|
||||
isExport: (0, _utils.validate)(bool),
|
||||
id: (0, _utils.validateType)("Identifier"),
|
||||
moduleReference: (0, _utils.validateType)(["TSEntityName", "TSExternalModuleReference"])
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSExternalModuleReference", {
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("StringLiteral")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSNonNullExpression", {
|
||||
aliases: ["Expression"],
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSExportAssignment", {
|
||||
aliases: ["Statement"],
|
||||
visitor: ["expression"],
|
||||
fields: {
|
||||
expression: (0, _utils.validateType)("Expression")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSNamespaceExportDeclaration", {
|
||||
aliases: ["Statement"],
|
||||
visitor: ["id"],
|
||||
fields: {
|
||||
id: (0, _utils.validateType)("Identifier")
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeAnnotation", {
|
||||
visitor: ["typeAnnotation"],
|
||||
fields: {
|
||||
typeAnnotation: {
|
||||
validate: (0, _utils.assertNodeType)("TSType")
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeParameterInstantiation", {
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSType")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeParameterDeclaration", {
|
||||
visitor: ["params"],
|
||||
fields: {
|
||||
params: {
|
||||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TSTypeParameter")))
|
||||
}
|
||||
}
|
||||
});
|
||||
(0, _utils.default)("TSTypeParameter", {
|
||||
builder: ["constraint", "default", "name"],
|
||||
visitor: ["constraint", "default"],
|
||||
fields: {
|
||||
name: {
|
||||
validate: (0, _utils.assertValueType)("string")
|
||||
},
|
||||
constraint: {
|
||||
validate: (0, _utils.assertNodeType)("TSType"),
|
||||
optional: true
|
||||
},
|
||||
default: {
|
||||
validate: (0, _utils.assertNodeType)("TSType"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
315
node_modules/@babel/types/lib/definitions/utils.js
generated
vendored
Normal file
315
node_modules/@babel/types/lib/definitions/utils.js
generated
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.validate = validate;
|
||||
exports.typeIs = typeIs;
|
||||
exports.validateType = validateType;
|
||||
exports.validateOptional = validateOptional;
|
||||
exports.validateOptionalType = validateOptionalType;
|
||||
exports.arrayOf = arrayOf;
|
||||
exports.arrayOfType = arrayOfType;
|
||||
exports.validateArrayOfType = validateArrayOfType;
|
||||
exports.assertEach = assertEach;
|
||||
exports.assertOneOf = assertOneOf;
|
||||
exports.assertNodeType = assertNodeType;
|
||||
exports.assertNodeOrValueType = assertNodeOrValueType;
|
||||
exports.assertValueType = assertValueType;
|
||||
exports.assertShape = assertShape;
|
||||
exports.assertOptionalChainStart = assertOptionalChainStart;
|
||||
exports.chain = chain;
|
||||
exports.default = defineType;
|
||||
exports.NODE_PARENT_VALIDATIONS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = void 0;
|
||||
|
||||
var _is = _interopRequireDefault(require("../validators/is"));
|
||||
|
||||
var _validate = require("../validators/validate");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const VISITOR_KEYS = {};
|
||||
exports.VISITOR_KEYS = VISITOR_KEYS;
|
||||
const ALIAS_KEYS = {};
|
||||
exports.ALIAS_KEYS = ALIAS_KEYS;
|
||||
const FLIPPED_ALIAS_KEYS = {};
|
||||
exports.FLIPPED_ALIAS_KEYS = FLIPPED_ALIAS_KEYS;
|
||||
const NODE_FIELDS = {};
|
||||
exports.NODE_FIELDS = NODE_FIELDS;
|
||||
const BUILDER_KEYS = {};
|
||||
exports.BUILDER_KEYS = BUILDER_KEYS;
|
||||
const DEPRECATED_KEYS = {};
|
||||
exports.DEPRECATED_KEYS = DEPRECATED_KEYS;
|
||||
const NODE_PARENT_VALIDATIONS = {};
|
||||
exports.NODE_PARENT_VALIDATIONS = NODE_PARENT_VALIDATIONS;
|
||||
|
||||
function getType(val) {
|
||||
if (Array.isArray(val)) {
|
||||
return "array";
|
||||
} else if (val === null) {
|
||||
return "null";
|
||||
} else {
|
||||
return typeof val;
|
||||
}
|
||||
}
|
||||
|
||||
function validate(validate) {
|
||||
return {
|
||||
validate
|
||||
};
|
||||
}
|
||||
|
||||
function typeIs(typeName) {
|
||||
return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName);
|
||||
}
|
||||
|
||||
function validateType(typeName) {
|
||||
return validate(typeIs(typeName));
|
||||
}
|
||||
|
||||
function validateOptional(validate) {
|
||||
return {
|
||||
validate,
|
||||
optional: true
|
||||
};
|
||||
}
|
||||
|
||||
function validateOptionalType(typeName) {
|
||||
return {
|
||||
validate: typeIs(typeName),
|
||||
optional: true
|
||||
};
|
||||
}
|
||||
|
||||
function arrayOf(elementType) {
|
||||
return chain(assertValueType("array"), assertEach(elementType));
|
||||
}
|
||||
|
||||
function arrayOfType(typeName) {
|
||||
return arrayOf(typeIs(typeName));
|
||||
}
|
||||
|
||||
function validateArrayOfType(typeName) {
|
||||
return validate(arrayOfType(typeName));
|
||||
}
|
||||
|
||||
function assertEach(callback) {
|
||||
function validator(node, key, val) {
|
||||
if (!Array.isArray(val)) return;
|
||||
|
||||
for (let i = 0; i < val.length; i++) {
|
||||
const subkey = `${key}[${i}]`;
|
||||
const v = val[i];
|
||||
callback(node, subkey, v);
|
||||
if (process.env.BABEL_TYPES_8_BREAKING) (0, _validate.validateChild)(node, subkey, v);
|
||||
}
|
||||
}
|
||||
|
||||
validator.each = callback;
|
||||
return validator;
|
||||
}
|
||||
|
||||
function assertOneOf(...values) {
|
||||
function validate(node, key, val) {
|
||||
if (values.indexOf(val) < 0) {
|
||||
throw new TypeError(`Property ${key} expected value to be one of ${JSON.stringify(values)} but got ${JSON.stringify(val)}`);
|
||||
}
|
||||
}
|
||||
|
||||
validate.oneOf = values;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertNodeType(...types) {
|
||||
function validate(node, key, val) {
|
||||
for (const type of types) {
|
||||
if ((0, _is.default)(type, val)) {
|
||||
(0, _validate.validateChild)(node, key, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`);
|
||||
}
|
||||
|
||||
validate.oneOfNodeTypes = types;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertNodeOrValueType(...types) {
|
||||
function validate(node, key, val) {
|
||||
for (const type of types) {
|
||||
if (getType(val) === type || (0, _is.default)(type, val)) {
|
||||
(0, _validate.validateChild)(node, key, val);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`);
|
||||
}
|
||||
|
||||
validate.oneOfNodeOrValueTypes = types;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertValueType(type) {
|
||||
function validate(node, key, val) {
|
||||
const valid = getType(val) === type;
|
||||
|
||||
if (!valid) {
|
||||
throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`);
|
||||
}
|
||||
}
|
||||
|
||||
validate.type = type;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertShape(shape) {
|
||||
function validate(node, key, val) {
|
||||
const errors = [];
|
||||
|
||||
for (const property of Object.keys(shape)) {
|
||||
try {
|
||||
(0, _validate.validateField)(node, property, val[property], shape[property]);
|
||||
} catch (error) {
|
||||
if (error instanceof TypeError) {
|
||||
errors.push(error.message);
|
||||
continue;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
throw new TypeError(`Property ${key} of ${node.type} expected to have the following:\n${errors.join("\n")}`);
|
||||
}
|
||||
}
|
||||
|
||||
validate.shapeOf = shape;
|
||||
return validate;
|
||||
}
|
||||
|
||||
function assertOptionalChainStart() {
|
||||
function validate(node) {
|
||||
var _current;
|
||||
|
||||
let current = node;
|
||||
|
||||
while (node) {
|
||||
const {
|
||||
type
|
||||
} = current;
|
||||
|
||||
if (type === "OptionalCallExpression") {
|
||||
if (current.optional) return;
|
||||
current = current.callee;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type === "OptionalMemberExpression") {
|
||||
if (current.optional) return;
|
||||
current = current.object;
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${(_current = current) == null ? void 0 : _current.type}`);
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
function chain(...fns) {
|
||||
function validate(...args) {
|
||||
for (const fn of fns) {
|
||||
fn(...args);
|
||||
}
|
||||
}
|
||||
|
||||
validate.chainOf = fns;
|
||||
return validate;
|
||||
}
|
||||
|
||||
const validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"];
|
||||
const validFieldKeys = ["default", "optional", "validate"];
|
||||
|
||||
function defineType(type, opts = {}) {
|
||||
const inherits = opts.inherits && store[opts.inherits] || {};
|
||||
let fields = opts.fields;
|
||||
|
||||
if (!fields) {
|
||||
fields = {};
|
||||
|
||||
if (inherits.fields) {
|
||||
const keys = Object.getOwnPropertyNames(inherits.fields);
|
||||
|
||||
for (const key of keys) {
|
||||
const field = inherits.fields[key];
|
||||
fields[key] = {
|
||||
default: field.default,
|
||||
optional: field.optional,
|
||||
validate: field.validate
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const visitor = opts.visitor || inherits.visitor || [];
|
||||
const aliases = opts.aliases || inherits.aliases || [];
|
||||
const builder = opts.builder || inherits.builder || opts.visitor || [];
|
||||
|
||||
for (const k of Object.keys(opts)) {
|
||||
if (validTypeOpts.indexOf(k) === -1) {
|
||||
throw new Error(`Unknown type option "${k}" on ${type}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.deprecatedAlias) {
|
||||
DEPRECATED_KEYS[opts.deprecatedAlias] = type;
|
||||
}
|
||||
|
||||
for (const key of visitor.concat(builder)) {
|
||||
fields[key] = fields[key] || {};
|
||||
}
|
||||
|
||||
for (const key of Object.keys(fields)) {
|
||||
const field = fields[key];
|
||||
|
||||
if (field.default !== undefined && builder.indexOf(key) === -1) {
|
||||
field.optional = true;
|
||||
}
|
||||
|
||||
if (field.default === undefined) {
|
||||
field.default = null;
|
||||
} else if (!field.validate && field.default != null) {
|
||||
field.validate = assertValueType(getType(field.default));
|
||||
}
|
||||
|
||||
for (const k of Object.keys(field)) {
|
||||
if (validFieldKeys.indexOf(k) === -1) {
|
||||
throw new Error(`Unknown field key "${k}" on ${type}.${key}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VISITOR_KEYS[type] = opts.visitor = visitor;
|
||||
BUILDER_KEYS[type] = opts.builder = builder;
|
||||
NODE_FIELDS[type] = opts.fields = fields;
|
||||
ALIAS_KEYS[type] = opts.aliases = aliases;
|
||||
aliases.forEach(alias => {
|
||||
FLIPPED_ALIAS_KEYS[alias] = FLIPPED_ALIAS_KEYS[alias] || [];
|
||||
FLIPPED_ALIAS_KEYS[alias].push(type);
|
||||
});
|
||||
|
||||
if (opts.validate) {
|
||||
NODE_PARENT_VALIDATIONS[type] = opts.validate;
|
||||
}
|
||||
|
||||
store[type] = opts;
|
||||
}
|
||||
|
||||
const store = {};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user