@rollup/wasm-node 4.13.2 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rollup +2 -2
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +175 -160
- package/dist/es/shared/parseAst.js +117 -99
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +120 -98
- package/dist/shared/rollup.js +228 -213
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +14 -13
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.14.1
|
|
4
|
+
Sun, 07 Apr 2024 07:35:08 GMT - commit 0b665c31833525c923c0fc20f43ebfca748c6670
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version = "4.
|
|
34
|
+
var version = "4.14.1";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -613,15 +613,6 @@ function getCacheForUncacheablePlugin(pluginName) {
|
|
|
613
613
|
};
|
|
614
614
|
}
|
|
615
615
|
|
|
616
|
-
const BLANK = Object.freeze(Object.create(null));
|
|
617
|
-
const EMPTY_OBJECT = Object.freeze({});
|
|
618
|
-
const EMPTY_ARRAY = Object.freeze([]);
|
|
619
|
-
const EMPTY_SET = Object.freeze(new (class extends Set {
|
|
620
|
-
add() {
|
|
621
|
-
throw new Error('Cannot add to empty set');
|
|
622
|
-
}
|
|
623
|
-
})());
|
|
624
|
-
|
|
625
616
|
const doNothing = () => { };
|
|
626
617
|
|
|
627
618
|
async function asyncFlatten(array) {
|
|
@@ -693,7 +684,7 @@ const treeshakePresets = {
|
|
|
693
684
|
recommended: {
|
|
694
685
|
annotations: true,
|
|
695
686
|
correctVarValueBeforeDeclaration: false,
|
|
696
|
-
manualPureFunctions: EMPTY_ARRAY,
|
|
687
|
+
manualPureFunctions: parseAst_js.EMPTY_ARRAY,
|
|
697
688
|
moduleSideEffects: () => true,
|
|
698
689
|
propertyReadSideEffects: true,
|
|
699
690
|
tryCatchDeoptimization: true,
|
|
@@ -702,7 +693,7 @@ const treeshakePresets = {
|
|
|
702
693
|
safest: {
|
|
703
694
|
annotations: true,
|
|
704
695
|
correctVarValueBeforeDeclaration: true,
|
|
705
|
-
manualPureFunctions: EMPTY_ARRAY,
|
|
696
|
+
manualPureFunctions: parseAst_js.EMPTY_ARRAY,
|
|
706
697
|
moduleSideEffects: () => true,
|
|
707
698
|
propertyReadSideEffects: true,
|
|
708
699
|
tryCatchDeoptimization: true,
|
|
@@ -711,7 +702,7 @@ const treeshakePresets = {
|
|
|
711
702
|
smallest: {
|
|
712
703
|
annotations: true,
|
|
713
704
|
correctVarValueBeforeDeclaration: false,
|
|
714
|
-
manualPureFunctions: EMPTY_ARRAY,
|
|
705
|
+
manualPureFunctions: parseAst_js.EMPTY_ARRAY,
|
|
715
706
|
moduleSideEffects: () => false,
|
|
716
707
|
propertyReadSideEffects: false,
|
|
717
708
|
tryCatchDeoptimization: false,
|
|
@@ -825,9 +816,9 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
825
816
|
watchMode: graph.watchMode
|
|
826
817
|
},
|
|
827
818
|
parse: parseAst_js.parseAst,
|
|
828
|
-
resolve(source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) {
|
|
819
|
+
resolve(source, importer, { attributes, custom, isEntry, skipSelf } = parseAst_js.BLANK) {
|
|
829
820
|
skipSelf ??= true;
|
|
830
|
-
return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
|
|
821
|
+
return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || parseAst_js.EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
|
|
831
822
|
},
|
|
832
823
|
setAssetSource: fileEmitter.setAssetSource,
|
|
833
824
|
warn: getLogHandler(parseAst_js.LOGLEVEL_WARN, 'PLUGIN_WARNING', onLog, plugin.name, logLevel)
|
|
@@ -1088,7 +1079,7 @@ function noReturn() { }
|
|
|
1088
1079
|
function getLogger(plugins, onLog, watchMode, logLevel) {
|
|
1089
1080
|
plugins = getSortedValidatedPlugins('onLog', plugins);
|
|
1090
1081
|
const minimalPriority = parseAst_js.logLevelPriority[logLevel];
|
|
1091
|
-
const logger = (level, log, skipped = EMPTY_SET) => {
|
|
1082
|
+
const logger = (level, log, skipped = parseAst_js.EMPTY_SET) => {
|
|
1092
1083
|
parseAst_js.augmentLogMessage(log);
|
|
1093
1084
|
const logPriority = parseAst_js.logLevelPriority[level];
|
|
1094
1085
|
if (logPriority < minimalPriority) {
|
|
@@ -1479,6 +1470,19 @@ function handleError(error, recover = false) {
|
|
|
1479
1470
|
if (error.stack) {
|
|
1480
1471
|
outputLines.push(dim(error.stack?.replace(`${nameSection}${error.message}\n`, '')));
|
|
1481
1472
|
}
|
|
1473
|
+
// ES2022: Error.prototype.cause is optional
|
|
1474
|
+
if (error.cause) {
|
|
1475
|
+
let cause = error.cause;
|
|
1476
|
+
const causeErrorLines = [];
|
|
1477
|
+
let indent = '';
|
|
1478
|
+
while (cause) {
|
|
1479
|
+
indent += ' ';
|
|
1480
|
+
const message = cause.stack || cause;
|
|
1481
|
+
causeErrorLines.push(...`[cause] ${message}`.split('\n').map(line => indent + line));
|
|
1482
|
+
cause = cause.cause;
|
|
1483
|
+
}
|
|
1484
|
+
outputLines.push(dim(causeErrorLines.join('\n')));
|
|
1485
|
+
}
|
|
1482
1486
|
outputLines.push('', '');
|
|
1483
1487
|
stderr(outputLines.join('\n'));
|
|
1484
1488
|
if (!recover)
|
|
@@ -2816,21 +2820,29 @@ class MagicString {
|
|
|
2816
2820
|
if (searchValue.global) {
|
|
2817
2821
|
const matches = matchAll(searchValue, this.original);
|
|
2818
2822
|
matches.forEach((match) => {
|
|
2819
|
-
if (match.index != null)
|
|
2823
|
+
if (match.index != null) {
|
|
2824
|
+
const replacement = getReplacement(match, this.original);
|
|
2825
|
+
if (replacement !== match[0]) {
|
|
2826
|
+
this.overwrite(
|
|
2827
|
+
match.index,
|
|
2828
|
+
match.index + match[0].length,
|
|
2829
|
+
replacement
|
|
2830
|
+
);
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
});
|
|
2834
|
+
} else {
|
|
2835
|
+
const match = this.original.match(searchValue);
|
|
2836
|
+
if (match && match.index != null) {
|
|
2837
|
+
const replacement = getReplacement(match, this.original);
|
|
2838
|
+
if (replacement !== match[0]) {
|
|
2820
2839
|
this.overwrite(
|
|
2821
2840
|
match.index,
|
|
2822
2841
|
match.index + match[0].length,
|
|
2823
|
-
|
|
2842
|
+
replacement
|
|
2824
2843
|
);
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
const match = this.original.match(searchValue);
|
|
2828
|
-
if (match && match.index != null)
|
|
2829
|
-
this.overwrite(
|
|
2830
|
-
match.index,
|
|
2831
|
-
match.index + match[0].length,
|
|
2832
|
-
getReplacement(match, this.original),
|
|
2833
|
-
);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2834
2846
|
}
|
|
2835
2847
|
return this;
|
|
2836
2848
|
}
|
|
@@ -2862,7 +2874,9 @@ class MagicString {
|
|
|
2862
2874
|
index !== -1;
|
|
2863
2875
|
index = original.indexOf(string, index + stringLength)
|
|
2864
2876
|
) {
|
|
2865
|
-
|
|
2877
|
+
const previous = original.slice(index, index + stringLength);
|
|
2878
|
+
if (previous !== replacement)
|
|
2879
|
+
this.overwrite(index, index + stringLength, replacement);
|
|
2866
2880
|
}
|
|
2867
2881
|
|
|
2868
2882
|
return this;
|
|
@@ -3588,8 +3602,8 @@ class ExternalModule {
|
|
|
3588
3602
|
ast: null,
|
|
3589
3603
|
attributes,
|
|
3590
3604
|
code: null,
|
|
3591
|
-
dynamicallyImportedIdResolutions: EMPTY_ARRAY,
|
|
3592
|
-
dynamicallyImportedIds: EMPTY_ARRAY,
|
|
3605
|
+
dynamicallyImportedIdResolutions: parseAst_js.EMPTY_ARRAY,
|
|
3606
|
+
dynamicallyImportedIds: parseAst_js.EMPTY_ARRAY,
|
|
3593
3607
|
get dynamicImporters() {
|
|
3594
3608
|
return dynamicImporters.sort();
|
|
3595
3609
|
},
|
|
@@ -3597,10 +3611,10 @@ class ExternalModule {
|
|
|
3597
3611
|
exports: null,
|
|
3598
3612
|
hasDefaultExport: null,
|
|
3599
3613
|
id,
|
|
3600
|
-
implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
|
|
3601
|
-
implicitlyLoadedBefore: EMPTY_ARRAY,
|
|
3602
|
-
importedIdResolutions: EMPTY_ARRAY,
|
|
3603
|
-
importedIds: EMPTY_ARRAY,
|
|
3614
|
+
implicitlyLoadedAfterOneOf: parseAst_js.EMPTY_ARRAY,
|
|
3615
|
+
implicitlyLoadedBefore: parseAst_js.EMPTY_ARRAY,
|
|
3616
|
+
importedIdResolutions: parseAst_js.EMPTY_ARRAY,
|
|
3617
|
+
importedIds: parseAst_js.EMPTY_ARRAY,
|
|
3604
3618
|
get importers() {
|
|
3605
3619
|
return importers.sort();
|
|
3606
3620
|
},
|
|
@@ -7134,7 +7148,7 @@ class LocalVariable extends Variable {
|
|
|
7134
7148
|
if (path.length === 0) {
|
|
7135
7149
|
this.isReassigned = true;
|
|
7136
7150
|
const expressionsToBeDeoptimized = this.expressionsToBeDeoptimized;
|
|
7137
|
-
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
7151
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
|
|
7138
7152
|
for (const expression of expressionsToBeDeoptimized) {
|
|
7139
7153
|
expression.deoptimizeCache();
|
|
7140
7154
|
}
|
|
@@ -7233,7 +7247,7 @@ class LocalVariable extends Variable {
|
|
|
7233
7247
|
}
|
|
7234
7248
|
|
|
7235
7249
|
const MAX_TRACKED_INTERACTIONS = 20;
|
|
7236
|
-
const NO_INTERACTIONS = EMPTY_ARRAY;
|
|
7250
|
+
const NO_INTERACTIONS = parseAst_js.EMPTY_ARRAY;
|
|
7237
7251
|
const UNKNOWN_DEOPTIMIZED_FIELD = new Set([UnknownKey]);
|
|
7238
7252
|
const EMPTY_PATH_TRACKER = new PathTracker();
|
|
7239
7253
|
const UNKNOWN_DEOPTIMIZED_ENTITY = new Set([UNKNOWN_EXPRESSION]);
|
|
@@ -8712,13 +8726,7 @@ class GlobalVariable extends Variable {
|
|
|
8712
8726
|
}
|
|
8713
8727
|
}
|
|
8714
8728
|
|
|
8715
|
-
const tdzVariableKinds =
|
|
8716
|
-
__proto__: null,
|
|
8717
|
-
class: true,
|
|
8718
|
-
const: true,
|
|
8719
|
-
let: true,
|
|
8720
|
-
var: true
|
|
8721
|
-
};
|
|
8729
|
+
const tdzVariableKinds = new Set(['class', 'const', 'let', 'var', 'using', 'await using']);
|
|
8722
8730
|
class Identifier extends NodeBase {
|
|
8723
8731
|
constructor() {
|
|
8724
8732
|
super(...arguments);
|
|
@@ -8764,6 +8772,8 @@ class Identifier extends NodeBase {
|
|
|
8764
8772
|
}
|
|
8765
8773
|
case 'let':
|
|
8766
8774
|
case 'const':
|
|
8775
|
+
case 'using':
|
|
8776
|
+
case 'await using':
|
|
8767
8777
|
case 'class': {
|
|
8768
8778
|
variable = this.scope.addDeclaration(this, this.scope.context, init, kind);
|
|
8769
8779
|
break;
|
|
@@ -8846,7 +8856,7 @@ class Identifier extends NodeBase {
|
|
|
8846
8856
|
return cachedTdzAccess;
|
|
8847
8857
|
if (!(this.variable instanceof LocalVariable &&
|
|
8848
8858
|
this.variable.kind &&
|
|
8849
|
-
this.variable.kind
|
|
8859
|
+
tdzVariableKinds.has(this.variable.kind) &&
|
|
8850
8860
|
// we ignore possible TDZs due to circular module dependencies as
|
|
8851
8861
|
// otherwise we get many false positives
|
|
8852
8862
|
this.variable.module === this.scope.context.module)) {
|
|
@@ -8874,7 +8884,7 @@ class Identifier extends NodeBase {
|
|
|
8874
8884
|
markDeclarationReached() {
|
|
8875
8885
|
this.variable.initReached = true;
|
|
8876
8886
|
}
|
|
8877
|
-
render(code, { snippets: { getPropertyAccess }, useOriginalName }, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
|
|
8887
|
+
render(code, { snippets: { getPropertyAccess }, useOriginalName }, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = parseAst_js.BLANK) {
|
|
8878
8888
|
if (this.variable) {
|
|
8879
8889
|
const name = this.variable.getName(getPropertyAccess, useOriginalName);
|
|
8880
8890
|
if (name !== this.name) {
|
|
@@ -9355,15 +9365,12 @@ class FunctionBase extends NodeBase {
|
|
|
9355
9365
|
}
|
|
9356
9366
|
parseNode(esTreeNode) {
|
|
9357
9367
|
const { body, params } = esTreeNode;
|
|
9358
|
-
const parameters = (this.params = []);
|
|
9359
9368
|
const { scope } = this;
|
|
9360
9369
|
const { bodyScope, context } = scope;
|
|
9361
9370
|
// We need to ensure that parameters are declared before the body is parsed
|
|
9362
9371
|
// so that the scope already knows all parameters and can detect conflicts
|
|
9363
9372
|
// when parsing the body.
|
|
9364
|
-
|
|
9365
|
-
parameters.push(new (context.getNodeConstructor(parameter.type))(this, scope).parseNode(parameter));
|
|
9366
|
-
}
|
|
9373
|
+
const parameters = (this.params = params.map((parameter) => new (context.getNodeConstructor(parameter.type))(this, scope).parseNode(parameter)));
|
|
9367
9374
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
9368
9375
|
this.body = new (context.getNodeConstructor(body.type))(this, bodyScope).parseNode(body);
|
|
9369
9376
|
return super.parseNode(esTreeNode);
|
|
@@ -9551,7 +9558,7 @@ class AssignmentExpression extends NodeBase {
|
|
|
9551
9558
|
}
|
|
9552
9559
|
this.left.setAssignedValue(this.right);
|
|
9553
9560
|
}
|
|
9554
|
-
render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
9561
|
+
render(code, options, { preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
9555
9562
|
const { left, right, start, end, parent } = this;
|
|
9556
9563
|
if (left.included) {
|
|
9557
9564
|
left.render(code, options);
|
|
@@ -9623,7 +9630,7 @@ class AssignmentPattern extends NodeBase {
|
|
|
9623
9630
|
markDeclarationReached() {
|
|
9624
9631
|
this.left.markDeclarationReached();
|
|
9625
9632
|
}
|
|
9626
|
-
render(code, options, { isShorthandProperty } = BLANK) {
|
|
9633
|
+
render(code, options, { isShorthandProperty } = parseAst_js.BLANK) {
|
|
9627
9634
|
this.left.render(code, options, { isShorthandProperty });
|
|
9628
9635
|
this.right.render(code, options);
|
|
9629
9636
|
}
|
|
@@ -9860,7 +9867,7 @@ class BinaryExpression extends NodeBase {
|
|
|
9860
9867
|
removeAnnotations(code) {
|
|
9861
9868
|
this.left.removeAnnotations(code);
|
|
9862
9869
|
}
|
|
9863
|
-
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
9870
|
+
render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
9864
9871
|
this.left.render(code, options, { renderedSurroundingElement });
|
|
9865
9872
|
this.right.render(code, options);
|
|
9866
9873
|
}
|
|
@@ -10081,7 +10088,7 @@ class MemberExpression extends NodeBase {
|
|
|
10081
10088
|
}
|
|
10082
10089
|
deoptimizeCache() {
|
|
10083
10090
|
const { expressionsToBeDeoptimized, object } = this;
|
|
10084
|
-
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
10091
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
|
|
10085
10092
|
this.propertyKey = UnknownKey;
|
|
10086
10093
|
object.deoptimizePath(UNKNOWN_PATH);
|
|
10087
10094
|
for (const expression of expressionsToBeDeoptimized) {
|
|
@@ -10192,7 +10199,7 @@ class MemberExpression extends NodeBase {
|
|
|
10192
10199
|
(this.optional &&
|
|
10193
10200
|
this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
|
|
10194
10201
|
}
|
|
10195
|
-
render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
|
|
10202
|
+
render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
10196
10203
|
if (this.variable || this.isUndefined) {
|
|
10197
10204
|
const { snippets: { getPropertyAccess } } = options;
|
|
10198
10205
|
let replacement = this.variable ? this.variable.getName(getPropertyAccess) : 'undefined';
|
|
@@ -10338,8 +10345,8 @@ class CallExpressionBase extends NodeBase {
|
|
|
10338
10345
|
if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
|
|
10339
10346
|
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
10340
10347
|
const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
|
|
10341
|
-
this.expressionsToBeDeoptimized = EMPTY_SET;
|
|
10342
|
-
this.deoptimizableDependentExpressions = EMPTY_ARRAY;
|
|
10348
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_SET;
|
|
10349
|
+
this.deoptimizableDependentExpressions = parseAst_js.EMPTY_ARRAY;
|
|
10343
10350
|
for (const expression of deoptimizableDependentExpressions) {
|
|
10344
10351
|
expression.deoptimizeCache();
|
|
10345
10352
|
}
|
|
@@ -10473,7 +10480,7 @@ class CallExpression extends CallExpressionBase {
|
|
|
10473
10480
|
(this.optional &&
|
|
10474
10481
|
this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
|
|
10475
10482
|
}
|
|
10476
|
-
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
10483
|
+
render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
10477
10484
|
this.callee.render(code, options, {
|
|
10478
10485
|
isCalleeOfRenderedParent: true,
|
|
10479
10486
|
renderedSurroundingElement
|
|
@@ -10828,7 +10835,7 @@ class ClassDeclaration extends ClassNode {
|
|
|
10828
10835
|
}
|
|
10829
10836
|
|
|
10830
10837
|
class ClassExpression extends ClassNode {
|
|
10831
|
-
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
10838
|
+
render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
10832
10839
|
super.render(code, options);
|
|
10833
10840
|
if (renderedSurroundingElement === parseAst_js.ExpressionStatement) {
|
|
10834
10841
|
code.appendRight(this.start, '(');
|
|
@@ -10884,7 +10891,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
10884
10891
|
this.usedBranch = null;
|
|
10885
10892
|
unusedBranch.deoptimizePath(UNKNOWN_PATH);
|
|
10886
10893
|
const { expressionsToBeDeoptimized } = this;
|
|
10887
|
-
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
10894
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
|
|
10888
10895
|
for (const expression of expressionsToBeDeoptimized) {
|
|
10889
10896
|
expression.deoptimizeCache();
|
|
10890
10897
|
}
|
|
@@ -10962,7 +10969,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
10962
10969
|
removeAnnotations(code) {
|
|
10963
10970
|
this.test.removeAnnotations(code);
|
|
10964
10971
|
}
|
|
10965
|
-
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
10972
|
+
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
10966
10973
|
const usedBranch = this.getUsedBranch();
|
|
10967
10974
|
if (this.test.included) {
|
|
10968
10975
|
this.test.render(code, options, { renderedSurroundingElement });
|
|
@@ -11364,7 +11371,7 @@ class FunctionExpression extends FunctionNode {
|
|
|
11364
11371
|
}
|
|
11365
11372
|
return super.parseNode(esTreeNode);
|
|
11366
11373
|
}
|
|
11367
|
-
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
11374
|
+
render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
11368
11375
|
super.render(code, options);
|
|
11369
11376
|
if (renderedSurroundingElement === parseAst_js.ExpressionStatement) {
|
|
11370
11377
|
code.appendRight(this.start, '(');
|
|
@@ -11785,7 +11792,8 @@ function isReassignedExportsMember(variable, exportNamesByVariable) {
|
|
|
11785
11792
|
}
|
|
11786
11793
|
|
|
11787
11794
|
class VariableDeclarator extends NodeBase {
|
|
11788
|
-
declareDeclarator(kind) {
|
|
11795
|
+
declareDeclarator(kind, isUsingDeclaration) {
|
|
11796
|
+
this.isUsingDeclaration = isUsingDeclaration;
|
|
11789
11797
|
this.id.declare(kind, this.init || UNDEFINED_EXPRESSION);
|
|
11790
11798
|
}
|
|
11791
11799
|
deoptimizePath(path) {
|
|
@@ -11796,7 +11804,7 @@ class VariableDeclarator extends NodeBase {
|
|
|
11796
11804
|
this.applyDeoptimizations();
|
|
11797
11805
|
const initEffect = this.init?.hasEffects(context);
|
|
11798
11806
|
this.id.markDeclarationReached();
|
|
11799
|
-
return initEffect || this.id.hasEffects(context);
|
|
11807
|
+
return initEffect || this.id.hasEffects(context) || this.isUsingDeclaration;
|
|
11800
11808
|
}
|
|
11801
11809
|
include(context, includeChildrenRecursively) {
|
|
11802
11810
|
const { deoptimized, id, init } = this;
|
|
@@ -11815,7 +11823,7 @@ class VariableDeclarator extends NodeBase {
|
|
|
11815
11823
|
render(code, options) {
|
|
11816
11824
|
const { exportNamesByVariable, snippets: { _, getPropertyAccess } } = options;
|
|
11817
11825
|
const { end, id, init, start } = this;
|
|
11818
|
-
const renderId = id.included;
|
|
11826
|
+
const renderId = id.included || this.isUsingDeclaration;
|
|
11819
11827
|
if (renderId) {
|
|
11820
11828
|
id.render(code, options);
|
|
11821
11829
|
}
|
|
@@ -11830,7 +11838,7 @@ class VariableDeclarator extends NodeBase {
|
|
|
11830
11838
|
code.appendLeft(init.start + 5, ` ${id.name}`);
|
|
11831
11839
|
}
|
|
11832
11840
|
}
|
|
11833
|
-
init.render(code, options, renderId ? BLANK : { renderedSurroundingElement: parseAst_js.ExpressionStatement });
|
|
11841
|
+
init.render(code, options, renderId ? parseAst_js.BLANK : { renderedSurroundingElement: parseAst_js.ExpressionStatement });
|
|
11834
11842
|
}
|
|
11835
11843
|
else if (id instanceof Identifier &&
|
|
11836
11844
|
isReassignedExportsMember(id.variable, exportNamesByVariable)) {
|
|
@@ -11879,13 +11887,13 @@ class ImportExpression extends NodeBase {
|
|
|
11879
11887
|
const parent1 = this.parent;
|
|
11880
11888
|
// Side-effect only: import('bar')
|
|
11881
11889
|
if (parent1 instanceof ExpressionStatement) {
|
|
11882
|
-
return EMPTY_ARRAY;
|
|
11890
|
+
return parseAst_js.EMPTY_ARRAY;
|
|
11883
11891
|
}
|
|
11884
11892
|
if (parent1 instanceof AwaitExpression) {
|
|
11885
11893
|
const parent2 = parent1.parent;
|
|
11886
11894
|
// Side-effect only: await import('bar')
|
|
11887
11895
|
if (parent2 instanceof ExpressionStatement) {
|
|
11888
|
-
return EMPTY_ARRAY;
|
|
11896
|
+
return parseAst_js.EMPTY_ARRAY;
|
|
11889
11897
|
}
|
|
11890
11898
|
// Case 1: const { foo } = await import('bar')
|
|
11891
11899
|
if (parent2 instanceof VariableDeclarator) {
|
|
@@ -11914,13 +11922,13 @@ class ImportExpression extends NodeBase {
|
|
|
11914
11922
|
// side-effect only, when only chaining .catch or .finally
|
|
11915
11923
|
if (callExpression.parent instanceof ExpressionStatement &&
|
|
11916
11924
|
['catch', 'finally'].includes(memberName)) {
|
|
11917
|
-
return EMPTY_ARRAY;
|
|
11925
|
+
return parseAst_js.EMPTY_ARRAY;
|
|
11918
11926
|
}
|
|
11919
11927
|
if (memberName !== 'then')
|
|
11920
11928
|
return;
|
|
11921
11929
|
// Side-effect only: import('bar').then()
|
|
11922
11930
|
if (callExpression.arguments.length === 0) {
|
|
11923
|
-
return EMPTY_ARRAY;
|
|
11931
|
+
return parseAst_js.EMPTY_ARRAY;
|
|
11924
11932
|
}
|
|
11925
11933
|
const argument = callExpression.arguments[0];
|
|
11926
11934
|
if (callExpression.arguments.length !== 1 ||
|
|
@@ -11929,7 +11937,7 @@ class ImportExpression extends NodeBase {
|
|
|
11929
11937
|
}
|
|
11930
11938
|
// Side-effect only: import('bar').then(() => {})
|
|
11931
11939
|
if (argument.params.length === 0) {
|
|
11932
|
-
return EMPTY_ARRAY;
|
|
11940
|
+
return parseAst_js.EMPTY_ARRAY;
|
|
11933
11941
|
}
|
|
11934
11942
|
const declaration = argument.params[0];
|
|
11935
11943
|
if (argument.params.length === 1 && declaration instanceof ObjectPattern) {
|
|
@@ -12203,7 +12211,7 @@ class LogicalExpression extends NodeBase {
|
|
|
12203
12211
|
this.usedBranch = null;
|
|
12204
12212
|
unusedBranch.deoptimizePath(UNKNOWN_PATH);
|
|
12205
12213
|
const { scope: { context }, expressionsToBeDeoptimized } = this;
|
|
12206
|
-
this.expressionsToBeDeoptimized = EMPTY_ARRAY;
|
|
12214
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
|
|
12207
12215
|
for (const expression of expressionsToBeDeoptimized) {
|
|
12208
12216
|
expression.deoptimizeCache();
|
|
12209
12217
|
}
|
|
@@ -12275,7 +12283,7 @@ class LogicalExpression extends NodeBase {
|
|
|
12275
12283
|
removeAnnotations(code) {
|
|
12276
12284
|
this.left.removeAnnotations(code);
|
|
12277
12285
|
}
|
|
12278
|
-
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
12286
|
+
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
12279
12287
|
if (!this.left.included || !this.right.included) {
|
|
12280
12288
|
const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
|
|
12281
12289
|
if (this.right.included) {
|
|
@@ -12533,7 +12541,7 @@ class ObjectExpression extends NodeBase {
|
|
|
12533
12541
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
12534
12542
|
return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
12535
12543
|
}
|
|
12536
|
-
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
12544
|
+
render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
12537
12545
|
super.render(code, options);
|
|
12538
12546
|
if (renderedSurroundingElement === parseAst_js.ExpressionStatement ||
|
|
12539
12547
|
renderedSurroundingElement === parseAst_js.ArrowFunctionExpression) {
|
|
@@ -12818,7 +12826,7 @@ class SequenceExpression extends NodeBase {
|
|
|
12818
12826
|
removeAnnotations(code) {
|
|
12819
12827
|
this.expressions[0].removeAnnotations(code);
|
|
12820
12828
|
}
|
|
12821
|
-
render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = BLANK) {
|
|
12829
|
+
render(code, options, { renderedParentType, isCalleeOfRenderedParent, preventASI } = parseAst_js.BLANK) {
|
|
12822
12830
|
let includedNodes = 0;
|
|
12823
12831
|
let lastSeparatorPos = null;
|
|
12824
12832
|
const lastNode = this.expressions[this.expressions.length - 1];
|
|
@@ -13473,7 +13481,7 @@ class VariableDeclaration extends NodeBase {
|
|
|
13473
13481
|
hasEffectsOnInteractionAtPath() {
|
|
13474
13482
|
return false;
|
|
13475
13483
|
}
|
|
13476
|
-
include(context, includeChildrenRecursively, { asSingleStatement } = BLANK) {
|
|
13484
|
+
include(context, includeChildrenRecursively, { asSingleStatement } = parseAst_js.BLANK) {
|
|
13477
13485
|
this.included = true;
|
|
13478
13486
|
for (const declarator of this.declarations) {
|
|
13479
13487
|
if (includeChildrenRecursively || declarator.shouldBeIncluded(context))
|
|
@@ -13492,15 +13500,17 @@ class VariableDeclaration extends NodeBase {
|
|
|
13492
13500
|
}
|
|
13493
13501
|
initialise() {
|
|
13494
13502
|
super.initialise();
|
|
13503
|
+
this.isUsingDeclaration = this.kind === 'await using' || this.kind === 'using';
|
|
13495
13504
|
for (const declarator of this.declarations) {
|
|
13496
|
-
declarator.declareDeclarator(this.kind);
|
|
13505
|
+
declarator.declareDeclarator(this.kind, this.isUsingDeclaration);
|
|
13497
13506
|
}
|
|
13498
13507
|
}
|
|
13499
13508
|
removeAnnotations(code) {
|
|
13500
13509
|
this.declarations[0].removeAnnotations(code);
|
|
13501
13510
|
}
|
|
13502
|
-
render(code, options, nodeRenderOptions = BLANK) {
|
|
13503
|
-
if (
|
|
13511
|
+
render(code, options, nodeRenderOptions = parseAst_js.BLANK) {
|
|
13512
|
+
if (this.isUsingDeclaration ||
|
|
13513
|
+
areAllDeclarationsIncludedAndNotExported(this.declarations, options.exportNamesByVariable)) {
|
|
13504
13514
|
for (const declarator of this.declarations) {
|
|
13505
13515
|
declarator.render(code, options);
|
|
13506
13516
|
}
|
|
@@ -13826,18 +13836,18 @@ const nodeConstructors$1 = [
|
|
|
13826
13836
|
];
|
|
13827
13837
|
const bufferParsers = [
|
|
13828
13838
|
function panicError(node, position, buffer, readString) {
|
|
13829
|
-
node.message = parseAst_js.convertString(position, buffer, readString);
|
|
13839
|
+
node.message = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
13830
13840
|
},
|
|
13831
13841
|
function parseError(node, position, buffer, readString) {
|
|
13832
|
-
node.message = parseAst_js.convertString(position, buffer, readString);
|
|
13842
|
+
node.message = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
13833
13843
|
},
|
|
13834
13844
|
function arrayExpression(node, position, buffer, readString) {
|
|
13835
13845
|
const { scope } = node;
|
|
13836
|
-
node.elements = convertNodeList(node, scope, position, buffer, readString);
|
|
13846
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
13837
13847
|
},
|
|
13838
13848
|
function arrayPattern(node, position, buffer, readString) {
|
|
13839
13849
|
const { scope } = node;
|
|
13840
|
-
node.elements = convertNodeList(node, scope, position, buffer, readString);
|
|
13850
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
13841
13851
|
},
|
|
13842
13852
|
function arrowFunctionExpression(node, position, buffer, readString) {
|
|
13843
13853
|
const { scope } = node;
|
|
@@ -13845,36 +13855,36 @@ const bufferParsers = [
|
|
|
13845
13855
|
node.async = (flags & 1) === 1;
|
|
13846
13856
|
node.expression = (flags & 2) === 2;
|
|
13847
13857
|
node.generator = (flags & 4) === 4;
|
|
13848
|
-
const
|
|
13849
|
-
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
13850
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 2], buffer, readString);
|
|
13851
|
-
const annotations = (node.annotations = parseAst_js.convertAnnotations(position + 3, buffer));
|
|
13858
|
+
const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
|
|
13852
13859
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
13860
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer, readString));
|
|
13861
|
+
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
13862
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer, readString);
|
|
13853
13863
|
},
|
|
13854
13864
|
function assignmentExpression(node, position, buffer, readString) {
|
|
13855
13865
|
const { scope } = node;
|
|
13856
13866
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
13857
|
-
node.
|
|
13858
|
-
node.
|
|
13867
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
13868
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
13859
13869
|
},
|
|
13860
13870
|
function assignmentPattern(node, position, buffer, readString) {
|
|
13861
13871
|
const { scope } = node;
|
|
13862
|
-
node.
|
|
13863
|
-
node.
|
|
13872
|
+
node.left = convertNode(node, scope, buffer[position], buffer, readString);
|
|
13873
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
13864
13874
|
},
|
|
13865
13875
|
function awaitExpression(node, position, buffer, readString) {
|
|
13866
13876
|
const { scope } = node;
|
|
13867
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
13877
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
13868
13878
|
},
|
|
13869
13879
|
function binaryExpression(node, position, buffer, readString) {
|
|
13870
13880
|
const { scope } = node;
|
|
13871
13881
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
13872
|
-
node.
|
|
13873
|
-
node.
|
|
13882
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
13883
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
13874
13884
|
},
|
|
13875
13885
|
function blockStatement(node, position, buffer, readString) {
|
|
13876
13886
|
const { scope } = node;
|
|
13877
|
-
node.body = convertNodeList(node, scope, position, buffer, readString);
|
|
13887
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
13878
13888
|
},
|
|
13879
13889
|
function breakStatement(node, position, buffer, readString) {
|
|
13880
13890
|
const { scope } = node;
|
|
@@ -13886,9 +13896,9 @@ const bufferParsers = [
|
|
|
13886
13896
|
const { scope } = node;
|
|
13887
13897
|
const flags = buffer[position];
|
|
13888
13898
|
node.optional = (flags & 1) === 1;
|
|
13889
|
-
node.
|
|
13890
|
-
node.
|
|
13891
|
-
node.
|
|
13899
|
+
node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer);
|
|
13900
|
+
node.callee = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
13901
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer, readString);
|
|
13892
13902
|
},
|
|
13893
13903
|
function catchClause(node, position, buffer, readString) {
|
|
13894
13904
|
const { scope } = node;
|
|
@@ -13902,15 +13912,18 @@ const bufferParsers = [
|
|
|
13902
13912
|
},
|
|
13903
13913
|
function chainExpression(node, position, buffer, readString) {
|
|
13904
13914
|
const { scope } = node;
|
|
13905
|
-
node.expression = convertNode(node, scope, position, buffer, readString);
|
|
13915
|
+
node.expression = convertNode(node, scope, buffer[position], buffer, readString);
|
|
13906
13916
|
},
|
|
13907
13917
|
function classBody(node, position, buffer, readString) {
|
|
13908
13918
|
const { scope } = node;
|
|
13909
|
-
const
|
|
13919
|
+
const bodyPosition = buffer[position];
|
|
13910
13920
|
const body = (node.body = []);
|
|
13911
|
-
|
|
13912
|
-
const
|
|
13913
|
-
|
|
13921
|
+
if (bodyPosition) {
|
|
13922
|
+
const length = buffer[bodyPosition];
|
|
13923
|
+
for (let index = 0; index < length; index++) {
|
|
13924
|
+
const nodePosition = buffer[bodyPosition + 1 + index];
|
|
13925
|
+
body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer, readString));
|
|
13926
|
+
}
|
|
13914
13927
|
}
|
|
13915
13928
|
},
|
|
13916
13929
|
function classDeclaration(node, position, buffer, readString) {
|
|
@@ -13940,9 +13953,9 @@ const bufferParsers = [
|
|
|
13940
13953
|
},
|
|
13941
13954
|
function conditionalExpression(node, position, buffer, readString) {
|
|
13942
13955
|
const { scope } = node;
|
|
13943
|
-
node.
|
|
13944
|
-
node.
|
|
13945
|
-
node.
|
|
13956
|
+
node.test = convertNode(node, scope, buffer[position], buffer, readString);
|
|
13957
|
+
node.consequent = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
13958
|
+
node.alternate = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
13946
13959
|
},
|
|
13947
13960
|
function continueStatement(node, position, buffer, readString) {
|
|
13948
13961
|
const { scope } = node;
|
|
@@ -13953,13 +13966,13 @@ const bufferParsers = [
|
|
|
13953
13966
|
function debuggerStatement() { },
|
|
13954
13967
|
function directive(node, position, buffer, readString) {
|
|
13955
13968
|
const { scope } = node;
|
|
13956
|
-
node.
|
|
13957
|
-
node.
|
|
13969
|
+
node.directive = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
13970
|
+
node.expression = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
13958
13971
|
},
|
|
13959
13972
|
function doWhileStatement(node, position, buffer, readString) {
|
|
13960
13973
|
const { scope } = node;
|
|
13961
|
-
node.
|
|
13962
|
-
node.
|
|
13974
|
+
node.body = convertNode(node, scope, buffer[position], buffer, readString);
|
|
13975
|
+
node.test = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
13963
13976
|
},
|
|
13964
13977
|
function emptyStatement() { },
|
|
13965
13978
|
function exportAllDeclaration(node, position, buffer, readString) {
|
|
@@ -13974,25 +13987,25 @@ const bufferParsers = [
|
|
|
13974
13987
|
},
|
|
13975
13988
|
function exportDefaultDeclaration(node, position, buffer, readString) {
|
|
13976
13989
|
const { scope } = node;
|
|
13977
|
-
node.declaration = convertNode(node, scope, position, buffer, readString);
|
|
13990
|
+
node.declaration = convertNode(node, scope, buffer[position], buffer, readString);
|
|
13978
13991
|
},
|
|
13979
13992
|
function exportNamedDeclaration(node, position, buffer, readString) {
|
|
13980
13993
|
const { scope } = node;
|
|
13981
|
-
|
|
13994
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
13995
|
+
const sourcePosition = buffer[position + 1];
|
|
13982
13996
|
node.source =
|
|
13983
13997
|
sourcePosition === 0 ? null : convertNode(node, scope, sourcePosition, buffer, readString);
|
|
13984
|
-
node.attributes = convertNodeList(node, scope, buffer[position +
|
|
13985
|
-
const declarationPosition = buffer[position +
|
|
13998
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
13999
|
+
const declarationPosition = buffer[position + 3];
|
|
13986
14000
|
node.declaration =
|
|
13987
14001
|
declarationPosition === 0
|
|
13988
14002
|
? null
|
|
13989
14003
|
: convertNode(node, scope, declarationPosition, buffer, readString);
|
|
13990
|
-
node.specifiers = convertNodeList(node, scope, position + 3, buffer, readString);
|
|
13991
14004
|
},
|
|
13992
14005
|
function exportSpecifier(node, position, buffer, readString) {
|
|
13993
14006
|
const { scope } = node;
|
|
13994
|
-
|
|
13995
|
-
|
|
14007
|
+
node.local = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14008
|
+
const exportedPosition = buffer[position + 1];
|
|
13996
14009
|
node.exported =
|
|
13997
14010
|
exportedPosition === 0
|
|
13998
14011
|
? node.local
|
|
@@ -14000,21 +14013,21 @@ const bufferParsers = [
|
|
|
14000
14013
|
},
|
|
14001
14014
|
function expressionStatement(node, position, buffer, readString) {
|
|
14002
14015
|
const { scope } = node;
|
|
14003
|
-
node.expression = convertNode(node, scope, position, buffer, readString);
|
|
14016
|
+
node.expression = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14004
14017
|
},
|
|
14005
14018
|
function forInStatement(node, position, buffer, readString) {
|
|
14006
14019
|
const { scope } = node;
|
|
14007
|
-
node.
|
|
14008
|
-
node.
|
|
14009
|
-
node.
|
|
14020
|
+
node.left = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14021
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14022
|
+
node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14010
14023
|
},
|
|
14011
14024
|
function forOfStatement(node, position, buffer, readString) {
|
|
14012
14025
|
const { scope } = node;
|
|
14013
14026
|
const flags = buffer[position];
|
|
14014
14027
|
node.await = (flags & 1) === 1;
|
|
14015
|
-
node.
|
|
14016
|
-
node.
|
|
14017
|
-
node.
|
|
14028
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14029
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14030
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer, readString);
|
|
14018
14031
|
},
|
|
14019
14032
|
function forStatement(node, position, buffer, readString) {
|
|
14020
14033
|
const { scope } = node;
|
|
@@ -14034,70 +14047,70 @@ const bufferParsers = [
|
|
|
14034
14047
|
const flags = buffer[position];
|
|
14035
14048
|
node.async = (flags & 1) === 1;
|
|
14036
14049
|
node.generator = (flags & 2) === 2;
|
|
14037
|
-
const
|
|
14050
|
+
const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
|
|
14051
|
+
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14052
|
+
const idPosition = buffer[position + 2];
|
|
14038
14053
|
node.id =
|
|
14039
14054
|
idPosition === 0
|
|
14040
14055
|
? null
|
|
14041
14056
|
: convertNode(node, scope.parent, idPosition, buffer, readString);
|
|
14042
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position +
|
|
14057
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
14043
14058
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
14044
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position +
|
|
14045
|
-
const annotations = (node.annotations = parseAst_js.convertAnnotations(position + 4, buffer));
|
|
14046
|
-
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14059
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer, readString);
|
|
14047
14060
|
},
|
|
14048
14061
|
function functionExpression(node, position, buffer, readString) {
|
|
14049
14062
|
const { scope } = node;
|
|
14050
14063
|
const flags = buffer[position];
|
|
14051
14064
|
node.async = (flags & 1) === 1;
|
|
14052
14065
|
node.generator = (flags & 2) === 2;
|
|
14053
|
-
const
|
|
14066
|
+
const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
|
|
14067
|
+
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14068
|
+
const idPosition = buffer[position + 2];
|
|
14054
14069
|
node.id =
|
|
14055
14070
|
idPosition === 0 ? null : convertNode(node, node.idScope, idPosition, buffer, readString);
|
|
14056
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position +
|
|
14071
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
14057
14072
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
14058
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position +
|
|
14059
|
-
const annotations = (node.annotations = parseAst_js.convertAnnotations(position + 4, buffer));
|
|
14060
|
-
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14073
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer, readString);
|
|
14061
14074
|
},
|
|
14062
14075
|
function identifier(node, position, buffer, readString) {
|
|
14063
|
-
node.name = parseAst_js.convertString(position, buffer, readString);
|
|
14076
|
+
node.name = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
14064
14077
|
},
|
|
14065
14078
|
function ifStatement(node, position, buffer, readString) {
|
|
14066
14079
|
const { scope } = node;
|
|
14067
|
-
node.
|
|
14068
|
-
|
|
14080
|
+
node.test = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14081
|
+
node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer, readString);
|
|
14082
|
+
const alternatePosition = buffer[position + 2];
|
|
14069
14083
|
node.alternate =
|
|
14070
14084
|
alternatePosition === 0
|
|
14071
14085
|
? null
|
|
14072
14086
|
: convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer, readString);
|
|
14073
|
-
node.test = convertNode(node, scope, position + 2, buffer, readString);
|
|
14074
14087
|
},
|
|
14075
14088
|
function importAttribute(node, position, buffer, readString) {
|
|
14076
14089
|
const { scope } = node;
|
|
14077
|
-
node.
|
|
14078
|
-
node.
|
|
14090
|
+
node.key = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14091
|
+
node.value = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14079
14092
|
},
|
|
14080
14093
|
function importDeclaration(node, position, buffer, readString) {
|
|
14081
14094
|
const { scope } = node;
|
|
14082
|
-
node.
|
|
14083
|
-
node.
|
|
14084
|
-
node.
|
|
14095
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14096
|
+
node.source = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14097
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
14085
14098
|
},
|
|
14086
14099
|
function importDefaultSpecifier(node, position, buffer, readString) {
|
|
14087
14100
|
const { scope } = node;
|
|
14088
|
-
node.local = convertNode(node, scope, position, buffer, readString);
|
|
14101
|
+
node.local = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14089
14102
|
},
|
|
14090
14103
|
function importExpression(node, position, buffer, readString) {
|
|
14091
14104
|
const { scope } = node;
|
|
14092
|
-
|
|
14105
|
+
node.source = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14106
|
+
node.sourceAstNode = parseAst_js.convertNode(buffer[position], buffer, readString);
|
|
14107
|
+
const optionsPosition = buffer[position + 1];
|
|
14093
14108
|
node.options =
|
|
14094
14109
|
optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer, readString);
|
|
14095
|
-
node.source = convertNode(node, scope, position + 1, buffer, readString);
|
|
14096
|
-
node.sourceAstNode = parseAst_js.convertNode(position + 1, buffer, readString);
|
|
14097
14110
|
},
|
|
14098
14111
|
function importNamespaceSpecifier(node, position, buffer, readString) {
|
|
14099
14112
|
const { scope } = node;
|
|
14100
|
-
node.local = convertNode(node, scope, position, buffer, readString);
|
|
14113
|
+
node.local = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14101
14114
|
},
|
|
14102
14115
|
function importSpecifier(node, position, buffer, readString) {
|
|
14103
14116
|
const { scope } = node;
|
|
@@ -14110,12 +14123,12 @@ const bufferParsers = [
|
|
|
14110
14123
|
},
|
|
14111
14124
|
function labeledStatement(node, position, buffer, readString) {
|
|
14112
14125
|
const { scope } = node;
|
|
14113
|
-
node.
|
|
14114
|
-
node.
|
|
14126
|
+
node.label = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14127
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14115
14128
|
},
|
|
14116
14129
|
function literalBigInt(node, position, buffer, readString) {
|
|
14117
|
-
node.
|
|
14118
|
-
|
|
14130
|
+
const bigint = (node.bigint = parseAst_js.convertString(buffer[position], buffer, readString));
|
|
14131
|
+
node.raw = parseAst_js.convertString(buffer[position + 1], buffer, readString);
|
|
14119
14132
|
node.value = BigInt(bigint);
|
|
14120
14133
|
},
|
|
14121
14134
|
function literalBoolean(node, position, buffer) {
|
|
@@ -14132,66 +14145,66 @@ const bufferParsers = [
|
|
|
14132
14145
|
node.value = new DataView(buffer.buffer).getFloat64((position + 1) << 2, true);
|
|
14133
14146
|
},
|
|
14134
14147
|
function literalRegExp(node, position, buffer, readString) {
|
|
14135
|
-
const
|
|
14136
|
-
const
|
|
14148
|
+
const flags = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
14149
|
+
const pattern = parseAst_js.convertString(buffer[position + 1], buffer, readString);
|
|
14137
14150
|
node.raw = `/${pattern}/${flags}`;
|
|
14138
14151
|
node.regex = { flags, pattern };
|
|
14139
14152
|
node.value = new RegExp(pattern, flags);
|
|
14140
14153
|
},
|
|
14141
14154
|
function literalString(node, position, buffer, readString) {
|
|
14142
|
-
|
|
14155
|
+
node.value = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
14156
|
+
const rawPosition = buffer[position + 1];
|
|
14143
14157
|
node.raw = rawPosition === 0 ? undefined : parseAst_js.convertString(rawPosition, buffer, readString);
|
|
14144
|
-
node.value = parseAst_js.convertString(position + 1, buffer, readString);
|
|
14145
14158
|
},
|
|
14146
14159
|
function logicalExpression(node, position, buffer, readString) {
|
|
14147
14160
|
const { scope } = node;
|
|
14148
14161
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14149
|
-
node.
|
|
14150
|
-
node.
|
|
14162
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14163
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14151
14164
|
},
|
|
14152
14165
|
function memberExpression(node, position, buffer, readString) {
|
|
14153
14166
|
const { scope } = node;
|
|
14154
14167
|
const flags = buffer[position];
|
|
14155
14168
|
node.computed = (flags & 1) === 1;
|
|
14156
14169
|
node.optional = (flags & 2) === 2;
|
|
14157
|
-
node.
|
|
14158
|
-
node.
|
|
14170
|
+
node.object = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14171
|
+
node.property = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14159
14172
|
},
|
|
14160
14173
|
function metaProperty(node, position, buffer, readString) {
|
|
14161
14174
|
const { scope } = node;
|
|
14162
|
-
node.
|
|
14163
|
-
node.
|
|
14175
|
+
node.meta = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14176
|
+
node.property = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14164
14177
|
},
|
|
14165
14178
|
function methodDefinition(node, position, buffer, readString) {
|
|
14166
14179
|
const { scope } = node;
|
|
14167
14180
|
const flags = buffer[position];
|
|
14168
14181
|
node.static = (flags & 1) === 1;
|
|
14169
14182
|
node.computed = (flags & 2) === 2;
|
|
14170
|
-
node.
|
|
14171
|
-
node.
|
|
14172
|
-
node.
|
|
14183
|
+
node.key = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14184
|
+
node.value = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14185
|
+
node.kind = parseAst_js.FIXED_STRINGS[buffer[position + 3]];
|
|
14173
14186
|
},
|
|
14174
14187
|
function newExpression(node, position, buffer, readString) {
|
|
14175
14188
|
const { scope } = node;
|
|
14176
|
-
node.
|
|
14177
|
-
node.
|
|
14178
|
-
node.
|
|
14189
|
+
node.annotations = parseAst_js.convertAnnotations(buffer[position], buffer);
|
|
14190
|
+
node.callee = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14191
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
14179
14192
|
},
|
|
14180
14193
|
function objectExpression(node, position, buffer, readString) {
|
|
14181
14194
|
const { scope } = node;
|
|
14182
|
-
node.properties = convertNodeList(node, scope, position, buffer, readString);
|
|
14195
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14183
14196
|
},
|
|
14184
14197
|
function objectPattern(node, position, buffer, readString) {
|
|
14185
14198
|
const { scope } = node;
|
|
14186
|
-
node.properties = convertNodeList(node, scope, position, buffer, readString);
|
|
14199
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14187
14200
|
},
|
|
14188
14201
|
function privateIdentifier(node, position, buffer, readString) {
|
|
14189
|
-
node.name = parseAst_js.convertString(position, buffer, readString);
|
|
14202
|
+
node.name = parseAst_js.convertString(buffer[position], buffer, readString);
|
|
14190
14203
|
},
|
|
14191
14204
|
function program(node, position, buffer, readString) {
|
|
14192
14205
|
const { scope } = node;
|
|
14193
|
-
node.
|
|
14194
|
-
node.
|
|
14206
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14207
|
+
node.invalidAnnotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer);
|
|
14195
14208
|
},
|
|
14196
14209
|
function property(node, position, buffer, readString) {
|
|
14197
14210
|
const { scope } = node;
|
|
@@ -14210,14 +14223,14 @@ const bufferParsers = [
|
|
|
14210
14223
|
const flags = buffer[position];
|
|
14211
14224
|
node.static = (flags & 1) === 1;
|
|
14212
14225
|
node.computed = (flags & 2) === 2;
|
|
14213
|
-
|
|
14226
|
+
node.key = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14227
|
+
const valuePosition = buffer[position + 2];
|
|
14214
14228
|
node.value =
|
|
14215
14229
|
valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer, readString);
|
|
14216
|
-
node.key = convertNode(node, scope, position + 2, buffer, readString);
|
|
14217
14230
|
},
|
|
14218
14231
|
function restElement(node, position, buffer, readString) {
|
|
14219
14232
|
const { scope } = node;
|
|
14220
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
14233
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14221
14234
|
},
|
|
14222
14235
|
function returnStatement(node, position, buffer, readString) {
|
|
14223
14236
|
const { scope } = node;
|
|
@@ -14229,15 +14242,15 @@ const bufferParsers = [
|
|
|
14229
14242
|
},
|
|
14230
14243
|
function sequenceExpression(node, position, buffer, readString) {
|
|
14231
14244
|
const { scope } = node;
|
|
14232
|
-
node.expressions = convertNodeList(node, scope, position, buffer, readString);
|
|
14245
|
+
node.expressions = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14233
14246
|
},
|
|
14234
14247
|
function spreadElement(node, position, buffer, readString) {
|
|
14235
14248
|
const { scope } = node;
|
|
14236
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
14249
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14237
14250
|
},
|
|
14238
14251
|
function staticBlock(node, position, buffer, readString) {
|
|
14239
14252
|
const { scope } = node;
|
|
14240
|
-
node.body = convertNodeList(node, scope, position, buffer, readString);
|
|
14253
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14241
14254
|
},
|
|
14242
14255
|
function superElement() { },
|
|
14243
14256
|
function switchCase(node, position, buffer, readString) {
|
|
@@ -14249,72 +14262,72 @@ const bufferParsers = [
|
|
|
14249
14262
|
},
|
|
14250
14263
|
function switchStatement(node, position, buffer, readString) {
|
|
14251
14264
|
const { scope } = node;
|
|
14252
|
-
node.
|
|
14253
|
-
node.
|
|
14265
|
+
node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer, readString);
|
|
14266
|
+
node.cases = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
14254
14267
|
},
|
|
14255
14268
|
function taggedTemplateExpression(node, position, buffer, readString) {
|
|
14256
14269
|
const { scope } = node;
|
|
14257
|
-
node.
|
|
14258
|
-
node.
|
|
14270
|
+
node.tag = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14271
|
+
node.quasi = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14259
14272
|
},
|
|
14260
14273
|
function templateElement(node, position, buffer, readString) {
|
|
14261
14274
|
const flags = buffer[position];
|
|
14262
14275
|
node.tail = (flags & 1) === 1;
|
|
14263
14276
|
const cookedPosition = buffer[position + 1];
|
|
14264
14277
|
const cooked = cookedPosition === 0 ? undefined : parseAst_js.convertString(cookedPosition, buffer, readString);
|
|
14265
|
-
const raw = parseAst_js.convertString(position + 2, buffer, readString);
|
|
14278
|
+
const raw = parseAst_js.convertString(buffer[position + 2], buffer, readString);
|
|
14266
14279
|
node.value = { cooked, raw };
|
|
14267
14280
|
},
|
|
14268
14281
|
function templateLiteral(node, position, buffer, readString) {
|
|
14269
14282
|
const { scope } = node;
|
|
14270
|
-
node.
|
|
14271
|
-
node.
|
|
14283
|
+
node.quasis = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
14284
|
+
node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
14272
14285
|
},
|
|
14273
14286
|
function thisExpression() { },
|
|
14274
14287
|
function throwStatement(node, position, buffer, readString) {
|
|
14275
14288
|
const { scope } = node;
|
|
14276
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
14289
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14277
14290
|
},
|
|
14278
14291
|
function tryStatement(node, position, buffer, readString) {
|
|
14279
14292
|
const { scope } = node;
|
|
14280
|
-
|
|
14293
|
+
node.block = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14294
|
+
const handlerPosition = buffer[position + 1];
|
|
14281
14295
|
node.handler =
|
|
14282
14296
|
handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer, readString);
|
|
14283
|
-
const finalizerPosition = buffer[position +
|
|
14297
|
+
const finalizerPosition = buffer[position + 2];
|
|
14284
14298
|
node.finalizer =
|
|
14285
14299
|
finalizerPosition === 0
|
|
14286
14300
|
? null
|
|
14287
14301
|
: convertNode(node, scope, finalizerPosition, buffer, readString);
|
|
14288
|
-
node.block = convertNode(node, scope, position + 2, buffer, readString);
|
|
14289
14302
|
},
|
|
14290
14303
|
function unaryExpression(node, position, buffer, readString) {
|
|
14291
14304
|
const { scope } = node;
|
|
14292
14305
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14293
|
-
node.argument = convertNode(node, scope, position + 1, buffer, readString);
|
|
14306
|
+
node.argument = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14294
14307
|
},
|
|
14295
14308
|
function updateExpression(node, position, buffer, readString) {
|
|
14296
14309
|
const { scope } = node;
|
|
14297
14310
|
const flags = buffer[position];
|
|
14298
14311
|
node.prefix = (flags & 1) === 1;
|
|
14299
14312
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position + 1]];
|
|
14300
|
-
node.argument = convertNode(node, scope, position + 2, buffer, readString);
|
|
14313
|
+
node.argument = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14301
14314
|
},
|
|
14302
14315
|
function variableDeclaration(node, position, buffer, readString) {
|
|
14303
14316
|
const { scope } = node;
|
|
14304
14317
|
node.kind = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14305
|
-
node.declarations = convertNodeList(node, scope, position + 1, buffer, readString);
|
|
14318
|
+
node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
14306
14319
|
},
|
|
14307
14320
|
function variableDeclarator(node, position, buffer, readString) {
|
|
14308
14321
|
const { scope } = node;
|
|
14309
|
-
|
|
14322
|
+
node.id = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14323
|
+
const initPosition = buffer[position + 1];
|
|
14310
14324
|
node.init =
|
|
14311
14325
|
initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
|
|
14312
|
-
node.id = convertNode(node, scope, position + 1, buffer, readString);
|
|
14313
14326
|
},
|
|
14314
14327
|
function whileStatement(node, position, buffer, readString) {
|
|
14315
14328
|
const { scope } = node;
|
|
14316
|
-
node.
|
|
14317
|
-
node.
|
|
14329
|
+
node.test = convertNode(node, scope, buffer[position], buffer, readString);
|
|
14330
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14318
14331
|
},
|
|
14319
14332
|
function yieldExpression(node, position, buffer, readString) {
|
|
14320
14333
|
const { scope } = node;
|
|
@@ -14344,6 +14357,8 @@ function convertNode(parent, parentScope, position, buffer, readString) {
|
|
|
14344
14357
|
return node;
|
|
14345
14358
|
}
|
|
14346
14359
|
function convertNodeList(parent, parentScope, position, buffer, readString) {
|
|
14360
|
+
if (position === 0)
|
|
14361
|
+
return parseAst_js.EMPTY_ARRAY;
|
|
14347
14362
|
const length = buffer[position++];
|
|
14348
14363
|
const list = [];
|
|
14349
14364
|
for (let index = 0; index < length; index++) {
|
|
@@ -14730,15 +14745,15 @@ function getAttributesFromImportExpression(node) {
|
|
|
14730
14745
|
if (options) {
|
|
14731
14746
|
context.module.log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logImportAttributeIsInvalid(context.module.id), start);
|
|
14732
14747
|
}
|
|
14733
|
-
return EMPTY_OBJECT;
|
|
14748
|
+
return parseAst_js.EMPTY_OBJECT;
|
|
14734
14749
|
}
|
|
14735
14750
|
const assertProperty = options.properties.find((property) => ATTRIBUTE_KEYWORDS.has(getPropertyKey(property)))?.value;
|
|
14736
14751
|
if (!assertProperty) {
|
|
14737
|
-
return EMPTY_OBJECT;
|
|
14752
|
+
return parseAst_js.EMPTY_OBJECT;
|
|
14738
14753
|
}
|
|
14739
14754
|
if (!(assertProperty instanceof ObjectExpression)) {
|
|
14740
14755
|
context.module.log(parseAst_js.LOGLEVEL_WARN, parseAst_js.logImportOptionsAreInvalid(context.module.id), start);
|
|
14741
|
-
return EMPTY_OBJECT;
|
|
14756
|
+
return parseAst_js.EMPTY_OBJECT;
|
|
14742
14757
|
}
|
|
14743
14758
|
const assertFields = assertProperty.properties
|
|
14744
14759
|
.map(property => {
|
|
@@ -14754,7 +14769,7 @@ function getAttributesFromImportExpression(node) {
|
|
|
14754
14769
|
if (assertFields.length > 0) {
|
|
14755
14770
|
return Object.fromEntries(assertFields);
|
|
14756
14771
|
}
|
|
14757
|
-
return EMPTY_OBJECT;
|
|
14772
|
+
return parseAst_js.EMPTY_OBJECT;
|
|
14758
14773
|
}
|
|
14759
14774
|
const getPropertyKey = (property) => {
|
|
14760
14775
|
const key = property.key;
|
|
@@ -14765,7 +14780,7 @@ const getPropertyKey = (property) => {
|
|
|
14765
14780
|
function getAttributesFromImportExportDeclaration(attributes) {
|
|
14766
14781
|
return attributes?.length
|
|
14767
14782
|
? Object.fromEntries(attributes.map(assertion => [getPropertyKey(assertion), assertion.value.value]))
|
|
14768
|
-
: EMPTY_OBJECT;
|
|
14783
|
+
: parseAst_js.EMPTY_OBJECT;
|
|
14769
14784
|
}
|
|
14770
14785
|
function doAttributesDiffer(assertionA, assertionB) {
|
|
14771
14786
|
const keysA = Object.keys(assertionA);
|
|
@@ -15253,7 +15268,7 @@ class Module {
|
|
|
15253
15268
|
}
|
|
15254
15269
|
return this.syntheticNamespace;
|
|
15255
15270
|
}
|
|
15256
|
-
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
15271
|
+
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = parseAst_js.EMPTY_OBJECT) {
|
|
15257
15272
|
if (name[0] === '*') {
|
|
15258
15273
|
if (name.length === 1) {
|
|
15259
15274
|
// export * from './other'
|
|
@@ -15539,7 +15554,7 @@ class Module {
|
|
|
15539
15554
|
transformFiles: this.transformFiles
|
|
15540
15555
|
};
|
|
15541
15556
|
}
|
|
15542
|
-
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
15557
|
+
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = parseAst_js.EMPTY_OBJECT) {
|
|
15543
15558
|
const localVariable = this.scope.variables.get(name);
|
|
15544
15559
|
if (localVariable) {
|
|
15545
15560
|
return localVariable;
|
|
@@ -19459,9 +19474,9 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
|
|
19459
19474
|
}
|
|
19460
19475
|
replaceContext = (pluginContext, plugin) => ({
|
|
19461
19476
|
...pluginContext,
|
|
19462
|
-
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) => {
|
|
19477
|
+
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = parseAst_js.BLANK) => {
|
|
19463
19478
|
skipSelf ??= true;
|
|
19464
|
-
return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
|
|
19479
|
+
return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || parseAst_js.EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
|
|
19465
19480
|
}
|
|
19466
19481
|
});
|
|
19467
19482
|
}
|
|
@@ -19710,7 +19725,7 @@ class ModuleLoader {
|
|
|
19710
19725
|
return module;
|
|
19711
19726
|
}
|
|
19712
19727
|
async preloadModule(resolvedId) {
|
|
19713
|
-
const module = await this.fetchModule(this.getResolvedIdWithDefaults(resolvedId, EMPTY_OBJECT), undefined, false, resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true);
|
|
19728
|
+
const module = await this.fetchModule(this.getResolvedIdWithDefaults(resolvedId, parseAst_js.EMPTY_OBJECT), undefined, false, resolvedId.resolveDependencies ? RESOLVE_DEPENDENCIES : true);
|
|
19714
19729
|
return module.info;
|
|
19715
19730
|
}
|
|
19716
19731
|
addEntryWithImplicitDependants(unresolvedModule, implicitlyLoadedAfter) {
|
|
@@ -19957,7 +19972,7 @@ class ModuleLoader {
|
|
|
19957
19972
|
source,
|
|
19958
19973
|
(module.resolvedIds[source] =
|
|
19959
19974
|
module.resolvedIds[source] ||
|
|
19960
|
-
this.handleInvalidResolvedId(await this.resolveId(source, module.id, EMPTY_OBJECT, false, attributes), source, module.id, attributes))
|
|
19975
|
+
this.handleInvalidResolvedId(await this.resolveId(source, module.id, parseAst_js.EMPTY_OBJECT, false, attributes), source, module.id, attributes))
|
|
19961
19976
|
]);
|
|
19962
19977
|
}
|
|
19963
19978
|
getResolvedIdWithDefaults(resolvedId, attributes) {
|
|
@@ -20016,7 +20031,7 @@ class ModuleLoader {
|
|
|
20016
20031
|
return resolvedId;
|
|
20017
20032
|
}
|
|
20018
20033
|
async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore, isLoadForManualChunks = false) {
|
|
20019
|
-
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT, true, EMPTY_OBJECT);
|
|
20034
|
+
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, parseAst_js.EMPTY_OBJECT, true, parseAst_js.EMPTY_OBJECT);
|
|
20020
20035
|
if (resolveIdResult == null) {
|
|
20021
20036
|
return parseAst_js.error(implicitlyLoadedBefore === null
|
|
20022
20037
|
? parseAst_js.logUnresolvedEntry(unresolvedId)
|
|
@@ -20032,7 +20047,7 @@ class ModuleLoader {
|
|
|
20032
20047
|
}
|
|
20033
20048
|
return this.fetchModule(this.getResolvedIdWithDefaults(typeof resolveIdResult === 'object'
|
|
20034
20049
|
? resolveIdResult
|
|
20035
|
-
: { id: resolveIdResult }, EMPTY_OBJECT), undefined, isEntry, false);
|
|
20050
|
+
: { id: resolveIdResult }, parseAst_js.EMPTY_OBJECT), undefined, isEntry, false);
|
|
20036
20051
|
}
|
|
20037
20052
|
async resolveDynamicImport(module, specifier, importer, attributes) {
|
|
20038
20053
|
const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
|
|
@@ -20057,7 +20072,7 @@ class ModuleLoader {
|
|
|
20057
20072
|
}
|
|
20058
20073
|
return existingResolution;
|
|
20059
20074
|
}
|
|
20060
|
-
return (module.resolvedIds[specifier] = this.handleInvalidResolvedId(await this.resolveId(specifier, module.id, EMPTY_OBJECT, false, attributes), specifier, module.id, attributes));
|
|
20075
|
+
return (module.resolvedIds[specifier] = this.handleInvalidResolvedId(await this.resolveId(specifier, module.id, parseAst_js.EMPTY_OBJECT, false, attributes), specifier, module.id, attributes));
|
|
20061
20076
|
}
|
|
20062
20077
|
return this.handleInvalidResolvedId(this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(resolution, importer, specifier), attributes), specifier, importer, attributes);
|
|
20063
20078
|
}
|
|
@@ -20469,7 +20484,7 @@ const getTreeshake = (config) => {
|
|
|
20469
20484
|
return {
|
|
20470
20485
|
annotations: configWithPreset.annotations !== false,
|
|
20471
20486
|
correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
|
|
20472
|
-
manualPureFunctions: configWithPreset.manualPureFunctions ?? EMPTY_ARRAY,
|
|
20487
|
+
manualPureFunctions: configWithPreset.manualPureFunctions ?? parseAst_js.EMPTY_ARRAY,
|
|
20473
20488
|
moduleSideEffects: getHasModuleSideEffects(configWithPreset.moduleSideEffects),
|
|
20474
20489
|
propertyReadSideEffects: configWithPreset.propertyReadSideEffects === 'always'
|
|
20475
20490
|
? 'always'
|