Update npm packages (73 packages including @jqhtml 2.3.36)

Update npm registry domain from privatenpm.hanson.xyz to npm.internal.hanson.xyz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-02-20 11:31:28 +00:00
parent d01a6179aa
commit b5eb27a827
1690 changed files with 47348 additions and 16848 deletions

4
.npmrc
View File

@@ -1,3 +1,3 @@
# Private NPM Registry Configuration # Private NPM Registry Configuration
@jqhtml:registry=https://privatenpm.hanson.xyz/ @jqhtml:registry=https://npm.internal.hanson.xyz/
//privatenpm.hanson.xyz/:_auth=cnNwYWRlOjg1ZmY2MTllZDQyNTM3ZTY1NzQ0NmQ2ZWFkOWU1OGI5 //npm.internal.hanson.xyz/:_auth=cnNwYWRlOjg1ZmY2MTllZDQyNTM3ZTY1NzQ0NmQ2ZWFkOWU1OGI5

View File

@@ -1 +1 @@
../baseline-browser-mapping/dist/cli.js ../baseline-browser-mapping/dist/cli.cjs

723
node_modules/.package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

View File

@@ -90,7 +90,7 @@ function highlight(text) {
let deprecationWarningShown = false; let deprecationWarningShown = false;
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/; const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
function getMarkerLines(loc, source, opts) { function getMarkerLines(loc, source, opts, startLineBaseZero) {
const startLoc = Object.assign({ const startLoc = Object.assign({
column: 0, column: 0,
line: -1 line: -1
@@ -100,9 +100,9 @@ function getMarkerLines(loc, source, opts) {
linesAbove = 2, linesAbove = 2,
linesBelow = 3 linesBelow = 3
} = opts || {}; } = opts || {};
const startLine = startLoc.line; const startLine = startLoc.line - startLineBaseZero;
const startColumn = startLoc.column; const startColumn = startLoc.column;
const endLine = endLoc.line; const endLine = endLoc.line - startLineBaseZero;
const endColumn = endLoc.column; const endColumn = endLoc.column;
let start = Math.max(startLine - (linesAbove + 1), 0); let start = Math.max(startLine - (linesAbove + 1), 0);
let end = Math.min(source.length, endLine + linesBelow); let end = Math.min(source.length, endLine + linesBelow);
@@ -148,19 +148,20 @@ function getMarkerLines(loc, source, opts) {
} }
function codeFrameColumns(rawLines, loc, opts = {}) { function codeFrameColumns(rawLines, loc, opts = {}) {
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode; const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
const startLineBaseZero = (opts.startLine || 1) - 1;
const defs = getDefs(shouldHighlight); const defs = getDefs(shouldHighlight);
const lines = rawLines.split(NEWLINE); const lines = rawLines.split(NEWLINE);
const { const {
start, start,
end, end,
markerLines markerLines
} = getMarkerLines(loc, lines, opts); } = getMarkerLines(loc, lines, opts, startLineBaseZero);
const hasColumns = loc.start && typeof loc.start.column === "number"; const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end).length; const numberMaxWidth = String(end + startLineBaseZero).length;
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines; const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => { let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
const number = start + 1 + index; const number = start + 1 + index;
const paddedNumber = ` ${number}`.slice(-numberMaxWidth); const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} |`; const gutter = ` ${paddedNumber} |`;
const hasMarker = markerLines[number]; const hasMarker = markerLines[number];
const lastMarkerLine = !markerLines[number + 1]; const lastMarkerLine = !markerLines[number + 1];

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/code-frame", "name": "@babel/code-frame",
"version": "7.28.6", "version": "7.29.0",
"description": "Generate errors that contain a code frame that point to source locations.", "description": "Generate errors that contain a code frame that point to source locations.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-code-frame", "homepage": "https://babel.dev/docs/en/next/babel-code-frame",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/compat-data", "name": "@babel/compat-data",
"version": "7.28.6", "version": "7.29.0",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"description": "The compat-data to determine required Babel plugins", "description": "The compat-data to determine required Babel plugins",
@@ -30,8 +30,8 @@
], ],
"devDependencies": { "devDependencies": {
"@mdn/browser-compat-data": "^6.0.8", "@mdn/browser-compat-data": "^6.0.8",
"core-js-compat": "^3.43.0", "core-js-compat": "^3.48.0",
"electron-to-chromium": "^1.5.140" "electron-to-chromium": "^1.5.278"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

View File

@@ -211,7 +211,7 @@ var _transform = require("./transform.js");
var _transformFile = require("./transform-file.js"); var _transformFile = require("./transform-file.js");
var _transformAst = require("./transform-ast.js"); var _transformAst = require("./transform-ast.js");
var _parse = require("./parse.js"); var _parse = require("./parse.js");
const version = exports.version = "7.28.6"; const version = exports.version = "7.29.0";
const resolvePlugin = (name, dirname) => resolvers.resolvePlugin(name, dirname, false).filepath; const resolvePlugin = (name, dirname) => resolvers.resolvePlugin(name, dirname, false).filepath;
exports.resolvePlugin = resolvePlugin; exports.resolvePlugin = resolvePlugin;
const resolvePreset = (name, dirname) => resolvers.resolvePreset(name, dirname, false).filepath; const resolvePreset = (name, dirname) => resolvers.resolvePreset(name, dirname, false).filepath;

View File

@@ -51,6 +51,11 @@ function* parser(pluginPasses, {
if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") {
err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file."; err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file.";
} }
const startLine = parserOpts == null ? void 0 : parserOpts.startLine;
const startColumn = parserOpts == null ? void 0 : parserOpts.startColumn;
if (startColumn != null) {
code = " ".repeat(startColumn) + code;
}
const { const {
loc, loc,
missingPlugin missingPlugin
@@ -62,7 +67,8 @@ function* parser(pluginPasses, {
column: loc.column + 1 column: loc.column + 1
} }
}, { }, {
highlightCode highlightCode,
startLine
}); });
if (missingPlugin) { if (missingPlugin) {
err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame, filename); err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame, filename);

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/core", "name": "@babel/core",
"version": "7.28.6", "version": "7.29.0",
"description": "Babel compiler core.", "description": "Babel compiler core.",
"main": "./lib/index.js", "main": "./lib/index.js",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
@@ -46,15 +46,15 @@
"./src/transform-file.ts": "./src/transform-file-browser.ts" "./src/transform-file.ts": "./src/transform-file-browser.ts"
}, },
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.28.6", "@babel/code-frame": "^7.29.0",
"@babel/generator": "^7.28.6", "@babel/generator": "^7.29.0",
"@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-compilation-targets": "^7.28.6",
"@babel/helper-module-transforms": "^7.28.6", "@babel/helper-module-transforms": "^7.28.6",
"@babel/helpers": "^7.28.6", "@babel/helpers": "^7.28.6",
"@babel/parser": "^7.28.6", "@babel/parser": "^7.29.0",
"@babel/template": "^7.28.6", "@babel/template": "^7.28.6",
"@babel/traverse": "^7.28.6", "@babel/traverse": "^7.29.0",
"@babel/types": "^7.28.6", "@babel/types": "^7.29.0",
"@jridgewell/remapping": "^2.3.5", "@jridgewell/remapping": "^2.3.5",
"convert-source-map": "^2.0.0", "convert-source-map": "^2.0.0",
"debug": "^4.1.0", "debug": "^4.1.0",
@@ -67,7 +67,7 @@
"@babel/plugin-syntax-flow": "^7.28.6", "@babel/plugin-syntax-flow": "^7.28.6",
"@babel/plugin-transform-flow-strip-types": "^7.27.1", "@babel/plugin-transform-flow-strip-types": "^7.27.1",
"@babel/plugin-transform-modules-commonjs": "^7.28.6", "@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/preset-env": "^7.28.6", "@babel/preset-env": "^7.29.0",
"@babel/preset-typescript": "^7.28.5", "@babel/preset-typescript": "^7.28.5",
"@jridgewell/trace-mapping": "^0.3.28", "@jridgewell/trace-mapping": "^0.3.28",
"@types/convert-source-map": "^2.0.0", "@types/convert-source-map": "^2.0.0",

View File

@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = void 0; exports.default = void 0;
const spaceIndents = [];
for (let i = 0; i < 32; i++) {
spaceIndents.push(" ".repeat(i * 2));
}
class Buffer { class Buffer {
constructor(map, indentChar) { constructor(map, indentChar) {
this._map = null; this._map = null;
@@ -11,11 +15,9 @@ class Buffer {
this._str = ""; this._str = "";
this._appendCount = 0; this._appendCount = 0;
this._last = 0; this._last = 0;
this._queue = [];
this._queueCursor = 0;
this._canMarkIdName = true; this._canMarkIdName = true;
this._indentChar = ""; this._indentChar = "";
this._fastIndentations = []; this._queuedChar = 0;
this._position = { this._position = {
line: 1, line: 1,
column: 0 column: 0
@@ -29,55 +31,32 @@ class Buffer {
}; };
this._map = map; this._map = map;
this._indentChar = indentChar; 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() { get() {
this._flush(); const {
const map = this._map; _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
};
}
const result = { const result = {
code: (this._buf + this._str).trimRight(), code: code,
decodedMap: map == null ? void 0 : map.getDecoded(), decodedMap: _map.getDecoded(),
get __mergedMap() { get __mergedMap() {
return this.map; return this.map;
}, },
get map() { get map() {
const resultMap = map ? map.get() : null; const resultMap = _map.get();
result.map = resultMap; result.map = resultMap;
return resultMap; return resultMap;
}, },
@@ -88,7 +67,7 @@ class Buffer {
}); });
}, },
get rawMappings() { get rawMappings() {
const mappings = map == null ? void 0 : map.getRawMappings(); const mappings = _map.getRawMappings();
result.rawMappings = mappings; result.rawMappings = mappings;
return mappings; return mappings;
}, },
@@ -103,66 +82,57 @@ class Buffer {
} }
append(str, maybeNewline) { append(str, maybeNewline) {
this._flush(); this._flush();
this._append(str, this._sourcePosition, maybeNewline); this._append(str, maybeNewline);
} }
appendChar(char) { appendChar(char) {
this._flush(); this._flush();
this._appendChar(char, 1, this._sourcePosition); this._appendChar(char, 1, true);
} }
queue(char) { queue(char) {
if (char === 10) { this._flush();
while (this._queueCursor !== 0) { this._queuedChar = char;
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() { _flush() {
const queueCursor = this._queueCursor; const queuedChar = this._queuedChar;
const queue = this._queue; if (queuedChar !== 0) {
for (let i = 0; i < queueCursor; i++) { this._appendChar(queuedChar, 1, true);
const item = queue[i]; this._queuedChar = 0;
this._appendChar(item.char, item.repeat, item);
} }
this._queueCursor = 0;
} }
_appendChar(char, repeat, sourcePos) { _appendChar(char, repeat, useSourcePos) {
this._last = char; this._last = char;
if (char === -1) { if (char === -1) {
const fastIndentation = this._fastIndentations[repeat]; const indent = repeat >= 64 ? this._indentChar.repeat(repeat) : spaceIndents[repeat / 2];
if (fastIndentation !== undefined) { this._str += indent;
this._str += fastIndentation;
} else {
this._str += repeat > 1 ? this._indentChar.repeat(repeat) : this._indentChar;
}
} else { } else {
this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char);
} }
const isSpace = char === 32;
const position = this._position;
if (char !== 10) { if (char !== 10) {
this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.identifierNamePos, sourcePos.filename); if (this._map) {
this._position.column += repeat; 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;
} else { } else {
this._position.line++; position.line++;
this._position.column = 0; position.column = 0;
}
if (this._canMarkIdName) {
sourcePos.identifierName = undefined;
sourcePos.identifierNamePos = undefined;
} }
} }
_append(str, sourcePos, maybeNewline) { _append(str, maybeNewline) {
const len = str.length; const len = str.length;
const position = this._position; const position = this._position;
this._last = str.charCodeAt(len - 1); const sourcePos = this._sourcePosition;
this._last = -1;
if (++this._appendCount > 4096) { if (++this._appendCount > 4096) {
+this._str; +this._str;
this._buf += this._str; this._buf += this._str;
@@ -171,7 +141,8 @@ class Buffer {
} else { } else {
this._str += str; this._str += str;
} }
if (!maybeNewline && !this._map) { const hasMap = this._map !== null;
if (!maybeNewline && !hasMap) {
position.column += len; position.column += len;
return; return;
} }
@@ -188,67 +159,40 @@ class Buffer {
} }
let i = str.indexOf("\n"); let i = str.indexOf("\n");
let last = 0; let last = 0;
if (i !== 0) { if (hasMap && i !== 0) {
this._mark(line, column, identifierName, identifierNamePos, filename); this._map.mark(position, line, column, identifierName, identifierNamePos, filename);
} }
while (i !== -1) { while (i !== -1) {
position.line++; position.line++;
position.column = 0; position.column = 0;
last = i + 1; last = i + 1;
if (last < len && line !== undefined) { if (last < len && line !== undefined) {
this._mark(++line, 0, undefined, undefined, filename); line++;
if (hasMap) {
this._map.mark(position, line, 0, undefined, undefined, filename);
}
} }
i = str.indexOf("\n", last); i = str.indexOf("\n", last);
} }
position.column += len - last; position.column += len - last;
} }
_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--;
}
}
removeLastSemicolon() { removeLastSemicolon() {
const queueCursor = this._queueCursor; if (this._queuedChar === 59) {
if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) { this._queuedChar = 0;
this._queueCursor--;
} }
} }
getLastChar() { getLastChar(checkQueue) {
const queueCursor = this._queueCursor; if (!checkQueue) {
return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last; return this._last;
}
const queuedChar = this._queuedChar;
return queuedChar !== 0 ? queuedChar : this._last;
} }
getNewlineCount() { getNewlineCount() {
const queueCursor = this._queueCursor; return this._queuedChar === 0 && this._last === 10 ? 1 : 0;
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() { hasContent() {
return this._queueCursor !== 0 || !!this._last; return this._last !== 0;
} }
exactSource(loc, cb) { exactSource(loc, cb) {
if (!this._map) { if (!this._map) {
@@ -258,12 +202,12 @@ class Buffer {
this.source("start", loc); this.source("start", loc);
const identifierName = loc.identifierName; const identifierName = loc.identifierName;
const sourcePos = this._sourcePosition; const sourcePos = this._sourcePosition;
if (identifierName) { if (identifierName != null) {
this._canMarkIdName = false; this._canMarkIdName = false;
sourcePos.identifierName = identifierName; sourcePos.identifierName = identifierName;
} }
cb(); cb();
if (identifierName) { if (identifierName != null) {
this._canMarkIdName = true; this._canMarkIdName = true;
sourcePos.identifierName = undefined; sourcePos.identifierName = undefined;
sourcePos.identifierNamePos = undefined; sourcePos.identifierNamePos = undefined;
@@ -279,6 +223,7 @@ class Buffer {
this._normalizePosition(prop, loc, columnOffset); this._normalizePosition(prop, loc, columnOffset);
} }
_normalizePosition(prop, loc, columnOffset) { _normalizePosition(prop, loc, columnOffset) {
this._flush();
const pos = loc[prop]; const pos = loc[prop];
const target = this._sourcePosition; const target = this._sourcePosition;
if (pos) { if (pos) {
@@ -288,28 +233,10 @@ class Buffer {
} }
} }
getCurrentColumn() { getCurrentColumn() {
const queue = this._queue; return this._position.column + (this._queuedChar ? 1 : 0);
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() { getCurrentLine() {
let count = 0; return this._position.line;
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; exports.default = Buffer;

File diff suppressed because one or more lines are too long

View File

@@ -18,13 +18,12 @@ function File(node) {
} }
function Program(node) { function Program(node) {
var _node$directives; var _node$directives;
this.noIndentInnerCommentsHere(); this.printInnerComments(false);
this.printInnerComments();
const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length;
if (directivesLen) { if (directivesLen) {
var _node$directives$trai; var _node$directives$trai;
const newline = node.body.length ? 2 : 1; const newline = node.body.length ? 2 : 1;
this.printSequence(node.directives, undefined, newline); this.printSequence(node.directives, undefined, undefined, newline);
if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) { if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) {
this.newline(newline); this.newline(newline);
} }
@@ -34,18 +33,18 @@ function Program(node) {
function BlockStatement(node) { function BlockStatement(node) {
var _node$directives2; var _node$directives2;
this.tokenChar(123); this.tokenChar(123);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length; const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length;
if (directivesLen) { if (directivesLen) {
var _node$directives$trai2; var _node$directives$trai2;
const newline = node.body.length ? 2 : 1; const newline = node.body.length ? 2 : 1;
this.printSequence(node.directives, true, newline); this.printSequence(node.directives, true, true, newline);
if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) { if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) {
this.newline(newline); this.newline(newline);
} }
} }
this.printSequence(node.body, true); this.printSequence(node.body, true, true);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightBrace(node); this.rightBrace(node);
} }
function Directive(node) { function Directive(node) {
@@ -73,7 +72,7 @@ function DirectiveLiteral(node) {
} }
function InterpreterDirective(node) { function InterpreterDirective(node) {
this.token(`#!${node.value}`); this.token(`#!${node.value}`);
this.newline(1, true); this._newline();
} }
function Placeholder(node) { function Placeholder(node) {
this.token("%%"); this.token("%%");

File diff suppressed because one or more lines are too long

View File

@@ -13,13 +13,17 @@ exports.ClassProperty = ClassProperty;
exports.StaticBlock = StaticBlock; exports.StaticBlock = StaticBlock;
exports._classMethodHead = _classMethodHead; exports._classMethodHead = _classMethodHead;
var _t = require("@babel/types"); 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 { const {
isExportDefaultDeclaration, isExportDefaultDeclaration,
isExportNamedDeclaration isExportNamedDeclaration
} = _t; } = _t;
function ClassDeclaration(node, parent) { function ClassDeclaration(node, parent) {
const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent); const inExport = isExportDefaultDeclaration(parent) || isExportNamedDeclaration(parent);
if (!inExport || !this._shouldPrintDecoratorsBeforeExport(parent)) { if (!inExport || !_expressions._shouldPrintDecoratorsBeforeExport.call(this, parent)) {
this.printJoin(node.decorators); this.printJoin(node.decorators);
} }
if (node.declare) { if (node.declare) {
@@ -57,12 +61,11 @@ function ClassBody(node) {
if (node.body.length === 0) { if (node.body.length === 0) {
this.tokenChar(125); this.tokenChar(125);
} else { } else {
this.newline();
const separator = classBodyEmptySemicolonsPrinter(this, node); const separator = classBodyEmptySemicolonsPrinter(this, node);
separator == null || separator(-1); separator == null || separator(-1);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printJoin(node.body, true, true, separator, true); this.printJoin(node.body, true, true, separator, true, true);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
if (!this.endsWith(10)) this.newline(); if (!this.endsWith(10)) this.newline();
this.rightBrace(node); this.rightBrace(node);
} }
@@ -90,7 +93,7 @@ function classBodyEmptySemicolonsPrinter(printer, node) {
const end = nextLocIndex === node.body.length ? node.end : node.body[nextLocIndex].start; const end = nextLocIndex === node.body.length ? node.end : node.body[nextLocIndex].start;
let tok; let tok;
while (k < indexes.length && printer.tokenMap.matchesOriginal(tok = printer._tokens[indexes[k]], ";") && tok.start < end) { while (k < indexes.length && printer.tokenMap.matchesOriginal(tok = printer._tokens[indexes[k]], ";") && tok.start < end) {
printer.token(";", undefined, occurrenceCount++); printer.tokenChar(59, occurrenceCount++);
k++; k++;
} }
}; };
@@ -102,13 +105,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; 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); if (endLine) this.catchUp(endLine);
} }
this.tsPrintClassMemberModifiers(node); _typescript._tsPrintClassMemberModifiers.call(this, node);
if (node.computed) { if (node.computed) {
this.tokenChar(91); this.tokenChar(91);
this.print(node.key); this.print(node.key);
this.tokenChar(93); this.tokenChar(93);
} else { } else {
this._variance(node); _flow._variance.call(this, node);
this.print(node.key); this.print(node.key);
} }
if (node.optional) { if (node.optional) {
@@ -131,7 +134,7 @@ function ClassAccessorProperty(node) {
this.printJoin(node.decorators); 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; 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); if (endLine) this.catchUp(endLine);
this.tsPrintClassMemberModifiers(node); _typescript._tsPrintClassMemberModifiers.call(this, node);
this.word("accessor", true); this.word("accessor", true);
this.space(); this.space();
if (node.computed) { if (node.computed) {
@@ -139,7 +142,7 @@ function ClassAccessorProperty(node) {
this.print(node.key); this.print(node.key);
this.tokenChar(93); this.tokenChar(93);
} else { } else {
this._variance(node); _flow._variance.call(this, node);
this.print(node.key); this.print(node.key);
} }
if (node.optional) { if (node.optional) {
@@ -159,7 +162,7 @@ function ClassAccessorProperty(node) {
} }
function ClassPrivateProperty(node) { function ClassPrivateProperty(node) {
this.printJoin(node.decorators); this.printJoin(node.decorators);
this.tsPrintClassMemberModifiers(node); _typescript._tsPrintClassMemberModifiers.call(this, node);
this.print(node.key); this.print(node.key);
if (node.optional) { if (node.optional) {
this.tokenChar(63); this.tokenChar(63);
@@ -177,12 +180,12 @@ function ClassPrivateProperty(node) {
this.semicolon(); this.semicolon();
} }
function ClassMethod(node) { function ClassMethod(node) {
this._classMethodHead(node); _classMethodHead.call(this, node);
this.space(); this.space();
this.print(node.body); this.print(node.body);
} }
function ClassPrivateMethod(node) { function ClassPrivateMethod(node) {
this._classMethodHead(node); _classMethodHead.call(this, node);
this.space(); this.space();
this.print(node.body); this.print(node.body);
} }
@@ -193,8 +196,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; 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); if (endLine) this.catchUp(endLine);
} }
this.tsPrintClassMemberModifiers(node); _typescript._tsPrintClassMemberModifiers.call(this, node);
this._methodHead(node); _methods._methodHead.call(this, node);
} }
function StaticBlock(node) { function StaticBlock(node) {
this.word("static"); this.word("static");

File diff suppressed because one or more lines are too long

View File

@@ -3,72 +3,71 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.addDeprecatedGenerators = addDeprecatedGenerators; exports.DecimalLiteral = DecimalLiteral;
function addDeprecatedGenerators(PrinterClass) { exports.Noop = Noop;
const deprecatedBabel7Generators = { exports.RecordExpression = RecordExpression;
Noop() {}, exports.TSExpressionWithTypeArguments = TSExpressionWithTypeArguments;
TSExpressionWithTypeArguments(node) { exports.TupleExpression = TupleExpression;
this.print(node.expression); function Noop() {}
this.print(node.typeParameters); function TSExpressionWithTypeArguments(node) {
}, this.print(node.expression);
DecimalLiteral(node) { this.print(node.typeParameters);
const raw = this.getPossibleRaw(node); }
if (!this.format.minified && raw !== undefined) { function DecimalLiteral(node) {
this.word(raw); const raw = this.getPossibleRaw(node);
return; 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);
} }
this.word(node.value + "m");
},
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);
},
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);
} }
}; }
Object.assign(PrinterClass.prototype, deprecatedBabel7Generators); this.token(endToken);
} }
//# sourceMappingURL=deprecated.js.map //# sourceMappingURL=deprecated.js.map

File diff suppressed because one or more lines are too long

View File

@@ -3,9 +3,10 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.LogicalExpression = exports.BinaryExpression = exports.AssignmentExpression = AssignmentExpression; exports.LogicalExpression = exports.AssignmentExpression = AssignmentExpression;
exports.AssignmentPattern = AssignmentPattern; exports.AssignmentPattern = AssignmentPattern;
exports.AwaitExpression = AwaitExpression; exports.AwaitExpression = AwaitExpression;
exports.BinaryExpression = BinaryExpression;
exports.BindExpression = BindExpression; exports.BindExpression = BindExpression;
exports.CallExpression = CallExpression; exports.CallExpression = CallExpression;
exports.ConditionalExpression = ConditionalExpression; exports.ConditionalExpression = ConditionalExpression;
@@ -43,11 +44,12 @@ function UnaryExpression(node) {
const { const {
operator operator
} = node; } = node;
if (operator === "void" || operator === "delete" || operator === "typeof" || operator === "throw") { const firstChar = operator.charCodeAt(0);
if (firstChar >= 97 && firstChar <= 122) {
this.word(operator); this.word(operator);
this.space(); this.space();
} else { } else {
this.token(operator); this.tokenChar(firstChar);
} }
this.print(node.argument); this.print(node.argument);
} }
@@ -62,18 +64,18 @@ function DoExpression(node) {
} }
function ParenthesizedExpression(node) { function ParenthesizedExpression(node) {
this.tokenChar(40); this.tokenChar(40);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.print(node.expression); this.print(node.expression, undefined, true);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node); this.rightParens(node);
} }
function UpdateExpression(node) { function UpdateExpression(node) {
if (node.prefix) { if (node.prefix) {
this.token(node.operator); this.token(node.operator, false, 0, true);
this.print(node.argument); this.print(node.argument);
} else { } else {
this.print(node.argument, true); this.print(node.argument, true);
this.token(node.operator); this.token(node.operator, false, 0, true);
} }
} }
function ConditionalExpression(node) { function ConditionalExpression(node) {
@@ -105,9 +107,9 @@ function NewExpression(node, parent) {
return; return;
} }
this.tokenChar(40); this.tokenChar(40);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printList(node.arguments, this.shouldPrintTrailingComma(")")); this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node); this.rightParens(node);
} }
function SequenceExpression(node) { function SequenceExpression(node) {
@@ -127,7 +129,10 @@ function _shouldPrintDecoratorsBeforeExport(node) {
} }
function Decorator(node) { function Decorator(node) {
this.tokenChar(64); this.tokenChar(64);
this.print(node.expression); const {
expression
} = node;
this.print(expression);
this.newline(); this.newline();
} }
function OptionalMemberExpression(node) { function OptionalMemberExpression(node) {
@@ -167,9 +172,9 @@ function OptionalCallExpression(node) {
} }
this.print(node.typeArguments); this.print(node.typeArguments);
this.tokenChar(40); this.tokenChar(40);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printList(node.arguments); this.printList(node.arguments, undefined, undefined, undefined, undefined, true);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node); this.rightParens(node);
} }
function CallExpression(node) { function CallExpression(node) {
@@ -177,9 +182,9 @@ function CallExpression(node) {
this.print(node.typeArguments); this.print(node.typeArguments);
this.print(node.typeParameters); this.print(node.typeParameters);
this.tokenChar(40); this.tokenChar(40);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.printList(node.arguments, this.shouldPrintTrailingComma(")")); this.printList(node.arguments, this.shouldPrintTrailingComma(")"), undefined, undefined, undefined, true);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.rightParens(node); this.rightParens(node);
} }
function Import() { function Import() {
@@ -228,11 +233,21 @@ function AssignmentPattern(node) {
function AssignmentExpression(node) { function AssignmentExpression(node) {
this.print(node.left); this.print(node.left);
this.space(); this.space();
if (node.operator === "in" || node.operator === "instanceof") { this.token(node.operator, false, 0, true);
this.word(node.operator); 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);
} else { } else {
this.token(node.operator); this.token(operator, false, 0, true);
this._endsWithDiv = node.operator === "/"; this.setLastChar(operator.charCodeAt(operator.length - 1));
} }
this.space(); this.space();
this.print(node.right); this.print(node.right);
@@ -252,11 +267,11 @@ function MemberExpression(node) {
computed = true; computed = true;
} }
if (computed) { if (computed) {
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.tokenChar(91); this.tokenChar(91);
this.print(node.property); this.print(node.property, undefined, true);
this.tokenChar(93); this.tokenChar(93);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
} else { } else {
this.tokenChar(46); this.tokenChar(46);
this.print(node.property); this.print(node.property);

File diff suppressed because one or more lines are too long

View File

@@ -109,7 +109,7 @@ function DeclareClass(node, parent) {
} }
this.word("class"); this.word("class");
this.space(); this.space();
this._interfaceish(node); _interfaceish.call(this, node);
} }
function DeclareFunction(node, parent) { function DeclareFunction(node, parent) {
if (!isDeclareExportDeclaration(parent)) { if (!isDeclareExportDeclaration(parent)) {
@@ -140,7 +140,7 @@ function DeclaredPredicate(node) {
function DeclareInterface(node) { function DeclareInterface(node) {
this.word("declare"); this.word("declare");
this.space(); this.space();
this.InterfaceDeclaration(node); InterfaceDeclaration.call(this, node);
} }
function DeclareModule(node) { function DeclareModule(node) {
this.word("declare"); this.word("declare");
@@ -162,14 +162,14 @@ function DeclareModuleExports(node) {
function DeclareTypeAlias(node) { function DeclareTypeAlias(node) {
this.word("declare"); this.word("declare");
this.space(); this.space();
this.TypeAlias(node); TypeAlias.call(this, node);
} }
function DeclareOpaqueType(node, parent) { function DeclareOpaqueType(node, parent) {
if (!isDeclareExportDeclaration(parent)) { if (!isDeclareExportDeclaration(parent)) {
this.word("declare"); this.word("declare");
this.space(); this.space();
} }
this.OpaqueType(node); OpaqueType.call(this, node);
} }
function DeclareVariable(node, parent) { function DeclareVariable(node, parent) {
if (!isDeclareExportDeclaration(parent)) { if (!isDeclareExportDeclaration(parent)) {
@@ -397,7 +397,7 @@ function _variance(node) {
function InterfaceDeclaration(node) { function InterfaceDeclaration(node) {
this.word("interface"); this.word("interface");
this.space(); this.space();
this._interfaceish(node); _interfaceish.call(this, node);
} }
function andSeparator(occurrenceCount) { function andSeparator(occurrenceCount) {
this.space(); this.space();
@@ -475,7 +475,7 @@ function TypeParameterInstantiation(node) {
this.tokenChar(62); this.tokenChar(62);
} }
function TypeParameter(node) { function TypeParameter(node) {
this._variance(node); _variance.call(this, node);
this.word(node.name); this.word(node.name);
if (node.bound) { if (node.bound) {
this.print(node.bound); this.print(node.bound);
@@ -517,12 +517,12 @@ function ObjectTypeAnnotation(node) {
if (props.length) { if (props.length) {
this.newline(); this.newline();
this.space(); this.space();
this.printJoin(props, true, true, undefined, undefined, () => { this.printJoin(props, true, true, () => {
if (props.length !== 1 || node.inexact) { if (props.length !== 1 || node.inexact) {
this.tokenChar(44); this.tokenChar(44);
this.space(); this.space();
} }
}); }, true);
this.space(); this.space();
} }
if (node.inexact) { if (node.inexact) {
@@ -568,7 +568,7 @@ function ObjectTypeIndexer(node) {
this.word("static"); this.word("static");
this.space(); this.space();
} }
this._variance(node); _variance.call(this, node);
this.tokenChar(91); this.tokenChar(91);
if (node.id) { if (node.id) {
this.print(node.id); this.print(node.id);
@@ -594,7 +594,7 @@ function ObjectTypeProperty(node) {
this.word(node.kind); this.word(node.kind);
this.space(); this.space();
} }
this._variance(node); _variance.call(this, node);
this.print(node.key); this.print(node.key);
if (node.optional) this.tokenChar(63); if (node.optional) this.tokenChar(63);
if (!node.method) { if (!node.method) {

File diff suppressed because one or more lines are too long

View File

@@ -17,39 +17,40 @@ var _index = require("../node/index.js");
const { const {
isIdentifier isIdentifier
} = _t; } = _t;
function _params(node, idNode, parentNode) { function _params(node, noLineTerminator, idNode, parentNode) {
this.print(node.typeParameters); this.print(node.typeParameters);
const nameInfo = _getFuncIdName.call(this, idNode, parentNode); if (idNode !== undefined || parentNode !== undefined) {
if (nameInfo) { const nameInfo = _getFuncIdName.call(this, idNode, parentNode);
this.sourceIdentifierName(nameInfo.name, nameInfo.pos); if (nameInfo) {
this.sourceIdentifierName(nameInfo.name, nameInfo.pos);
}
} }
this.tokenChar(40); this.tokenChar(40);
this._parameters(node.params, ")"); _parameters.call(this, node.params, 41);
const noLineTerminator = node.type === "ArrowFunctionExpression";
this.print(node.returnType, noLineTerminator); this.print(node.returnType, noLineTerminator);
this._noLineTerminator = noLineTerminator; this._noLineTerminator = noLineTerminator;
} }
function _parameters(parameters, endToken) { function _parameters(parameters, endToken) {
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
const trailingComma = this.shouldPrintTrailingComma(endToken); const trailingComma = this.shouldPrintTrailingComma(endToken);
const paramLength = parameters.length; const paramLength = parameters.length;
for (let i = 0; i < paramLength; i++) { for (let i = 0; i < paramLength; i++) {
this._param(parameters[i]); _param.call(this, parameters[i]);
if (trailingComma || i < paramLength - 1) { if (trailingComma || i < paramLength - 1) {
this.token(",", undefined, i); this.tokenChar(44, i);
this.space(); this.space();
} }
} }
this.token(endToken); this.tokenChar(endToken);
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
} }
function _param(parameter) { function _param(parameter) {
this.printJoin(parameter.decorators); this.printJoin(parameter.decorators, undefined, undefined, undefined, undefined, true);
this.print(parameter); this.print(parameter, undefined, true);
if (parameter.optional) { if (parameter.optional) {
this.tokenChar(63); this.tokenChar(63);
} }
this.print(parameter.typeAnnotation); this.print(parameter.typeAnnotation, undefined, true);
} }
function _methodHead(node) { function _methodHead(node) {
const kind = node.kind; const kind = node.kind;
@@ -77,7 +78,11 @@ function _methodHead(node) {
if (node.optional) { if (node.optional) {
this.tokenChar(63); this.tokenChar(63);
} }
this._params(node, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key); if (this._buf._map) {
_params.call(this, node, false, node.computed && node.key.type !== "StringLiteral" ? undefined : node.key);
} else {
_params.call(this, node, false);
}
} }
function _predicate(node, noLineTerminatorAfter) { function _predicate(node, noLineTerminatorAfter) {
if (node.predicate) { if (node.predicate) {
@@ -88,18 +93,18 @@ function _predicate(node, noLineTerminatorAfter) {
this.print(node.predicate, noLineTerminatorAfter); this.print(node.predicate, noLineTerminatorAfter);
} }
} }
function _functionHead(node, parent) { function _functionHead(node, parent, hasPredicate) {
if (node.async) { if (node.async) {
this.word("async"); this.word("async");
if (!this.format.preserveFormat) { if (!this.format.preserveFormat) {
this._endsWithInnerRaw = false; this._innerCommentsState = 0;
} }
this.space(); this.space();
} }
this.word("function"); this.word("function");
if (node.generator) { if (node.generator) {
if (!this.format.preserveFormat) { if (!this.format.preserveFormat) {
this._endsWithInnerRaw = false; this._innerCommentsState = 0;
} }
this.tokenChar(42); this.tokenChar(42);
} }
@@ -107,13 +112,17 @@ function _functionHead(node, parent) {
if (node.id) { if (node.id) {
this.print(node.id); this.print(node.id);
} }
this._params(node, node.id, parent); if (this._buf._map) {
if (node.type !== "TSDeclareFunction") { _params.call(this, node, false, node.id, parent);
this._predicate(node); } else {
_params.call(this, node, false);
}
if (hasPredicate) {
_predicate.call(this, node);
} }
} }
function FunctionExpression(node, parent) { function FunctionExpression(node, parent) {
this._functionHead(node, parent); _functionHead.call(this, node, parent, true);
this.space(); this.space();
this.print(node.body); this.print(node.body);
} }
@@ -122,12 +131,12 @@ function ArrowFunctionExpression(node, parent) {
this.word("async", true); this.word("async", true);
this.space(); this.space();
} }
if (this._shouldPrintArrowParamsParens(node)) { if (_shouldPrintArrowParamsParens.call(this, node)) {
this._params(node, undefined, parent); _params.call(this, node, true, undefined, this._buf._map ? parent : undefined);
} else { } else {
this.print(node.params[0], true); this.print(node.params[0], true);
} }
this._predicate(node, true); _predicate.call(this, node, true);
this.space(); this.space();
this.printInnerComments(); this.printInnerComments();
this.token("=>"); this.token("=>");

File diff suppressed because one or more lines are too long

View File

@@ -18,6 +18,7 @@ exports.ImportSpecifier = ImportSpecifier;
exports._printAttributes = _printAttributes; exports._printAttributes = _printAttributes;
var _t = require("@babel/types"); var _t = require("@babel/types");
var _index = require("../node/index.js"); var _index = require("../node/index.js");
var _expressions = require("./expressions.js");
const { const {
isClassDeclaration, isClassDeclaration,
isExportDefaultSpecifier, isExportDefaultSpecifier,
@@ -116,14 +117,14 @@ function ExportAllDeclaration(node) {
if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) { if ((_node$attributes = node.attributes) != null && _node$attributes.length || (_node$assertions = node.assertions) != null && _node$assertions.length) {
this.print(node.source, true); this.print(node.source, true);
this.space(); this.space();
this._printAttributes(node, false); _printAttributes.call(this, node, false);
} else { } else {
this.print(node.source); this.print(node.source);
} }
this.semicolon(); this.semicolon();
} }
function maybePrintDecoratorsBeforeExport(printer, node) { function maybePrintDecoratorsBeforeExport(printer, node) {
if (isClassDeclaration(node.declaration) && printer._shouldPrintDecoratorsBeforeExport(node)) { if (isClassDeclaration(node.declaration) && _expressions._shouldPrintDecoratorsBeforeExport.call(printer, node)) {
printer.printJoin(node.declaration.decorators); printer.printJoin(node.declaration.decorators);
} }
} }
@@ -174,7 +175,7 @@ function ExportNamedDeclaration(node) {
if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) { if ((_node$attributes2 = node.attributes) != null && _node$attributes2.length || (_node$assertions2 = node.assertions) != null && _node$assertions2.length) {
this.print(node.source, true); this.print(node.source, true);
this.space(); this.space();
this._printAttributes(node, hasBrace); _printAttributes.call(this, node, hasBrace);
} else { } else {
this.print(node.source); this.print(node.source);
} }
@@ -247,7 +248,7 @@ function ImportDeclaration(node) {
if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) { if ((_node$attributes3 = node.attributes) != null && _node$attributes3.length || (_node$assertions3 = node.assertions) != null && _node$assertions3.length) {
this.print(node.source, true); this.print(node.source, true);
this.space(); this.space();
this._printAttributes(node, hasBrace); _printAttributes.call(this, node, hasBrace);
} else { } else {
this.print(node.source); this.print(node.source);
} }

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,8 @@ exports.CatchClause = CatchClause;
exports.ContinueStatement = ContinueStatement; exports.ContinueStatement = ContinueStatement;
exports.DebuggerStatement = DebuggerStatement; exports.DebuggerStatement = DebuggerStatement;
exports.DoWhileStatement = DoWhileStatement; exports.DoWhileStatement = DoWhileStatement;
exports.ForOfStatement = exports.ForInStatement = void 0; exports.ForInStatement = ForInStatement;
exports.ForOfStatement = ForOfStatement;
exports.ForStatement = ForStatement; exports.ForStatement = ForStatement;
exports.IfStatement = IfStatement; exports.IfStatement = IfStatement;
exports.LabeledStatement = LabeledStatement; exports.LabeledStatement = LabeledStatement;
@@ -22,9 +23,9 @@ exports.VariableDeclarator = VariableDeclarator;
exports.WhileStatement = WhileStatement; exports.WhileStatement = WhileStatement;
exports.WithStatement = WithStatement; exports.WithStatement = WithStatement;
var _t = require("@babel/types"); var _t = require("@babel/types");
var _index = require("../node/index.js");
const { const {
isFor, isFor,
isForStatement,
isIfStatement, isIfStatement,
isStatement isStatement
} = _t; } = _t;
@@ -34,7 +35,7 @@ function WithStatement(node) {
this.tokenChar(40); this.tokenChar(40);
this.print(node.object); this.print(node.object);
this.tokenChar(41); this.tokenChar(41);
this.printBlock(node); this.printBlock(node.body);
} }
function IfStatement(node) { function IfStatement(node) {
this.word("if"); this.word("if");
@@ -75,23 +76,21 @@ function ForStatement(node) {
this.word("for"); this.word("for");
this.space(); this.space();
this.tokenChar(40); this.tokenChar(40);
{ this.tokenContext |= _index.TokenContext.forInitHead | _index.TokenContext.forInOrInitHeadAccumulate;
const exit = this.enterForStatementInit(); this.print(node.init);
this.print(node.init); this.tokenContext = _index.TokenContext.normal;
exit();
}
this.tokenChar(59); this.tokenChar(59);
if (node.test) { if (node.test) {
this.space(); this.space();
this.print(node.test); this.print(node.test);
} }
this.token(";", false, 1); this.tokenChar(59, 1);
if (node.update) { if (node.update) {
this.space(); this.space();
this.print(node.update); this.print(node.update);
} }
this.tokenChar(41); this.tokenChar(41);
this.printBlock(node); this.printBlock(node.body);
} }
function WhileStatement(node) { function WhileStatement(node) {
this.word("while"); this.word("while");
@@ -99,32 +98,41 @@ function WhileStatement(node) {
this.tokenChar(40); this.tokenChar(40);
this.print(node.test); this.print(node.test);
this.tokenChar(41); this.tokenChar(41);
this.printBlock(node); this.printBlock(node.body);
} }
function ForXStatement(node) { function ForInStatement(node) {
this.word("for"); this.word("for");
this.space(); this.space();
const isForOf = node.type === "ForOfStatement"; this.noIndentInnerCommentsHere();
if (isForOf && node.await) { 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) {
this.word("await"); this.word("await");
this.space(); this.space();
} }
this.noIndentInnerCommentsHere(); this.noIndentInnerCommentsHere();
this.tokenChar(40); this.tokenChar(40);
{ this.tokenContext |= _index.TokenContext.forOfHead;
const exit = this.enterForXStatementInit(isForOf); this.print(node.left);
this.print(node.left);
exit == null || exit();
}
this.space(); this.space();
this.word(isForOf ? "of" : "in"); this.word("of");
this.space(); this.space();
this.print(node.right); this.print(node.right);
this.tokenChar(41); this.tokenChar(41);
this.printBlock(node); this.printBlock(node.body);
} }
const ForInStatement = exports.ForInStatement = ForXStatement;
const ForOfStatement = exports.ForOfStatement = ForXStatement;
function DoWhileStatement(node) { function DoWhileStatement(node) {
this.word("do"); this.word("do");
this.space(); this.space();
@@ -225,6 +233,10 @@ function DebuggerStatement() {
this.word("debugger"); this.word("debugger");
this.semicolon(); this.semicolon();
} }
function commaSeparatorWithNewline(occurrenceCount) {
this.tokenChar(44, occurrenceCount);
this.newline();
}
function VariableDeclaration(node, parent) { function VariableDeclaration(node, parent) {
if (node.declare) { if (node.declare) {
this.word("declare"); this.word("declare");
@@ -233,12 +245,15 @@ function VariableDeclaration(node, parent) {
const { const {
kind kind
} = node; } = node;
if (kind === "await using") { switch (kind) {
this.word("await"); case "await using":
this.space(); this.word("await");
this.word("using", true); this.space();
} else { case "using":
this.word(kind, kind === "using"); this.word("using", true);
break;
default:
this.word(kind);
} }
this.space(); this.space();
let hasInits = false; let hasInits = false;
@@ -246,18 +261,23 @@ function VariableDeclaration(node, parent) {
for (const declar of node.declarations) { for (const declar of node.declarations) {
if (declar.init) { if (declar.init) {
hasInits = true; hasInits = true;
break;
} }
} }
} }
this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? function (occurrenceCount) { this.printList(node.declarations, undefined, undefined, node.declarations.length > 1, hasInits ? commaSeparatorWithNewline : undefined);
this.token(",", false, occurrenceCount); if (parent != null) {
this.newline(); switch (parent.type) {
} : undefined); case "ForStatement":
if (isFor(parent)) { if (parent.init === node) {
if (isForStatement(parent)) { return;
if (parent.init === node) return; }
} else { break;
if (parent.left === node) return; case "ForInStatement":
case "ForOfStatement":
if (parent.left === node) {
return;
}
} }
} }
this.semicolon(); this.semicolon();

File diff suppressed because one or more lines are too long

View File

@@ -32,7 +32,7 @@ function _printTemplate(node, substitutions) {
this.token(partRaw + "`", true); this.token(partRaw + "`", true);
} }
function TemplateLiteral(node) { function TemplateLiteral(node) {
this._printTemplate(node, node.expressions); _printTemplate.call(this, node, node.expressions);
} }
//# sourceMappingURL=template-literals.js.map //# sourceMappingURL=template-literals.js.map

View File

@@ -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","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;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;EACtE,IAAI,CAACO,cAAc,CAACP,IAAI,EAAEA,IAAI,CAACsB,WAAW,CAAC;AAC7C","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","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":[]}

View File

@@ -24,15 +24,13 @@ exports.VoidPattern = VoidPattern;
exports._getRawIdentifier = _getRawIdentifier; exports._getRawIdentifier = _getRawIdentifier;
var _t = require("@babel/types"); var _t = require("@babel/types");
var _jsesc = require("jsesc"); var _jsesc = require("jsesc");
var _methods = require("./methods.js");
const { const {
isAssignmentPattern, isAssignmentPattern,
isIdentifier isIdentifier
} = _t; } = _t;
let lastRawIdentNode = null;
let lastRawIdentResult = ""; let lastRawIdentResult = "";
function _getRawIdentifier(node) { function _getRawIdentifier(node) {
if (node === lastRawIdentNode) return lastRawIdentResult;
lastRawIdentNode = node;
const { const {
name name
} = node; } = node;
@@ -44,9 +42,11 @@ function _getRawIdentifier(node) {
return lastRawIdentResult = node.name; return lastRawIdentResult = node.name;
} }
function Identifier(node) { function Identifier(node) {
var _node$loc; if (this._buf._map) {
this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name); var _node$loc;
this.word(this.tokenMap ? this._getRawIdentifier(node) : node.name); this.sourceIdentifierName(((_node$loc = node.loc) == null ? void 0 : _node$loc.identifierName) || node.name);
}
this.word(this.tokenMap ? lastRawIdentResult : node.name);
} }
function ArgumentPlaceholder() { function ArgumentPlaceholder() {
this.tokenChar(63); this.tokenChar(63);
@@ -59,18 +59,17 @@ function ObjectExpression(node) {
const props = node.properties; const props = node.properties;
this.tokenChar(123); this.tokenChar(123);
if (props.length) { if (props.length) {
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.space(); this.space();
this.printList(props, this.shouldPrintTrailingComma("}"), true, true); this.printList(props, this.shouldPrintTrailingComma("}"), true, true, undefined, true);
this.space(); this.space();
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
} }
this.sourceWithOffset("end", node.loc, -1); this.rightBrace(node);
this.tokenChar(125);
} }
function ObjectMethod(node) { function ObjectMethod(node) {
this.printJoin(node.decorators); this.printJoin(node.decorators);
this._methodHead(node); _methods._methodHead.call(this, node);
this.space(); this.space();
this.print(node.body); this.print(node.body);
} }
@@ -98,24 +97,24 @@ function ArrayExpression(node) {
const elems = node.elements; const elems = node.elements;
const len = elems.length; const len = elems.length;
this.tokenChar(91); this.tokenChar(91);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
for (let i = 0; i < elems.length; i++) { for (let i = 0; i < elems.length; i++) {
const elem = elems[i]; const elem = elems[i];
if (elem) { if (elem) {
if (i > 0) this.space(); if (i > 0) this.space();
this.print(elem); this.print(elem, undefined, true);
if (i < len - 1 || this.shouldPrintTrailingComma("]")) { if (i < len - 1 || this.shouldPrintTrailingComma("]")) {
this.token(",", false, i); this.tokenChar(44, i);
} }
} else { } else {
this.token(",", false, i); this.tokenChar(44, i);
} }
} }
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.tokenChar(93); this.tokenChar(93);
} }
function RegExpLiteral(node) { function RegExpLiteral(node) {
this.word(`/${node.pattern}/${node.flags}`); this.word(`/${node.pattern}/${node.flags}`, false);
} }
function BooleanLiteral(node) { function BooleanLiteral(node) {
this.word(node.value ? "true" : "false"); this.word(node.value ? "true" : "false");

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.TSAnyKeyword = TSAnyKeyword; exports.TSAnyKeyword = TSAnyKeyword;
exports.TSArrayType = TSArrayType; exports.TSArrayType = TSArrayType;
exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression; exports.TSAsExpression = TSAsExpression;
exports.TSBigIntKeyword = TSBigIntKeyword; exports.TSBigIntKeyword = TSBigIntKeyword;
exports.TSBooleanKeyword = TSBooleanKeyword; exports.TSBooleanKeyword = TSBooleanKeyword;
exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration; exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration;
@@ -49,6 +49,7 @@ exports.TSParenthesizedType = TSParenthesizedType;
exports.TSPropertySignature = TSPropertySignature; exports.TSPropertySignature = TSPropertySignature;
exports.TSQualifiedName = TSQualifiedName; exports.TSQualifiedName = TSQualifiedName;
exports.TSRestType = TSRestType; exports.TSRestType = TSRestType;
exports.TSSatisfiesExpression = TSSatisfiesExpression;
exports.TSStringKeyword = TSStringKeyword; exports.TSStringKeyword = TSStringKeyword;
exports.TSSymbolKeyword = TSSymbolKeyword; exports.TSSymbolKeyword = TSSymbolKeyword;
exports.TSTemplateLiteralType = TSTemplateLiteralType; exports.TSTemplateLiteralType = TSTemplateLiteralType;
@@ -68,10 +69,10 @@ exports.TSUndefinedKeyword = TSUndefinedKeyword;
exports.TSUnionType = TSUnionType; exports.TSUnionType = TSUnionType;
exports.TSUnknownKeyword = TSUnknownKeyword; exports.TSUnknownKeyword = TSUnknownKeyword;
exports.TSVoidKeyword = TSVoidKeyword; exports.TSVoidKeyword = TSVoidKeyword;
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers; exports._tsPrintClassMemberModifiers = _tsPrintClassMemberModifiers;
exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType; var _methods = require("./methods.js");
exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName; var _classes = require("./classes.js");
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase; var _templateLiterals = require("./template-literals.js");
function TSTypeAnnotation(node, parent) { function TSTypeAnnotation(node, parent) {
this.token((parent.type === "TSFunctionType" || parent.type === "TSConstructorType") && parent.typeAnnotation === node ? "=>" : ":"); this.token((parent.type === "TSFunctionType" || parent.type === "TSConstructorType") && parent.typeAnnotation === node ? "=>" : ":");
this.space(); this.space();
@@ -124,18 +125,18 @@ function TSParameterProperty(node) {
this.word("readonly"); this.word("readonly");
this.space(); this.space();
} }
this._param(node.parameter); _methods._param.call(this, node.parameter);
} }
function TSDeclareFunction(node, parent) { function TSDeclareFunction(node, parent) {
if (node.declare) { if (node.declare) {
this.word("declare"); this.word("declare");
this.space(); this.space();
} }
this._functionHead(node, parent); _methods._functionHead.call(this, node, parent, false);
this.semicolon(); this.semicolon();
} }
function TSDeclareMethod(node) { function TSDeclareMethod(node) {
this._classMethodHead(node); _classes._classMethodHead.call(this, node);
this.semicolon(); this.semicolon();
} }
function TSQualifiedName(node) { function TSQualifiedName(node) {
@@ -144,7 +145,7 @@ function TSQualifiedName(node) {
this.print(node.right); this.print(node.right);
} }
function TSCallSignatureDeclaration(node) { function TSCallSignatureDeclaration(node) {
this.tsPrintSignatureDeclarationBase(node); tsPrintSignatureDeclarationBase.call(this, node);
maybePrintTrailingCommaOrSemicolon(this, node); maybePrintTrailingCommaOrSemicolon(this, node);
} }
function maybePrintTrailingCommaOrSemicolon(printer, node) { function maybePrintTrailingCommaOrSemicolon(printer, node) {
@@ -161,7 +162,7 @@ function maybePrintTrailingCommaOrSemicolon(printer, node) {
function TSConstructSignatureDeclaration(node) { function TSConstructSignatureDeclaration(node) {
this.word("new"); this.word("new");
this.space(); this.space();
this.tsPrintSignatureDeclarationBase(node); tsPrintSignatureDeclarationBase.call(this, node);
maybePrintTrailingCommaOrSemicolon(this, node); maybePrintTrailingCommaOrSemicolon(this, node);
} }
function TSPropertySignature(node) { function TSPropertySignature(node) {
@@ -172,7 +173,7 @@ function TSPropertySignature(node) {
this.word("readonly"); this.word("readonly");
this.space(); this.space();
} }
this.tsPrintPropertyOrMethodName(node); tsPrintPropertyOrMethodName.call(this, node);
this.print(node.typeAnnotation); this.print(node.typeAnnotation);
maybePrintTrailingCommaOrSemicolon(this, node); maybePrintTrailingCommaOrSemicolon(this, node);
} }
@@ -196,8 +197,8 @@ function TSMethodSignature(node) {
this.word(kind); this.word(kind);
this.space(); this.space();
} }
this.tsPrintPropertyOrMethodName(node); tsPrintPropertyOrMethodName.call(this, node);
this.tsPrintSignatureDeclarationBase(node); tsPrintSignatureDeclarationBase.call(this, node);
maybePrintTrailingCommaOrSemicolon(this, node); maybePrintTrailingCommaOrSemicolon(this, node);
} }
function TSIndexSignature(node) { function TSIndexSignature(node) {
@@ -214,7 +215,7 @@ function TSIndexSignature(node) {
this.space(); this.space();
} }
this.tokenChar(91); this.tokenChar(91);
this._parameters(node.parameters, "]"); _methods._parameters.call(this, node.parameters, 93);
this.print(node.typeAnnotation); this.print(node.typeAnnotation);
maybePrintTrailingCommaOrSemicolon(this, node); maybePrintTrailingCommaOrSemicolon(this, node);
} }
@@ -261,7 +262,7 @@ function TSThisType() {
this.word("this"); this.word("this");
} }
function TSFunctionType(node) { function TSFunctionType(node) {
this.tsPrintFunctionOrConstructorType(node); tsPrintFunctionOrConstructorType.call(this, node);
} }
function TSConstructorType(node) { function TSConstructorType(node) {
if (node.abstract) { if (node.abstract) {
@@ -270,7 +271,7 @@ function TSConstructorType(node) {
} }
this.word("new"); this.word("new");
this.space(); this.space();
this.tsPrintFunctionOrConstructorType(node); tsPrintFunctionOrConstructorType.call(this, node);
} }
function tsPrintFunctionOrConstructorType(node) { function tsPrintFunctionOrConstructorType(node) {
const { const {
@@ -279,7 +280,7 @@ function tsPrintFunctionOrConstructorType(node) {
const parameters = node.parameters; const parameters = node.parameters;
this.print(typeParameters); this.print(typeParameters);
this.tokenChar(40); this.tokenChar(40);
this._parameters(parameters, ")"); _methods._parameters.call(this, parameters, 41);
this.space(); this.space();
const returnType = node.typeAnnotation; const returnType = node.typeAnnotation;
this.print(returnType); this.print(returnType);
@@ -312,7 +313,7 @@ function TSTypeQuery(node) {
} }
} }
function TSTypeLiteral(node) { function TSTypeLiteral(node) {
printBraced(this, node, () => this.printJoin(node.members, true, true)); printBraced(this, node, () => this.printJoin(node.members, true, true, undefined, undefined, true));
} }
function TSArrayType(node) { function TSArrayType(node) {
this.print(node.elementType, true); this.print(node.elementType, true);
@@ -401,7 +402,7 @@ function TSMappedType(node) {
typeAnnotation typeAnnotation
} = node; } = node;
this.tokenChar(123); this.tokenChar(123);
const exit = this.enterDelimited(); const oldNoLineTerminatorAfterNode = this.enterDelimited();
this.space(); this.space();
if (readonly) { if (readonly) {
tokenIfPlusMinus(this, readonly); tokenIfPlusMinus(this, readonly);
@@ -413,12 +414,12 @@ function TSMappedType(node) {
this.space(); this.space();
this.word("in"); this.word("in");
this.space(); this.space();
this.print(node.typeParameter.constraint); this.print(node.typeParameter.constraint, undefined, true);
if (nameType) { if (nameType) {
this.space(); this.space();
this.word("as"); this.word("as");
this.space(); this.space();
this.print(nameType); this.print(nameType, undefined, true);
} }
this.tokenChar(93); this.tokenChar(93);
if (optional) { if (optional) {
@@ -428,10 +429,10 @@ function TSMappedType(node) {
if (typeAnnotation) { if (typeAnnotation) {
this.tokenChar(58); this.tokenChar(58);
this.space(); this.space();
this.print(typeAnnotation); this.print(typeAnnotation, undefined, true);
} }
this.space(); this.space();
exit(); this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.tokenChar(125); this.tokenChar(125);
} }
function tokenIfPlusMinus(self, tok) { function tokenIfPlusMinus(self, tok) {
@@ -440,7 +441,7 @@ function tokenIfPlusMinus(self, tok) {
} }
} }
function TSTemplateLiteralType(node) { function TSTemplateLiteralType(node) {
this._printTemplate(node, node.types); _templateLiterals._printTemplate.call(this, node, node.types);
} }
function TSLiteralType(node) { function TSLiteralType(node) {
this.print(node.literal); this.print(node.literal);
@@ -475,7 +476,7 @@ function TSInterfaceDeclaration(node) {
this.print(body); this.print(body);
} }
function TSInterfaceBody(node) { function TSInterfaceBody(node) {
printBraced(this, node, () => this.printJoin(node.body, true, true)); printBraced(this, node, () => this.printJoin(node.body, true, true, undefined, undefined, true));
} }
function TSTypeAliasDeclaration(node) { function TSTypeAliasDeclaration(node) {
const { const {
@@ -498,15 +499,25 @@ function TSTypeAliasDeclaration(node) {
this.print(typeAnnotation); this.print(typeAnnotation);
this.semicolon(); this.semicolon();
} }
function TSTypeExpression(node) { function TSAsExpression(node) {
const { const {
type,
expression, expression,
typeAnnotation typeAnnotation
} = node; } = node;
this.print(expression, true); this.print(expression, true);
this.space(); this.space();
this.word(type === "TSAsExpression" ? "as" : "satisfies"); 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.space(); this.space();
this.print(typeAnnotation); this.print(typeAnnotation);
} }
@@ -548,7 +559,7 @@ function TSEnumDeclaration(node) {
function TSEnumBody(node) { function TSEnumBody(node) {
printBraced(this, node, () => { printBraced(this, node, () => {
var _this$shouldPrintTrai; var _this$shouldPrintTrai;
return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true); return this.printList(node.members, (_this$shouldPrintTrai = this.shouldPrintTrailingComma("}")) != null ? _this$shouldPrintTrai : true, true, true, undefined, true);
}); });
} }
function TSEnumMember(node) { function TSEnumMember(node) {
@@ -593,7 +604,7 @@ function TSModuleDeclaration(node) {
this.print(body); this.print(body);
} }
function TSModuleBlock(node) { function TSModuleBlock(node) {
printBraced(this, node, () => this.printSequence(node.body, true)); printBraced(this, node, () => this.printSequence(node.body, true, true));
} }
function TSImportType(node) { function TSImportType(node) {
const { const {
@@ -643,6 +654,7 @@ function TSExternalModuleReference(node) {
function TSNonNullExpression(node) { function TSNonNullExpression(node) {
this.print(node.expression); this.print(node.expression);
this.tokenChar(33); this.tokenChar(33);
this.setLastChar(33);
} }
function TSExportAssignment(node) { function TSExportAssignment(node) {
this.word("export"); this.word("export");
@@ -669,11 +681,11 @@ function tsPrintSignatureDeclarationBase(node) {
const parameters = node.parameters; const parameters = node.parameters;
this.print(typeParameters); this.print(typeParameters);
this.tokenChar(40); this.tokenChar(40);
this._parameters(parameters, ")"); _methods._parameters.call(this, parameters, 41);
const returnType = node.typeAnnotation; const returnType = node.typeAnnotation;
this.print(returnType); this.print(returnType);
} }
function tsPrintClassMemberModifiers(node) { function _tsPrintClassMemberModifiers(node) {
const isPrivateField = node.type === "ClassPrivateProperty"; const isPrivateField = node.type === "ClassPrivateProperty";
const isPublicField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty"; const isPublicField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty";
printModifiersList(this, node, [isPublicField && node.declare && "declare", !isPrivateField && node.accessibility]); printModifiersList(this, node, [isPublicField && node.declare && "declare", !isPrivateField && node.accessibility]);
@@ -685,9 +697,9 @@ function tsPrintClassMemberModifiers(node) {
} }
function printBraced(printer, node, cb) { function printBraced(printer, node, cb) {
printer.token("{"); printer.token("{");
const exit = printer.enterDelimited(); const oldNoLineTerminatorAfterNode = printer.enterDelimited();
cb(); cb();
exit(); printer._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
printer.rightBrace(node); printer.rightBrace(node);
} }
function printModifiersList(printer, node, modifiers) { function printModifiersList(printer, node, modifiers) {

File diff suppressed because one or more lines are too long

View File

@@ -5,22 +5,12 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.TokenContext = void 0; exports.TokenContext = void 0;
exports.isLastChild = isLastChild; exports.isLastChild = isLastChild;
exports.needsParens = needsParens; exports.parentNeedsParens = parentNeedsParens;
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
var whitespace = require("./whitespace.js");
var parens = require("./parentheses.js"); var parens = require("./parentheses.js");
var _t = require("@babel/types"); var _t = require("@babel/types");
var _nodes = require("../nodes.js");
const { const {
FLIPPED_ALIAS_KEYS, VISITOR_KEYS
VISITOR_KEYS,
isCallExpression,
isDecorator,
isExpressionStatement,
isMemberExpression,
isNewExpression,
isParenthesizedExpression
} = _t; } = _t;
const TokenContext = exports.TokenContext = { const TokenContext = exports.TokenContext = {
normal: 0, normal: 0,
@@ -34,63 +24,32 @@ const TokenContext = exports.TokenContext = {
forInOrInitHeadAccumulate: 128, forInOrInitHeadAccumulate: 128,
forInOrInitHeadAccumulatePassThroughMask: 128 forInOrInitHeadAccumulatePassThroughMask: 128
}; };
function expandAliases(obj) { for (const type of Object.keys(parens)) {
const map = new Map(); const func = parens[type];
function add(type, func) { if (_nodes.generatorInfosMap.has(type)) {
const fn = map.get(type); _nodes.generatorInfosMap.get(type)[2] = func;
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);
} }
for (const type of Object.keys(obj)) {
const aliases = FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (const alias of aliases) {
add(alias, obj[type]);
}
} else {
add(type, obj[type]);
}
}
return map;
} }
const expandedParens = expandAliases(parens);
const expandedWhitespaceNodes = expandAliases(whitespace.nodes);
function isOrHasCallExpression(node) { function isOrHasCallExpression(node) {
if (isCallExpression(node)) { switch (node.type) {
return true; case "CallExpression":
} return true;
return isMemberExpression(node) && isOrHasCallExpression(node.object); case "MemberExpression":
} return 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; return false;
} }
function needsWhitespaceBefore(node, parent) { function parentNeedsParens(node, parent, parentId) {
return needsWhitespace(node, parent, 1); switch (parentId) {
} case 112:
function needsWhitespaceAfter(node, parent) { if (parent.callee === node) {
return needsWhitespace(node, parent, 2); if (isOrHasCallExpression(node)) return true;
} }
function needsParens(node, parent, tokenContext, getRawIdentifier) { break;
var _expandedParens$get; case 42:
if (!parent) return false; return !isDecoratorMemberExpression(node) && !(node.type === "CallExpression" && isDecoratorMemberExpression(node.callee)) && node.type !== "ParenthesizedExpression";
if (isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
} }
if (isDecorator(parent)) { return false;
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) { function isDecoratorMemberExpression(node) {
switch (node.type) { switch (node.type) {

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.AssignmentExpression = AssignmentExpression; exports.AssignmentExpression = AssignmentExpression;
exports.Binary = Binary;
exports.BinaryExpression = BinaryExpression; exports.BinaryExpression = BinaryExpression;
exports.ClassExpression = ClassExpression; exports.ClassExpression = ClassExpression;
exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression; exports.ArrowFunctionExpression = exports.ConditionalExpression = ConditionalExpression;
@@ -24,7 +23,7 @@ exports.TSConstructorType = exports.TSFunctionType = TSFunctionType;
exports.TSInferType = TSInferType; exports.TSInferType = TSInferType;
exports.TSInstantiationExpression = TSInstantiationExpression; exports.TSInstantiationExpression = TSInstantiationExpression;
exports.TSIntersectionType = TSIntersectionType; exports.TSIntersectionType = TSIntersectionType;
exports.UnaryLike = exports.TSTypeAssertion = UnaryLike; exports.SpreadElement = exports.UnaryExpression = exports.TSTypeAssertion = UnaryLike;
exports.TSTypeOperator = TSTypeOperator; exports.TSTypeOperator = TSTypeOperator;
exports.TSUnionType = TSUnionType; exports.TSUnionType = TSUnionType;
exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation;
@@ -33,229 +32,267 @@ exports.AwaitExpression = exports.YieldExpression = YieldExpression;
var _t = require("@babel/types"); var _t = require("@babel/types");
var _index = require("./index.js"); var _index = require("./index.js");
const { const {
isArrayTypeAnnotation,
isBinaryExpression,
isCallExpression,
isForOfStatement,
isIndexedAccessType,
isMemberExpression, isMemberExpression,
isObjectPattern,
isOptionalMemberExpression, isOptionalMemberExpression,
isYieldExpression, isYieldExpression,
isStatement isStatement
} = _t; } = _t;
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]]); 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 getBinaryPrecedence(node, nodeType) { function isTSTypeExpression(nodeId) {
if (nodeType === "BinaryExpression" || nodeType === "LogicalExpression") { return nodeId === 156 || nodeId === 201 || nodeId === 209;
return PRECEDENCE.get(node.operator);
}
if (nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression") {
return PRECEDENCE.get("in");
}
} }
function isTSTypeExpression(nodeType) { const isClassExtendsClause = (node, parent, parentId) => {
return nodeType === "TSAsExpression" || nodeType === "TSSatisfiesExpression" || nodeType === "TSTypeAssertion"; return (parentId === 21 || parentId === 22) && parent.superClass === node;
}
const isClassExtendsClause = (node, parent) => {
const parentType = parent.type;
return (parentType === "ClassDeclaration" || parentType === "ClassExpression") && parent.superClass === node;
}; };
const hasPostfixPart = (node, parent) => { const hasPostfixPart = (node, parent, parentId) => {
const parentType = parent.type; switch (parentId) {
return (parentType === "MemberExpression" || parentType === "OptionalMemberExpression") && parent.object === node || (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression") && parent.callee === node || parentType === "TaggedTemplateExpression" && parent.tag === node || parentType === "TSNonNullExpression"; 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;
}
return false;
}; };
function NullableTypeAnnotation(node, parent) { function NullableTypeAnnotation(node, parent, parentId) {
return isArrayTypeAnnotation(parent); return parentId === 4;
} }
function FunctionTypeAnnotation(node, parent, tokenContext) { function FunctionTypeAnnotation(node, parent, parentId, tokenContext) {
const parentType = parent.type; return (parentId === 239 || parentId === 90 || parentId === 4 || (tokenContext & _index.TokenContext.arrowFlowReturnType) > 0
return (parentType === "UnionTypeAnnotation" || parentType === "IntersectionTypeAnnotation" || parentType === "ArrayTypeAnnotation" || Boolean(tokenContext & _index.TokenContext.arrowFlowReturnType)
); );
} }
function UpdateExpression(node, parent) { function UpdateExpression(node, parent, parentId) {
return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); return hasPostfixPart(node, parent, parentId) || isClassExtendsClause(node, parent, parentId);
} }
function needsParenBeforeExpressionBrace(tokenContext) { function needsParenBeforeExpressionBrace(tokenContext) {
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody)); return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.arrowBody)) > 0;
} }
function ObjectExpression(node, parent, tokenContext) { function ObjectExpression(node, parent, parentId, tokenContext) {
return needsParenBeforeExpressionBrace(tokenContext); return needsParenBeforeExpressionBrace(tokenContext);
} }
function DoExpression(node, parent, tokenContext) { function DoExpression(node, parent, parentId, tokenContext) {
return !node.async && Boolean(tokenContext & _index.TokenContext.expressionStatement); return (tokenContext & _index.TokenContext.expressionStatement) > 0 && !node.async;
} }
function Binary(node, parent) { function BinaryLike(node, parent, parentId, nodeType) {
const parentType = parent.type; if (isClassExtendsClause(node, parent, parentId)) {
if (node.type === "BinaryExpression" && node.operator === "**" && parentType === "BinaryExpression" && parent.operator === "**") {
return parent.left === node;
}
if (isClassExtendsClause(node, parent)) {
return true; return true;
} }
if (hasPostfixPart(node, parent) || parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "AwaitExpression") { if (hasPostfixPart(node, parent, parentId) || parentId === 238 || parentId === 145 || parentId === 8) {
return true; return true;
} }
const parentPos = getBinaryPrecedence(parent, parentType); let parentPos;
if (parentPos != null) { switch (parentId) {
const nodePos = getBinaryPrecedence(node, node.type); case 10:
if (parentPos === nodePos && parentType === "BinaryExpression" && parent.right === node || parentPos > nodePos) { 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)) {
return true; 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 true;
} }
} }
return false; return false;
} }
function TSTypeOperator(node, parent) { function UnionTypeAnnotation(node, parent, parentId) {
const parentType = parent.type; switch (parentId) {
return parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSOptionalType"; case 4:
case 115:
case 90:
case 239:
return true;
}
return false;
} }
function TSInstantiationExpression(node, parent) { function OptionalIndexedAccessType(node, parent, parentId) {
const parentType = parent.type; return parentId === 84 && parent.objectType === node;
return (parentType === "CallExpression" || parentType === "OptionalCallExpression" || parentType === "NewExpression" || parentType === "TSInstantiationExpression") && !!parent.typeParameters;
} }
function TSFunctionType(node, parent) { function TSAsExpression(node, parent, parentId) {
const parentType = parent.type; if ((parentId === 6 || parentId === 7) && parent.left === node) {
return parentType === "TSIntersectionType" || parentType === "TSUnionType" || parentType === "TSTypeOperator" || parentType === "TSOptionalType" || parentType === "TSArrayType" || parentType === "TSIndexedAccessType" && parent.objectType === node || parentType === "TSConditionalType" && (parent.checkType === node || parent.extendsType === node); return true;
}
if (parentId === 10 && (parent.operator === "|" || parent.operator === "&") && node === parent.left) {
return true;
}
return BinaryLike(node, parent, parentId, 2);
} }
function BinaryExpression(node, parent, tokenContext) { function TSConditionalType(node, parent, parentId) {
return node.operator === "in" && Boolean(tokenContext & _index.TokenContext.forInOrInitHeadAccumulate); 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 SequenceExpression(node, parent) { function TSUnionType(node, parent, parentId) {
const parentType = parent.type; switch (parentId) {
if (parentType === "SequenceExpression" || parentType === "ParenthesizedExpression" || parentType === "MemberExpression" && parent.property === node || parentType === "OptionalMemberExpression" && parent.property === node || parentType === "TemplateLiteral") { 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) {
return false; return false;
} }
if (parentType === "ClassDeclaration") { if (parentId === 21) {
return true; return true;
} }
if (parentType === "ForOfStatement") { if (parentId === 68) {
return parent.right === node; return parent.right === node;
} }
if (parentType === "ExportDefaultDeclaration") { if (parentId === 60) {
return true; return true;
} }
return !isStatement(parent); return !isStatement(parent);
} }
function YieldExpression(node, parent) { function YieldExpression(node, parent, parentId) {
const parentType = parent.type; 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);
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, tokenContext) { function ClassExpression(node, parent, parentId, tokenContext) {
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)); return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)) > 0;
} }
function UnaryLike(node, parent) { function UnaryLike(node, parent, parentId) {
return hasPostfixPart(node, parent) || isBinaryExpression(parent) && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent); return hasPostfixPart(node, parent, parentId) || parentId === 10 && parent.operator === "**" && parent.left === node || isClassExtendsClause(node, parent, parentId);
} }
function FunctionExpression(node, parent, tokenContext) { function FunctionExpression(node, parent, parentId, tokenContext) {
return Boolean(tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)); return (tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.exportDefault)) > 0;
} }
function ConditionalExpression(node, parent) { function ConditionalExpression(node, parent, parentId) {
const parentType = parent.type; switch (parentId) {
if (parentType === "UnaryExpression" || parentType === "SpreadElement" || parentType === "BinaryExpression" || parentType === "LogicalExpression" || parentType === "ConditionalExpression" && parent.test === node || parentType === "AwaitExpression" || isTSTypeExpression(parentType)) { case 238:
case 145:
case 10:
case 107:
case 8:
return true;
case 28:
if (parent.test === node) {
return true;
}
}
if (isTSTypeExpression(parentId)) {
return true; return true;
} }
return UnaryLike(node, parent); return UnaryLike(node, parent, parentId);
} }
function OptionalMemberExpression(node, parent) { function OptionalMemberExpression(node, parent, parentId) {
return isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node; switch (parentId) {
case 17:
return parent.callee === node;
case 108:
return parent.object === node;
}
return false;
} }
function AssignmentExpression(node, parent, tokenContext) { function AssignmentExpression(node, parent, parentId, tokenContext) {
if (needsParenBeforeExpressionBrace(tokenContext) && isObjectPattern(node.left)) { if (needsParenBeforeExpressionBrace(tokenContext) && node.left.type === "ObjectPattern") {
return true; return true;
} else {
return ConditionalExpression(node, parent);
} }
return ConditionalExpression(node, parent, parentId);
} }
function LogicalExpression(node, parent) { function Identifier(node, parent, parentId, tokenContext, getRawIdentifier) {
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; var _node$extra;
const parentType = parent.type; if (getRawIdentifier && getRawIdentifier(node) !== node.name) {
if ((_node$extra = node.extra) != null && _node$extra.parenthesized && parentType === "AssignmentExpression" && parent.left === node) { return false;
}
if (parentId === 6 && (_node$extra = node.extra) != null && _node$extra.parenthesized && parent.left === node) {
const rightType = parent.right.type; const rightType = parent.right.type;
if ((rightType === "FunctionExpression" || rightType === "ClassExpression") && parent.right.id == null) { if ((rightType === "FunctionExpression" || rightType === "ClassExpression") && parent.right.id == null) {
return true; return true;
} }
} }
if (getRawIdentifier && getRawIdentifier(node) !== node.name) { if (tokenContext & _index.TokenContext.forOfHead || (parentId === 108 || parentId === 132) && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) {
return false; if (node.name === "let") {
} const isFollowedByBracket = isMemberExpression(parent, {
if (node.name === "let") { object: node,
const isFollowedByBracket = isMemberExpression(parent, { computed: true
object: node, }) || isOptionalMemberExpression(parent, {
computed: true object: node,
}) || isOptionalMemberExpression(parent, { computed: true,
object: node, optional: false
computed: true, });
optional: false if (isFollowedByBracket && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) {
}); return true;
if (isFollowedByBracket && tokenContext & (_index.TokenContext.expressionStatement | _index.TokenContext.forInitHead | _index.TokenContext.forInHead)) { }
return true; return (tokenContext & _index.TokenContext.forOfHead) > 0;
} }
return Boolean(tokenContext & _index.TokenContext.forOfHead);
} }
return node.name === "async" && isForOfStatement(parent, { return parentId === 68 && parent.left === node && node.name === "async" && !parent.await;
left: node,
await: false
});
} }
//# sourceMappingURL=parentheses.js.map //# sourceMappingURL=parentheses.js.map

File diff suppressed because one or more lines are too long

View File

@@ -1,156 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.nodes = void 0;
var _t = require("@babel/types");
const {
FLIPPED_ALIAS_KEYS,
isArrayExpression,
isAssignmentExpression,
isBinary,
isBlockStatement,
isCallExpression,
isFunction,
isIdentifier,
isLiteral,
isMemberExpression,
isObjectExpression,
isOptionalCallExpression,
isOptionalMemberExpression,
isStringLiteral
} = _t;
function crawlInternal(node, state) {
if (!node) return state;
if (isMemberExpression(node) || isOptionalMemberExpression(node)) {
crawlInternal(node.object, state);
if (node.computed) crawlInternal(node.property, state);
} else if (isBinary(node) || isAssignmentExpression(node)) {
crawlInternal(node.left, state);
crawlInternal(node.right, state);
} else if (isCallExpression(node) || isOptionalCallExpression(node)) {
state.hasCall = true;
crawlInternal(node.callee, state);
} else if (isFunction(node)) {
state.hasFunction = true;
} else if (isIdentifier(node)) {
state.hasHelper = state.hasHelper || node.callee && isHelper(node.callee);
}
return state;
}
function crawl(node) {
return crawlInternal(node, {
hasCall: false,
hasFunction: false,
hasHelper: false
});
}
function isHelper(node) {
if (!node) return false;
if (isMemberExpression(node)) {
return isHelper(node.object) || isHelper(node.property);
} else if (isIdentifier(node)) {
return node.name === "require" || node.name.charCodeAt(0) === 95;
} else if (isCallExpression(node)) {
return isHelper(node.callee);
} else if (isBinary(node) || isAssignmentExpression(node)) {
return isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else {
return false;
}
}
function isType(node) {
return isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node);
}
const nodes = exports.nodes = {
AssignmentExpression(node) {
const state = crawl(node.right);
if (state.hasCall && state.hasHelper || state.hasFunction) {
return state.hasFunction ? 1 | 2 : 2;
}
return 0;
},
SwitchCase(node, parent) {
return (!!node.consequent.length || parent.cases[0] === node ? 1 : 0) | (!node.consequent.length && parent.cases[parent.cases.length - 1] === node ? 2 : 0);
},
LogicalExpression(node) {
if (isFunction(node.left) || isFunction(node.right)) {
return 2;
}
return 0;
},
Literal(node) {
if (isStringLiteral(node) && node.value === "use strict") {
return 2;
}
return 0;
},
CallExpression(node) {
if (isFunction(node.callee) || isHelper(node)) {
return 1 | 2;
}
return 0;
},
OptionalCallExpression(node) {
if (isFunction(node.callee)) {
return 1 | 2;
}
return 0;
},
VariableDeclaration(node) {
for (let i = 0; i < node.declarations.length; i++) {
const declar = node.declarations[i];
let enabled = isHelper(declar.id) && !isType(declar.init);
if (!enabled && declar.init) {
const state = crawl(declar.init);
enabled = isHelper(declar.init) && state.hasCall || state.hasFunction;
}
if (enabled) {
return 1 | 2;
}
}
return 0;
},
IfStatement(node) {
if (isBlockStatement(node.consequent)) {
return 1 | 2;
}
return 0;
}
};
nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) {
if (parent.properties[0] === node) {
return 1;
}
return 0;
};
nodes.ObjectTypeCallProperty = function (node, parent) {
var _parent$properties;
if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) {
return 1;
}
return 0;
};
nodes.ObjectTypeIndexer = function (node, parent) {
var _parent$properties2, _parent$callPropertie;
if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) {
return 1;
}
return 0;
};
nodes.ObjectTypeInternalSlot = function (node, parent) {
var _parent$properties3, _parent$callPropertie2, _parent$indexers;
if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) {
return 1;
}
return 0;
};
[["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) {
[type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
const ret = amounts ? 1 | 2 : 0;
nodes[type] = () => ret;
});
});
//# sourceMappingURL=whitespace.js.map

File diff suppressed because one or more lines are too long

19
node_modules/@babel/generator/lib/nodes.js generated vendored Normal file
View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.generatorInfosMap = void 0;
var generatorFunctions = require("./generators/index.js");
var deprecatedGeneratorFunctions = require("./generators/deprecated.js");
const generatorInfosMap = exports.generatorInfosMap = new Map();
let index = 0;
for (const key of Object.keys(generatorFunctions).sort()) {
if (key.startsWith("_")) continue;
generatorInfosMap.set(key, [generatorFunctions[key], index++, undefined]);
}
for (const key of Object.keys(deprecatedGeneratorFunctions)) {
generatorInfosMap.set(key, [deprecatedGeneratorFunctions[key], index++, undefined]);
}
//# sourceMappingURL=nodes.js.map

1
node_modules/@babel/generator/lib/nodes.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"names":["generatorFunctions","require","deprecatedGeneratorFunctions","generatorInfosMap","exports","Map","index","key","Object","keys","sort","startsWith","set","undefined"],"sources":["../src/nodes.ts"],"sourcesContent":["import type * as t from \"@babel/types\";\n\nimport * as generatorFunctions from \"./generators/index.ts\";\nimport * as deprecatedGeneratorFunctions from \"./generators/deprecated.ts\";\nimport type { NodeHandler } from \"./node/index.ts\";\nimport type Printer from \"./printer.ts\";\n\ndeclare global {\n function __node(type: t.Node[\"type\"]): number;\n}\n\nconst generatorInfosMap = new Map<\n string,\n [\n (this: Printer, node: t.Node, parent?: t.Node | null) => void,\n number,\n NodeHandler<boolean> | undefined,\n ]\n>();\nlet index = 0;\n\nfor (const key of Object.keys(generatorFunctions).sort() as Exclude<\n keyof typeof generatorFunctions,\n `_${string}`\n>[]) {\n if (key.startsWith(\"_\")) continue;\n generatorInfosMap.set(key, [generatorFunctions[key], index++, undefined]);\n}\nif (!process.env.BABEL_8_BREAKING) {\n for (const key of Object.keys(\n deprecatedGeneratorFunctions,\n ) as (keyof typeof deprecatedGeneratorFunctions)[]) {\n generatorInfosMap.set(key, [\n deprecatedGeneratorFunctions[key],\n index++,\n undefined,\n ]);\n }\n}\n\nexport { generatorInfosMap };\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,4BAAA,GAAAD,OAAA;AAQA,MAAME,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,IAAIE,GAAG,CAO/B,CAAC;AACH,IAAIC,KAAK,GAAG,CAAC;AAEb,KAAK,MAAMC,GAAG,IAAIC,MAAM,CAACC,IAAI,CAACT,kBAAkB,CAAC,CAACU,IAAI,CAAC,CAAC,EAGnD;EACH,IAAIH,GAAG,CAACI,UAAU,CAAC,GAAG,CAAC,EAAE;EACzBR,iBAAiB,CAACS,GAAG,CAACL,GAAG,EAAE,CAACP,kBAAkB,CAACO,GAAG,CAAC,EAAED,KAAK,EAAE,EAAEO,SAAS,CAAC,CAAC;AAC3E;AAEE,KAAK,MAAMN,GAAG,IAAIC,MAAM,CAACC,IAAI,CAC3BP,4BACF,CAAC,EAAmD;EAClDC,iBAAiB,CAACS,GAAG,CAACL,GAAG,EAAE,CACzBL,4BAA4B,CAACK,GAAG,CAAC,EACjCD,KAAK,EAAE,EACPO,SAAS,CACV,CAAC;AACJ","ignoreList":[]}

View File

@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
exports.default = void 0; exports.default = void 0;
var _buffer = require("./buffer.js"); var _buffer = require("./buffer.js");
var _index = require("./node/index.js"); var _index = require("./node/index.js");
var n = _index; var _nodes = require("./nodes.js");
var _t = require("@babel/types"); var _t = require("@babel/types");
var _tokenMap = require("./token-map.js"); var _tokenMap = require("./token-map.js");
var generatorFunctions = require("./generators/index.js"); var _types2 = require("./generators/types.js");
var _deprecated = require("./generators/deprecated.js");
const { const {
isExpression, isExpression,
isFunction, isFunction,
@@ -26,15 +25,13 @@ const HAS_NEWLINE_OR_BlOCK_COMMENT_END = /[\n\r\u2028\u2029]|\*\//;
function commentIsNewline(c) { function commentIsNewline(c) {
return c.type === "CommentLine" || HAS_NEWLINE.test(c.value); return c.type === "CommentLine" || HAS_NEWLINE.test(c.value);
} }
const {
needsParens
} = n;
class Printer { class Printer {
constructor(format, map, tokens = null, originalCode = null) { constructor(format, map, tokens = null, originalCode = null) {
this.tokenContext = _index.TokenContext.normal; this.tokenContext = _index.TokenContext.normal;
this._tokens = null; this._tokens = null;
this._originalCode = null; this._originalCode = null;
this._currentNode = null; this._currentNode = null;
this._currentTypeId = null;
this._indent = 0; this._indent = 0;
this._indentRepeat = 0; this._indentRepeat = 0;
this._insideAux = false; this._insideAux = false;
@@ -42,14 +39,11 @@ class Printer {
this._noLineTerminatorAfterNode = null; this._noLineTerminatorAfterNode = null;
this._printAuxAfterOnNextUserNode = false; this._printAuxAfterOnNextUserNode = false;
this._printedComments = new Set(); this._printedComments = new Set();
this._endsWithInteger = false;
this._endsWithWord = false;
this._endsWithDiv = false;
this._lastCommentLine = 0; this._lastCommentLine = 0;
this._endsWithInnerRaw = false; this._innerCommentsState = 0;
this._indentInnerComments = true; this._flags = 0;
this.tokenMap = null; this.tokenMap = null;
this._boundGetRawIdentifier = this._getRawIdentifier.bind(this); this._boundGetRawIdentifier = null;
this._printSemicolonBeforeNextNode = -1; this._printSemicolonBeforeNextNode = -1;
this._printSemicolonBeforeNextToken = -1; this._printSemicolonBeforeNextToken = -1;
this.format = format; this.format = format;
@@ -58,67 +52,66 @@ class Printer {
this._indentRepeat = format.indent.style.length; this._indentRepeat = format.indent.style.length;
this._inputMap = (map == null ? void 0 : map._inputMap) || null; this._inputMap = (map == null ? void 0 : map._inputMap) || null;
this._buf = new _buffer.default(map, format.indent.style[0]); this._buf = new _buffer.default(map, format.indent.style[0]);
} const {
enterForStatementInit() { preserveFormat,
this.tokenContext |= _index.TokenContext.forInitHead | _index.TokenContext.forInOrInitHeadAccumulate; compact,
return () => this.tokenContext = _index.TokenContext.normal; concise,
} retainLines,
enterForXStatementInit(isForOf) { retainFunctionParens
if (isForOf) { } = format;
this.tokenContext |= _index.TokenContext.forOfHead; if (preserveFormat) {
return null; this._flags |= 1;
} else { }
this.tokenContext |= _index.TokenContext.forInHead | _index.TokenContext.forInOrInitHeadAccumulate; if (compact) {
return () => this.tokenContext = _index.TokenContext.normal; 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;
} }
} }
enterDelimited() { enterDelimited() {
const oldTokenContext = this.tokenContext;
const oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode; const oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
if (!(oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) && oldNoLineTerminatorAfterNode === null) { if (oldNoLineTerminatorAfterNode !== null) {
return () => {}; this._noLineTerminatorAfterNode = null;
} }
this._noLineTerminatorAfterNode = null; return oldNoLineTerminatorAfterNode;
this.tokenContext = _index.TokenContext.normal;
return () => {
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
this.tokenContext = oldTokenContext;
};
} }
generate(ast) { generate(ast) {
if (this.format.preserveFormat) { if (this.format.preserveFormat) {
this.tokenMap = new _tokenMap.TokenMap(ast, this._tokens, this._originalCode); this.tokenMap = new _tokenMap.TokenMap(ast, this._tokens, this._originalCode);
this._boundGetRawIdentifier = _types2._getRawIdentifier.bind(this);
} }
this.print(ast); this.print(ast);
this._maybeAddAuxComment(); this._maybeAddAuxComment();
return this._buf.get(); return this._buf.get();
} }
indent() { indent(flags = this._flags) {
const { if (flags & (1 | 2 | 4)) {
format
} = this;
if (format.preserveFormat || format.compact || format.concise) {
return; return;
} }
this._indent++; this._indent += this._indentRepeat;
} }
dedent() { dedent(flags = this._flags) {
const { if (flags & (1 | 2 | 4)) {
format
} = this;
if (format.preserveFormat || format.compact || format.concise) {
return; return;
} }
this._indent--; this._indent -= this._indentRepeat;
} }
semicolon(force = false) { semicolon(force = false) {
this._maybeAddAuxComment(); const flags = this._flags;
if (force) { if (flags & 32) {
this._appendChar(59); this._maybeAddAuxComment();
this._noLineTerminator = false;
return;
} }
if (this.tokenMap) { if (flags & 1) {
const node = this._currentNode; const node = this._currentNode;
if (node.start != null && node.end != null) { if (node.start != null && node.end != null) {
if (!this.tokenMap.endMatches(node, ";")) { if (!this.tokenMap.endMatches(node, ";")) {
@@ -129,7 +122,11 @@ class Printer {
this._catchUpTo(this._tokens[indexes[indexes.length - 1]].loc.start); this._catchUpTo(this._tokens[indexes[indexes.length - 1]].loc.start);
} }
} }
this._queue(59); if (force) {
this._appendChar(59);
} else {
this._queue(59);
}
this._noLineTerminator = false; this._noLineTerminator = false;
} }
rightBrace(node) { rightBrace(node) {
@@ -144,15 +141,14 @@ class Printer {
this.tokenChar(41); this.tokenChar(41);
} }
space(force = false) { space(force = false) {
const { if (this._flags & (1 | 2)) {
format return;
} = this; }
if (format.compact || format.preserveFormat) return;
if (force) { if (force) {
this._space(); this._space();
} else if (this._buf.hasContent()) { } else {
const lastCp = this.getLastChar(); const lastCp = this.getLastChar(true);
if (lastCp !== 32 && lastCp !== 10) { if (lastCp !== 0 && lastCp !== 32 && lastCp !== 10) {
this._space(); this._space();
} }
} }
@@ -160,13 +156,17 @@ class Printer {
word(str, noLineTerminatorAfter = false) { word(str, noLineTerminatorAfter = false) {
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask; this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
this._maybePrintInnerComments(str); this._maybePrintInnerComments(str);
this._maybeAddAuxComment(); const flags = this._flags;
if (this.tokenMap) this._catchUpToCurrentToken(str); if (flags & 32) {
if (this._endsWithWord || this._endsWithDiv && str.charCodeAt(0) === 47) { this._maybeAddAuxComment();
}
if (flags & 1) this._catchUpToCurrentToken(str);
const lastChar = this.getLastChar();
if (lastChar === -2 || lastChar === -3 || lastChar === 47 && str.charCodeAt(0) === 47) {
this._space(); this._space();
} }
this._append(str, false); this._append(str, false);
this._endsWithWord = true; this.setLastChar(-3);
this._noLineTerminator = noLineTerminatorAfter; this._noLineTerminator = noLineTerminatorAfter;
} }
number(str, number) { number(str, number) {
@@ -178,61 +178,68 @@ class Printer {
return false; return false;
} }
this.word(str); this.word(str);
this._endsWithInteger = Number.isInteger(number) && !isNonDecimalLiteral(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46; if (Number.isInteger(number) && !isNonDecimalLiteral(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46) {
this.setLastChar(-2);
}
} }
token(str, maybeNewline = false, occurrenceCount = 0) { token(str, maybeNewline = false, occurrenceCount = 0, mayNeedSpace = false) {
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask; this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
this._maybePrintInnerComments(str, occurrenceCount); this._maybePrintInnerComments(str, occurrenceCount);
this._maybeAddAuxComment(); const flags = this._flags;
if (this.tokenMap) this._catchUpToCurrentToken(str, occurrenceCount); if (flags & 32) {
const lastChar = this.getLastChar(); this._maybeAddAuxComment();
const strFirst = str.charCodeAt(0); }
if (lastChar === 33 && (str === "--" || strFirst === 61) || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) { if (flags & 1) {
this._space(); 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._append(str, maybeNewline); this._append(str, maybeNewline);
this._noLineTerminator = false; this._noLineTerminator = false;
} }
tokenChar(char) { tokenChar(char, occurrenceCount = 0) {
this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask; this.tokenContext &= _index.TokenContext.forInOrInitHeadAccumulatePassThroughMask;
const str = String.fromCharCode(char); this._maybePrintInnerComments(char, occurrenceCount);
this._maybePrintInnerComments(str); const flags = this._flags;
this._maybeAddAuxComment(); if (flags & 32) {
if (this.tokenMap) this._catchUpToCurrentToken(str); this._maybeAddAuxComment();
const lastChar = this.getLastChar(); }
if (char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || char === 46 && this._endsWithInteger) { if (flags & 1) {
this._catchUpToCurrentToken(char, occurrenceCount);
}
if (char === 43 && this.getLastChar() === 43 || char === 45 && this.getLastChar() === 45 || char === 46 && this.getLastChar() === -2) {
this._space(); this._space();
} }
this._appendChar(char); this._appendChar(char);
this._noLineTerminator = false; this._noLineTerminator = false;
} }
newline(i = 1, force) { newline(i = 1, flags = this._flags) {
if (i <= 0) return; if (i <= 0) return;
if (!force) { if (flags & (8 | 2)) {
if (this.format.retainLines || this.format.compact) return; return;
if (this.format.concise) { }
this.space(); if (flags & 4) {
return; this.space();
} return;
} }
if (i > 2) i = 2; if (i > 2) i = 2;
i -= this._buf.getNewlineCount(); i -= this._buf.getNewlineCount();
for (let j = 0; j < i; j++) { for (let j = 0; j < i; j++) {
this._newline(); this._newline();
} }
return;
} }
endsWith(char) { endsWith(char) {
return this.getLastChar() === char; return this.getLastChar(true) === char;
} }
getLastChar() { getLastChar(checkQueue) {
return this._buf.getLastChar(); return this._buf.getLastChar(checkQueue);
} }
endsWithCharAndNewline() { setLastChar(char) {
return this._buf.endsWithCharAndNewline(); this._buf._last = char;
}
removeTrailingNewline() {
this._buf.removeTrailingNewline();
} }
exactSource(loc, cb) { exactSource(loc, cb) {
if (!loc) { if (!loc) {
@@ -262,49 +269,40 @@ class Printer {
this._queue(32); this._queue(32);
} }
_newline() { _newline() {
this._queue(10); if (this._buf._queuedChar === 32) this._buf._queuedChar = 0;
this._appendChar(10, true);
} }
_catchUpToCurrentToken(str, occurrenceCount = 0) { _catchUpToCurrentToken(str, occurrenceCount = 0) {
const token = this.tokenMap.findMatching(this._currentNode, str, occurrenceCount); const token = this.tokenMap.findMatching(this._currentNode, str, occurrenceCount);
if (token) this._catchUpTo(token.loc.start); if (token) this._catchUpTo(token.loc.start);
if (this._printSemicolonBeforeNextToken !== -1 && this._printSemicolonBeforeNextToken === this._buf.getCurrentLine()) { if (this._printSemicolonBeforeNextToken !== -1 && this._printSemicolonBeforeNextToken === this._buf.getCurrentLine()) {
this._buf.appendChar(59); this._appendChar(59, true);
this._endsWithWord = false;
this._endsWithInteger = false;
this._endsWithDiv = false;
} }
this._printSemicolonBeforeNextToken = -1; this._printSemicolonBeforeNextToken = -1;
this._printSemicolonBeforeNextNode = -1; this._printSemicolonBeforeNextNode = -1;
} }
_append(str, maybeNewline) { _append(str, maybeNewline) {
this._maybeIndent(str.charCodeAt(0)); this._maybeIndent();
this._buf.append(str, maybeNewline); this._buf.append(str, maybeNewline);
this._endsWithWord = false;
this._endsWithInteger = false;
this._endsWithDiv = false;
} }
_appendChar(char) { _appendChar(char, noIndent) {
this._maybeIndent(char); if (!noIndent) {
this._maybeIndent();
}
this._buf.appendChar(char); this._buf.appendChar(char);
this._endsWithWord = false;
this._endsWithInteger = false;
this._endsWithDiv = false;
} }
_queue(char) { _queue(char) {
this._maybeIndent(char);
this._buf.queue(char); this._buf.queue(char);
this._endsWithWord = false; this.setLastChar(-1);
this._endsWithInteger = false;
} }
_maybeIndent(firstChar) { _maybeIndent() {
if (this._indent && firstChar !== 10 && this.endsWith(10)) { const indent = this._shouldIndent();
this._buf.queueIndentation(this._getIndent()); if (indent > 0) {
this._buf._appendChar(-1, indent, false);
} }
} }
_shouldIndent(firstChar) { _shouldIndent() {
if (this._indent && firstChar !== 10 && this.endsWith(10)) { return this.endsWith(10) ? this._indent : 0;
return true;
}
} }
catchUp(line) { catchUp(line) {
if (!this.format.retainLines) return; if (!this.format.retainLines) return;
@@ -314,11 +312,9 @@ class Printer {
} }
} }
_catchUp(prop, loc) { _catchUp(prop, loc) {
const { const flags = this._flags;
format if ((flags & 1) === 0) {
} = this; if (flags & 8 && loc != null && loc[prop]) {
if (!format.preserveFormat) {
if (format.retainLines && loc != null && loc[prop]) {
this.catchUp(loc[prop].line); this.catchUp(loc[prop].line);
} }
return; return;
@@ -342,64 +338,80 @@ class Printer {
if (spacesCount > 0) { 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); 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._append(spaces, false); this._append(spaces, false);
this.setLastChar(32);
} }
} }
_getIndent() {
return this._indentRepeat * this._indent;
}
printTerminatorless(node) { printTerminatorless(node) {
this._noLineTerminator = true; this._noLineTerminator = true;
this.print(node); this.print(node);
} }
print(node, noLineTerminatorAfter = false, trailingCommentsLineOffset) { print(node, noLineTerminatorAfter = false, resetTokenContext = false, trailingCommentsLineOffset) {
var _node$extra, _node$leadingComments, _node$leadingComments2; var _node$leadingComments, _node$leadingComments2;
if (!node) return; if (!node) return;
this._endsWithInnerRaw = false; this._innerCommentsState = 0;
const nodeType = node.type; const {
const format = this.format; type,
const oldConcise = format.concise; loc,
extra
} = node;
const flags = this._flags;
let changedFlags = false;
if (node._compact) { if (node._compact) {
format.concise = true; this._flags |= 4;
changedFlags = true;
} }
const printMethod = this[nodeType]; const nodeInfo = _nodes.generatorInfosMap.get(type);
if (printMethod === undefined) { if (nodeInfo === undefined) {
throw new ReferenceError(`unknown node of type ${JSON.stringify(nodeType)} with constructor ${JSON.stringify(node.constructor.name)}`); throw new ReferenceError(`unknown node of type ${JSON.stringify(type)} with constructor ${JSON.stringify(node.constructor.name)}`);
} }
const [printMethod, nodeId, needsParens] = nodeInfo;
const parent = this._currentNode; const parent = this._currentNode;
const parentId = this._currentTypeId;
this._currentNode = node; this._currentNode = node;
if (this.tokenMap) { this._currentTypeId = nodeId;
if (flags & 1) {
this._printSemicolonBeforeNextToken = this._printSemicolonBeforeNextNode; this._printSemicolonBeforeNextToken = this._printSemicolonBeforeNextNode;
} }
const oldInAux = this._insideAux; let oldInAux;
this._insideAux = node.loc == null; if (flags & 32) {
this._maybeAddAuxComment(this._insideAux && !oldInAux); oldInAux = this._insideAux;
const parenthesized = (_node$extra = node.extra) == null ? void 0 : _node$extra.parenthesized; this._insideAux = loc == null;
let shouldPrintParens = parenthesized && format.preserveFormat || parenthesized && format.retainFunctionParens && nodeType === "FunctionExpression" || needsParens(node, parent, this.tokenContext, format.preserveFormat ? this._boundGetRawIdentifier : undefined); 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));
if (!shouldPrintParens && parenthesized && (_node$leadingComments = node.leadingComments) != null && _node$leadingComments.length && node.leadingComments[0].type === "CommentBlock") { if (!shouldPrintParens && parenthesized && (_node$leadingComments = node.leadingComments) != null && _node$leadingComments.length && node.leadingComments[0].type === "CommentBlock") {
const parentType = parent == null ? void 0 : parent.type; switch (parentId) {
switch (parentType) { case 65:
case "ExpressionStatement": case 243:
case "VariableDeclarator": case 6:
case "AssignmentExpression": case 143:
case "ReturnStatement":
break; break;
case "CallExpression": case 17:
case "OptionalCallExpression": case 130:
case "NewExpression": case 112:
if (parent.callee !== node) break; if (parent.callee !== node) break;
default: default:
shouldPrintParens = true; shouldPrintParens = true;
} }
} }
let indentParenthesized = false; let indentParenthesized = false;
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())) { if (!shouldPrintParens && this._noLineTerminator && ((_node$leadingComments2 = node.leadingComments) != null && _node$leadingComments2.some(commentIsNewline) || flags & 8 && loc && loc.start.line > this._buf.getCurrentLine())) {
shouldPrintParens = true; shouldPrintParens = true;
indentParenthesized = true; indentParenthesized = true;
} }
let oldNoLineTerminatorAfterNode; let oldNoLineTerminatorAfterNode;
let oldTokenContext;
if (!shouldPrintParens) { if (!shouldPrintParens) {
noLineTerminatorAfter || (noLineTerminatorAfter = !!parent && this._noLineTerminatorAfterNode === parent && n.isLastChild(parent, node)); noLineTerminatorAfter || (noLineTerminatorAfter = !!parent && this._noLineTerminatorAfterNode === parent && (0, _index.isLastChild)(parent, node));
if (noLineTerminatorAfter) { if (noLineTerminatorAfter) {
var _node$trailingComment; var _node$trailingComment;
if ((_node$trailingComment = node.trailingComments) != null && _node$trailingComment.some(commentIsNewline)) { if ((_node$trailingComment = node.trailingComments) != null && _node$trailingComment.some(commentIsNewline)) {
@@ -413,18 +425,18 @@ class Printer {
if (shouldPrintParens) { if (shouldPrintParens) {
this.tokenChar(40); this.tokenChar(40);
if (indentParenthesized) this.indent(); if (indentParenthesized) this.indent();
this._endsWithInnerRaw = false; this._innerCommentsState = 0;
if (this.tokenContext & _index.TokenContext.forInOrInitHeadAccumulate) { if (!resetTokenContext) {
oldTokenContext = this.tokenContext; oldTokenContext = this.tokenContext;
this.tokenContext = _index.TokenContext.normal; }
if (oldTokenContext & _index.TokenContext.forInOrInitHeadAccumulate) {
this.tokenContext = 0;
} }
oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode; oldNoLineTerminatorAfterNode = this._noLineTerminatorAfterNode;
this._noLineTerminatorAfterNode = null; this._noLineTerminatorAfterNode = null;
} }
this._lastCommentLine = 0;
this._printLeadingComments(node, parent); this._printLeadingComments(node, parent);
const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc; this.exactSource(nodeId === 139 || nodeId === 66 ? null : loc, printMethod.bind(this, node, parent));
this.exactSource(loc, printMethod.bind(this, node, parent));
if (shouldPrintParens) { if (shouldPrintParens) {
this._printTrailingComments(node, parent); this._printTrailingComments(node, parent);
if (indentParenthesized) { if (indentParenthesized) {
@@ -433,20 +445,25 @@ class Printer {
} }
this.tokenChar(41); this.tokenChar(41);
this._noLineTerminator = noLineTerminatorAfter; this._noLineTerminator = noLineTerminatorAfter;
if (oldTokenContext) this.tokenContext = oldTokenContext;
} else if (noLineTerminatorAfter && !this._noLineTerminator) { } else if (noLineTerminatorAfter && !this._noLineTerminator) {
this._noLineTerminator = true; this._noLineTerminator = true;
this._printTrailingComments(node, parent); this._printTrailingComments(node, parent);
} else { } else {
this._printTrailingComments(node, parent, trailingCommentsLineOffset); this._printTrailingComments(node, parent, trailingCommentsLineOffset);
} }
if (oldTokenContext) this.tokenContext = oldTokenContext;
this._currentNode = parent; this._currentNode = parent;
format.concise = oldConcise; this._currentTypeId = parentId;
this._insideAux = oldInAux; if (changedFlags) {
if (oldNoLineTerminatorAfterNode !== undefined) { this._flags = flags;
}
if (flags & 32) {
this._insideAux = oldInAux;
}
if (oldNoLineTerminatorAfterNode != null) {
this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode; this._noLineTerminatorAfterNode = oldNoLineTerminatorAfterNode;
} }
this._endsWithInnerRaw = false; this._innerCommentsState = 0;
} }
_maybeAddAuxComment(enteredPositionlessNode) { _maybeAddAuxComment(enteredPositionlessNode) {
if (enteredPositionlessNode) this._printAuxBeforeComment(); if (enteredPositionlessNode) this._printAuxBeforeComment();
@@ -480,46 +497,46 @@ class Printer {
return extra.raw; return extra.raw;
} }
} }
printJoin(nodes, statement, indent, separator, printTrailingSeparator, iterator, trailingCommentsLineOffset) { printJoin(nodes, statement, indent, separator, printTrailingSeparator, resetTokenContext, trailingCommentsLineOffset) {
if (!(nodes != null && nodes.length)) return; if (!(nodes != null && nodes.length)) return;
if (indent == null && this.format.retainLines) { const flags = this._flags;
if (indent == null && flags & 8) {
var _nodes$0$loc; var _nodes$0$loc;
const startLine = (_nodes$0$loc = nodes[0].loc) == null ? void 0 : _nodes$0$loc.start.line; const startLine = (_nodes$0$loc = nodes[0].loc) == null ? void 0 : _nodes$0$loc.start.line;
if (startLine != null && startLine !== this._buf.getCurrentLine()) { if (startLine != null && startLine !== this._buf.getCurrentLine()) {
indent = true; indent = true;
} }
} }
if (indent) this.indent(); if (indent) this.indent(flags);
const newlineOpts = {
nextNodeStartLine: 0
};
const boundSeparator = separator == null ? void 0 : separator.bind(this);
const len = nodes.length; const len = nodes.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
const node = nodes[i]; const node = nodes[i];
if (!node) continue; if (!node) continue;
if (statement) this._printNewline(i === 0, newlineOpts); if (statement && i === 0 && this._buf.hasContent()) {
this.print(node, undefined, trailingCommentsLineOffset || 0); this.newline(1, flags);
iterator == null || iterator(node, i); }
if (boundSeparator != null) { this.print(node, false, resetTokenContext, trailingCommentsLineOffset || 0);
if (i < len - 1) boundSeparator(i, false);else if (printTrailingSeparator) boundSeparator(i, true); if (separator != null) {
if (i < len - 1) separator.call(this, i, false);else if (printTrailingSeparator) separator.call(this, i, true);
} }
if (statement) { if (statement) {
var _node$trailingComment2;
if (!((_node$trailingComment2 = node.trailingComments) != null && _node$trailingComment2.length)) {
this._lastCommentLine = 0;
}
if (i + 1 === len) { if (i + 1 === len) {
this.newline(1); this.newline(1, flags);
} else { } else {
var _nextNode$loc; const lastCommentLine = this._lastCommentLine;
const nextNode = nodes[i + 1]; if (lastCommentLine > 0) {
newlineOpts.nextNodeStartLine = ((_nextNode$loc = nextNode.loc) == null ? void 0 : _nextNode$loc.start.line) || 0; var _nodes$loc;
this._printNewline(true, newlineOpts); 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);
} }
} }
} }
if (indent) this.dedent(); if (indent) this.dedent(flags);
} }
printAndIndentOnComments(node) { printAndIndentOnComments(node) {
const indent = node.leadingComments && node.leadingComments.length > 0; const indent = node.leadingComments && node.leadingComments.length > 0;
@@ -527,12 +544,11 @@ class Printer {
this.print(node); this.print(node);
if (indent) this.dedent(); if (indent) this.dedent();
} }
printBlock(parent) { printBlock(body) {
const node = parent.body; if (body.type !== "EmptyStatement") {
if (node.type !== "EmptyStatement") {
this.space(); this.space();
} }
this.print(node); this.print(body);
} }
_printTrailingComments(node, parent, lineOffset) { _printTrailingComments(node, parent, lineOffset) {
const { const {
@@ -544,6 +560,8 @@ class Printer {
} }
if (trailingComments != null && trailingComments.length) { if (trailingComments != null && trailingComments.length) {
this._printComments(2, trailingComments, node, parent, lineOffset); this._printComments(2, trailingComments, node, parent, lineOffset);
} else {
this._lastCommentLine = 0;
} }
} }
_printLeadingComments(node, parent) { _printLeadingComments(node, parent) {
@@ -552,65 +570,48 @@ class Printer {
this._printComments(0, comments, node, parent); this._printComments(0, comments, node, parent);
} }
_maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) { _maybePrintInnerComments(nextTokenStr, nextTokenOccurrenceCount) {
if (this._endsWithInnerRaw) { var _this$tokenMap;
var _this$tokenMap; const state = this._innerCommentsState;
this.printInnerComments((_this$tokenMap = this.tokenMap) == null ? void 0 : _this$tokenMap.findMatching(this._currentNode, nextTokenStr, nextTokenOccurrenceCount)); 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));
} }
this._endsWithInnerRaw = true;
this._indentInnerComments = true;
} }
printInnerComments(nextToken) { printInnerComments(indent = true, nextToken) {
const node = this._currentNode; const node = this._currentNode;
const comments = node.innerComments; const comments = node.innerComments;
if (!(comments != null && comments.length)) return; if (!(comments != null && comments.length)) {
this._innerCommentsState = 2;
return;
}
const hasSpace = this.endsWith(32); const hasSpace = this.endsWith(32);
const indent = this._indentInnerComments;
const printedCommentsCount = this._printedComments.size;
if (indent) this.indent(); if (indent) this.indent();
this._printComments(1, comments, node, undefined, undefined, nextToken); switch (this._printComments(1, comments, node, undefined, undefined, nextToken)) {
if (hasSpace && printedCommentsCount !== this._printedComments.size) { case 2:
this.space(); this._innerCommentsState = 2;
case 1:
if (hasSpace) this.space();
} }
if (indent) this.dedent(); if (indent) this.dedent();
} }
noIndentInnerCommentsHere() { noIndentInnerCommentsHere() {
this._indentInnerComments = false; this._innerCommentsState &= ~4;
} }
printSequence(nodes, indent, trailingCommentsLineOffset) { printSequence(nodes, indent, resetTokenContext, trailingCommentsLineOffset) {
this.printJoin(nodes, true, indent != null ? indent : false, undefined, undefined, undefined, trailingCommentsLineOffset); this.printJoin(nodes, true, indent != null ? indent : false, undefined, undefined, resetTokenContext, trailingCommentsLineOffset);
} }
printList(items, printTrailingSeparator, statement, indent, separator, iterator) { printList(items, printTrailingSeparator, statement, indent, separator, resetTokenContext) {
this.printJoin(items, statement, indent, separator != null ? separator : commaSeparator, printTrailingSeparator, iterator); this.printJoin(items, statement, indent, separator != null ? separator : commaSeparator, printTrailingSeparator, resetTokenContext);
} }
shouldPrintTrailingComma(listEnd) { shouldPrintTrailingComma(listEnd) {
if (!this.tokenMap) return null; if (!this.tokenMap) return null;
const listEndIndex = this.tokenMap.findLastIndex(this._currentNode, token => this.tokenMap.matchesOriginal(token, listEnd)); const listEndIndex = this.tokenMap.findLastIndex(this._currentNode, token => this.tokenMap.matchesOriginal(token, typeof listEnd === "number" ? String.fromCharCode(listEnd) : listEnd));
if (listEndIndex <= 0) return null; if (listEndIndex <= 0) return null;
return this.tokenMap.matchesOriginal(this._tokens[listEndIndex - 1], ","); 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) { _shouldPrintComment(comment, nextToken) {
if (comment.ignore) return 0; if (comment.ignore) return 0;
if (this._printedComments.has(comment)) return 0; if (this._printedComments.has(comment)) return 0;
@@ -632,13 +633,19 @@ class Printer {
_printComment(comment, skipNewLines) { _printComment(comment, skipNewLines) {
const noLineTerminator = this._noLineTerminator; const noLineTerminator = this._noLineTerminator;
const isBlockComment = comment.type === "CommentBlock"; const isBlockComment = comment.type === "CommentBlock";
const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator; const printNewLines = isBlockComment && skipNewLines !== 1 && !noLineTerminator;
if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) { if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) {
this.newline(1); this.newline(1);
} }
const lastCharCode = this.getLastChar(); switch (this.getLastChar(true)) {
if (lastCharCode !== 91 && lastCharCode !== 123 && lastCharCode !== 40) { case 47:
this.space(); this._space();
case 91:
case 123:
case 40:
break;
default:
this.space();
} }
let val; let val;
if (isBlockComment) { if (isBlockComment) {
@@ -650,12 +657,12 @@ class Printer {
const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
val = val.replace(newlineRegex, "\n"); val = val.replace(newlineRegex, "\n");
} }
if (this.format.concise) { if (this._flags & 4) {
val = val.replace(/\n(?!$)/g, `\n`); val = val.replace(/\n(?!$)/g, `\n`);
} else { } else {
let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn(); let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn();
if (this._shouldIndent(47) || this.format.retainLines) { if (this._shouldIndent() || this.format.retainLines) {
indentSize += this._getIndent(); indentSize += this._indent;
} }
val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`); val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`);
} }
@@ -665,24 +672,10 @@ class Printer {
} else { } else {
val = `/*${comment.value}*/`; val = `/*${comment.value}*/`;
} }
if (this._endsWithDiv) this._space(); this.source("start", comment.loc);
if (this.tokenMap) { this._append(val, isBlockComment);
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) { if (!isBlockComment && !noLineTerminator) {
this.newline(1, true); this._newline();
} }
if (printNewLines && skipNewLines !== 3) { if (printNewLines && skipNewLines !== 3) {
this.newline(1); this.newline(1);
@@ -696,13 +689,15 @@ class Printer {
const nodeEndLine = hasLoc ? nodeLoc.end.line : 0; const nodeEndLine = hasLoc ? nodeLoc.end.line : 0;
let lastLine = 0; let lastLine = 0;
let leadingCommentNewline = 0; let leadingCommentNewline = 0;
const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this); const {
_noLineTerminator,
_flags
} = this;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; i++) {
const comment = comments[i]; const comment = comments[i];
const shouldPrint = this._shouldPrintComment(comment, nextToken); const shouldPrint = this._shouldPrintComment(comment, nextToken);
if (shouldPrint === 2) { if (shouldPrint === 2) {
hasLoc = false; return i === 0 ? 0 : 1;
break;
} }
if (hasLoc && comment.loc && shouldPrint === 1) { if (hasLoc && comment.loc && shouldPrint === 1) {
const commentStartLine = comment.loc.start.line; const commentStartLine = comment.loc.start.line;
@@ -717,25 +712,37 @@ class Printer {
offset = commentStartLine - lastLine; offset = commentStartLine - lastLine;
} }
lastLine = commentEndLine; lastLine = commentEndLine;
maybeNewline(offset); if (offset > 0 && !_noLineTerminator) {
this.newline(offset, _flags);
}
this._printComment(comment, 1); this._printComment(comment, 1);
if (i + 1 === len) { if (i + 1 === len) {
maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline)); const count = Math.max(nodeStartLine - lastLine, leadingCommentNewline);
if (count > 0 && !_noLineTerminator) {
this.newline(count, _flags);
}
lastLine = nodeStartLine; lastLine = nodeStartLine;
} }
} else if (type === 1) { } else if (type === 1) {
const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine); const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine);
lastLine = commentEndLine; lastLine = commentEndLine;
maybeNewline(offset); if (offset > 0 && !_noLineTerminator) {
this.newline(offset, _flags);
}
this._printComment(comment, 1); this._printComment(comment, 1);
if (i + 1 === len) { if (i + 1 === len) {
maybeNewline(Math.min(1, nodeEndLine - lastLine)); const count = Math.min(1, nodeEndLine - lastLine);
if (count > 0 && !_noLineTerminator) {
this.newline(count, _flags);
}
lastLine = nodeEndLine; lastLine = nodeEndLine;
} }
} else { } else {
const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine); const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine);
lastLine = commentEndLine; lastLine = commentEndLine;
maybeNewline(offset); if (offset > 0 && !_noLineTerminator) {
this.newline(offset, _flags);
}
this._printComment(comment, 1); this._printComment(comment, 1);
} }
} else { } else {
@@ -747,9 +754,7 @@ class Printer {
const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value); 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); const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent) && !isTSEnumMember(node);
if (type === 0) { if (type === 0) {
this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, { this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent) && parent.body === node ? 1 : 0);
body: node
}) ? 1 : 0);
} else if (shouldSkipNewline && type === 2) { } else if (shouldSkipNewline && type === 2) {
this._printComment(comment, 1); this._printComment(comment, 1);
} else { } else {
@@ -765,13 +770,12 @@ class Printer {
if (type === 2 && hasLoc && lastLine) { if (type === 2 && hasLoc && lastLine) {
this._lastCommentLine = lastLine; this._lastCommentLine = lastLine;
} }
return 2;
} }
} }
Object.assign(Printer.prototype, generatorFunctions);
(0, _deprecated.addDeprecatedGenerators)(Printer);
var _default = exports.default = Printer; var _default = exports.default = Printer;
function commaSeparator(occurrenceCount, last) { function commaSeparator(occurrenceCount, last) {
this.token(",", false, occurrenceCount); this.tokenChar(44, occurrenceCount);
if (!last) this.space(); if (!last) this.space();
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -55,6 +55,9 @@ class TokenMap {
findMatching(node, test, occurrenceCount = 0) { findMatching(node, test, occurrenceCount = 0) {
const indexes = this._nodesToTokenIndexes.get(node); const indexes = this._nodesToTokenIndexes.get(node);
if (indexes) { if (indexes) {
if (typeof test === "number") {
test = String.fromCharCode(test);
}
let i = 0; let i = 0;
const count = occurrenceCount; const count = occurrenceCount;
if (count > 1) { if (count > 1) {

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/generator", "name": "@babel/generator",
"version": "7.28.6", "version": "7.29.1",
"description": "Turns an AST into code.", "description": "Turns an AST into code.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
@@ -19,14 +19,14 @@
"lib" "lib"
], ],
"dependencies": { "dependencies": {
"@babel/parser": "^7.28.6", "@babel/parser": "^7.29.0",
"@babel/types": "^7.28.6", "@babel/types": "^7.29.0",
"@jridgewell/gen-mapping": "^0.3.12", "@jridgewell/gen-mapping": "^0.3.12",
"@jridgewell/trace-mapping": "^0.3.28", "@jridgewell/trace-mapping": "^0.3.28",
"jsesc": "^3.0.2" "jsesc": "^3.0.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/helper-fixtures": "^7.28.6", "@babel/helper-fixtures": "^7.28.6",
"@babel/plugin-transform-typescript": "^7.28.6", "@babel/plugin-transform-typescript": "^7.28.6",
"@jridgewell/sourcemap-codec": "^1.5.3", "@jridgewell/sourcemap-codec": "^1.5.3",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/helper-define-polyfill-provider", "name": "@babel/helper-define-polyfill-provider",
"version": "0.6.5", "version": "0.6.6",
"description": "Babel helper to create your own polyfill provider", "description": "Babel helper to create your own polyfill provider",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -33,21 +33,21 @@
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"dependencies": { "dependencies": {
"@babel/helper-compilation-targets": "^7.27.2", "@babel/helper-compilation-targets": "^7.28.6",
"@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-plugin-utils": "^7.28.6",
"debug": "^4.4.1", "debug": "^4.4.3",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
"resolve": "^1.22.10" "resolve": "^1.22.11"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.27.2", "@babel/cli": "^7.28.6",
"@babel/core": "^7.27.7", "@babel/core": "^7.28.6",
"@babel/generator": "^7.27.5", "@babel/generator": "^7.28.6",
"@babel/plugin-transform-modules-commonjs": "^7.27.1", "@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/traverse": "^7.27.7", "@babel/traverse": "^7.28.6",
"babel-loader": "^8.4.1", "babel-loader": "^8.4.1",
"rollup": "^2.79.2", "rollup": "^2.79.2",
"rollup-plugin-babel": "^4.4.0", "rollup-plugin-babel": "^4.4.0",
@@ -55,5 +55,5 @@
"webpack": "^4.47.0", "webpack": "^4.47.0",
"webpack-cli": "^3.3.12" "webpack-cli": "^3.3.12"
}, },
"gitHead": "fddd6fc6e7c3c41b1234d82e53faf5de832bbf2b" "gitHead": "9b040e303af7d703a57f16d46538d1b0d5462237"
} }

View File

@@ -9246,7 +9246,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
return this.finishCallExpression(node, state.optionalChainMember); return this.finishCallExpression(node, state.optionalChainMember);
} }
const tokenType = this.state.type; const tokenType = this.state.type;
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) { if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenType !== 93 && tokenType !== 120 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak()) {
return; return;
} }
const node = this.startNodeAt(startLoc); const node = this.startNodeAt(startLoc);
@@ -9721,8 +9721,18 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass {
} }
parseClassSuper(node) { parseClassSuper(node) {
super.parseClassSuper(node); super.parseClassSuper(node);
if (node.superClass && (this.match(47) || this.match(51))) { if (node.superClass) {
node.superTypeParameters = this.tsParseTypeArgumentsInExpression(); 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)) {
node.superTypeParameters = this.tsParseTypeArgumentsInExpression();
}
} }
if (this.eatContextual(113)) { if (this.eatContextual(113)) {
node.implements = this.tsParseHeritageClause("implements"); node.implements = this.tsParseHeritageClause("implements");

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/parser", "name": "@babel/parser",
"version": "7.28.6", "version": "7.29.0",
"description": "A JavaScript parser", "description": "A JavaScript parser",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-parser", "homepage": "https://babel.dev/docs/en/next/babel-parser",
@@ -35,10 +35,10 @@
}, },
"# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.", "# dependencies": "This package doesn't actually have runtime dependencies. @babel/types is only needed for type definitions.",
"dependencies": { "dependencies": {
"@babel/types": "^7.28.6" "@babel/types": "^7.29.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/code-frame": "^7.28.6", "@babel/code-frame": "^7.29.0",
"@babel/helper-check-duplicate-nodes": "^7.28.6", "@babel/helper-check-duplicate-nodes": "^7.28.6",
"@babel/helper-fixtures": "^7.28.6", "@babel/helper-fixtures": "^7.28.6",
"@babel/helper-string-parser": "^7.27.1", "@babel/helper-string-parser": "^7.27.1",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-proposal-decorators", "name": "@babel/plugin-proposal-decorators",
"version": "7.28.6", "version": "7.29.0",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"license": "MIT", "license": "MIT",
"publishConfig": { "publishConfig": {
@@ -28,11 +28,11 @@
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/traverse": "^7.28.6", "@babel/traverse": "^7.29.0",
"array.prototype.concat": "^1.0.2", "array.prototype.concat": "^1.0.2",
"babel-plugin-polyfill-es-shims": "^0.10.8", "babel-plugin-polyfill-es-shims": "^0.10.9",
"object.getownpropertydescriptors": "^2.1.1" "object.getownpropertydescriptors": "^2.1.1"
}, },
"engines": { "engines": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-transform-async-generator-functions", "name": "@babel/plugin-transform-async-generator-functions",
"version": "7.28.6", "version": "7.29.0",
"description": "Turn async generator functions into ES2015 generators", "description": "Turn async generator functions into ES2015 generators",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -19,16 +19,16 @@
"dependencies": { "dependencies": {
"@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6",
"@babel/helper-remap-async-to-generator": "^7.27.1", "@babel/helper-remap-async-to-generator": "^7.27.1",
"@babel/traverse": "^7.28.6" "@babel/traverse": "^7.29.0"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"babel-plugin-polyfill-corejs3": "^0.13.0", "babel-plugin-polyfill-corejs3": "^0.14.0",
"core-js-pure": "^3.43.0" "core-js-pure": "^3.48.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-transform-duplicate-named-capturing-groups-regex", "name": "@babel/plugin-transform-duplicate-named-capturing-groups-regex",
"version": "7.28.6", "version": "7.29.0",
"description": "Compile regular expressions using duplicate named groups to index-based groups.", "description": "Compile regular expressions using duplicate named groups to index-based groups.",
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-duplicate-named-capturing-groups-regex", "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-duplicate-named-capturing-groups-regex",
"license": "MIT", "license": "MIT",
@@ -28,9 +28,9 @@
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"core-js": "^3.30.2" "core-js": "^3.48.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

View File

@@ -136,9 +136,7 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
if (path.isCallExpression() && !_core.types.isImport(path.node.callee)) return; if (path.isCallExpression() && !_core.types.isImport(path.node.callee)) return;
if (path.isCallExpression()) { if (path.isCallExpression()) {
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) { if (!this.file.has("@babel/plugin-proposal-dynamic-import")) {
{ console.warn(MISSING_PLUGIN_WARNING);
console.warn(MISSING_PLUGIN_WARNING);
}
} }
} else { } else {
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) { if (!this.file.has("@babel/plugin-proposal-dynamic-import")) {
@@ -166,6 +164,7 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
} }
}, },
exit(path, state) { exit(path, state) {
var _path$scope, _path$scope$hoistVari;
const scope = path.scope; const scope = path.scope;
const exportIdent = scope.generateUid("export"); const exportIdent = scope.generateUid("export");
const { const {
@@ -348,10 +347,7 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
}); });
let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options); let moduleName = (0, _helperModuleTransforms.getModuleName)(this.file.opts, options);
if (moduleName) moduleName = _core.types.stringLiteral(moduleName); if (moduleName) moduleName = _core.types.stringLiteral(moduleName);
{ (_path$scope$hoistVari = (_path$scope = path.scope).hoistVariables) != null ? _path$scope$hoistVari : _path$scope.hoistVariables = require("@babel/traverse").Scope.prototype.hoistVariables;
var _path$scope, _path$scope$hoistVari;
(_path$scope$hoistVari = (_path$scope = path.scope).hoistVariables) != null ? _path$scope$hoistVari : _path$scope.hoistVariables = require("@babel/traverse").Scope.prototype.hoistVariables;
}
path.scope.hoistVariables((id, hasInit) => { path.scope.hoistVariables((id, hasInit) => {
variableIds.push(id); variableIds.push(id);
if (!hasInit && id.name in exportMap) { if (!hasInit && id.name in exportMap) {
@@ -376,18 +372,16 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
path.remove(); path.remove();
} }
let hasTLA = false; let hasTLA = false;
{ path.traverse({
path.traverse({ AwaitExpression(path) {
AwaitExpression(path) { hasTLA = true;
hasTLA = true; path.stop();
path.stop(); },
}, Function(path) {
Function(path) { path.skip();
path.skip(); },
}, noScope: true
noScope: true });
});
}
path.node.body = [buildTemplate({ path.node.body = [buildTemplate({
SYSTEM_REGISTER: _core.types.memberExpression(_core.types.identifier(systemGlobal), _core.types.identifier("register")), SYSTEM_REGISTER: _core.types.memberExpression(_core.types.identifier(systemGlobal), _core.types.identifier("register")),
BEFORE_BODY: beforeBody, BEFORE_BODY: beforeBody,

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-transform-modules-systemjs", "name": "@babel/plugin-transform-modules-systemjs",
"version": "7.28.5", "version": "7.29.0",
"description": "This plugin transforms ES2015 modules to SystemJS", "description": "This plugin transforms ES2015 modules to SystemJS",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -13,10 +13,10 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/helper-module-transforms": "^7.28.3", "@babel/helper-module-transforms": "^7.28.6",
"@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-plugin-utils": "^7.28.6",
"@babel/helper-validator-identifier": "^7.28.5", "@babel/helper-validator-identifier": "^7.28.5",
"@babel/traverse": "^7.28.5" "@babel/traverse": "^7.29.0"
}, },
"keywords": [ "keywords": [
"babel-plugin" "babel-plugin"
@@ -25,10 +25,10 @@
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.5", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/helper-transform-fixture-test-runner": "^7.28.5", "@babel/helper-transform-fixture-test-runner": "^7.28.6",
"core-js": "^3.35.0" "core-js": "^3.48.0"
}, },
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-modules-systemjs", "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-modules-systemjs",
"engines": { "engines": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-transform-named-capturing-groups-regex", "name": "@babel/plugin-transform-named-capturing-groups-regex",
"version": "7.27.1", "version": "7.29.0",
"description": "Compile regular expressions using named groups to ES5.", "description": "Compile regular expressions using named groups to ES5.",
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-named-capturing-groups-regex", "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-named-capturing-groups-regex",
"license": "MIT", "license": "MIT",
@@ -21,16 +21,16 @@
}, },
"bugs": "https://github.com/babel/babel/issues", "bugs": "https://github.com/babel/babel/issues",
"dependencies": { "dependencies": {
"@babel/helper-create-regexp-features-plugin": "^7.27.1", "@babel/helper-create-regexp-features-plugin": "^7.28.5",
"@babel/helper-plugin-utils": "^7.27.1" "@babel/helper-plugin-utils": "^7.28.6"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0" "@babel/core": "^7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.27.1", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"core-js": "^3.30.2" "core-js": "^3.48.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

View File

@@ -2,7 +2,7 @@
"name": "@babel/plugin-transform-regenerator", "name": "@babel/plugin-transform-regenerator",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"description": "Explode async and generator functions into a state machine.", "description": "Explode async and generator functions into a state machine.",
"version": "7.28.6", "version": "7.29.0",
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-regenerator", "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-regenerator",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -21,7 +21,7 @@
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/helper-check-duplicate-nodes": "^7.28.6", "@babel/helper-check-duplicate-nodes": "^7.28.6",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/plugin-proposal-function-sent": "^7.27.1", "@babel/plugin-proposal-function-sent": "^7.27.1",
@@ -31,8 +31,8 @@
"@babel/plugin-transform-for-of": "^7.27.1", "@babel/plugin-transform-for-of": "^7.27.1",
"@babel/plugin-transform-modules-commonjs": "^7.28.6", "@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/plugin-transform-parameters": "^7.27.7", "@babel/plugin-transform-parameters": "^7.27.7",
"@babel/plugin-transform-runtime": "^7.28.5", "@babel/plugin-transform-runtime": "^7.29.0",
"babel-plugin-polyfill-regenerator": "^0.6.5", "babel-plugin-polyfill-regenerator": "^0.6.6",
"mocha": "^10.0.0", "mocha": "^10.0.0",
"recast": "^0.23.3", "recast": "^0.23.3",
"uglify-js": "^3.14.0" "uglify-js": "^3.14.0"

View File

@@ -1,4 +1,3 @@
;
const pluginCorejs2 = require("babel-plugin-polyfill-corejs2").default; const pluginCorejs2 = require("babel-plugin-polyfill-corejs2").default;
const pluginCorejs3 = require("babel-plugin-polyfill-corejs3").default; const pluginCorejs3 = require("babel-plugin-polyfill-corejs3").default;
const pluginRegenerator = require("babel-plugin-polyfill-regenerator").default; const pluginRegenerator = require("babel-plugin-polyfill-regenerator").default;

File diff suppressed because one or more lines are too long

View File

@@ -26,14 +26,12 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options,
if (moduleName !== null && typeof moduleName !== "string") { if (moduleName !== null && typeof moduleName !== "string") {
throw new Error("The 'moduleName' option must be null or a string."); throw new Error("The 'moduleName' option must be null or a string.");
} }
{ var supportsCJSDefault;
var supportsCJSDefault; if (!runtimeVersion) {
if (!runtimeVersion) { supportsCJSDefault = true;
supportsCJSDefault = true; } else {
} else { const normalizedRuntimeVersion = _semver.valid(runtimeVersion) ? `^${runtimeVersion}` : runtimeVersion;
const normalizedRuntimeVersion = _semver.valid(runtimeVersion) ? `^${runtimeVersion}` : runtimeVersion; supportsCJSDefault = !_semver.intersects(`<7.13.0`, normalizedRuntimeVersion) && !_semver.intersects(`>=8.0.0`, normalizedRuntimeVersion);
supportsCJSDefault = !_semver.intersects(`<7.13.0`, normalizedRuntimeVersion) && !_semver.intersects(`>=8.0.0`, normalizedRuntimeVersion);
}
} }
if (hasOwnProperty.call(options, "useBuiltIns")) { if (hasOwnProperty.call(options, "useBuiltIns")) {
if (options.useBuiltIns) { if (options.useBuiltIns) {
@@ -49,23 +47,18 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options,
throw new Error("The 'polyfill' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime."); throw new Error("The 'polyfill' option has been removed. Use the 'corejs'" + "option to polyfill with `core-js` via @babel/runtime.");
} }
} }
; const {
{ useESModules = false
const { } = options;
useESModules = false if (typeof useESModules !== "boolean" && useESModules !== "auto") {
} = options; throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.");
if (typeof useESModules !== "boolean" && useESModules !== "auto") {
throw new Error("The 'useESModules' option must be undefined, or a boolean, or 'auto'.");
}
var esModules = useESModules === "auto" ? api.caller(caller => !!(caller != null && caller.supportsStaticESM)) : useESModules;
} }
{ var esModules = useESModules === "auto" ? api.caller(caller => !!(caller != null && caller.supportsStaticESM)) : useESModules;
var { var {
helpers: useRuntimeHelpers = true helpers: useRuntimeHelpers = true
} = options; } = options;
if (typeof useRuntimeHelpers !== "boolean") { if (typeof useRuntimeHelpers !== "boolean") {
throw new Error("The 'helpers' option must be undefined, or a boolean."); throw new Error("The 'helpers' option must be undefined, or a boolean.");
}
} }
const HEADER_HELPERS = new Set(["interopRequireWildcard", "interopRequireDefault"]); const HEADER_HELPERS = new Set(["interopRequireWildcard", "interopRequireDefault"]);
return { return {
@@ -77,16 +70,14 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options,
file.set("helperGenerator", name => { file.set("helperGenerator", name => {
var _ref; var _ref;
modulePath != null ? modulePath : modulePath = (0, _index.default)((_ref = moduleName != null ? moduleName : file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime", dirname, absoluteRuntime); modulePath != null ? modulePath : modulePath = (0, _index.default)((_ref = moduleName != null ? moduleName : file.get("runtimeHelpersModuleName")) != null ? _ref : "@babel/runtime", dirname, absoluteRuntime);
{ if (!(file.availableHelper != null && file.availableHelper(name, runtimeVersion))) {
if (!(file.availableHelper != null && file.availableHelper(name, runtimeVersion))) { if (name === "regeneratorRuntime") {
if (name === "regeneratorRuntime") { return _core.types.arrowFunctionExpression([], _core.types.identifier("regeneratorRuntime"));
return _core.types.arrowFunctionExpression([], _core.types.identifier("regeneratorRuntime"));
}
if (name === "regenerator" || name === "regeneratorKeys" || name === "regeneratorAsync" || name === "regeneratorAsyncGen") {
return _core.types.identifier("__interal_marker_fallback_regenerator__");
}
return;
} }
if (name === "regenerator" || name === "regeneratorKeys" || name === "regeneratorAsync" || name === "regeneratorAsyncGen") {
return _core.types.identifier("__interal_marker_fallback_regenerator__");
}
return;
} }
const blockHoist = HEADER_HELPERS.has(name) && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined; const blockHoist = HEADER_HELPERS.has(name) && !(0, _helperModuleImports.isModule)(file.path) ? 4 : undefined;
let helperPath = `${modulePath}/helpers/${esModules && file.path.node.sourceType === "module" ? "esm/" + name : name}`; let helperPath = `${modulePath}/helpers/${esModules && file.path.node.sourceType === "module" ? "esm/" + name : name}`;

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/plugin-transform-runtime", "name": "@babel/plugin-transform-runtime",
"version": "7.28.5", "version": "7.29.0",
"description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals", "description": "Externalise references to helpers and builtins, automatically polyfilling your code without polluting globals",
"repository": { "repository": {
"type": "git", "type": "git",
@@ -20,8 +20,8 @@
"./src/get-runtime-path/index.ts": "./src/get-runtime-path/browser.ts" "./src/get-runtime-path/index.ts": "./src/get-runtime-path/browser.ts"
}, },
"dependencies": { "dependencies": {
"@babel/helper-module-imports": "^7.27.1", "@babel/helper-module-imports": "^7.28.6",
"@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-plugin-utils": "^7.28.6",
"babel-plugin-polyfill-corejs2": "^0.4.14", "babel-plugin-polyfill-corejs2": "^0.4.14",
"babel-plugin-polyfill-corejs3": "^0.13.0", "babel-plugin-polyfill-corejs3": "^0.13.0",
"babel-plugin-polyfill-regenerator": "^0.6.5", "babel-plugin-polyfill-regenerator": "^0.6.5",
@@ -31,13 +31,13 @@
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.5", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/helpers": "^7.28.4", "@babel/helpers": "^7.28.6",
"@babel/preset-env": "^7.28.5", "@babel/preset-env": "^7.29.0",
"@babel/runtime": "^7.28.4", "@babel/runtime": "^7.28.6",
"@babel/runtime-corejs3": "^7.28.4", "@babel/runtime-corejs3": "^7.29.0",
"babel-plugin-polyfill-corejs3": "^0.13.0", "babel-plugin-polyfill-corejs3": "^0.14.0",
"make-dir": "^2.1.0" "make-dir": "^2.1.0"
}, },
"homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-runtime", "homepage": "https://babel.dev/docs/en/next/babel-plugin-transform-runtime",

View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Nicolò Ribaudo and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,78 @@
# babel-plugin-polyfill-corejs3
## Install
Using npm:
```sh
npm install --save-dev babel-plugin-polyfill-corejs3
```
or using yarn:
```sh
yarn add babel-plugin-polyfill-corejs3 --dev
```
## Usage
Add this plugin to your Babel configuration:
```json
{
"plugins": [["polyfill-corejs3", { "method": "usage-global", "version": "3.48" }]]
}
```
This package supports the `usage-pure`, `usage-global`, and `entry-global` methods.
When `entry-global` is used, it replaces imports to `core-js`.
## Options
See [here](../../docs/usage.md#options) for a list of options supported by every polyfill provider.
### `version`
`string`, defaults to `"3.0"`.
This option only has an effect when used alongside `"method": "usage-global"` or `"method": "usage-pure"`. It is recommended to specify the minor version you are using as `core-js@3.0` may not include polyfills for the latest features. If you are bundling an app, you can provide the version directly from your node modules:
```js
{
plugins: [
["polyfill-corejs3", {
"method": "usage-pure",
// use `core-js/package.json` if you are using `usage-global`
"version": require("core-js-pure/package.json").version
}]
]
}
```
If you are a library author, specify a reasonably modern `core-js` version in your
`package.json` and provide the plugin the minimal supported version.
```json
{
"dependencies": {
"core-js": "^3.48.0"
}
}
```
```js
{
plugins: [
["polyfill-corejs3", {
"method": "usage-global",
// improvise if you have more complicated version spec, e.g. > 3.1.4
"version": require("./package.json").dependencies["core-js"]
}]
]
}
```
### `proposals`
`boolean`, defaults to `false`.
This option only has an effect when used alongside `"method": "usage-global"` or `"method": "usage-pure"`. When `proposals` are `true`, any ES proposal supported by core-js will be polyfilled as well.

View File

@@ -0,0 +1,4 @@
`core-js-compat` exposes some files as JSON, and they cannot be
imported by Node.js ESM files.
This folder proxies `core-js-compat` to ensure that every entry
is CJS and can be safely imported.

View File

@@ -0,0 +1 @@
module.exports = require("core-js-compat/data");

View File

@@ -0,0 +1 @@
module.exports = require("core-js-compat/entries");

View File

@@ -0,0 +1 @@
module.exports = require("core-js-compat/get-modules-list-for-target-version");

View File

@@ -0,0 +1,855 @@
import corejs3Polyfills from '../core-js-compat/data.js';
import getModulesListForTargetVersion from '../core-js-compat/get-modules-list-for-target-version.js';
import * as _babel from '@babel/core';
import corejsEntries from '../core-js-compat/entries.js';
import defineProvider from '@babel/helper-define-polyfill-provider';
// This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs
var corejs3ShippedProposalsList = new Set(["esnext.array.group", "esnext.array.group-to-map", "esnext.iterator.zip", "esnext.iterator.zip-keyed", "esnext.symbol.metadata"]);
const polyfillsOrder = {};
Object.keys(corejs3Polyfills).forEach((name, index) => {
polyfillsOrder[name] = index;
});
const define = (pure, global, name = global[0], exclude) => {
return {
name,
pure,
global: global.sort((a, b) => polyfillsOrder[a] - polyfillsOrder[b]),
exclude
};
};
const typed = (...modules) => define(null, [...modules, ...TypedArrayDependencies]);
const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
const CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
const ErrorDependencies = ["es.error.cause", "es.error.to-string"];
const SuppressedErrorDependencies = ["es.suppressed-error.constructor", ...ErrorDependencies];
const ArrayBufferDependencies = ["es.array-buffer.constructor", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"];
const TypedArrayDependencies = ["es.typed-array.at", "es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.find-last", "es.typed-array.find-last-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.to-string", "es.typed-array.with", "es.object.to-string", "es.array.iterator", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by", ...ArrayBufferDependencies];
const PromiseDependencies = ["es.promise", "es.object.to-string"];
const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
const MapDependencies = ["es.map", "es.map.get-or-insert", "es.map.get-or-insert-computed", "esnext.map.delete-all", "esnext.map.emplace", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
const SetDependencies = ["es.set", "es.set.difference.v2", "es.set.intersection.v2", "es.set.is-disjoint-from.v2", "es.set.is-subset-of.v2", "es.set.is-superset-of.v2", "es.set.symmetric-difference.v2", "es.set.union.v2", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
const WeakMapDependencies = ["es.weak-map", "es.weak-map.get-or-insert", "es.weak-map.get-or-insert-computed", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", ...CommonIteratorsWithTag];
const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
const DOMExceptionDependencies = ["web.dom-exception.constructor", "web.dom-exception.stack", "web.dom-exception.to-string-tag", "es.error.to-string"];
const URLSearchParamsDependencies = ["web.url-search-params", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag];
const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...PromiseDependencies];
const AsyncIteratorProblemMethods = ["esnext.async-iterator.every", "esnext.async-iterator.filter", "esnext.async-iterator.find", "esnext.async-iterator.flat-map", "esnext.async-iterator.for-each", "esnext.async-iterator.map", "esnext.async-iterator.reduce", "esnext.async-iterator.some"];
const IteratorDependencies = ["es.iterator.constructor", "es.object.to-string"];
const DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"];
const TypedArrayStaticMethods = base => ({
from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
fromAsync: define(null, ["esnext.typed-array.from-async", base, ...PromiseDependenciesWithIterators, ...TypedArrayDependencies]),
of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies])
});
const DataViewDependencies = ["es.data-view", ...ArrayBufferDependencies];
const BuiltIns = {
AsyncDisposableStack: define("async-disposable-stack/index", ["es.async-disposable-stack.constructor", "es.object.to-string", "es.async-iterator.async-dispose", "es.iterator.dispose", ...PromiseDependencies, ...SuppressedErrorDependencies]),
AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
AggregateError: define("aggregate-error", ["es.aggregate-error", ...ErrorDependencies, ...CommonIteratorsWithTag, "es.aggregate-error.cause"]),
ArrayBuffer: define(null, ArrayBufferDependencies),
DataView: define(null, DataViewDependencies),
Date: define(null, ["es.date.to-string"]),
DOMException: define("dom-exception/index", DOMExceptionDependencies),
DisposableStack: define("disposable-stack/index", ["es.disposable-stack.constructor", "es.object.to-string", "es.iterator.dispose", ...SuppressedErrorDependencies]),
Error: define(null, ErrorDependencies),
EvalError: define(null, ErrorDependencies),
Float32Array: typed("es.typed-array.float32-array"),
Float64Array: typed("es.typed-array.float64-array"),
Int8Array: typed("es.typed-array.int8-array"),
Int16Array: typed("es.typed-array.int16-array"),
Int32Array: typed("es.typed-array.int32-array"),
Iterator: define("iterator/index", IteratorDependencies),
Uint8Array: typed("es.typed-array.uint8-array", "es.uint8-array.set-from-base64", "es.uint8-array.set-from-hex", "es.uint8-array.to-base64", "es.uint8-array.to-hex"),
Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
Uint16Array: typed("es.typed-array.uint16-array"),
Uint32Array: typed("es.typed-array.uint32-array"),
Map: define("map/index", MapDependencies),
Number: define(null, ["es.number.constructor"]),
Observable: define("observable/index", ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag]),
Promise: define("promise/index", PromiseDependencies),
RangeError: define(null, ErrorDependencies),
ReferenceError: define(null, ErrorDependencies),
Reflect: define(null, ["es.reflect.to-string-tag", "es.object.to-string"]),
RegExp: define(null, ["es.regexp.constructor", "es.regexp.dot-all", "es.regexp.exec", "es.regexp.sticky", "es.regexp.to-string"]),
Set: define("set/index", SetDependencies),
SuppressedError: define("suppressed-error", SuppressedErrorDependencies),
Symbol: define("symbol/index", SymbolDependencies),
SyntaxError: define(null, ErrorDependencies),
TypeError: define(null, ErrorDependencies),
URIError: define(null, ErrorDependencies),
URL: define("url/index", ["web.url", "web.url.to-json", ...URLSearchParamsDependencies]),
URLSearchParams: define("url-search-params/index", URLSearchParamsDependencies),
WeakMap: define("weak-map/index", WeakMapDependencies),
WeakSet: define("weak-set/index", WeakSetDependencies),
atob: define("atob", ["web.atob", ...DOMExceptionDependencies]),
btoa: define("btoa", ["web.btoa", ...DOMExceptionDependencies]),
clearImmediate: define("clear-immediate", ["web.immediate"]),
compositeKey: define("composite-key", ["esnext.composite-key"]),
compositeSymbol: define("composite-symbol", ["esnext.composite-symbol"]),
escape: define("escape", ["es.escape"]),
fetch: define(null, PromiseDependencies),
globalThis: define("global-this", ["es.global-this"]),
parseFloat: define("parse-float", ["es.parse-float"]),
parseInt: define("parse-int", ["es.parse-int"]),
queueMicrotask: define("queue-microtask", ["web.queue-microtask"]),
self: define("self", ["web.self"]),
setImmediate: define("set-immediate", ["web.immediate"]),
setInterval: define("set-interval", ["web.timers"]),
setTimeout: define("set-timeout", ["web.timers"]),
structuredClone: define("structured-clone", ["web.structured-clone", ...DOMExceptionDependencies, "es.array.iterator", "es.object.keys", "es.object.to-string", "es.map", "es.set"]),
unescape: define("unescape", ["es.unescape"])
};
const StaticProperties = {
AsyncIterator: {
from: define("async-iterator/from", ["esnext.async-iterator.from", ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods, ...CommonIterators])
},
Array: {
from: define("array/from", ["es.array.from", "es.string.iterator"]),
fromAsync: define("array/from-async", ["es.array.from-async", ...PromiseDependenciesWithIterators]),
isArray: define("array/is-array", ["es.array.is-array"]),
isTemplateObject: define("array/is-template-object", ["esnext.array.is-template-object"]),
of: define("array/of", ["es.array.of"])
},
ArrayBuffer: {
isView: define(null, ["es.array-buffer.is-view"])
},
BigInt: {
range: define("bigint/range", ["esnext.bigint.range", "es.object.to-string"])
},
Date: {
now: define("date/now", ["es.date.now"])
},
Error: {
isError: define("error/is-error", ["es.error.is-error", "es.object.create"])
},
Function: {
isCallable: define("function/is-callable", ["esnext.function.is-callable"]),
isConstructor: define("function/is-constructor", ["esnext.function.is-constructor"])
},
Iterator: {
concat: define("iterator/concat", ["es.iterator.concat", ...IteratorDependencies, ...CommonIterators]),
from: define("iterator/from", ["es.iterator.from", ...IteratorDependencies, ...CommonIterators]),
range: define("iterator/range", ["esnext.iterator.range", ...IteratorDependencies]),
zip: define("iterator/zip", ["esnext.iterator.zip", ...IteratorDependencies, ...CommonIterators]),
zipKeyed: define("iterator/zip-keyed", ["esnext.iterator.zip-keyed", "es.object.create", "es.reflect.own-keys", ...IteratorDependencies, ...CommonIterators])
},
JSON: {
isRawJSON: define("json/is-raw-json", ["es.json.is-raw-json"]),
parse: define("json/parse", ["es.json.parse", "es.object.keys"]),
rawJSON: define("json/raw-json", ["es.json.raw-json", "es.object.create", "es.object.freeze"]),
stringify: define("json/stringify", ["es.json.stringify", "es.date.to-json"])
},
Math: {
DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]),
RAD_PER_DEG: define("math/rad-per-deg", ["esnext.math.rad-per-deg"]),
acosh: define("math/acosh", ["es.math.acosh"]),
asinh: define("math/asinh", ["es.math.asinh"]),
atanh: define("math/atanh", ["es.math.atanh"]),
cbrt: define("math/cbrt", ["es.math.cbrt"]),
clamp: define("math/clamp", ["esnext.math.clamp"]),
clz32: define("math/clz32", ["es.math.clz32"]),
cosh: define("math/cosh", ["es.math.cosh"]),
degrees: define("math/degrees", ["esnext.math.degrees"]),
expm1: define("math/expm1", ["es.math.expm1"]),
fround: define("math/fround", ["es.math.fround"]),
f16round: define("math/f16round", ["es.math.f16round"]),
fscale: define("math/fscale", ["esnext.math.fscale"]),
hypot: define("math/hypot", ["es.math.hypot"]),
iaddh: define("math/iaddh", ["esnext.math.iaddh"]),
imul: define("math/imul", ["es.math.imul"]),
imulh: define("math/imulh", ["esnext.math.imulh"]),
isubh: define("math/isubh", ["esnext.math.isubh"]),
log10: define("math/log10", ["es.math.log10"]),
log1p: define("math/log1p", ["es.math.log1p"]),
log2: define("math/log2", ["es.math.log2"]),
radians: define("math/radians", ["esnext.math.radians"]),
scale: define("math/scale", ["esnext.math.scale"]),
seededPRNG: define("math/seeded-prng", ["esnext.math.seeded-prng"]),
sign: define("math/sign", ["es.math.sign"]),
signbit: define("math/signbit", ["esnext.math.signbit"]),
sinh: define("math/sinh", ["es.math.sinh"]),
sumPrecise: define("math/sum-precise", ["es.math.sum-precise", "es.array.iterator"]),
tanh: define("math/tanh", ["es.math.tanh"]),
trunc: define("math/trunc", ["es.math.trunc"]),
umulh: define("math/umulh", ["esnext.math.umulh"])
},
Map: {
from: define("map/from", ["esnext.map.from", ...MapDependencies]),
groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]),
keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]),
of: define("map/of", ["esnext.map.of", ...MapDependencies])
},
Number: {
EPSILON: define("number/epsilon", ["es.number.epsilon"]),
MAX_SAFE_INTEGER: define("number/max-safe-integer", ["es.number.max-safe-integer"]),
MIN_SAFE_INTEGER: define("number/min-safe-integer", ["es.number.min-safe-integer"]),
fromString: define("number/from-string", ["esnext.number.from-string"]),
isFinite: define("number/is-finite", ["es.number.is-finite"]),
isInteger: define("number/is-integer", ["es.number.is-integer"]),
isNaN: define("number/is-nan", ["es.number.is-nan"]),
isSafeInteger: define("number/is-safe-integer", ["es.number.is-safe-integer"]),
parseFloat: define("number/parse-float", ["es.number.parse-float"]),
parseInt: define("number/parse-int", ["es.number.parse-int"]),
range: define("number/range", ["esnext.number.range", "es.object.to-string"])
},
Object: {
assign: define("object/assign", ["es.object.assign"]),
create: define("object/create", ["es.object.create"]),
defineProperties: define("object/define-properties", ["es.object.define-properties"]),
defineProperty: define("object/define-property", ["es.object.define-property"]),
entries: define("object/entries", ["es.object.entries"]),
freeze: define("object/freeze", ["es.object.freeze"]),
fromEntries: define("object/from-entries", ["es.object.from-entries", "es.array.iterator"]),
getOwnPropertyDescriptor: define("object/get-own-property-descriptor", ["es.object.get-own-property-descriptor"]),
getOwnPropertyDescriptors: define("object/get-own-property-descriptors", ["es.object.get-own-property-descriptors"]),
getOwnPropertyNames: define("object/get-own-property-names", ["es.object.get-own-property-names"]),
getOwnPropertySymbols: define("object/get-own-property-symbols", ["es.symbol"]),
getPrototypeOf: define("object/get-prototype-of", ["es.object.get-prototype-of"]),
groupBy: define("object/group-by", ["es.object.group-by", "es.object.create"]),
hasOwn: define("object/has-own", ["es.object.has-own"]),
is: define("object/is", ["es.object.is"]),
isExtensible: define("object/is-extensible", ["es.object.is-extensible"]),
isFrozen: define("object/is-frozen", ["es.object.is-frozen"]),
isSealed: define("object/is-sealed", ["es.object.is-sealed"]),
keys: define("object/keys", ["es.object.keys"]),
preventExtensions: define("object/prevent-extensions", ["es.object.prevent-extensions"]),
seal: define("object/seal", ["es.object.seal"]),
setPrototypeOf: define("object/set-prototype-of", ["es.object.set-prototype-of"]),
values: define("object/values", ["es.object.values"])
},
Promise: {
all: define(null, PromiseDependenciesWithIterators),
allSettled: define("promise/all-settled", ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
any: define("promise/any", ["es.promise.any", "es.aggregate-error", ...PromiseDependenciesWithIterators]),
race: define(null, PromiseDependenciesWithIterators),
try: define("promise/try", ["es.promise.try", ...PromiseDependencies]),
withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies])
},
Reflect: {
apply: define("reflect/apply", ["es.reflect.apply"]),
construct: define("reflect/construct", ["es.reflect.construct"]),
defineMetadata: define("reflect/define-metadata", ["esnext.reflect.define-metadata"]),
defineProperty: define("reflect/define-property", ["es.reflect.define-property"]),
deleteMetadata: define("reflect/delete-metadata", ["esnext.reflect.delete-metadata"]),
deleteProperty: define("reflect/delete-property", ["es.reflect.delete-property"]),
get: define("reflect/get", ["es.reflect.get"]),
getMetadata: define("reflect/get-metadata", ["esnext.reflect.get-metadata"]),
getMetadataKeys: define("reflect/get-metadata-keys", ["esnext.reflect.get-metadata-keys"]),
getOwnMetadata: define("reflect/get-own-metadata", ["esnext.reflect.get-own-metadata"]),
getOwnMetadataKeys: define("reflect/get-own-metadata-keys", ["esnext.reflect.get-own-metadata-keys"]),
getOwnPropertyDescriptor: define("reflect/get-own-property-descriptor", ["es.reflect.get-own-property-descriptor"]),
getPrototypeOf: define("reflect/get-prototype-of", ["es.reflect.get-prototype-of"]),
has: define("reflect/has", ["es.reflect.has"]),
hasMetadata: define("reflect/has-metadata", ["esnext.reflect.has-metadata"]),
hasOwnMetadata: define("reflect/has-own-metadata", ["esnext.reflect.has-own-metadata"]),
isExtensible: define("reflect/is-extensible", ["es.reflect.is-extensible"]),
metadata: define("reflect/metadata", ["esnext.reflect.metadata"]),
ownKeys: define("reflect/own-keys", ["es.reflect.own-keys"]),
preventExtensions: define("reflect/prevent-extensions", ["es.reflect.prevent-extensions"]),
set: define("reflect/set", ["es.reflect.set"]),
setPrototypeOf: define("reflect/set-prototype-of", ["es.reflect.set-prototype-of"])
},
RegExp: {
escape: define("regexp/escape", ["es.regexp.escape"])
},
Set: {
from: define("set/from", ["esnext.set.from", ...SetDependencies]),
of: define("set/of", ["esnext.set.of", ...SetDependencies])
},
String: {
cooked: define("string/cooked", ["esnext.string.cooked"]),
dedent: define("string/dedent", ["esnext.string.dedent", "es.string.from-code-point", "es.weak-map"]),
fromCodePoint: define("string/from-code-point", ["es.string.from-code-point"]),
raw: define("string/raw", ["es.string.raw"])
},
Symbol: {
asyncDispose: define("symbol/async-dispose", ["es.symbol.async-dispose", "es.async-iterator.async-dispose"]),
asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
customMatcher: define("symbol/custom-matcher", ["esnext.symbol.custom-matcher"]),
dispose: define("symbol/dispose", ["es.symbol.dispose", "es.iterator.dispose"]),
for: define("symbol/for", [], "es.symbol"),
hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
isConcatSpreadable: define("symbol/is-concat-spreadable", ["es.symbol.is-concat-spreadable", "es.array.concat"]),
isRegistered: define("symbol/is-registered", ["esnext.symbol.is-registered", "es.symbol"]),
isRegisteredSymbol: define("symbol/is-registered-symbol", ["esnext.symbol.is-registered-symbol", "es.symbol"]),
isWellKnown: define("symbol/is-well-known", ["esnext.symbol.is-well-known", "es.symbol"]),
isWellKnownSymbol: define("symbol/is-well-known-symbol", ["esnext.symbol.is-well-known-symbol", "es.symbol"]),
iterator: define("symbol/iterator", ["es.symbol.iterator", ...CommonIteratorsWithTag]),
keyFor: define("symbol/key-for", [], "es.symbol"),
match: define("symbol/match", ["es.symbol.match", "es.string.match"]),
matcher: define("symbol/matcher", ["esnext.symbol.matcher"]),
matchAll: define("symbol/match-all", ["es.symbol.match-all", "es.string.match-all"]),
metadata: define("symbol/metadata", DecoratorMetadataDependencies),
metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]),
observable: define("symbol/observable", ["esnext.symbol.observable"]),
patternMatch: define("symbol/pattern-match", ["esnext.symbol.pattern-match"]),
replace: define("symbol/replace", ["es.symbol.replace", "es.string.replace"]),
search: define("symbol/search", ["es.symbol.search", "es.string.search"]),
species: define("symbol/species", ["es.symbol.species", "es.array.species"]),
split: define("symbol/split", ["es.symbol.split", "es.string.split"]),
toPrimitive: define("symbol/to-primitive", ["es.symbol.to-primitive", "es.date.to-primitive"]),
toStringTag: define("symbol/to-string-tag", ["es.symbol.to-string-tag", "es.object.to-string", "es.math.to-string-tag", "es.json.to-string-tag"]),
unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
},
URL: {
canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
parse: define("url/parse", ["web.url.parse", "web.url"])
},
WeakMap: {
from: define("weak-map/from", ["esnext.weak-map.from", ...WeakMapDependencies]),
of: define("weak-map/of", ["esnext.weak-map.of", ...WeakMapDependencies])
},
WeakSet: {
from: define("weak-set/from", ["esnext.weak-set.from", ...WeakSetDependencies]),
of: define("weak-set/of", ["esnext.weak-set.of", ...WeakSetDependencies])
},
Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
Uint8Array: {
fromBase64: define(null, ["es.uint8-array.from-base64", ...TypedArrayDependencies]),
fromHex: define(null, ["es.uint8-array.from-hex", ...TypedArrayDependencies]),
...TypedArrayStaticMethods("es.typed-array.uint8-array")
},
Uint8ClampedArray: TypedArrayStaticMethods("es.typed-array.uint8-clamped-array"),
Int16Array: TypedArrayStaticMethods("es.typed-array.int16-array"),
Uint16Array: TypedArrayStaticMethods("es.typed-array.uint16-array"),
Int32Array: TypedArrayStaticMethods("es.typed-array.int32-array"),
Uint32Array: TypedArrayStaticMethods("es.typed-array.uint32-array"),
Float32Array: TypedArrayStaticMethods("es.typed-array.float32-array"),
Float64Array: TypedArrayStaticMethods("es.typed-array.float64-array"),
WebAssembly: {
CompileError: define(null, ErrorDependencies),
LinkError: define(null, ErrorDependencies),
RuntimeError: define(null, ErrorDependencies)
}
};
["AggregateError", "EvalError", "RangeError", "ReferenceError", "SuppressedError", "SyntaxError", "TypeError", "URIError"].forEach(ERROR_SUBCLASS => {
StaticProperties[ERROR_SUBCLASS] = StaticProperties.Error;
});
const InstanceProperties = {
asIndexedPairs: define(null, ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
at: define("instance/at", [
// TODO: We should introduce overloaded instance methods definition
// Before that is implemented, the `esnext.string.at` must be the first
// In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
// and treats the compat-data of `esnext.string.at` as the compat-data of
// pure import `instance/at`. The first polyfill here should have the lowest corejs
// supported versions.
"esnext.string.at", "es.string.at-alternative", "es.array.at"]),
anchor: define(null, ["es.string.anchor"]),
big: define(null, ["es.string.big"]),
bind: define("instance/bind", ["es.function.bind"]),
blink: define(null, ["es.string.blink"]),
bold: define(null, ["es.string.bold"]),
chunks: define(null, ["esnext.iterator.chunks", ...IteratorDependencies]),
clamp: define("instance/clamp", ["esnext.number.clamp"]),
codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
codePoints: define("instance/code-points", ["esnext.string.code-points"]),
concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
description: define(null, ["es.symbol", "es.symbol.description"]),
dotAll: define(null, ["es.regexp.dot-all"]),
drop: define(null, ["es.iterator.drop", ...IteratorDependencies, "esnext.async-iterator.drop", ...AsyncIteratorDependencies]),
endsWith: define("instance/ends-with", ["es.string.ends-with"]),
entries: define("instance/entries", ArrayNatureIteratorsWithTag),
every: define("instance/every", ["es.array.every", "es.iterator.every", ...IteratorDependencies
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// "esnext.async-iterator.every",
// ...AsyncIteratorDependencies
]),
exec: define(null, ["es.regexp.exec"]),
fill: define("instance/fill", ["es.array.fill"]),
filter: define("instance/filter", ["es.array.filter", "es.iterator.filter", ...IteratorDependencies
// "esnext.async-iterator.filter",
]),
filterReject: define("instance/filter-reject", ["esnext.array.filter-reject"]),
finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
find: define("instance/find", ["es.array.find", "es.iterator.find", ...IteratorDependencies
// "esnext.async-iterator.find",
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
fixed: define(null, ["es.string.fixed"]),
flags: define("instance/flags", ["es.regexp.flags"]),
flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "es.iterator.flat-map", ...IteratorDependencies
// "esnext.async-iterator.flat-map",
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getFloat16: define(null, ["es.data-view.get-float16", ...DataViewDependencies]),
getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
getYear: define(null, ["es.date.get-year"]),
group: define("instance/group", ["esnext.array.group"]),
groupBy: define("instance/group-by", ["esnext.array.group-by"]),
groupByToMap: define("instance/group-by-to-map", ["esnext.array.group-by-to-map", "es.map", "es.object.to-string"]),
groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
fontcolor: define(null, ["es.string.fontcolor"]),
fontsize: define(null, ["es.string.fontsize"]),
forEach: define("instance/for-each", ["es.array.for-each", "es.iterator.for-each", ...IteratorDependencies,
// "esnext.async-iterator.for-each",
"web.dom-collections.for-each"]),
includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
indexOf: define("instance/index-of", ["es.array.index-of"]),
isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
italics: define(null, ["es.string.italics"]),
join: define(null, ["es.array.join"]),
keys: define("instance/keys", ArrayNatureIteratorsWithTag),
lastIndex: define(null, ["esnext.array.last-index"]),
lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
lastItem: define(null, ["esnext.array.last-item"]),
link: define(null, ["es.string.link"]),
map: define("instance/map", ["es.array.map", "es.iterator.map", ...IteratorDependencies
// "esnext.async-iterator.map",
]),
match: define(null, ["es.string.match", "es.regexp.exec"]),
matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
name: define(null, ["es.function.name"]),
padEnd: define("instance/pad-end", ["es.string.pad-end"]),
padStart: define("instance/pad-start", ["es.string.pad-start"]),
push: define("instance/push", ["es.array.push"]),
reduce: define("instance/reduce", ["es.array.reduce", "es.iterator.reduce", ...IteratorDependencies
// "esnext.async-iterator.reduce",
]),
reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
repeat: define("instance/repeat", ["es.string.repeat"]),
replace: define(null, ["es.string.replace", "es.regexp.exec"]),
replaceAll: define("instance/replace-all", ["es.string.replace-all", "es.string.replace", "es.regexp.exec"]),
reverse: define("instance/reverse", ["es.array.reverse"]),
search: define(null, ["es.string.search", "es.regexp.exec"]),
setFloat16: define(null, ["es.data-view.set-float16", ...DataViewDependencies]),
setUint8Clamped: define(null, ["esnext.data-view.set-uint8-clamped", ...DataViewDependencies]),
setYear: define(null, ["es.date.set-year"]),
slice: define("instance/slice", ["es.array.slice"]),
sliding: define(null, ["esnext.iterator.sliding", ...IteratorDependencies]),
small: define(null, ["es.string.small"]),
some: define("instance/some", ["es.array.some", "es.iterator.some", ...IteratorDependencies
// "esnext.async-iterator.some",
]),
sort: define("instance/sort", ["es.array.sort"]),
splice: define("instance/splice", ["es.array.splice"]),
split: define(null, ["es.string.split", "es.regexp.exec"]),
startsWith: define("instance/starts-with", ["es.string.starts-with"]),
sticky: define(null, ["es.regexp.sticky"]),
strike: define(null, ["es.string.strike"]),
sub: define(null, ["es.string.sub"]),
substr: define(null, ["es.string.substr"]),
sup: define(null, ["es.string.sup"]),
take: define(null, ["es.iterator.take", ...IteratorDependencies, "esnext.async-iterator.take", ...AsyncIteratorDependencies]),
test: define(null, ["es.regexp.test", "es.regexp.exec"]),
toArray: define(null, ["es.iterator.to-array", ...IteratorDependencies, "esnext.async-iterator.to-array", ...AsyncIteratorDependencies]),
toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
toExponential: define(null, ["es.number.to-exponential"]),
toFixed: define(null, ["es.number.to-fixed"]),
toGMTString: define(null, ["es.date.to-gmt-string"]),
toISOString: define(null, ["es.date.to-iso-string"]),
toJSON: define(null, ["es.date.to-json"]),
toPrecision: define(null, ["es.number.to-precision"]),
toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
toSorted: define("instance/to-sorted", ["es.array.to-sorted", "es.array.sort"]),
toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
toString: define(null, ["es.object.to-string", "es.error.to-string", "es.date.to-string", "es.regexp.to-string"]),
toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
trim: define("instance/trim", ["es.string.trim"]),
trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
trimRight: define("instance/trim-right", ["es.string.trim-end"]),
trimStart: define("instance/trim-start", ["es.string.trim-start"]),
uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
unshift: define("instance/unshift", ["es.array.unshift"]),
unThis: define("instance/un-this", ["esnext.function.un-this"]),
values: define("instance/values", ArrayNatureIteratorsWithTag),
windows: define(null, ["esnext.iterator.windows", ...IteratorDependencies]),
with: define("instance/with", ["es.array.with"]),
__defineGetter__: define(null, ["es.object.define-getter"]),
__defineSetter__: define(null, ["es.object.define-setter"]),
__lookupGetter__: define(null, ["es.object.lookup-getter"]),
__lookupSetter__: define(null, ["es.object.lookup-setter"]),
["__proto__"]: define(null, ["es.object.proto"])
};
// This file contains the list of paths supported by @babel/runtime-corejs3.
// It must _not_ be edited, as all new features should go through direct
// injection of core-js-pure imports.
const stable = new Set(["array", "array/from", "array/is-array", "array/of", "clear-immediate", "date/now", "instance/bind", "instance/code-point-at", "instance/concat", "instance/copy-within", "instance/ends-with", "instance/entries", "instance/every", "instance/fill", "instance/filter", "instance/find", "instance/find-index", "instance/flags", "instance/flat", "instance/flat-map", "instance/for-each", "instance/includes", "instance/index-of", "instance/keys", "instance/last-index-of", "instance/map", "instance/pad-end", "instance/pad-start", "instance/reduce", "instance/reduce-right", "instance/repeat", "instance/reverse", "instance/slice", "instance/some", "instance/sort", "instance/splice", "instance/starts-with", "instance/trim", "instance/trim-end", "instance/trim-left", "instance/trim-right", "instance/trim-start", "instance/values", "json/stringify", "map", "math/acosh", "math/asinh", "math/atanh", "math/cbrt", "math/clz32", "math/cosh", "math/expm1", "math/fround", "math/hypot", "math/imul", "math/log10", "math/log1p", "math/log2", "math/sign", "math/sinh", "math/tanh", "math/trunc", "number/epsilon", "number/is-finite", "number/is-integer", "number/is-nan", "number/is-safe-integer", "number/max-safe-integer", "number/min-safe-integer", "number/parse-float", "number/parse-int", "object/assign", "object/create", "object/define-properties", "object/define-property", "object/entries", "object/freeze", "object/from-entries", "object/get-own-property-descriptor", "object/get-own-property-descriptors", "object/get-own-property-names", "object/get-own-property-symbols", "object/get-prototype-of", "object/is", "object/is-extensible", "object/is-frozen", "object/is-sealed", "object/keys", "object/prevent-extensions", "object/seal", "object/set-prototype-of", "object/values", "parse-float", "parse-int", "promise", "queue-microtask", "reflect/apply", "reflect/construct", "reflect/define-property", "reflect/delete-property", "reflect/get", "reflect/get-own-property-descriptor", "reflect/get-prototype-of", "reflect/has", "reflect/is-extensible", "reflect/own-keys", "reflect/prevent-extensions", "reflect/set", "reflect/set-prototype-of", "set", "set-immediate", "set-interval", "set-timeout", "string/from-code-point", "string/raw", "symbol", "symbol/async-iterator", "symbol/for", "symbol/has-instance", "symbol/is-concat-spreadable", "symbol/iterator", "symbol/key-for", "symbol/match", "symbol/replace", "symbol/search", "symbol/species", "symbol/split", "symbol/to-primitive", "symbol/to-string-tag", "symbol/unscopables", "url", "url-search-params", "weak-map", "weak-set"]);
const proposals = new Set([...stable, "aggregate-error", "composite-key", "composite-symbol", "global-this", "instance/at", "instance/code-points", "instance/match-all", "instance/replace-all", "math/clamp", "math/degrees", "math/deg-per-rad", "math/fscale", "math/iaddh", "math/imulh", "math/isubh", "math/rad-per-deg", "math/radians", "math/scale", "math/seeded-prng", "math/signbit", "math/umulh", "number/from-string", "observable", "reflect/define-metadata", "reflect/delete-metadata", "reflect/get-metadata", "reflect/get-metadata-keys", "reflect/get-own-metadata", "reflect/get-own-metadata-keys", "reflect/has-metadata", "reflect/has-own-metadata", "reflect/metadata", "symbol/dispose", "symbol/observable", "symbol/pattern-match"]);
const {
types: t$2
} = _babel.default || _babel;
function canSkipPolyfill(desc, path) {
const {
node,
parent
} = path;
switch (desc.name) {
case "es.string.split":
{
if (!t$2.isCallExpression(parent, {
callee: node
})) return false;
if (parent.arguments.length < 1) return true;
const splitter = parent.arguments[0];
return t$2.isStringLiteral(splitter) || t$2.isTemplateLiteral(splitter);
}
}
}
const {
types: t$1
} = _babel.default || _babel;
const BABEL_RUNTIME = "@babel/runtime-corejs3";
function callMethod(path, id, optionalCall, wrapCallee) {
const [context1, context2] = maybeMemoizeContext(path.node, path.scope);
let callee = t$1.callExpression(id, [context1]);
if (wrapCallee) callee = wrapCallee(callee);
const call = t$1.identifier("call");
path.replaceWith(optionalCall ? t$1.optionalMemberExpression(callee, call, false, true) : t$1.memberExpression(callee, call));
path.parentPath.unshiftContainer("arguments", context2);
}
function maybeMemoizeContext(node, scope) {
const {
object
} = node;
let context1, context2;
if (t$1.isIdentifier(object)) {
context2 = object;
context1 = t$1.cloneNode(object);
} else {
context2 = scope.generateDeclaredUidIdentifier("context");
context1 = t$1.assignmentExpression("=", t$1.cloneNode(context2), object);
}
return [context1, context2];
}
function extractOptionalCheck(scope, node) {
let optionalNode = node;
while (!optionalNode.optional && t$1.isOptionalMemberExpression(optionalNode.object)) {
optionalNode = optionalNode.object;
}
optionalNode.optional = false;
const ctx = scope.generateDeclaredUidIdentifier("context");
const assign = t$1.assignmentExpression("=", ctx, optionalNode.object);
optionalNode.object = t$1.cloneNode(ctx);
return ifNotNullish => t$1.conditionalExpression(t$1.binaryExpression("==", assign, t$1.nullLiteral()), t$1.unaryExpression("void", t$1.numericLiteral(0)), ifNotNullish);
}
function isCoreJSSource(source) {
if (typeof source === "string") {
source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
}
return Object.prototype.hasOwnProperty.call(corejsEntries, source) && corejsEntries[source];
}
function coreJSModule(name) {
return `core-js/modules/${name}.js`;
}
function coreJSPureHelper(name, useBabelRuntime, ext) {
return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
}
const {
types: t,
template: template
} = _babel.default || _babel;
const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
const uniqueObjects = ["array", "string", "iterator", "async-iterator", "dom-collections"].map(v => new RegExp(`[a-z]*\\.${v}\\..*`));
const esnextFallback = (name, cb) => {
if (cb(name)) return true;
if (!name.startsWith("es.")) return false;
const fallback = `esnext.${name.slice(3)}`;
if (!corejs3Polyfills[fallback]) return false;
return cb(fallback);
};
var index = defineProvider(function ({
getUtils,
method,
shouldInjectPolyfill,
createMetaResolver,
debug,
babel
}, {
version = 3,
proposals: proposals$1,
shippedProposals,
[presetEnvCompat]: {
noRuntimeName = false
} = {},
[runtimeCompat]: {
useBabelRuntime = false,
ext = ".js"
} = {}
}) {
const isWebpack = babel.caller(caller => (caller == null ? void 0 : caller.name) === "babel-loader");
const resolve = createMetaResolver({
global: BuiltIns,
static: StaticProperties,
instance: InstanceProperties
});
const available = new Set(getModulesListForTargetVersion(version));
function getCoreJSPureBase(useProposalBase) {
return useBabelRuntime ? useProposalBase ? `${BABEL_RUNTIME}/core-js` : `${BABEL_RUNTIME}/core-js-stable` : useProposalBase ? "core-js-pure/features" : "core-js-pure/stable";
}
function maybeInjectGlobalImpl(name, utils) {
if (shouldInjectPolyfill(name)) {
debug(name);
utils.injectGlobalImport(coreJSModule(name), name);
return true;
}
return false;
}
function maybeInjectGlobal(names, utils, fallback = true) {
for (const name of names) {
if (fallback) {
esnextFallback(name, name => maybeInjectGlobalImpl(name, utils));
} else {
maybeInjectGlobalImpl(name, utils);
}
}
}
function maybeInjectPure(desc, hint, utils, object) {
if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) {
const {
name
} = desc;
let useProposalBase = false;
if (proposals$1 || shippedProposals && name.startsWith("esnext.")) {
useProposalBase = true;
} else if (name.startsWith("es.") && !available.has(name)) {
useProposalBase = true;
}
if (useBabelRuntime && !(useProposalBase ? proposals : stable).has(desc.pure)) {
return;
}
const coreJSPureBase = getCoreJSPureBase(useProposalBase);
return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint);
}
}
function isFeatureStable(name) {
if (name.startsWith("esnext.")) {
const esName = `es.${name.slice(7)}`;
// If its imaginative esName is not in latest compat data, it means
// the proposal is not stage 4
return esName in corejs3Polyfills;
}
return true;
}
return {
name: "corejs3",
runtimeName: noRuntimeName ? null : BABEL_RUNTIME,
polyfills: corejs3Polyfills,
filterPolyfills(name) {
if (!available.has(name)) return false;
if (proposals$1 || method === "entry-global") return true;
if (shippedProposals && corejs3ShippedProposalsList.has(name)) {
return true;
}
return isFeatureStable(name);
},
entryGlobal(meta, utils, path) {
if (meta.kind !== "import") return;
const modules = isCoreJSSource(meta.source);
if (!modules) return;
if (modules.length === 1 && meta.source === coreJSModule(modules[0]) && shouldInjectPolyfill(modules[0])) {
// Avoid infinite loop: do not replace imports with a new copy of
// themselves.
debug(null);
return;
}
const modulesSet = new Set(modules);
const filteredModules = modules.filter(module => {
if (!module.startsWith("esnext.")) return true;
const stable = module.replace("esnext.", "es.");
if (modulesSet.has(stable) && shouldInjectPolyfill(stable)) {
return false;
}
return true;
});
maybeInjectGlobal(filteredModules, utils, false);
path.remove();
},
usageGlobal(meta, utils, path) {
const resolved = resolve(meta);
if (!resolved) return;
if (canSkipPolyfill(resolved.desc, path)) return;
let deps = resolved.desc.global;
if (resolved.kind !== "global" && "object" in meta && meta.object && meta.placement === "prototype") {
const low = meta.object.toLowerCase();
deps = deps.filter(m => uniqueObjects.some(v => v.test(m)) ? m.includes(low) : true);
}
maybeInjectGlobal(deps, utils);
return true;
},
usagePure(meta, utils, path) {
if (meta.kind === "in") {
if (meta.key === "Symbol.iterator") {
path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right] // meta.kind === "in" narrows this
));
}
return;
}
if (path.parentPath.isUnaryExpression({
operator: "delete"
})) return;
if (meta.kind === "property") {
// We can't compile destructuring and updateExpression.
if (!path.isMemberExpression() && !path.isOptionalMemberExpression()) {
return;
}
if (!path.isReferenced()) return;
if (path.parentPath.isUpdateExpression()) return;
if (t.isSuper(path.node.object)) {
return;
}
if (meta.key === "Symbol.iterator") {
if (!shouldInjectPolyfill("es.symbol.iterator")) return;
const {
parent,
node
} = path;
if (t.isCallExpression(parent, {
callee: node
})) {
if (parent.arguments.length === 0) {
path.parentPath.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator", useBabelRuntime, ext), "getIterator"), [node.object]));
path.skip();
} else {
callMethod(path, utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"));
}
} else {
path.replaceWith(t.callExpression(utils.injectDefaultImport(coreJSPureHelper("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object]));
}
return;
}
}
let resolved = resolve(meta);
if (!resolved) return;
if (canSkipPolyfill(resolved.desc, path)) return;
if (useBabelRuntime && resolved.desc.pure && resolved.desc.pure.slice(-6) === "/index") {
// Remove /index, since it doesn't exist in @babel/runtime-corejs3s
resolved = {
...resolved,
desc: {
...resolved.desc,
pure: resolved.desc.pure.slice(0, -6)
}
};
}
if (resolved.kind === "global") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils);
if (id) path.replaceWith(id);
} else if (resolved.kind === "static") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils,
// @ts-expect-error
meta.object);
if (id) {
path.replaceWith(id);
let {
parentPath
} = path;
if (parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) {
do {
const parentAsNotOptional = parentPath;
parentAsNotOptional.type = parentAsNotOptional.node.type = parentPath.type === "OptionalMemberExpression" ? "MemberExpression" : "CallExpression";
delete parentAsNotOptional.node.optional;
({
parentPath
} = parentPath);
} while ((parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) && !parentPath.node.optional);
}
}
} else if (resolved.kind === "instance") {
const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
// @ts-expect-error
meta.object);
if (!id) return;
const {
node,
parent
} = path;
if (t.isOptionalCallExpression(parent) && parent.callee === node) {
const wasOptional = parent.optional;
parent.optional = !wasOptional;
if (!wasOptional) {
const check = extractOptionalCheck(path.scope, node);
const [thisArg, thisArg2] = maybeMemoizeContext(node, path.scope);
path.replaceWith(check(template.expression.ast`
Function.call.bind(${id}(${thisArg}), ${thisArg2})
`));
} else if (t.isOptionalMemberExpression(node)) {
const check = extractOptionalCheck(path.scope, node);
callMethod(path, id, true, check);
} else {
callMethod(path, id, true);
}
} else if (t.isCallExpression(parent) && parent.callee === node) {
callMethod(path, id, false);
} else if (t.isOptionalMemberExpression(node)) {
const check = extractOptionalCheck(path.scope, node);
path.replaceWith(check(t.callExpression(id, [node.object])));
if (t.isOptionalMemberExpression(parent)) parent.optional = true;
} else {
path.replaceWith(t.callExpression(id, [node.object]));
}
}
},
visitor: method === "usage-global" && {
// import("foo")
CallExpression(path) {
if (path.get("callee").isImport()) {
const utils = getUtils(path);
if (isWebpack) {
// Webpack uses Promise.all to handle dynamic import.
maybeInjectGlobal(PromiseDependenciesWithIterators, utils);
} else {
maybeInjectGlobal(PromiseDependencies, utils);
}
}
},
// (async function () { }).finally(...)
Function(path) {
if (path.node.async) {
maybeInjectGlobal(PromiseDependencies, getUtils(path));
}
},
// for-of, [a, b] = c
"ForOfStatement|ArrayPattern"(path) {
maybeInjectGlobal(CommonIterators, getUtils(path));
},
// [...spread]
SpreadElement(path) {
if (!path.parentPath.isObjectExpression()) {
maybeInjectGlobal(CommonIterators, getUtils(path));
}
},
// yield*
YieldExpression(path) {
if (path.node.delegate) {
maybeInjectGlobal(CommonIterators, getUtils(path));
}
},
// Decorators metadata
Class(path) {
var _path$node$decorators;
const hasDecorators = ((_path$node$decorators = path.node.decorators) == null ? void 0 : _path$node$decorators.length) || path.node.body.body.some(el => {
var _decorators;
return (_decorators = el.decorators) == null ? void 0 : _decorators.length;
});
if (hasDecorators) {
maybeInjectGlobal(DecoratorMetadataDependencies, getUtils(path));
}
}
}
};
});
export { index as default };
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
"use strict";
exports.__esModule = true;
exports.stable = exports.proposals = void 0;
// This file contains the list of paths supported by @babel/runtime-corejs3.
// It must _not_ be edited, as all new features should go through direct
// injection of core-js-pure imports.
const stable = exports.stable = new Set(["array", "array/from", "array/is-array", "array/of", "clear-immediate", "date/now", "instance/bind", "instance/code-point-at", "instance/concat", "instance/copy-within", "instance/ends-with", "instance/entries", "instance/every", "instance/fill", "instance/filter", "instance/find", "instance/find-index", "instance/flags", "instance/flat", "instance/flat-map", "instance/for-each", "instance/includes", "instance/index-of", "instance/keys", "instance/last-index-of", "instance/map", "instance/pad-end", "instance/pad-start", "instance/reduce", "instance/reduce-right", "instance/repeat", "instance/reverse", "instance/slice", "instance/some", "instance/sort", "instance/splice", "instance/starts-with", "instance/trim", "instance/trim-end", "instance/trim-left", "instance/trim-right", "instance/trim-start", "instance/values", "json/stringify", "map", "math/acosh", "math/asinh", "math/atanh", "math/cbrt", "math/clz32", "math/cosh", "math/expm1", "math/fround", "math/hypot", "math/imul", "math/log10", "math/log1p", "math/log2", "math/sign", "math/sinh", "math/tanh", "math/trunc", "number/epsilon", "number/is-finite", "number/is-integer", "number/is-nan", "number/is-safe-integer", "number/max-safe-integer", "number/min-safe-integer", "number/parse-float", "number/parse-int", "object/assign", "object/create", "object/define-properties", "object/define-property", "object/entries", "object/freeze", "object/from-entries", "object/get-own-property-descriptor", "object/get-own-property-descriptors", "object/get-own-property-names", "object/get-own-property-symbols", "object/get-prototype-of", "object/is", "object/is-extensible", "object/is-frozen", "object/is-sealed", "object/keys", "object/prevent-extensions", "object/seal", "object/set-prototype-of", "object/values", "parse-float", "parse-int", "promise", "queue-microtask", "reflect/apply", "reflect/construct", "reflect/define-property", "reflect/delete-property", "reflect/get", "reflect/get-own-property-descriptor", "reflect/get-prototype-of", "reflect/has", "reflect/is-extensible", "reflect/own-keys", "reflect/prevent-extensions", "reflect/set", "reflect/set-prototype-of", "set", "set-immediate", "set-interval", "set-timeout", "string/from-code-point", "string/raw", "symbol", "symbol/async-iterator", "symbol/for", "symbol/has-instance", "symbol/is-concat-spreadable", "symbol/iterator", "symbol/key-for", "symbol/match", "symbol/replace", "symbol/search", "symbol/species", "symbol/split", "symbol/to-primitive", "symbol/to-string-tag", "symbol/unscopables", "url", "url-search-params", "weak-map", "weak-set"]);
const proposals = exports.proposals = new Set([...stable, "aggregate-error", "composite-key", "composite-symbol", "global-this", "instance/at", "instance/code-points", "instance/match-all", "instance/replace-all", "math/clamp", "math/degrees", "math/deg-per-rad", "math/fscale", "math/iaddh", "math/imulh", "math/isubh", "math/rad-per-deg", "math/radians", "math/scale", "math/seeded-prng", "math/signbit", "math/umulh", "number/from-string", "observable", "reflect/define-metadata", "reflect/delete-metadata", "reflect/get-metadata", "reflect/get-metadata-keys", "reflect/get-own-metadata", "reflect/get-own-metadata-keys", "reflect/has-metadata", "reflect/has-own-metadata", "reflect/metadata", "symbol/dispose", "symbol/observable", "symbol/pattern-match"]);

View File

@@ -0,0 +1,474 @@
"use strict";
exports.__esModule = true;
exports.StaticProperties = exports.PromiseDependenciesWithIterators = exports.PromiseDependencies = exports.InstanceProperties = exports.DecoratorMetadataDependencies = exports.CommonIterators = exports.BuiltIns = void 0;
var _data = _interopRequireDefault(require("../core-js-compat/data.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const polyfillsOrder = {};
Object.keys(_data.default).forEach((name, index) => {
polyfillsOrder[name] = index;
});
const define = (pure, global, name = global[0], exclude) => {
return {
name,
pure,
global: global.sort((a, b) => polyfillsOrder[a] - polyfillsOrder[b]),
exclude
};
};
const typed = (...modules) => define(null, [...modules, ...TypedArrayDependencies]);
const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
const CommonIterators = exports.CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
const ErrorDependencies = ["es.error.cause", "es.error.to-string"];
const SuppressedErrorDependencies = ["es.suppressed-error.constructor", ...ErrorDependencies];
const ArrayBufferDependencies = ["es.array-buffer.constructor", "es.array-buffer.slice", "es.data-view", "es.array-buffer.detached", "es.array-buffer.transfer", "es.array-buffer.transfer-to-fixed-length", "es.object.to-string"];
const TypedArrayDependencies = ["es.typed-array.at", "es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.find-last", "es.typed-array.find-last-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-reversed", "es.typed-array.to-sorted", "es.typed-array.to-string", "es.typed-array.with", "es.object.to-string", "es.array.iterator", "esnext.typed-array.filter-reject", "esnext.typed-array.group-by", "esnext.typed-array.to-spliced", "esnext.typed-array.unique-by", ...ArrayBufferDependencies];
const PromiseDependencies = exports.PromiseDependencies = ["es.promise", "es.object.to-string"];
const PromiseDependenciesWithIterators = exports.PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
const MapDependencies = ["es.map", "es.map.get-or-insert", "es.map.get-or-insert-computed", "esnext.map.delete-all", "esnext.map.emplace", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
const SetDependencies = ["es.set", "es.set.difference.v2", "es.set.intersection.v2", "es.set.is-disjoint-from.v2", "es.set.is-subset-of.v2", "es.set.is-superset-of.v2", "es.set.symmetric-difference.v2", "es.set.union.v2", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
const WeakMapDependencies = ["es.weak-map", "es.weak-map.get-or-insert", "es.weak-map.get-or-insert-computed", "esnext.weak-map.delete-all", "esnext.weak-map.emplace", ...CommonIteratorsWithTag];
const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
const DOMExceptionDependencies = ["web.dom-exception.constructor", "web.dom-exception.stack", "web.dom-exception.to-string-tag", "es.error.to-string"];
const URLSearchParamsDependencies = ["web.url-search-params", "web.url-search-params.delete", "web.url-search-params.has", "web.url-search-params.size", ...CommonIteratorsWithTag];
const AsyncIteratorDependencies = ["esnext.async-iterator.constructor", ...PromiseDependencies];
const AsyncIteratorProblemMethods = ["esnext.async-iterator.every", "esnext.async-iterator.filter", "esnext.async-iterator.find", "esnext.async-iterator.flat-map", "esnext.async-iterator.for-each", "esnext.async-iterator.map", "esnext.async-iterator.reduce", "esnext.async-iterator.some"];
const IteratorDependencies = ["es.iterator.constructor", "es.object.to-string"];
const DecoratorMetadataDependencies = exports.DecoratorMetadataDependencies = ["esnext.symbol.metadata", "esnext.function.metadata"];
const TypedArrayStaticMethods = base => ({
from: define(null, ["es.typed-array.from", base, ...TypedArrayDependencies]),
fromAsync: define(null, ["esnext.typed-array.from-async", base, ...PromiseDependenciesWithIterators, ...TypedArrayDependencies]),
of: define(null, ["es.typed-array.of", base, ...TypedArrayDependencies])
});
const DataViewDependencies = ["es.data-view", ...ArrayBufferDependencies];
const BuiltIns = exports.BuiltIns = {
AsyncDisposableStack: define("async-disposable-stack/index", ["es.async-disposable-stack.constructor", "es.object.to-string", "es.async-iterator.async-dispose", "es.iterator.dispose", ...PromiseDependencies, ...SuppressedErrorDependencies]),
AsyncIterator: define("async-iterator/index", AsyncIteratorDependencies),
AggregateError: define("aggregate-error", ["es.aggregate-error", ...ErrorDependencies, ...CommonIteratorsWithTag, "es.aggregate-error.cause"]),
ArrayBuffer: define(null, ArrayBufferDependencies),
DataView: define(null, DataViewDependencies),
Date: define(null, ["es.date.to-string"]),
DOMException: define("dom-exception/index", DOMExceptionDependencies),
DisposableStack: define("disposable-stack/index", ["es.disposable-stack.constructor", "es.object.to-string", "es.iterator.dispose", ...SuppressedErrorDependencies]),
Error: define(null, ErrorDependencies),
EvalError: define(null, ErrorDependencies),
Float32Array: typed("es.typed-array.float32-array"),
Float64Array: typed("es.typed-array.float64-array"),
Int8Array: typed("es.typed-array.int8-array"),
Int16Array: typed("es.typed-array.int16-array"),
Int32Array: typed("es.typed-array.int32-array"),
Iterator: define("iterator/index", IteratorDependencies),
Uint8Array: typed("es.typed-array.uint8-array", "es.uint8-array.set-from-base64", "es.uint8-array.set-from-hex", "es.uint8-array.to-base64", "es.uint8-array.to-hex"),
Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
Uint16Array: typed("es.typed-array.uint16-array"),
Uint32Array: typed("es.typed-array.uint32-array"),
Map: define("map/index", MapDependencies),
Number: define(null, ["es.number.constructor"]),
Observable: define("observable/index", ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag]),
Promise: define("promise/index", PromiseDependencies),
RangeError: define(null, ErrorDependencies),
ReferenceError: define(null, ErrorDependencies),
Reflect: define(null, ["es.reflect.to-string-tag", "es.object.to-string"]),
RegExp: define(null, ["es.regexp.constructor", "es.regexp.dot-all", "es.regexp.exec", "es.regexp.sticky", "es.regexp.to-string"]),
Set: define("set/index", SetDependencies),
SuppressedError: define("suppressed-error", SuppressedErrorDependencies),
Symbol: define("symbol/index", SymbolDependencies),
SyntaxError: define(null, ErrorDependencies),
TypeError: define(null, ErrorDependencies),
URIError: define(null, ErrorDependencies),
URL: define("url/index", ["web.url", "web.url.to-json", ...URLSearchParamsDependencies]),
URLSearchParams: define("url-search-params/index", URLSearchParamsDependencies),
WeakMap: define("weak-map/index", WeakMapDependencies),
WeakSet: define("weak-set/index", WeakSetDependencies),
atob: define("atob", ["web.atob", ...DOMExceptionDependencies]),
btoa: define("btoa", ["web.btoa", ...DOMExceptionDependencies]),
clearImmediate: define("clear-immediate", ["web.immediate"]),
compositeKey: define("composite-key", ["esnext.composite-key"]),
compositeSymbol: define("composite-symbol", ["esnext.composite-symbol"]),
escape: define("escape", ["es.escape"]),
fetch: define(null, PromiseDependencies),
globalThis: define("global-this", ["es.global-this"]),
parseFloat: define("parse-float", ["es.parse-float"]),
parseInt: define("parse-int", ["es.parse-int"]),
queueMicrotask: define("queue-microtask", ["web.queue-microtask"]),
self: define("self", ["web.self"]),
setImmediate: define("set-immediate", ["web.immediate"]),
setInterval: define("set-interval", ["web.timers"]),
setTimeout: define("set-timeout", ["web.timers"]),
structuredClone: define("structured-clone", ["web.structured-clone", ...DOMExceptionDependencies, "es.array.iterator", "es.object.keys", "es.object.to-string", "es.map", "es.set"]),
unescape: define("unescape", ["es.unescape"])
};
const StaticProperties = exports.StaticProperties = {
AsyncIterator: {
from: define("async-iterator/from", ["esnext.async-iterator.from", ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods, ...CommonIterators])
},
Array: {
from: define("array/from", ["es.array.from", "es.string.iterator"]),
fromAsync: define("array/from-async", ["es.array.from-async", ...PromiseDependenciesWithIterators]),
isArray: define("array/is-array", ["es.array.is-array"]),
isTemplateObject: define("array/is-template-object", ["esnext.array.is-template-object"]),
of: define("array/of", ["es.array.of"])
},
ArrayBuffer: {
isView: define(null, ["es.array-buffer.is-view"])
},
BigInt: {
range: define("bigint/range", ["esnext.bigint.range", "es.object.to-string"])
},
Date: {
now: define("date/now", ["es.date.now"])
},
Error: {
isError: define("error/is-error", ["es.error.is-error", "es.object.create"])
},
Function: {
isCallable: define("function/is-callable", ["esnext.function.is-callable"]),
isConstructor: define("function/is-constructor", ["esnext.function.is-constructor"])
},
Iterator: {
concat: define("iterator/concat", ["es.iterator.concat", ...IteratorDependencies, ...CommonIterators]),
from: define("iterator/from", ["es.iterator.from", ...IteratorDependencies, ...CommonIterators]),
range: define("iterator/range", ["esnext.iterator.range", ...IteratorDependencies]),
zip: define("iterator/zip", ["esnext.iterator.zip", ...IteratorDependencies, ...CommonIterators]),
zipKeyed: define("iterator/zip-keyed", ["esnext.iterator.zip-keyed", "es.object.create", "es.reflect.own-keys", ...IteratorDependencies, ...CommonIterators])
},
JSON: {
isRawJSON: define("json/is-raw-json", ["es.json.is-raw-json"]),
parse: define("json/parse", ["es.json.parse", "es.object.keys"]),
rawJSON: define("json/raw-json", ["es.json.raw-json", "es.object.create", "es.object.freeze"]),
stringify: define("json/stringify", ["es.json.stringify", "es.date.to-json"])
},
Math: {
DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]),
RAD_PER_DEG: define("math/rad-per-deg", ["esnext.math.rad-per-deg"]),
acosh: define("math/acosh", ["es.math.acosh"]),
asinh: define("math/asinh", ["es.math.asinh"]),
atanh: define("math/atanh", ["es.math.atanh"]),
cbrt: define("math/cbrt", ["es.math.cbrt"]),
clamp: define("math/clamp", ["esnext.math.clamp"]),
clz32: define("math/clz32", ["es.math.clz32"]),
cosh: define("math/cosh", ["es.math.cosh"]),
degrees: define("math/degrees", ["esnext.math.degrees"]),
expm1: define("math/expm1", ["es.math.expm1"]),
fround: define("math/fround", ["es.math.fround"]),
f16round: define("math/f16round", ["es.math.f16round"]),
fscale: define("math/fscale", ["esnext.math.fscale"]),
hypot: define("math/hypot", ["es.math.hypot"]),
iaddh: define("math/iaddh", ["esnext.math.iaddh"]),
imul: define("math/imul", ["es.math.imul"]),
imulh: define("math/imulh", ["esnext.math.imulh"]),
isubh: define("math/isubh", ["esnext.math.isubh"]),
log10: define("math/log10", ["es.math.log10"]),
log1p: define("math/log1p", ["es.math.log1p"]),
log2: define("math/log2", ["es.math.log2"]),
radians: define("math/radians", ["esnext.math.radians"]),
scale: define("math/scale", ["esnext.math.scale"]),
seededPRNG: define("math/seeded-prng", ["esnext.math.seeded-prng"]),
sign: define("math/sign", ["es.math.sign"]),
signbit: define("math/signbit", ["esnext.math.signbit"]),
sinh: define("math/sinh", ["es.math.sinh"]),
sumPrecise: define("math/sum-precise", ["es.math.sum-precise", "es.array.iterator"]),
tanh: define("math/tanh", ["es.math.tanh"]),
trunc: define("math/trunc", ["es.math.trunc"]),
umulh: define("math/umulh", ["esnext.math.umulh"])
},
Map: {
from: define("map/from", ["esnext.map.from", ...MapDependencies]),
groupBy: define("map/group-by", ["es.map.group-by", ...MapDependencies]),
keyBy: define("map/key-by", ["esnext.map.key-by", ...MapDependencies]),
of: define("map/of", ["esnext.map.of", ...MapDependencies])
},
Number: {
EPSILON: define("number/epsilon", ["es.number.epsilon"]),
MAX_SAFE_INTEGER: define("number/max-safe-integer", ["es.number.max-safe-integer"]),
MIN_SAFE_INTEGER: define("number/min-safe-integer", ["es.number.min-safe-integer"]),
fromString: define("number/from-string", ["esnext.number.from-string"]),
isFinite: define("number/is-finite", ["es.number.is-finite"]),
isInteger: define("number/is-integer", ["es.number.is-integer"]),
isNaN: define("number/is-nan", ["es.number.is-nan"]),
isSafeInteger: define("number/is-safe-integer", ["es.number.is-safe-integer"]),
parseFloat: define("number/parse-float", ["es.number.parse-float"]),
parseInt: define("number/parse-int", ["es.number.parse-int"]),
range: define("number/range", ["esnext.number.range", "es.object.to-string"])
},
Object: {
assign: define("object/assign", ["es.object.assign"]),
create: define("object/create", ["es.object.create"]),
defineProperties: define("object/define-properties", ["es.object.define-properties"]),
defineProperty: define("object/define-property", ["es.object.define-property"]),
entries: define("object/entries", ["es.object.entries"]),
freeze: define("object/freeze", ["es.object.freeze"]),
fromEntries: define("object/from-entries", ["es.object.from-entries", "es.array.iterator"]),
getOwnPropertyDescriptor: define("object/get-own-property-descriptor", ["es.object.get-own-property-descriptor"]),
getOwnPropertyDescriptors: define("object/get-own-property-descriptors", ["es.object.get-own-property-descriptors"]),
getOwnPropertyNames: define("object/get-own-property-names", ["es.object.get-own-property-names"]),
getOwnPropertySymbols: define("object/get-own-property-symbols", ["es.symbol"]),
getPrototypeOf: define("object/get-prototype-of", ["es.object.get-prototype-of"]),
groupBy: define("object/group-by", ["es.object.group-by", "es.object.create"]),
hasOwn: define("object/has-own", ["es.object.has-own"]),
is: define("object/is", ["es.object.is"]),
isExtensible: define("object/is-extensible", ["es.object.is-extensible"]),
isFrozen: define("object/is-frozen", ["es.object.is-frozen"]),
isSealed: define("object/is-sealed", ["es.object.is-sealed"]),
keys: define("object/keys", ["es.object.keys"]),
preventExtensions: define("object/prevent-extensions", ["es.object.prevent-extensions"]),
seal: define("object/seal", ["es.object.seal"]),
setPrototypeOf: define("object/set-prototype-of", ["es.object.set-prototype-of"]),
values: define("object/values", ["es.object.values"])
},
Promise: {
all: define(null, PromiseDependenciesWithIterators),
allSettled: define("promise/all-settled", ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
any: define("promise/any", ["es.promise.any", "es.aggregate-error", ...PromiseDependenciesWithIterators]),
race: define(null, PromiseDependenciesWithIterators),
try: define("promise/try", ["es.promise.try", ...PromiseDependencies]),
withResolvers: define("promise/with-resolvers", ["es.promise.with-resolvers", ...PromiseDependencies])
},
Reflect: {
apply: define("reflect/apply", ["es.reflect.apply"]),
construct: define("reflect/construct", ["es.reflect.construct"]),
defineMetadata: define("reflect/define-metadata", ["esnext.reflect.define-metadata"]),
defineProperty: define("reflect/define-property", ["es.reflect.define-property"]),
deleteMetadata: define("reflect/delete-metadata", ["esnext.reflect.delete-metadata"]),
deleteProperty: define("reflect/delete-property", ["es.reflect.delete-property"]),
get: define("reflect/get", ["es.reflect.get"]),
getMetadata: define("reflect/get-metadata", ["esnext.reflect.get-metadata"]),
getMetadataKeys: define("reflect/get-metadata-keys", ["esnext.reflect.get-metadata-keys"]),
getOwnMetadata: define("reflect/get-own-metadata", ["esnext.reflect.get-own-metadata"]),
getOwnMetadataKeys: define("reflect/get-own-metadata-keys", ["esnext.reflect.get-own-metadata-keys"]),
getOwnPropertyDescriptor: define("reflect/get-own-property-descriptor", ["es.reflect.get-own-property-descriptor"]),
getPrototypeOf: define("reflect/get-prototype-of", ["es.reflect.get-prototype-of"]),
has: define("reflect/has", ["es.reflect.has"]),
hasMetadata: define("reflect/has-metadata", ["esnext.reflect.has-metadata"]),
hasOwnMetadata: define("reflect/has-own-metadata", ["esnext.reflect.has-own-metadata"]),
isExtensible: define("reflect/is-extensible", ["es.reflect.is-extensible"]),
metadata: define("reflect/metadata", ["esnext.reflect.metadata"]),
ownKeys: define("reflect/own-keys", ["es.reflect.own-keys"]),
preventExtensions: define("reflect/prevent-extensions", ["es.reflect.prevent-extensions"]),
set: define("reflect/set", ["es.reflect.set"]),
setPrototypeOf: define("reflect/set-prototype-of", ["es.reflect.set-prototype-of"])
},
RegExp: {
escape: define("regexp/escape", ["es.regexp.escape"])
},
Set: {
from: define("set/from", ["esnext.set.from", ...SetDependencies]),
of: define("set/of", ["esnext.set.of", ...SetDependencies])
},
String: {
cooked: define("string/cooked", ["esnext.string.cooked"]),
dedent: define("string/dedent", ["esnext.string.dedent", "es.string.from-code-point", "es.weak-map"]),
fromCodePoint: define("string/from-code-point", ["es.string.from-code-point"]),
raw: define("string/raw", ["es.string.raw"])
},
Symbol: {
asyncDispose: define("symbol/async-dispose", ["es.symbol.async-dispose", "es.async-iterator.async-dispose"]),
asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
customMatcher: define("symbol/custom-matcher", ["esnext.symbol.custom-matcher"]),
dispose: define("symbol/dispose", ["es.symbol.dispose", "es.iterator.dispose"]),
for: define("symbol/for", [], "es.symbol"),
hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
isConcatSpreadable: define("symbol/is-concat-spreadable", ["es.symbol.is-concat-spreadable", "es.array.concat"]),
isRegistered: define("symbol/is-registered", ["esnext.symbol.is-registered", "es.symbol"]),
isRegisteredSymbol: define("symbol/is-registered-symbol", ["esnext.symbol.is-registered-symbol", "es.symbol"]),
isWellKnown: define("symbol/is-well-known", ["esnext.symbol.is-well-known", "es.symbol"]),
isWellKnownSymbol: define("symbol/is-well-known-symbol", ["esnext.symbol.is-well-known-symbol", "es.symbol"]),
iterator: define("symbol/iterator", ["es.symbol.iterator", ...CommonIteratorsWithTag]),
keyFor: define("symbol/key-for", [], "es.symbol"),
match: define("symbol/match", ["es.symbol.match", "es.string.match"]),
matcher: define("symbol/matcher", ["esnext.symbol.matcher"]),
matchAll: define("symbol/match-all", ["es.symbol.match-all", "es.string.match-all"]),
metadata: define("symbol/metadata", DecoratorMetadataDependencies),
metadataKey: define("symbol/metadata-key", ["esnext.symbol.metadata-key"]),
observable: define("symbol/observable", ["esnext.symbol.observable"]),
patternMatch: define("symbol/pattern-match", ["esnext.symbol.pattern-match"]),
replace: define("symbol/replace", ["es.symbol.replace", "es.string.replace"]),
search: define("symbol/search", ["es.symbol.search", "es.string.search"]),
species: define("symbol/species", ["es.symbol.species", "es.array.species"]),
split: define("symbol/split", ["es.symbol.split", "es.string.split"]),
toPrimitive: define("symbol/to-primitive", ["es.symbol.to-primitive", "es.date.to-primitive"]),
toStringTag: define("symbol/to-string-tag", ["es.symbol.to-string-tag", "es.object.to-string", "es.math.to-string-tag", "es.json.to-string-tag"]),
unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
},
URL: {
canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
parse: define("url/parse", ["web.url.parse", "web.url"])
},
WeakMap: {
from: define("weak-map/from", ["esnext.weak-map.from", ...WeakMapDependencies]),
of: define("weak-map/of", ["esnext.weak-map.of", ...WeakMapDependencies])
},
WeakSet: {
from: define("weak-set/from", ["esnext.weak-set.from", ...WeakSetDependencies]),
of: define("weak-set/of", ["esnext.weak-set.of", ...WeakSetDependencies])
},
Int8Array: TypedArrayStaticMethods("es.typed-array.int8-array"),
Uint8Array: _extends({
fromBase64: define(null, ["es.uint8-array.from-base64", ...TypedArrayDependencies]),
fromHex: define(null, ["es.uint8-array.from-hex", ...TypedArrayDependencies])
}, TypedArrayStaticMethods("es.typed-array.uint8-array")),
Uint8ClampedArray: TypedArrayStaticMethods("es.typed-array.uint8-clamped-array"),
Int16Array: TypedArrayStaticMethods("es.typed-array.int16-array"),
Uint16Array: TypedArrayStaticMethods("es.typed-array.uint16-array"),
Int32Array: TypedArrayStaticMethods("es.typed-array.int32-array"),
Uint32Array: TypedArrayStaticMethods("es.typed-array.uint32-array"),
Float32Array: TypedArrayStaticMethods("es.typed-array.float32-array"),
Float64Array: TypedArrayStaticMethods("es.typed-array.float64-array"),
WebAssembly: {
CompileError: define(null, ErrorDependencies),
LinkError: define(null, ErrorDependencies),
RuntimeError: define(null, ErrorDependencies)
}
};
["AggregateError", "EvalError", "RangeError", "ReferenceError", "SuppressedError", "SyntaxError", "TypeError", "URIError"].forEach(ERROR_SUBCLASS => {
StaticProperties[ERROR_SUBCLASS] = StaticProperties.Error;
});
const InstanceProperties = exports.InstanceProperties = {
asIndexedPairs: define(null, ["esnext.async-iterator.as-indexed-pairs", ...AsyncIteratorDependencies, "esnext.iterator.as-indexed-pairs", ...IteratorDependencies]),
at: define("instance/at", [
// TODO: We should introduce overloaded instance methods definition
// Before that is implemented, the `esnext.string.at` must be the first
// In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
// and treats the compat-data of `esnext.string.at` as the compat-data of
// pure import `instance/at`. The first polyfill here should have the lowest corejs
// supported versions.
"esnext.string.at", "es.string.at-alternative", "es.array.at"]),
anchor: define(null, ["es.string.anchor"]),
big: define(null, ["es.string.big"]),
bind: define("instance/bind", ["es.function.bind"]),
blink: define(null, ["es.string.blink"]),
bold: define(null, ["es.string.bold"]),
chunks: define(null, ["esnext.iterator.chunks", ...IteratorDependencies]),
clamp: define("instance/clamp", ["esnext.number.clamp"]),
codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
codePoints: define("instance/code-points", ["esnext.string.code-points"]),
concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
description: define(null, ["es.symbol", "es.symbol.description"]),
dotAll: define(null, ["es.regexp.dot-all"]),
drop: define(null, ["es.iterator.drop", ...IteratorDependencies, "esnext.async-iterator.drop", ...AsyncIteratorDependencies]),
endsWith: define("instance/ends-with", ["es.string.ends-with"]),
entries: define("instance/entries", ArrayNatureIteratorsWithTag),
every: define("instance/every", ["es.array.every", "es.iterator.every", ...IteratorDependencies
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// "esnext.async-iterator.every",
// ...AsyncIteratorDependencies
]),
exec: define(null, ["es.regexp.exec"]),
fill: define("instance/fill", ["es.array.fill"]),
filter: define("instance/filter", ["es.array.filter", "es.iterator.filter", ...IteratorDependencies
// "esnext.async-iterator.filter",
]),
filterReject: define("instance/filter-reject", ["esnext.array.filter-reject"]),
finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
find: define("instance/find", ["es.array.find", "es.iterator.find", ...IteratorDependencies
// "esnext.async-iterator.find",
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
findLastIndex: define("instance/find-last-index", ["es.array.find-last-index"]),
fixed: define(null, ["es.string.fixed"]),
flags: define("instance/flags", ["es.regexp.flags"]),
flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map", "es.iterator.flat-map", ...IteratorDependencies
// "esnext.async-iterator.flat-map",
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getFloat16: define(null, ["es.data-view.get-float16", ...DataViewDependencies]),
getUint8Clamped: define(null, ["esnext.data-view.get-uint8-clamped", ...DataViewDependencies]),
getYear: define(null, ["es.date.get-year"]),
group: define("instance/group", ["esnext.array.group"]),
groupBy: define("instance/group-by", ["esnext.array.group-by"]),
groupByToMap: define("instance/group-by-to-map", ["esnext.array.group-by-to-map", "es.map", "es.object.to-string"]),
groupToMap: define("instance/group-to-map", ["esnext.array.group-to-map", "es.map", "es.object.to-string"]),
fontcolor: define(null, ["es.string.fontcolor"]),
fontsize: define(null, ["es.string.fontsize"]),
forEach: define("instance/for-each", ["es.array.for-each", "es.iterator.for-each", ...IteratorDependencies,
// "esnext.async-iterator.for-each",
"web.dom-collections.for-each"]),
includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
indexed: define(null, ["esnext.async-iterator.indexed", ...AsyncIteratorDependencies, "esnext.iterator.indexed", ...IteratorDependencies]),
indexOf: define("instance/index-of", ["es.array.index-of"]),
isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
italics: define(null, ["es.string.italics"]),
join: define(null, ["es.array.join"]),
keys: define("instance/keys", ArrayNatureIteratorsWithTag),
lastIndex: define(null, ["esnext.array.last-index"]),
lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
lastItem: define(null, ["esnext.array.last-item"]),
link: define(null, ["es.string.link"]),
map: define("instance/map", ["es.array.map", "es.iterator.map", ...IteratorDependencies
// "esnext.async-iterator.map",
]),
match: define(null, ["es.string.match", "es.regexp.exec"]),
matchAll: define("instance/match-all", ["es.string.match-all", "es.regexp.exec"]),
name: define(null, ["es.function.name"]),
padEnd: define("instance/pad-end", ["es.string.pad-end"]),
padStart: define("instance/pad-start", ["es.string.pad-start"]),
push: define("instance/push", ["es.array.push"]),
reduce: define("instance/reduce", ["es.array.reduce", "es.iterator.reduce", ...IteratorDependencies
// "esnext.async-iterator.reduce",
]),
reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
repeat: define("instance/repeat", ["es.string.repeat"]),
replace: define(null, ["es.string.replace", "es.regexp.exec"]),
replaceAll: define("instance/replace-all", ["es.string.replace-all", "es.string.replace", "es.regexp.exec"]),
reverse: define("instance/reverse", ["es.array.reverse"]),
search: define(null, ["es.string.search", "es.regexp.exec"]),
setFloat16: define(null, ["es.data-view.set-float16", ...DataViewDependencies]),
setUint8Clamped: define(null, ["esnext.data-view.set-uint8-clamped", ...DataViewDependencies]),
setYear: define(null, ["es.date.set-year"]),
slice: define("instance/slice", ["es.array.slice"]),
sliding: define(null, ["esnext.iterator.sliding", ...IteratorDependencies]),
small: define(null, ["es.string.small"]),
some: define("instance/some", ["es.array.some", "es.iterator.some", ...IteratorDependencies
// "esnext.async-iterator.some",
]),
sort: define("instance/sort", ["es.array.sort"]),
splice: define("instance/splice", ["es.array.splice"]),
split: define(null, ["es.string.split", "es.regexp.exec"]),
startsWith: define("instance/starts-with", ["es.string.starts-with"]),
sticky: define(null, ["es.regexp.sticky"]),
strike: define(null, ["es.string.strike"]),
sub: define(null, ["es.string.sub"]),
substr: define(null, ["es.string.substr"]),
sup: define(null, ["es.string.sup"]),
take: define(null, ["es.iterator.take", ...IteratorDependencies, "esnext.async-iterator.take", ...AsyncIteratorDependencies]),
test: define(null, ["es.regexp.test", "es.regexp.exec"]),
toArray: define(null, ["es.iterator.to-array", ...IteratorDependencies, "esnext.async-iterator.to-array", ...AsyncIteratorDependencies]),
toAsync: define(null, ["esnext.iterator.to-async", ...IteratorDependencies, ...AsyncIteratorDependencies, ...AsyncIteratorProblemMethods]),
toExponential: define(null, ["es.number.to-exponential"]),
toFixed: define(null, ["es.number.to-fixed"]),
toGMTString: define(null, ["es.date.to-gmt-string"]),
toISOString: define(null, ["es.date.to-iso-string"]),
toJSON: define(null, ["es.date.to-json"]),
toPrecision: define(null, ["es.number.to-precision"]),
toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
toSorted: define("instance/to-sorted", ["es.array.to-sorted", "es.array.sort"]),
toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
toString: define(null, ["es.object.to-string", "es.error.to-string", "es.date.to-string", "es.regexp.to-string"]),
toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
trim: define("instance/trim", ["es.string.trim"]),
trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
trimRight: define("instance/trim-right", ["es.string.trim-end"]),
trimStart: define("instance/trim-start", ["es.string.trim-start"]),
uniqueBy: define("instance/unique-by", ["esnext.array.unique-by", "es.map"]),
unshift: define("instance/unshift", ["es.array.unshift"]),
unThis: define("instance/un-this", ["esnext.function.un-this"]),
values: define("instance/values", ArrayNatureIteratorsWithTag),
windows: define(null, ["esnext.iterator.windows", ...IteratorDependencies]),
with: define("instance/with", ["es.array.with"]),
__defineGetter__: define(null, ["es.object.define-getter"]),
__defineSetter__: define(null, ["es.object.define-setter"]),
__lookupGetter__: define(null, ["es.object.lookup-getter"]),
__lookupSetter__: define(null, ["es.object.lookup-setter"]),
["__proto__"]: define(null, ["es.object.proto"])
};

View File

@@ -0,0 +1,309 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _data = _interopRequireDefault(require("../core-js-compat/data.js"));
var _shippedProposals = _interopRequireDefault(require("./shipped-proposals"));
var _getModulesListForTargetVersion = _interopRequireDefault(require("../core-js-compat/get-modules-list-for-target-version.js"));
var _builtInDefinitions = require("./built-in-definitions");
var BabelRuntimePaths = _interopRequireWildcard(require("./babel-runtime-corejs3-paths"));
var _usageFilters = _interopRequireDefault(require("./usage-filters"));
var _babel = _interopRequireWildcard(require("@babel/core"));
var _utils = require("./utils");
var _helperDefinePolyfillProvider = _interopRequireDefault(require("@babel/helper-define-polyfill-provider"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
const {
types: t,
template: template
} = _babel.default || _babel;
const presetEnvCompat = "#__secret_key__@babel/preset-env__compatibility";
const runtimeCompat = "#__secret_key__@babel/runtime__compatibility";
const uniqueObjects = ["array", "string", "iterator", "async-iterator", "dom-collections"].map(v => new RegExp(`[a-z]*\\.${v}\\..*`));
const esnextFallback = (name, cb) => {
if (cb(name)) return true;
if (!name.startsWith("es.")) return false;
const fallback = `esnext.${name.slice(3)}`;
if (!_data.default[fallback]) return false;
return cb(fallback);
};
var _default = exports.default = (0, _helperDefinePolyfillProvider.default)(function ({
getUtils,
method,
shouldInjectPolyfill,
createMetaResolver,
debug,
babel
}, {
version = 3,
proposals,
shippedProposals,
[presetEnvCompat]: {
noRuntimeName = false
} = {},
[runtimeCompat]: {
useBabelRuntime = false,
ext = ".js"
} = {}
}) {
const isWebpack = babel.caller(caller => (caller == null ? void 0 : caller.name) === "babel-loader");
const resolve = createMetaResolver({
global: _builtInDefinitions.BuiltIns,
static: _builtInDefinitions.StaticProperties,
instance: _builtInDefinitions.InstanceProperties
});
const available = new Set((0, _getModulesListForTargetVersion.default)(version));
function getCoreJSPureBase(useProposalBase) {
return useBabelRuntime ? useProposalBase ? `${_utils.BABEL_RUNTIME}/core-js` : `${_utils.BABEL_RUNTIME}/core-js-stable` : useProposalBase ? "core-js-pure/features" : "core-js-pure/stable";
}
function maybeInjectGlobalImpl(name, utils) {
if (shouldInjectPolyfill(name)) {
debug(name);
utils.injectGlobalImport((0, _utils.coreJSModule)(name), name);
return true;
}
return false;
}
function maybeInjectGlobal(names, utils, fallback = true) {
for (const name of names) {
if (fallback) {
esnextFallback(name, name => maybeInjectGlobalImpl(name, utils));
} else {
maybeInjectGlobalImpl(name, utils);
}
}
}
function maybeInjectPure(desc, hint, utils, object) {
if (desc.pure && !(object && desc.exclude && desc.exclude.includes(object)) && esnextFallback(desc.name, shouldInjectPolyfill)) {
const {
name
} = desc;
let useProposalBase = false;
if (proposals || shippedProposals && name.startsWith("esnext.")) {
useProposalBase = true;
} else if (name.startsWith("es.") && !available.has(name)) {
useProposalBase = true;
}
if (useBabelRuntime && !(useProposalBase ? BabelRuntimePaths.proposals : BabelRuntimePaths.stable).has(desc.pure)) {
return;
}
const coreJSPureBase = getCoreJSPureBase(useProposalBase);
return utils.injectDefaultImport(`${coreJSPureBase}/${desc.pure}${ext}`, hint);
}
}
function isFeatureStable(name) {
if (name.startsWith("esnext.")) {
const esName = `es.${name.slice(7)}`;
// If its imaginative esName is not in latest compat data, it means
// the proposal is not stage 4
return esName in _data.default;
}
return true;
}
return {
name: "corejs3",
runtimeName: noRuntimeName ? null : _utils.BABEL_RUNTIME,
polyfills: _data.default,
filterPolyfills(name) {
if (!available.has(name)) return false;
if (proposals || method === "entry-global") return true;
if (shippedProposals && _shippedProposals.default.has(name)) {
return true;
}
return isFeatureStable(name);
},
entryGlobal(meta, utils, path) {
if (meta.kind !== "import") return;
const modules = (0, _utils.isCoreJSSource)(meta.source);
if (!modules) return;
if (modules.length === 1 && meta.source === (0, _utils.coreJSModule)(modules[0]) && shouldInjectPolyfill(modules[0])) {
// Avoid infinite loop: do not replace imports with a new copy of
// themselves.
debug(null);
return;
}
const modulesSet = new Set(modules);
const filteredModules = modules.filter(module => {
if (!module.startsWith("esnext.")) return true;
const stable = module.replace("esnext.", "es.");
if (modulesSet.has(stable) && shouldInjectPolyfill(stable)) {
return false;
}
return true;
});
maybeInjectGlobal(filteredModules, utils, false);
path.remove();
},
usageGlobal(meta, utils, path) {
const resolved = resolve(meta);
if (!resolved) return;
if ((0, _usageFilters.default)(resolved.desc, path)) return;
let deps = resolved.desc.global;
if (resolved.kind !== "global" && "object" in meta && meta.object && meta.placement === "prototype") {
const low = meta.object.toLowerCase();
deps = deps.filter(m => uniqueObjects.some(v => v.test(m)) ? m.includes(low) : true);
}
maybeInjectGlobal(deps, utils);
return true;
},
usagePure(meta, utils, path) {
if (meta.kind === "in") {
if (meta.key === "Symbol.iterator") {
path.replaceWith(t.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("is-iterable", useBabelRuntime, ext), "isIterable"), [path.node.right] // meta.kind === "in" narrows this
));
}
return;
}
if (path.parentPath.isUnaryExpression({
operator: "delete"
})) return;
if (meta.kind === "property") {
// We can't compile destructuring and updateExpression.
if (!path.isMemberExpression() && !path.isOptionalMemberExpression()) {
return;
}
if (!path.isReferenced()) return;
if (path.parentPath.isUpdateExpression()) return;
if (t.isSuper(path.node.object)) {
return;
}
if (meta.key === "Symbol.iterator") {
if (!shouldInjectPolyfill("es.symbol.iterator")) return;
const {
parent,
node
} = path;
if (t.isCallExpression(parent, {
callee: node
})) {
if (parent.arguments.length === 0) {
path.parentPath.replaceWith(t.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator", useBabelRuntime, ext), "getIterator"), [node.object]));
path.skip();
} else {
(0, _utils.callMethod)(path, utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"));
}
} else {
path.replaceWith(t.callExpression(utils.injectDefaultImport((0, _utils.coreJSPureHelper)("get-iterator-method", useBabelRuntime, ext), "getIteratorMethod"), [path.node.object]));
}
return;
}
}
let resolved = resolve(meta);
if (!resolved) return;
if ((0, _usageFilters.default)(resolved.desc, path)) return;
if (useBabelRuntime && resolved.desc.pure && resolved.desc.pure.slice(-6) === "/index") {
// Remove /index, since it doesn't exist in @babel/runtime-corejs3s
resolved = _extends({}, resolved, {
desc: _extends({}, resolved.desc, {
pure: resolved.desc.pure.slice(0, -6)
})
});
}
if (resolved.kind === "global") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils);
if (id) path.replaceWith(id);
} else if (resolved.kind === "static") {
const id = maybeInjectPure(resolved.desc, resolved.name, utils,
// @ts-expect-error
meta.object);
if (id) {
path.replaceWith(id);
let {
parentPath
} = path;
if (parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) {
do {
const parentAsNotOptional = parentPath;
parentAsNotOptional.type = parentAsNotOptional.node.type = parentPath.type === "OptionalMemberExpression" ? "MemberExpression" : "CallExpression";
delete parentAsNotOptional.node.optional;
({
parentPath
} = parentPath);
} while ((parentPath.isOptionalMemberExpression() || parentPath.isOptionalCallExpression()) && !parentPath.node.optional);
}
}
} else if (resolved.kind === "instance") {
const id = maybeInjectPure(resolved.desc, `${resolved.name}InstanceProperty`, utils,
// @ts-expect-error
meta.object);
if (!id) return;
const {
node,
parent
} = path;
if (t.isOptionalCallExpression(parent) && parent.callee === node) {
const wasOptional = parent.optional;
parent.optional = !wasOptional;
if (!wasOptional) {
const check = (0, _utils.extractOptionalCheck)(path.scope, node);
const [thisArg, thisArg2] = (0, _utils.maybeMemoizeContext)(node, path.scope);
path.replaceWith(check(template.expression.ast`
Function.call.bind(${id}(${thisArg}), ${thisArg2})
`));
} else if (t.isOptionalMemberExpression(node)) {
const check = (0, _utils.extractOptionalCheck)(path.scope, node);
(0, _utils.callMethod)(path, id, true, check);
} else {
(0, _utils.callMethod)(path, id, true);
}
} else if (t.isCallExpression(parent) && parent.callee === node) {
(0, _utils.callMethod)(path, id, false);
} else if (t.isOptionalMemberExpression(node)) {
const check = (0, _utils.extractOptionalCheck)(path.scope, node);
path.replaceWith(check(t.callExpression(id, [node.object])));
if (t.isOptionalMemberExpression(parent)) parent.optional = true;
} else {
path.replaceWith(t.callExpression(id, [node.object]));
}
}
},
visitor: method === "usage-global" && {
// import("foo")
CallExpression(path) {
if (path.get("callee").isImport()) {
const utils = getUtils(path);
if (isWebpack) {
// Webpack uses Promise.all to handle dynamic import.
maybeInjectGlobal(_builtInDefinitions.PromiseDependenciesWithIterators, utils);
} else {
maybeInjectGlobal(_builtInDefinitions.PromiseDependencies, utils);
}
}
},
// (async function () { }).finally(...)
Function(path) {
if (path.node.async) {
maybeInjectGlobal(_builtInDefinitions.PromiseDependencies, getUtils(path));
}
},
// for-of, [a, b] = c
"ForOfStatement|ArrayPattern"(path) {
maybeInjectGlobal(_builtInDefinitions.CommonIterators, getUtils(path));
},
// [...spread]
SpreadElement(path) {
if (!path.parentPath.isObjectExpression()) {
maybeInjectGlobal(_builtInDefinitions.CommonIterators, getUtils(path));
}
},
// yield*
YieldExpression(path) {
if (path.node.delegate) {
maybeInjectGlobal(_builtInDefinitions.CommonIterators, getUtils(path));
}
},
// Decorators metadata
Class(path) {
var _path$node$decorators;
const hasDecorators = ((_path$node$decorators = path.node.decorators) == null ? void 0 : _path$node$decorators.length) || path.node.body.body.some(el => {
var _decorators;
return (_decorators = el.decorators) == null ? void 0 : _decorators.length;
});
if (hasDecorators) {
maybeInjectGlobal(_builtInDefinitions.DecoratorMetadataDependencies, getUtils(path));
}
}
}
};
});

View File

@@ -0,0 +1,6 @@
"use strict";
exports.__esModule = true;
exports.default = void 0;
// This file is automatically generated by scripts/build-corejs3-shipped-proposals.mjs
var _default = exports.default = new Set(["esnext.array.group", "esnext.array.group-to-map", "esnext.iterator.zip", "esnext.iterator.zip-keyed", "esnext.symbol.metadata"]);

View File

@@ -0,0 +1,26 @@
"use strict";
exports.__esModule = true;
exports.default = canSkipPolyfill;
var _babel = _interopRequireWildcard(require("@babel/core"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const {
types: t
} = _babel.default || _babel;
function canSkipPolyfill(desc, path) {
const {
node,
parent
} = path;
switch (desc.name) {
case "es.string.split":
{
if (!t.isCallExpression(parent, {
callee: node
})) return false;
if (parent.arguments.length < 1) return true;
const splitter = parent.arguments[0];
return t.isStringLiteral(splitter) || t.isTemplateLiteral(splitter);
}
}
}

View File

@@ -0,0 +1,63 @@
"use strict";
exports.__esModule = true;
exports.BABEL_RUNTIME = void 0;
exports.callMethod = callMethod;
exports.coreJSModule = coreJSModule;
exports.coreJSPureHelper = coreJSPureHelper;
exports.extractOptionalCheck = extractOptionalCheck;
exports.isCoreJSSource = isCoreJSSource;
exports.maybeMemoizeContext = maybeMemoizeContext;
var _babel = _interopRequireWildcard(require("@babel/core"));
var _entries = _interopRequireDefault(require("../core-js-compat/entries.js"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
const {
types: t
} = _babel.default || _babel;
const BABEL_RUNTIME = exports.BABEL_RUNTIME = "@babel/runtime-corejs3";
function callMethod(path, id, optionalCall, wrapCallee) {
const [context1, context2] = maybeMemoizeContext(path.node, path.scope);
let callee = t.callExpression(id, [context1]);
if (wrapCallee) callee = wrapCallee(callee);
const call = t.identifier("call");
path.replaceWith(optionalCall ? t.optionalMemberExpression(callee, call, false, true) : t.memberExpression(callee, call));
path.parentPath.unshiftContainer("arguments", context2);
}
function maybeMemoizeContext(node, scope) {
const {
object
} = node;
let context1, context2;
if (t.isIdentifier(object)) {
context2 = object;
context1 = t.cloneNode(object);
} else {
context2 = scope.generateDeclaredUidIdentifier("context");
context1 = t.assignmentExpression("=", t.cloneNode(context2), object);
}
return [context1, context2];
}
function extractOptionalCheck(scope, node) {
let optionalNode = node;
while (!optionalNode.optional && t.isOptionalMemberExpression(optionalNode.object)) {
optionalNode = optionalNode.object;
}
optionalNode.optional = false;
const ctx = scope.generateDeclaredUidIdentifier("context");
const assign = t.assignmentExpression("=", ctx, optionalNode.object);
optionalNode.object = t.cloneNode(ctx);
return ifNotNullish => t.conditionalExpression(t.binaryExpression("==", assign, t.nullLiteral()), t.unaryExpression("void", t.numericLiteral(0)), ifNotNullish);
}
function isCoreJSSource(source) {
if (typeof source === "string") {
source = source.replace(/\\/g, "/").replace(/(\/(index)?)?(\.js)?$/i, "").toLowerCase();
}
return Object.prototype.hasOwnProperty.call(_entries.default, source) && _entries.default[source];
}
function coreJSModule(name) {
return `core-js/modules/${name}.js`;
}
function coreJSPureHelper(name, useBabelRuntime, ext) {
return useBabelRuntime ? `${BABEL_RUNTIME}/core-js/${name}${ext}` : `core-js-pure/features/${name}.js`;
}

View File

@@ -0,0 +1,49 @@
{
"name": "babel-plugin-polyfill-corejs3",
"version": "0.14.0",
"description": "A Babel plugin to inject imports to core-js@3 polyfills",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel-polyfills.git",
"directory": "packages/babel-plugin-polyfill-corejs3"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "lib/index.js",
"exports": {
".": [
{
"import": "./esm/index.mjs",
"default": "./lib/index.js"
},
"./lib/index.js"
],
"./package.json": "./package.json"
},
"keywords": [
"babel-plugin"
],
"dependencies": {
"@babel/helper-define-polyfill-provider": "^0.6.6",
"core-js-compat": "^3.48.0"
},
"devDependencies": {
"@babel/core": "^7.28.6",
"@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/plugin-proposal-decorators": "^7.28.6",
"@babel/plugin-transform-class-properties": "^7.28.6",
"@babel/plugin-transform-classes": "^7.28.6",
"@babel/plugin-transform-for-of": "^7.27.1",
"@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/plugin-transform-runtime": "^7.28.5",
"@babel/plugin-transform-spread": "^7.28.6",
"core-js": "^3.48.0",
"core-js-pure": "^3.48.0"
},
"peerDependencies": {
"@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0"
},
"gitHead": "9b040e303af7d703a57f16d46538d1b0d5462237"
}

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/preset-env", "name": "@babel/preset-env",
"version": "7.28.6", "version": "7.29.0",
"description": "A Babel preset for each environment.", "description": "A Babel preset for each environment.",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-preset-env", "homepage": "https://babel.dev/docs/en/next/babel-preset-env",
@@ -16,7 +16,7 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/compat-data": "^7.28.6", "@babel/compat-data": "^7.29.0",
"@babel/helper-compilation-targets": "^7.28.6", "@babel/helper-compilation-targets": "^7.28.6",
"@babel/helper-plugin-utils": "^7.28.6", "@babel/helper-plugin-utils": "^7.28.6",
"@babel/helper-validator-option": "^7.27.1", "@babel/helper-validator-option": "^7.27.1",
@@ -30,7 +30,7 @@
"@babel/plugin-syntax-import-attributes": "^7.28.6", "@babel/plugin-syntax-import-attributes": "^7.28.6",
"@babel/plugin-syntax-unicode-sets-regex": "^7.18.6", "@babel/plugin-syntax-unicode-sets-regex": "^7.18.6",
"@babel/plugin-transform-arrow-functions": "^7.27.1", "@babel/plugin-transform-arrow-functions": "^7.27.1",
"@babel/plugin-transform-async-generator-functions": "^7.28.6", "@babel/plugin-transform-async-generator-functions": "^7.29.0",
"@babel/plugin-transform-async-to-generator": "^7.28.6", "@babel/plugin-transform-async-to-generator": "^7.28.6",
"@babel/plugin-transform-block-scoped-functions": "^7.27.1", "@babel/plugin-transform-block-scoped-functions": "^7.27.1",
"@babel/plugin-transform-block-scoping": "^7.28.6", "@babel/plugin-transform-block-scoping": "^7.28.6",
@@ -41,7 +41,7 @@
"@babel/plugin-transform-destructuring": "^7.28.5", "@babel/plugin-transform-destructuring": "^7.28.5",
"@babel/plugin-transform-dotall-regex": "^7.28.6", "@babel/plugin-transform-dotall-regex": "^7.28.6",
"@babel/plugin-transform-duplicate-keys": "^7.27.1", "@babel/plugin-transform-duplicate-keys": "^7.27.1",
"@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.28.6", "@babel/plugin-transform-duplicate-named-capturing-groups-regex": "^7.29.0",
"@babel/plugin-transform-dynamic-import": "^7.27.1", "@babel/plugin-transform-dynamic-import": "^7.27.1",
"@babel/plugin-transform-explicit-resource-management": "^7.28.6", "@babel/plugin-transform-explicit-resource-management": "^7.28.6",
"@babel/plugin-transform-exponentiation-operator": "^7.28.6", "@babel/plugin-transform-exponentiation-operator": "^7.28.6",
@@ -54,9 +54,9 @@
"@babel/plugin-transform-member-expression-literals": "^7.27.1", "@babel/plugin-transform-member-expression-literals": "^7.27.1",
"@babel/plugin-transform-modules-amd": "^7.27.1", "@babel/plugin-transform-modules-amd": "^7.27.1",
"@babel/plugin-transform-modules-commonjs": "^7.28.6", "@babel/plugin-transform-modules-commonjs": "^7.28.6",
"@babel/plugin-transform-modules-systemjs": "^7.28.5", "@babel/plugin-transform-modules-systemjs": "^7.29.0",
"@babel/plugin-transform-modules-umd": "^7.27.1", "@babel/plugin-transform-modules-umd": "^7.27.1",
"@babel/plugin-transform-named-capturing-groups-regex": "^7.27.1", "@babel/plugin-transform-named-capturing-groups-regex": "^7.29.0",
"@babel/plugin-transform-new-target": "^7.27.1", "@babel/plugin-transform-new-target": "^7.27.1",
"@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6", "@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6",
"@babel/plugin-transform-numeric-separator": "^7.28.6", "@babel/plugin-transform-numeric-separator": "^7.28.6",
@@ -68,7 +68,7 @@
"@babel/plugin-transform-private-methods": "^7.28.6", "@babel/plugin-transform-private-methods": "^7.28.6",
"@babel/plugin-transform-private-property-in-object": "^7.28.6", "@babel/plugin-transform-private-property-in-object": "^7.28.6",
"@babel/plugin-transform-property-literals": "^7.27.1", "@babel/plugin-transform-property-literals": "^7.27.1",
"@babel/plugin-transform-regenerator": "^7.28.6", "@babel/plugin-transform-regenerator": "^7.29.0",
"@babel/plugin-transform-regexp-modifiers": "^7.28.6", "@babel/plugin-transform-regexp-modifiers": "^7.28.6",
"@babel/plugin-transform-reserved-words": "^7.27.1", "@babel/plugin-transform-reserved-words": "^7.27.1",
"@babel/plugin-transform-shorthand-properties": "^7.27.1", "@babel/plugin-transform-shorthand-properties": "^7.27.1",
@@ -81,20 +81,20 @@
"@babel/plugin-transform-unicode-regex": "^7.27.1", "@babel/plugin-transform-unicode-regex": "^7.27.1",
"@babel/plugin-transform-unicode-sets-regex": "^7.28.6", "@babel/plugin-transform-unicode-sets-regex": "^7.28.6",
"@babel/preset-modules": "0.1.6-no-external-plugins", "@babel/preset-modules": "0.1.6-no-external-plugins",
"babel-plugin-polyfill-corejs2": "^0.4.14", "babel-plugin-polyfill-corejs2": "^0.4.15",
"babel-plugin-polyfill-corejs3": "^0.13.0", "babel-plugin-polyfill-corejs3": "^0.14.0",
"babel-plugin-polyfill-regenerator": "^0.6.5", "babel-plugin-polyfill-regenerator": "^0.6.6",
"core-js-compat": "^3.43.0", "core-js-compat": "^3.48.0",
"semver": "^6.3.1" "semver": "^6.3.1"
}, },
"peerDependencies": { "peerDependencies": {
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/core-7.12": "npm:@babel/core@7.12.9", "@babel/core-7.12": "npm:@babel/core@7.12.9",
"@babel/helper-plugin-test-runner": "^7.27.1", "@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/traverse": "^7.28.6" "@babel/traverse": "^7.29.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

View File

@@ -7,6 +7,7 @@ exports.default = void 0;
var _index = require("./path/index.js"); var _index = require("./path/index.js");
var _t = require("@babel/types"); var _t = require("@babel/types");
var _context = require("./path/context.js"); var _context = require("./path/context.js");
var _hub = require("./hub.js");
const { const {
VISITOR_KEYS VISITOR_KEYS
} = _t; } = _t;
@@ -33,12 +34,17 @@ class TraversalContext {
return false; return false;
} }
create(node, container, key, listKey) { create(node, container, key, listKey) {
const {
parentPath
} = this;
const hub = parentPath == null ? node.type === "Program" || node.type === "File" ? new _hub.default() : undefined : parentPath.hub;
return _index.default.get({ return _index.default.get({
parentPath: this.parentPath, parentPath,
parent: node, parent: node,
container, container,
key: key, key: key,
listKey listKey,
hub
}); });
} }
maybeQueue(path, notPriority) { maybeQueue(path, notPriority) {

File diff suppressed because one or more lines are too long

View File

@@ -30,6 +30,9 @@ const renameVisitor = {
path.requeueComputedKeyAndDecorators(); path.requeueComputedKeyAndDecorators();
} }
} }
if (path.isSwitchStatement()) {
path.context.maybeQueue(path.get("discriminant"));
}
} }
}, },
ObjectProperty({ ObjectProperty({

File diff suppressed because one or more lines are too long

View File

@@ -102,7 +102,7 @@ function verify$1(visitor) {
} }
if (shouldIgnoreKey(nodeType)) continue; if (shouldIgnoreKey(nodeType)) continue;
if (!TYPES.includes(nodeType)) { if (!TYPES.includes(nodeType)) {
throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.28.6"}`); throw new Error(`You gave us a visitor for the node type ${nodeType} but it's not a valid type in @babel/traverse ${"7.29.0"}`);
} }
const visitors = visitor[nodeType]; const visitors = visitor[nodeType];
if (typeof visitors === "object") { if (typeof visitors === "object") {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/traverse", "name": "@babel/traverse",
"version": "7.28.6", "version": "7.29.0",
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-traverse", "homepage": "https://babel.dev/docs/en/next/babel-traverse",
@@ -16,16 +16,16 @@
}, },
"main": "./lib/index.js", "main": "./lib/index.js",
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.28.6", "@babel/code-frame": "^7.29.0",
"@babel/generator": "^7.28.6", "@babel/generator": "^7.29.0",
"@babel/helper-globals": "^7.28.0", "@babel/helper-globals": "^7.28.0",
"@babel/parser": "^7.28.6", "@babel/parser": "^7.29.0",
"@babel/template": "^7.28.6", "@babel/template": "^7.28.6",
"@babel/types": "^7.28.6", "@babel/types": "^7.29.0",
"debug": "^4.3.1" "debug": "^4.3.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.28.6", "@babel/core": "^7.29.0",
"@babel/helper-plugin-test-runner": "^7.27.1" "@babel/helper-plugin-test-runner": "^7.27.1"
}, },
"engines": { "engines": {

File diff suppressed because one or more lines are too long

View File

@@ -917,13 +917,15 @@ function classDeclaration(id = null, superClass = null, body, decorators = null)
validate(defs.decorators, node, "decorators", decorators, 1); validate(defs.decorators, node, "decorators", decorators, 1);
return node; return node;
} }
function exportAllDeclaration(source) { function exportAllDeclaration(source, attributes = null) {
const node = { const node = {
type: "ExportAllDeclaration", type: "ExportAllDeclaration",
source source,
attributes
}; };
const defs = NODE_FIELDS.ExportAllDeclaration; const defs = NODE_FIELDS.ExportAllDeclaration;
validate(defs.source, node, "source", source, 1); validate(defs.source, node, "source", source, 1);
validate(defs.attributes, node, "attributes", attributes, 1);
return node; return node;
} }
function exportDefaultDeclaration(declaration) { function exportDefaultDeclaration(declaration) {
@@ -935,17 +937,19 @@ function exportDefaultDeclaration(declaration) {
validate(defs.declaration, node, "declaration", declaration, 1); validate(defs.declaration, node, "declaration", declaration, 1);
return node; return node;
} }
function exportNamedDeclaration(declaration = null, specifiers = [], source = null) { function exportNamedDeclaration(declaration = null, specifiers = [], source = null, attributes = null) {
const node = { const node = {
type: "ExportNamedDeclaration", type: "ExportNamedDeclaration",
declaration, declaration,
specifiers, specifiers,
source source,
attributes
}; };
const defs = NODE_FIELDS.ExportNamedDeclaration; const defs = NODE_FIELDS.ExportNamedDeclaration;
validate(defs.declaration, node, "declaration", declaration, 1); validate(defs.declaration, node, "declaration", declaration, 1);
validate(defs.specifiers, node, "specifiers", specifiers, 1); validate(defs.specifiers, node, "specifiers", specifiers, 1);
validate(defs.source, node, "source", source, 1); validate(defs.source, node, "source", source, 1);
validate(defs.attributes, node, "attributes", attributes, 1);
return node; return node;
} }
function exportSpecifier(local, exported) { function exportSpecifier(local, exported) {
@@ -974,15 +978,17 @@ function forOfStatement(left, right, body, _await = false) {
validate(defs.await, node, "await", _await); validate(defs.await, node, "await", _await);
return node; return node;
} }
function importDeclaration(specifiers, source) { function importDeclaration(specifiers, source, attributes = null) {
const node = { const node = {
type: "ImportDeclaration", type: "ImportDeclaration",
specifiers, specifiers,
source source,
attributes
}; };
const defs = NODE_FIELDS.ImportDeclaration; const defs = NODE_FIELDS.ImportDeclaration;
validate(defs.specifiers, node, "specifiers", specifiers, 1); validate(defs.specifiers, node, "specifiers", specifiers, 1);
validate(defs.source, node, "source", source, 1); validate(defs.source, node, "source", source, 1);
validate(defs.attributes, node, "attributes", attributes, 1);
return node; return node;
} }
function importDefaultSpecifier(local) { function importDefaultSpecifier(local) {

File diff suppressed because one or more lines are too long

View File

@@ -1080,7 +1080,7 @@ importAttributes.assertions = {
validate: (0, _utils.arrayOfType)("ImportAttribute") validate: (0, _utils.arrayOfType)("ImportAttribute")
}; };
defineType("ExportAllDeclaration", { defineType("ExportAllDeclaration", {
builder: ["source"], builder: ["source", "attributes"],
visitor: ["source", "attributes", "assertions"], visitor: ["source", "attributes", "assertions"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"],
fields: Object.assign({ fields: Object.assign({
@@ -1099,7 +1099,7 @@ defineType("ExportDefaultDeclaration", {
} }
}); });
defineType("ExportNamedDeclaration", { defineType("ExportNamedDeclaration", {
builder: ["declaration", "specifiers", "source"], builder: ["declaration", "specifiers", "source", "attributes"],
visitor: ["declaration", "specifiers", "source", "attributes", "assertions"], visitor: ["declaration", "specifiers", "source", "attributes", "assertions"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"], aliases: ["Statement", "Declaration", "ImportOrExportDeclaration", "ExportDeclaration"],
fields: Object.assign({ fields: Object.assign({
@@ -1189,7 +1189,7 @@ defineType("ForOfStatement", {
} }
}); });
defineType("ImportDeclaration", { defineType("ImportDeclaration", {
builder: ["specifiers", "source"], builder: ["specifiers", "source", "attributes"],
visitor: ["specifiers", "source", "attributes", "assertions"], visitor: ["specifiers", "source", "attributes", "assertions"],
aliases: ["Statement", "Declaration", "ImportOrExportDeclaration"], aliases: ["Statement", "Declaration", "ImportOrExportDeclaration"],
fields: Object.assign({}, importAttributes, { fields: Object.assign({}, importAttributes, {

File diff suppressed because one or more lines are too long

View File

@@ -442,8 +442,8 @@ export interface ClassDeclaration extends BaseNode {
export interface ExportAllDeclaration extends BaseNode { export interface ExportAllDeclaration extends BaseNode {
type: "ExportAllDeclaration"; type: "ExportAllDeclaration";
source: StringLiteral; source: StringLiteral;
assertions: ImportAttribute[] | null;
attributes: ImportAttribute[] | null; attributes: ImportAttribute[] | null;
assertions: ImportAttribute[] | null;
exportKind: "type" | "value" | null; exportKind: "type" | "value" | null;
} }
@@ -458,8 +458,8 @@ export interface ExportNamedDeclaration extends BaseNode {
declaration: Declaration | null; declaration: Declaration | null;
specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[]; specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[];
source: StringLiteral | null; source: StringLiteral | null;
assertions: ImportAttribute[] | null;
attributes: ImportAttribute[] | null; attributes: ImportAttribute[] | null;
assertions: ImportAttribute[] | null;
exportKind: "type" | "value" | null; exportKind: "type" | "value" | null;
} }
@@ -482,8 +482,8 @@ export interface ImportDeclaration extends BaseNode {
type: "ImportDeclaration"; type: "ImportDeclaration";
specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[]; specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[];
source: StringLiteral; source: StringLiteral;
assertions: ImportAttribute[] | null;
attributes: ImportAttribute[] | null; attributes: ImportAttribute[] | null;
assertions: ImportAttribute[] | null;
importKind: "type" | "typeof" | "value" | null; importKind: "type" | "typeof" | "value" | null;
module: boolean | null; module: boolean | null;
phase: "source" | "defer" | null; phase: "source" | "defer" | null;
@@ -1868,12 +1868,12 @@ export function arrowFunctionExpression(params: FunctionParameter[], body: Block
export function classBody(body: (ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock)[]): ClassBody; export function classBody(body: (ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock)[]): ClassBody;
export function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassExpression; export function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassExpression;
export function classDeclaration(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassDeclaration; export function classDeclaration(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassDeclaration;
export function exportAllDeclaration(source: StringLiteral): ExportAllDeclaration; export function exportAllDeclaration(source: StringLiteral, attributes?: ImportAttribute[] | null): ExportAllDeclaration;
export function exportDefaultDeclaration(declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration; export function exportDefaultDeclaration(declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration;
export function exportNamedDeclaration(declaration?: Declaration | null, specifiers?: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[], source?: StringLiteral | null): ExportNamedDeclaration; export function exportNamedDeclaration(declaration?: Declaration | null, specifiers?: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[], source?: StringLiteral | null, attributes?: ImportAttribute[] | null): ExportNamedDeclaration;
export function exportSpecifier(local: Identifier, exported: Identifier | StringLiteral): ExportSpecifier; export function exportSpecifier(local: Identifier, exported: Identifier | StringLiteral): ExportSpecifier;
export function forOfStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement, _await?: boolean): ForOfStatement; export function forOfStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement, _await?: boolean): ForOfStatement;
export function importDeclaration(specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[], source: StringLiteral): ImportDeclaration; export function importDeclaration(specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[], source: StringLiteral, attributes?: ImportAttribute[] | null): ImportDeclaration;
export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifier; export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifier;
export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier; export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier;
export function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier; export function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier;

View File

@@ -742,9 +742,9 @@ interface ClassDeclaration extends BaseNode {
interface ExportAllDeclaration extends BaseNode { interface ExportAllDeclaration extends BaseNode {
type: "ExportAllDeclaration"; type: "ExportAllDeclaration";
source: StringLiteral; source: StringLiteral;
attributes?: ImportAttribute[] | null;
/** @deprecated */ /** @deprecated */
assertions?: ImportAttribute[] | null; assertions?: ImportAttribute[] | null;
attributes?: ImportAttribute[] | null;
exportKind?: "type" | "value" | null; exportKind?: "type" | "value" | null;
} }
interface ExportDefaultDeclaration extends BaseNode { interface ExportDefaultDeclaration extends BaseNode {
@@ -757,9 +757,9 @@ interface ExportNamedDeclaration extends BaseNode {
declaration?: Declaration | null; declaration?: Declaration | null;
specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[]; specifiers: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[];
source?: StringLiteral | null; source?: StringLiteral | null;
attributes?: ImportAttribute[] | null;
/** @deprecated */ /** @deprecated */
assertions?: ImportAttribute[] | null; assertions?: ImportAttribute[] | null;
attributes?: ImportAttribute[] | null;
exportKind?: "type" | "value" | null; exportKind?: "type" | "value" | null;
} }
interface ExportSpecifier extends BaseNode { interface ExportSpecifier extends BaseNode {
@@ -779,9 +779,9 @@ interface ImportDeclaration extends BaseNode {
type: "ImportDeclaration"; type: "ImportDeclaration";
specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[]; specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[];
source: StringLiteral; source: StringLiteral;
attributes?: ImportAttribute[] | null;
/** @deprecated */ /** @deprecated */
assertions?: ImportAttribute[] | null; assertions?: ImportAttribute[] | null;
attributes?: ImportAttribute[] | null;
importKind?: "type" | "typeof" | "value" | null; importKind?: "type" | "typeof" | "value" | null;
module?: boolean | null; module?: boolean | null;
phase?: "source" | "defer" | null; phase?: "source" | "defer" | null;
@@ -2230,12 +2230,12 @@ declare function arrowFunctionExpression(params: FunctionParameter[], body: Bloc
declare function classBody(body: (ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock)[]): ClassBody; declare function classBody(body: (ClassMethod | ClassPrivateMethod | ClassProperty | ClassPrivateProperty | ClassAccessorProperty | TSDeclareMethod | TSIndexSignature | StaticBlock)[]): ClassBody;
declare function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassExpression; declare function classExpression(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassExpression;
declare function classDeclaration(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassDeclaration; declare function classDeclaration(id: Identifier | null | undefined, superClass: Expression | null | undefined, body: ClassBody, decorators?: Decorator[] | null): ClassDeclaration;
declare function exportAllDeclaration(source: StringLiteral): ExportAllDeclaration; declare function exportAllDeclaration(source: StringLiteral, attributes?: ImportAttribute[] | null): ExportAllDeclaration;
declare function exportDefaultDeclaration(declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration; declare function exportDefaultDeclaration(declaration: TSDeclareFunction | FunctionDeclaration | ClassDeclaration | Expression): ExportDefaultDeclaration;
declare function exportNamedDeclaration(declaration?: Declaration | null, specifiers?: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[], source?: StringLiteral | null): ExportNamedDeclaration; declare function exportNamedDeclaration(declaration?: Declaration | null, specifiers?: (ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier)[], source?: StringLiteral | null, attributes?: ImportAttribute[] | null): ExportNamedDeclaration;
declare function exportSpecifier(local: Identifier, exported: Identifier | StringLiteral): ExportSpecifier; declare function exportSpecifier(local: Identifier, exported: Identifier | StringLiteral): ExportSpecifier;
declare function forOfStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement, _await?: boolean): ForOfStatement; declare function forOfStatement(left: VariableDeclaration | LVal, right: Expression, body: Statement, _await?: boolean): ForOfStatement;
declare function importDeclaration(specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[], source: StringLiteral): ImportDeclaration; declare function importDeclaration(specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[], source: StringLiteral, attributes?: ImportAttribute[] | null): ImportDeclaration;
declare function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifier; declare function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifier;
declare function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier; declare function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier;
declare function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier; declare function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier;

View File

@@ -434,8 +434,8 @@ declare class BabelNodeClassDeclaration extends BabelNode {
declare class BabelNodeExportAllDeclaration extends BabelNode { declare class BabelNodeExportAllDeclaration extends BabelNode {
type: "ExportAllDeclaration"; type: "ExportAllDeclaration";
source: BabelNodeStringLiteral; source: BabelNodeStringLiteral;
assertions?: BabelNodeImportAttribute[];
attributes?: BabelNodeImportAttribute[]; attributes?: BabelNodeImportAttribute[];
assertions?: BabelNodeImportAttribute[];
exportKind?: "type" | "value"; exportKind?: "type" | "value";
} }
@@ -450,8 +450,8 @@ declare class BabelNodeExportNamedDeclaration extends BabelNode {
declaration?: BabelNodeDeclaration; declaration?: BabelNodeDeclaration;
specifiers?: (BabelNodeExportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier)[]; specifiers?: (BabelNodeExportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier)[];
source?: BabelNodeStringLiteral; source?: BabelNodeStringLiteral;
assertions?: BabelNodeImportAttribute[];
attributes?: BabelNodeImportAttribute[]; attributes?: BabelNodeImportAttribute[];
assertions?: BabelNodeImportAttribute[];
exportKind?: "type" | "value"; exportKind?: "type" | "value";
} }
@@ -473,8 +473,8 @@ declare class BabelNodeImportDeclaration extends BabelNode {
type: "ImportDeclaration"; type: "ImportDeclaration";
specifiers: (BabelNodeImportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier)[]; specifiers: (BabelNodeImportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier)[];
source: BabelNodeStringLiteral; source: BabelNodeStringLiteral;
assertions?: BabelNodeImportAttribute[];
attributes?: BabelNodeImportAttribute[]; attributes?: BabelNodeImportAttribute[];
assertions?: BabelNodeImportAttribute[];
importKind?: "type" | "typeof" | "value"; importKind?: "type" | "typeof" | "value";
module?: boolean; module?: boolean;
phase?: "source" | "defer"; phase?: "source" | "defer";
@@ -1762,12 +1762,12 @@ declare module "@babel/types" {
declare export function classBody(body: (BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeClassProperty | BabelNodeClassPrivateProperty | BabelNodeClassAccessorProperty | BabelNodeTSDeclareMethod | BabelNodeTSIndexSignature | BabelNodeStaticBlock)[]): BabelNodeClassBody; declare export function classBody(body: (BabelNodeClassMethod | BabelNodeClassPrivateMethod | BabelNodeClassProperty | BabelNodeClassPrivateProperty | BabelNodeClassAccessorProperty | BabelNodeTSDeclareMethod | BabelNodeTSIndexSignature | BabelNodeStaticBlock)[]): BabelNodeClassBody;
declare export function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: BabelNodeDecorator[]): BabelNodeClassExpression; declare export function classExpression(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: BabelNodeDecorator[]): BabelNodeClassExpression;
declare export function classDeclaration(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: BabelNodeDecorator[]): BabelNodeClassDeclaration; declare export function classDeclaration(id?: BabelNodeIdentifier, superClass?: BabelNodeExpression, body: BabelNodeClassBody, decorators?: BabelNodeDecorator[]): BabelNodeClassDeclaration;
declare export function exportAllDeclaration(source: BabelNodeStringLiteral): BabelNodeExportAllDeclaration; declare export function exportAllDeclaration(source: BabelNodeStringLiteral, attributes?: BabelNodeImportAttribute[]): BabelNodeExportAllDeclaration;
declare export function exportDefaultDeclaration(declaration: BabelNodeTSDeclareFunction | BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration; declare export function exportDefaultDeclaration(declaration: BabelNodeTSDeclareFunction | BabelNodeFunctionDeclaration | BabelNodeClassDeclaration | BabelNodeExpression): BabelNodeExportDefaultDeclaration;
declare export function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers?: (BabelNodeExportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier)[], source?: BabelNodeStringLiteral): BabelNodeExportNamedDeclaration; declare export function exportNamedDeclaration(declaration?: BabelNodeDeclaration, specifiers?: (BabelNodeExportSpecifier | BabelNodeExportDefaultSpecifier | BabelNodeExportNamespaceSpecifier)[], source?: BabelNodeStringLiteral, attributes?: BabelNodeImportAttribute[]): BabelNodeExportNamedDeclaration;
declare export function exportSpecifier(local: BabelNodeIdentifier, exported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeExportSpecifier; declare export function exportSpecifier(local: BabelNodeIdentifier, exported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeExportSpecifier;
declare export function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement, _await?: boolean): BabelNodeForOfStatement; declare export function forOfStatement(left: BabelNodeVariableDeclaration | BabelNodeLVal, right: BabelNodeExpression, body: BabelNodeStatement, _await?: boolean): BabelNodeForOfStatement;
declare export function importDeclaration(specifiers: (BabelNodeImportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier)[], source: BabelNodeStringLiteral): BabelNodeImportDeclaration; declare export function importDeclaration(specifiers: (BabelNodeImportSpecifier | BabelNodeImportDefaultSpecifier | BabelNodeImportNamespaceSpecifier)[], source: BabelNodeStringLiteral, attributes?: BabelNodeImportAttribute[]): BabelNodeImportDeclaration;
declare export function importDefaultSpecifier(local: BabelNodeIdentifier): BabelNodeImportDefaultSpecifier; declare export function importDefaultSpecifier(local: BabelNodeIdentifier): BabelNodeImportDefaultSpecifier;
declare export function importNamespaceSpecifier(local: BabelNodeIdentifier): BabelNodeImportNamespaceSpecifier; declare export function importNamespaceSpecifier(local: BabelNodeIdentifier): BabelNodeImportNamespaceSpecifier;
declare export function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier; declare export function importSpecifier(local: BabelNodeIdentifier, imported: BabelNodeIdentifier | BabelNodeStringLiteral): BabelNodeImportSpecifier;

View File

@@ -1,6 +1,6 @@
{ {
"name": "@babel/types", "name": "@babel/types",
"version": "7.28.6", "version": "7.29.0",
"description": "Babel Types is a Lodash-esque utility library for AST nodes", "description": "Babel Types is a Lodash-esque utility library for AST nodes",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-types", "homepage": "https://babel.dev/docs/en/next/babel-types",
@@ -20,9 +20,9 @@
"@babel/helper-validator-identifier": "^7.28.5" "@babel/helper-validator-identifier": "^7.28.5"
}, },
"devDependencies": { "devDependencies": {
"@babel/generator": "^7.28.6", "@babel/generator": "^7.29.0",
"@babel/helper-fixtures": "^7.28.6", "@babel/helper-fixtures": "^7.28.6",
"@babel/parser": "^7.28.6" "@babel/parser": "^7.29.0"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"

View File

@@ -120,6 +120,22 @@ export declare class Jqhtml_Component {
* Provided for API consistency and clarity * Provided for API consistency and clarity
*/ */
redraw(id?: string | null): void; redraw(id?: string | null): void;
/**
* Re-fetch data by executing on_load() without triggering re-render or lifecycle.
*
* Runs on_load() on a detached proxy (same restrictions as during boot):
* - this.data is restored to on_create() snapshot, then unfrozen for writing
* - this.args is read-only
* - All other properties (this.$, this.$sid, etc.) are blocked
*
* After on_load() completes, this.data is atomically updated and re-frozen.
* The developer decides what to do next (e.g., call this.render()).
*
* Pattern: load() invokes on_load(), just as render() invokes on_render().
*
* @returns true if this.data changed, false if unchanged
*/
load(): Promise<boolean>;
/** /**
* Create phase - Quick setup, prepare UI * Create phase - Quick setup, prepare UI
* SYNCHRONOUS - no awaits, no yields * SYNCHRONOUS - no awaits, no yields

View File

@@ -1 +1 @@
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,CAAC,EAAE;YACb,GAAG,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;YACjF,UAAU,EAAE,MAAM,IAAI,CAAC;SACxB,CAAC;KACH;CACF;AAED,qBAAa,gBAAgB;IAE3B,MAAM,CAAC,kBAAkB,UAAQ;IACjC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC;IAGtB,CAAC,EAAE,GAAG,CAAC;IACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAK;IAGzB,OAAO,CAAC,kBAAkB,CAAmB;IAC7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,mBAAmB,CAAuB;IAClD,OAAO,CAAC,oBAAoB,CAAwE;IACpG,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,uBAAuB,CAAoC;IACnE,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,iBAAiB,CAAC,CAAsB;IAChD,OAAO,CAAC,yBAAyB,CAAwB;IACzD,OAAO,CAAC,sBAAsB,CAAkB;IAGhD,OAAO,CAAC,UAAU,CAAuB;IAGzC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,8BAA8B,CAAkB;IACxD,OAAO,CAAC,WAAW,CAAkB;IAGrC,OAAO,CAAC,mBAAmB,CAAkB;IAG7C,OAAO,CAAC,oBAAoB,CAAkB;IAI9C,OAAO,CAAC,sBAAsB,CAAkB;IAIhD,OAAO,CAAC,WAAW,CAAkB;IAIrC,OAAO,CAAC,aAAa,CAAkB;IAIvC,OAAO,CAAC,WAAW,CAAoC;IAKvD,OAAO,CAAC,oBAAoB,CAAkB;gBAElC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IA2JzD;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAmClC;;;;;;OAMG;YACW,eAAe;IAO7B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM;IAsUzC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAmDtC;;;OAGG;IACH,MAAM,CAAC,EAAE,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAItC;;;OAGG;IACH,MAAM,IAAI,IAAI;IAwJd;;;;;;;;;;OAUG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAyI5B;;;;;;;;;;;;;OAaG;YACW,yBAAyB;IAkKvC;;;;;;;;;OASG;YACW,kBAAkB;IAmFhC;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAuD7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3C;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9C;;;;OAIG;YACW,wBAAwB;IAqCtC;;;;;;;;;;OAUG;YACW,4BAA4B;IAqC1C;;;;;;;;OAQG;IACG,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBpD;;;;;;;;OAQG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA2K9B;;;;OAIG;IACH;;;;OAIG;IACH,KAAK,IAAI,IAAI;IA+Cb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAkBZ,SAAS,IAAI,IAAI;IACjB,SAAS,IAAI,IAAI;IACjB,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACzB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAC/B,OAAO,IAAI,IAAI;IAEf;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,MAAM;IAEnB;;;;OAIG;IACH;;;OAGG;IACH,gBAAgB,IAAI,OAAO;IAmC3B;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;;;;;;OAUG;IACH,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAuBzF;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAiB7C;;;OAGG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK3C;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIpC;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG;IAgB3B;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAgB9C;;;OAGG;IACH,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAIvC;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAa1C;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAoBlD;;OAEG;IACH,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IA0CtC,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,kBAAkB;IA4B1B,OAAO,CAAC,yBAAyB;IAuHjC,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;IAUlB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,0BAA0B;CAqEnC"} {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAgBH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,CAAC,EAAE;YACb,GAAG,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;YACjF,UAAU,EAAE,MAAM,IAAI,CAAC;SACxB,CAAC;KACH;CACF;AAED,qBAAa,gBAAgB;IAE3B,MAAM,CAAC,kBAAkB,UAAQ;IACjC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC;IAGtB,CAAC,EAAE,GAAG,CAAC;IACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAK;IAGzB,OAAO,CAAC,kBAAkB,CAAmB;IAC7C,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,mBAAmB,CAAuB;IAClD,OAAO,CAAC,oBAAoB,CAAwE;IACpG,OAAO,CAAC,iBAAiB,CAA+B;IACxD,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,aAAa,CAAa;IAClC,OAAO,CAAC,oBAAoB,CAAoC;IAChE,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,uBAAuB,CAAoC;IACnE,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,iBAAiB,CAAC,CAAsB;IAChD,OAAO,CAAC,yBAAyB,CAAwB;IACzD,OAAO,CAAC,sBAAsB,CAAkB;IAGhD,OAAO,CAAC,UAAU,CAAuB;IAGzC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,8BAA8B,CAAkB;IACxD,OAAO,CAAC,WAAW,CAAkB;IAGrC,OAAO,CAAC,mBAAmB,CAAkB;IAG7C,OAAO,CAAC,oBAAoB,CAAkB;IAI9C,OAAO,CAAC,sBAAsB,CAAkB;IAIhD,OAAO,CAAC,WAAW,CAAkB;IAIrC,OAAO,CAAC,aAAa,CAAkB;IAIvC,OAAO,CAAC,WAAW,CAAoC;IAKvD,OAAO,CAAC,oBAAoB,CAAkB;gBAElC,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM;IA2JzD;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;IAmClC;;;;;;OAMG;YACW,eAAe;IAO7B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAO5B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAIpB;;;OAGG;IACH;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM;IAsUzC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAmDtC;;;OAGG;IACH,MAAM,CAAC,EAAE,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAItC;;;;;;;;;;;;;;OAcG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC;IA8C9B;;;OAGG;IACH,MAAM,IAAI,IAAI;IAwJd;;;;;;;;;;OAUG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAyI5B;;;;;;;;;;;;;OAaG;YACW,yBAAyB;IAkKvC;;;;;;;;;OASG;YACW,kBAAkB;IAmFhC;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAuD7B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB3C;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAS9C;;;;OAIG;YACW,wBAAwB;IAqCtC;;;;;;;;;;OAUG;YACW,4BAA4B;IAqC1C;;;;;;;;OAQG;IACG,MAAM,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBpD;;;;;;;;OAQG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA2K9B;;;;OAIG;IACH;;;;OAIG;IACH,KAAK,IAAI,IAAI;IA+Cb;;;OAGG;IACH,IAAI,IAAI,IAAI;IAkBZ,SAAS,IAAI,IAAI;IACjB,SAAS,IAAI,IAAI;IACjB,OAAO,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACzB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAC/B,OAAO,IAAI,IAAI;IAEf;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,MAAM;IAEnB;;;;OAIG;IACH;;;OAGG;IACH,gBAAgB,IAAI,OAAO;IAmC3B;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;;;;;;;;;OAUG;IACH,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAuBzF;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAiB7C;;;OAGG;IACH,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAK3C;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIpC;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG;IAgB3B;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAgB9C;;;OAGG;IACH,YAAY,IAAI,gBAAgB,GAAG,IAAI;IAIvC;;OAEG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAa1C;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAoBlD;;OAEG;IACH,MAAM,CAAC,mBAAmB,IAAI,MAAM,EAAE;IA0CtC,OAAO,CAAC,aAAa;IAIrB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,kBAAkB;IA4B1B,OAAO,CAAC,yBAAyB;IAuHjC,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,gBAAgB;IAcxB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IA+BzB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,UAAU;IAUlB;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,0BAA0B;CAqEnC"}

View File

@@ -2748,6 +2748,60 @@ class Jqhtml_Component {
redraw(id = null) { redraw(id = null) {
return this.render(id); return this.render(id);
} }
/**
* Re-fetch data by executing on_load() without triggering re-render or lifecycle.
*
* Runs on_load() on a detached proxy (same restrictions as during boot):
* - this.data is restored to on_create() snapshot, then unfrozen for writing
* - this.args is read-only
* - All other properties (this.$, this.$sid, etc.) are blocked
*
* After on_load() completes, this.data is atomically updated and re-frozen.
* The developer decides what to do next (e.g., call this.render()).
*
* Pattern: load() invokes on_load(), just as render() invokes on_render().
*
* @returns true if this.data changed, false if unchanged
*/
async load() {
if (this._stopped)
return false;
// Snapshot current data for change detection
const data_before = JSON.stringify(this.data);
// Execute on_load() on detached proxy (restores data to on_create snapshot)
const { data: result_data } = await this._execute_on_load_detached(false);
// Atomically update this.data: unfreeze → assign → normalize → refreeze
this.__data_frozen = false;
this.data = result_data;
const cache_mode = Jqhtml_Local_Storage.get_cache_mode();
if (cache_mode === 'data') {
const normalized = Jqhtml_Local_Storage.normalize_for_cache(this.data);
this.data = normalized;
}
this.__data_frozen = true;
// Detect if data changed
const data_after = JSON.stringify(this.data);
const data_changed = data_before !== data_after;
// Update cache with fresh data if changed
if (data_changed) {
// Regenerate cache key (args may have changed since boot)
let cache_key = null;
if (typeof this.cache_id === 'function') {
try {
cache_key = `${this.component_name()}::${String(this.cache_id())}`;
}
catch { /* cache_id() threw - skip caching */ }
}
else {
const result = Load_Coordinator.generate_invocation_key(this.component_name(), this.args);
cache_key = result.key;
}
if (cache_key && cache_mode !== 'html') {
Jqhtml_Local_Storage.set(cache_key, this.data);
}
}
return data_changed;
}
/** /**
* Create phase - Quick setup, prepare UI * Create phase - Quick setup, prepare UI
* SYNCHRONOUS - no awaits, no yields * SYNCHRONOUS - no awaits, no yields
@@ -5043,7 +5097,7 @@ function init(jQuery) {
} }
} }
// Version - will be replaced during build with actual version from package.json // Version - will be replaced during build with actual version from package.json
const version = '2.3.35'; const version = '2.3.36';
// Default export with all functionality // Default export with all functionality
const jqhtml = { const jqhtml = {
// Core // Core

Some files were not shown because too many files have changed in this diff Show More