feat(planning): grille hebdomadaire complète avec API et filtres
- Connexion API via proxy Angular (résolution CORS, base path /api) - Import CSS ng-zorro global pour les modales et composants - Filtres Camion/Show câblés sur l'affichage de la grille - Camions affichés via TrucksService (linkés au show du même créneau) - Panneau de détails : spectacles + camions du jour sélectionné - Modale de création de spectacle stylisée avec fond et centrage - Positionnement précis des events à la minute dans leur créneau - Auto-scroll vers l'heure courante au chargement - Ligne "maintenant" sur la colonne du jour actuel - Régénération des services OpenAPI (nouveaux noms de types) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+36
-37
@@ -38,39 +38,39 @@ const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
let tokenize;
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const getTokenType = function (token, offset, text) {
|
||||
if (token.type === "name") {
|
||||
const tokenValue = token.value;
|
||||
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
|
||||
return "keyword";
|
||||
{
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const getTokenType = function (token, offset, text) {
|
||||
if (token.type === "name") {
|
||||
if (helperValidatorIdentifier.isKeyword(token.value) || helperValidatorIdentifier.isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
||||
return "jsxIdentifier";
|
||||
}
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
||||
return "jsxIdentifier";
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
|
||||
if (firstChar !== firstChar.toLowerCase()) {
|
||||
return "capitalized";
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
}
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
return token.type;
|
||||
};
|
||||
tokenize = function* (text) {
|
||||
let match;
|
||||
while (match = jsTokens.default.exec(text)) {
|
||||
const token = jsTokens.matchToToken(match);
|
||||
yield {
|
||||
type: getTokenType(token, match.index, text),
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
};
|
||||
return token.type;
|
||||
};
|
||||
tokenize = function* (text) {
|
||||
let match;
|
||||
while (match = jsTokens.default.exec(text)) {
|
||||
const token = jsTokens.matchToToken(match);
|
||||
yield {
|
||||
type: getTokenType(token, match.index, text),
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function highlight(text) {
|
||||
if (text === "") return "";
|
||||
const defs = getDefs(true);
|
||||
@@ -90,7 +90,7 @@ function highlight(text) {
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
function getMarkerLines(loc, source, opts, startLineBaseZero) {
|
||||
function getMarkerLines(loc, source, opts) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
@@ -100,9 +100,9 @@ function getMarkerLines(loc, source, opts, startLineBaseZero) {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line - startLineBaseZero;
|
||||
const startLine = startLoc.line;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line - startLineBaseZero;
|
||||
const endLine = endLoc.line;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
@@ -148,20 +148,19 @@ function getMarkerLines(loc, source, opts, startLineBaseZero) {
|
||||
}
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
||||
const startLineBaseZero = (opts.startLine || 1) - 1;
|
||||
const defs = getDefs(shouldHighlight);
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts, startLineBaseZero);
|
||||
} = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end + startLineBaseZero).length;
|
||||
const numberMaxWidth = String(end).length;
|
||||
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
|
||||
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.29.7",
|
||||
"version": "7.27.1",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
@@ -16,12 +16,11 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.29.7",
|
||||
"@babel/helper-validator-identifier": "^7.27.1",
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"charcodes": "^0.2.0",
|
||||
"import-meta-resolve": "^4.1.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
|
||||
+1
-15
@@ -54,7 +54,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -220,7 +219,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -282,7 +280,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -1078,7 +1075,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "7",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "43",
|
||||
"electron": "1.7"
|
||||
},
|
||||
@@ -1220,6 +1216,7 @@
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"rhino": "1.7.15",
|
||||
"opera_mobile": "46",
|
||||
"electron": "3.0"
|
||||
},
|
||||
@@ -1455,7 +1452,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
@@ -1469,7 +1465,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
@@ -1973,7 +1968,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -1987,7 +1981,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2001,7 +1994,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2015,7 +2007,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2029,7 +2020,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2043,7 +2033,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2057,7 +2046,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2071,7 +2059,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -2085,7 +2072,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
|
||||
-3
@@ -13,9 +13,6 @@
|
||||
"bugfix/transform-safari-block-shadowing",
|
||||
"bugfix/transform-safari-for-shadowing"
|
||||
],
|
||||
"transform-destructuring": [
|
||||
"bugfix/transform-safari-rest-destructuring-rhs-array"
|
||||
],
|
||||
"transform-template-literals": [
|
||||
"bugfix/transform-tagged-template-caching"
|
||||
],
|
||||
|
||||
-28
@@ -35,7 +35,6 @@
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
@@ -81,19 +80,6 @@
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-rest-destructuring-rhs-array": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "34",
|
||||
"safari": "14.1",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "14.5",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-tagged-template-caching": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
@@ -185,7 +171,6 @@
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
@@ -202,19 +187,6 @@
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-destructuring": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
|
||||
+6
-11
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"transform-explicit-resource-management": {
|
||||
"chrome": "141",
|
||||
"edge": "141",
|
||||
"chrome": "134",
|
||||
"edge": "134",
|
||||
"firefox": "141",
|
||||
"node": "25",
|
||||
"electron": "39.0"
|
||||
"node": "24",
|
||||
"electron": "35.0"
|
||||
},
|
||||
"transform-duplicate-named-capturing-groups-regex": {
|
||||
"chrome": "126",
|
||||
@@ -14,7 +14,6 @@
|
||||
"safari": "17.4",
|
||||
"node": "23",
|
||||
"ios": "17.4",
|
||||
"rhino": "1.9",
|
||||
"electron": "31.0"
|
||||
},
|
||||
"transform-regexp-modifiers": {
|
||||
@@ -433,7 +432,6 @@
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
@@ -447,7 +445,6 @@
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
@@ -461,7 +458,6 @@
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
@@ -502,7 +498,6 @@
|
||||
"deno": "1",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
@@ -700,10 +695,10 @@
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "14.1",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "14.5",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/compat-data",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.5",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"description": "The compat-data to determine required Babel plugins",
|
||||
@@ -30,8 +30,8 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^6.0.8",
|
||||
"core-js-compat": "^3.48.0",
|
||||
"electron-to-chromium": "^1.5.278"
|
||||
"core-js-compat": "^3.43.0",
|
||||
"electron-to-chromium": "^1.5.140"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
+1
-16
@@ -1,16 +1 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||
fi
|
||||
../semver/bin/semver.js
|
||||
+157
-87
@@ -4,10 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
const spaceIndents = [];
|
||||
for (let i = 0; i < 32; i++) {
|
||||
spaceIndents.push(" ".repeat(i * 2));
|
||||
}
|
||||
class Buffer {
|
||||
constructor(map, indentChar) {
|
||||
this._map = null;
|
||||
@@ -15,9 +11,11 @@ class Buffer {
|
||||
this._str = "";
|
||||
this._appendCount = 0;
|
||||
this._last = 0;
|
||||
this._queue = [];
|
||||
this._queueCursor = 0;
|
||||
this._canMarkIdName = true;
|
||||
this._indentChar = "";
|
||||
this._queuedChar = 0;
|
||||
this._fastIndentations = [];
|
||||
this._position = {
|
||||
line: 1,
|
||||
column: 0
|
||||
@@ -31,32 +29,55 @@ class Buffer {
|
||||
};
|
||||
this._map = map;
|
||||
this._indentChar = indentChar;
|
||||
for (let i = 0; i < 64; i++) {
|
||||
this._fastIndentations.push(indentChar.repeat(i));
|
||||
}
|
||||
this._allocQueue();
|
||||
}
|
||||
_allocQueue() {
|
||||
const queue = this._queue;
|
||||
for (let i = 0; i < 16; i++) {
|
||||
queue.push({
|
||||
char: 0,
|
||||
repeat: 1,
|
||||
line: undefined,
|
||||
column: undefined,
|
||||
identifierName: undefined,
|
||||
identifierNamePos: undefined,
|
||||
filename: ""
|
||||
});
|
||||
}
|
||||
}
|
||||
_pushQueue(char, repeat, line, column, filename) {
|
||||
const cursor = this._queueCursor;
|
||||
if (cursor === this._queue.length) {
|
||||
this._allocQueue();
|
||||
}
|
||||
const item = this._queue[cursor];
|
||||
item.char = char;
|
||||
item.repeat = repeat;
|
||||
item.line = line;
|
||||
item.column = column;
|
||||
item.filename = filename;
|
||||
this._queueCursor++;
|
||||
}
|
||||
_popQueue() {
|
||||
if (this._queueCursor === 0) {
|
||||
throw new Error("Cannot pop from empty queue");
|
||||
}
|
||||
return this._queue[--this._queueCursor];
|
||||
}
|
||||
get() {
|
||||
const {
|
||||
_map,
|
||||
_last
|
||||
} = this;
|
||||
if (this._queuedChar !== 32) {
|
||||
this._flush();
|
||||
}
|
||||
const code = _last === 10 ? (this._buf + this._str).trimRight() : this._buf + this._str;
|
||||
if (_map === null) {
|
||||
return {
|
||||
code: code,
|
||||
decodedMap: undefined,
|
||||
map: null,
|
||||
rawMappings: undefined
|
||||
};
|
||||
}
|
||||
this._flush();
|
||||
const map = this._map;
|
||||
const result = {
|
||||
code: code,
|
||||
decodedMap: _map.getDecoded(),
|
||||
code: (this._buf + this._str).trimRight(),
|
||||
decodedMap: map == null ? void 0 : map.getDecoded(),
|
||||
get __mergedMap() {
|
||||
return this.map;
|
||||
},
|
||||
get map() {
|
||||
const resultMap = _map.get();
|
||||
const resultMap = map ? map.get() : null;
|
||||
result.map = resultMap;
|
||||
return resultMap;
|
||||
},
|
||||
@@ -67,7 +88,7 @@ class Buffer {
|
||||
});
|
||||
},
|
||||
get rawMappings() {
|
||||
const mappings = _map.getRawMappings();
|
||||
const mappings = map == null ? void 0 : map.getRawMappings();
|
||||
result.rawMappings = mappings;
|
||||
return mappings;
|
||||
},
|
||||
@@ -80,59 +101,68 @@ class Buffer {
|
||||
};
|
||||
return result;
|
||||
}
|
||||
append(str, maybeNewline, ignoreMapping = false) {
|
||||
append(str, maybeNewline) {
|
||||
this._flush();
|
||||
this._append(str, maybeNewline, ignoreMapping);
|
||||
this._append(str, this._sourcePosition, maybeNewline);
|
||||
}
|
||||
appendChar(char) {
|
||||
this._flush();
|
||||
this._appendChar(char, 1, true);
|
||||
this._appendChar(char, 1, this._sourcePosition);
|
||||
}
|
||||
queue(char) {
|
||||
this._flush();
|
||||
this._queuedChar = char;
|
||||
if (char === 10) {
|
||||
while (this._queueCursor !== 0) {
|
||||
const char = this._queue[this._queueCursor - 1].char;
|
||||
if (char !== 32 && char !== 9) {
|
||||
break;
|
||||
}
|
||||
this._queueCursor--;
|
||||
}
|
||||
}
|
||||
const sourcePosition = this._sourcePosition;
|
||||
this._pushQueue(char, 1, sourcePosition.line, sourcePosition.column, sourcePosition.filename);
|
||||
}
|
||||
queueIndentation(repeat) {
|
||||
if (repeat === 0) return;
|
||||
this._pushQueue(-1, repeat, undefined, undefined, undefined);
|
||||
}
|
||||
_flush() {
|
||||
const queuedChar = this._queuedChar;
|
||||
if (queuedChar !== 0) {
|
||||
this._appendChar(queuedChar, 1, true);
|
||||
this._queuedChar = 0;
|
||||
const queueCursor = this._queueCursor;
|
||||
const queue = this._queue;
|
||||
for (let i = 0; i < queueCursor; i++) {
|
||||
const item = queue[i];
|
||||
this._appendChar(item.char, item.repeat, item);
|
||||
}
|
||||
this._queueCursor = 0;
|
||||
}
|
||||
_appendChar(char, repeat, useSourcePos) {
|
||||
_appendChar(char, repeat, sourcePos) {
|
||||
this._last = char;
|
||||
if (char === -1) {
|
||||
const indent = repeat >= 64 ? this._indentChar.repeat(repeat) : spaceIndents[repeat / 2];
|
||||
this._str += indent;
|
||||
const fastIndentation = this._fastIndentations[repeat];
|
||||
if (fastIndentation !== undefined) {
|
||||
this._str += fastIndentation;
|
||||
} else {
|
||||
this._str += repeat > 1 ? this._indentChar.repeat(repeat) : this._indentChar;
|
||||
}
|
||||
} else {
|
||||
this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char);
|
||||
}
|
||||
const isSpace = char === 32;
|
||||
const position = this._position;
|
||||
if (char !== 10) {
|
||||
if (this._map) {
|
||||
const sourcePos = this._sourcePosition;
|
||||
if (useSourcePos && sourcePos) {
|
||||
this._map.mark(position, sourcePos.line, sourcePos.column, isSpace ? undefined : sourcePos.identifierName, isSpace ? undefined : sourcePos.identifierNamePos, sourcePos.filename);
|
||||
if (!isSpace && this._canMarkIdName) {
|
||||
sourcePos.identifierName = undefined;
|
||||
sourcePos.identifierNamePos = undefined;
|
||||
}
|
||||
} else {
|
||||
this._map.mark(position);
|
||||
}
|
||||
}
|
||||
position.column += repeat;
|
||||
this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.identifierNamePos, sourcePos.filename);
|
||||
this._position.column += repeat;
|
||||
} else {
|
||||
position.line++;
|
||||
position.column = 0;
|
||||
this._position.line++;
|
||||
this._position.column = 0;
|
||||
}
|
||||
if (this._canMarkIdName) {
|
||||
sourcePos.identifierName = undefined;
|
||||
sourcePos.identifierNamePos = undefined;
|
||||
}
|
||||
}
|
||||
_append(str, maybeNewline, ignoreMapping) {
|
||||
_append(str, sourcePos, maybeNewline) {
|
||||
const len = str.length;
|
||||
const position = this._position;
|
||||
const sourcePos = this._sourcePosition;
|
||||
this._last = -1;
|
||||
this._last = str.charCodeAt(len - 1);
|
||||
if (++this._appendCount > 4096) {
|
||||
+this._str;
|
||||
this._buf += this._str;
|
||||
@@ -141,8 +171,7 @@ class Buffer {
|
||||
} else {
|
||||
this._str += str;
|
||||
}
|
||||
const hasMap = !ignoreMapping && this._map !== null;
|
||||
if (!maybeNewline && !hasMap) {
|
||||
if (!maybeNewline && !this._map) {
|
||||
position.column += len;
|
||||
return;
|
||||
}
|
||||
@@ -159,40 +188,67 @@ class Buffer {
|
||||
}
|
||||
let i = str.indexOf("\n");
|
||||
let last = 0;
|
||||
if (hasMap && i !== 0) {
|
||||
this._map.mark(position, line, column, identifierName, identifierNamePos, filename);
|
||||
if (i !== 0) {
|
||||
this._mark(line, column, identifierName, identifierNamePos, filename);
|
||||
}
|
||||
while (i !== -1) {
|
||||
position.line++;
|
||||
position.column = 0;
|
||||
last = i + 1;
|
||||
if (last < len && line !== undefined) {
|
||||
line++;
|
||||
if (hasMap) {
|
||||
this._map.mark(position, line, 0, undefined, undefined, filename);
|
||||
}
|
||||
this._mark(++line, 0, undefined, undefined, filename);
|
||||
}
|
||||
i = str.indexOf("\n", last);
|
||||
}
|
||||
position.column += len - last;
|
||||
}
|
||||
removeLastSemicolon() {
|
||||
if (this._queuedChar === 59) {
|
||||
this._queuedChar = 0;
|
||||
_mark(line, column, identifierName, identifierNamePos, filename) {
|
||||
var _this$_map;
|
||||
(_this$_map = this._map) == null || _this$_map.mark(this._position, line, column, identifierName, identifierNamePos, filename);
|
||||
}
|
||||
removeTrailingNewline() {
|
||||
const queueCursor = this._queueCursor;
|
||||
if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 10) {
|
||||
this._queueCursor--;
|
||||
}
|
||||
}
|
||||
getLastChar(checkQueue) {
|
||||
if (!checkQueue) {
|
||||
return this._last;
|
||||
removeLastSemicolon() {
|
||||
const queueCursor = this._queueCursor;
|
||||
if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) {
|
||||
this._queueCursor--;
|
||||
}
|
||||
const queuedChar = this._queuedChar;
|
||||
return queuedChar !== 0 ? queuedChar : this._last;
|
||||
}
|
||||
getLastChar() {
|
||||
const queueCursor = this._queueCursor;
|
||||
return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last;
|
||||
}
|
||||
getNewlineCount() {
|
||||
return this._queuedChar === 0 && this._last === 10 ? 1 : 0;
|
||||
const queueCursor = this._queueCursor;
|
||||
let count = 0;
|
||||
if (queueCursor === 0) return this._last === 10 ? 1 : 0;
|
||||
for (let i = queueCursor - 1; i >= 0; i--) {
|
||||
if (this._queue[i].char !== 10) {
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return count === queueCursor && this._last === 10 ? count + 1 : count;
|
||||
}
|
||||
endsWithCharAndNewline() {
|
||||
const queue = this._queue;
|
||||
const queueCursor = this._queueCursor;
|
||||
if (queueCursor !== 0) {
|
||||
const lastCp = queue[queueCursor - 1].char;
|
||||
if (lastCp !== 10) return;
|
||||
if (queueCursor > 1) {
|
||||
return queue[queueCursor - 2].char;
|
||||
} else {
|
||||
return this._last;
|
||||
}
|
||||
}
|
||||
}
|
||||
hasContent() {
|
||||
return this._last !== 0;
|
||||
return this._queueCursor !== 0 || !!this._last;
|
||||
}
|
||||
exactSource(loc, cb) {
|
||||
if (!this._map) {
|
||||
@@ -202,12 +258,12 @@ class Buffer {
|
||||
this.source("start", loc);
|
||||
const identifierName = loc.identifierName;
|
||||
const sourcePos = this._sourcePosition;
|
||||
if (identifierName != null) {
|
||||
if (identifierName) {
|
||||
this._canMarkIdName = false;
|
||||
sourcePos.identifierName = identifierName;
|
||||
}
|
||||
cb();
|
||||
if (identifierName != null) {
|
||||
if (identifierName) {
|
||||
this._canMarkIdName = true;
|
||||
sourcePos.identifierName = undefined;
|
||||
sourcePos.identifierNamePos = undefined;
|
||||
@@ -223,23 +279,37 @@ class Buffer {
|
||||
this._normalizePosition(prop, loc, columnOffset);
|
||||
}
|
||||
_normalizePosition(prop, loc, columnOffset) {
|
||||
this._flush();
|
||||
const pos = loc[prop];
|
||||
const target = this._sourcePosition;
|
||||
if (pos) {
|
||||
this.setSourcePosition(pos.line, Math.max(pos.column + columnOffset, 0));
|
||||
this._sourcePosition.filename = loc.filename;
|
||||
target.line = pos.line;
|
||||
target.column = Math.max(pos.column + columnOffset, 0);
|
||||
target.filename = loc.filename;
|
||||
}
|
||||
}
|
||||
setSourcePosition(line, column) {
|
||||
const target = this._sourcePosition;
|
||||
target.line = line;
|
||||
target.column = column;
|
||||
}
|
||||
getCurrentColumn() {
|
||||
return this._position.column + (this._queuedChar ? 1 : 0);
|
||||
const queue = this._queue;
|
||||
const queueCursor = this._queueCursor;
|
||||
let lastIndex = -1;
|
||||
let len = 0;
|
||||
for (let i = 0; i < queueCursor; i++) {
|
||||
const item = queue[i];
|
||||
if (item.char === 10) {
|
||||
lastIndex = len;
|
||||
}
|
||||
len += item.repeat;
|
||||
}
|
||||
return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex;
|
||||
}
|
||||
getCurrentLine() {
|
||||
return this._position.line;
|
||||
let count = 0;
|
||||
const queue = this._queue;
|
||||
for (let i = 0; i < this._queueCursor; i++) {
|
||||
if (queue[i].char === 10) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return this._position.line + count;
|
||||
}
|
||||
}
|
||||
exports.default = Buffer;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+8
-7
@@ -18,12 +18,13 @@ function File(node) {
|
||||
}
|
||||
function Program(node) {
|
||||
var _node$directives;
|
||||
this.printInnerComments(false);
|
||||
this.noIndentInnerCommentsHere();
|
||||
this.printInnerComments();
|
||||
const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
|
||||
if (directivesLen) {
|
||||
var _node$directives$trai;
|
||||
const newline = node.body.length ? 2 : 1;
|
||||
this.printSequence(node.directives, undefined, undefined, newline);
|
||||
this.printSequence(node.directives, undefined, newline);
|
||||
if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
|
||||
this.newline(newline);
|
||||
}
|
||||
@@ -33,18 +34,18 @@ function Program(node) {
|
||||
function BlockStatement(node) {
|
||||
var _node$directives2;
|
||||
this.tokenChar(123);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
const exit = this.enterDelimited();
|
||||
const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length;
|
||||
if (directivesLen) {
|
||||
var _node$directives$trai2;
|
||||
const newline = node.body.length ? 2 : 1;
|
||||
this.printSequence(node.directives, true, true, newline);
|
||||
this.printSequence(node.directives, true, newline);
|
||||
if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) {
|
||||
this.newline(newline);
|
||||
}
|
||||
}
|
||||
this.printSequence(node.body, true, true);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
this.printSequence(node.body, true);
|
||||
exit();
|
||||
this.rightBrace(node);
|
||||
}
|
||||
function Directive(node) {
|
||||
@@ -72,7 +73,7 @@ function DirectiveLiteral(node) {
|
||||
}
|
||||
function InterpreterDirective(node) {
|
||||
this.token(`#!${node.value}`);
|
||||
this._newline();
|
||||
this.newline(1, true);
|
||||
}
|
||||
function Placeholder(node) {
|
||||
this.token("%%");
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+15
-18
@@ -13,17 +13,13 @@ exports.ClassProperty = ClassProperty;
|
||||
exports.StaticBlock = StaticBlock;
|
||||
exports._classMethodHead = _classMethodHead;
|
||||
var _t = require("@babel/types");
|
||||
var _expressions = require("./expressions.js");
|
||||
var _typescript = require("./typescript.js");
|
||||
var _flow = require("./flow.js");
|
||||
var _methods = require("./methods.js");
|
||||
const {
|
||||
isExportDefaultDeclaration,
|
||||
isExportNamedDeclaration
|
||||
} = _t;
|
||||
function ClassDeclaration(node, parent) {
|
||||
const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent);
|
||||
if (!inExport || !_expressions._shouldPrintDecoratorsBeforeExport.call(this, parent)) {
|
||||
if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) {
|
||||
this.printJoin(node.decorators);
|
||||
}
|
||||
if (node.declare) {
|
||||
@@ -61,11 +57,12 @@ function ClassBody(node) {
|
||||
if (node.body.length === 0) {
|
||||
this.tokenChar(125);
|
||||
} else {
|
||||
this.newline();
|
||||
const separator = classBodyEmptySemicolonsPrinter(this, node);
|
||||
separator == null || separator(-1);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
this.printJoin(node.body, true, true, separator, true, true);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
const exit = this.enterDelimited();
|
||||
this.printJoin(node.body, true, true, separator, true);
|
||||
exit();
|
||||
if (!this.endsWith(10)) this.newline();
|
||||
this.rightBrace(node);
|
||||
}
|
||||
@@ -93,7 +90,7 @@ function classBodyEmptySemicolonsPrinter(printer, node) {
|
||||
const end = nextLocIndex === node.body.length ? node.end : node.body[nextLocIndex].start;
|
||||
let tok;
|
||||
while (k < indexes.length && printer.tokenMap.matchesOriginal(tok = printer._tokens[indexes[k]], ";") && tok.start < end) {
|
||||
printer.tokenChar(59, occurrenceCount++);
|
||||
printer.token(";", undefined, occurrenceCount++);
|
||||
k++;
|
||||
}
|
||||
};
|
||||
@@ -105,13 +102,13 @@ function ClassProperty(node) {
|
||||
const endLine = (_node$key$loc = node.key.loc) == null || (_node$key$loc = _node$key$loc.end) == null ? void 0 : _node$key$loc.line;
|
||||
if (endLine) this.catchUp(endLine);
|
||||
}
|
||||
_typescript._tsPrintClassMemberModifiers.call(this, node);
|
||||
this.tsPrintClassMemberModifiers(node);
|
||||
if (node.computed) {
|
||||
this.tokenChar(91);
|
||||
this.print(node.key);
|
||||
this.tokenChar(93);
|
||||
} else {
|
||||
_flow._variance.call(this, node);
|
||||
this._variance(node);
|
||||
this.print(node.key);
|
||||
}
|
||||
if (node.optional) {
|
||||
@@ -134,7 +131,7 @@ function ClassAccessorProperty(node) {
|
||||
this.printJoin(node.decorators);
|
||||
const endLine = (_node$key$loc2 = node.key.loc) == null || (_node$key$loc2 = _node$key$loc2.end) == null ? void 0 : _node$key$loc2.line;
|
||||
if (endLine) this.catchUp(endLine);
|
||||
_typescript._tsPrintClassMemberModifiers.call(this, node);
|
||||
this.tsPrintClassMemberModifiers(node);
|
||||
this.word("accessor", true);
|
||||
this.space();
|
||||
if (node.computed) {
|
||||
@@ -142,7 +139,7 @@ function ClassAccessorProperty(node) {
|
||||
this.print(node.key);
|
||||
this.tokenChar(93);
|
||||
} else {
|
||||
_flow._variance.call(this, node);
|
||||
this._variance(node);
|
||||
this.print(node.key);
|
||||
}
|
||||
if (node.optional) {
|
||||
@@ -162,7 +159,7 @@ function ClassAccessorProperty(node) {
|
||||
}
|
||||
function ClassPrivateProperty(node) {
|
||||
this.printJoin(node.decorators);
|
||||
_typescript._tsPrintClassMemberModifiers.call(this, node);
|
||||
this.tsPrintClassMemberModifiers(node);
|
||||
this.print(node.key);
|
||||
if (node.optional) {
|
||||
this.tokenChar(63);
|
||||
@@ -180,12 +177,12 @@ function ClassPrivateProperty(node) {
|
||||
this.semicolon();
|
||||
}
|
||||
function ClassMethod(node) {
|
||||
_classMethodHead.call(this, node);
|
||||
this._classMethodHead(node);
|
||||
this.space();
|
||||
this.print(node.body);
|
||||
}
|
||||
function ClassPrivateMethod(node) {
|
||||
_classMethodHead.call(this, node);
|
||||
this._classMethodHead(node);
|
||||
this.space();
|
||||
this.print(node.body);
|
||||
}
|
||||
@@ -196,8 +193,8 @@ function _classMethodHead(node) {
|
||||
const endLine = (_node$key$loc3 = node.key.loc) == null || (_node$key$loc3 = _node$key$loc3.end) == null ? void 0 : _node$key$loc3.line;
|
||||
if (endLine) this.catchUp(endLine);
|
||||
}
|
||||
_typescript._tsPrintClassMemberModifiers.call(this, node);
|
||||
_methods._methodHead.call(this, node);
|
||||
this.tsPrintClassMemberModifiers(node);
|
||||
this._methodHead(node);
|
||||
}
|
||||
function StaticBlock(node) {
|
||||
this.word("static");
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+18
-63
@@ -3,71 +3,26 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DecimalLiteral = DecimalLiteral;
|
||||
exports.Noop = Noop;
|
||||
exports.RecordExpression = RecordExpression;
|
||||
exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments;
|
||||
exports.TupleExpression = TupleExpression;
|
||||
function Noop() {}
|
||||
function TSExpressionWithTypeArguments(node) {
|
||||
this.print(node.expression);
|
||||
this.print(node.typeParameters);
|
||||
}
|
||||
function DecimalLiteral(node) {
|
||||
const raw = this.getPossibleRaw(node);
|
||||
if (!this.format.minified && raw !== undefined) {
|
||||
this.word(raw);
|
||||
return;
|
||||
}
|
||||
this.word(node.value + "m");
|
||||
}
|
||||
function RecordExpression(node) {
|
||||
const props = node.properties;
|
||||
let startToken;
|
||||
let endToken;
|
||||
if (this.format.recordAndTupleSyntaxType === "bar") {
|
||||
startToken = "{|";
|
||||
endToken = "|}";
|
||||
} else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) {
|
||||
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
|
||||
} else {
|
||||
startToken = "#{";
|
||||
endToken = "}";
|
||||
}
|
||||
this.token(startToken);
|
||||
if (props.length) {
|
||||
this.space();
|
||||
this.printList(props, this.shouldPrintTrailingComma(endToken), true, true);
|
||||
this.space();
|
||||
}
|
||||
this.token(endToken);
|
||||
}
|
||||
function TupleExpression(node) {
|
||||
const elems = node.elements;
|
||||
const len = elems.length;
|
||||
let startToken;
|
||||
let endToken;
|
||||
if (this.format.recordAndTupleSyntaxType === "bar") {
|
||||
startToken = "[|";
|
||||
endToken = "|]";
|
||||
} else if (this.format.recordAndTupleSyntaxType === "hash") {
|
||||
startToken = "#[";
|
||||
endToken = "]";
|
||||
} else {
|
||||
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
|
||||
}
|
||||
this.token(startToken);
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
const elem = elems[i];
|
||||
if (elem) {
|
||||
if (i > 0) this.space();
|
||||
this.print(elem);
|
||||
if (i < len - 1 || this.shouldPrintTrailingComma(endToken)) {
|
||||
this.token(",", false, i);
|
||||
exports.addDeprecatedGenerators = addDeprecatedGenerators;
|
||||
function addDeprecatedGenerators(PrinterClass) {
|
||||
{
|
||||
const deprecatedBabel7Generators = {
|
||||
Noop() {},
|
||||
TSExpressionWithTypeArguments(node) {
|
||||
this.print(node.expression);
|
||||
this.print(node.typeParameters);
|
||||
},
|
||||
DecimalLiteral(node) {
|
||||
const raw = this.getPossibleRaw(node);
|
||||
if (!this.format.minified && raw !== undefined) {
|
||||
this.word(raw);
|
||||
return;
|
||||
}
|
||||
this.word(node.value + "m");
|
||||
}
|
||||
}
|
||||
};
|
||||
Object.assign(PrinterClass.prototype, deprecatedBabel7Generators);
|
||||
}
|
||||
this.token(endToken);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=deprecated.js.map
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+36
-45
@@ -3,10 +3,9 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.LogicalExpression = exports.AssignmentExpression = AssignmentExpression;
|
||||
exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression;
|
||||
exports.AssignmentPattern = AssignmentPattern;
|
||||
exports.AwaitExpression = AwaitExpression;
|
||||
exports.BinaryExpression = BinaryExpression;
|
||||
exports.BindExpression = BindExpression;
|
||||
exports.CallExpression = CallExpression;
|
||||
exports.ConditionalExpression = ConditionalExpression;
|
||||
@@ -44,12 +43,11 @@ function UnaryExpression(node) {
|
||||
const {
|
||||
operator
|
||||
} = node;
|
||||
const firstChar = operator.charCodeAt(0);
|
||||
if (firstChar >= 97 && firstChar <= 122) {
|
||||
if (operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw") {
|
||||
this.word(operator);
|
||||
this.space();
|
||||
} else {
|
||||
this.tokenChar(firstChar);
|
||||
this.token(operator);
|
||||
}
|
||||
this.print(node.argument);
|
||||
}
|
||||
@@ -64,18 +62,18 @@ function DoExpression(node) {
|
||||
}
|
||||
function ParenthesizedExpression(node) {
|
||||
this.tokenChar(40);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
this.print(node.expression, undefined, true);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
const exit = this.enterDelimited();
|
||||
this.print(node.expression);
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function UpdateExpression(node) {
|
||||
if (node.prefix) {
|
||||
this.token(node.operator, false, 0, true);
|
||||
this.token(node.operator);
|
||||
this.print(node.argument);
|
||||
} else {
|
||||
this.print(node.argument, true);
|
||||
this.token(node.operator, false, 0, true);
|
||||
this.token(node.operator);
|
||||
}
|
||||
}
|
||||
function ConditionalExpression(node) {
|
||||
@@ -99,17 +97,19 @@ function NewExpression(node, parent) {
|
||||
return;
|
||||
}
|
||||
this.print(node.typeArguments);
|
||||
this.print(node.typeParameters);
|
||||
if (node.optional) {
|
||||
this.token("?.");
|
||||
{
|
||||
this.print(node.typeParameters);
|
||||
if (node.optional) {
|
||||
this.token("?.");
|
||||
}
|
||||
}
|
||||
if (node.arguments.length === 0 && this.tokenMap && !this.tokenMap.endMatches(node, ")")) {
|
||||
return;
|
||||
}
|
||||
this.tokenChar(40);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
const exit = this.enterDelimited();
|
||||
this.printList(node.arguments, this.shouldPrintTrailingComma(")"));
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function SequenceExpression(node) {
|
||||
@@ -129,10 +129,7 @@ function _shouldPrintDecoratorsBeforeExport(node) {
|
||||
}
|
||||
function Decorator(node) {
|
||||
this.tokenChar(64);
|
||||
const {
|
||||
expression
|
||||
} = node;
|
||||
this.print(expression);
|
||||
this.print(node.expression);
|
||||
this.newline();
|
||||
}
|
||||
function OptionalMemberExpression(node) {
|
||||
@@ -166,25 +163,29 @@ function OptionalMemberExpression(node) {
|
||||
}
|
||||
function OptionalCallExpression(node) {
|
||||
this.print(node.callee);
|
||||
this.print(node.typeParameters);
|
||||
{
|
||||
this.print(node.typeParameters);
|
||||
}
|
||||
if (node.optional) {
|
||||
this.token("?.");
|
||||
}
|
||||
this.print(node.typeArguments);
|
||||
this.tokenChar(40);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
this.printList(node.arguments, undefined, undefined, undefined, undefined, true);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
const exit = this.enterDelimited();
|
||||
this.printList(node.arguments);
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function CallExpression(node) {
|
||||
this.print(node.callee);
|
||||
this.print(node.typeArguments);
|
||||
this.print(node.typeParameters);
|
||||
{
|
||||
this.print(node.typeParameters);
|
||||
}
|
||||
this.tokenChar(40);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
const exit = this.enterDelimited();
|
||||
this.printList(node.arguments, this.shouldPrintTrailingComma(")"));
|
||||
exit();
|
||||
this.rightParens(node);
|
||||
}
|
||||
function Import() {
|
||||
@@ -233,21 +234,11 @@ function AssignmentPattern(node) {
|
||||
function AssignmentExpression(node) {
|
||||
this.print(node.left);
|
||||
this.space();
|
||||
this.token(node.operator, false, 0, true);
|
||||
this.space();
|
||||
this.print(node.right);
|
||||
}
|
||||
function BinaryExpression(node) {
|
||||
this.print(node.left);
|
||||
this.space();
|
||||
const {
|
||||
operator
|
||||
} = node;
|
||||
if (operator.charCodeAt(0) === 105) {
|
||||
this.word(operator);
|
||||
if (node.operator === "in" || node.operator === "instanceof") {
|
||||
this.word(node.operator);
|
||||
} else {
|
||||
this.token(operator, false, 0, true);
|
||||
this.setLastChar(operator.charCodeAt(operator.length - 1));
|
||||
this.token(node.operator);
|
||||
this._endsWithDiv = node.operator === "/";
|
||||
}
|
||||
this.space();
|
||||
this.print(node.right);
|
||||
@@ -267,11 +258,11 @@ function MemberExpression(node) {
|
||||
computed = true;
|
||||
}
|
||||
if (computed) {
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
const exit = this.enterDelimited();
|
||||
this.tokenChar(91);
|
||||
this.print(node.property, undefined, true);
|
||||
this.print(node.property);
|
||||
this.tokenChar(93);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
exit();
|
||||
} else {
|
||||
this.tokenChar(46);
|
||||
this.print(node.property);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+10
-10
@@ -109,7 +109,7 @@ function DeclareClass(node, parent) {
|
||||
}
|
||||
this.word("class");
|
||||
this.space();
|
||||
_interfaceish.call(this, node);
|
||||
this._interfaceish(node);
|
||||
}
|
||||
function DeclareFunction(node, parent) {
|
||||
if (!isDeclareExportDeclaration(parent)) {
|
||||
@@ -140,7 +140,7 @@ function DeclaredPredicate(node) {
|
||||
function DeclareInterface(node) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
InterfaceDeclaration.call(this, node);
|
||||
this.InterfaceDeclaration(node);
|
||||
}
|
||||
function DeclareModule(node) {
|
||||
this.word("declare");
|
||||
@@ -162,14 +162,14 @@ function DeclareModuleExports(node) {
|
||||
function DeclareTypeAlias(node) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
TypeAlias.call(this, node);
|
||||
this.TypeAlias(node);
|
||||
}
|
||||
function DeclareOpaqueType(node, parent) {
|
||||
if (!isDeclareExportDeclaration(parent)) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
OpaqueType.call(this, node);
|
||||
this.OpaqueType(node);
|
||||
}
|
||||
function DeclareVariable(node, parent) {
|
||||
if (!isDeclareExportDeclaration(parent)) {
|
||||
@@ -397,7 +397,7 @@ function _variance(node) {
|
||||
function InterfaceDeclaration(node) {
|
||||
this.word("interface");
|
||||
this.space();
|
||||
_interfaceish.call(this, node);
|
||||
this._interfaceish(node);
|
||||
}
|
||||
function andSeparator(occurrenceCount) {
|
||||
this.space();
|
||||
@@ -475,7 +475,7 @@ function TypeParameterInstantiation(node) {
|
||||
this.tokenChar(62);
|
||||
}
|
||||
function TypeParameter(node) {
|
||||
_variance.call(this, node);
|
||||
this._variance(node);
|
||||
this.word(node.name);
|
||||
if (node.bound) {
|
||||
this.print(node.bound);
|
||||
@@ -517,12 +517,12 @@ function ObjectTypeAnnotation(node) {
|
||||
if (props.length) {
|
||||
this.newline();
|
||||
this.space();
|
||||
this.printJoin(props, true, true, () => {
|
||||
this.printJoin(props, true, true, undefined, undefined, () => {
|
||||
if (props.length !== 1 || node.inexact) {
|
||||
this.tokenChar(44);
|
||||
this.space();
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
this.space();
|
||||
}
|
||||
if (node.inexact) {
|
||||
@@ -568,7 +568,7 @@ function ObjectTypeIndexer(node) {
|
||||
this.word("static");
|
||||
this.space();
|
||||
}
|
||||
_variance.call(this, node);
|
||||
this._variance(node);
|
||||
this.tokenChar(91);
|
||||
if (node.id) {
|
||||
this.print(node.id);
|
||||
@@ -594,7 +594,7 @@ function ObjectTypeProperty(node) {
|
||||
this.word(node.kind);
|
||||
this.space();
|
||||
}
|
||||
_variance.call(this, node);
|
||||
this._variance(node);
|
||||
this.print(node.key);
|
||||
if (node.optional) this.tokenChar(63);
|
||||
if (!node.method) {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+5
-3
@@ -80,10 +80,12 @@ function spaceSeparator() {
|
||||
function JSXOpeningElement(node) {
|
||||
this.tokenChar(60);
|
||||
this.print(node.name);
|
||||
if (node.typeArguments) {
|
||||
this.print(node.typeArguments);
|
||||
{
|
||||
if (node.typeArguments) {
|
||||
this.print(node.typeArguments);
|
||||
}
|
||||
this.print(node.typeParameters);
|
||||
}
|
||||
this.print(node.typeParameters);
|
||||
if (node.attributes.length > 0) {
|
||||
this.space();
|
||||
this.printJoin(node.attributes, undefined, undefined, spaceSeparator);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+25
-34
@@ -17,40 +17,39 @@ var _index = require("../node/index.js");
|
||||
const {
|
||||
isIdentifier
|
||||
} = _t;
|
||||
function _params(node, noLineTerminator, idNode, parentNode) {
|
||||
function _params(node, idNode, parentNode) {
|
||||
this.print(node.typeParameters);
|
||||
if (idNode !== undefined || parentNode !== undefined) {
|
||||
const nameInfo = _getFuncIdName.call(this, idNode, parentNode);
|
||||
if (nameInfo) {
|
||||
this.sourceIdentifierName(nameInfo.name, nameInfo.pos);
|
||||
}
|
||||
const nameInfo = _getFuncIdName.call(this, idNode, parentNode);
|
||||
if (nameInfo) {
|
||||
this.sourceIdentifierName(nameInfo.name, nameInfo.pos);
|
||||
}
|
||||
this.tokenChar(40);
|
||||
_parameters.call(this, node.params, 41);
|
||||
this._parameters(node.params, ")");
|
||||
const noLineTerminator = node.type === "ArrowFunctionExpression";
|
||||
this.print(node.returnType, noLineTerminator);
|
||||
this._noLineTerminator = noLineTerminator;
|
||||
}
|
||||
function _parameters(parameters, endToken) {
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
const exit = this.enterDelimited();
|
||||
const trailingComma = this.shouldPrintTrailingComma(endToken);
|
||||
const paramLength = parameters.length;
|
||||
for (let i = 0; i < paramLength; i++) {
|
||||
_param.call(this, parameters[i]);
|
||||
this._param(parameters[i]);
|
||||
if (trailingComma || i < paramLength - 1) {
|
||||
this.tokenChar(44, i);
|
||||
this.token(",", undefined, i);
|
||||
this.space();
|
||||
}
|
||||
}
|
||||
this.tokenChar(endToken);
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
this.token(endToken);
|
||||
exit();
|
||||
}
|
||||
function _param(parameter) {
|
||||
this.printJoin(parameter.decorators, undefined, undefined, undefined, undefined, true);
|
||||
this.print(parameter, undefined, true);
|
||||
this.printJoin(parameter.decorators);
|
||||
this.print(parameter);
|
||||
if (parameter.optional) {
|
||||
this.tokenChar(63);
|
||||
}
|
||||
this.print(parameter.typeAnnotation, undefined, true);
|
||||
this.print(parameter.typeAnnotation);
|
||||
}
|
||||
function _methodHead(node) {
|
||||
const kind = node.kind;
|
||||
@@ -78,11 +77,7 @@ function _methodHead(node) {
|
||||
if (node.optional) {
|
||||
this.tokenChar(63);
|
||||
}
|
||||
if (this._buf._map) {
|
||||
_params.call(this, node, false, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key);
|
||||
} else {
|
||||
_params.call(this, node, false);
|
||||
}
|
||||
this._params(node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key);
|
||||
}
|
||||
function _predicate(node, noLineTerminatorAfter) {
|
||||
if (node.predicate) {
|
||||
@@ -93,18 +88,18 @@ function _predicate(node, noLineTerminatorAfter) {
|
||||
this.print(node.predicate, noLineTerminatorAfter);
|
||||
}
|
||||
}
|
||||
function _functionHead(node, parent, hasPredicate) {
|
||||
function _functionHead(node, parent) {
|
||||
if (node.async) {
|
||||
this.word("async");
|
||||
if (!this.format.preserveFormat) {
|
||||
this._innerCommentsState = 0;
|
||||
this._endsWithInnerRaw = false;
|
||||
}
|
||||
this.space();
|
||||
}
|
||||
this.word("function");
|
||||
if (node.generator) {
|
||||
if (!this.format.preserveFormat) {
|
||||
this._innerCommentsState = 0;
|
||||
this._endsWithInnerRaw = false;
|
||||
}
|
||||
this.tokenChar(42);
|
||||
}
|
||||
@@ -112,17 +107,13 @@ function _functionHead(node, parent, hasPredicate) {
|
||||
if (node.id) {
|
||||
this.print(node.id);
|
||||
}
|
||||
if (this._buf._map) {
|
||||
_params.call(this, node, false, node.id, parent);
|
||||
} else {
|
||||
_params.call(this, node, false);
|
||||
}
|
||||
if (hasPredicate) {
|
||||
_predicate.call(this, node);
|
||||
this._params(node, node.id, parent);
|
||||
if (node.type !== "TSDeclareFunction") {
|
||||
this._predicate(node);
|
||||
}
|
||||
}
|
||||
function FunctionExpression(node, parent) {
|
||||
_functionHead.call(this, node, parent, true);
|
||||
this._functionHead(node, parent);
|
||||
this.space();
|
||||
this.print(node.body);
|
||||
}
|
||||
@@ -131,12 +122,12 @@ function ArrowFunctionExpression(node, parent) {
|
||||
this.word("async", true);
|
||||
this.space();
|
||||
}
|
||||
if (_shouldPrintArrowParamsParens.call(this, node)) {
|
||||
_params.call(this, node, true, undefined, this._buf._map ? parent : undefined);
|
||||
if (this._shouldPrintArrowParamsParens(node)) {
|
||||
this._params(node, undefined, parent);
|
||||
} else {
|
||||
this.print(node.params[0], true);
|
||||
}
|
||||
_predicate.call(this, node, true);
|
||||
this._predicate(node, true);
|
||||
this.space();
|
||||
this.printInnerComments();
|
||||
this.token("=>");
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+8
-11
@@ -18,7 +18,6 @@ exports.ImportSpecifier = ImportSpecifier;
|
||||
exports._printAttributes = _printAttributes;
|
||||
var _t = require("@babel/types");
|
||||
var _index = require("../node/index.js");
|
||||
var _expressions = require("./expressions.js");
|
||||
const {
|
||||
isClassDeclaration,
|
||||
isExportDefaultSpecifier,
|
||||
@@ -69,15 +68,13 @@ function ExportNamespaceSpecifier(node) {
|
||||
let warningShown = false;
|
||||
function _printAttributes(node, hasPreviousBrace) {
|
||||
var _node$extra;
|
||||
const {
|
||||
attributes
|
||||
} = node;
|
||||
var {
|
||||
assertions
|
||||
} = node;
|
||||
const {
|
||||
importAttributesKeyword
|
||||
} = this.format;
|
||||
const {
|
||||
attributes,
|
||||
assertions
|
||||
} = node;
|
||||
if (attributes && !importAttributesKeyword && node.extra && (node.extra.deprecatedAssertSyntax || node.extra.deprecatedWithLegacySyntax) && !warningShown) {
|
||||
warningShown = true;
|
||||
console.warn(`\
|
||||
@@ -117,14 +114,14 @@ function ExportAllDeclaration(node) {
|
||||
if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) {
|
||||
this.print(node.source, true);
|
||||
this.space();
|
||||
_printAttributes.call(this, node, false);
|
||||
this._printAttributes(node, false);
|
||||
} else {
|
||||
this.print(node.source);
|
||||
}
|
||||
this.semicolon();
|
||||
}
|
||||
function maybePrintDecoratorsBeforeExport(printer, node) {
|
||||
if (isClassDeclaration(node.declaration) && _expressions._shouldPrintDecoratorsBeforeExport.call(printer, node)) {
|
||||
if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) {
|
||||
printer.printJoin(node.declaration.decorators);
|
||||
}
|
||||
}
|
||||
@@ -175,7 +172,7 @@ function ExportNamedDeclaration(node) {
|
||||
if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) {
|
||||
this.print(node.source, true);
|
||||
this.space();
|
||||
_printAttributes.call(this, node, hasBrace);
|
||||
this._printAttributes(node, hasBrace);
|
||||
} else {
|
||||
this.print(node.source);
|
||||
}
|
||||
@@ -248,7 +245,7 @@ function ImportDeclaration(node) {
|
||||
if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) {
|
||||
this.print(node.source, true);
|
||||
this.space();
|
||||
_printAttributes.call(this, node, hasBrace);
|
||||
this._printAttributes(node, hasBrace);
|
||||
} else {
|
||||
this.print(node.source);
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+38
-58
@@ -8,8 +8,7 @@ exports.CatchClause = CatchClause;
|
||||
exports.ContinueStatement = ContinueStatement;
|
||||
exports.DebuggerStatement = DebuggerStatement;
|
||||
exports.DoWhileStatement = DoWhileStatement;
|
||||
exports.ForInStatement = ForInStatement;
|
||||
exports.ForOfStatement = ForOfStatement;
|
||||
exports.ForOfStatement = exports.ForInStatement = void 0;
|
||||
exports.ForStatement = ForStatement;
|
||||
exports.IfStatement = IfStatement;
|
||||
exports.LabeledStatement = LabeledStatement;
|
||||
@@ -23,9 +22,9 @@ exports.VariableDeclarator = VariableDeclarator;
|
||||
exports.WhileStatement = WhileStatement;
|
||||
exports.WithStatement = WithStatement;
|
||||
var _t = require("@babel/types");
|
||||
var _index = require("../node/index.js");
|
||||
const {
|
||||
isFor,
|
||||
isForStatement,
|
||||
isIfStatement,
|
||||
isStatement
|
||||
} = _t;
|
||||
@@ -35,7 +34,7 @@ function WithStatement(node) {
|
||||
this.tokenChar(40);
|
||||
this.print(node.object);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node.body);
|
||||
this.printBlock(node);
|
||||
}
|
||||
function IfStatement(node) {
|
||||
this.word("if");
|
||||
@@ -76,21 +75,23 @@ function ForStatement(node) {
|
||||
this.word("for");
|
||||
this.space();
|
||||
this.tokenChar(40);
|
||||
this.tokenContext |= _index.TokenContext.forInitHead | _index.TokenContext.forInOrInitHeadAccumulate;
|
||||
this.print(node.init);
|
||||
this.tokenContext = _index.TokenContext.normal;
|
||||
{
|
||||
const exit = this.enterForStatementInit();
|
||||
this.print(node.init);
|
||||
exit();
|
||||
}
|
||||
this.tokenChar(59);
|
||||
if (node.test) {
|
||||
this.space();
|
||||
this.print(node.test);
|
||||
}
|
||||
this.tokenChar(59, 1);
|
||||
this.token(";", false, 1);
|
||||
if (node.update) {
|
||||
this.space();
|
||||
this.print(node.update);
|
||||
}
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node.body);
|
||||
this.printBlock(node);
|
||||
}
|
||||
function WhileStatement(node) {
|
||||
this.word("while");
|
||||
@@ -98,41 +99,32 @@ function WhileStatement(node) {
|
||||
this.tokenChar(40);
|
||||
this.print(node.test);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node.body);
|
||||
this.printBlock(node);
|
||||
}
|
||||
function ForInStatement(node) {
|
||||
function ForXStatement(node) {
|
||||
this.word("for");
|
||||
this.space();
|
||||
this.noIndentInnerCommentsHere();
|
||||
this.tokenChar(40);
|
||||
this.tokenContext |= _index.TokenContext.forInHead | _index.TokenContext.forInOrInitHeadAccumulate;
|
||||
this.print(node.left);
|
||||
this.tokenContext = _index.TokenContext.normal;
|
||||
this.space();
|
||||
this.word("in");
|
||||
this.space();
|
||||
this.print(node.right);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node.body);
|
||||
}
|
||||
function ForOfStatement(node) {
|
||||
this.word("for");
|
||||
this.space();
|
||||
if (node.await) {
|
||||
const isForOf = node.type === "ForOfStatement";
|
||||
if (isForOf && node.await) {
|
||||
this.word("await");
|
||||
this.space();
|
||||
}
|
||||
this.noIndentInnerCommentsHere();
|
||||
this.tokenChar(40);
|
||||
this.tokenContext |= _index.TokenContext.forOfHead;
|
||||
this.print(node.left);
|
||||
{
|
||||
const exit = this.enterForXStatementInit(isForOf);
|
||||
this.print(node.left);
|
||||
exit == null || exit();
|
||||
}
|
||||
this.space();
|
||||
this.word("of");
|
||||
this.word(isForOf ? "of" : "in");
|
||||
this.space();
|
||||
this.print(node.right);
|
||||
this.tokenChar(41);
|
||||
this.printBlock(node.body);
|
||||
this.printBlock(node);
|
||||
}
|
||||
const ForInStatement = exports.ForInStatement = ForXStatement;
|
||||
const ForOfStatement = exports.ForOfStatement = ForXStatement;
|
||||
function DoWhileStatement(node) {
|
||||
this.word("do");
|
||||
this.space();
|
||||
@@ -233,10 +225,6 @@ function DebuggerStatement() {
|
||||
this.word("debugger");
|
||||
this.semicolon();
|
||||
}
|
||||
function commaSeparatorWithNewline(occurrenceCount) {
|
||||
this.tokenChar(44, occurrenceCount);
|
||||
this.newline();
|
||||
}
|
||||
function VariableDeclaration(node, parent) {
|
||||
if (node.declare) {
|
||||
this.word("declare");
|
||||
@@ -245,15 +233,12 @@ function VariableDeclaration(node, parent) {
|
||||
const {
|
||||
kind
|
||||
} = node;
|
||||
switch (kind) {
|
||||
case "await using":
|
||||
this.word("await");
|
||||
this.space();
|
||||
case "using":
|
||||
this.word("using", true);
|
||||
break;
|
||||
default:
|
||||
this.word(kind);
|
||||
if (kind === "await using") {
|
||||
this.word("await");
|
||||
this.space();
|
||||
this.word("using", true);
|
||||
} else {
|
||||
this.word(kind, kind === "using");
|
||||
}
|
||||
this.space();
|
||||
let hasInits = false;
|
||||
@@ -261,23 +246,18 @@ function VariableDeclaration(node, parent) {
|
||||
for (const declar of node.declarations) {
|
||||
if (declar.init) {
|
||||
hasInits = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? commaSeparatorWithNewline : undefined);
|
||||
if (parent != null) {
|
||||
switch (parent.type) {
|
||||
case "ForStatement":
|
||||
if (parent.init === node) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "ForInStatement":
|
||||
case "ForOfStatement":
|
||||
if (parent.left === node) {
|
||||
return;
|
||||
}
|
||||
this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? function (occurrenceCount) {
|
||||
this.token(",", false, occurrenceCount);
|
||||
this.newline();
|
||||
} : undefined);
|
||||
if (isFor(parent)) {
|
||||
if (isForStatement(parent)) {
|
||||
if (parent.init === node) return;
|
||||
} else {
|
||||
if (parent.left === node) return;
|
||||
}
|
||||
}
|
||||
this.semicolon();
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-2
@@ -9,7 +9,9 @@ exports.TemplateLiteral = TemplateLiteral;
|
||||
exports._printTemplate = _printTemplate;
|
||||
function TaggedTemplateExpression(node) {
|
||||
this.print(node.tag);
|
||||
this.print(node.typeParameters);
|
||||
{
|
||||
this.print(node.typeParameters);
|
||||
}
|
||||
this.print(node.quasi);
|
||||
}
|
||||
function TemplateElement() {
|
||||
@@ -32,7 +34,7 @@ function _printTemplate(node, substitutions) {
|
||||
this.token(partRaw + "`", true);
|
||||
}
|
||||
function TemplateLiteral(node) {
|
||||
_printTemplate.call(this, node, node.expressions);
|
||||
this._printTemplate(node, node.expressions);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=template-literals.js.map
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["TaggedTemplateExpression","node","print","tag","typeParameters","quasi","TemplateElement","Error","_printTemplate","substitutions","quasis","partRaw","i","length","value","raw","token","tokenMap","findMatching","_catchUpTo","loc","start","TemplateLiteral","call","expressions"],"sources":["../../src/generators/template-literals.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n\nexport function TaggedTemplateExpression(\n this: Printer,\n node: t.TaggedTemplateExpression,\n) {\n this.print(node.tag);\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n this.print(node.typeArguments);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n this.print(node.typeParameters);\n }\n this.print(node.quasi);\n}\n\nexport function TemplateElement(this: Printer) {\n throw new Error(\"TemplateElement printing is handled in TemplateLiteral\");\n}\n\nexport type TemplateLiteralBase = t.Node & {\n quasis: t.TemplateElement[];\n};\n\nexport function _printTemplate<T extends t.Node>(\n this: Printer,\n node: TemplateLiteralBase,\n substitutions: T[],\n) {\n const quasis = node.quasis;\n let partRaw = \"`\";\n for (let i = 0; i < quasis.length - 1; i++) {\n partRaw += quasis[i].value.raw;\n this.token(partRaw + \"${\", true);\n this.print(substitutions[i]);\n partRaw = \"}\";\n\n // In Babel 7 we have individual tokens for ${ and }, so the automatic\n // catchup logic does not work. Manually look for those tokens.\n if (!process.env.BABEL_8_BREAKING && this.tokenMap) {\n const token = this.tokenMap.findMatching(node, \"}\", i);\n if (token) this._catchUpTo(token.loc.start);\n }\n }\n partRaw += quasis[quasis.length - 1].value.raw;\n this.token(partRaw + \"`\", true);\n}\n\nexport function TemplateLiteral(this: Printer, node: t.TemplateLiteral) {\n _printTemplate.call(this, node, node.expressions);\n}\n"],"mappings":";;;;;;;;;AAGO,SAASA,wBAAwBA,CAEtCC,IAAgC,EAChC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,GAAG,CAAC;EAMlB,IAAI,CAACD,KAAK,CAACD,IAAI,CAACG,cAAc,CAAC;EAEjC,IAAI,CAACF,KAAK,CAACD,IAAI,CAACI,KAAK,CAAC;AACxB;AAEO,SAASC,eAAeA,CAAA,EAAgB;EAC7C,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;AAC3E;AAMO,SAASC,cAAcA,CAE5BP,IAAyB,EACzBQ,aAAkB,EAClB;EACA,MAAMC,MAAM,GAAGT,IAAI,CAACS,MAAM;EAC1B,IAAIC,OAAO,GAAG,GAAG;EACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACG,MAAM,GAAG,CAAC,EAAED,CAAC,EAAE,EAAE;IAC1CD,OAAO,IAAID,MAAM,CAACE,CAAC,CAAC,CAACE,KAAK,CAACC,GAAG;IAC9B,IAAI,CAACC,KAAK,CAACL,OAAO,GAAG,IAAI,EAAE,IAAI,CAAC;IAChC,IAAI,CAACT,KAAK,CAACO,aAAa,CAACG,CAAC,CAAC,CAAC;IAC5BD,OAAO,GAAG,GAAG;IAIb,IAAqC,IAAI,CAACM,QAAQ,EAAE;MAClD,MAAMD,KAAK,GAAG,IAAI,CAACC,QAAQ,CAACC,YAAY,CAACjB,IAAI,EAAE,GAAG,EAAEW,CAAC,CAAC;MACtD,IAAII,KAAK,EAAE,IAAI,CAACG,UAAU,CAACH,KAAK,CAACI,GAAG,CAACC,KAAK,CAAC;IAC7C;EACF;EACAV,OAAO,IAAID,MAAM,CAACA,MAAM,CAACG,MAAM,GAAG,CAAC,CAAC,CAACC,KAAK,CAACC,GAAG;EAC9C,IAAI,CAACC,KAAK,CAACL,OAAO,GAAG,GAAG,EAAE,IAAI,CAAC;AACjC;AAEO,SAASW,eAAeA,CAAgBrB,IAAuB,EAAE;EACtEO,cAAc,CAACe,IAAI,CAAC,IAAI,EAAEtB,IAAI,EAAEA,IAAI,CAACuB,WAAW,CAAC;AACnD","ignoreList":[]}
|
||||
{"version":3,"names":["TaggedTemplateExpression","node","print","tag","typeParameters","quasi","TemplateElement","Error","_printTemplate","substitutions","quasis","partRaw","i","length","value","raw","token","tokenMap","findMatching","_catchUpTo","loc","start","TemplateLiteral","expressions"],"sources":["../../src/generators/template-literals.ts"],"sourcesContent":["import type Printer from \"../printer.ts\";\nimport type * as t from \"@babel/types\";\n\nexport function TaggedTemplateExpression(\n this: Printer,\n node: t.TaggedTemplateExpression,\n) {\n this.print(node.tag);\n if (process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST\n this.print(node.typeArguments);\n } else {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST\n this.print(node.typeParameters);\n }\n this.print(node.quasi);\n}\n\nexport function TemplateElement(this: Printer) {\n throw new Error(\"TemplateElement printing is handled in TemplateLiteral\");\n}\n\nexport type TemplateLiteralBase = t.Node & {\n quasis: t.TemplateElement[];\n};\n\nexport function _printTemplate<T extends t.Node>(\n this: Printer,\n node: TemplateLiteralBase,\n substitutions: T[],\n) {\n const quasis = node.quasis;\n let partRaw = \"`\";\n for (let i = 0; i < quasis.length - 1; i++) {\n partRaw += quasis[i].value.raw;\n this.token(partRaw + \"${\", true);\n this.print(substitutions[i]);\n partRaw = \"}\";\n\n // In Babel 7 we have individual tokens for ${ and }, so the automatic\n // catchup logic does not work. Manually look for those tokens.\n if (!process.env.BABEL_8_BREAKING && this.tokenMap) {\n const token = this.tokenMap.findMatching(node, \"}\", i);\n if (token) this._catchUpTo(token.loc.start);\n }\n }\n partRaw += quasis[quasis.length - 1].value.raw;\n this.token(partRaw + \"`\", true);\n}\n\nexport function TemplateLiteral(this: Printer, node: t.TemplateLiteral) {\n this._printTemplate(node, node.expressions);\n}\n"],"mappings":";;;;;;;;;AAGO,SAASA,wBAAwBA,CAEtCC,IAAgC,EAChC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,GAAG,CAAC;EAIb;IAEL,IAAI,CAACD,KAAK,CAACD,IAAI,CAACG,cAAc,CAAC;EACjC;EACA,IAAI,CAACF,KAAK,CAACD,IAAI,CAACI,KAAK,CAAC;AACxB;AAEO,SAASC,eAAeA,CAAA,EAAgB;EAC7C,MAAM,IAAIC,KAAK,CAAC,wDAAwD,CAAC;AAC3E;AAMO,SAASC,cAAcA,CAE5BP,IAAyB,EACzBQ,aAAkB,EAClB;EACA,MAAMC,MAAM,GAAGT,IAAI,CAACS,MAAM;EAC1B,IAAIC,OAAO,GAAG,GAAG;EACjB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACG,MAAM,GAAG,CAAC,EAAED,CAAC,EAAE,EAAE;IAC1CD,OAAO,IAAID,MAAM,CAACE,CAAC,CAAC,CAACE,KAAK,CAACC,GAAG;IAC9B,IAAI,CAACC,KAAK,CAACL,OAAO,GAAG,IAAI,EAAE,IAAI,CAAC;IAChC,IAAI,CAACT,KAAK,CAACO,aAAa,CAACG,CAAC,CAAC,CAAC;IAC5BD,OAAO,GAAG,GAAG;IAIb,IAAqC,IAAI,CAACM,QAAQ,EAAE;MAClD,MAAMD,KAAK,GAAG,IAAI,CAACC,QAAQ,CAACC,YAAY,CAACjB,IAAI,EAAE,GAAG,EAAEW,CAAC,CAAC;MACtD,IAAII,KAAK,EAAE,IAAI,CAACG,UAAU,CAACH,KAAK,CAACI,GAAG,CAACC,KAAK,CAAC;IAC7C;EACF;EACAV,OAAO,IAAID,MAAM,CAACA,MAAM,CAACG,MAAM,GAAG,CAAC,CAAC,CAACC,KAAK,CAACC,GAAG;EAC9C,IAAI,CAACC,KAAK,CAACL,OAAO,GAAG,GAAG,EAAE,IAAI,CAAC;AACjC;AAEO,SAASW,eAAeA,CAAgBrB,IAAuB,EAAE;EACtE,IAAI,CAACO,cAAc,CAACP,IAAI,EAAEA,IAAI,CAACsB,WAAW,CAAC;AAC7C","ignoreList":[]}
|
||||
+72
-17
@@ -16,21 +16,25 @@ exports.ObjectProperty = ObjectProperty;
|
||||
exports.PipelineBareFunction = PipelineBareFunction;
|
||||
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
|
||||
exports.PipelineTopicExpression = PipelineTopicExpression;
|
||||
exports.RecordExpression = RecordExpression;
|
||||
exports.RegExpLiteral = RegExpLiteral;
|
||||
exports.SpreadElement = exports.RestElement = RestElement;
|
||||
exports.StringLiteral = StringLiteral;
|
||||
exports.TopicReference = TopicReference;
|
||||
exports.TupleExpression = TupleExpression;
|
||||
exports.VoidPattern = VoidPattern;
|
||||
exports._getRawIdentifier = _getRawIdentifier;
|
||||
var _t = require("@babel/types");
|
||||
var _jsesc = require("jsesc");
|
||||
var _methods = require("./methods.js");
|
||||
const {
|
||||
isAssignmentPattern,
|
||||
isIdentifier
|
||||
} = _t;
|
||||
let lastRawIdentNode = null;
|
||||
let lastRawIdentResult = "";
|
||||
function _getRawIdentifier(node) {
|
||||
if (node === lastRawIdentNode) return lastRawIdentResult;
|
||||
lastRawIdentNode = node;
|
||||
const {
|
||||
name
|
||||
} = node;
|
||||
@@ -42,11 +46,9 @@ function _getRawIdentifier(node) {
|
||||
return lastRawIdentResult = node.name;
|
||||
}
|
||||
function Identifier(node) {
|
||||
if (this._buf._map) {
|
||||
var _node$loc;
|
||||
this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name);
|
||||
}
|
||||
this.word(this.tokenMap ? lastRawIdentResult : node.name);
|
||||
var _node$loc;
|
||||
this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name);
|
||||
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name);
|
||||
}
|
||||
function ArgumentPlaceholder() {
|
||||
this.tokenChar(63);
|
||||
@@ -59,17 +61,18 @@ function ObjectExpression(node) {
|
||||
const props = node.properties;
|
||||
this.tokenChar(123);
|
||||
if (props.length) {
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
const exit = this.enterDelimited();
|
||||
this.space();
|
||||
this.printList(props, this.shouldPrintTrailingComma("}"), true, true, undefined, true);
|
||||
this.printList(props, this.shouldPrintTrailingComma("}"), true, true);
|
||||
this.space();
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
exit();
|
||||
}
|
||||
this.rightBrace(node);
|
||||
this.sourceWithOffset("end", node.loc, -1);
|
||||
this.tokenChar(125);
|
||||
}
|
||||
function ObjectMethod(node) {
|
||||
this.printJoin(node.decorators);
|
||||
_methods._methodHead.call(this, node);
|
||||
this._methodHead(node);
|
||||
this.space();
|
||||
this.print(node.body);
|
||||
}
|
||||
@@ -97,24 +100,76 @@ function ArrayExpression(node) {
|
||||
const elems = node.elements;
|
||||
const len = elems.length;
|
||||
this.tokenChar(91);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
const exit = this.enterDelimited();
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
const elem = elems[i];
|
||||
if (elem) {
|
||||
if (i > 0) this.space();
|
||||
this.print(elem, undefined, true);
|
||||
this.print(elem);
|
||||
if (i < len - 1 || this.shouldPrintTrailingComma("]")) {
|
||||
this.tokenChar(44, i);
|
||||
this.token(",", false, i);
|
||||
}
|
||||
} else {
|
||||
this.tokenChar(44, i);
|
||||
this.token(",", false, i);
|
||||
}
|
||||
}
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
exit();
|
||||
this.tokenChar(93);
|
||||
}
|
||||
function RecordExpression(node) {
|
||||
const props = node.properties;
|
||||
let startToken;
|
||||
let endToken;
|
||||
{
|
||||
if (this.format.recordAndTupleSyntaxType === "bar") {
|
||||
startToken = "{|";
|
||||
endToken = "|}";
|
||||
} else if (this.format.recordAndTupleSyntaxType !== "hash" && this.format.recordAndTupleSyntaxType != null) {
|
||||
throw new Error(`The "recordAndTupleSyntaxType" generator option must be "bar" or "hash" (${JSON.stringify(this.format.recordAndTupleSyntaxType)} received).`);
|
||||
} else {
|
||||
startToken = "#{";
|
||||
endToken = "}";
|
||||
}
|
||||
}
|
||||
this.token(startToken);
|
||||
if (props.length) {
|
||||
this.space();
|
||||
this.printList(props, this.shouldPrintTrailingComma(endToken), true, true);
|
||||
this.space();
|
||||
}
|
||||
this.token(endToken);
|
||||
}
|
||||
function TupleExpression(node) {
|
||||
const elems = node.elements;
|
||||
const len = elems.length;
|
||||
let startToken;
|
||||
let endToken;
|
||||
{
|
||||
if (this.format.recordAndTupleSyntaxType === "bar") {
|
||||
startToken = "[|";
|
||||
endToken = "|]";
|
||||
} else if (this.format.recordAndTupleSyntaxType === "hash") {
|
||||
startToken = "#[";
|
||||
endToken = "]";
|
||||
} else {
|
||||
throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`);
|
||||
}
|
||||
}
|
||||
this.token(startToken);
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
const elem = elems[i];
|
||||
if (elem) {
|
||||
if (i > 0) this.space();
|
||||
this.print(elem);
|
||||
if (i < len - 1 || this.shouldPrintTrailingComma(endToken)) {
|
||||
this.token(",", false, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.token(endToken);
|
||||
}
|
||||
function RegExpLiteral(node) {
|
||||
this.word(`/${node.pattern}/${node.flags}`, false);
|
||||
this.word(`/${node.pattern}/${node.flags}`);
|
||||
}
|
||||
function BooleanLiteral(node) {
|
||||
this.word(node.value ? "true" : "false");
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+64
-65
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.TSAnyKeyword = TSAnyKeyword;
|
||||
exports.TSArrayType = TSArrayType;
|
||||
exports.TSAsExpression = TSAsExpression;
|
||||
exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression;
|
||||
exports.TSBigIntKeyword = TSBigIntKeyword;
|
||||
exports.TSBooleanKeyword = TSBooleanKeyword;
|
||||
exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
|
||||
@@ -49,7 +49,6 @@ exports.TSParenthesizedType = TSParenthesizedType;
|
||||
exports.TSPropertySignature = TSPropertySignature;
|
||||
exports.TSQualifiedName = TSQualifiedName;
|
||||
exports.TSRestType = TSRestType;
|
||||
exports.TSSatisfiesExpression = TSSatisfiesExpression;
|
||||
exports.TSStringKeyword = TSStringKeyword;
|
||||
exports.TSSymbolKeyword = TSSymbolKeyword;
|
||||
exports.TSTemplateLiteralType = TSTemplateLiteralType;
|
||||
@@ -69,10 +68,10 @@ exports.TSUndefinedKeyword = TSUndefinedKeyword;
|
||||
exports.TSUnionType = TSUnionType;
|
||||
exports.TSUnknownKeyword = TSUnknownKeyword;
|
||||
exports.TSVoidKeyword = TSVoidKeyword;
|
||||
exports._tsPrintClassMemberModifiers = _tsPrintClassMemberModifiers;
|
||||
var _methods = require("./methods.js");
|
||||
var _classes = require("./classes.js");
|
||||
var _templateLiterals = require("./template-literals.js");
|
||||
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
|
||||
exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType;
|
||||
exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
|
||||
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
|
||||
function TSTypeAnnotation(node, parent) {
|
||||
this.token((parent.type === "TSFunctionType" || parent.type === "TSConstructorType") && parent.typeAnnotation === node ? "=>" : ":");
|
||||
this.space();
|
||||
@@ -125,18 +124,18 @@ function TSParameterProperty(node) {
|
||||
this.word("readonly");
|
||||
this.space();
|
||||
}
|
||||
_methods._param.call(this, node.parameter);
|
||||
this._param(node.parameter);
|
||||
}
|
||||
function TSDeclareFunction(node, parent) {
|
||||
if (node.declare) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
_methods._functionHead.call(this, node, parent, false);
|
||||
this._functionHead(node, parent);
|
||||
this.semicolon();
|
||||
}
|
||||
function TSDeclareMethod(node) {
|
||||
_classes._classMethodHead.call(this, node);
|
||||
this._classMethodHead(node);
|
||||
this.semicolon();
|
||||
}
|
||||
function TSQualifiedName(node) {
|
||||
@@ -145,7 +144,7 @@ function TSQualifiedName(node) {
|
||||
this.print(node.right);
|
||||
}
|
||||
function TSCallSignatureDeclaration(node) {
|
||||
tsPrintSignatureDeclarationBase.call(this, node);
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
maybePrintTrailingCommaOrSemicolon(this, node);
|
||||
}
|
||||
function maybePrintTrailingCommaOrSemicolon(printer, node) {
|
||||
@@ -162,7 +161,7 @@ function maybePrintTrailingCommaOrSemicolon(printer, node) {
|
||||
function TSConstructSignatureDeclaration(node) {
|
||||
this.word("new");
|
||||
this.space();
|
||||
tsPrintSignatureDeclarationBase.call(this, node);
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
maybePrintTrailingCommaOrSemicolon(this, node);
|
||||
}
|
||||
function TSPropertySignature(node) {
|
||||
@@ -173,7 +172,7 @@ function TSPropertySignature(node) {
|
||||
this.word("readonly");
|
||||
this.space();
|
||||
}
|
||||
tsPrintPropertyOrMethodName.call(this, node);
|
||||
this.tsPrintPropertyOrMethodName(node);
|
||||
this.print(node.typeAnnotation);
|
||||
maybePrintTrailingCommaOrSemicolon(this, node);
|
||||
}
|
||||
@@ -197,8 +196,8 @@ function TSMethodSignature(node) {
|
||||
this.word(kind);
|
||||
this.space();
|
||||
}
|
||||
tsPrintPropertyOrMethodName.call(this, node);
|
||||
tsPrintSignatureDeclarationBase.call(this, node);
|
||||
this.tsPrintPropertyOrMethodName(node);
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
maybePrintTrailingCommaOrSemicolon(this, node);
|
||||
}
|
||||
function TSIndexSignature(node) {
|
||||
@@ -215,7 +214,7 @@ function TSIndexSignature(node) {
|
||||
this.space();
|
||||
}
|
||||
this.tokenChar(91);
|
||||
_methods._parameters.call(this, node.parameters, 93);
|
||||
this._parameters(node.parameters, "]");
|
||||
this.print(node.typeAnnotation);
|
||||
maybePrintTrailingCommaOrSemicolon(this, node);
|
||||
}
|
||||
@@ -262,7 +261,7 @@ function TSThisType() {
|
||||
this.word("this");
|
||||
}
|
||||
function TSFunctionType(node) {
|
||||
tsPrintFunctionOrConstructorType.call(this, node);
|
||||
this.tsPrintFunctionOrConstructorType(node);
|
||||
}
|
||||
function TSConstructorType(node) {
|
||||
if (node.abstract) {
|
||||
@@ -271,7 +270,7 @@ function TSConstructorType(node) {
|
||||
}
|
||||
this.word("new");
|
||||
this.space();
|
||||
tsPrintFunctionOrConstructorType.call(this, node);
|
||||
this.tsPrintFunctionOrConstructorType(node);
|
||||
}
|
||||
function tsPrintFunctionOrConstructorType(node) {
|
||||
const {
|
||||
@@ -280,7 +279,7 @@ function tsPrintFunctionOrConstructorType(node) {
|
||||
const parameters = node.parameters;
|
||||
this.print(typeParameters);
|
||||
this.tokenChar(40);
|
||||
_methods._parameters.call(this, parameters, 41);
|
||||
this._parameters(parameters, ")");
|
||||
this.space();
|
||||
const returnType = node.typeAnnotation;
|
||||
this.print(returnType);
|
||||
@@ -313,7 +312,7 @@ function TSTypeQuery(node) {
|
||||
}
|
||||
}
|
||||
function TSTypeLiteral(node) {
|
||||
printBraced(this, node, () => this.printJoin(node.members, true, true, undefined, undefined, true));
|
||||
printBraced(this, node, () => this.printJoin(node.members, true, true));
|
||||
}
|
||||
function TSArrayType(node) {
|
||||
this.print(node.elementType, true);
|
||||
@@ -402,7 +401,7 @@ function TSMappedType(node) {
|
||||
typeAnnotation
|
||||
} = node;
|
||||
this.tokenChar(123);
|
||||
const oldNoLineTerminatorAfterNode = this.enterDelimited();
|
||||
const exit = this.enterDelimited();
|
||||
this.space();
|
||||
if (readonly) {
|
||||
tokenIfPlusMinus(this, readonly);
|
||||
@@ -410,16 +409,20 @@ function TSMappedType(node) {
|
||||
this.space();
|
||||
}
|
||||
this.tokenChar(91);
|
||||
this.word(node.typeParameter.name);
|
||||
{
|
||||
this.word(node.typeParameter.name);
|
||||
}
|
||||
this.space();
|
||||
this.word("in");
|
||||
this.space();
|
||||
this.print(node.typeParameter.constraint, undefined, true);
|
||||
{
|
||||
this.print(node.typeParameter.constraint);
|
||||
}
|
||||
if (nameType) {
|
||||
this.space();
|
||||
this.word("as");
|
||||
this.space();
|
||||
this.print(nameType, undefined, true);
|
||||
this.print(nameType);
|
||||
}
|
||||
this.tokenChar(93);
|
||||
if (optional) {
|
||||
@@ -429,10 +432,10 @@ function TSMappedType(node) {
|
||||
if (typeAnnotation) {
|
||||
this.tokenChar(58);
|
||||
this.space();
|
||||
this.print(typeAnnotation, undefined, true);
|
||||
this.print(typeAnnotation);
|
||||
}
|
||||
this.space();
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
exit();
|
||||
this.tokenChar(125);
|
||||
}
|
||||
function tokenIfPlusMinus(self, tok) {
|
||||
@@ -441,7 +444,7 @@ function tokenIfPlusMinus(self, tok) {
|
||||
}
|
||||
}
|
||||
function TSTemplateLiteralType(node) {
|
||||
_templateLiterals._printTemplate.call(this, node, node.types);
|
||||
this._printTemplate(node, node.types);
|
||||
}
|
||||
function TSLiteralType(node) {
|
||||
this.print(node.literal);
|
||||
@@ -476,7 +479,7 @@ function TSInterfaceDeclaration(node) {
|
||||
this.print(body);
|
||||
}
|
||||
function TSInterfaceBody(node) {
|
||||
printBraced(this, node, () => this.printJoin(node.body, true, true, undefined, undefined, true));
|
||||
printBraced(this, node, () => this.printJoin(node.body, true, true));
|
||||
}
|
||||
function TSTypeAliasDeclaration(node) {
|
||||
const {
|
||||
@@ -499,25 +502,15 @@ function TSTypeAliasDeclaration(node) {
|
||||
this.print(typeAnnotation);
|
||||
this.semicolon();
|
||||
}
|
||||
function TSAsExpression(node) {
|
||||
function TSTypeExpression(node) {
|
||||
const {
|
||||
type,
|
||||
expression,
|
||||
typeAnnotation
|
||||
} = node;
|
||||
this.print(expression, true);
|
||||
this.space();
|
||||
this.word("as");
|
||||
this.space();
|
||||
this.print(typeAnnotation);
|
||||
}
|
||||
function TSSatisfiesExpression(node) {
|
||||
const {
|
||||
expression,
|
||||
typeAnnotation
|
||||
} = node;
|
||||
this.print(expression, true);
|
||||
this.space();
|
||||
this.word("satisfies");
|
||||
this.word(type === "TSAsExpression" ? "as" : "satisfies");
|
||||
this.space();
|
||||
this.print(typeAnnotation);
|
||||
}
|
||||
@@ -534,7 +527,9 @@ function TSTypeAssertion(node) {
|
||||
}
|
||||
function TSInstantiationExpression(node) {
|
||||
this.print(node.expression);
|
||||
this.print(node.typeParameters);
|
||||
{
|
||||
this.print(node.typeParameters);
|
||||
}
|
||||
}
|
||||
function TSEnumDeclaration(node) {
|
||||
const {
|
||||
@@ -554,12 +549,14 @@ function TSEnumDeclaration(node) {
|
||||
this.space();
|
||||
this.print(id);
|
||||
this.space();
|
||||
TSEnumBody.call(this, node);
|
||||
{
|
||||
TSEnumBody.call(this, node);
|
||||
}
|
||||
}
|
||||
function TSEnumBody(node) {
|
||||
printBraced(this, node, () => {
|
||||
var _this$shouldPrintTrai;
|
||||
return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true, undefined, true);
|
||||
return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true);
|
||||
});
|
||||
}
|
||||
function TSEnumMember(node) {
|
||||
@@ -585,35 +582,38 @@ function TSModuleDeclaration(node) {
|
||||
this.word("declare");
|
||||
this.space();
|
||||
}
|
||||
if (!node.global) {
|
||||
this.word(kind != null ? kind : id.type === "Identifier" ? "namespace" : "module");
|
||||
{
|
||||
if (!node.global) {
|
||||
this.word(kind != null ? kind : id.type === "Identifier" ? "namespace" : "module");
|
||||
this.space();
|
||||
}
|
||||
this.print(id);
|
||||
if (!node.body) {
|
||||
this.semicolon();
|
||||
return;
|
||||
}
|
||||
let body = node.body;
|
||||
while (body.type === "TSModuleDeclaration") {
|
||||
this.tokenChar(46);
|
||||
this.print(body.id);
|
||||
body = body.body;
|
||||
}
|
||||
this.space();
|
||||
this.print(body);
|
||||
}
|
||||
this.print(id);
|
||||
if (!node.body) {
|
||||
this.semicolon();
|
||||
return;
|
||||
}
|
||||
let body = node.body;
|
||||
while (body.type === "TSModuleDeclaration") {
|
||||
this.tokenChar(46);
|
||||
this.print(body.id);
|
||||
body = body.body;
|
||||
}
|
||||
this.space();
|
||||
this.print(body);
|
||||
}
|
||||
function TSModuleBlock(node) {
|
||||
printBraced(this, node, () => this.printSequence(node.body, true, true));
|
||||
printBraced(this, node, () => this.printSequence(node.body, true));
|
||||
}
|
||||
function TSImportType(node) {
|
||||
const {
|
||||
argument,
|
||||
qualifier,
|
||||
options
|
||||
} = node;
|
||||
this.word("import");
|
||||
this.tokenChar(40);
|
||||
this.print(node.argument);
|
||||
this.print(argument);
|
||||
if (options) {
|
||||
this.tokenChar(44);
|
||||
this.print(options);
|
||||
@@ -654,7 +654,6 @@ function TSExternalModuleReference(node) {
|
||||
function TSNonNullExpression(node) {
|
||||
this.print(node.expression);
|
||||
this.tokenChar(33);
|
||||
this.setLastChar(33);
|
||||
}
|
||||
function TSExportAssignment(node) {
|
||||
this.word("export");
|
||||
@@ -681,11 +680,11 @@ function tsPrintSignatureDeclarationBase(node) {
|
||||
const parameters = node.parameters;
|
||||
this.print(typeParameters);
|
||||
this.tokenChar(40);
|
||||
_methods._parameters.call(this, parameters, 41);
|
||||
this._parameters(parameters, ")");
|
||||
const returnType = node.typeAnnotation;
|
||||
this.print(returnType);
|
||||
}
|
||||
function _tsPrintClassMemberModifiers(node) {
|
||||
function tsPrintClassMemberModifiers(node) {
|
||||
const isPrivateField = node.type === "ClassPrivateProperty";
|
||||
const isPublicField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty";
|
||||
printModifiersList(this, node, [isPublicField && node.declare && "declare", !isPrivateField && node.accessibility]);
|
||||
@@ -697,9 +696,9 @@ function _tsPrintClassMemberModifiers(node) {
|
||||
}
|
||||
function printBraced(printer, node, cb) {
|
||||
printer.token("{");
|
||||
const oldNoLineTerminatorAfterNode = printer.enterDelimited();
|
||||
const exit = printer.enterDelimited();
|
||||
cb();
|
||||
printer._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
exit();
|
||||
printer.rightBrace(node);
|
||||
}
|
||||
function printModifiersList(printer, node, modifiers) {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+24
-20
@@ -8,7 +8,6 @@ exports.generate = generate;
|
||||
var _sourceMap = require("./source-map.js");
|
||||
var _printer = require("./printer.js");
|
||||
function normalizeOptions(code, opts, ast) {
|
||||
var _opts$recordAndTupleS;
|
||||
if (opts.experimental_preserveFormat) {
|
||||
if (typeof code !== "string") {
|
||||
throw new Error("`experimental_preserveFormat` requires the original `code` to be passed to @babel/generator as a string");
|
||||
@@ -49,12 +48,15 @@ function normalizeOptions(code, opts, ast) {
|
||||
wrap: true,
|
||||
minimal: false
|
||||
}, opts.jsescOption),
|
||||
topicToken: opts.topicToken
|
||||
topicToken: opts.topicToken,
|
||||
importAttributesKeyword: opts.importAttributesKeyword
|
||||
};
|
||||
format.decoratorsBeforeExport = opts.decoratorsBeforeExport;
|
||||
format.jsescOption.json = opts.jsonCompatibleStrings;
|
||||
format.recordAndTupleSyntaxType = (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash";
|
||||
format.importAttributesKeyword = opts.importAttributesKeyword;
|
||||
{
|
||||
var _opts$recordAndTupleS;
|
||||
format.decoratorsBeforeExport = opts.decoratorsBeforeExport;
|
||||
format.jsescOption.json = opts.jsonCompatibleStrings;
|
||||
format.recordAndTupleSyntaxType = (_opts$recordAndTupleS = opts.recordAndTupleSyntaxType) != null ? _opts$recordAndTupleS : "hash";
|
||||
}
|
||||
if (format.minified) {
|
||||
format.compact = true;
|
||||
format.shouldPrintComment = format.shouldPrintComment || (() => format.comments);
|
||||
@@ -83,20 +85,22 @@ function normalizeOptions(code, opts, ast) {
|
||||
}
|
||||
return format;
|
||||
}
|
||||
exports.CodeGenerator = class CodeGenerator {
|
||||
constructor(ast, opts = {}, code) {
|
||||
this._ast = void 0;
|
||||
this._format = void 0;
|
||||
this._map = void 0;
|
||||
this._ast = ast;
|
||||
this._format = normalizeOptions(code, opts, ast);
|
||||
this._map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
|
||||
}
|
||||
generate() {
|
||||
const printer = new _printer.default(this._format, this._map);
|
||||
return printer.generate(this._ast);
|
||||
}
|
||||
};
|
||||
{
|
||||
exports.CodeGenerator = class CodeGenerator {
|
||||
constructor(ast, opts = {}, code) {
|
||||
this._ast = void 0;
|
||||
this._format = void 0;
|
||||
this._map = void 0;
|
||||
this._ast = ast;
|
||||
this._format = normalizeOptions(code, opts, ast);
|
||||
this._map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
|
||||
}
|
||||
generate() {
|
||||
const printer = new _printer.default(this._format, this._map);
|
||||
return printer.generate(this._ast);
|
||||
}
|
||||
};
|
||||
}
|
||||
function generate(ast, opts = {}, code) {
|
||||
const format = normalizeOptions(code, opts, ast);
|
||||
const map = opts.sourceMaps ? new _sourceMap.default(opts, code) : null;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+66
-25
@@ -5,12 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.TokenContext = void 0;
|
||||
exports.isLastChild = isLastChild;
|
||||
exports.parentNeedsParens = parentNeedsParens;
|
||||
exports.needsParens = needsParens;
|
||||
exports.needsWhitespace = needsWhitespace;
|
||||
exports.needsWhitespaceAfter = needsWhitespaceAfter;
|
||||
exports.needsWhitespaceBefore = needsWhitespaceBefore;
|
||||
var whitespace = require("./whitespace.js");
|
||||
var parens = require("./parentheses.js");
|
||||
var _t = require("@babel/types");
|
||||
var _nodes = require("../nodes.js");
|
||||
const {
|
||||
VISITOR_KEYS
|
||||
FLIPPED_ALIAS_KEYS,
|
||||
VISITOR_KEYS,
|
||||
isCallExpression,
|
||||
isDecorator,
|
||||
isExpressionStatement,
|
||||
isMemberExpression,
|
||||
isNewExpression,
|
||||
isParenthesizedExpression
|
||||
} = _t;
|
||||
const TokenContext = exports.TokenContext = {
|
||||
normal: 0,
|
||||
@@ -24,33 +34,64 @@ const TokenContext = exports.TokenContext = {
|
||||
forInOrInitHeadAccumulate: 128,
|
||||
forInOrInitHeadAccumulatePassThroughMask: 128
|
||||
};
|
||||
for (const type of Object.keys(parens)) {
|
||||
const func = parens[type];
|
||||
if (_nodes.generatorInfosMap.has(type)) {
|
||||
_nodes.generatorInfosMap.get(type)[2] = func;
|
||||
function expandAliases(obj) {
|
||||
const map = new Map();
|
||||
function add(type, func) {
|
||||
const fn = map.get(type);
|
||||
map.set(type, fn ? function (node, parent, stack, getRawIdentifier) {
|
||||
var _fn;
|
||||
return (_fn = fn(node, parent, stack, getRawIdentifier)) != null ? _fn : func(node, parent, stack, getRawIdentifier);
|
||||
} : func);
|
||||
}
|
||||
}
|
||||
function isOrHasCallExpression(node) {
|
||||
switch (node.type) {
|
||||
case "CallExpression":
|
||||
return true;
|
||||
case "MemberExpression":
|
||||
return isOrHasCallExpression(node.object);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function parentNeedsParens(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 112:
|
||||
if (parent.callee === node) {
|
||||
if (isOrHasCallExpression(node)) return true;
|
||||
for (const type of Object.keys(obj)) {
|
||||
const aliases = FLIPPED_ALIAS_KEYS[type];
|
||||
if (aliases) {
|
||||
for (const alias of aliases) {
|
||||
add(alias, obj[type]);
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
return !isDecoratorMemberExpression(node) && !(node.type === "CallExpression" && isDecoratorMemberExpression(node.callee)) && node.type !== "ParenthesizedExpression";
|
||||
} else {
|
||||
add(type, obj[type]);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
const expandedParens = expandAliases(parens);
|
||||
const expandedWhitespaceNodes = expandAliases(whitespace.nodes);
|
||||
function isOrHasCallExpression(node) {
|
||||
if (isCallExpression(node)) {
|
||||
return true;
|
||||
}
|
||||
return isMemberExpression(node) && isOrHasCallExpression(node.object);
|
||||
}
|
||||
function needsWhitespace(node, parent, type) {
|
||||
var _expandedWhitespaceNo;
|
||||
if (!node) return false;
|
||||
if (isExpressionStatement(node)) {
|
||||
node = node.expression;
|
||||
}
|
||||
const flag = (_expandedWhitespaceNo = expandedWhitespaceNodes.get(node.type)) == null ? void 0 : _expandedWhitespaceNo(node, parent);
|
||||
if (typeof flag === "number") {
|
||||
return (flag & type) !== 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function needsWhitespaceBefore(node, parent) {
|
||||
return needsWhitespace(node, parent, 1);
|
||||
}
|
||||
function needsWhitespaceAfter(node, parent) {
|
||||
return needsWhitespace(node, parent, 2);
|
||||
}
|
||||
function needsParens(node, parent, tokenContext, getRawIdentifier) {
|
||||
var _expandedParens$get;
|
||||
if (!parent) return false;
|
||||
if (isNewExpression(parent) && parent.callee === node) {
|
||||
if (isOrHasCallExpression(node)) return true;
|
||||
}
|
||||
if (isDecorator(parent)) {
|
||||
return !isDecoratorMemberExpression(node) && !(isCallExpression(node) && isDecoratorMemberExpression(node.callee)) && !isParenthesizedExpression(node);
|
||||
}
|
||||
return ((_expandedParens$get = expandedParens.get(node.type)) == null ? void 0 : _expandedParens$get(node, parent, tokenContext, getRawIdentifier)) || false;
|
||||
}
|
||||
function isDecoratorMemberExpression(node) {
|
||||
switch (node.type) {
|
||||
case "Identifier":
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+167
-204
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AssignmentExpression = AssignmentExpression;
|
||||
exports.Binary = Binary;
|
||||
exports.BinaryExpression = BinaryExpression;
|
||||
exports.ClassExpression = ClassExpression;
|
||||
exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression;
|
||||
@@ -23,7 +24,7 @@ exports.TSConstructorType = exports.TSFunctionType = TSFunctionType;
|
||||
exports.TSInferType = TSInferType;
|
||||
exports.TSInstantiationExpression = TSInstantiationExpression;
|
||||
exports.TSIntersectionType = TSIntersectionType;
|
||||
exports.SpreadElement = exports.UnaryExpression = exports.TSTypeAssertion = UnaryLike;
|
||||
exports.UnaryLike = exports.TSTypeAssertion = UnaryLike;
|
||||
exports.TSTypeOperator = TSTypeOperator;
|
||||
exports.TSUnionType = TSUnionType;
|
||||
exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
|
||||
@@ -32,267 +33,229 @@ exports.AwaitExpression = exports.YieldExpression = YieldExpression;
|
||||
var _t = require("@babel/types");
|
||||
var _index = require("./index.js");
|
||||
const {
|
||||
isArrayTypeAnnotation,
|
||||
isBinaryExpression,
|
||||
isCallExpression,
|
||||
isForOfStatement,
|
||||
isIndexedAccessType,
|
||||
isMemberExpression,
|
||||
isObjectPattern,
|
||||
isOptionalMemberExpression,
|
||||
isYieldExpression,
|
||||
isStatement
|
||||
} = _t;
|
||||
const PRECEDENCE = new Map([["||", 0], ["??", 1], ["&&", 2], ["|", 3], ["^", 4], ["&", 5], ["==", 6], ["===", 6], ["!=", 6], ["!==", 6], ["<", 7], [">", 7], ["<=", 7], [">=", 7], ["in", 7], ["instanceof", 7], [">>", 8], ["<<", 8], [">>>", 8], ["+", 9], ["-", 9], ["*", 10], ["/", 10], ["%", 10], ["**", 11]]);
|
||||
function isTSTypeExpression(nodeId) {
|
||||
return nodeId === 156 || nodeId === 201 || nodeId === 209;
|
||||
}
|
||||
const isClassExtendsClause = (node, parent, parentId) => {
|
||||
return (parentId === 21 || parentId === 22) && parent.superClass === node;
|
||||
};
|
||||
const hasPostfixPart = (node, parent, parentId) => {
|
||||
switch (parentId) {
|
||||
case 108:
|
||||
case 132:
|
||||
return parent.object === node;
|
||||
case 17:
|
||||
case 130:
|
||||
case 112:
|
||||
return parent.callee === node;
|
||||
case 222:
|
||||
return parent.tag === node;
|
||||
case 191:
|
||||
return true;
|
||||
const PRECEDENCE = new Map([["||", 0], ["??", 0], ["|>", 0], ["&&", 1], ["|", 2], ["^", 3], ["&", 4], ["==", 5], ["===", 5], ["!=", 5], ["!==", 5], ["<", 6], [">", 6], ["<=", 6], [">=", 6], ["in", 6], ["instanceof", 6], [">>", 7], ["<<", 7], [">>>", 7], ["+", 8], ["-", 8], ["*", 9], ["/", 9], ["%", 9], ["**", 10]]);
|
||||
function getBinaryPrecedence(node, nodeType) {
|
||||
if (nodeType === "BinaryExpression" || nodeType === "LogicalExpression") {
|
||||
return PRECEDENCE.get(node.operator);
|
||||
}
|
||||
if (nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression") {
|
||||
return PRECEDENCE.get("in");
|
||||
}
|
||||
return false;
|
||||
};
|
||||
function NullableTypeAnnotation(node, parent, parentId) {
|
||||
return parentId === 4;
|
||||
}
|
||||
function FunctionTypeAnnotation(node, parent, parentId, tokenContext) {
|
||||
return (parentId === 239 || parentId === 90 || parentId === 4 || (tokenContext & _index.TokenContext.arrowFlowReturnType) > 0
|
||||
function isTSTypeExpression(nodeType) {
|
||||
return nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression" || nodeType === "TSTypeAssertion";
|
||||
}
|
||||
const isClassExtendsClause = (node, parent) => {
|
||||
const parentType = parent.type;
|
||||
return (parentType === "ClassDeclaration" || parentType === "ClassExpression") && parent.superClass === node;
|
||||
};
|
||||
const hasPostfixPart = (node, parent) => {
|
||||
const parentType = parent.type;
|
||||
return (parentType === "MemberExpression" || parentType === "OptionalMemberExpression") && parent.object === node || (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression") && parent.callee === node || parentType === "TaggedTemplateExpression" && parent.tag === node || parentType === "TSNonNullExpression";
|
||||
};
|
||||
function NullableTypeAnnotation(node, parent) {
|
||||
return isArrayTypeAnnotation(parent);
|
||||
}
|
||||
function FunctionTypeAnnotation(node, parent, tokenContext) {
|
||||
const parentType = parent.type;
|
||||
return (parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType)
|
||||
);
|
||||
}
|
||||
function UpdateExpression(node, parent, parentId) {
|
||||
return hasPostfixPart(node, parent, parentId) || isClassExtendsClause(node, parent, parentId);
|
||||
function UpdateExpression(node, parent) {
|
||||
return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);
|
||||
}
|
||||
function needsParenBeforeExpressionBrace(tokenContext) {
|
||||
return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody)) > 0;
|
||||
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody));
|
||||
}
|
||||
function ObjectExpression(node, parent, parentId, tokenContext) {
|
||||
function ObjectExpression(node, parent, tokenContext) {
|
||||
return needsParenBeforeExpressionBrace(tokenContext);
|
||||
}
|
||||
function DoExpression(node, parent, parentId, tokenContext) {
|
||||
return (tokenContext & _index.TokenContext.expressionStatement) > 0 && !node.async;
|
||||
function DoExpression(node, parent, tokenContext) {
|
||||
return !node.async && Boolean(tokenContext & _index.TokenContext.expressionStatement);
|
||||
}
|
||||
function BinaryLike(node, parent, parentId, nodeType) {
|
||||
if (isClassExtendsClause(node, parent, parentId)) {
|
||||
function Binary(node, parent) {
|
||||
const parentType = parent.type;
|
||||
if (node.type === "BinaryExpression" && node.operator === "**" && parentType === "BinaryExpression" && parent.operator === "**") {
|
||||
return parent.left === node;
|
||||
}
|
||||
if (isClassExtendsClause(node, parent)) {
|
||||
return true;
|
||||
}
|
||||
if (hasPostfixPart(node, parent, parentId) || parentId === 238 || parentId === 145 || parentId === 8) {
|
||||
if (hasPostfixPart(node, parent) || parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "AwaitExpression") {
|
||||
return true;
|
||||
}
|
||||
let parentPos;
|
||||
switch (parentId) {
|
||||
case 10:
|
||||
case 107:
|
||||
parentPos = PRECEDENCE.get(parent.operator);
|
||||
break;
|
||||
case 156:
|
||||
case 201:
|
||||
parentPos = 7;
|
||||
}
|
||||
if (parentPos !== undefined) {
|
||||
const nodePos = nodeType === 2 ? 7 : PRECEDENCE.get(node.operator);
|
||||
if (parentPos > nodePos) return true;
|
||||
if (parentPos === nodePos && parentId === 10 && (nodePos === 11 ? parent.left === node : parent.right === node)) {
|
||||
const parentPos = getBinaryPrecedence(parent, parentType);
|
||||
if (parentPos != null) {
|
||||
const nodePos = getBinaryPrecedence(node, node.type);
|
||||
if (parentPos === nodePos && parentType === "BinaryExpression" && parent.right === node || parentPos > nodePos) {
|
||||
return true;
|
||||
}
|
||||
if (nodeType === 1 && parentId === 107 && (nodePos === 1 && parentPos !== 1 || parentPos === 1 && nodePos !== 1)) {
|
||||
}
|
||||
}
|
||||
function UnionTypeAnnotation(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return parentType === "ArrayTypeAnnotation" || parentType === "NullableTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "UnionTypeAnnotation";
|
||||
}
|
||||
function OptionalIndexedAccessType(node, parent) {
|
||||
return isIndexedAccessType(parent) && parent.objectType === node;
|
||||
}
|
||||
function TSAsExpression(node, parent) {
|
||||
if ((parent.type === "AssignmentExpression" || parent.type === "AssignmentPattern") && parent.left === node) {
|
||||
return true;
|
||||
}
|
||||
if (parent.type === "BinaryExpression" && (parent.operator === "|" || parent.operator === "&") && node === parent.left) {
|
||||
return true;
|
||||
}
|
||||
return Binary(node, parent);
|
||||
}
|
||||
function TSConditionalType(node, parent) {
|
||||
const parentType = parent.type;
|
||||
if (parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType" || parentType === "TSTypeOperator" || parentType === "TSTypeParameter") {
|
||||
return true;
|
||||
}
|
||||
if ((parentType === "TSIntersectionType" || parentType === "TSUnionType") && parent.types[0] === node) {
|
||||
return true;
|
||||
}
|
||||
if (parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function TSUnionType(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return parentType === "TSIntersectionType" || parentType === "TSTypeOperator" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
|
||||
}
|
||||
function TSIntersectionType(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return parentType === "TSTypeOperator" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
|
||||
}
|
||||
function TSInferType(node, parent) {
|
||||
const parentType = parent.type;
|
||||
if (parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType") {
|
||||
return true;
|
||||
}
|
||||
if (node.typeParameter.constraint) {
|
||||
if ((parentType === "TSIntersectionType" || parentType === "TSUnionType") && parent.types[0] === node) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function UnionTypeAnnotation(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 4:
|
||||
case 115:
|
||||
case 90:
|
||||
case 239:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
function TSTypeOperator(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType";
|
||||
}
|
||||
function OptionalIndexedAccessType(node, parent, parentId) {
|
||||
return parentId === 84 && parent.objectType === node;
|
||||
function TSInstantiationExpression(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters;
|
||||
}
|
||||
function TSAsExpression(node, parent, parentId) {
|
||||
if ((parentId === 6 || parentId === 7) && parent.left === node) {
|
||||
return true;
|
||||
}
|
||||
if (parentId === 10 && (parent.operator === "|" || parent.operator === "&") && node === parent.left) {
|
||||
return true;
|
||||
}
|
||||
return BinaryLike(node, parent, parentId, 2);
|
||||
function TSFunctionType(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSTypeOperator" || parentType === "TSOptionalType" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node);
|
||||
}
|
||||
function TSConditionalType(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 155:
|
||||
case 195:
|
||||
case 211:
|
||||
case 212:
|
||||
return true;
|
||||
case 175:
|
||||
return parent.objectType === node;
|
||||
case 181:
|
||||
case 219:
|
||||
return parent.types[0] === node;
|
||||
case 161:
|
||||
return parent.checkType === node || parent.extendsType === node;
|
||||
}
|
||||
return false;
|
||||
function BinaryExpression(node, parent, tokenContext) {
|
||||
return node.operator === "in" && Boolean(tokenContext & _index.TokenContext.forInOrInitHeadAccumulate);
|
||||
}
|
||||
function TSUnionType(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 181:
|
||||
case 211:
|
||||
case 155:
|
||||
case 195:
|
||||
return true;
|
||||
case 175:
|
||||
return parent.objectType === node;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function TSIntersectionType(node, parent, parentId) {
|
||||
return parentId === 211 || TSTypeOperator(node, parent, parentId);
|
||||
}
|
||||
function TSInferType(node, parent, parentId) {
|
||||
if (TSTypeOperator(node, parent, parentId)) {
|
||||
return true;
|
||||
}
|
||||
if ((parentId === 181 || parentId === 219) && node.typeParameter.constraint && parent.types[0] === node) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function TSTypeOperator(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 155:
|
||||
case 195:
|
||||
return true;
|
||||
case 175:
|
||||
if (parent.objectType === node) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function TSInstantiationExpression(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 17:
|
||||
case 130:
|
||||
case 112:
|
||||
case 177:
|
||||
return (parent.typeParameters
|
||||
) != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function TSFunctionType(node, parent, parentId) {
|
||||
if (TSUnionType(node, parent, parentId)) return true;
|
||||
return parentId === 219 || parentId === 161 && (parent.checkType === node || parent.extendsType === node);
|
||||
}
|
||||
function BinaryExpression(node, parent, parentId, tokenContext) {
|
||||
if (BinaryLike(node, parent, parentId, 0)) return true;
|
||||
return (tokenContext & _index.TokenContext.forInOrInitHeadAccumulate) > 0 && node.operator === "in";
|
||||
}
|
||||
function LogicalExpression(node, parent, parentId) {
|
||||
return BinaryLike(node, parent, parentId, 1);
|
||||
}
|
||||
function SequenceExpression(node, parent, parentId) {
|
||||
if (parentId === 144 || parentId === 133 || parentId === 108 && parent.property === node || parentId === 132 && parent.property === node || parentId === 224) {
|
||||
function SequenceExpression(node, parent) {
|
||||
const parentType = parent.type;
|
||||
if (parentType === "SequenceExpression" || parentType === "ParenthesizedExpression" || parentType === "MemberExpression" && parent.property === node || parentType === "OptionalMemberExpression" && parent.property === node || parentType === "TemplateLiteral") {
|
||||
return false;
|
||||
}
|
||||
if (parentId === 21) {
|
||||
if (parentType === "ClassDeclaration") {
|
||||
return true;
|
||||
}
|
||||
if (parentId === 68) {
|
||||
if (parentType === "ForOfStatement") {
|
||||
return parent.right === node;
|
||||
}
|
||||
if (parentId === 60) {
|
||||
if (parentType === "ExportDefaultDeclaration") {
|
||||
return true;
|
||||
}
|
||||
return !isStatement(parent);
|
||||
}
|
||||
function YieldExpression(node, parent, parentId) {
|
||||
return parentId === 10 || parentId === 107 || parentId === 238 || parentId === 145 || hasPostfixPart(node, parent, parentId) || parentId === 8 && isYieldExpression(node) || parentId === 28 && node === parent.test || isClassExtendsClause(node, parent, parentId) || isTSTypeExpression(parentId);
|
||||
function YieldExpression(node, parent) {
|
||||
const parentType = parent.type;
|
||||
return parentType === "BinaryExpression" || parentType === "LogicalExpression" || parentType === "UnaryExpression" || parentType === "SpreadElement" || hasPostfixPart(node, parent) || parentType === "AwaitExpression" && isYieldExpression(node) || parentType === "ConditionalExpression" && node === parent.test || isClassExtendsClause(node, parent) || isTSTypeExpression(parentType);
|
||||
}
|
||||
function ClassExpression(node, parent, parentId, tokenContext) {
|
||||
return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)) > 0;
|
||||
function ClassExpression(node, parent, tokenContext) {
|
||||
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault));
|
||||
}
|
||||
function UnaryLike(node, parent, parentId) {
|
||||
return hasPostfixPart(node, parent, parentId) || parentId === 10 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId);
|
||||
function UnaryLike(node, parent) {
|
||||
return hasPostfixPart(node, parent) || isBinaryExpression(parent) && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent);
|
||||
}
|
||||
function FunctionExpression(node, parent, parentId, tokenContext) {
|
||||
return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)) > 0;
|
||||
function FunctionExpression(node, parent, tokenContext) {
|
||||
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault));
|
||||
}
|
||||
function ConditionalExpression(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 238:
|
||||
case 145:
|
||||
case 10:
|
||||
case 107:
|
||||
case 8:
|
||||
return true;
|
||||
case 28:
|
||||
if (parent.test === node) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (isTSTypeExpression(parentId)) {
|
||||
function ConditionalExpression(node, parent) {
|
||||
const parentType = parent.type;
|
||||
if (parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "BinaryExpression" || parentType === "LogicalExpression" || parentType === "ConditionalExpression" && parent.test === node || parentType === "AwaitExpression" || isTSTypeExpression(parentType)) {
|
||||
return true;
|
||||
}
|
||||
return UnaryLike(node, parent, parentId);
|
||||
return UnaryLike(node, parent);
|
||||
}
|
||||
function OptionalMemberExpression(node, parent, parentId) {
|
||||
switch (parentId) {
|
||||
case 17:
|
||||
return parent.callee === node;
|
||||
case 108:
|
||||
return parent.object === node;
|
||||
}
|
||||
return false;
|
||||
function OptionalMemberExpression(node, parent) {
|
||||
return isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node;
|
||||
}
|
||||
function AssignmentExpression(node, parent, parentId, tokenContext) {
|
||||
if (needsParenBeforeExpressionBrace(tokenContext) && node.left.type === "ObjectPattern") {
|
||||
function AssignmentExpression(node, parent, tokenContext) {
|
||||
if (needsParenBeforeExpressionBrace(tokenContext) && isObjectPattern(node.left)) {
|
||||
return true;
|
||||
} else {
|
||||
return ConditionalExpression(node, parent);
|
||||
}
|
||||
return ConditionalExpression(node, parent, parentId);
|
||||
}
|
||||
function Identifier(node, parent, parentId, tokenContext, getRawIdentifier) {
|
||||
function LogicalExpression(node, parent) {
|
||||
const parentType = parent.type;
|
||||
if (isTSTypeExpression(parentType)) return true;
|
||||
if (parentType !== "LogicalExpression") return false;
|
||||
switch (node.operator) {
|
||||
case "||":
|
||||
return parent.operator === "??" || parent.operator === "&&";
|
||||
case "&&":
|
||||
return parent.operator === "??";
|
||||
case "??":
|
||||
return parent.operator !== "??";
|
||||
}
|
||||
}
|
||||
function Identifier(node, parent, tokenContext, getRawIdentifier) {
|
||||
var _node$extra;
|
||||
if (getRawIdentifier && getRawIdentifier(node) !== node.name) {
|
||||
return false;
|
||||
}
|
||||
if (parentId === 6 && (_node$extra = node.extra) != null && _node$extra.parenthesized && parent.left === node) {
|
||||
const parentType = parent.type;
|
||||
if ((_node$extra = node.extra) != null && _node$extra.parenthesized && parentType === "AssignmentExpression" && parent.left === node) {
|
||||
const rightType = parent.right.type;
|
||||
if ((rightType === "FunctionExpression" || rightType === "ClassExpression") && parent.right.id == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (tokenContext & _index.TokenContext.forOfHead || (parentId === 108 || parentId === 132) && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) {
|
||||
if (node.name === "let") {
|
||||
const isFollowedByBracket = isMemberExpression(parent, {
|
||||
object: node,
|
||||
computed: true
|
||||
}) || isOptionalMemberExpression(parent, {
|
||||
object: node,
|
||||
computed: true,
|
||||
optional: false
|
||||
});
|
||||
if (isFollowedByBracket && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) {
|
||||
return true;
|
||||
}
|
||||
return (tokenContext & _index.TokenContext.forOfHead) > 0;
|
||||
}
|
||||
if (getRawIdentifier && getRawIdentifier(node) !== node.name) {
|
||||
return false;
|
||||
}
|
||||
return parentId === 68 && parent.left === node && node.name === "async" && !parent.await;
|
||||
if (node.name === "let") {
|
||||
const isFollowedByBracket = isMemberExpression(parent, {
|
||||
object: node,
|
||||
computed: true
|
||||
}) || isOptionalMemberExpression(parent, {
|
||||
object: node,
|
||||
computed: true,
|
||||
optional: false
|
||||
});
|
||||
if (isFollowedByBracket && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) {
|
||||
return true;
|
||||
}
|
||||
return Boolean(tokenContext & _index.TokenContext.forOfHead);
|
||||
}
|
||||
return node.name === "async" && isForOfStatement(parent, {
|
||||
left: node,
|
||||
await: false
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=parentheses.js.map
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+273
-276
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
||||
exports.default = void 0;
|
||||
var _buffer = require("./buffer.js");
|
||||
var _index = require("./node/index.js");
|
||||
var _nodes = require("./nodes.js");
|
||||
var n = _index;
|
||||
var _t = require("@babel/types");
|
||||
var _tokenMap = require("./token-map.js");
|
||||
var _types2 = require("./generators/types.js");
|
||||
var generatorFunctions = require("./generators/index.js");
|
||||
var _deprecated = require("./generators/deprecated.js");
|
||||
const {
|
||||
isExpression,
|
||||
isFunction,
|
||||
@@ -25,13 +26,15 @@ const HAS_NEWLINE_OR_BlOCK_COMMENT_END = /[\n\r\u2028\u2029]|\*\//;
|
||||
function commentIsNewline(c) {
|
||||
return c.type === "CommentLine" || HAS_NEWLINE.test(c.value);
|
||||
}
|
||||
const {
|
||||
needsParens
|
||||
} = n;
|
||||
class Printer {
|
||||
constructor(format, map, tokens = null, originalCode = null) {
|
||||
this.tokenContext = _index.TokenContext.normal;
|
||||
this._tokens = null;
|
||||
this._originalCode = null;
|
||||
this._currentNode = null;
|
||||
this._currentTypeId = null;
|
||||
this._indent = 0;
|
||||
this._indentRepeat = 0;
|
||||
this._insideAux = false;
|
||||
@@ -39,11 +42,14 @@ class Printer {
|
||||
this._noLineTerminatorAfterNode = null;
|
||||
this._printAuxAfterOnNextUserNode = false;
|
||||
this._printedComments = new Set();
|
||||
this._endsWithInteger = false;
|
||||
this._endsWithWord = false;
|
||||
this._endsWithDiv = false;
|
||||
this._lastCommentLine = 0;
|
||||
this._innerCommentsState = 0;
|
||||
this._flags = 0;
|
||||
this._endsWithInnerRaw = false;
|
||||
this._indentInnerComments = true;
|
||||
this.tokenMap = null;
|
||||
this._boundGetRawIdentifier = null;
|
||||
this._boundGetRawIdentifier = this._getRawIdentifier.bind(this);
|
||||
this._printSemicolonBeforeNextNode = -1;
|
||||
this._printSemicolonBeforeNextToken = -1;
|
||||
this.format = format;
|
||||
@@ -52,66 +58,67 @@ class Printer {
|
||||
this._indentRepeat = format.indent.style.length;
|
||||
this._inputMap = (map == null ? void 0 : map._inputMap) || null;
|
||||
this._buf = new _buffer.default(map, format.indent.style[0]);
|
||||
const {
|
||||
preserveFormat,
|
||||
compact,
|
||||
concise,
|
||||
retainLines,
|
||||
retainFunctionParens
|
||||
} = format;
|
||||
if (preserveFormat) {
|
||||
this._flags |= 1;
|
||||
}
|
||||
if (compact) {
|
||||
this._flags |= 2;
|
||||
}
|
||||
if (concise) {
|
||||
this._flags |= 4;
|
||||
}
|
||||
if (retainLines) {
|
||||
this._flags |= 8;
|
||||
}
|
||||
if (retainFunctionParens) {
|
||||
this._flags |= 16;
|
||||
}
|
||||
if (format.auxiliaryCommentBefore || format.auxiliaryCommentAfter) {
|
||||
this._flags |= 32;
|
||||
}
|
||||
enterForStatementInit() {
|
||||
this.tokenContext |= _index.TokenContext.forInitHead | _index.TokenContext.forInOrInitHeadAccumulate;
|
||||
return () => this.tokenContext = _index.TokenContext.normal;
|
||||
}
|
||||
enterForXStatementInit(isForOf) {
|
||||
if (isForOf) {
|
||||
this.tokenContext |= _index.TokenContext.forOfHead;
|
||||
return null;
|
||||
} else {
|
||||
this.tokenContext |= _index.TokenContext.forInHead | _index.TokenContext.forInOrInitHeadAccumulate;
|
||||
return () => this.tokenContext = _index.TokenContext.normal;
|
||||
}
|
||||
}
|
||||
enterDelimited() {
|
||||
const oldTokenContext = this.tokenContext;
|
||||
const oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
|
||||
if (oldNoLineTerminatorAfterNode !== null) {
|
||||
this._noLineTerminatorAfterNode = null;
|
||||
if (!(oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) && oldNoLineTerminatorAfterNode === null) {
|
||||
return () => {};
|
||||
}
|
||||
return oldNoLineTerminatorAfterNode;
|
||||
this._noLineTerminatorAfterNode = null;
|
||||
this.tokenContext = _index.TokenContext.normal;
|
||||
return () => {
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
this.tokenContext = oldTokenContext;
|
||||
};
|
||||
}
|
||||
generate(ast) {
|
||||
if (this.format.preserveFormat) {
|
||||
this.tokenMap = new _tokenMap.TokenMap(ast, this._tokens, this._originalCode);
|
||||
this._boundGetRawIdentifier = _types2._getRawIdentifier.bind(this);
|
||||
}
|
||||
this.print(ast);
|
||||
this._maybeAddAuxComment();
|
||||
return this._buf.get();
|
||||
}
|
||||
indent(flags = this._flags) {
|
||||
if (flags & (1 | 2 | 4)) {
|
||||
indent() {
|
||||
const {
|
||||
format
|
||||
} = this;
|
||||
if (format.preserveFormat || format.compact || format.concise) {
|
||||
return;
|
||||
}
|
||||
this._indent += this._indentRepeat;
|
||||
this._indent++;
|
||||
}
|
||||
dedent(flags = this._flags) {
|
||||
if (flags & (1 | 2 | 4)) {
|
||||
dedent() {
|
||||
const {
|
||||
format
|
||||
} = this;
|
||||
if (format.preserveFormat || format.compact || format.concise) {
|
||||
return;
|
||||
}
|
||||
this._indent -= this._indentRepeat;
|
||||
this._indent--;
|
||||
}
|
||||
semicolon(force = false) {
|
||||
const flags = this._flags;
|
||||
if (flags & 32) {
|
||||
this._maybeAddAuxComment();
|
||||
this._maybeAddAuxComment();
|
||||
if (force) {
|
||||
this._appendChar(59);
|
||||
this._noLineTerminator = false;
|
||||
return;
|
||||
}
|
||||
if (flags & 1) {
|
||||
if (this.tokenMap) {
|
||||
const node = this._currentNode;
|
||||
if (node.start != null && node.end != null) {
|
||||
if (!this.tokenMap.endMatches(node, ";")) {
|
||||
@@ -122,11 +129,7 @@ class Printer {
|
||||
this._catchUpTo(this._tokens[indexes[indexes.length - 1]].loc.start);
|
||||
}
|
||||
}
|
||||
if (force) {
|
||||
this._appendChar(59);
|
||||
} else {
|
||||
this._queue(59);
|
||||
}
|
||||
this._queue(59);
|
||||
this._noLineTerminator = false;
|
||||
}
|
||||
rightBrace(node) {
|
||||
@@ -141,14 +144,15 @@ class Printer {
|
||||
this.tokenChar(41);
|
||||
}
|
||||
space(force = false) {
|
||||
if (this._flags & (1 | 2)) {
|
||||
return;
|
||||
}
|
||||
const {
|
||||
format
|
||||
} = this;
|
||||
if (format.compact || format.preserveFormat) return;
|
||||
if (force) {
|
||||
this._space();
|
||||
} else {
|
||||
const lastCp = this.getLastChar(true);
|
||||
if (lastCp !== 0 && lastCp !== 32 && lastCp !== 10) {
|
||||
} else if (this._buf.hasContent()) {
|
||||
const lastCp = this.getLastChar();
|
||||
if (lastCp !== 32 && lastCp !== 10) {
|
||||
this._space();
|
||||
}
|
||||
}
|
||||
@@ -156,17 +160,13 @@ class Printer {
|
||||
word(str, noLineTerminatorAfter = false) {
|
||||
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
|
||||
this._maybePrintInnerComments(str);
|
||||
const flags = this._flags;
|
||||
if (flags & 32) {
|
||||
this._maybeAddAuxComment();
|
||||
}
|
||||
if (flags & 1) this._catchUpToCurrentToken(str);
|
||||
const lastChar = this.getLastChar();
|
||||
if (lastChar === -2 || lastChar === -3 || lastChar === 47 && str.charCodeAt(0) === 47) {
|
||||
this._maybeAddAuxComment();
|
||||
if (this.tokenMap) this._catchUpToCurrentToken(str);
|
||||
if (this._endsWithWord || this._endsWithDiv && str.charCodeAt(0) === 47) {
|
||||
this._space();
|
||||
}
|
||||
this._append(str, false);
|
||||
this.setLastChar(-3);
|
||||
this._endsWithWord = true;
|
||||
this._noLineTerminator = noLineTerminatorAfter;
|
||||
}
|
||||
number(str, number) {
|
||||
@@ -178,68 +178,61 @@ class Printer {
|
||||
return false;
|
||||
}
|
||||
this.word(str);
|
||||
if (Number.isInteger(number) && !isNonDecimalLiteral(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46) {
|
||||
this.setLastChar(-2);
|
||||
}
|
||||
this._endsWithInteger = Number.isInteger(number) && !isNonDecimalLiteral(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46;
|
||||
}
|
||||
token(str, maybeNewline = false, occurrenceCount = 0, mayNeedSpace = false) {
|
||||
token(str, maybeNewline = false, occurrenceCount = 0) {
|
||||
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
|
||||
this._maybePrintInnerComments(str, occurrenceCount);
|
||||
const flags = this._flags;
|
||||
if (flags & 32) {
|
||||
this._maybeAddAuxComment();
|
||||
}
|
||||
if (flags & 1) {
|
||||
this._catchUpToCurrentToken(str, occurrenceCount);
|
||||
}
|
||||
if (mayNeedSpace) {
|
||||
const strFirst = str.charCodeAt(0);
|
||||
if ((strFirst === 45 && str === "--" || strFirst === 61) && this.getLastChar() === 33 || strFirst === 43 && this.getLastChar() === 43 || strFirst === 45 && this.getLastChar() === 45 || strFirst === 46 && this.getLastChar() === -2) {
|
||||
this._space();
|
||||
}
|
||||
this._maybeAddAuxComment();
|
||||
if (this.tokenMap) this._catchUpToCurrentToken(str, occurrenceCount);
|
||||
const lastChar = this.getLastChar();
|
||||
const strFirst = str.charCodeAt(0);
|
||||
if (lastChar === 33 && (str === "--" || strFirst === 61) || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) {
|
||||
this._space();
|
||||
}
|
||||
this._append(str, maybeNewline);
|
||||
this._noLineTerminator = false;
|
||||
}
|
||||
tokenChar(char, occurrenceCount = 0) {
|
||||
tokenChar(char) {
|
||||
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
|
||||
this._maybePrintInnerComments(char, occurrenceCount);
|
||||
const flags = this._flags;
|
||||
if (flags & 32) {
|
||||
this._maybeAddAuxComment();
|
||||
}
|
||||
if (flags & 1) {
|
||||
this._catchUpToCurrentToken(char, occurrenceCount);
|
||||
}
|
||||
if (char === 43 && this.getLastChar() === 43 || char === 45 && this.getLastChar() === 45 || char === 46 && this.getLastChar() === -2) {
|
||||
const str = String.fromCharCode(char);
|
||||
this._maybePrintInnerComments(str);
|
||||
this._maybeAddAuxComment();
|
||||
if (this.tokenMap) this._catchUpToCurrentToken(str);
|
||||
const lastChar = this.getLastChar();
|
||||
if (char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || char === 46 && this._endsWithInteger) {
|
||||
this._space();
|
||||
}
|
||||
this._appendChar(char);
|
||||
this._noLineTerminator = false;
|
||||
}
|
||||
newline(i = 1, flags = this._flags) {
|
||||
newline(i = 1, force) {
|
||||
if (i <= 0) return;
|
||||
if (flags & (8 | 2)) {
|
||||
return;
|
||||
}
|
||||
if (flags & 4) {
|
||||
this.space();
|
||||
return;
|
||||
if (!force) {
|
||||
if (this.format.retainLines || this.format.compact) return;
|
||||
if (this.format.concise) {
|
||||
this.space();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (i > 2) i = 2;
|
||||
i -= this._buf.getNewlineCount();
|
||||
for (let j = 0; j < i; j++) {
|
||||
this._newline();
|
||||
}
|
||||
return;
|
||||
}
|
||||
endsWith(char) {
|
||||
return this.getLastChar(true) === char;
|
||||
return this.getLastChar() === char;
|
||||
}
|
||||
getLastChar(checkQueue) {
|
||||
return this._buf.getLastChar(checkQueue);
|
||||
getLastChar() {
|
||||
return this._buf.getLastChar();
|
||||
}
|
||||
setLastChar(char) {
|
||||
this._buf._last = char;
|
||||
endsWithCharAndNewline() {
|
||||
return this._buf.endsWithCharAndNewline();
|
||||
}
|
||||
removeTrailingNewline() {
|
||||
this._buf.removeTrailingNewline();
|
||||
}
|
||||
exactSource(loc, cb) {
|
||||
if (!loc) {
|
||||
@@ -269,40 +262,49 @@ class Printer {
|
||||
this._queue(32);
|
||||
}
|
||||
_newline() {
|
||||
if (this._buf._queuedChar === 32) this._buf._queuedChar = 0;
|
||||
this._appendChar(10, true);
|
||||
this._queue(10);
|
||||
}
|
||||
_catchUpToCurrentToken(str, occurrenceCount = 0) {
|
||||
const token = this.tokenMap.findMatching(this._currentNode, str, occurrenceCount);
|
||||
if (token) this._catchUpTo(token.loc.start);
|
||||
if (this._printSemicolonBeforeNextToken !== -1 && this._printSemicolonBeforeNextToken === this._buf.getCurrentLine()) {
|
||||
this._appendChar(59, true);
|
||||
this._buf.appendChar(59);
|
||||
this._endsWithWord = false;
|
||||
this._endsWithInteger = false;
|
||||
this._endsWithDiv = false;
|
||||
}
|
||||
this._printSemicolonBeforeNextToken = -1;
|
||||
this._printSemicolonBeforeNextNode = -1;
|
||||
}
|
||||
_append(str, maybeNewline) {
|
||||
this._maybeIndent();
|
||||
this._maybeIndent(str.charCodeAt(0));
|
||||
this._buf.append(str, maybeNewline);
|
||||
this._endsWithWord = false;
|
||||
this._endsWithInteger = false;
|
||||
this._endsWithDiv = false;
|
||||
}
|
||||
_appendChar(char, noIndent) {
|
||||
if (!noIndent) {
|
||||
this._maybeIndent();
|
||||
}
|
||||
_appendChar(char) {
|
||||
this._maybeIndent(char);
|
||||
this._buf.appendChar(char);
|
||||
this._endsWithWord = false;
|
||||
this._endsWithInteger = false;
|
||||
this._endsWithDiv = false;
|
||||
}
|
||||
_queue(char) {
|
||||
this._maybeIndent(char);
|
||||
this._buf.queue(char);
|
||||
this.setLastChar(-1);
|
||||
this._endsWithWord = false;
|
||||
this._endsWithInteger = false;
|
||||
}
|
||||
_maybeIndent() {
|
||||
const indent = this._shouldIndent();
|
||||
if (indent > 0) {
|
||||
this._buf._appendChar(-1, indent, false);
|
||||
_maybeIndent(firstChar) {
|
||||
if (this._indent && firstChar !== 10 && this.endsWith(10)) {
|
||||
this._buf.queueIndentation(this._getIndent());
|
||||
}
|
||||
}
|
||||
_shouldIndent() {
|
||||
return this.endsWith(10) ? this._indent : 0;
|
||||
_shouldIndent(firstChar) {
|
||||
if (this._indent && firstChar !== 10 && this.endsWith(10)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catchUp(line) {
|
||||
if (!this.format.retainLines) return;
|
||||
@@ -312,9 +314,11 @@ class Printer {
|
||||
}
|
||||
}
|
||||
_catchUp(prop, loc) {
|
||||
const flags = this._flags;
|
||||
if ((flags & 1) === 0) {
|
||||
if (flags & 8 && loc != null && loc[prop]) {
|
||||
const {
|
||||
format
|
||||
} = this;
|
||||
if (!format.preserveFormat) {
|
||||
if (format.retainLines && loc != null && loc[prop]) {
|
||||
this.catchUp(loc[prop].line);
|
||||
}
|
||||
return;
|
||||
@@ -337,82 +341,65 @@ class Printer {
|
||||
const spacesCount = count > 0 ? column : column - this._buf.getCurrentColumn();
|
||||
if (spacesCount > 0) {
|
||||
const spaces = this._originalCode ? this._originalCode.slice(index - spacesCount, index).replace(/[^\t\x0B\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]/gu, " ") : " ".repeat(spacesCount);
|
||||
this._buf.append(spaces, false, true);
|
||||
this._buf.setSourcePosition(line, column);
|
||||
this.setLastChar(32);
|
||||
this._append(spaces, false);
|
||||
}
|
||||
}
|
||||
_getIndent() {
|
||||
return this._indentRepeat * this._indent;
|
||||
}
|
||||
printTerminatorless(node) {
|
||||
this._noLineTerminator = true;
|
||||
this.print(node);
|
||||
}
|
||||
print(node, noLineTerminatorAfter = false, resetTokenContext = false, trailingCommentsLineOffset) {
|
||||
var _node$leadingComments, _node$leadingComments2;
|
||||
print(node, noLineTerminatorAfter = false, trailingCommentsLineOffset) {
|
||||
var _node$extra, _node$leadingComments, _node$leadingComments2;
|
||||
if (!node) return;
|
||||
this._innerCommentsState = 0;
|
||||
const {
|
||||
type,
|
||||
loc,
|
||||
extra
|
||||
} = node;
|
||||
const flags = this._flags;
|
||||
let changedFlags = false;
|
||||
this._endsWithInnerRaw = false;
|
||||
const nodeType = node.type;
|
||||
const format = this.format;
|
||||
const oldConcise = format.concise;
|
||||
if (node._compact) {
|
||||
this._flags |= 4;
|
||||
changedFlags = true;
|
||||
format.concise = true;
|
||||
}
|
||||
const nodeInfo = _nodes.generatorInfosMap.get(type);
|
||||
if (nodeInfo === undefined) {
|
||||
throw new ReferenceError(`unknown node of type ${JSON.stringify(type)} with constructor ${JSON.stringify(node.constructor.name)}`);
|
||||
const printMethod = this[nodeType];
|
||||
if (printMethod === undefined) {
|
||||
throw new ReferenceError(`unknown node of type ${JSON.stringify(nodeType)} with constructor ${JSON.stringify(node.constructor.name)}`);
|
||||
}
|
||||
const [printMethod, nodeId, needsParens] = nodeInfo;
|
||||
const parent = this._currentNode;
|
||||
const parentId = this._currentTypeId;
|
||||
this._currentNode = node;
|
||||
this._currentTypeId = nodeId;
|
||||
if (flags & 1) {
|
||||
if (this.tokenMap) {
|
||||
this._printSemicolonBeforeNextToken = this._printSemicolonBeforeNextNode;
|
||||
}
|
||||
let oldInAux;
|
||||
if (flags & 32) {
|
||||
oldInAux = this._insideAux;
|
||||
this._insideAux = loc == null;
|
||||
this._maybeAddAuxComment(this._insideAux && !oldInAux);
|
||||
}
|
||||
let oldTokenContext = 0;
|
||||
if (resetTokenContext) {
|
||||
oldTokenContext = this.tokenContext;
|
||||
if (oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) {
|
||||
this.tokenContext = 0;
|
||||
} else {
|
||||
oldTokenContext = 0;
|
||||
}
|
||||
}
|
||||
const parenthesized = extra != null && extra.parenthesized;
|
||||
let shouldPrintParens = parenthesized && flags & 1 || parenthesized && flags & 16 && nodeId === 71 || parent && ((0, _index.parentNeedsParens)(node, parent, parentId) || needsParens != null && needsParens(node, parent, parentId, this.tokenContext, flags & 1 ? this._boundGetRawIdentifier : undefined));
|
||||
const oldInAux = this._insideAux;
|
||||
this._insideAux = node.loc == null;
|
||||
this._maybeAddAuxComment(this._insideAux && !oldInAux);
|
||||
const parenthesized = (_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized;
|
||||
let shouldPrintParens = parenthesized && format.preserveFormat || parenthesized && format.retainFunctionParens && nodeType === "FunctionExpression" || needsParens(node, parent, this.tokenContext, format.preserveFormat ? this._boundGetRawIdentifier : undefined);
|
||||
if (!shouldPrintParens && parenthesized && (_node$leadingComments = node.leadingComments) != null && _node$leadingComments.length && node.leadingComments[0].type === "CommentBlock") {
|
||||
switch (parentId) {
|
||||
case 65:
|
||||
case 243:
|
||||
case 6:
|
||||
case 143:
|
||||
const parentType = parent == null ? void 0 : parent.type;
|
||||
switch (parentType) {
|
||||
case "ExpressionStatement":
|
||||
case "VariableDeclarator":
|
||||
case "AssignmentExpression":
|
||||
case "ReturnStatement":
|
||||
break;
|
||||
case 17:
|
||||
case 130:
|
||||
case 112:
|
||||
case "CallExpression":
|
||||
case "OptionalCallExpression":
|
||||
case "NewExpression":
|
||||
if (parent.callee !== node) break;
|
||||
default:
|
||||
shouldPrintParens = true;
|
||||
}
|
||||
}
|
||||
let indentParenthesized = false;
|
||||
if (!shouldPrintParens && this._noLineTerminator && ((_node$leadingComments2 = node.leadingComments) != null && _node$leadingComments2.some(commentIsNewline) || flags & 8 && loc && loc.start.line > this._buf.getCurrentLine())) {
|
||||
if (!shouldPrintParens && this._noLineTerminator && ((_node$leadingComments2 = node.leadingComments) != null && _node$leadingComments2.some(commentIsNewline) || this.format.retainLines && node.loc && node.loc.start.line > this._buf.getCurrentLine())) {
|
||||
shouldPrintParens = true;
|
||||
indentParenthesized = true;
|
||||
}
|
||||
let oldNoLineTerminatorAfterNode;
|
||||
let oldTokenContext;
|
||||
if (!shouldPrintParens) {
|
||||
noLineTerminatorAfter || (noLineTerminatorAfter = !!parent && this._noLineTerminatorAfterNode === parent && (0, _index.isLastChild)(parent, node));
|
||||
noLineTerminatorAfter || (noLineTerminatorAfter = !!parent && this._noLineTerminatorAfterNode === parent && n.isLastChild(parent, node));
|
||||
if (noLineTerminatorAfter) {
|
||||
var _node$trailingComment;
|
||||
if ((_node$trailingComment = node.trailingComments) != null && _node$trailingComment.some(commentIsNewline)) {
|
||||
@@ -426,18 +413,18 @@ class Printer {
|
||||
if (shouldPrintParens) {
|
||||
this.tokenChar(40);
|
||||
if (indentParenthesized) this.indent();
|
||||
this._innerCommentsState = 0;
|
||||
if (!resetTokenContext) {
|
||||
this._endsWithInnerRaw = false;
|
||||
if (this.tokenContext & _index.TokenContext.forInOrInitHeadAccumulate) {
|
||||
oldTokenContext = this.tokenContext;
|
||||
}
|
||||
if (oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) {
|
||||
this.tokenContext = 0;
|
||||
this.tokenContext = _index.TokenContext.normal;
|
||||
}
|
||||
oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
|
||||
this._noLineTerminatorAfterNode = null;
|
||||
}
|
||||
this._lastCommentLine = 0;
|
||||
this._printLeadingComments(node, parent);
|
||||
this.exactSource(nodeId === 139 || nodeId === 66 ? null : loc, printMethod.bind(this, node, parent));
|
||||
const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc;
|
||||
this.exactSource(loc, printMethod.bind(this, node, parent));
|
||||
if (shouldPrintParens) {
|
||||
this._printTrailingComments(node, parent);
|
||||
if (indentParenthesized) {
|
||||
@@ -446,25 +433,20 @@ class Printer {
|
||||
}
|
||||
this.tokenChar(41);
|
||||
this._noLineTerminator = noLineTerminatorAfter;
|
||||
if (oldTokenContext) this.tokenContext = oldTokenContext;
|
||||
} else if (noLineTerminatorAfter && !this._noLineTerminator) {
|
||||
this._noLineTerminator = true;
|
||||
this._printTrailingComments(node, parent);
|
||||
} else {
|
||||
this._printTrailingComments(node, parent, trailingCommentsLineOffset);
|
||||
}
|
||||
if (oldTokenContext) this.tokenContext = oldTokenContext;
|
||||
this._currentNode = parent;
|
||||
this._currentTypeId = parentId;
|
||||
if (changedFlags) {
|
||||
this._flags = flags;
|
||||
}
|
||||
if (flags & 32) {
|
||||
this._insideAux = oldInAux;
|
||||
}
|
||||
if (oldNoLineTerminatorAfterNode != null) {
|
||||
format.concise = oldConcise;
|
||||
this._insideAux = oldInAux;
|
||||
if (oldNoLineTerminatorAfterNode !== undefined) {
|
||||
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
|
||||
}
|
||||
this._innerCommentsState = 0;
|
||||
this._endsWithInnerRaw = false;
|
||||
}
|
||||
_maybeAddAuxComment(enteredPositionlessNode) {
|
||||
if (enteredPositionlessNode) this._printAuxBeforeComment();
|
||||
@@ -498,46 +480,46 @@ class Printer {
|
||||
return extra.raw;
|
||||
}
|
||||
}
|
||||
printJoin(nodes, statement, indent, separator, printTrailingSeparator, resetTokenContext, trailingCommentsLineOffset) {
|
||||
printJoin(nodes, statement, indent, separator, printTrailingSeparator, iterator, trailingCommentsLineOffset) {
|
||||
if (!(nodes != null && nodes.length)) return;
|
||||
const flags = this._flags;
|
||||
if (indent == null && flags & 8) {
|
||||
if (indent == null && this.format.retainLines) {
|
||||
var _nodes$0$loc;
|
||||
const startLine = (_nodes$0$loc = nodes[0].loc) == null ? void 0 : _nodes$0$loc.start.line;
|
||||
if (startLine != null && startLine !== this._buf.getCurrentLine()) {
|
||||
indent = true;
|
||||
}
|
||||
}
|
||||
if (indent) this.indent(flags);
|
||||
if (indent) this.indent();
|
||||
const newlineOpts = {
|
||||
nextNodeStartLine: 0
|
||||
};
|
||||
const boundSeparator = separator == null ? void 0 : separator.bind(this);
|
||||
const len = nodes.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
const node = nodes[i];
|
||||
if (!node) continue;
|
||||
if (statement && i === 0 && this._buf.hasContent()) {
|
||||
this.newline(1, flags);
|
||||
}
|
||||
this.print(node, false, resetTokenContext, trailingCommentsLineOffset || 0);
|
||||
if (separator != null) {
|
||||
if (i < len - 1) separator.call(this, i, false);else if (printTrailingSeparator) separator.call(this, i, true);
|
||||
if (statement) this._printNewline(i === 0, newlineOpts);
|
||||
this.print(node, undefined, trailingCommentsLineOffset || 0);
|
||||
iterator == null || iterator(node, i);
|
||||
if (boundSeparator != null) {
|
||||
if (i < len - 1) boundSeparator(i, false);else if (printTrailingSeparator) boundSeparator(i, true);
|
||||
}
|
||||
if (statement) {
|
||||
var _node$trailingComment2;
|
||||
if (!((_node$trailingComment2 = node.trailingComments) != null && _node$trailingComment2.length)) {
|
||||
this._lastCommentLine = 0;
|
||||
}
|
||||
if (i + 1 === len) {
|
||||
this.newline(1, flags);
|
||||
this.newline(1);
|
||||
} else {
|
||||
const lastCommentLine = this._lastCommentLine;
|
||||
if (lastCommentLine > 0) {
|
||||
var _nodes$loc;
|
||||
const offset = (((_nodes$loc = nodes[i + 1].loc) == null ? void 0 : _nodes$loc.start.line) || 0) - lastCommentLine;
|
||||
if (offset >= 0) {
|
||||
this.newline(offset || 1, flags);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
this.newline(1, flags);
|
||||
var _nextNode$loc;
|
||||
const nextNode = nodes[i + 1];
|
||||
newlineOpts.nextNodeStartLine = ((_nextNode$loc = nextNode.loc) == null ? void 0 : _nextNode$loc.start.line) || 0;
|
||||
this._printNewline(true, newlineOpts);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (indent) this.dedent(flags);
|
||||
if (indent) this.dedent();
|
||||
}
|
||||
printAndIndentOnComments(node) {
|
||||
const indent = node.leadingComments && node.leadingComments.length > 0;
|
||||
@@ -545,11 +527,12 @@ class Printer {
|
||||
this.print(node);
|
||||
if (indent) this.dedent();
|
||||
}
|
||||
printBlock(body) {
|
||||
if (body.type !== "EmptyStatement") {
|
||||
printBlock(parent) {
|
||||
const node = parent.body;
|
||||
if (node.type !== "EmptyStatement") {
|
||||
this.space();
|
||||
}
|
||||
this.print(body);
|
||||
this.print(node);
|
||||
}
|
||||
_printTrailingComments(node, parent, lineOffset) {
|
||||
const {
|
||||
@@ -561,8 +544,6 @@ class Printer {
|
||||
}
|
||||
if (trailingComments != null && trailingComments.length) {
|
||||
this._printComments(2, trailingComments, node, parent, lineOffset);
|
||||
} else {
|
||||
this._lastCommentLine = 0;
|
||||
}
|
||||
}
|
||||
_printLeadingComments(node, parent) {
|
||||
@@ -571,48 +552,65 @@ class Printer {
|
||||
this._printComments(0, comments, node, parent);
|
||||
}
|
||||
_maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) {
|
||||
var _this$tokenMap;
|
||||
const state = this._innerCommentsState;
|
||||
switch (state & 3) {
|
||||
case 0:
|
||||
this._innerCommentsState = 1 | 4;
|
||||
return;
|
||||
case 1:
|
||||
this.printInnerComments((state & 4) > 0, (_this$tokenMap = this.tokenMap) == null ? void 0 : _this$tokenMap.findMatching(this._currentNode, nextTokenStr, nextTokenOccurrenceCount));
|
||||
if (this._endsWithInnerRaw) {
|
||||
var _this$tokenMap;
|
||||
this.printInnerComments((_this$tokenMap = this.tokenMap) == null ? void 0 : _this$tokenMap.findMatching(this._currentNode, nextTokenStr, nextTokenOccurrenceCount));
|
||||
}
|
||||
this._endsWithInnerRaw = true;
|
||||
this._indentInnerComments = true;
|
||||
}
|
||||
printInnerComments(indent = true, nextToken) {
|
||||
printInnerComments(nextToken) {
|
||||
const node = this._currentNode;
|
||||
const comments = node.innerComments;
|
||||
if (!(comments != null && comments.length)) {
|
||||
this._innerCommentsState = 2;
|
||||
return;
|
||||
}
|
||||
if (!(comments != null && comments.length)) return;
|
||||
const hasSpace = this.endsWith(32);
|
||||
const indent = this._indentInnerComments;
|
||||
const printedCommentsCount = this._printedComments.size;
|
||||
if (indent) this.indent();
|
||||
switch (this._printComments(1, comments, node, undefined, undefined, nextToken)) {
|
||||
case 2:
|
||||
this._innerCommentsState = 2;
|
||||
case 1:
|
||||
if (hasSpace) this.space();
|
||||
this._printComments(1, comments, node, undefined, undefined, nextToken);
|
||||
if (hasSpace && printedCommentsCount !== this._printedComments.size) {
|
||||
this.space();
|
||||
}
|
||||
if (indent) this.dedent();
|
||||
}
|
||||
noIndentInnerCommentsHere() {
|
||||
this._innerCommentsState &= ~4;
|
||||
this._indentInnerComments = false;
|
||||
}
|
||||
printSequence(nodes, indent, resetTokenContext, trailingCommentsLineOffset) {
|
||||
this.printJoin(nodes, true, indent != null ? indent : false, undefined, undefined, resetTokenContext, trailingCommentsLineOffset);
|
||||
printSequence(nodes, indent, trailingCommentsLineOffset) {
|
||||
this.printJoin(nodes, true, indent != null ? indent : false, undefined, undefined, undefined, trailingCommentsLineOffset);
|
||||
}
|
||||
printList(items, printTrailingSeparator, statement, indent, separator, resetTokenContext) {
|
||||
this.printJoin(items, statement, indent, separator != null ? separator : commaSeparator, printTrailingSeparator, resetTokenContext);
|
||||
printList(items, printTrailingSeparator, statement, indent, separator, iterator) {
|
||||
this.printJoin(items, statement, indent, separator != null ? separator : commaSeparator, printTrailingSeparator, iterator);
|
||||
}
|
||||
shouldPrintTrailingComma(listEnd) {
|
||||
if (!this.tokenMap) return null;
|
||||
const listEndIndex = this.tokenMap.findLastIndex(this._currentNode, token => this.tokenMap.matchesOriginal(token, typeof listEnd === "number" ? String.fromCharCode(listEnd) : listEnd));
|
||||
const listEndIndex = this.tokenMap.findLastIndex(this._currentNode, token => this.tokenMap.matchesOriginal(token, listEnd));
|
||||
if (listEndIndex <= 0) return null;
|
||||
return this.tokenMap.matchesOriginal(this._tokens[listEndIndex - 1], ",");
|
||||
}
|
||||
_printNewline(newLine, opts) {
|
||||
const format = this.format;
|
||||
if (format.retainLines || format.compact) return;
|
||||
if (format.concise) {
|
||||
this.space();
|
||||
return;
|
||||
}
|
||||
if (!newLine) {
|
||||
return;
|
||||
}
|
||||
const startLine = opts.nextNodeStartLine;
|
||||
const lastCommentLine = this._lastCommentLine;
|
||||
if (startLine > 0 && lastCommentLine > 0) {
|
||||
const offset = startLine - lastCommentLine;
|
||||
if (offset >= 0) {
|
||||
this.newline(offset || 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this._buf.hasContent()) {
|
||||
this.newline(1);
|
||||
}
|
||||
}
|
||||
_shouldPrintComment(comment, nextToken) {
|
||||
if (comment.ignore) return 0;
|
||||
if (this._printedComments.has(comment)) return 0;
|
||||
@@ -634,19 +632,13 @@ class Printer {
|
||||
_printComment(comment, skipNewLines) {
|
||||
const noLineTerminator = this._noLineTerminator;
|
||||
const isBlockComment = comment.type === "CommentBlock";
|
||||
const printNewLines = isBlockComment && skipNewLines !== 1 && !noLineTerminator;
|
||||
const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator;
|
||||
if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) {
|
||||
this.newline(1);
|
||||
}
|
||||
switch (this.getLastChar(true)) {
|
||||
case 47:
|
||||
this._space();
|
||||
case 91:
|
||||
case 123:
|
||||
case 40:
|
||||
break;
|
||||
default:
|
||||
this.space();
|
||||
const lastCharCode = this.getLastChar();
|
||||
if (lastCharCode !== 91 && lastCharCode !== 123 && lastCharCode !== 40) {
|
||||
this.space();
|
||||
}
|
||||
let val;
|
||||
if (isBlockComment) {
|
||||
@@ -658,12 +650,12 @@ class Printer {
|
||||
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
|
||||
val = val.replace(newlineRegex, "\n");
|
||||
}
|
||||
if (this._flags & 4) {
|
||||
if (this.format.concise) {
|
||||
val = val.replace(/\n(?!$)/g, `\n`);
|
||||
} else {
|
||||
let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn();
|
||||
if (this._shouldIndent() || this.format.retainLines) {
|
||||
indentSize += this._indent;
|
||||
if (this._shouldIndent(47) || this.format.retainLines) {
|
||||
indentSize += this._getIndent();
|
||||
}
|
||||
val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`);
|
||||
}
|
||||
@@ -673,10 +665,24 @@ class Printer {
|
||||
} else {
|
||||
val = `/*${comment.value}*/`;
|
||||
}
|
||||
this.source("start", comment.loc);
|
||||
this._append(val, isBlockComment);
|
||||
if (this._endsWithDiv) this._space();
|
||||
if (this.tokenMap) {
|
||||
const {
|
||||
_printSemicolonBeforeNextToken,
|
||||
_printSemicolonBeforeNextNode
|
||||
} = this;
|
||||
this._printSemicolonBeforeNextToken = -1;
|
||||
this._printSemicolonBeforeNextNode = -1;
|
||||
this.source("start", comment.loc);
|
||||
this._append(val, isBlockComment);
|
||||
this._printSemicolonBeforeNextNode = _printSemicolonBeforeNextNode;
|
||||
this._printSemicolonBeforeNextToken = _printSemicolonBeforeNextToken;
|
||||
} else {
|
||||
this.source("start", comment.loc);
|
||||
this._append(val, isBlockComment);
|
||||
}
|
||||
if (!isBlockComment && !noLineTerminator) {
|
||||
this._newline();
|
||||
this.newline(1, true);
|
||||
}
|
||||
if (printNewLines && skipNewLines !== 3) {
|
||||
this.newline(1);
|
||||
@@ -690,15 +696,13 @@ class Printer {
|
||||
const nodeEndLine = hasLoc ? nodeLoc.end.line : 0;
|
||||
let lastLine = 0;
|
||||
let leadingCommentNewline = 0;
|
||||
const {
|
||||
_noLineTerminator,
|
||||
_flags
|
||||
} = this;
|
||||
const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this);
|
||||
for (let i = 0; i < len; i++) {
|
||||
const comment = comments[i];
|
||||
const shouldPrint = this._shouldPrintComment(comment, nextToken);
|
||||
if (shouldPrint === 2) {
|
||||
return i === 0 ? 0 : 1;
|
||||
hasLoc = false;
|
||||
break;
|
||||
}
|
||||
if (hasLoc && comment.loc && shouldPrint === 1) {
|
||||
const commentStartLine = comment.loc.start.line;
|
||||
@@ -713,37 +717,25 @@ class Printer {
|
||||
offset = commentStartLine - lastLine;
|
||||
}
|
||||
lastLine = commentEndLine;
|
||||
if (offset > 0 && !_noLineTerminator) {
|
||||
this.newline(offset, _flags);
|
||||
}
|
||||
maybeNewline(offset);
|
||||
this._printComment(comment, 1);
|
||||
if (i + 1 === len) {
|
||||
const count = Math.max(nodeStartLine - lastLine, leadingCommentNewline);
|
||||
if (count > 0 && !_noLineTerminator) {
|
||||
this.newline(count, _flags);
|
||||
}
|
||||
maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline));
|
||||
lastLine = nodeStartLine;
|
||||
}
|
||||
} else if (type === 1) {
|
||||
const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine);
|
||||
lastLine = commentEndLine;
|
||||
if (offset > 0 && !_noLineTerminator) {
|
||||
this.newline(offset, _flags);
|
||||
}
|
||||
maybeNewline(offset);
|
||||
this._printComment(comment, 1);
|
||||
if (i + 1 === len) {
|
||||
const count = Math.min(1, nodeEndLine - lastLine);
|
||||
if (count > 0 && !_noLineTerminator) {
|
||||
this.newline(count, _flags);
|
||||
}
|
||||
maybeNewline(Math.min(1, nodeEndLine - lastLine));
|
||||
lastLine = nodeEndLine;
|
||||
}
|
||||
} else {
|
||||
const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine);
|
||||
lastLine = commentEndLine;
|
||||
if (offset > 0 && !_noLineTerminator) {
|
||||
this.newline(offset, _flags);
|
||||
}
|
||||
maybeNewline(offset);
|
||||
this._printComment(comment, 1);
|
||||
}
|
||||
} else {
|
||||
@@ -755,7 +747,9 @@ class Printer {
|
||||
const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value);
|
||||
const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumMember(node);
|
||||
if (type === 0) {
|
||||
this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent) && parent.body === node ? 1 : 0);
|
||||
this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, {
|
||||
body: node
|
||||
}) ? 1 : 0);
|
||||
} else if (shouldSkipNewline && type === 2) {
|
||||
this._printComment(comment, 1);
|
||||
} else {
|
||||
@@ -771,12 +765,15 @@ class Printer {
|
||||
if (type === 2 && hasLoc && lastLine) {
|
||||
this._lastCommentLine = lastLine;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
Object.assign(Printer.prototype, generatorFunctions);
|
||||
{
|
||||
(0, _deprecated.addDeprecatedGenerators)(Printer);
|
||||
}
|
||||
var _default = exports.default = Printer;
|
||||
function commaSeparator(occurrenceCount, last) {
|
||||
this.tokenChar(44, occurrenceCount);
|
||||
this.token(",", false, occurrenceCount);
|
||||
if (!last) this.space();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-3
@@ -58,9 +58,7 @@ class SourceMap {
|
||||
line,
|
||||
column: column
|
||||
});
|
||||
if (originalMapping.name && (identifierNamePos || identifierName != null && originalMapping.column === column)) {
|
||||
identifierName = originalMapping.name;
|
||||
} else if (identifierNamePos) {
|
||||
if (!originalMapping.name && identifierNamePos) {
|
||||
const originalIdentifierMapping = (0, _traceMapping.originalPositionFor)(this._inputMap, identifierNamePos);
|
||||
if (originalIdentifierMapping.name) {
|
||||
identifierName = originalIdentifierMapping.name;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+2
-6
@@ -55,14 +55,11 @@ class TokenMap {
|
||||
findMatching(node, test, occurrenceCount = 0) {
|
||||
const indexes = this._nodesToTokenIndexes.get(node);
|
||||
if (indexes) {
|
||||
if (typeof test === "number") {
|
||||
test = String.fromCharCode(test);
|
||||
}
|
||||
let i = 0;
|
||||
const count = occurrenceCount;
|
||||
if (count > 1) {
|
||||
const cache = this._nodesOccurrencesCountCache.get(node);
|
||||
if ((cache == null ? void 0 : cache.test) === test && cache.count < count) {
|
||||
if (cache && cache.test === test && cache.count < count) {
|
||||
i = cache.i + 1;
|
||||
occurrenceCount -= cache.count + 1;
|
||||
}
|
||||
@@ -106,7 +103,6 @@ class TokenMap {
|
||||
return this.matchesOriginal(tok, test);
|
||||
}
|
||||
_getTokensIndexesOfNode(node) {
|
||||
var _node$declaration;
|
||||
if (node.start == null || node.end == null) return [];
|
||||
const {
|
||||
first,
|
||||
@@ -114,7 +110,7 @@ class TokenMap {
|
||||
} = this._findTokensOfNode(node, 0, this._tokens.length - 1);
|
||||
let low = first;
|
||||
const children = childrenIterator(node);
|
||||
if ((node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") && ((_node$declaration = node.declaration) == null ? void 0 : _node$declaration.type) === "ClassDeclaration") {
|
||||
if ((node.type === "ExportNamedDeclaration" || node.type === "ExportDefaultDeclaration") && node.declaration && node.declaration.type === "ClassDeclaration") {
|
||||
children.next();
|
||||
}
|
||||
const indexes = [];
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+6
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/generator",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.5",
|
||||
"description": "Turns an AST into code.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
@@ -19,16 +19,16 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.29.7",
|
||||
"@babel/types": "^7.29.7",
|
||||
"@babel/parser": "^7.28.5",
|
||||
"@babel/types": "^7.28.5",
|
||||
"@jridgewell/gen-mapping": "^0.3.12",
|
||||
"@jridgewell/trace-mapping": "^0.3.28",
|
||||
"jsesc": "^3.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.29.7",
|
||||
"@babel/helper-fixtures": "^7.29.7",
|
||||
"@babel/plugin-transform-typescript": "^7.29.7",
|
||||
"@babel/core": "^7.28.5",
|
||||
"@babel/helper-fixtures": "^7.28.0",
|
||||
"@babel/plugin-transform-typescript": "^7.28.5",
|
||||
"@jridgewell/sourcemap-codec": "^1.5.3",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_semver","require","_pretty","_utils","getInclusionReasons","item","targetVersions","list","minVersions","Object","keys","reduce","result","env","minVersion","getLowestImplementedVersion","targetVersion","prettifyVersion","minIsUnreleased","isUnreleasedVersion","targetIsUnreleased","semver","lt","toString","semverify"],"sources":["../src/debug.ts"],"sourcesContent":["import semver from \"semver\";\nimport { prettifyVersion } from \"./pretty.ts\";\nimport {\n semverify,\n isUnreleasedVersion,\n getLowestImplementedVersion,\n} from \"./utils.ts\";\nimport type { Target, Targets } from \"./types.ts\";\n\nexport function getInclusionReasons(\n item: string,\n targetVersions: Targets,\n list: Record<string, Targets>,\n) {\n const minVersions = list[item] || {};\n\n return (Object.keys(targetVersions) as Target[]).reduce(\n (result, env) => {\n const minVersion = getLowestImplementedVersion(minVersions, env);\n const targetVersion = targetVersions[env];\n\n if (!minVersion) {\n result[env] = prettifyVersion(targetVersion);\n } else {\n const minIsUnreleased = isUnreleasedVersion(minVersion, env);\n const targetIsUnreleased = isUnreleasedVersion(targetVersion, env);\n\n if (\n !targetIsUnreleased &&\n (minIsUnreleased ||\n semver.lt(targetVersion.toString(), semverify(minVersion)))\n ) {\n result[env] = prettifyVersion(targetVersion);\n }\n }\n\n return result;\n },\n {} as Partial<Record<Target, string>>,\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,SAASG,mBAAmBA,CACjCC,IAAY,EACZC,cAAuB,EACvBC,IAA6B,EAC7B;EACA,MAAMC,WAAW,GAAGD,IAAI,CAACF,IAAI,CAAC,IAAI,CAAC,CAAC;EAEpC,OAAQI,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAAcK,MAAM,CACrD,CAACC,MAAM,EAAEC,GAAG,KAAK;IACf,MAAMC,UAAU,GAAG,IAAAC,kCAA2B,EAACP,WAAW,EAAEK,GAAG,CAAC;IAChE,MAAMG,aAAa,GAAGV,cAAc,CAACO,GAAG,CAAC;IAEzC,IAAI,CAACC,UAAU,EAAE;MACfF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;IAC9C,CAAC,MAAM;MACL,MAAME,eAAe,GAAG,IAAAC,0BAAmB,EAACL,UAAU,EAAED,GAAG,CAAC;MAC5D,MAAMO,kBAAkB,GAAG,IAAAD,0BAAmB,EAACH,aAAa,EAAEH,GAAG,CAAC;MAElE,IACE,CAACO,kBAAkB,KAClBF,eAAe,IACdG,OAAM,CAACC,EAAE,CAACN,aAAa,CAACO,QAAQ,CAAC,CAAC,EAAE,IAAAC,gBAAS,EAACV,UAAU,CAAC,CAAC,CAAC,EAC7D;QACAF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;MAC9C;IACF;IAEA,OAAOJ,MAAM;EACf,CAAC,EACD,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
||||
{"version":3,"names":["_semver","require","_pretty","_utils","getInclusionReasons","item","targetVersions","list","minVersions","Object","keys","reduce","result","env","minVersion","getLowestImplementedVersion","targetVersion","prettifyVersion","minIsUnreleased","isUnreleasedVersion","targetIsUnreleased","semver","lt","toString","semverify"],"sources":["../src/debug.ts"],"sourcesContent":["import semver from \"semver\";\nimport { prettifyVersion } from \"./pretty.ts\";\nimport {\n semverify,\n isUnreleasedVersion,\n getLowestImplementedVersion,\n} from \"./utils.ts\";\nimport type { Target, Targets } from \"./types.ts\";\n\nexport function getInclusionReasons(\n item: string,\n targetVersions: Targets,\n list: { [key: string]: Targets },\n) {\n const minVersions = list[item] || {};\n\n return (Object.keys(targetVersions) as Target[]).reduce(\n (result, env) => {\n const minVersion = getLowestImplementedVersion(minVersions, env);\n const targetVersion = targetVersions[env];\n\n if (!minVersion) {\n result[env] = prettifyVersion(targetVersion);\n } else {\n const minIsUnreleased = isUnreleasedVersion(minVersion, env);\n const targetIsUnreleased = isUnreleasedVersion(targetVersion, env);\n\n if (\n !targetIsUnreleased &&\n (minIsUnreleased ||\n semver.lt(targetVersion.toString(), semverify(minVersion)))\n ) {\n result[env] = prettifyVersion(targetVersion);\n }\n }\n\n return result;\n },\n {} as Partial<Record<Target, string>>,\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAOO,SAASG,mBAAmBA,CACjCC,IAAY,EACZC,cAAuB,EACvBC,IAAgC,EAChC;EACA,MAAMC,WAAW,GAAGD,IAAI,CAACF,IAAI,CAAC,IAAI,CAAC,CAAC;EAEpC,OAAQI,MAAM,CAACC,IAAI,CAACJ,cAAc,CAAC,CAAcK,MAAM,CACrD,CAACC,MAAM,EAAEC,GAAG,KAAK;IACf,MAAMC,UAAU,GAAG,IAAAC,kCAA2B,EAACP,WAAW,EAAEK,GAAG,CAAC;IAChE,MAAMG,aAAa,GAAGV,cAAc,CAACO,GAAG,CAAC;IAEzC,IAAI,CAACC,UAAU,EAAE;MACfF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;IAC9C,CAAC,MAAM;MACL,MAAME,eAAe,GAAG,IAAAC,0BAAmB,EAACL,UAAU,EAAED,GAAG,CAAC;MAC5D,MAAMO,kBAAkB,GAAG,IAAAD,0BAAmB,EAACH,aAAa,EAAEH,GAAG,CAAC;MAElE,IACE,CAACO,kBAAkB,KAClBF,eAAe,IACdG,OAAM,CAACC,EAAE,CAACN,aAAa,CAACO,QAAQ,CAAC,CAAC,EAAE,IAAAC,gBAAS,EAACV,UAAU,CAAC,CAAC,CAAC,EAC7D;QACAF,MAAM,CAACC,GAAG,CAAC,GAAG,IAAAI,uBAAe,EAACD,aAAa,CAAC;MAC9C;IACF;IAEA,OAAOJ,MAAM;EACf,CAAC,EACD,CAAC,CACH,CAAC;AACH","ignoreList":[]}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-1
@@ -181,9 +181,12 @@ function getTargets(inputTargets = {}, options = {}) {
|
||||
}
|
||||
}
|
||||
if (browsers == null) {
|
||||
browsers = [];
|
||||
{
|
||||
browsers = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
;
|
||||
if (esmodules && (esmodules !== "intersect" || !((_browsers = browsers) != null && _browsers.length))) {
|
||||
browsers = Object.keys(ESM_SUPPORT).map(browser => `${browser} >= ${ESM_SUPPORT[browser]}`).join(", ");
|
||||
esmodules = false;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-16
@@ -1,16 +1 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*)
|
||||
if command -v cygpath > /dev/null 2>&1; then
|
||||
basedir=`cygpath -w "$basedir"`
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
||||
else
|
||||
exec node "$basedir/../semver/bin/semver.js" "$@"
|
||||
fi
|
||||
../semver/bin/semver.js
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-compilation-targets",
|
||||
"version": "7.29.7",
|
||||
"version": "7.27.2",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"description": "Helper functions on Babel compilation targets",
|
||||
@@ -25,14 +25,14 @@
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/compat-data": "^7.29.7",
|
||||
"@babel/helper-validator-option": "^7.29.7",
|
||||
"@babel/compat-data": "^7.27.2",
|
||||
"@babel/helper-validator-option": "^7.27.1",
|
||||
"browserslist": "^4.24.0",
|
||||
"lru-cache": "^5.1.1",
|
||||
"semver": "^6.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-plugin-test-runner": "^7.29.7",
|
||||
"@babel/helper-plugin-test-runner": "^7.27.1",
|
||||
"@types/lru-cache": "^5.1.1",
|
||||
"@types/semver": "^5.5.0"
|
||||
},
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-globals",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.0",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"description": "A collection of JavaScript globals for Babel internal usage",
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-imports",
|
||||
"version": "7.29.7",
|
||||
"version": "7.27.1",
|
||||
"description": "Babel helper functions for inserting module loads",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-imports",
|
||||
@@ -15,11 +15,11 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.29.7",
|
||||
"@babel/types": "^7.29.7"
|
||||
"@babel/traverse": "^7.27.1",
|
||||
"@babel/types": "^7.27.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.29.7"
|
||||
"@babel/core": "^7.27.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
+6
-4
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
||||
});
|
||||
exports.buildDynamicImport = buildDynamicImport;
|
||||
var _core = require("@babel/core");
|
||||
exports.getDynamicImportSource = function getDynamicImportSource(node) {
|
||||
const [source] = node.arguments;
|
||||
return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``;
|
||||
};
|
||||
{
|
||||
exports.getDynamicImportSource = function getDynamicImportSource(node) {
|
||||
const [source] = node.arguments;
|
||||
return _core.types.isStringLiteral(source) || _core.types.isTemplateLiteral(source) ? source : _core.template.expression.ast`\`\${${source}}\``;
|
||||
};
|
||||
}
|
||||
function buildDynamicImport(node, deferToThen, wrapWithPromise, builder) {
|
||||
const specifier = _core.types.isCallExpression(node) ? node.arguments[0] : node.source;
|
||||
if (_core.types.isStringLiteral(specifier) || _core.types.isTemplateLiteral(specifier) && specifier.quasis.length === 0) {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_core","require","exports","getDynamicImportSource","node","source","arguments","t","isStringLiteral","isTemplateLiteral","template","expression","ast","buildDynamicImport","deferToThen","wrapWithPromise","builder","specifier","isCallExpression","quasis","length","specifierToString","identifier","templateLiteral","templateElement","raw"],"sources":["../src/dynamic-import.ts"],"sourcesContent":["// Heavily inspired by\n// https://github.com/airbnb/babel-plugin-dynamic-import-node/blob/master/src/utils.js\n\nimport { types as t, template } from \"@babel/core\";\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM && !IS_STANDALONE) {\n // eslint-disable-next-line no-restricted-globals\n exports.getDynamicImportSource = function getDynamicImportSource(\n node: t.CallExpression,\n ): t.StringLiteral | t.TemplateLiteral {\n const [source] = node.arguments;\n\n return t.isStringLiteral(source) || t.isTemplateLiteral(source)\n ? source\n : (template.expression.ast`\\`\\${${source}}\\`` as t.TemplateLiteral);\n };\n}\n\nexport function buildDynamicImport(\n node: t.CallExpression | t.ImportExpression,\n deferToThen: boolean,\n wrapWithPromise: boolean,\n builder: (specifier: t.Expression) => t.Expression,\n): t.Expression {\n const specifier = t.isCallExpression(node) ? node.arguments[0] : node.source;\n\n if (\n t.isStringLiteral(specifier) ||\n (t.isTemplateLiteral(specifier) && specifier.quasis.length === 0)\n ) {\n if (deferToThen) {\n return template.expression.ast`\n Promise.resolve().then(() => ${builder(specifier)})\n `;\n } else return builder(specifier);\n }\n\n const specifierToString = t.isTemplateLiteral(specifier)\n ? t.identifier(\"specifier\")\n : t.templateLiteral(\n [t.templateElement({ raw: \"\" }), t.templateElement({ raw: \"\" })],\n [t.identifier(\"specifier\")],\n );\n\n if (deferToThen) {\n return template.expression.ast`\n (specifier =>\n new Promise(r => r(${specifierToString}))\n .then(s => ${builder(t.identifier(\"s\"))})\n )(${specifier})\n `;\n } else if (wrapWithPromise) {\n return template.expression.ast`\n (specifier =>\n new Promise(r => r(${builder(specifierToString)}))\n )(${specifier})\n `;\n } else {\n return template.expression.ast`\n (specifier => ${builder(specifierToString)})(${specifier})\n `;\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIEC,OAAO,CAACC,sBAAsB,GAAG,SAASA,sBAAsBA,CAC9DC,IAAsB,EACe;EACrC,MAAM,CAACC,MAAM,CAAC,GAAGD,IAAI,CAACE,SAAS;EAE/B,OAAOC,WAAC,CAACC,eAAe,CAACH,MAAM,CAAC,IAAIE,WAAC,CAACE,iBAAiB,CAACJ,MAAM,CAAC,GAC3DA,MAAM,GACLK,cAAQ,CAACC,UAAU,CAACC,GAAG,QAAQP,MAAM,KAA2B;AACvE,CAAC;AAGI,SAASQ,kBAAkBA,CAChCT,IAA2C,EAC3CU,WAAoB,EACpBC,eAAwB,EACxBC,OAAkD,EACpC;EACd,MAAMC,SAAS,GAAGV,WAAC,CAACW,gBAAgB,CAACd,IAAI,CAAC,GAAGA,IAAI,CAACE,SAAS,CAAC,CAAC,CAAC,GAAGF,IAAI,CAACC,MAAM;EAE5E,IACEE,WAAC,CAACC,eAAe,CAACS,SAAS,CAAC,IAC3BV,WAAC,CAACE,iBAAiB,CAACQ,SAAS,CAAC,IAAIA,SAAS,CAACE,MAAM,CAACC,MAAM,KAAK,CAAE,EACjE;IACA,IAAIN,WAAW,EAAE;MACf,OAAOJ,cAAQ,CAACC,UAAU,CAACC,GAAG;AACpC,uCAAuCI,OAAO,CAACC,SAAS,CAAC;AACzD,OAAO;IACH,CAAC,MAAM,OAAOD,OAAO,CAACC,SAAS,CAAC;EAClC;EAEA,MAAMI,iBAAiB,GAAGd,WAAC,CAACE,iBAAiB,CAACQ,SAAS,CAAC,GACpDV,WAAC,CAACe,UAAU,CAAC,WAAW,CAAC,GACzBf,WAAC,CAACgB,eAAe,CACf,CAAChB,WAAC,CAACiB,eAAe,CAAC;IAAEC,GAAG,EAAE;EAAG,CAAC,CAAC,EAAElB,WAAC,CAACiB,eAAe,CAAC;IAAEC,GAAG,EAAE;EAAG,CAAC,CAAC,CAAC,EAChE,CAAClB,WAAC,CAACe,UAAU,CAAC,WAAW,CAAC,CAC5B,CAAC;EAEL,IAAIR,WAAW,EAAE;IACf,OAAOJ,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC;AACA,6BAA6BS,iBAAiB;AAC9C,uBAAuBL,OAAO,CAACT,WAAC,CAACe,UAAU,CAAC,GAAG,CAAC,CAAC;AACjD,UAAUL,SAAS;AACnB,KAAK;EACH,CAAC,MAAM,IAAIF,eAAe,EAAE;IAC1B,OAAOL,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC;AACA,6BAA6BI,OAAO,CAACK,iBAAiB,CAAC;AACvD,UAAUJ,SAAS;AACnB,KAAK;EACH,CAAC,MAAM;IACL,OAAOP,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC,sBAAsBI,OAAO,CAACK,iBAAiB,CAAC,KAAKJ,SAAS;AAC9D,KAAK;EACH;AACF","ignoreList":[]}
|
||||
{"version":3,"names":["_core","require","exports","getDynamicImportSource","node","source","arguments","t","isStringLiteral","isTemplateLiteral","template","expression","ast","buildDynamicImport","deferToThen","wrapWithPromise","builder","specifier","isCallExpression","quasis","length","specifierToString","identifier","templateLiteral","templateElement","raw"],"sources":["../src/dynamic-import.ts"],"sourcesContent":["// Heavily inspired by\n// https://github.com/airbnb/babel-plugin-dynamic-import-node/blob/master/src/utils.js\n\nimport { types as t, template } from \"@babel/core\";\n\nif (!process.env.BABEL_8_BREAKING && !USE_ESM && !IS_STANDALONE) {\n // eslint-disable-next-line no-restricted-globals\n exports.getDynamicImportSource = function getDynamicImportSource(\n node: t.CallExpression,\n ): t.StringLiteral | t.TemplateLiteral {\n const [source] = node.arguments;\n\n return t.isStringLiteral(source) || t.isTemplateLiteral(source)\n ? source\n : (template.expression.ast`\\`\\${${source}}\\`` as t.TemplateLiteral);\n };\n}\n\nexport function buildDynamicImport(\n node: t.CallExpression | t.ImportExpression,\n deferToThen: boolean,\n wrapWithPromise: boolean,\n builder: (specifier: t.Expression) => t.Expression,\n): t.Expression {\n const specifier = t.isCallExpression(node) ? node.arguments[0] : node.source;\n\n if (\n t.isStringLiteral(specifier) ||\n (t.isTemplateLiteral(specifier) && specifier.quasis.length === 0)\n ) {\n if (deferToThen) {\n return template.expression.ast`\n Promise.resolve().then(() => ${builder(specifier)})\n `;\n } else return builder(specifier);\n }\n\n const specifierToString = t.isTemplateLiteral(specifier)\n ? t.identifier(\"specifier\")\n : t.templateLiteral(\n [t.templateElement({ raw: \"\" }), t.templateElement({ raw: \"\" })],\n [t.identifier(\"specifier\")],\n );\n\n if (deferToThen) {\n return template.expression.ast`\n (specifier =>\n new Promise(r => r(${specifierToString}))\n .then(s => ${builder(t.identifier(\"s\"))})\n )(${specifier})\n `;\n } else if (wrapWithPromise) {\n return template.expression.ast`\n (specifier =>\n new Promise(r => r(${builder(specifierToString)}))\n )(${specifier})\n `;\n } else {\n return template.expression.ast`\n (specifier => ${builder(specifierToString)})(${specifier})\n `;\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAEiE;EAE/DC,OAAO,CAACC,sBAAsB,GAAG,SAASA,sBAAsBA,CAC9DC,IAAsB,EACe;IACrC,MAAM,CAACC,MAAM,CAAC,GAAGD,IAAI,CAACE,SAAS;IAE/B,OAAOC,WAAC,CAACC,eAAe,CAACH,MAAM,CAAC,IAAIE,WAAC,CAACE,iBAAiB,CAACJ,MAAM,CAAC,GAC3DA,MAAM,GACLK,cAAQ,CAACC,UAAU,CAACC,GAAG,QAAQP,MAAM,KAA2B;EACvE,CAAC;AACH;AAEO,SAASQ,kBAAkBA,CAChCT,IAA2C,EAC3CU,WAAoB,EACpBC,eAAwB,EACxBC,OAAkD,EACpC;EACd,MAAMC,SAAS,GAAGV,WAAC,CAACW,gBAAgB,CAACd,IAAI,CAAC,GAAGA,IAAI,CAACE,SAAS,CAAC,CAAC,CAAC,GAAGF,IAAI,CAACC,MAAM;EAE5E,IACEE,WAAC,CAACC,eAAe,CAACS,SAAS,CAAC,IAC3BV,WAAC,CAACE,iBAAiB,CAACQ,SAAS,CAAC,IAAIA,SAAS,CAACE,MAAM,CAACC,MAAM,KAAK,CAAE,EACjE;IACA,IAAIN,WAAW,EAAE;MACf,OAAOJ,cAAQ,CAACC,UAAU,CAACC,GAAG;AACpC,uCAAuCI,OAAO,CAACC,SAAS,CAAC;AACzD,OAAO;IACH,CAAC,MAAM,OAAOD,OAAO,CAACC,SAAS,CAAC;EAClC;EAEA,MAAMI,iBAAiB,GAAGd,WAAC,CAACE,iBAAiB,CAACQ,SAAS,CAAC,GACpDV,WAAC,CAACe,UAAU,CAAC,WAAW,CAAC,GACzBf,WAAC,CAACgB,eAAe,CACf,CAAChB,WAAC,CAACiB,eAAe,CAAC;IAAEC,GAAG,EAAE;EAAG,CAAC,CAAC,EAAElB,WAAC,CAACiB,eAAe,CAAC;IAAEC,GAAG,EAAE;EAAG,CAAC,CAAC,CAAC,EAChE,CAAClB,WAAC,CAACe,UAAU,CAAC,WAAW,CAAC,CAC5B,CAAC;EAEL,IAAIR,WAAW,EAAE;IACf,OAAOJ,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC;AACA,6BAA6BS,iBAAiB;AAC9C,uBAAuBL,OAAO,CAACT,WAAC,CAACe,UAAU,CAAC,GAAG,CAAC,CAAC;AACjD,UAAUL,SAAS;AACnB,KAAK;EACH,CAAC,MAAM,IAAIF,eAAe,EAAE;IAC1B,OAAOL,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC;AACA,6BAA6BI,OAAO,CAACK,iBAAiB,CAAC;AACvD,UAAUJ,SAAS;AACnB,KAAK;EACH,CAAC,MAAM;IACL,OAAOP,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC,sBAAsBI,OAAO,CAACK,iBAAiB,CAAC,KAAKJ,SAAS;AAC9D,KAAK;EACH;AACF","ignoreList":[]}
|
||||
+12
-10
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = getModuleName;
|
||||
const originalGetModuleName = getModuleName;
|
||||
exports.default = getModuleName = function getModuleName(rootOpts, pluginOpts) {
|
||||
var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo;
|
||||
return originalGetModuleName(rootOpts, {
|
||||
moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId,
|
||||
moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds,
|
||||
getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId,
|
||||
moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
|
||||
});
|
||||
};
|
||||
{
|
||||
const originalGetModuleName = getModuleName;
|
||||
exports.default = getModuleName = function getModuleName(rootOpts, pluginOpts) {
|
||||
var _pluginOpts$moduleId, _pluginOpts$moduleIds, _pluginOpts$getModule, _pluginOpts$moduleRoo;
|
||||
return originalGetModuleName(rootOpts, {
|
||||
moduleId: (_pluginOpts$moduleId = pluginOpts.moduleId) != null ? _pluginOpts$moduleId : rootOpts.moduleId,
|
||||
moduleIds: (_pluginOpts$moduleIds = pluginOpts.moduleIds) != null ? _pluginOpts$moduleIds : rootOpts.moduleIds,
|
||||
getModuleId: (_pluginOpts$getModule = pluginOpts.getModuleId) != null ? _pluginOpts$getModule : rootOpts.getModuleId,
|
||||
moduleRoot: (_pluginOpts$moduleRoo = pluginOpts.moduleRoot) != null ? _pluginOpts$moduleRoo : rootOpts.moduleRoot
|
||||
});
|
||||
};
|
||||
}
|
||||
function getModuleName(rootOpts, pluginOpts) {
|
||||
const {
|
||||
filename,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["originalGetModuleName","getModuleName","exports","default","rootOpts","pluginOpts","_pluginOpts$moduleId","_pluginOpts$moduleIds","_pluginOpts$getModule","_pluginOpts$moduleRoo","moduleId","moduleIds","getModuleId","moduleRoot","filename","filenameRelative","sourceRoot","moduleName","sourceRootReplacer","RegExp","replace"],"sources":["../src/get-module-name.ts"],"sourcesContent":["type RootOptions = {\n filename?: string;\n filenameRelative?: string;\n sourceRoot?: string;\n};\n\nexport type PluginOptions = {\n moduleId?: string;\n moduleIds?: boolean;\n getModuleId?: (moduleName: string) => string | null | undefined;\n moduleRoot?: string;\n};\n\nif (!process.env.BABEL_8_BREAKING) {\n const originalGetModuleName = getModuleName;\n\n // @ts-expect-error TS doesn't like reassigning a function.\n getModuleName = function getModuleName(\n rootOpts: RootOptions & PluginOptions,\n pluginOpts: PluginOptions,\n ): string | null {\n return originalGetModuleName(rootOpts, {\n moduleId: pluginOpts.moduleId ?? rootOpts.moduleId,\n moduleIds: pluginOpts.moduleIds ?? rootOpts.moduleIds,\n getModuleId: pluginOpts.getModuleId ?? rootOpts.getModuleId,\n moduleRoot: pluginOpts.moduleRoot ?? rootOpts.moduleRoot,\n });\n };\n}\n\nexport default function getModuleName(\n rootOpts: RootOptions,\n pluginOpts: PluginOptions,\n): string | null {\n const {\n filename,\n filenameRelative = filename,\n sourceRoot = pluginOpts.moduleRoot,\n } = rootOpts;\n\n const {\n moduleId,\n moduleIds = !!moduleId,\n\n getModuleId,\n\n moduleRoot = sourceRoot,\n } = pluginOpts;\n\n if (!moduleIds) return null;\n\n // moduleId is n/a if a `getModuleId()` is provided\n if (moduleId != null && !getModuleId) {\n return moduleId;\n }\n\n let moduleName = moduleRoot != null ? moduleRoot + \"/\" : \"\";\n\n if (filenameRelative) {\n const sourceRootReplacer =\n sourceRoot != null ? new RegExp(\"^\" + sourceRoot + \"/?\") : \"\";\n\n moduleName += filenameRelative\n // remove sourceRoot from filename\n .replace(sourceRootReplacer, \"\")\n // remove extension\n .replace(/\\.\\w*$/, \"\");\n }\n\n // normalize path separators\n moduleName = moduleName.replace(/\\\\/g, \"/\");\n\n if (getModuleId) {\n // If return is falsy, assume they want us to use our generated default name\n return getModuleId(moduleName) || moduleName;\n } else {\n return moduleName;\n }\n}\n"],"mappings":";;;;;;AAcE,MAAMA,qBAAqB,GAAGC,aAAa;AAG3CC,OAAA,CAAAC,OAAA,GAAAF,aAAa,GAAG,SAASA,aAAaA,CACpCG,QAAqC,EACrCC,UAAyB,EACV;EAAA,IAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;EACf,OAAOT,qBAAqB,CAACI,QAAQ,EAAE;IACrCM,QAAQ,GAAAJ,oBAAA,GAAED,UAAU,CAACK,QAAQ,YAAAJ,oBAAA,GAAIF,QAAQ,CAACM,QAAQ;IAClDC,SAAS,GAAAJ,qBAAA,GAAEF,UAAU,CAACM,SAAS,YAAAJ,qBAAA,GAAIH,QAAQ,CAACO,SAAS;IACrDC,WAAW,GAAAJ,qBAAA,GAAEH,UAAU,CAACO,WAAW,YAAAJ,qBAAA,GAAIJ,QAAQ,CAACQ,WAAW;IAC3DC,UAAU,GAAAJ,qBAAA,GAAEJ,UAAU,CAACQ,UAAU,YAAAJ,qBAAA,GAAIL,QAAQ,CAACS;EAChD,CAAC,CAAC;AACJ,CAAC;AAGY,SAASZ,aAAaA,CACnCG,QAAqB,EACrBC,UAAyB,EACV;EACf,MAAM;IACJS,QAAQ;IACRC,gBAAgB,GAAGD,QAAQ;IAC3BE,UAAU,GAAGX,UAAU,CAACQ;EAC1B,CAAC,GAAGT,QAAQ;EAEZ,MAAM;IACJM,QAAQ;IACRC,SAAS,GAAG,CAAC,CAACD,QAAQ;IAEtBE,WAAW;IAEXC,UAAU,GAAGG;EACf,CAAC,GAAGX,UAAU;EAEd,IAAI,CAACM,SAAS,EAAE,OAAO,IAAI;EAG3B,IAAID,QAAQ,IAAI,IAAI,IAAI,CAACE,WAAW,EAAE;IACpC,OAAOF,QAAQ;EACjB;EAEA,IAAIO,UAAU,GAAGJ,UAAU,IAAI,IAAI,GAAGA,UAAU,GAAG,GAAG,GAAG,EAAE;EAE3D,IAAIE,gBAAgB,EAAE;IACpB,MAAMG,kBAAkB,GACtBF,UAAU,IAAI,IAAI,GAAG,IAAIG,MAAM,CAAC,GAAG,GAAGH,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE;IAE/DC,UAAU,IAAIF,gBAAgB,CAE3BK,OAAO,CAACF,kBAAkB,EAAE,EAAE,CAAC,CAE/BE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;EAC1B;EAGAH,UAAU,GAAGA,UAAU,CAACG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAE3C,IAAIR,WAAW,EAAE;IAEf,OAAOA,WAAW,CAACK,UAAU,CAAC,IAAIA,UAAU;EAC9C,CAAC,MAAM;IACL,OAAOA,UAAU;EACnB;AACF","ignoreList":[]}
|
||||
{"version":3,"names":["originalGetModuleName","getModuleName","exports","default","rootOpts","pluginOpts","_pluginOpts$moduleId","_pluginOpts$moduleIds","_pluginOpts$getModule","_pluginOpts$moduleRoo","moduleId","moduleIds","getModuleId","moduleRoot","filename","filenameRelative","sourceRoot","moduleName","sourceRootReplacer","RegExp","replace"],"sources":["../src/get-module-name.ts"],"sourcesContent":["type RootOptions = {\n filename?: string;\n filenameRelative?: string;\n sourceRoot?: string;\n};\n\nexport type PluginOptions = {\n moduleId?: string;\n moduleIds?: boolean;\n getModuleId?: (moduleName: string) => string | null | undefined;\n moduleRoot?: string;\n};\n\nif (!process.env.BABEL_8_BREAKING) {\n const originalGetModuleName = getModuleName;\n\n // @ts-expect-error TS doesn't like reassigning a function.\n getModuleName = function getModuleName(\n rootOpts: RootOptions & PluginOptions,\n pluginOpts: PluginOptions,\n ): string | null {\n return originalGetModuleName(rootOpts, {\n moduleId: pluginOpts.moduleId ?? rootOpts.moduleId,\n moduleIds: pluginOpts.moduleIds ?? rootOpts.moduleIds,\n getModuleId: pluginOpts.getModuleId ?? rootOpts.getModuleId,\n moduleRoot: pluginOpts.moduleRoot ?? rootOpts.moduleRoot,\n });\n };\n}\n\nexport default function getModuleName(\n rootOpts: RootOptions,\n pluginOpts: PluginOptions,\n): string | null {\n const {\n filename,\n filenameRelative = filename,\n sourceRoot = pluginOpts.moduleRoot,\n } = rootOpts;\n\n const {\n moduleId,\n moduleIds = !!moduleId,\n\n getModuleId,\n\n moduleRoot = sourceRoot,\n } = pluginOpts;\n\n if (!moduleIds) return null;\n\n // moduleId is n/a if a `getModuleId()` is provided\n if (moduleId != null && !getModuleId) {\n return moduleId;\n }\n\n let moduleName = moduleRoot != null ? moduleRoot + \"/\" : \"\";\n\n if (filenameRelative) {\n const sourceRootReplacer =\n sourceRoot != null ? new RegExp(\"^\" + sourceRoot + \"/?\") : \"\";\n\n moduleName += filenameRelative\n // remove sourceRoot from filename\n .replace(sourceRootReplacer, \"\")\n // remove extension\n .replace(/\\.\\w*$/, \"\");\n }\n\n // normalize path separators\n moduleName = moduleName.replace(/\\\\/g, \"/\");\n\n if (getModuleId) {\n // If return is falsy, assume they want us to use our generated default name\n return getModuleId(moduleName) || moduleName;\n } else {\n return moduleName;\n }\n}\n"],"mappings":";;;;;;AAamC;EACjC,MAAMA,qBAAqB,GAAGC,aAAa;EAG3CC,OAAA,CAAAC,OAAA,GAAAF,aAAa,GAAG,SAASA,aAAaA,CACpCG,QAAqC,EACrCC,UAAyB,EACV;IAAA,IAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IACf,OAAOT,qBAAqB,CAACI,QAAQ,EAAE;MACrCM,QAAQ,GAAAJ,oBAAA,GAAED,UAAU,CAACK,QAAQ,YAAAJ,oBAAA,GAAIF,QAAQ,CAACM,QAAQ;MAClDC,SAAS,GAAAJ,qBAAA,GAAEF,UAAU,CAACM,SAAS,YAAAJ,qBAAA,GAAIH,QAAQ,CAACO,SAAS;MACrDC,WAAW,GAAAJ,qBAAA,GAAEH,UAAU,CAACO,WAAW,YAAAJ,qBAAA,GAAIJ,QAAQ,CAACQ,WAAW;MAC3DC,UAAU,GAAAJ,qBAAA,GAAEJ,UAAU,CAACQ,UAAU,YAAAJ,qBAAA,GAAIL,QAAQ,CAACS;IAChD,CAAC,CAAC;EACJ,CAAC;AACH;AAEe,SAASZ,aAAaA,CACnCG,QAAqB,EACrBC,UAAyB,EACV;EACf,MAAM;IACJS,QAAQ;IACRC,gBAAgB,GAAGD,QAAQ;IAC3BE,UAAU,GAAGX,UAAU,CAACQ;EAC1B,CAAC,GAAGT,QAAQ;EAEZ,MAAM;IACJM,QAAQ;IACRC,SAAS,GAAG,CAAC,CAACD,QAAQ;IAEtBE,WAAW;IAEXC,UAAU,GAAGG;EACf,CAAC,GAAGX,UAAU;EAEd,IAAI,CAACM,SAAS,EAAE,OAAO,IAAI;EAG3B,IAAID,QAAQ,IAAI,IAAI,IAAI,CAACE,WAAW,EAAE;IACpC,OAAOF,QAAQ;EACjB;EAEA,IAAIO,UAAU,GAAGJ,UAAU,IAAI,IAAI,GAAGA,UAAU,GAAG,GAAG,GAAG,EAAE;EAE3D,IAAIE,gBAAgB,EAAE;IACpB,MAAMG,kBAAkB,GACtBF,UAAU,IAAI,IAAI,GAAG,IAAIG,MAAM,CAAC,GAAG,GAAGH,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE;IAE/DC,UAAU,IAAIF,gBAAgB,CAE3BK,OAAO,CAACF,kBAAkB,EAAE,EAAE,CAAC,CAE/BE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;EAC1B;EAGAH,UAAU,GAAGA,UAAU,CAACG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;EAE3C,IAAIR,WAAW,EAAE;IAEf,OAAOA,WAAW,CAACK,UAAU,CAAC,IAAIA,UAAU;EAC9C,CAAC,MAAM;IACL,OAAOA,UAAU;EACnB;AACF","ignoreList":[]}
|
||||
+3
-1
@@ -52,7 +52,9 @@ var _normalizeAndLoadMetadata = require("./normalize-and-load-metadata.js");
|
||||
var Lazy = require("./lazy-modules.js");
|
||||
var _dynamicImport = require("./dynamic-import.js");
|
||||
var _getModuleName = require("./get-module-name.js");
|
||||
exports.getDynamicImportSource = require("./dynamic-import").getDynamicImportSource;
|
||||
{
|
||||
exports.getDynamicImportSource = require("./dynamic-import").getDynamicImportSource;
|
||||
}
|
||||
function rewriteModuleStatementsAndPrepareHeader(path, {
|
||||
exportName,
|
||||
strict,
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-2
@@ -328,9 +328,11 @@ function getLocalExportMetadata(programPath, initializeReexports, stringSpecifie
|
||||
}
|
||||
function nameAnonymousExports(programPath) {
|
||||
programPath.get("body").forEach(child => {
|
||||
var _child$splitExportDec;
|
||||
if (!child.isExportDefaultDeclaration()) return;
|
||||
(_child$splitExportDec = child.splitExportDeclaration) != null ? _child$splitExportDec : child.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration;
|
||||
{
|
||||
var _child$splitExportDec;
|
||||
(_child$splitExportDec = child.splitExportDeclaration) != null ? _child$splitExportDec : child.splitExportDeclaration = require("@babel/traverse").NodePath.prototype.splitExportDeclaration;
|
||||
}
|
||||
child.splitExportDeclaration();
|
||||
});
|
||||
}
|
||||
|
||||
Generated
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-module-transforms",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.3",
|
||||
"description": "Babel helper functions for implementing ES6 module transformations",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-module-transforms",
|
||||
@@ -15,12 +15,12 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-imports": "^7.29.7",
|
||||
"@babel/helper-validator-identifier": "^7.29.7",
|
||||
"@babel/traverse": "^7.29.7"
|
||||
"@babel/helper-module-imports": "^7.27.1",
|
||||
"@babel/helper-validator-identifier": "^7.27.1",
|
||||
"@babel/traverse": "^7.28.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.29.7"
|
||||
"@babel/core": "^7.28.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-string-parser",
|
||||
"version": "7.29.7",
|
||||
"version": "7.27.1",
|
||||
"description": "A utility package to parse strings",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-validator-identifier",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.5",
|
||||
"description": "Validate identifier/keywords name",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helper-validator-option",
|
||||
"version": "7.29.7",
|
||||
"version": "7.27.1",
|
||||
"description": "Validate plugin/preset options",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
+334
-332
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_applyDecoratedDescriptor","target","property","decorators","descriptor","context","desc","Object","keys","forEach","key","enumerable","configurable","initializer","writable","slice","reverse","reduce","decorator","value","call","defineProperty"],"sources":["../../src/helpers/applyDecoratedDescriptor.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\ninterface DescriptorWithInitializer extends PropertyDescriptor {\n initializer?: () => any;\n}\n\ndeclare const Object: Omit<typeof globalThis.Object, \"keys\"> & {\n keys<T>(o: T): (keyof T)[];\n};\n\nexport default function _applyDecoratedDescriptor<T>(\n target: T,\n property: PropertyKey,\n decorators: ((\n t: T,\n p: PropertyKey,\n desc: DescriptorWithInitializer,\n ) => any)[],\n descriptor: DescriptorWithInitializer,\n context: DecoratorContext,\n) {\n var desc: DescriptorWithInitializer = {};\n Object.keys(descriptor).forEach(function (key) {\n desc[key] = descriptor[key];\n });\n desc.enumerable = !!desc.enumerable;\n desc.configurable = !!desc.configurable;\n if (\"value\" in desc || desc.initializer) {\n desc.writable = true;\n }\n\n desc = decorators\n .slice()\n .reverse()\n .reduce(function (desc, decorator) {\n return decorator(target, property, desc) || desc;\n }, desc);\n\n if (context && desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(context) : void 0;\n desc.initializer = void 0;\n }\n\n if (desc.initializer === void 0) {\n Object.defineProperty(target, property, desc);\n return null;\n }\n\n return desc;\n}\n"],"mappings":";;;;;;AAUe,SAASA,yBAAyBA,CAC/CC,MAAS,EACTC,QAAqB,EACrBC,UAIW,EACXC,UAAqC,EACrCC,OAAyB,EACzB;EACA,IAAIC,IAA+B,GAAG,CAAC,CAAC;EACxCC,MAAM,CAACC,IAAI,CAACJ,UAAU,CAAC,CAACK,OAAO,CAAC,UAAUC,GAAG,EAAE;IAC7CJ,IAAI,CAACI,GAAG,CAAC,GAAGN,UAAU,CAACM,GAAG,CAAC;EAC7B,CAAC,CAAC;EACFJ,IAAI,CAACK,UAAU,GAAG,CAAC,CAACL,IAAI,CAACK,UAAU;EACnCL,IAAI,CAACM,YAAY,GAAG,CAAC,CAACN,IAAI,CAACM,YAAY;EACvC,IAAI,OAAO,IAAIN,IAAI,IAAIA,IAAI,CAACO,WAAW,EAAE;IACvCP,IAAI,CAACQ,QAAQ,GAAG,IAAI;EACtB;EAEAR,IAAI,GAAGH,UAAU,CACdY,KAAK,CAAC,CAAC,CACPC,OAAO,CAAC,CAAC,CACTC,MAAM,CAAC,UAAUX,IAAI,EAAEY,SAAS,EAAE;IACjC,OAAOA,SAAS,CAACjB,MAAM,EAAEC,QAAQ,EAAEI,IAAI,CAAC,IAAIA,IAAI;EAClD,CAAC,EAAEA,IAAI,CAAC;EAEV,IAAID,OAAO,IAAIC,IAAI,CAACO,WAAW,KAAK,KAAK,CAAC,EAAE;IAC1CP,IAAI,CAACa,KAAK,GAAGb,IAAI,CAACO,WAAW,GAAGP,IAAI,CAACO,WAAW,CAACO,IAAI,CAACf,OAAO,CAAC,GAAG,KAAK,CAAC;IACvEC,IAAI,CAACO,WAAW,GAAG,KAAK,CAAC;EAC3B;EAEA,IAAIP,IAAI,CAACO,WAAW,KAAK,KAAK,CAAC,EAAE;IAC/BN,MAAM,CAACc,cAAc,CAACpB,MAAM,EAAEC,QAAQ,EAAEI,IAAI,CAAC;IAC7C,OAAO,IAAI;EACb;EAEA,OAAOA,IAAI;AACb","ignoreList":[]}
|
||||
{"version":3,"names":["_applyDecoratedDescriptor","target","property","decorators","descriptor","context","desc","Object","keys","forEach","key","enumerable","configurable","initializer","writable","slice","reverse","reduce","decorator","value","call","defineProperty"],"sources":["../../src/helpers/applyDecoratedDescriptor.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\ninterface DescriptorWithInitializer extends PropertyDescriptor {\n initializer?: () => any;\n}\n\ndeclare const Object: Omit<typeof globalThis.Object, \"keys\"> & {\n keys<T>(o: T): Array<keyof T>;\n};\n\nexport default function _applyDecoratedDescriptor<T>(\n target: T,\n property: PropertyKey,\n decorators: ((\n t: T,\n p: PropertyKey,\n desc: DescriptorWithInitializer,\n ) => any)[],\n descriptor: DescriptorWithInitializer,\n context: DecoratorContext,\n) {\n var desc: DescriptorWithInitializer = {};\n Object.keys(descriptor).forEach(function (key) {\n desc[key] = descriptor[key];\n });\n desc.enumerable = !!desc.enumerable;\n desc.configurable = !!desc.configurable;\n if (\"value\" in desc || desc.initializer) {\n desc.writable = true;\n }\n\n desc = decorators\n .slice()\n .reverse()\n .reduce(function (desc, decorator) {\n return decorator(target, property, desc) || desc;\n }, desc);\n\n if (context && desc.initializer !== void 0) {\n desc.value = desc.initializer ? desc.initializer.call(context) : void 0;\n desc.initializer = void 0;\n }\n\n if (desc.initializer === void 0) {\n Object.defineProperty(target, property, desc);\n return null;\n }\n\n return desc;\n}\n"],"mappings":";;;;;;AAUe,SAASA,yBAAyBA,CAC/CC,MAAS,EACTC,QAAqB,EACrBC,UAIW,EACXC,UAAqC,EACrCC,OAAyB,EACzB;EACA,IAAIC,IAA+B,GAAG,CAAC,CAAC;EACxCC,MAAM,CAACC,IAAI,CAACJ,UAAU,CAAC,CAACK,OAAO,CAAC,UAAUC,GAAG,EAAE;IAC7CJ,IAAI,CAACI,GAAG,CAAC,GAAGN,UAAU,CAACM,GAAG,CAAC;EAC7B,CAAC,CAAC;EACFJ,IAAI,CAACK,UAAU,GAAG,CAAC,CAACL,IAAI,CAACK,UAAU;EACnCL,IAAI,CAACM,YAAY,GAAG,CAAC,CAACN,IAAI,CAACM,YAAY;EACvC,IAAI,OAAO,IAAIN,IAAI,IAAIA,IAAI,CAACO,WAAW,EAAE;IACvCP,IAAI,CAACQ,QAAQ,GAAG,IAAI;EACtB;EAEAR,IAAI,GAAGH,UAAU,CACdY,KAAK,CAAC,CAAC,CACPC,OAAO,CAAC,CAAC,CACTC,MAAM,CAAC,UAAUX,IAAI,EAAEY,SAAS,EAAE;IACjC,OAAOA,SAAS,CAACjB,MAAM,EAAEC,QAAQ,EAAEI,IAAI,CAAC,IAAIA,IAAI;EAClD,CAAC,EAAEA,IAAI,CAAC;EAEV,IAAID,OAAO,IAAIC,IAAI,CAACO,WAAW,KAAK,KAAK,CAAC,EAAE;IAC1CP,IAAI,CAACa,KAAK,GAAGb,IAAI,CAACO,WAAW,GAAGP,IAAI,CAACO,WAAW,CAACO,IAAI,CAACf,OAAO,CAAC,GAAG,KAAK,CAAC;IACvEC,IAAI,CAACO,WAAW,GAAG,KAAK,CAAC;EAC3B;EAEA,IAAIP,IAAI,CAACO,WAAW,KAAK,KAAK,CAAC,EAAE;IAC/BN,MAAM,CAACc,cAAc,CAACpB,MAAM,EAAEC,QAAQ,EAAEI,IAAI,CAAC;IAC7C,OAAO,IAAI;EACb;EAEA,OAAOA,IAAI;AACb","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_arrayWithHoles","arr","Array","isArray"],"sources":["../../src/helpers/arrayWithHoles.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _arrayWithHoles<T>(arr: T[]) {\n if (Array.isArray(arr)) return arr;\n}\n"],"mappings":";;;;;;AAEe,SAASA,eAAeA,CAAIC,GAAQ,EAAE;EACnD,IAAIC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE,OAAOA,GAAG;AACpC","ignoreList":[]}
|
||||
{"version":3,"names":["_arrayWithHoles","arr","Array","isArray"],"sources":["../../src/helpers/arrayWithHoles.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _arrayWithHoles<T>(arr: Array<T>) {\n if (Array.isArray(arr)) return arr;\n}\n"],"mappings":";;;;;;AAEe,SAASA,eAAeA,CAAIC,GAAa,EAAE;EACxD,IAAIC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE,OAAOA,GAAG;AACpC","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_arrayLikeToArray","require","_arrayWithoutHoles","arr","Array","isArray","arrayLikeToArray"],"sources":["../../src/helpers/arrayWithoutHoles.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nimport arrayLikeToArray from \"./arrayLikeToArray.ts\";\n\nexport default function _arrayWithoutHoles<T>(arr: T[]) {\n if (Array.isArray(arr)) return arrayLikeToArray<T>(arr);\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAEe,SAASC,kBAAkBA,CAAIC,GAAQ,EAAE;EACtD,IAAIC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE,OAAO,IAAAG,yBAAgB,EAAIH,GAAG,CAAC;AACzD","ignoreList":[]}
|
||||
{"version":3,"names":["_arrayLikeToArray","require","_arrayWithoutHoles","arr","Array","isArray","arrayLikeToArray"],"sources":["../../src/helpers/arrayWithoutHoles.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nimport arrayLikeToArray from \"./arrayLikeToArray.ts\";\n\nexport default function _arrayWithoutHoles<T>(arr: Array<T>) {\n if (Array.isArray(arr)) return arrayLikeToArray<T>(arr);\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAEe,SAASC,kBAAkBA,CAAIC,GAAa,EAAE;EAC3D,IAAIC,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE,OAAO,IAAAG,yBAAgB,EAAIH,GAAG,CAAC;AACzD","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_defineEnumerableProperties","obj","descs","key","desc","configurable","enumerable","writable","Object","defineProperty","getOwnPropertySymbols","objectSymbols","i","length","sym"],"sources":["../../src/helpers/defineEnumerableProperties.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n/* @onlyBabel7 */\nexport default function _defineEnumerableProperties<T>(\n obj: T,\n descs: Record<string | symbol, PropertyDescriptor>,\n): T {\n // eslint-disable-next-line guard-for-in\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n\n // Symbols are not enumerated over by for-in loops. If native\n // Symbols are available, fetch all of the descs object's own\n // symbol properties and define them on our target object too.\n if (Object.getOwnPropertySymbols) {\n var objectSymbols = Object.getOwnPropertySymbols(descs);\n for (var i = 0; i < objectSymbols.length; i++) {\n var sym = objectSymbols[i];\n desc = descs[sym];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, sym, desc);\n }\n }\n return obj;\n}\n"],"mappings":";;;;;;AAEe,SAASA,2BAA2BA,CACjDC,GAAM,EACNC,KAAkD,EAC/C;EAEH,KAAK,IAAIC,GAAG,IAAID,KAAK,EAAE;IACrB,IAAIE,IAAI,GAAGF,KAAK,CAACC,GAAG,CAAC;IACrBC,IAAI,CAACC,YAAY,GAAGD,IAAI,CAACE,UAAU,GAAG,IAAI;IAC1C,IAAI,OAAO,IAAIF,IAAI,EAAEA,IAAI,CAACG,QAAQ,GAAG,IAAI;IACzCC,MAAM,CAACC,cAAc,CAACR,GAAG,EAAEE,GAAG,EAAEC,IAAI,CAAC;EACvC;EAKA,IAAII,MAAM,CAACE,qBAAqB,EAAE;IAChC,IAAIC,aAAa,GAAGH,MAAM,CAACE,qBAAqB,CAACR,KAAK,CAAC;IACvD,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,aAAa,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;MAC7C,IAAIE,GAAG,GAAGH,aAAa,CAACC,CAAC,CAAC;MAC1BR,IAAI,GAAGF,KAAK,CAACY,GAAG,CAAC;MACjBV,IAAI,CAACC,YAAY,GAAGD,IAAI,CAACE,UAAU,GAAG,IAAI;MAC1C,IAAI,OAAO,IAAIF,IAAI,EAAEA,IAAI,CAACG,QAAQ,GAAG,IAAI;MACzCC,MAAM,CAACC,cAAc,CAACR,GAAG,EAAEa,GAAG,EAAEV,IAAI,CAAC;IACvC;EACF;EACA,OAAOH,GAAG;AACZ","ignoreList":[]}
|
||||
{"version":3,"names":["_defineEnumerableProperties","obj","descs","key","desc","configurable","enumerable","writable","Object","defineProperty","getOwnPropertySymbols","objectSymbols","i","length","sym"],"sources":["../../src/helpers/defineEnumerableProperties.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n/* @onlyBabel7 */\nexport default function _defineEnumerableProperties<T>(\n obj: T,\n descs: { [key: string | symbol]: PropertyDescriptor },\n): T {\n // eslint-disable-next-line guard-for-in\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n\n // Symbols are not enumerated over by for-in loops. If native\n // Symbols are available, fetch all of the descs object's own\n // symbol properties and define them on our target object too.\n if (Object.getOwnPropertySymbols) {\n var objectSymbols = Object.getOwnPropertySymbols(descs);\n for (var i = 0; i < objectSymbols.length; i++) {\n var sym = objectSymbols[i];\n desc = descs[sym];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, sym, desc);\n }\n }\n return obj;\n}\n"],"mappings":";;;;;;AAEe,SAASA,2BAA2BA,CACjDC,GAAM,EACNC,KAAqD,EAClD;EAEH,KAAK,IAAIC,GAAG,IAAID,KAAK,EAAE;IACrB,IAAIE,IAAI,GAAGF,KAAK,CAACC,GAAG,CAAC;IACrBC,IAAI,CAACC,YAAY,GAAGD,IAAI,CAACE,UAAU,GAAG,IAAI;IAC1C,IAAI,OAAO,IAAIF,IAAI,EAAEA,IAAI,CAACG,QAAQ,GAAG,IAAI;IACzCC,MAAM,CAACC,cAAc,CAACR,GAAG,EAAEE,GAAG,EAAEC,IAAI,CAAC;EACvC;EAKA,IAAII,MAAM,CAACE,qBAAqB,EAAE;IAChC,IAAIC,aAAa,GAAGH,MAAM,CAACE,qBAAqB,CAACR,KAAK,CAAC;IACvD,KAAK,IAAIU,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,aAAa,CAACE,MAAM,EAAED,CAAC,EAAE,EAAE;MAC7C,IAAIE,GAAG,GAAGH,aAAa,CAACC,CAAC,CAAC;MAC1BR,IAAI,GAAGF,KAAK,CAACY,GAAG,CAAC;MACjBV,IAAI,CAACC,YAAY,GAAGD,IAAI,CAACE,UAAU,GAAG,IAAI;MAC1C,IAAI,OAAO,IAAIF,IAAI,EAAEA,IAAI,CAACG,QAAQ,GAAG,IAAI;MACzCC,MAAM,CAACC,cAAc,CAACR,GAAG,EAAEa,GAAG,EAAEV,IAAI,CAAC;IACvC;EACF;EACA,OAAOH,GAAG;AACZ","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["dispose_SuppressedError","error","suppressed","SuppressedError","stack","Error","prototype","Object","create","constructor","value","writable","configurable","_dispose","hasError","next","length","r","pop","p","d","call","v","a","Promise","resolve","then","err","e"],"sources":["../../src/helpers/dispose.js"],"sourcesContent":["/* @minVersion 7.22.0 */\n/* @onlyBabel7 */\n\nfunction dispose_SuppressedError(error, suppressed) {\n if (typeof SuppressedError !== \"undefined\") {\n dispose_SuppressedError = SuppressedError;\n } else {\n dispose_SuppressedError = function SuppressedError(error, suppressed) {\n this.suppressed = suppressed;\n this.error = error;\n this.stack = new Error().stack;\n };\n dispose_SuppressedError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: dispose_SuppressedError,\n writable: true,\n configurable: true,\n },\n });\n }\n return new dispose_SuppressedError(error, suppressed);\n}\n\nexport default function _dispose(stack, error, hasError) {\n function next() {\n while (stack.length > 0) {\n try {\n var r = stack.pop();\n var p = r.d.call(r.v);\n if (r.a) return Promise.resolve(p).then(next, err);\n } catch (e) {\n return err(e);\n }\n }\n if (hasError) throw error;\n }\n\n function err(e) {\n error = hasError ? new dispose_SuppressedError(error, e) : e;\n hasError = true;\n\n return next();\n }\n\n return next();\n}\n"],"mappings":";;;;;;AAGA,SAASA,uBAAuBA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAClD,IAAI,OAAOC,eAAe,KAAK,WAAW,EAAE;IAC1CH,uBAAuB,GAAGG,eAAe;EAC3C,CAAC,MAAM;IACLH,uBAAuB,GAAG,SAASG,eAAeA,CAACF,KAAK,EAAEC,UAAU,EAAE;MACpE,IAAI,CAACA,UAAU,GAAGA,UAAU;MAC5B,IAAI,CAACD,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACG,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAC,CAACD,KAAK;IAChC,CAAC;IACDJ,uBAAuB,CAACM,SAAS,GAAGC,MAAM,CAACC,MAAM,CAACH,KAAK,CAACC,SAAS,EAAE;MACjEG,WAAW,EAAE;QACXC,KAAK,EAAEV,uBAAuB;QAC9BW,QAAQ,EAAE,IAAI;QACdC,YAAY,EAAE;MAChB;IACF,CAAC,CAAC;EACJ;EACA,OAAO,IAAIZ,uBAAuB,CAACC,KAAK,EAAEC,UAAU,CAAC;AACvD;AAEe,SAASW,QAAQA,CAACT,KAAK,EAAEH,KAAK,EAAEa,QAAQ,EAAE;EACvD,SAASC,IAAIA,CAAA,EAAG;IACd,OAAOX,KAAK,CAACY,MAAM,GAAG,CAAC,EAAE;MACvB,IAAI;QACF,IAAIC,CAAC,GAAGb,KAAK,CAACc,GAAG,CAAC,CAAC;QACnB,IAAIC,CAAC,GAAGF,CAAC,CAACG,CAAC,CAACC,IAAI,CAACJ,CAAC,CAACK,CAAC,CAAC;QACrB,IAAIL,CAAC,CAACM,CAAC,EAAE,OAAOC,OAAO,CAACC,OAAO,CAACN,CAAC,CAAC,CAACO,IAAI,CAACX,IAAI,EAAEY,GAAG,CAAC;MACpD,CAAC,CAAC,OAAOC,CAAC,EAAE;QACV,OAAOD,GAAG,CAACC,CAAC,CAAC;MACf;IACF;IACA,IAAId,QAAQ,EAAE,MAAMb,KAAK;EAC3B;EAEA,SAAS0B,GAAGA,CAACC,CAAC,EAAE;IACd3B,KAAK,GAAGa,QAAQ,GAAG,IAAId,uBAAuB,CAACC,KAAK,EAAE2B,CAAC,CAAC,GAAGA,CAAC;IAC5Dd,QAAQ,GAAG,IAAI;IAEf,OAAOC,IAAI,CAAC,CAAC;EACf;EAEA,OAAOA,IAAI,CAAC,CAAC;AACf","ignoreList":[]}
|
||||
{"version":3,"names":["dispose_SuppressedError","error","suppressed","SuppressedError","stack","Error","prototype","Object","create","constructor","value","writable","configurable","_dispose","hasError","next","length","r","pop","p","d","call","v","a","Promise","resolve","then","err","e"],"sources":["../../src/helpers/dispose.js"],"sourcesContent":["/* @minVersion 7.22.0 */\n/* @onlyBabel7 */\n\nfunction dispose_SuppressedError(error, suppressed) {\n if (typeof SuppressedError !== \"undefined\") {\n // eslint-disable-next-line no-undef\n dispose_SuppressedError = SuppressedError;\n } else {\n dispose_SuppressedError = function SuppressedError(error, suppressed) {\n this.suppressed = suppressed;\n this.error = error;\n this.stack = new Error().stack;\n };\n dispose_SuppressedError.prototype = Object.create(Error.prototype, {\n constructor: {\n value: dispose_SuppressedError,\n writable: true,\n configurable: true,\n },\n });\n }\n return new dispose_SuppressedError(error, suppressed);\n}\n\nexport default function _dispose(stack, error, hasError) {\n function next() {\n while (stack.length > 0) {\n try {\n var r = stack.pop();\n var p = r.d.call(r.v);\n if (r.a) return Promise.resolve(p).then(next, err);\n } catch (e) {\n return err(e);\n }\n }\n if (hasError) throw error;\n }\n\n function err(e) {\n error = hasError ? new dispose_SuppressedError(error, e) : e;\n hasError = true;\n\n return next();\n }\n\n return next();\n}\n"],"mappings":";;;;;;AAGA,SAASA,uBAAuBA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAClD,IAAI,OAAOC,eAAe,KAAK,WAAW,EAAE;IAE1CH,uBAAuB,GAAGG,eAAe;EAC3C,CAAC,MAAM;IACLH,uBAAuB,GAAG,SAASG,eAAeA,CAACF,KAAK,EAAEC,UAAU,EAAE;MACpE,IAAI,CAACA,UAAU,GAAGA,UAAU;MAC5B,IAAI,CAACD,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACG,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAC,CAACD,KAAK;IAChC,CAAC;IACDJ,uBAAuB,CAACM,SAAS,GAAGC,MAAM,CAACC,MAAM,CAACH,KAAK,CAACC,SAAS,EAAE;MACjEG,WAAW,EAAE;QACXC,KAAK,EAAEV,uBAAuB;QAC9BW,QAAQ,EAAE,IAAI;QACdC,YAAY,EAAE;MAChB;IACF,CAAC,CAAC;EACJ;EACA,OAAO,IAAIZ,uBAAuB,CAACC,KAAK,EAAEC,UAAU,CAAC;AACvD;AAEe,SAASW,QAAQA,CAACT,KAAK,EAAEH,KAAK,EAAEa,QAAQ,EAAE;EACvD,SAASC,IAAIA,CAAA,EAAG;IACd,OAAOX,KAAK,CAACY,MAAM,GAAG,CAAC,EAAE;MACvB,IAAI;QACF,IAAIC,CAAC,GAAGb,KAAK,CAACc,GAAG,CAAC,CAAC;QACnB,IAAIC,CAAC,GAAGF,CAAC,CAACG,CAAC,CAACC,IAAI,CAACJ,CAAC,CAACK,CAAC,CAAC;QACrB,IAAIL,CAAC,CAACM,CAAC,EAAE,OAAOC,OAAO,CAACC,OAAO,CAACN,CAAC,CAAC,CAACO,IAAI,CAACX,IAAI,EAAEY,GAAG,CAAC;MACpD,CAAC,CAAC,OAAOC,CAAC,EAAE;QACV,OAAOD,GAAG,CAACC,CAAC,CAAC;MACf;IACF;IACA,IAAId,QAAQ,EAAE,MAAMb,KAAK;EAC3B;EAEA,SAAS0B,GAAGA,CAACC,CAAC,EAAE;IACd3B,KAAK,GAAGa,QAAQ,GAAG,IAAId,uBAAuB,CAACC,KAAK,EAAE2B,CAAC,CAAC,GAAGA,CAAC;IAC5Dd,QAAQ,GAAG,IAAI;IAEf,OAAOC,IAAI,CAAC,CAAC;EACf;EAEA,OAAOA,IAAI,CAAC,CAAC;AACf","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_interopRequireWildcard","obj","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","exports","default","__esModule","_","newObj","__proto__","desc","has","get","set","key","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/helpers/interopRequireWildcard.ts"],"sourcesContent":["/* @minVersion 7.14.0 */\n\nexport default function _interopRequireWildcard(\n obj: any,\n nodeInterop: boolean,\n) {\n if (typeof WeakMap === \"function\") {\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n }\n\n // @ts-expect-error: assign to function\n return (_interopRequireWildcard = function (obj: any, nodeInterop: boolean) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n // Temporary variable for output size\n var _;\n var newObj: Record<string, any> = { __proto__: null, default: obj };\n var desc: PropertyDescriptor | undefined;\n\n if (\n obj === null ||\n (typeof obj !== \"object\" && typeof obj !== \"function\")\n ) {\n return newObj;\n }\n\n _ = nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n if (_) {\n if (_.has(obj)) return _.get(obj);\n _.set(obj, newObj);\n }\n\n for (const key in obj) {\n if (key !== \"default\" && {}.hasOwnProperty.call(obj, key)) {\n desc =\n (_ = Object.defineProperty) &&\n Object.getOwnPropertyDescriptor(obj, key);\n if (desc && (desc.get || desc.set)) {\n _(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n return newObj;\n })(obj, nodeInterop);\n}\n"],"mappings":";;;;;;AAEe,SAASA,uBAAuBA,CAC7CC,GAAQ,EACRC,WAAoB,EACpB;EACA,IAAI,OAAOC,OAAO,KAAK,UAAU,EAAE;IACjC,IAAIC,iBAAiB,GAAG,IAAID,OAAO,CAAC,CAAC;IACrC,IAAIE,gBAAgB,GAAG,IAAIF,OAAO,CAAC,CAAC;EACtC;EAGA,OAAO,CAAAG,OAAA,CAAAC,OAAA,GAACP,uBAAuB,GAAG,SAAAA,CAAUC,GAAQ,EAAEC,WAAoB,EAAE;IAC1E,IAAI,CAACA,WAAW,IAAID,GAAG,IAAIA,GAAG,CAACO,UAAU,EAAE;MACzC,OAAOP,GAAG;IACZ;IAEA,IAAIQ,CAAC;IACL,IAAIC,MAA2B,GAAG;MAAEC,SAAS,EAAE,IAAI;MAAEJ,OAAO,EAAEN;IAAI,CAAC;IACnE,IAAIW,IAAoC;IAExC,IACEX,GAAG,KAAK,IAAI,IACX,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,UAAW,EACtD;MACA,OAAOS,MAAM;IACf;IAEAD,CAAC,GAAGP,WAAW,GAAGG,gBAAgB,GAAGD,iBAAiB;IACtD,IAAIK,CAAC,EAAE;MACL,IAAIA,CAAC,CAACI,GAAG,CAACZ,GAAG,CAAC,EAAE,OAAOQ,CAAC,CAACK,GAAG,CAACb,GAAG,CAAC;MACjCQ,CAAC,CAACM,GAAG,CAACd,GAAG,EAAES,MAAM,CAAC;IACpB;IAEA,KAAK,MAAMM,GAAG,IAAIf,GAAG,EAAE;MACrB,IAAIe,GAAG,KAAK,SAAS,IAAI,CAAC,CAAC,CAACC,cAAc,CAACC,IAAI,CAACjB,GAAG,EAAEe,GAAG,CAAC,EAAE;QACzDJ,IAAI,GACF,CAACH,CAAC,GAAGU,MAAM,CAACC,cAAc,KAC1BD,MAAM,CAACE,wBAAwB,CAACpB,GAAG,EAAEe,GAAG,CAAC;QAC3C,IAAIJ,IAAI,KAAKA,IAAI,CAACE,GAAG,IAAIF,IAAI,CAACG,GAAG,CAAC,EAAE;UAClCN,CAAC,CAACC,MAAM,EAAEM,GAAG,EAAEJ,IAAI,CAAC;QACtB,CAAC,MAAM;UACLF,MAAM,CAACM,GAAG,CAAC,GAAGf,GAAG,CAACe,GAAG,CAAC;QACxB;MACF;IACF;IACA,OAAON,MAAM;EACf,CAAC,EAAET,GAAG,EAAEC,WAAW,CAAC;AACtB","ignoreList":[]}
|
||||
{"version":3,"names":["_interopRequireWildcard","obj","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","exports","default","__esModule","_","newObj","__proto__","desc","has","get","set","key","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/helpers/interopRequireWildcard.ts"],"sourcesContent":["/* @minVersion 7.14.0 */\n\nexport default function _interopRequireWildcard(\n obj: any,\n nodeInterop: boolean,\n) {\n if (typeof WeakMap === \"function\") {\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n }\n\n // @ts-expect-error: assign to function\n return (_interopRequireWildcard = function (obj: any, nodeInterop: boolean) {\n if (!nodeInterop && obj && obj.__esModule) {\n return obj;\n }\n // Temporary variable for output size\n var _;\n var newObj: { [key: string]: any } = { __proto__: null, default: obj };\n var desc: PropertyDescriptor | undefined;\n\n if (\n obj === null ||\n (typeof obj !== \"object\" && typeof obj !== \"function\")\n ) {\n return newObj;\n }\n\n _ = nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n if (_) {\n if (_.has(obj)) return _.get(obj);\n _.set(obj, newObj);\n }\n\n for (const key in obj) {\n if (key !== \"default\" && {}.hasOwnProperty.call(obj, key)) {\n desc =\n (_ = Object.defineProperty) &&\n Object.getOwnPropertyDescriptor(obj, key);\n if (desc && (desc.get || desc.set)) {\n _(newObj, key, desc);\n } else {\n newObj[key] = obj[key];\n }\n }\n }\n return newObj;\n })(obj, nodeInterop);\n}\n"],"mappings":";;;;;;AAEe,SAASA,uBAAuBA,CAC7CC,GAAQ,EACRC,WAAoB,EACpB;EACA,IAAI,OAAOC,OAAO,KAAK,UAAU,EAAE;IACjC,IAAIC,iBAAiB,GAAG,IAAID,OAAO,CAAC,CAAC;IACrC,IAAIE,gBAAgB,GAAG,IAAIF,OAAO,CAAC,CAAC;EACtC;EAGA,OAAO,CAAAG,OAAA,CAAAC,OAAA,GAACP,uBAAuB,GAAG,SAAAA,CAAUC,GAAQ,EAAEC,WAAoB,EAAE;IAC1E,IAAI,CAACA,WAAW,IAAID,GAAG,IAAIA,GAAG,CAACO,UAAU,EAAE;MACzC,OAAOP,GAAG;IACZ;IAEA,IAAIQ,CAAC;IACL,IAAIC,MAA8B,GAAG;MAAEC,SAAS,EAAE,IAAI;MAAEJ,OAAO,EAAEN;IAAI,CAAC;IACtE,IAAIW,IAAoC;IAExC,IACEX,GAAG,KAAK,IAAI,IACX,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,UAAW,EACtD;MACA,OAAOS,MAAM;IACf;IAEAD,CAAC,GAAGP,WAAW,GAAGG,gBAAgB,GAAGD,iBAAiB;IACtD,IAAIK,CAAC,EAAE;MACL,IAAIA,CAAC,CAACI,GAAG,CAACZ,GAAG,CAAC,EAAE,OAAOQ,CAAC,CAACK,GAAG,CAACb,GAAG,CAAC;MACjCQ,CAAC,CAACM,GAAG,CAACd,GAAG,EAAES,MAAM,CAAC;IACpB;IAEA,KAAK,MAAMM,GAAG,IAAIf,GAAG,EAAE;MACrB,IAAIe,GAAG,KAAK,SAAS,IAAI,CAAC,CAAC,CAACC,cAAc,CAACC,IAAI,CAACjB,GAAG,EAAEe,GAAG,CAAC,EAAE;QACzDJ,IAAI,GACF,CAACH,CAAC,GAAGU,MAAM,CAACC,cAAc,KAC1BD,MAAM,CAACE,wBAAwB,CAACpB,GAAG,EAAEe,GAAG,CAAC;QAC3C,IAAIJ,IAAI,KAAKA,IAAI,CAACE,GAAG,IAAIF,IAAI,CAACG,GAAG,CAAC,EAAE;UAClCN,CAAC,CAACC,MAAM,EAAEM,GAAG,EAAEJ,IAAI,CAAC;QACtB,CAAC,MAAM;UACLF,MAAM,CAACM,GAAG,CAAC,GAAGf,GAAG,CAACe,GAAG,CAAC;QACxB;MACF;IACF;IACA,OAAON,MAAM;EACf,CAAC,EAAET,GAAG,EAAEC,WAAW,CAAC;AACtB","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_objectWithoutPropertiesLoose","source","excluded","target","key","Object","prototype","hasOwnProperty","call","indexOf"],"sources":["../../src/helpers/objectWithoutPropertiesLoose.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _objectWithoutPropertiesLoose<\n T extends object,\n K extends PropertyKey[],\n>(\n source: T | null | undefined,\n excluded: K,\n): Pick<T, Exclude<keyof T, K[number]>>;\nexport default function _objectWithoutPropertiesLoose<\n T extends object,\n K extends (keyof T)[],\n>(source: T | null | undefined, excluded: K): Omit<T, K[number]>;\nexport default function _objectWithoutPropertiesLoose<T extends object>(\n source: T | null | undefined,\n excluded: PropertyKey[],\n): Partial<T> {\n if (source == null) return {};\n\n var target: Partial<T> = {};\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (excluded.indexOf(key) !== -1) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n"],"mappings":";;;;;;AAae,SAASA,6BAA6BA,CACnDC,MAA4B,EAC5BC,QAAuB,EACX;EACZ,IAAID,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAE7B,IAAIE,MAAkB,GAAG,CAAC,CAAC;EAE3B,KAAK,IAAIC,GAAG,IAAIH,MAAM,EAAE;IACtB,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,MAAM,EAAEG,GAAG,CAAC,EAAE;MACrD,IAAIF,QAAQ,CAACO,OAAO,CAACL,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;MAClCD,MAAM,CAACC,GAAG,CAAC,GAAGH,MAAM,CAACG,GAAG,CAAC;IAC3B;EACF;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
||||
{"version":3,"names":["_objectWithoutPropertiesLoose","source","excluded","target","key","Object","prototype","hasOwnProperty","call","indexOf"],"sources":["../../src/helpers/objectWithoutPropertiesLoose.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _objectWithoutPropertiesLoose<\n T extends object,\n K extends PropertyKey[],\n>(\n source: T | null | undefined,\n excluded: K,\n): Pick<T, Exclude<keyof T, K[number]>>;\nexport default function _objectWithoutPropertiesLoose<\n T extends object,\n K extends Array<keyof T>,\n>(source: T | null | undefined, excluded: K): Omit<T, K[number]>;\nexport default function _objectWithoutPropertiesLoose<T extends object>(\n source: T | null | undefined,\n excluded: PropertyKey[],\n): Partial<T> {\n if (source == null) return {};\n\n var target: Partial<T> = {};\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (excluded.indexOf(key) !== -1) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n"],"mappings":";;;;;;AAae,SAASA,6BAA6BA,CACnDC,MAA4B,EAC5BC,QAAuB,EACX;EACZ,IAAID,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAE7B,IAAIE,MAAkB,GAAG,CAAC,CAAC;EAE3B,KAAK,IAAIC,GAAG,IAAIH,MAAM,EAAE;IACtB,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,MAAM,EAAEG,GAAG,CAAC,EAAE;MACrD,IAAIF,QAAQ,CAACO,OAAO,CAACL,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;MAClCD,MAAM,CAACC,GAAG,CAAC,GAAGH,MAAM,CAACG,GAAG,CAAC;IAC3B;EACF;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_arrayLikeToArray","require","_unsupportedIterableToArray","o","minLen","arrayLikeToArray","name","Object","prototype","toString","call","slice","constructor","Array","from","test"],"sources":["../../src/helpers/unsupportedIterableToArray.ts"],"sourcesContent":["/* @minVersion 7.9.0 */\n\nimport arrayLikeToArray from \"./arrayLikeToArray.ts\";\n\ntype NonArrayIterable<V, T extends Iterable<V> = Iterable<V>> = T extends any[]\n ? never\n : Iterable<V>;\n\nexport default function _unsupportedIterableToArray<T>(\n o: RelativeIndexable<T> /* string | typedarray */ | ArrayLike<T> | Set<T>,\n minLen?: number | null,\n): T[];\nexport default function _unsupportedIterableToArray<T, K>(\n o: Map<K, T>,\n minLen?: number | null,\n): [K, T][];\n// This is a specific overload added specifically for createForOfIteratorHelpers.ts\nexport default function _unsupportedIterableToArray<T>(\n o: NonArrayIterable<T>,\n minLen?: number | null,\n): undefined;\nexport default function _unsupportedIterableToArray(\n o: any,\n minLen?: number | null,\n): any[] | undefined {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray<string>(o, minLen);\n var name = Object.prototype.toString.call(o).slice(8, -1);\n if (name === \"Object\" && o.constructor) name = o.constructor.name;\n if (name === \"Map\" || name === \"Set\") return Array.from(o);\n if (\n name === \"Arguments\" ||\n /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(name)\n ) {\n return arrayLikeToArray(o, minLen);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAmBe,SAASC,2BAA2BA,CACjDC,CAAM,EACNC,MAAsB,EACH;EACnB,IAAI,CAACD,CAAC,EAAE;EACR,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE,OAAO,IAAAE,yBAAgB,EAASF,CAAC,EAAEC,MAAM,CAAC;EACrE,IAAIE,IAAI,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACP,CAAC,CAAC,CAACQ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACzD,IAAIL,IAAI,KAAK,QAAQ,IAAIH,CAAC,CAACS,WAAW,EAAEN,IAAI,GAAGH,CAAC,CAACS,WAAW,CAACN,IAAI;EACjE,IAAIA,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,KAAK,EAAE,OAAOO,KAAK,CAACC,IAAI,CAACX,CAAC,CAAC;EAC1D,IACEG,IAAI,KAAK,WAAW,IACpB,0CAA0C,CAACS,IAAI,CAACT,IAAI,CAAC,EACrD;IACA,OAAO,IAAAD,yBAAgB,EAACF,CAAC,EAAEC,MAAM,CAAC;EACpC;AACF","ignoreList":[]}
|
||||
{"version":3,"names":["_arrayLikeToArray","require","_unsupportedIterableToArray","o","minLen","arrayLikeToArray","name","Object","prototype","toString","call","slice","constructor","Array","from","test"],"sources":["../../src/helpers/unsupportedIterableToArray.ts"],"sourcesContent":["/* @minVersion 7.9.0 */\n\nimport arrayLikeToArray from \"./arrayLikeToArray.ts\";\n\ntype NonArrayIterable<V, T extends Iterable<V> = Iterable<V>> =\n T extends Array<any> ? never : Iterable<V>;\n\nexport default function _unsupportedIterableToArray<T>(\n o: RelativeIndexable<T> /* string | typedarray */ | ArrayLike<T> | Set<T>,\n minLen?: number | null,\n): T[];\nexport default function _unsupportedIterableToArray<T, K>(\n o: Map<K, T>,\n minLen?: number | null,\n): [K, T][];\n// This is a specific overload added specifically for createForOfIteratorHelpers.ts\nexport default function _unsupportedIterableToArray<T>(\n o: NonArrayIterable<T>,\n minLen?: number | null,\n): undefined;\nexport default function _unsupportedIterableToArray(\n o: any,\n minLen?: number | null,\n): any[] | undefined {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray<string>(o, minLen);\n var name = Object.prototype.toString.call(o).slice(8, -1);\n if (name === \"Object\" && o.constructor) name = o.constructor.name;\n if (name === \"Map\" || name === \"Set\") return Array.from(o);\n if (\n name === \"Arguments\" ||\n /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(name)\n ) {\n return arrayLikeToArray(o, minLen);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAkBe,SAASC,2BAA2BA,CACjDC,CAAM,EACNC,MAAsB,EACH;EACnB,IAAI,CAACD,CAAC,EAAE;EACR,IAAI,OAAOA,CAAC,KAAK,QAAQ,EAAE,OAAO,IAAAE,yBAAgB,EAASF,CAAC,EAAEC,MAAM,CAAC;EACrE,IAAIE,IAAI,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACP,CAAC,CAAC,CAACQ,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EACzD,IAAIL,IAAI,KAAK,QAAQ,IAAIH,CAAC,CAACS,WAAW,EAAEN,IAAI,GAAGH,CAAC,CAACS,WAAW,CAACN,IAAI;EACjE,IAAIA,IAAI,KAAK,KAAK,IAAIA,IAAI,KAAK,KAAK,EAAE,OAAOO,KAAK,CAACC,IAAI,CAACX,CAAC,CAAC;EAC1D,IACEG,IAAI,KAAK,WAAW,IACpB,0CAA0C,CAACS,IAAI,CAACT,IAAI,CAAC,EACrD;IACA,OAAO,IAAAD,yBAAgB,EAACF,CAAC,EAAEC,MAAM,CAAC;EACpC;AACF","ignoreList":[]}
|
||||
+19
-10
@@ -36,29 +36,38 @@ function AsyncGenerator(gen) {
|
||||
var overloaded = value instanceof _OverloadYield.default;
|
||||
Promise.resolve(overloaded ? value.v : value).then(function (arg) {
|
||||
if (overloaded) {
|
||||
var nextKey = key === "return" && value.k ? key : "next";
|
||||
var nextKey = key === "return" ? "return" : "next";
|
||||
if (!value.k || arg.done) {
|
||||
return resume(nextKey, arg);
|
||||
} else {
|
||||
arg = gen[nextKey](arg).value;
|
||||
}
|
||||
}
|
||||
settle(!!result.done, arg);
|
||||
settle(result.done ? "return" : "normal", arg);
|
||||
}, function (err) {
|
||||
resume("throw", err);
|
||||
});
|
||||
} catch (err) {
|
||||
settle(2, err);
|
||||
settle("throw", err);
|
||||
}
|
||||
}
|
||||
function settle(type, value) {
|
||||
if (type === 2) {
|
||||
front.reject(value);
|
||||
} else {
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: type
|
||||
});
|
||||
switch (type) {
|
||||
case "return":
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: true
|
||||
});
|
||||
break;
|
||||
case "throw":
|
||||
front.reject(value);
|
||||
break;
|
||||
default:
|
||||
front.resolve({
|
||||
value: value,
|
||||
done: false
|
||||
});
|
||||
break;
|
||||
}
|
||||
front = front.next;
|
||||
if (front) {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+13
-9
@@ -93,12 +93,14 @@ function loadHelper(name) {
|
||||
return helperData[name];
|
||||
}
|
||||
function get(name, getDependency, bindingName, localBindings, adjustAst) {
|
||||
if (typeof bindingName === "object") {
|
||||
const id = bindingName;
|
||||
if ((id == null ? void 0 : id.type) === "Identifier") {
|
||||
bindingName = id.name;
|
||||
} else {
|
||||
bindingName = undefined;
|
||||
{
|
||||
if (typeof bindingName === "object") {
|
||||
const id = bindingName;
|
||||
if ((id == null ? void 0 : id.type) === "Identifier") {
|
||||
bindingName = id.name;
|
||||
} else {
|
||||
bindingName = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
return loadHelper(name).build(getDependency, bindingName, localBindings, adjustAst);
|
||||
@@ -113,9 +115,11 @@ function isInternal(name) {
|
||||
var _helpers$name;
|
||||
return (_helpers$name = _helpersGenerated.default[name]) == null ? void 0 : _helpers$name.metadata.internal;
|
||||
}
|
||||
exports.ensure = name => {
|
||||
loadHelper(name);
|
||||
};
|
||||
{
|
||||
exports.ensure = name => {
|
||||
loadHelper(name);
|
||||
};
|
||||
}
|
||||
const list = exports.list = Object.keys(_helpersGenerated.default).map(name => name.replace(/^_/, ""));
|
||||
var _default = exports.default = get;
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+6
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/helpers",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.4",
|
||||
"description": "Collection of helper functions used by Babel transforms.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helpers",
|
||||
@@ -15,13 +15,13 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.29.7",
|
||||
"@babel/types": "^7.29.7"
|
||||
"@babel/template": "^7.27.2",
|
||||
"@babel/types": "^7.28.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/generator": "^7.29.7",
|
||||
"@babel/helper-plugin-test-runner": "^7.29.7",
|
||||
"@babel/parser": "^7.29.7",
|
||||
"@babel/generator": "^7.28.3",
|
||||
"@babel/helper-plugin-test-runner": "^7.27.1",
|
||||
"@babel/parser": "^7.28.4",
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
+316
-253
@@ -350,16 +350,18 @@ function toParseErrorConstructor({
|
||||
syntaxPlugin
|
||||
}) {
|
||||
const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
|
||||
const oldReasonCodes = {
|
||||
AccessorCannotDeclareThisParameter: "AccesorCannotDeclareThisParameter",
|
||||
AccessorCannotHaveTypeParameters: "AccesorCannotHaveTypeParameters",
|
||||
ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",
|
||||
SetAccessorCannotHaveOptionalParameter: "SetAccesorCannotHaveOptionalParameter",
|
||||
SetAccessorCannotHaveRestParameter: "SetAccesorCannotHaveRestParameter",
|
||||
SetAccessorCannotHaveReturnType: "SetAccesorCannotHaveReturnType"
|
||||
};
|
||||
if (oldReasonCodes[reasonCode]) {
|
||||
reasonCode = oldReasonCodes[reasonCode];
|
||||
{
|
||||
const oldReasonCodes = {
|
||||
AccessorCannotDeclareThisParameter: "AccesorCannotDeclareThisParameter",
|
||||
AccessorCannotHaveTypeParameters: "AccesorCannotHaveTypeParameters",
|
||||
ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",
|
||||
SetAccessorCannotHaveOptionalParameter: "SetAccesorCannotHaveOptionalParameter",
|
||||
SetAccessorCannotHaveRestParameter: "SetAccesorCannotHaveRestParameter",
|
||||
SetAccessorCannotHaveReturnType: "SetAccesorCannotHaveReturnType"
|
||||
};
|
||||
if (oldReasonCodes[reasonCode]) {
|
||||
reasonCode = oldReasonCodes[reasonCode];
|
||||
}
|
||||
}
|
||||
return function constructor(loc, details) {
|
||||
const error = new SyntaxError();
|
||||
@@ -620,8 +622,10 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
||||
}
|
||||
parsePrivateName() {
|
||||
const node = super.parsePrivateName();
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return node;
|
||||
{
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return this.convertPrivateNameToPrivateIdentifier(node);
|
||||
}
|
||||
@@ -632,14 +636,18 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
||||
return this.castNodeTo(node, "PrivateIdentifier");
|
||||
}
|
||||
isPrivateName(node) {
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return super.isPrivateName(node);
|
||||
{
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return super.isPrivateName(node);
|
||||
}
|
||||
}
|
||||
return node.type === "PrivateIdentifier";
|
||||
}
|
||||
getPrivateNameSV(node) {
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return super.getPrivateNameSV(node);
|
||||
{
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return super.getPrivateNameSV(node);
|
||||
}
|
||||
}
|
||||
return node.name;
|
||||
}
|
||||
@@ -687,25 +695,35 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
||||
}
|
||||
parseClassProperty(...args) {
|
||||
const propertyNode = super.parseClassProperty(...args);
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return propertyNode;
|
||||
{
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return propertyNode;
|
||||
}
|
||||
}
|
||||
{
|
||||
this.castNodeTo(propertyNode, "PropertyDefinition");
|
||||
}
|
||||
this.castNodeTo(propertyNode, "PropertyDefinition");
|
||||
return propertyNode;
|
||||
}
|
||||
parseClassPrivateProperty(...args) {
|
||||
const propertyNode = super.parseClassPrivateProperty(...args);
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return propertyNode;
|
||||
{
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return propertyNode;
|
||||
}
|
||||
}
|
||||
{
|
||||
this.castNodeTo(propertyNode, "PropertyDefinition");
|
||||
}
|
||||
this.castNodeTo(propertyNode, "PropertyDefinition");
|
||||
propertyNode.computed = false;
|
||||
return propertyNode;
|
||||
}
|
||||
parseClassAccessorProperty(node) {
|
||||
const accessorPropertyNode = super.parseClassAccessorProperty(node);
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return accessorPropertyNode;
|
||||
{
|
||||
if (!this.getPluginOption("estree", "classFeatures")) {
|
||||
return accessorPropertyNode;
|
||||
}
|
||||
}
|
||||
if (accessorPropertyNode.abstract && this.hasPlugin("typescript")) {
|
||||
delete accessorPropertyNode.abstract;
|
||||
@@ -762,11 +780,14 @@ var estree = superClass => class ESTreeParserMixin extends superClass {
|
||||
finishCallExpression(unfinished, optional) {
|
||||
const node = super.finishCallExpression(unfinished, optional);
|
||||
if (node.callee.type === "Import") {
|
||||
var _ref, _ref2;
|
||||
var _ref;
|
||||
this.castNodeTo(node, "ImportExpression");
|
||||
node.source = node.arguments[0];
|
||||
node.options = (_ref = node.arguments[1]) != null ? _ref : null;
|
||||
node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
|
||||
{
|
||||
var _ref2;
|
||||
node.attributes = (_ref2 = node.arguments[1]) != null ? _ref2 : null;
|
||||
}
|
||||
delete node.arguments;
|
||||
delete node.callee;
|
||||
} else if (node.type === "OptionalCallExpression") {
|
||||
@@ -890,7 +911,9 @@ const types = {
|
||||
j_cTag: new TokContext("</tag"),
|
||||
j_expr: new TokContext("<tag>...</tag>", true)
|
||||
};
|
||||
types.template = new TokContext("`", true);
|
||||
{
|
||||
types.template = new TokContext("`", true);
|
||||
}
|
||||
const beforeExpr = true;
|
||||
const startsExpr = true;
|
||||
const isLoop = true;
|
||||
@@ -919,7 +942,9 @@ class ExportedTokenType {
|
||||
this.prefix = !!conf.prefix;
|
||||
this.postfix = !!conf.postfix;
|
||||
this.binop = conf.binop != null ? conf.binop : null;
|
||||
this.updateContext = null;
|
||||
{
|
||||
this.updateContext = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
const keywords$1 = new Map();
|
||||
@@ -1420,22 +1445,24 @@ function tokenIsTemplate(token) {
|
||||
function getExportedToken(token) {
|
||||
return tokenTypes[token];
|
||||
}
|
||||
tokenTypes[8].updateContext = context => {
|
||||
context.pop();
|
||||
};
|
||||
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = context => {
|
||||
context.push(types.brace);
|
||||
};
|
||||
tokenTypes[22].updateContext = context => {
|
||||
if (context[context.length - 1] === types.template) {
|
||||
{
|
||||
tokenTypes[8].updateContext = context => {
|
||||
context.pop();
|
||||
} else {
|
||||
context.push(types.template);
|
||||
}
|
||||
};
|
||||
tokenTypes[143].updateContext = context => {
|
||||
context.push(types.j_expr, types.j_oTag);
|
||||
};
|
||||
};
|
||||
tokenTypes[5].updateContext = tokenTypes[7].updateContext = tokenTypes[23].updateContext = context => {
|
||||
context.push(types.brace);
|
||||
};
|
||||
tokenTypes[22].updateContext = context => {
|
||||
if (context[context.length - 1] === types.template) {
|
||||
context.pop();
|
||||
} else {
|
||||
context.push(types.template);
|
||||
}
|
||||
};
|
||||
tokenTypes[143].updateContext = context => {
|
||||
context.push(types.j_expr, types.j_oTag);
|
||||
};
|
||||
}
|
||||
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088f\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5c\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdc-\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7dc\ua7f1-\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 = "\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\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\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-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1add\u1ae0-\u1aeb\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\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\uff65";
|
||||
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
||||
@@ -1946,7 +1973,7 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
}
|
||||
flowParseDeclareVariable(node) {
|
||||
this.next();
|
||||
node.id = this.flowParseTypeAnnotatableIdentifier();
|
||||
node.id = this.flowParseTypeAnnotatableIdentifier(true);
|
||||
this.scope.declareName(node.id.name, 5, node.id.loc.start);
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "DeclareVariable");
|
||||
@@ -2120,14 +2147,9 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
reservedType: word
|
||||
});
|
||||
}
|
||||
flowParseRestrictedIdentifierName(liberal, declaration) {
|
||||
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
||||
return this.parseIdentifierName(liberal);
|
||||
}
|
||||
flowParseRestrictedIdentifier(liberal, declaration) {
|
||||
const node = this.startNode();
|
||||
const name = this.flowParseRestrictedIdentifierName(liberal, declaration);
|
||||
return this.createIdentifier(node, name);
|
||||
this.checkReservedType(this.state.value, this.state.startLoc, declaration);
|
||||
return this.parseIdentifier(liberal);
|
||||
}
|
||||
flowParseTypeAlias(node) {
|
||||
node.id = this.flowParseRestrictedIdentifier(false, true);
|
||||
@@ -2161,21 +2183,14 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
this.semicolon();
|
||||
return this.finishNode(node, "OpaqueType");
|
||||
}
|
||||
flowParseTypeParameterBound() {
|
||||
if (this.match(14) || this.isContextual(81)) {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
node.typeAnnotation = this.flowParseType();
|
||||
return this.finishNode(node, "TypeAnnotation");
|
||||
}
|
||||
}
|
||||
flowParseTypeParameter(requireDefault = false) {
|
||||
const nodeStartLoc = this.state.startLoc;
|
||||
const node = this.startNode();
|
||||
const variance = this.flowParseVariance();
|
||||
node.name = this.flowParseRestrictedIdentifierName();
|
||||
const ident = this.flowParseTypeAnnotatableIdentifier();
|
||||
node.name = ident.name;
|
||||
node.variance = variance;
|
||||
node.bound = this.flowParseTypeParameterBound();
|
||||
node.bound = ident.typeAnnotation;
|
||||
if (this.match(29)) {
|
||||
this.eat(29);
|
||||
node.default = this.flowParseType();
|
||||
@@ -2872,13 +2887,13 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
node.typeAnnotation = this.flowParseTypeInitialiser();
|
||||
return this.finishNode(node, "TypeAnnotation");
|
||||
}
|
||||
flowParseTypeAnnotatableIdentifier() {
|
||||
const node = this.startNode();
|
||||
const name = this.parseIdentifierName();
|
||||
flowParseTypeAnnotatableIdentifier(allowPrimitiveOverride) {
|
||||
const ident = allowPrimitiveOverride ? this.parseIdentifier() : this.flowParseRestrictedIdentifier();
|
||||
if (this.match(14)) {
|
||||
node.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
ident.typeAnnotation = this.flowParseTypeAnnotation();
|
||||
this.resetEndLocation(ident);
|
||||
}
|
||||
return this.createIdentifier(node, name);
|
||||
return ident;
|
||||
}
|
||||
typeCastToParameter(node) {
|
||||
node.expression.typeAnnotation = node.typeAnnotation;
|
||||
@@ -3306,7 +3321,9 @@ var flow = superClass => class FlowParserMixin extends superClass {
|
||||
parseClassSuper(node) {
|
||||
super.parseClassSuper(node);
|
||||
if (node.superClass && (this.match(47) || this.match(51))) {
|
||||
node.superTypeParameters = this.flowParseTypeParameterInstantiationInExpression();
|
||||
{
|
||||
node.superTypeParameters = this.flowParseTypeParameterInstantiationInExpression();
|
||||
}
|
||||
}
|
||||
if (this.isContextual(113)) {
|
||||
this.next();
|
||||
@@ -5102,10 +5119,10 @@ class CommentsParser extends BaseParser {
|
||||
switch (node.type) {
|
||||
case "ObjectExpression":
|
||||
case "ObjectPattern":
|
||||
case "RecordExpression":
|
||||
adjustInnerComments(node, node.properties, commentWS);
|
||||
break;
|
||||
case "CallExpression":
|
||||
case "NewExpression":
|
||||
case "OptionalCallExpression":
|
||||
adjustInnerComments(node, node.arguments, commentWS);
|
||||
break;
|
||||
@@ -5118,11 +5135,11 @@ class CommentsParser extends BaseParser {
|
||||
case "ObjectMethod":
|
||||
case "ClassMethod":
|
||||
case "ClassPrivateMethod":
|
||||
case "TSTypeParameterDeclaration":
|
||||
adjustInnerComments(node, node.params, commentWS);
|
||||
break;
|
||||
case "ArrayExpression":
|
||||
case "ArrayPattern":
|
||||
case "TupleExpression":
|
||||
adjustInnerComments(node, node.elements, commentWS);
|
||||
break;
|
||||
case "ExportNamedDeclaration":
|
||||
@@ -5130,24 +5147,15 @@ class CommentsParser extends BaseParser {
|
||||
adjustInnerComments(node, node.specifiers, commentWS);
|
||||
break;
|
||||
case "TSEnumDeclaration":
|
||||
adjustInnerComments(node, node.members, commentWS);
|
||||
{
|
||||
adjustInnerComments(node, node.members, commentWS);
|
||||
}
|
||||
break;
|
||||
case "TSEnumBody":
|
||||
adjustInnerComments(node, node.members, commentWS);
|
||||
break;
|
||||
case "TSInterfaceBody":
|
||||
adjustInnerComments(node, node.body, commentWS);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (node.type === "RecordExpression") {
|
||||
adjustInnerComments(node, node.properties, commentWS);
|
||||
break;
|
||||
}
|
||||
if (node.type === "TupleExpression") {
|
||||
adjustInnerComments(node, node.elements, commentWS);
|
||||
break;
|
||||
}
|
||||
setInnerComments(node, comments);
|
||||
}
|
||||
}
|
||||
@@ -7089,17 +7097,19 @@ class Node {
|
||||
}
|
||||
}
|
||||
const NodePrototype = Node.prototype;
|
||||
NodePrototype.__clone = function () {
|
||||
const newNode = new Node(undefined, this.start, this.loc.start);
|
||||
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];
|
||||
{
|
||||
NodePrototype.__clone = function () {
|
||||
const newNode = new Node(undefined, this.start, this.loc.start);
|
||||
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;
|
||||
};
|
||||
return newNode;
|
||||
};
|
||||
}
|
||||
class NodeUtils extends UtilParser {
|
||||
startNode() {
|
||||
const loc = this.state.startLoc;
|
||||
@@ -7951,9 +7961,13 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
this.expect(10);
|
||||
if (!this.match(134)) {
|
||||
this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc);
|
||||
node.argument = super.parseExprAtom();
|
||||
{
|
||||
node.argument = super.parseExprAtom();
|
||||
}
|
||||
} else {
|
||||
node.argument = this.parseStringLiteral(this.state.value);
|
||||
{
|
||||
node.argument = this.parseStringLiteral(this.state.value);
|
||||
}
|
||||
}
|
||||
if (this.eat(12)) {
|
||||
node.options = this.tsParseImportTypeOptions();
|
||||
@@ -7965,7 +7979,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
node.qualifier = this.tsParseEntityName(1 | 2);
|
||||
}
|
||||
if (this.match(47)) {
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
{
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
}
|
||||
}
|
||||
return this.finishNode(node, "TSImportType");
|
||||
}
|
||||
@@ -8030,7 +8046,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
const node = this.startNode();
|
||||
node.typeName = this.tsParseEntityName(1);
|
||||
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
{
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
}
|
||||
}
|
||||
return this.finishNode(node, "TSTypeReference");
|
||||
}
|
||||
@@ -8053,10 +8071,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
if (this.match(83)) {
|
||||
node.exprName = this.tsParseImportType();
|
||||
} else {
|
||||
node.exprName = this.tsParseEntityName(1 | 2);
|
||||
{
|
||||
node.exprName = this.tsParseEntityName(1 | 2);
|
||||
}
|
||||
}
|
||||
if (!this.hasPrecedingLineBreak() && this.match(47)) {
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
{
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
}
|
||||
}
|
||||
return this.finishNode(node, "TSTypeQuery");
|
||||
}
|
||||
@@ -8277,10 +8299,12 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
node.readonly = true;
|
||||
}
|
||||
this.expect(0);
|
||||
const typeParameter = this.startNode();
|
||||
typeParameter.name = this.tsParseTypeParameterName();
|
||||
typeParameter.constraint = this.tsExpectThenParseType(58);
|
||||
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
||||
{
|
||||
const typeParameter = this.startNode();
|
||||
typeParameter.name = this.tsParseTypeParameterName();
|
||||
typeParameter.constraint = this.tsExpectThenParseType(58);
|
||||
node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
|
||||
}
|
||||
node.nameType = this.eatContextual(93) ? this.tsParseType() : null;
|
||||
this.expect(3);
|
||||
if (this.match(53)) {
|
||||
@@ -8412,9 +8436,11 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
return this.finishNode(node, "TSLiteralType");
|
||||
}
|
||||
tsParseTemplateLiteralType() {
|
||||
const node = this.startNode();
|
||||
node.literal = super.parseTemplate(false);
|
||||
return this.finishNode(node, "TSLiteralType");
|
||||
{
|
||||
const node = this.startNode();
|
||||
node.literal = super.parseTemplate(false);
|
||||
return this.finishNode(node, "TSLiteralType");
|
||||
}
|
||||
}
|
||||
parseTemplateSubstitution() {
|
||||
if (this.state.inType) return this.tsParseType();
|
||||
@@ -8744,12 +8770,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
tsParseHeritageClause(token) {
|
||||
const originalStartLoc = this.state.startLoc;
|
||||
const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
||||
const node = this.startNode();
|
||||
node.expression = this.tsParseEntityName(1 | 2);
|
||||
if (this.match(47)) {
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
{
|
||||
const node = this.startNode();
|
||||
node.expression = this.tsParseEntityName(1 | 2);
|
||||
if (this.match(47)) {
|
||||
node.typeParameters = this.tsParseTypeArguments();
|
||||
}
|
||||
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
||||
}
|
||||
return this.finishNode(node, "TSExpressionWithTypeArguments");
|
||||
});
|
||||
if (!delimitedList.length) {
|
||||
this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
||||
@@ -8865,9 +8893,11 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
this.expectContextual(126);
|
||||
node.id = this.parseIdentifier();
|
||||
this.checkIdentifier(node.id, node.const ? 8971 : 8459);
|
||||
this.expect(5);
|
||||
node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
|
||||
this.expect(8);
|
||||
{
|
||||
this.expect(5);
|
||||
node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this));
|
||||
this.expect(8);
|
||||
}
|
||||
return this.finishNode(node, "TSEnumDeclaration");
|
||||
}
|
||||
tsParseEnumBody() {
|
||||
@@ -8906,7 +8936,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
tsParseAmbientExternalModuleDeclaration(node) {
|
||||
if (this.isContextual(112)) {
|
||||
node.kind = "global";
|
||||
node.global = true;
|
||||
{
|
||||
node.global = true;
|
||||
}
|
||||
node.id = this.parseIdentifier();
|
||||
} else if (this.match(134)) {
|
||||
node.kind = "module";
|
||||
@@ -8926,7 +8958,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
return this.finishNode(node, "TSModuleDeclaration");
|
||||
}
|
||||
tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
|
||||
node.isExport = isExport || false;
|
||||
{
|
||||
node.isExport = isExport || false;
|
||||
}
|
||||
node.id = maybeDefaultIdentifier || this.parseIdentifier();
|
||||
this.checkIdentifier(node.id, 4096);
|
||||
this.expect(29);
|
||||
@@ -9248,7 +9282,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
}
|
||||
if (tokenIsTemplate(this.state.type)) {
|
||||
const result = super.parseTaggedTemplateExpression(base, startLoc, state);
|
||||
result.typeParameters = typeArguments;
|
||||
{
|
||||
result.typeParameters = typeArguments;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
if (!noCalls && this.eat(10)) {
|
||||
@@ -9256,19 +9292,23 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
node.callee = base;
|
||||
node.arguments = this.parseCallExpressionArguments();
|
||||
this.tsCheckForInvalidTypeCasts(node.arguments);
|
||||
node.typeParameters = typeArguments;
|
||||
{
|
||||
node.typeParameters = typeArguments;
|
||||
}
|
||||
if (state.optionalChainMember) {
|
||||
node.optional = isOptionalCall;
|
||||
}
|
||||
return this.finishCallExpression(node, state.optionalChainMember);
|
||||
}
|
||||
const tokenType = this.state.type;
|
||||
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenType !== 93 && tokenType !== 120 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
||||
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
|
||||
return;
|
||||
}
|
||||
const node = this.startNodeAt(startLoc);
|
||||
node.expression = base;
|
||||
node.typeParameters = typeArguments;
|
||||
{
|
||||
node.typeParameters = typeArguments;
|
||||
}
|
||||
return this.finishNode(node, "TSInstantiationExpression");
|
||||
});
|
||||
if (missingParenErrorLoc) {
|
||||
@@ -9295,7 +9335,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
callee
|
||||
} = node;
|
||||
if (callee.type === "TSInstantiationExpression" && !((_callee$extra = callee.extra) != null && _callee$extra.parenthesized)) {
|
||||
node.typeParameters = callee.typeParameters;
|
||||
{
|
||||
node.typeParameters = callee.typeParameters;
|
||||
}
|
||||
node.callee = callee.expression;
|
||||
}
|
||||
}
|
||||
@@ -9385,7 +9427,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
nodeImportEquals.importKind = "value";
|
||||
}
|
||||
const declaration = this.tsParseImportEqualsDeclaration(nodeImportEquals, maybeDefaultIdentifier, true);
|
||||
return declaration;
|
||||
{
|
||||
return declaration;
|
||||
}
|
||||
} else if (this.eat(29)) {
|
||||
const assign = node;
|
||||
assign.expression = super.parseExpression();
|
||||
@@ -9738,16 +9782,8 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
}
|
||||
parseClassSuper(node) {
|
||||
super.parseClassSuper(node);
|
||||
if (node.superClass) {
|
||||
if (node.superClass.type === "TSInstantiationExpression") {
|
||||
const tsInstantiationExpression = node.superClass;
|
||||
const superClass = tsInstantiationExpression.expression;
|
||||
this.takeSurroundingComments(superClass, superClass.start, superClass.end);
|
||||
const superTypeArguments = tsInstantiationExpression.typeParameters;
|
||||
this.takeSurroundingComments(superTypeArguments, superTypeArguments.start, superTypeArguments.end);
|
||||
node.superClass = superClass;
|
||||
node.superTypeParameters = superTypeArguments;
|
||||
} else if (this.match(47) || this.match(51)) {
|
||||
if (node.superClass && (this.match(47) || this.match(51))) {
|
||||
{
|
||||
node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
|
||||
}
|
||||
}
|
||||
@@ -9963,7 +9999,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
const typeArguments = this.tsParseTypeArgumentsInExpression();
|
||||
if (this.match(10)) {
|
||||
const call = super.parseMaybeDecoratorArguments(expr, startLoc);
|
||||
call.typeParameters = typeArguments;
|
||||
{
|
||||
call.typeParameters = typeArguments;
|
||||
}
|
||||
return call;
|
||||
}
|
||||
this.unexpected(null, 10);
|
||||
@@ -10054,7 +10092,9 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
|
||||
if (this.match(47) || this.match(51)) {
|
||||
const typeArguments = this.tsTryParseAndCatch(() => this.tsParseTypeArgumentsInExpression());
|
||||
if (typeArguments) {
|
||||
node.typeParameters = typeArguments;
|
||||
{
|
||||
node.typeParameters = typeArguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.jsxParseOpeningElementAfterName(node);
|
||||
@@ -10502,8 +10542,7 @@ var placeholders = superClass => class PlaceholdersParserMixin extends superClas
|
||||
return false;
|
||||
}
|
||||
verifyBreakContinue(node, isBreak) {
|
||||
var _node$label;
|
||||
if (((_node$label = node.label) == null ? void 0 : _node$label.type) === "Placeholder") return;
|
||||
if (node.label && node.label.type === "Placeholder") return;
|
||||
super.verifyBreakContinue(node, isBreak);
|
||||
}
|
||||
parseExpressionStatement(node, expr) {
|
||||
@@ -10676,7 +10715,6 @@ function validatePlugins(pluginsMap) {
|
||||
throw new Error(`"pipelineOperator" requires "proposal" option whose value must be one of: ${proposalList}.`);
|
||||
}
|
||||
if (proposal === "hack") {
|
||||
var _pluginsMap$get;
|
||||
if (pluginsMap.has("placeholders")) {
|
||||
throw new Error("Cannot combine placeholders plugin and Hack-style pipes.");
|
||||
}
|
||||
@@ -10688,20 +10726,25 @@ function validatePlugins(pluginsMap) {
|
||||
const tokenList = TOPIC_TOKENS.map(t => `"${t}"`).join(", ");
|
||||
throw new Error(`"pipelineOperator" in "proposal": "hack" mode also requires a "topicToken" option whose value must be one of: ${tokenList}.`);
|
||||
}
|
||||
if (topicToken === "#" && ((_pluginsMap$get = pluginsMap.get("recordAndTuple")) == null ? void 0 : _pluginsMap$get.syntaxType) === "hash") {
|
||||
throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
|
||||
{
|
||||
var _pluginsMap$get;
|
||||
if (topicToken === "#" && ((_pluginsMap$get = pluginsMap.get("recordAndTuple")) == null ? void 0 : _pluginsMap$get.syntaxType) === "hash") {
|
||||
throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "hack", topicToken: "#" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
|
||||
}
|
||||
}
|
||||
} else if (proposal === "smart" && ((_pluginsMap$get2 = pluginsMap.get("recordAndTuple")) == null ? void 0 : _pluginsMap$get2.syntaxType) === "hash") {
|
||||
throw new Error(`Plugin conflict between \`["pipelineOperator", { proposal: "smart" }]\` and \`${JSON.stringify(["recordAndTuple", pluginsMap.get("recordAndTuple")])}\`.`);
|
||||
}
|
||||
}
|
||||
if (pluginsMap.has("moduleAttributes")) {
|
||||
if (pluginsMap.has("deprecatedImportAssert") || pluginsMap.has("importAssertions")) {
|
||||
throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");
|
||||
}
|
||||
const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
|
||||
if (moduleAttributesVersionPluginOption !== "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 (pluginsMap.has("deprecatedImportAssert") || pluginsMap.has("importAssertions")) {
|
||||
throw new Error("Cannot combine importAssertions, deprecatedImportAssert and moduleAttributes plugins.");
|
||||
}
|
||||
const moduleAttributesVersionPluginOption = pluginsMap.get("moduleAttributes").version;
|
||||
if (moduleAttributesVersionPluginOption !== "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 (pluginsMap.has("importAssertions")) {
|
||||
@@ -10709,15 +10752,19 @@ function validatePlugins(pluginsMap) {
|
||||
throw new Error("Cannot combine importAssertions and deprecatedImportAssert plugins.");
|
||||
}
|
||||
}
|
||||
if (pluginsMap.has("deprecatedImportAssert")) ;else if (pluginsMap.has("importAttributes") && pluginsMap.get("importAttributes").deprecatedAssertSyntax) {
|
||||
pluginsMap.set("deprecatedImportAssert", {});
|
||||
if (!pluginsMap.has("deprecatedImportAssert") && pluginsMap.has("importAttributes") && pluginsMap.get("importAttributes").deprecatedAssertSyntax) {
|
||||
{
|
||||
pluginsMap.set("deprecatedImportAssert", {});
|
||||
}
|
||||
}
|
||||
if (pluginsMap.has("recordAndTuple")) {
|
||||
const syntaxType = pluginsMap.get("recordAndTuple").syntaxType;
|
||||
if (syntaxType != null) {
|
||||
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
||||
if (!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)) {
|
||||
throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
|
||||
{
|
||||
const syntaxType = pluginsMap.get("recordAndTuple").syntaxType;
|
||||
if (syntaxType != null) {
|
||||
const RECORD_AND_TUPLE_SYNTAX_TYPES = ["hash", "bar"];
|
||||
if (!RECORD_AND_TUPLE_SYNTAX_TYPES.includes(syntaxType)) {
|
||||
throw new Error("The 'syntaxType' option of the 'recordAndTuple' plugin must be one of: " + RECORD_AND_TUPLE_SYNTAX_TYPES.map(p => `'${p}'`).join(", "));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11417,12 +11464,14 @@ class ExpressionParser extends LValParser {
|
||||
throw this.unexpected();
|
||||
}
|
||||
default:
|
||||
if (type === 137) {
|
||||
return this.parseDecimalLiteral(this.state.value);
|
||||
} else if (type === 2 || type === 1) {
|
||||
return this.parseArrayLike(this.state.type === 2 ? 4 : 3, true);
|
||||
} else if (type === 6 || type === 7) {
|
||||
return this.parseObjectLike(this.state.type === 6 ? 9 : 8, false, true);
|
||||
{
|
||||
if (type === 137) {
|
||||
return this.parseDecimalLiteral(this.state.value);
|
||||
} else if (type === 2 || type === 1) {
|
||||
return this.parseArrayLike(this.state.type === 2 ? 4 : 3, true);
|
||||
} else if (type === 6 || type === 7) {
|
||||
return this.parseObjectLike(this.state.type === 6 ? 9 : 8, false, true);
|
||||
}
|
||||
}
|
||||
if (tokenIsIdentifier(type)) {
|
||||
if (this.isContextual(127) && this.lookaheadInLineCharCode() === 123) {
|
||||
@@ -11440,7 +11489,7 @@ class ExpressionParser extends LValParser {
|
||||
this.next();
|
||||
return this.parseAsyncFunctionExpression(this.startNodeAtNode(id));
|
||||
} else if (tokenIsIdentifier(type)) {
|
||||
if (canBeArrow && this.lookaheadCharCode() === 61) {
|
||||
if (this.lookaheadCharCode() === 61) {
|
||||
return this.parseAsyncArrowUnaryFunction(this.startNodeAtNode(id));
|
||||
} else {
|
||||
return id;
|
||||
@@ -11547,12 +11596,16 @@ class ExpressionParser extends LValParser {
|
||||
const node = this.startNode();
|
||||
this.next();
|
||||
if (this.match(10) && !this.scope.allowDirectSuper) {
|
||||
if (!(this.optionFlags & 16)) {
|
||||
this.raise(Errors.SuperNotAllowed, node);
|
||||
{
|
||||
if (!(this.optionFlags & 16)) {
|
||||
this.raise(Errors.SuperNotAllowed, node);
|
||||
}
|
||||
}
|
||||
} else if (!this.scope.allowSuper) {
|
||||
if (!(this.optionFlags & 16)) {
|
||||
this.raise(Errors.UnexpectedSuper, node);
|
||||
{
|
||||
if (!(this.optionFlags & 16)) {
|
||||
this.raise(Errors.UnexpectedSuper, node);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.match(10) && !this.match(0) && !this.match(16)) {
|
||||
@@ -11632,7 +11685,9 @@ class ExpressionParser extends LValParser {
|
||||
return this.parseLiteral(value, "NumericLiteral");
|
||||
}
|
||||
parseBigIntLiteral(value) {
|
||||
return this.parseLiteral(value, "BigIntLiteral");
|
||||
{
|
||||
return this.parseLiteral(value, "BigIntLiteral");
|
||||
}
|
||||
}
|
||||
parseDecimalLiteral(value) {
|
||||
return this.parseLiteral(value, "DecimalLiteral");
|
||||
@@ -11852,8 +11907,10 @@ class ExpressionParser extends LValParser {
|
||||
if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") {
|
||||
this.raise(Errors.InvalidRecordProperty, prop);
|
||||
}
|
||||
if (prop.shorthand) {
|
||||
this.addExtra(prop, "shorthand", true);
|
||||
{
|
||||
if (prop.shorthand) {
|
||||
this.addExtra(prop, "shorthand", true);
|
||||
}
|
||||
}
|
||||
node.properties.push(prop);
|
||||
}
|
||||
@@ -12526,98 +12583,100 @@ function babel7CompatTokens(tokens, input, startIndex) {
|
||||
type
|
||||
} = token;
|
||||
if (typeof type === "number") {
|
||||
if (type === 139) {
|
||||
const {
|
||||
loc,
|
||||
start,
|
||||
value,
|
||||
end
|
||||
} = token;
|
||||
const hashEndPos = start + 1;
|
||||
const hashEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
||||
tokens.splice(i, 1, new Token({
|
||||
type: getExportedToken(27),
|
||||
value: "#",
|
||||
start: start,
|
||||
end: hashEndPos,
|
||||
startLoc: loc.start,
|
||||
endLoc: hashEndLoc
|
||||
}), new Token({
|
||||
type: getExportedToken(132),
|
||||
value: value,
|
||||
start: hashEndPos,
|
||||
end: end,
|
||||
startLoc: hashEndLoc,
|
||||
endLoc: loc.end
|
||||
}));
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (tokenIsTemplate(type)) {
|
||||
const {
|
||||
loc,
|
||||
start,
|
||||
value,
|
||||
end
|
||||
} = token;
|
||||
const backquoteEnd = start + 1;
|
||||
const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
||||
let startToken;
|
||||
if (input.charCodeAt(start - startIndex) === 96) {
|
||||
startToken = new Token({
|
||||
type: getExportedToken(22),
|
||||
value: "`",
|
||||
{
|
||||
if (type === 139) {
|
||||
const {
|
||||
loc,
|
||||
start,
|
||||
value,
|
||||
end
|
||||
} = token;
|
||||
const hashEndPos = start + 1;
|
||||
const hashEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
||||
tokens.splice(i, 1, new Token({
|
||||
type: getExportedToken(27),
|
||||
value: "#",
|
||||
start: start,
|
||||
end: backquoteEnd,
|
||||
end: hashEndPos,
|
||||
startLoc: loc.start,
|
||||
endLoc: backquoteEndLoc
|
||||
});
|
||||
} else {
|
||||
startToken = new Token({
|
||||
type: getExportedToken(8),
|
||||
value: "}",
|
||||
start: start,
|
||||
end: backquoteEnd,
|
||||
startLoc: loc.start,
|
||||
endLoc: backquoteEndLoc
|
||||
});
|
||||
}
|
||||
let templateValue, templateElementEnd, templateElementEndLoc, endToken;
|
||||
if (type === 24) {
|
||||
templateElementEnd = end - 1;
|
||||
templateElementEndLoc = createPositionWithColumnOffset(loc.end, -1);
|
||||
templateValue = value === null ? null : value.slice(1, -1);
|
||||
endToken = new Token({
|
||||
type: getExportedToken(22),
|
||||
value: "`",
|
||||
start: templateElementEnd,
|
||||
endLoc: hashEndLoc
|
||||
}), new Token({
|
||||
type: getExportedToken(132),
|
||||
value: value,
|
||||
start: hashEndPos,
|
||||
end: end,
|
||||
startLoc: templateElementEndLoc,
|
||||
startLoc: hashEndLoc,
|
||||
endLoc: loc.end
|
||||
});
|
||||
} else {
|
||||
templateElementEnd = end - 2;
|
||||
templateElementEndLoc = createPositionWithColumnOffset(loc.end, -2);
|
||||
templateValue = value === null ? null : value.slice(1, -2);
|
||||
endToken = new Token({
|
||||
type: getExportedToken(23),
|
||||
value: "${",
|
||||
start: templateElementEnd,
|
||||
end: end,
|
||||
startLoc: templateElementEndLoc,
|
||||
endLoc: loc.end
|
||||
});
|
||||
}));
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (tokenIsTemplate(type)) {
|
||||
const {
|
||||
loc,
|
||||
start,
|
||||
value,
|
||||
end
|
||||
} = token;
|
||||
const backquoteEnd = start + 1;
|
||||
const backquoteEndLoc = createPositionWithColumnOffset(loc.start, 1);
|
||||
let startToken;
|
||||
if (input.charCodeAt(start - startIndex) === 96) {
|
||||
startToken = new Token({
|
||||
type: getExportedToken(22),
|
||||
value: "`",
|
||||
start: start,
|
||||
end: backquoteEnd,
|
||||
startLoc: loc.start,
|
||||
endLoc: backquoteEndLoc
|
||||
});
|
||||
} else {
|
||||
startToken = new Token({
|
||||
type: getExportedToken(8),
|
||||
value: "}",
|
||||
start: start,
|
||||
end: backquoteEnd,
|
||||
startLoc: loc.start,
|
||||
endLoc: backquoteEndLoc
|
||||
});
|
||||
}
|
||||
let templateValue, templateElementEnd, templateElementEndLoc, endToken;
|
||||
if (type === 24) {
|
||||
templateElementEnd = end - 1;
|
||||
templateElementEndLoc = createPositionWithColumnOffset(loc.end, -1);
|
||||
templateValue = value === null ? null : value.slice(1, -1);
|
||||
endToken = new Token({
|
||||
type: getExportedToken(22),
|
||||
value: "`",
|
||||
start: templateElementEnd,
|
||||
end: end,
|
||||
startLoc: templateElementEndLoc,
|
||||
endLoc: loc.end
|
||||
});
|
||||
} else {
|
||||
templateElementEnd = end - 2;
|
||||
templateElementEndLoc = createPositionWithColumnOffset(loc.end, -2);
|
||||
templateValue = value === null ? null : value.slice(1, -2);
|
||||
endToken = new Token({
|
||||
type: getExportedToken(23),
|
||||
value: "${",
|
||||
start: templateElementEnd,
|
||||
end: end,
|
||||
startLoc: templateElementEndLoc,
|
||||
endLoc: loc.end
|
||||
});
|
||||
}
|
||||
tokens.splice(i, 1, startToken, new Token({
|
||||
type: getExportedToken(20),
|
||||
value: templateValue,
|
||||
start: backquoteEnd,
|
||||
end: templateElementEnd,
|
||||
startLoc: backquoteEndLoc,
|
||||
endLoc: templateElementEndLoc
|
||||
}), endToken);
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
tokens.splice(i, 1, startToken, new Token({
|
||||
type: getExportedToken(20),
|
||||
value: templateValue,
|
||||
start: backquoteEnd,
|
||||
end: templateElementEnd,
|
||||
startLoc: backquoteEndLoc,
|
||||
endLoc: templateElementEndLoc
|
||||
}), endToken);
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
token.type = getExportedToken(type);
|
||||
}
|
||||
@@ -14342,7 +14401,9 @@ class StatementParser extends ExpressionParser {
|
||||
}
|
||||
maybeParseImportAttributes(node) {
|
||||
let attributes;
|
||||
var useWith = false;
|
||||
{
|
||||
var useWith = false;
|
||||
}
|
||||
if (this.match(76)) {
|
||||
if (this.hasPrecedingLineBreak() && this.lookaheadCharCode() === 40) {
|
||||
return;
|
||||
@@ -14354,7 +14415,9 @@ class StatementParser extends ExpressionParser {
|
||||
} else {
|
||||
attributes = this.parseImportAttributes();
|
||||
}
|
||||
useWith = true;
|
||||
{
|
||||
useWith = true;
|
||||
}
|
||||
} else if (this.isContextual(94) && !this.hasPrecedingLineBreak()) {
|
||||
if (!this.hasPlugin("deprecatedImportAssert") && !this.hasPlugin("importAssertions")) {
|
||||
this.raise(Errors.ImportAttributesUseAssert, this.state.startLoc);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+7
-7
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/parser",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.5",
|
||||
"description": "A JavaScript parser",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-parser",
|
||||
@@ -35,14 +35,14 @@
|
||||
},
|
||||
"# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.29.7"
|
||||
"@babel/types": "^7.28.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/code-frame": "^7.29.7",
|
||||
"@babel/helper-check-duplicate-nodes": "^7.29.7",
|
||||
"@babel/helper-fixtures": "^7.29.7",
|
||||
"@babel/helper-string-parser": "^7.29.7",
|
||||
"@babel/helper-validator-identifier": "^7.29.7",
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/helper-check-duplicate-nodes": "^7.27.1",
|
||||
"@babel/helper-fixtures": "^7.28.0",
|
||||
"@babel/helper-string-parser": "^7.27.1",
|
||||
"@babel/helper-validator-identifier": "^7.28.5",
|
||||
"charcodes": "^0.2.0"
|
||||
},
|
||||
"bin": "./bin/babel-parser.js",
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ type Plugin$1 =
|
||||
| "deferredImportEvaluation"
|
||||
| "decoratorAutoAccessors"
|
||||
| "destructuringPrivate"
|
||||
| IF_BABEL_7<"deprecatedImportAssert">
|
||||
| "deprecatedImportAssert"
|
||||
| "doExpressions"
|
||||
| IF_BABEL_7<"dynamicImport">
|
||||
| IF_BABEL_7<"explicitResourceManagement">
|
||||
|
||||
+31
-18
@@ -5,42 +5,55 @@ function _wrapAsyncGenerator(e) {
|
||||
};
|
||||
}
|
||||
function AsyncGenerator(e) {
|
||||
var t, n;
|
||||
function resume(t, n) {
|
||||
var r, t;
|
||||
function resume(r, t) {
|
||||
try {
|
||||
var r = e[t](n),
|
||||
o = r.value,
|
||||
var n = e[r](t),
|
||||
o = n.value,
|
||||
u = o instanceof OverloadYield;
|
||||
Promise.resolve(u ? o.v : o).then(function (n) {
|
||||
Promise.resolve(u ? o.v : o).then(function (t) {
|
||||
if (u) {
|
||||
var i = "return" === t && o.k ? t : "next";
|
||||
if (!o.k || n.done) return resume(i, n);
|
||||
n = e[i](n).value;
|
||||
var i = "return" === r ? "return" : "next";
|
||||
if (!o.k || t.done) return resume(i, t);
|
||||
t = e[i](t).value;
|
||||
}
|
||||
settle(!!r.done, n);
|
||||
settle(n.done ? "return" : "normal", t);
|
||||
}, function (e) {
|
||||
resume("throw", e);
|
||||
});
|
||||
} catch (e) {
|
||||
settle(2, e);
|
||||
settle("throw", e);
|
||||
}
|
||||
}
|
||||
function settle(e, r) {
|
||||
2 === e ? t.reject(r) : t.resolve({
|
||||
value: r,
|
||||
done: e
|
||||
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
||||
function settle(e, n) {
|
||||
switch (e) {
|
||||
case "return":
|
||||
r.resolve({
|
||||
value: n,
|
||||
done: !0
|
||||
});
|
||||
break;
|
||||
case "throw":
|
||||
r.reject(n);
|
||||
break;
|
||||
default:
|
||||
r.resolve({
|
||||
value: n,
|
||||
done: !1
|
||||
});
|
||||
}
|
||||
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
||||
}
|
||||
this._invoke = function (e, r) {
|
||||
this._invoke = function (e, n) {
|
||||
return new Promise(function (o, u) {
|
||||
var i = {
|
||||
key: e,
|
||||
arg: r,
|
||||
arg: n,
|
||||
resolve: o,
|
||||
reject: u,
|
||||
next: null
|
||||
};
|
||||
n ? n = n.next = i : (t = n = i, resume(e, r));
|
||||
t ? t = t.next = i : (r = t = i, resume(e, n));
|
||||
});
|
||||
}, "function" != typeof e["return"] && (this["return"] = void 0);
|
||||
}
|
||||
|
||||
+31
-18
@@ -5,42 +5,55 @@ function _wrapAsyncGenerator(e) {
|
||||
};
|
||||
}
|
||||
function AsyncGenerator(e) {
|
||||
var t, n;
|
||||
function resume(t, n) {
|
||||
var r, t;
|
||||
function resume(r, t) {
|
||||
try {
|
||||
var r = e[t](n),
|
||||
o = r.value,
|
||||
var n = e[r](t),
|
||||
o = n.value,
|
||||
u = o instanceof OverloadYield;
|
||||
Promise.resolve(u ? o.v : o).then(function (n) {
|
||||
Promise.resolve(u ? o.v : o).then(function (t) {
|
||||
if (u) {
|
||||
var i = "return" === t && o.k ? t : "next";
|
||||
if (!o.k || n.done) return resume(i, n);
|
||||
n = e[i](n).value;
|
||||
var i = "return" === r ? "return" : "next";
|
||||
if (!o.k || t.done) return resume(i, t);
|
||||
t = e[i](t).value;
|
||||
}
|
||||
settle(!!r.done, n);
|
||||
settle(n.done ? "return" : "normal", t);
|
||||
}, function (e) {
|
||||
resume("throw", e);
|
||||
});
|
||||
} catch (e) {
|
||||
settle(2, e);
|
||||
settle("throw", e);
|
||||
}
|
||||
}
|
||||
function settle(e, r) {
|
||||
2 === e ? t.reject(r) : t.resolve({
|
||||
value: r,
|
||||
done: e
|
||||
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
||||
function settle(e, n) {
|
||||
switch (e) {
|
||||
case "return":
|
||||
r.resolve({
|
||||
value: n,
|
||||
done: !0
|
||||
});
|
||||
break;
|
||||
case "throw":
|
||||
r.reject(n);
|
||||
break;
|
||||
default:
|
||||
r.resolve({
|
||||
value: n,
|
||||
done: !1
|
||||
});
|
||||
}
|
||||
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
||||
}
|
||||
this._invoke = function (e, r) {
|
||||
this._invoke = function (e, n) {
|
||||
return new Promise(function (o, u) {
|
||||
var i = {
|
||||
key: e,
|
||||
arg: r,
|
||||
arg: n,
|
||||
resolve: o,
|
||||
reject: u,
|
||||
next: null
|
||||
};
|
||||
n ? n = n.next = i : (t = n = i, resume(e, r));
|
||||
t ? t = t.next = i : (r = t = i, resume(e, n));
|
||||
});
|
||||
}, "function" != typeof e["return"] && (this["return"] = void 0);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/runtime",
|
||||
"version": "7.29.7",
|
||||
"version": "7.28.4",
|
||||
"description": "babel's modular runtime helpers",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"names":["_t","require","assertExpressionStatement","makeStatementFormatter","fn","code","str","validate","unwrap","ast","program","body","slice","smart","exports","length","statements","statement","Error","expression","start","stmt"],"sources":["../src/formatters.ts"],"sourcesContent":["import { assertExpressionStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport type Formatter<T> = {\n code: (source: string) => string;\n validate: (ast: t.File) => void;\n unwrap: (ast: t.File) => T;\n};\n\nfunction makeStatementFormatter<T>(\n fn: (statements: t.Statement[]) => T,\n): Formatter<T> {\n return {\n // We need to prepend a \";\" to force statement parsing so that\n // ExpressionStatement strings won't be parsed as directives.\n // Alongside that, we also prepend a comment so that when a syntax error\n // is encountered, the user will be less likely to get confused about\n // where the random semicolon came from.\n code: str => `/* @babel/template */;\\n${str}`,\n validate: () => {},\n unwrap: (ast: t.File): T => {\n return fn(ast.program.body.slice(1));\n },\n };\n}\n\nexport const smart = makeStatementFormatter(body => {\n if (body.length > 1) {\n return body;\n } else {\n return body[0];\n }\n});\n\nexport const statements = makeStatementFormatter(body => body);\n\nexport const statement = makeStatementFormatter(body => {\n // We do this validation when unwrapping since the replacement process\n // could have added or removed statements.\n if (body.length === 0) {\n throw new Error(\"Found nothing to return.\");\n }\n if (body.length > 1) {\n throw new Error(\"Found multiple statements but wanted one\");\n }\n\n return body[0];\n});\n\nexport const expression: Formatter<t.Expression> = {\n code: str => `(\\n${str}\\n)`,\n validate: ast => {\n if (ast.program.body.length > 1) {\n throw new Error(\"Found multiple statements but wanted one\");\n }\n if (expression.unwrap(ast).start === 0) {\n throw new Error(\"Parse result included parens.\");\n }\n },\n unwrap: ({ program }) => {\n const [stmt] = program.body;\n assertExpressionStatement(stmt);\n return stmt.expression;\n },\n};\n\nexport const program: Formatter<t.Program> = {\n code: str => str,\n validate: () => {},\n unwrap: ast => ast.program,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAAyD;EAAhDC;AAAyB,IAAAF,EAAA;AASlC,SAASG,sBAAsBA,CAC7BC,EAAoC,EACtB;EACd,OAAO;IAMLC,IAAI,EAAEC,GAAG,IAAI,2BAA2BA,GAAG,EAAE;IAC7CC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;IAClBC,MAAM,EAAGC,GAAW,IAAQ;MAC1B,OAAOL,EAAE,CAACK,GAAG,CAACC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC;EACF,CAAC;AACH;AAEO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAGV,sBAAsB,CAACQ,IAAI,IAAI;EAClD,IAAIA,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;IACnB,OAAOJ,IAAI;EACb,CAAC,MAAM;IACL,OAAOA,IAAI,CAAC,CAAC,CAAC;EAChB;AACF,CAAC,CAAC;AAEK,MAAMK,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAGb,sBAAsB,CAACQ,IAAI,IAAIA,IAAI,CAAC;AAEvD,MAAMM,SAAS,GAAAH,OAAA,CAAAG,SAAA,GAAGd,sBAAsB,CAACQ,IAAI,IAAI;EAGtD,IAAIA,IAAI,CAACI,MAAM,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,IAAIP,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;IACnB,MAAM,IAAIG,KAAK,CAAC,0CAA0C,CAAC;EAC7D;EAEA,OAAOP,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEK,MAAMQ,UAAmC,GAAAL,OAAA,CAAAK,UAAA,GAAG;EACjDd,IAAI,EAAEC,GAAG,IAAI,MAAMA,GAAG,KAAK;EAC3BC,QAAQ,EAAEE,GAAG,IAAI;IACf,IAAIA,GAAG,CAACC,OAAO,CAACC,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;MAC/B,MAAM,IAAIG,KAAK,CAAC,0CAA0C,CAAC;IAC7D;IACA,IAAIC,UAAU,CAACX,MAAM,CAACC,GAAG,CAAC,CAACW,KAAK,KAAK,CAAC,EAAE;MACtC,MAAM,IAAIF,KAAK,CAAC,+BAA+B,CAAC;IAClD;EACF,CAAC;EACDV,MAAM,EAAEA,CAAC;IAAEE;EAAQ,CAAC,KAAK;IACvB,MAAM,CAACW,IAAI,CAAC,GAAGX,OAAO,CAACC,IAAI;IAC3BT,yBAAyB,CAACmB,IAAI,CAAC;IAC/B,OAAOA,IAAI,CAACF,UAAU;EACxB;AACF,CAAC;AAEM,MAAMT,OAA6B,GAAAI,OAAA,CAAAJ,OAAA,GAAG;EAC3CL,IAAI,EAAEC,GAAG,IAAIA,GAAG;EAChBC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,MAAM,EAAEC,GAAG,IAAIA,GAAG,CAACC;AACrB,CAAC","ignoreList":[]}
|
||||
{"version":3,"names":["_t","require","assertExpressionStatement","makeStatementFormatter","fn","code","str","validate","unwrap","ast","program","body","slice","smart","exports","length","statements","statement","Error","expression","start","stmt"],"sources":["../src/formatters.ts"],"sourcesContent":["import { assertExpressionStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport type Formatter<T> = {\n code: (source: string) => string;\n validate: (ast: t.File) => void;\n unwrap: (ast: t.File) => T;\n};\n\nfunction makeStatementFormatter<T>(\n fn: (statements: Array<t.Statement>) => T,\n): Formatter<T> {\n return {\n // We need to prepend a \";\" to force statement parsing so that\n // ExpressionStatement strings won't be parsed as directives.\n // Alongside that, we also prepend a comment so that when a syntax error\n // is encountered, the user will be less likely to get confused about\n // where the random semicolon came from.\n code: str => `/* @babel/template */;\\n${str}`,\n validate: () => {},\n unwrap: (ast: t.File): T => {\n return fn(ast.program.body.slice(1));\n },\n };\n}\n\nexport const smart = makeStatementFormatter(body => {\n if (body.length > 1) {\n return body;\n } else {\n return body[0];\n }\n});\n\nexport const statements = makeStatementFormatter(body => body);\n\nexport const statement = makeStatementFormatter(body => {\n // We do this validation when unwrapping since the replacement process\n // could have added or removed statements.\n if (body.length === 0) {\n throw new Error(\"Found nothing to return.\");\n }\n if (body.length > 1) {\n throw new Error(\"Found multiple statements but wanted one\");\n }\n\n return body[0];\n});\n\nexport const expression: Formatter<t.Expression> = {\n code: str => `(\\n${str}\\n)`,\n validate: ast => {\n if (ast.program.body.length > 1) {\n throw new Error(\"Found multiple statements but wanted one\");\n }\n if (expression.unwrap(ast).start === 0) {\n throw new Error(\"Parse result included parens.\");\n }\n },\n unwrap: ({ program }) => {\n const [stmt] = program.body;\n assertExpressionStatement(stmt);\n return stmt.expression;\n },\n};\n\nexport const program: Formatter<t.Program> = {\n code: str => str,\n validate: () => {},\n unwrap: ast => ast.program,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAAyD;EAAhDC;AAAyB,IAAAF,EAAA;AASlC,SAASG,sBAAsBA,CAC7BC,EAAyC,EAC3B;EACd,OAAO;IAMLC,IAAI,EAAEC,GAAG,IAAI,2BAA2BA,GAAG,EAAE;IAC7CC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;IAClBC,MAAM,EAAGC,GAAW,IAAQ;MAC1B,OAAOL,EAAE,CAACK,GAAG,CAACC,OAAO,CAACC,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC;EACF,CAAC;AACH;AAEO,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAGV,sBAAsB,CAACQ,IAAI,IAAI;EAClD,IAAIA,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;IACnB,OAAOJ,IAAI;EACb,CAAC,MAAM;IACL,OAAOA,IAAI,CAAC,CAAC,CAAC;EAChB;AACF,CAAC,CAAC;AAEK,MAAMK,UAAU,GAAAF,OAAA,CAAAE,UAAA,GAAGb,sBAAsB,CAACQ,IAAI,IAAIA,IAAI,CAAC;AAEvD,MAAMM,SAAS,GAAAH,OAAA,CAAAG,SAAA,GAAGd,sBAAsB,CAACQ,IAAI,IAAI;EAGtD,IAAIA,IAAI,CAACI,MAAM,KAAK,CAAC,EAAE;IACrB,MAAM,IAAIG,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EACA,IAAIP,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;IACnB,MAAM,IAAIG,KAAK,CAAC,0CAA0C,CAAC;EAC7D;EAEA,OAAOP,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEK,MAAMQ,UAAmC,GAAAL,OAAA,CAAAK,UAAA,GAAG;EACjDd,IAAI,EAAEC,GAAG,IAAI,MAAMA,GAAG,KAAK;EAC3BC,QAAQ,EAAEE,GAAG,IAAI;IACf,IAAIA,GAAG,CAACC,OAAO,CAACC,IAAI,CAACI,MAAM,GAAG,CAAC,EAAE;MAC/B,MAAM,IAAIG,KAAK,CAAC,0CAA0C,CAAC;IAC7D;IACA,IAAIC,UAAU,CAACX,MAAM,CAACC,GAAG,CAAC,CAACW,KAAK,KAAK,CAAC,EAAE;MACtC,MAAM,IAAIF,KAAK,CAAC,+BAA+B,CAAC;IAClD;EACF,CAAC;EACDV,MAAM,EAAEA,CAAC;IAAEE;EAAQ,CAAC,KAAK;IACvB,MAAM,CAACW,IAAI,CAAC,GAAGX,OAAO,CAACC,IAAI;IAC3BT,yBAAyB,CAACmB,IAAI,CAAC;IAC/B,OAAOA,IAAI,CAACF,UAAU;EACxB;AACF,CAAC;AAEM,MAAMT,OAA6B,GAAAI,OAAA,CAAAJ,OAAA,GAAG;EAC3CL,IAAI,EAAEC,GAAG,IAAIA,GAAG;EAChBC,QAAQ,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClBC,MAAM,EAAEC,GAAG,IAAIA,GAAG,CAACC;AACrB,CAAC","ignoreList":[]}
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/template",
|
||||
"version": "7.29.7",
|
||||
"version": "7.27.2",
|
||||
"description": "Generate an AST from a string template.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-template",
|
||||
@@ -16,9 +16,9 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.29.7",
|
||||
"@babel/parser": "^7.29.7",
|
||||
"@babel/types": "^7.29.7"
|
||||
"@babel/code-frame": "^7.27.1",
|
||||
"@babel/parser": "^7.27.2",
|
||||
"@babel/types": "^7.27.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
||||
+1
@@ -29,6 +29,7 @@ function getCachedPaths(path) {
|
||||
return pathsCache.get(parent);
|
||||
}
|
||||
function getOrCreateCachedPaths(node, parentPath) {
|
||||
;
|
||||
let paths = pathsCache.get(node);
|
||||
if (!paths) pathsCache.set(node, paths = new Map());
|
||||
return paths;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user