@rollup/wasm-node 4.64.4 → 4.64.6
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 +3 -3
- 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 +161 -65
- package/dist/es/shared/parseAst.js +2 -2
- 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/node-entry.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +161 -65
- 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 +1 -1
package/dist/bin/rollup
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
3
|
@license
|
|
4
|
-
Rollup.js v4.64.
|
|
5
|
-
|
|
4
|
+
Rollup.js v4.64.6
|
|
5
|
+
Tue, 13 Oct 2026 09:01:30 GMT - commit 3ba51901a0f41d8e6d4152c407cba036fb599feb
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ require('node:perf_hooks');
|
|
|
27
27
|
require('node:url');
|
|
28
28
|
require('../getLogFilter.js');
|
|
29
29
|
|
|
30
|
-
const help = "rollup version 4.64.
|
|
30
|
+
const help = "rollup version 4.64.6\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @license
|
package/dist/es/getLogFilter.js
CHANGED
package/dist/es/parseAst.js
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.64.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.64.6
|
|
4
|
+
Tue, 13 Oct 2026 09:01:30 GMT - commit 3ba51901a0f41d8e6d4152c407cba036fb599feb
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ function _mergeNamespaces(n, m) {
|
|
|
27
27
|
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version = "4.64.
|
|
30
|
+
var version = "4.64.6";
|
|
31
31
|
const pkg = {
|
|
32
32
|
version: version};
|
|
33
33
|
|
|
@@ -6064,6 +6064,47 @@ class MethodDefinition extends MethodBase {
|
|
|
6064
6064
|
}
|
|
6065
6065
|
}
|
|
6066
6066
|
|
|
6067
|
+
class PropertyDefinition extends NodeBase {
|
|
6068
|
+
get computed() {
|
|
6069
|
+
return isFlagSet(this.flags, 1024 /* Flag.computed */);
|
|
6070
|
+
}
|
|
6071
|
+
set computed(value) {
|
|
6072
|
+
this.flags = setFlag(this.flags, 1024 /* Flag.computed */, value);
|
|
6073
|
+
}
|
|
6074
|
+
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
6075
|
+
this.value?.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
6076
|
+
}
|
|
6077
|
+
deoptimizePath(path) {
|
|
6078
|
+
this.value?.deoptimizePath(path);
|
|
6079
|
+
}
|
|
6080
|
+
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
6081
|
+
return this.value
|
|
6082
|
+
? this.value.getLiteralValueAtPath(path, recursionTracker, origin)
|
|
6083
|
+
: UnknownValue;
|
|
6084
|
+
}
|
|
6085
|
+
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
6086
|
+
return this.value
|
|
6087
|
+
? this.value.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)
|
|
6088
|
+
: UNKNOWN_RETURN_EXPRESSION;
|
|
6089
|
+
}
|
|
6090
|
+
hasEffects(context) {
|
|
6091
|
+
return (this.key.hasEffects(context) ||
|
|
6092
|
+
(this.static && !!this.value?.hasEffects(context)) ||
|
|
6093
|
+
checkEffectForNodes(this.decorators, context));
|
|
6094
|
+
}
|
|
6095
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
6096
|
+
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
6097
|
+
}
|
|
6098
|
+
includeNode(context) {
|
|
6099
|
+
this.included = true;
|
|
6100
|
+
this.value?.includePath(UNKNOWN_PATH, context);
|
|
6101
|
+
for (const decorator of this.decorators) {
|
|
6102
|
+
decorator.includePath(UNKNOWN_PATH, context);
|
|
6103
|
+
}
|
|
6104
|
+
}
|
|
6105
|
+
}
|
|
6106
|
+
PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
6107
|
+
|
|
6067
6108
|
class BlockScope extends ChildScope {
|
|
6068
6109
|
constructor(parent) {
|
|
6069
6110
|
super(parent, parent.context);
|
|
@@ -6129,6 +6170,7 @@ function isStaticBlock(statement) {
|
|
|
6129
6170
|
class ClassNode extends NodeBase {
|
|
6130
6171
|
constructor() {
|
|
6131
6172
|
super(...arguments);
|
|
6173
|
+
this.instanceFieldValues = null;
|
|
6132
6174
|
this.objectEntity = null;
|
|
6133
6175
|
}
|
|
6134
6176
|
createScope(parentScope) {
|
|
@@ -6162,7 +6204,7 @@ class ClassNode extends NodeBase {
|
|
|
6162
6204
|
(this.classConstructor === null
|
|
6163
6205
|
? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
|
|
6164
6206
|
: this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
|
|
6165
|
-
|
|
6207
|
+
this.hasEffectsOnInstanceFieldInitialization(context)
|
|
6166
6208
|
: this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
6167
6209
|
}
|
|
6168
6210
|
include(context, includeChildrenRecursively) {
|
|
@@ -6180,6 +6222,10 @@ class ClassNode extends NodeBase {
|
|
|
6180
6222
|
initialise() {
|
|
6181
6223
|
super.initialise();
|
|
6182
6224
|
this.id?.declare('class', EMPTY_PATH, this);
|
|
6225
|
+
this.instanceEntity = new ObjectEntity(new Map(), new ObjectMember(this, ['prototype']));
|
|
6226
|
+
// This makes sure that all deoptimizations of "this" are applied to the
|
|
6227
|
+
// instance entity, even if the class is only instantiated by unknown code.
|
|
6228
|
+
this.body.scope.instanceThisVariable.addArgumentForDeoptimization(this.instanceEntity);
|
|
6183
6229
|
for (const method of this.body.body) {
|
|
6184
6230
|
if (method instanceof MethodDefinition && method.kind === 'constructor') {
|
|
6185
6231
|
this.classConstructor = method;
|
|
@@ -6200,6 +6246,36 @@ class ClassNode extends NodeBase {
|
|
|
6200
6246
|
}
|
|
6201
6247
|
this.scope.context.requestTreeshakingPass();
|
|
6202
6248
|
}
|
|
6249
|
+
hasEffectsOnInstanceFieldInitialization(context) {
|
|
6250
|
+
const fieldValues = this.getInstanceFieldValues();
|
|
6251
|
+
if (fieldValues.length === 0)
|
|
6252
|
+
return false;
|
|
6253
|
+
const { replacedVariableInits } = context;
|
|
6254
|
+
const thisVariable = this.body.scope.instanceThisVariable;
|
|
6255
|
+
const thisInit = replacedVariableInits.get(thisVariable);
|
|
6256
|
+
replacedVariableInits.set(thisVariable, this.instanceEntity);
|
|
6257
|
+
const hasEffects = fieldValues.some(value => value.hasEffects(context));
|
|
6258
|
+
if (thisInit) {
|
|
6259
|
+
replacedVariableInits.set(thisVariable, thisInit);
|
|
6260
|
+
}
|
|
6261
|
+
else {
|
|
6262
|
+
replacedVariableInits.delete(thisVariable);
|
|
6263
|
+
}
|
|
6264
|
+
return hasEffects;
|
|
6265
|
+
}
|
|
6266
|
+
getInstanceFieldValues() {
|
|
6267
|
+
if (this.instanceFieldValues === null) {
|
|
6268
|
+
this.instanceFieldValues = [];
|
|
6269
|
+
for (const definition of this.body.body) {
|
|
6270
|
+
if (definition instanceof PropertyDefinition &&
|
|
6271
|
+
!definition.static &&
|
|
6272
|
+
definition.value !== null) {
|
|
6273
|
+
this.instanceFieldValues.push(definition.value);
|
|
6274
|
+
}
|
|
6275
|
+
}
|
|
6276
|
+
}
|
|
6277
|
+
return this.instanceFieldValues;
|
|
6278
|
+
}
|
|
6203
6279
|
getObjectEntity() {
|
|
6204
6280
|
if (this.objectEntity !== null) {
|
|
6205
6281
|
return this.objectEntity;
|
|
@@ -12623,6 +12699,17 @@ class AssignmentPattern extends NodeBase {
|
|
|
12623
12699
|
}
|
|
12624
12700
|
}
|
|
12625
12701
|
|
|
12702
|
+
function markTopLevelAwait(node) {
|
|
12703
|
+
if (node.scope.context.usesTopLevelAwait)
|
|
12704
|
+
return;
|
|
12705
|
+
let parent = node.parent;
|
|
12706
|
+
do {
|
|
12707
|
+
if (parent instanceof FunctionBase)
|
|
12708
|
+
return;
|
|
12709
|
+
} while ((parent = parent.parent));
|
|
12710
|
+
node.scope.context.usesTopLevelAwait = true;
|
|
12711
|
+
}
|
|
12712
|
+
|
|
12626
12713
|
class AwaitExpression extends NodeBase {
|
|
12627
12714
|
deoptimizePath(path) {
|
|
12628
12715
|
this.argument.deoptimizePath(path);
|
|
@@ -12634,12 +12721,7 @@ class AwaitExpression extends NodeBase {
|
|
|
12634
12721
|
}
|
|
12635
12722
|
initialise() {
|
|
12636
12723
|
super.initialise();
|
|
12637
|
-
|
|
12638
|
-
do {
|
|
12639
|
-
if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
|
|
12640
|
-
return;
|
|
12641
|
-
} while ((parent = parent.parent));
|
|
12642
|
-
this.scope.context.usesTopLevelAwait = true;
|
|
12724
|
+
markTopLevelAwait(this);
|
|
12643
12725
|
}
|
|
12644
12726
|
include(context, includeChildrenRecursively) {
|
|
12645
12727
|
if (!this.included)
|
|
@@ -13130,7 +13212,8 @@ class ClassBodyScope extends ChildScope {
|
|
|
13130
13212
|
super(parent, context);
|
|
13131
13213
|
this.variables.set('this', (this.thisVariable = new LocalVariable('this', null, classNode, EMPTY_PATH, context, 'other')));
|
|
13132
13214
|
this.instanceScope = new ChildScope(this, context);
|
|
13133
|
-
this.
|
|
13215
|
+
this.instanceThisVariable = new ThisVariable(context);
|
|
13216
|
+
this.instanceScope.variables.set('this', this.instanceThisVariable);
|
|
13134
13217
|
}
|
|
13135
13218
|
findLexicalBoundary() {
|
|
13136
13219
|
return this;
|
|
@@ -13630,6 +13713,8 @@ class ForOfStatement extends NodeBase {
|
|
|
13630
13713
|
}
|
|
13631
13714
|
initialise() {
|
|
13632
13715
|
super.initialise();
|
|
13716
|
+
if (this.await)
|
|
13717
|
+
markTopLevelAwait(this);
|
|
13633
13718
|
this.left.setAssignedValue(UNKNOWN_EXPRESSION);
|
|
13634
13719
|
}
|
|
13635
13720
|
render(code, options) {
|
|
@@ -15432,47 +15517,6 @@ class Property extends MethodBase {
|
|
|
15432
15517
|
Property.prototype.includeNode = onlyIncludeSelfNoDeoptimize;
|
|
15433
15518
|
Property.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
15434
15519
|
|
|
15435
|
-
class PropertyDefinition extends NodeBase {
|
|
15436
|
-
get computed() {
|
|
15437
|
-
return isFlagSet(this.flags, 1024 /* Flag.computed */);
|
|
15438
|
-
}
|
|
15439
|
-
set computed(value) {
|
|
15440
|
-
this.flags = setFlag(this.flags, 1024 /* Flag.computed */, value);
|
|
15441
|
-
}
|
|
15442
|
-
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
15443
|
-
this.value?.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
15444
|
-
}
|
|
15445
|
-
deoptimizePath(path) {
|
|
15446
|
-
this.value?.deoptimizePath(path);
|
|
15447
|
-
}
|
|
15448
|
-
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
15449
|
-
return this.value
|
|
15450
|
-
? this.value.getLiteralValueAtPath(path, recursionTracker, origin)
|
|
15451
|
-
: UnknownValue;
|
|
15452
|
-
}
|
|
15453
|
-
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
15454
|
-
return this.value
|
|
15455
|
-
? this.value.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)
|
|
15456
|
-
: UNKNOWN_RETURN_EXPRESSION;
|
|
15457
|
-
}
|
|
15458
|
-
hasEffects(context) {
|
|
15459
|
-
return (this.key.hasEffects(context) ||
|
|
15460
|
-
(this.static && !!this.value?.hasEffects(context)) ||
|
|
15461
|
-
checkEffectForNodes(this.decorators, context));
|
|
15462
|
-
}
|
|
15463
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
15464
|
-
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
15465
|
-
}
|
|
15466
|
-
includeNode(context) {
|
|
15467
|
-
this.included = true;
|
|
15468
|
-
this.value?.includePath(UNKNOWN_PATH, context);
|
|
15469
|
-
for (const decorator of this.decorators) {
|
|
15470
|
-
decorator.includePath(UNKNOWN_PATH, context);
|
|
15471
|
-
}
|
|
15472
|
-
}
|
|
15473
|
-
}
|
|
15474
|
-
PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
15475
|
-
|
|
15476
15520
|
class ReturnStatement extends NodeBase {
|
|
15477
15521
|
hasEffects(context) {
|
|
15478
15522
|
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
@@ -16200,6 +16244,8 @@ class VariableDeclaration extends NodeBase {
|
|
|
16200
16244
|
}
|
|
16201
16245
|
initialise() {
|
|
16202
16246
|
super.initialise();
|
|
16247
|
+
if (this.kind === 'await using')
|
|
16248
|
+
markTopLevelAwait(this);
|
|
16203
16249
|
for (const declarator of this.declarations) {
|
|
16204
16250
|
declarator.declareDeclarator(this.kind);
|
|
16205
16251
|
}
|
|
@@ -18093,6 +18139,9 @@ class Module {
|
|
|
18093
18139
|
hasEffects() {
|
|
18094
18140
|
return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
|
|
18095
18141
|
}
|
|
18142
|
+
hasTopLevelAwait() {
|
|
18143
|
+
return this.astContext.usesTopLevelAwait;
|
|
18144
|
+
}
|
|
18096
18145
|
include() {
|
|
18097
18146
|
const context = createInclusionContext();
|
|
18098
18147
|
if (this.ast.shouldBeIncluded(context))
|
|
@@ -20359,7 +20408,8 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, log
|
|
|
20359
20408
|
// Warning: This will consume dynamicallyDependentEntriesByDynamicEntry.
|
|
20360
20409
|
// If we no longer want this, we should make a copy here.
|
|
20361
20410
|
const alreadyLoadedAtomsByEntry = getAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, entriesAndManualChunksCount);
|
|
20362
|
-
|
|
20411
|
+
// Warning: This will consume dynamicallyDependentEntriesByAwaitedDynamicEntry.
|
|
20412
|
+
const awaitedAlreadyLoadedAtomsByEntry = getAwaitedAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry, entriesAndManualChunksCount);
|
|
20363
20413
|
// This mutates the dependentEntries in chunkAtoms
|
|
20364
20414
|
removeUnnecessaryDependentEntries(chunkAtoms, alreadyLoadedAtomsByEntry, awaitedAlreadyLoadedAtomsByEntry);
|
|
20365
20415
|
const { chunks, sideEffectAtoms, sizeByAtom } = getChunksWithSameDependentEntriesAndCorrelatedAtoms(chunkAtoms, staticDependencyAtomsByEntry, alreadyLoadedAtomsByEntry, minChunkSize);
|
|
@@ -20422,13 +20472,16 @@ function analyzeModuleGraph(entries, manualChunkModules, manualChunkModulesByMod
|
|
|
20422
20472
|
for (const currentEntryModules of allEntriesAndManualChunks) {
|
|
20423
20473
|
const dynamicImportsForCurrentEntry = new Set();
|
|
20424
20474
|
const awaitedDynamicImportsForCurrentEntry = new Set();
|
|
20475
|
+
const dynamicEntriesForCurrentEntry = new Set();
|
|
20425
20476
|
dynamicImportModulesByEntry[entryOrManualChunkIndex] = dynamicImportsForCurrentEntry;
|
|
20426
20477
|
awaitedDynamicImportModulesByEntry[entryOrManualChunkIndex] =
|
|
20427
20478
|
awaitedDynamicImportsForCurrentEntry;
|
|
20428
20479
|
const staticDependencies = new Set(currentEntryModules);
|
|
20480
|
+
let hasTopLevelAwait = false;
|
|
20429
20481
|
// If we have a very large manual chunk, tracking if it is already added to the dependencies will improve performance
|
|
20430
20482
|
const addedManualChunks = new Set();
|
|
20431
20483
|
for (const module of staticDependencies) {
|
|
20484
|
+
hasTopLevelAwait ||= module.hasTopLevelAwait();
|
|
20432
20485
|
getOrCreate(dependentEntriesByModule, module, (getNewSet)).add(entryOrManualChunkIndex);
|
|
20433
20486
|
const manualChunkMembers = manualChunkModulesByModule.get(module);
|
|
20434
20487
|
if (manualChunkMembers && !addedManualChunks.has(manualChunkMembers)) {
|
|
@@ -20445,17 +20498,13 @@ function analyzeModuleGraph(entries, manualChunkModules, manualChunkModulesByMod
|
|
|
20445
20498
|
for (const { node: { resolution } } of module.dynamicImports) {
|
|
20446
20499
|
if (resolution instanceof Module &&
|
|
20447
20500
|
resolution.includedDynamicImporters.length > 0 &&
|
|
20448
|
-
!allEntriesSet.has(resolution)) {
|
|
20449
|
-
|
|
20450
|
-
allEntriesSet.
|
|
20451
|
-
|
|
20452
|
-
|
|
20453
|
-
|
|
20454
|
-
|
|
20455
|
-
awaitedDynamicEntryModules.add(resolution);
|
|
20456
|
-
awaitedDynamicImportsForCurrentEntry.add(resolution);
|
|
20457
|
-
break;
|
|
20458
|
-
}
|
|
20501
|
+
(dynamicEntryModules.has(resolution) || !allEntriesSet.has(resolution))) {
|
|
20502
|
+
dynamicEntriesForCurrentEntry.add(resolution);
|
|
20503
|
+
if (!allEntriesSet.has(resolution)) {
|
|
20504
|
+
dynamicEntryModules.add(resolution);
|
|
20505
|
+
allEntriesSet.add(resolution);
|
|
20506
|
+
allEntriesAndManualChunks.push([resolution]);
|
|
20507
|
+
dynamicImportsForCurrentEntry.add(resolution);
|
|
20459
20508
|
}
|
|
20460
20509
|
}
|
|
20461
20510
|
}
|
|
@@ -20467,13 +20516,20 @@ function analyzeModuleGraph(entries, manualChunkModules, manualChunkModulesByMod
|
|
|
20467
20516
|
}
|
|
20468
20517
|
}
|
|
20469
20518
|
}
|
|
20519
|
+
// A dynamic import can be awaited indirectly through a static dependency.
|
|
20520
|
+
if (hasTopLevelAwait) {
|
|
20521
|
+
for (const dynamicEntry of dynamicEntriesForCurrentEntry) {
|
|
20522
|
+
awaitedDynamicEntryModules.add(dynamicEntry);
|
|
20523
|
+
awaitedDynamicImportsForCurrentEntry.add(dynamicEntry);
|
|
20524
|
+
}
|
|
20525
|
+
}
|
|
20470
20526
|
entryOrManualChunkIndex++;
|
|
20471
20527
|
}
|
|
20472
20528
|
const { awaitedDynamicEntries, awaitedDynamicImportsByEntry, dynamicEntries, dynamicImportsByEntry } = getDynamicEntries(allEntriesAndManualChunks, dynamicEntryModules, dynamicImportModulesByEntry, awaitedDynamicEntryModules, awaitedDynamicImportModulesByEntry);
|
|
20473
20529
|
return {
|
|
20474
20530
|
awaitedDynamicImportsByEntry,
|
|
20475
20531
|
dependentEntriesByModule,
|
|
20476
|
-
dynamicallyDependentEntriesByAwaitedDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, awaitedDynamicEntries, allEntriesAndManualChunks, dynamicEntry => dynamicEntry.includedTopLevelAwaitingDynamicImporters),
|
|
20532
|
+
dynamicallyDependentEntriesByAwaitedDynamicEntry: addAwaitingEntries(getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, awaitedDynamicEntries, allEntriesAndManualChunks, dynamicEntry => dynamicEntry.includedTopLevelAwaitingDynamicImporters), awaitedDynamicImportsByEntry),
|
|
20477
20533
|
dynamicallyDependentEntriesByDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries, allEntriesAndManualChunks, dynamicEntry => dynamicEntry.includedDynamicImporters),
|
|
20478
20534
|
dynamicImportsByEntry,
|
|
20479
20535
|
entriesAndManualChunksCount: allEntriesAndManualChunks.length
|
|
@@ -20515,6 +20571,18 @@ function getDynamicImportsByEntry(dynamicImportModulesByEntry, entryIndexByModul
|
|
|
20515
20571
|
}
|
|
20516
20572
|
return dynamicImportsByEntry;
|
|
20517
20573
|
}
|
|
20574
|
+
// A dynamic entry can be awaited by an entry even if the importing module does
|
|
20575
|
+
// not have a top-level await itself, e.g. if the import is inside a function
|
|
20576
|
+
// that is awaited in the entry. In that case, the entry is still evaluating
|
|
20577
|
+
// when the dynamic entry is executed, so we add all awaiting entries here.
|
|
20578
|
+
function addAwaitingEntries(dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry) {
|
|
20579
|
+
for (const [entryIndex, awaitedDynamicImports] of awaitedDynamicImportsByEntry.entries()) {
|
|
20580
|
+
for (const dynamicEntryIndex of awaitedDynamicImports) {
|
|
20581
|
+
getOrCreate(dynamicallyDependentEntriesByAwaitedDynamicEntry, dynamicEntryIndex, (getNewSet)).add(entryIndex);
|
|
20582
|
+
}
|
|
20583
|
+
}
|
|
20584
|
+
return dynamicallyDependentEntriesByAwaitedDynamicEntry;
|
|
20585
|
+
}
|
|
20518
20586
|
function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries, allEntriesAndManualChunks, getDynamicImporters) {
|
|
20519
20587
|
const dynamicallyDependentEntriesByDynamicEntry = new Map();
|
|
20520
20588
|
for (const dynamicEntryIndex of dynamicEntries) {
|
|
@@ -20609,6 +20677,34 @@ function getAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyD
|
|
|
20609
20677
|
}
|
|
20610
20678
|
return alreadyLoadedAtomsByEntry;
|
|
20611
20679
|
}
|
|
20680
|
+
// Warning: This will consume dynamicallyDependentEntriesByAwaitedDynamicEntry.
|
|
20681
|
+
function getAwaitedAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry, allEntriesCount) {
|
|
20682
|
+
// Unlike already loaded atoms, this is a union and not an intersection: If
|
|
20683
|
+
// any importer that is still evaluating while it awaits a dynamic entry has
|
|
20684
|
+
// loaded an atom, merging that atom into the chunk of this importer would
|
|
20685
|
+
// create a cycle. Entries that are not awaited have no such atoms.
|
|
20686
|
+
const awaitedAlreadyLoadedAtomsByEntry = new Array(allEntriesCount).fill(0n);
|
|
20687
|
+
for (const [dynamicEntryIndex, dynamicallyDependentEntries] of dynamicallyDependentEntriesByAwaitedDynamicEntry) {
|
|
20688
|
+
// We delete here so that they can be added again if necessary to be handled
|
|
20689
|
+
// again by the loop
|
|
20690
|
+
dynamicallyDependentEntriesByAwaitedDynamicEntry.delete(dynamicEntryIndex);
|
|
20691
|
+
const knownLoadedAtoms = awaitedAlreadyLoadedAtomsByEntry[dynamicEntryIndex];
|
|
20692
|
+
let updatedLoadedAtoms = knownLoadedAtoms;
|
|
20693
|
+
for (const entryIndex of dynamicallyDependentEntries) {
|
|
20694
|
+
updatedLoadedAtoms |=
|
|
20695
|
+
staticDependencyAtomsByEntry[entryIndex] | awaitedAlreadyLoadedAtomsByEntry[entryIndex];
|
|
20696
|
+
}
|
|
20697
|
+
// If the knownLoadedAtoms changed, all awaited dynamic imports of this
|
|
20698
|
+
// entry need to be updated again
|
|
20699
|
+
if (updatedLoadedAtoms !== knownLoadedAtoms) {
|
|
20700
|
+
awaitedAlreadyLoadedAtomsByEntry[dynamicEntryIndex] = updatedLoadedAtoms;
|
|
20701
|
+
for (const dynamicImport of awaitedDynamicImportsByEntry[dynamicEntryIndex]) {
|
|
20702
|
+
getOrCreate(dynamicallyDependentEntriesByAwaitedDynamicEntry, dynamicImport, (getNewSet)).add(dynamicEntryIndex);
|
|
20703
|
+
}
|
|
20704
|
+
}
|
|
20705
|
+
}
|
|
20706
|
+
return awaitedAlreadyLoadedAtomsByEntry;
|
|
20707
|
+
}
|
|
20612
20708
|
/**
|
|
20613
20709
|
* This removes all unnecessary dynamic entries from the dependentEntries in its
|
|
20614
20710
|
* first argument if a chunk is already loaded without that entry.
|
package/dist/es/shared/watch.js
CHANGED
package/dist/getLogFilter.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/parseAst.js
CHANGED
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/parseAst.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.64.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.64.6
|
|
4
|
+
Tue, 13 Oct 2026 09:01:30 GMT - commit 3ba51901a0f41d8e6d4152c407cba036fb599feb
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@ function _mergeNamespaces(n, m) {
|
|
|
42
42
|
|
|
43
43
|
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
|
44
44
|
|
|
45
|
-
var version = "4.64.
|
|
45
|
+
var version = "4.64.6";
|
|
46
46
|
const package_ = {
|
|
47
47
|
version: version};
|
|
48
48
|
|
|
@@ -10224,6 +10224,47 @@ class MethodDefinition extends MethodBase {
|
|
|
10224
10224
|
}
|
|
10225
10225
|
}
|
|
10226
10226
|
|
|
10227
|
+
class PropertyDefinition extends NodeBase {
|
|
10228
|
+
get computed() {
|
|
10229
|
+
return isFlagSet(this.flags, 1024 /* Flag.computed */);
|
|
10230
|
+
}
|
|
10231
|
+
set computed(value) {
|
|
10232
|
+
this.flags = setFlag(this.flags, 1024 /* Flag.computed */, value);
|
|
10233
|
+
}
|
|
10234
|
+
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
10235
|
+
this.value?.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
10236
|
+
}
|
|
10237
|
+
deoptimizePath(path) {
|
|
10238
|
+
this.value?.deoptimizePath(path);
|
|
10239
|
+
}
|
|
10240
|
+
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10241
|
+
return this.value
|
|
10242
|
+
? this.value.getLiteralValueAtPath(path, recursionTracker, origin)
|
|
10243
|
+
: UnknownValue;
|
|
10244
|
+
}
|
|
10245
|
+
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
10246
|
+
return this.value
|
|
10247
|
+
? this.value.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)
|
|
10248
|
+
: UNKNOWN_RETURN_EXPRESSION;
|
|
10249
|
+
}
|
|
10250
|
+
hasEffects(context) {
|
|
10251
|
+
return (this.key.hasEffects(context) ||
|
|
10252
|
+
(this.static && !!this.value?.hasEffects(context)) ||
|
|
10253
|
+
checkEffectForNodes(this.decorators, context));
|
|
10254
|
+
}
|
|
10255
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10256
|
+
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
10257
|
+
}
|
|
10258
|
+
includeNode(context) {
|
|
10259
|
+
this.included = true;
|
|
10260
|
+
this.value?.includePath(UNKNOWN_PATH, context);
|
|
10261
|
+
for (const decorator of this.decorators) {
|
|
10262
|
+
decorator.includePath(UNKNOWN_PATH, context);
|
|
10263
|
+
}
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
10267
|
+
|
|
10227
10268
|
class BlockScope extends ChildScope {
|
|
10228
10269
|
constructor(parent) {
|
|
10229
10270
|
super(parent, parent.context);
|
|
@@ -10289,6 +10330,7 @@ function isStaticBlock(statement) {
|
|
|
10289
10330
|
class ClassNode extends NodeBase {
|
|
10290
10331
|
constructor() {
|
|
10291
10332
|
super(...arguments);
|
|
10333
|
+
this.instanceFieldValues = null;
|
|
10292
10334
|
this.objectEntity = null;
|
|
10293
10335
|
}
|
|
10294
10336
|
createScope(parentScope) {
|
|
@@ -10322,7 +10364,7 @@ class ClassNode extends NodeBase {
|
|
|
10322
10364
|
(this.classConstructor === null
|
|
10323
10365
|
? this.superClass?.hasEffectsOnInteractionAtPath(path, interaction, context)
|
|
10324
10366
|
: this.classConstructor.hasEffectsOnInteractionAtPath(path, interaction, context)) ||
|
|
10325
|
-
|
|
10367
|
+
this.hasEffectsOnInstanceFieldInitialization(context)
|
|
10326
10368
|
: this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
10327
10369
|
}
|
|
10328
10370
|
include(context, includeChildrenRecursively) {
|
|
@@ -10340,6 +10382,10 @@ class ClassNode extends NodeBase {
|
|
|
10340
10382
|
initialise() {
|
|
10341
10383
|
super.initialise();
|
|
10342
10384
|
this.id?.declare('class', EMPTY_PATH, this);
|
|
10385
|
+
this.instanceEntity = new ObjectEntity(new Map(), new ObjectMember(this, ['prototype']));
|
|
10386
|
+
// This makes sure that all deoptimizations of "this" are applied to the
|
|
10387
|
+
// instance entity, even if the class is only instantiated by unknown code.
|
|
10388
|
+
this.body.scope.instanceThisVariable.addArgumentForDeoptimization(this.instanceEntity);
|
|
10343
10389
|
for (const method of this.body.body) {
|
|
10344
10390
|
if (method instanceof MethodDefinition && method.kind === 'constructor') {
|
|
10345
10391
|
this.classConstructor = method;
|
|
@@ -10360,6 +10406,36 @@ class ClassNode extends NodeBase {
|
|
|
10360
10406
|
}
|
|
10361
10407
|
this.scope.context.requestTreeshakingPass();
|
|
10362
10408
|
}
|
|
10409
|
+
hasEffectsOnInstanceFieldInitialization(context) {
|
|
10410
|
+
const fieldValues = this.getInstanceFieldValues();
|
|
10411
|
+
if (fieldValues.length === 0)
|
|
10412
|
+
return false;
|
|
10413
|
+
const { replacedVariableInits } = context;
|
|
10414
|
+
const thisVariable = this.body.scope.instanceThisVariable;
|
|
10415
|
+
const thisInit = replacedVariableInits.get(thisVariable);
|
|
10416
|
+
replacedVariableInits.set(thisVariable, this.instanceEntity);
|
|
10417
|
+
const hasEffects = fieldValues.some(value => value.hasEffects(context));
|
|
10418
|
+
if (thisInit) {
|
|
10419
|
+
replacedVariableInits.set(thisVariable, thisInit);
|
|
10420
|
+
}
|
|
10421
|
+
else {
|
|
10422
|
+
replacedVariableInits.delete(thisVariable);
|
|
10423
|
+
}
|
|
10424
|
+
return hasEffects;
|
|
10425
|
+
}
|
|
10426
|
+
getInstanceFieldValues() {
|
|
10427
|
+
if (this.instanceFieldValues === null) {
|
|
10428
|
+
this.instanceFieldValues = [];
|
|
10429
|
+
for (const definition of this.body.body) {
|
|
10430
|
+
if (definition instanceof PropertyDefinition &&
|
|
10431
|
+
!definition.static &&
|
|
10432
|
+
definition.value !== null) {
|
|
10433
|
+
this.instanceFieldValues.push(definition.value);
|
|
10434
|
+
}
|
|
10435
|
+
}
|
|
10436
|
+
}
|
|
10437
|
+
return this.instanceFieldValues;
|
|
10438
|
+
}
|
|
10363
10439
|
getObjectEntity() {
|
|
10364
10440
|
if (this.objectEntity !== null) {
|
|
10365
10441
|
return this.objectEntity;
|
|
@@ -14240,6 +14316,17 @@ class AssignmentPattern extends NodeBase {
|
|
|
14240
14316
|
}
|
|
14241
14317
|
}
|
|
14242
14318
|
|
|
14319
|
+
function markTopLevelAwait(node) {
|
|
14320
|
+
if (node.scope.context.usesTopLevelAwait)
|
|
14321
|
+
return;
|
|
14322
|
+
let parent = node.parent;
|
|
14323
|
+
do {
|
|
14324
|
+
if (parent instanceof FunctionBase)
|
|
14325
|
+
return;
|
|
14326
|
+
} while ((parent = parent.parent));
|
|
14327
|
+
node.scope.context.usesTopLevelAwait = true;
|
|
14328
|
+
}
|
|
14329
|
+
|
|
14243
14330
|
class AwaitExpression extends NodeBase {
|
|
14244
14331
|
deoptimizePath(path) {
|
|
14245
14332
|
this.argument.deoptimizePath(path);
|
|
@@ -14251,12 +14338,7 @@ class AwaitExpression extends NodeBase {
|
|
|
14251
14338
|
}
|
|
14252
14339
|
initialise() {
|
|
14253
14340
|
super.initialise();
|
|
14254
|
-
|
|
14255
|
-
do {
|
|
14256
|
-
if (parent instanceof FunctionNode || parent instanceof ArrowFunctionExpression)
|
|
14257
|
-
return;
|
|
14258
|
-
} while ((parent = parent.parent));
|
|
14259
|
-
this.scope.context.usesTopLevelAwait = true;
|
|
14341
|
+
markTopLevelAwait(this);
|
|
14260
14342
|
}
|
|
14261
14343
|
include(context, includeChildrenRecursively) {
|
|
14262
14344
|
if (!this.included)
|
|
@@ -14747,7 +14829,8 @@ class ClassBodyScope extends ChildScope {
|
|
|
14747
14829
|
super(parent, context);
|
|
14748
14830
|
this.variables.set('this', (this.thisVariable = new LocalVariable('this', null, classNode, EMPTY_PATH, context, 'other')));
|
|
14749
14831
|
this.instanceScope = new ChildScope(this, context);
|
|
14750
|
-
this.
|
|
14832
|
+
this.instanceThisVariable = new ThisVariable(context);
|
|
14833
|
+
this.instanceScope.variables.set('this', this.instanceThisVariable);
|
|
14751
14834
|
}
|
|
14752
14835
|
findLexicalBoundary() {
|
|
14753
14836
|
return this;
|
|
@@ -15247,6 +15330,8 @@ class ForOfStatement extends NodeBase {
|
|
|
15247
15330
|
}
|
|
15248
15331
|
initialise() {
|
|
15249
15332
|
super.initialise();
|
|
15333
|
+
if (this.await)
|
|
15334
|
+
markTopLevelAwait(this);
|
|
15250
15335
|
this.left.setAssignedValue(UNKNOWN_EXPRESSION);
|
|
15251
15336
|
}
|
|
15252
15337
|
render(code, options) {
|
|
@@ -17049,47 +17134,6 @@ class Property extends MethodBase {
|
|
|
17049
17134
|
Property.prototype.includeNode = onlyIncludeSelfNoDeoptimize;
|
|
17050
17135
|
Property.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
17051
17136
|
|
|
17052
|
-
class PropertyDefinition extends NodeBase {
|
|
17053
|
-
get computed() {
|
|
17054
|
-
return isFlagSet(this.flags, 1024 /* Flag.computed */);
|
|
17055
|
-
}
|
|
17056
|
-
set computed(value) {
|
|
17057
|
-
this.flags = setFlag(this.flags, 1024 /* Flag.computed */, value);
|
|
17058
|
-
}
|
|
17059
|
-
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
17060
|
-
this.value?.deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
17061
|
-
}
|
|
17062
|
-
deoptimizePath(path) {
|
|
17063
|
-
this.value?.deoptimizePath(path);
|
|
17064
|
-
}
|
|
17065
|
-
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
17066
|
-
return this.value
|
|
17067
|
-
? this.value.getLiteralValueAtPath(path, recursionTracker, origin)
|
|
17068
|
-
: UnknownValue;
|
|
17069
|
-
}
|
|
17070
|
-
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
17071
|
-
return this.value
|
|
17072
|
-
? this.value.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)
|
|
17073
|
-
: UNKNOWN_RETURN_EXPRESSION;
|
|
17074
|
-
}
|
|
17075
|
-
hasEffects(context) {
|
|
17076
|
-
return (this.key.hasEffects(context) ||
|
|
17077
|
-
(this.static && !!this.value?.hasEffects(context)) ||
|
|
17078
|
-
checkEffectForNodes(this.decorators, context));
|
|
17079
|
-
}
|
|
17080
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
17081
|
-
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
17082
|
-
}
|
|
17083
|
-
includeNode(context) {
|
|
17084
|
-
this.included = true;
|
|
17085
|
-
this.value?.includePath(UNKNOWN_PATH, context);
|
|
17086
|
-
for (const decorator of this.decorators) {
|
|
17087
|
-
decorator.includePath(UNKNOWN_PATH, context);
|
|
17088
|
-
}
|
|
17089
|
-
}
|
|
17090
|
-
}
|
|
17091
|
-
PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
17092
|
-
|
|
17093
17137
|
class ReturnStatement extends NodeBase {
|
|
17094
17138
|
hasEffects(context) {
|
|
17095
17139
|
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
@@ -17817,6 +17861,8 @@ class VariableDeclaration extends NodeBase {
|
|
|
17817
17861
|
}
|
|
17818
17862
|
initialise() {
|
|
17819
17863
|
super.initialise();
|
|
17864
|
+
if (this.kind === 'await using')
|
|
17865
|
+
markTopLevelAwait(this);
|
|
17820
17866
|
for (const declarator of this.declarations) {
|
|
17821
17867
|
declarator.declareDeclarator(this.kind);
|
|
17822
17868
|
}
|
|
@@ -19703,6 +19749,9 @@ class Module {
|
|
|
19703
19749
|
hasEffects() {
|
|
19704
19750
|
return this.info.moduleSideEffects === 'no-treeshake' || this.ast.hasCachedEffects();
|
|
19705
19751
|
}
|
|
19752
|
+
hasTopLevelAwait() {
|
|
19753
|
+
return this.astContext.usesTopLevelAwait;
|
|
19754
|
+
}
|
|
19706
19755
|
include() {
|
|
19707
19756
|
const context = createInclusionContext();
|
|
19708
19757
|
if (this.ast.shouldBeIncluded(context))
|
|
@@ -21855,7 +21904,8 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, log
|
|
|
21855
21904
|
// Warning: This will consume dynamicallyDependentEntriesByDynamicEntry.
|
|
21856
21905
|
// If we no longer want this, we should make a copy here.
|
|
21857
21906
|
const alreadyLoadedAtomsByEntry = getAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, entriesAndManualChunksCount);
|
|
21858
|
-
|
|
21907
|
+
// Warning: This will consume dynamicallyDependentEntriesByAwaitedDynamicEntry.
|
|
21908
|
+
const awaitedAlreadyLoadedAtomsByEntry = getAwaitedAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry, entriesAndManualChunksCount);
|
|
21859
21909
|
// This mutates the dependentEntries in chunkAtoms
|
|
21860
21910
|
removeUnnecessaryDependentEntries(chunkAtoms, alreadyLoadedAtomsByEntry, awaitedAlreadyLoadedAtomsByEntry);
|
|
21861
21911
|
const { chunks, sideEffectAtoms, sizeByAtom } = getChunksWithSameDependentEntriesAndCorrelatedAtoms(chunkAtoms, staticDependencyAtomsByEntry, alreadyLoadedAtomsByEntry, minChunkSize);
|
|
@@ -21918,13 +21968,16 @@ function analyzeModuleGraph(entries, manualChunkModules, manualChunkModulesByMod
|
|
|
21918
21968
|
for (const currentEntryModules of allEntriesAndManualChunks) {
|
|
21919
21969
|
const dynamicImportsForCurrentEntry = new Set();
|
|
21920
21970
|
const awaitedDynamicImportsForCurrentEntry = new Set();
|
|
21971
|
+
const dynamicEntriesForCurrentEntry = new Set();
|
|
21921
21972
|
dynamicImportModulesByEntry[entryOrManualChunkIndex] = dynamicImportsForCurrentEntry;
|
|
21922
21973
|
awaitedDynamicImportModulesByEntry[entryOrManualChunkIndex] =
|
|
21923
21974
|
awaitedDynamicImportsForCurrentEntry;
|
|
21924
21975
|
const staticDependencies = new Set(currentEntryModules);
|
|
21976
|
+
let hasTopLevelAwait = false;
|
|
21925
21977
|
// If we have a very large manual chunk, tracking if it is already added to the dependencies will improve performance
|
|
21926
21978
|
const addedManualChunks = new Set();
|
|
21927
21979
|
for (const module of staticDependencies) {
|
|
21980
|
+
hasTopLevelAwait ||= module.hasTopLevelAwait();
|
|
21928
21981
|
getOrCreate(dependentEntriesByModule, module, (getNewSet)).add(entryOrManualChunkIndex);
|
|
21929
21982
|
const manualChunkMembers = manualChunkModulesByModule.get(module);
|
|
21930
21983
|
if (manualChunkMembers && !addedManualChunks.has(manualChunkMembers)) {
|
|
@@ -21941,17 +21994,13 @@ function analyzeModuleGraph(entries, manualChunkModules, manualChunkModulesByMod
|
|
|
21941
21994
|
for (const { node: { resolution } } of module.dynamicImports) {
|
|
21942
21995
|
if (resolution instanceof Module &&
|
|
21943
21996
|
resolution.includedDynamicImporters.length > 0 &&
|
|
21944
|
-
!allEntriesSet.has(resolution)) {
|
|
21945
|
-
|
|
21946
|
-
allEntriesSet.
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
|
|
21951
|
-
awaitedDynamicEntryModules.add(resolution);
|
|
21952
|
-
awaitedDynamicImportsForCurrentEntry.add(resolution);
|
|
21953
|
-
break;
|
|
21954
|
-
}
|
|
21997
|
+
(dynamicEntryModules.has(resolution) || !allEntriesSet.has(resolution))) {
|
|
21998
|
+
dynamicEntriesForCurrentEntry.add(resolution);
|
|
21999
|
+
if (!allEntriesSet.has(resolution)) {
|
|
22000
|
+
dynamicEntryModules.add(resolution);
|
|
22001
|
+
allEntriesSet.add(resolution);
|
|
22002
|
+
allEntriesAndManualChunks.push([resolution]);
|
|
22003
|
+
dynamicImportsForCurrentEntry.add(resolution);
|
|
21955
22004
|
}
|
|
21956
22005
|
}
|
|
21957
22006
|
}
|
|
@@ -21963,13 +22012,20 @@ function analyzeModuleGraph(entries, manualChunkModules, manualChunkModulesByMod
|
|
|
21963
22012
|
}
|
|
21964
22013
|
}
|
|
21965
22014
|
}
|
|
22015
|
+
// A dynamic import can be awaited indirectly through a static dependency.
|
|
22016
|
+
if (hasTopLevelAwait) {
|
|
22017
|
+
for (const dynamicEntry of dynamicEntriesForCurrentEntry) {
|
|
22018
|
+
awaitedDynamicEntryModules.add(dynamicEntry);
|
|
22019
|
+
awaitedDynamicImportsForCurrentEntry.add(dynamicEntry);
|
|
22020
|
+
}
|
|
22021
|
+
}
|
|
21966
22022
|
entryOrManualChunkIndex++;
|
|
21967
22023
|
}
|
|
21968
22024
|
const { awaitedDynamicEntries, awaitedDynamicImportsByEntry, dynamicEntries, dynamicImportsByEntry } = getDynamicEntries(allEntriesAndManualChunks, dynamicEntryModules, dynamicImportModulesByEntry, awaitedDynamicEntryModules, awaitedDynamicImportModulesByEntry);
|
|
21969
22025
|
return {
|
|
21970
22026
|
awaitedDynamicImportsByEntry,
|
|
21971
22027
|
dependentEntriesByModule,
|
|
21972
|
-
dynamicallyDependentEntriesByAwaitedDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, awaitedDynamicEntries, allEntriesAndManualChunks, dynamicEntry => dynamicEntry.includedTopLevelAwaitingDynamicImporters),
|
|
22028
|
+
dynamicallyDependentEntriesByAwaitedDynamicEntry: addAwaitingEntries(getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, awaitedDynamicEntries, allEntriesAndManualChunks, dynamicEntry => dynamicEntry.includedTopLevelAwaitingDynamicImporters), awaitedDynamicImportsByEntry),
|
|
21973
22029
|
dynamicallyDependentEntriesByDynamicEntry: getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries, allEntriesAndManualChunks, dynamicEntry => dynamicEntry.includedDynamicImporters),
|
|
21974
22030
|
dynamicImportsByEntry,
|
|
21975
22031
|
entriesAndManualChunksCount: allEntriesAndManualChunks.length
|
|
@@ -22011,6 +22067,18 @@ function getDynamicImportsByEntry(dynamicImportModulesByEntry, entryIndexByModul
|
|
|
22011
22067
|
}
|
|
22012
22068
|
return dynamicImportsByEntry;
|
|
22013
22069
|
}
|
|
22070
|
+
// A dynamic entry can be awaited by an entry even if the importing module does
|
|
22071
|
+
// not have a top-level await itself, e.g. if the import is inside a function
|
|
22072
|
+
// that is awaited in the entry. In that case, the entry is still evaluating
|
|
22073
|
+
// when the dynamic entry is executed, so we add all awaiting entries here.
|
|
22074
|
+
function addAwaitingEntries(dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry) {
|
|
22075
|
+
for (const [entryIndex, awaitedDynamicImports] of awaitedDynamicImportsByEntry.entries()) {
|
|
22076
|
+
for (const dynamicEntryIndex of awaitedDynamicImports) {
|
|
22077
|
+
getOrCreate(dynamicallyDependentEntriesByAwaitedDynamicEntry, dynamicEntryIndex, (getNewSet)).add(entryIndex);
|
|
22078
|
+
}
|
|
22079
|
+
}
|
|
22080
|
+
return dynamicallyDependentEntriesByAwaitedDynamicEntry;
|
|
22081
|
+
}
|
|
22014
22082
|
function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule, dynamicEntries, allEntriesAndManualChunks, getDynamicImporters) {
|
|
22015
22083
|
const dynamicallyDependentEntriesByDynamicEntry = new Map();
|
|
22016
22084
|
for (const dynamicEntryIndex of dynamicEntries) {
|
|
@@ -22105,6 +22173,34 @@ function getAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyD
|
|
|
22105
22173
|
}
|
|
22106
22174
|
return alreadyLoadedAtomsByEntry;
|
|
22107
22175
|
}
|
|
22176
|
+
// Warning: This will consume dynamicallyDependentEntriesByAwaitedDynamicEntry.
|
|
22177
|
+
function getAwaitedAlreadyLoadedAtomsByEntry(staticDependencyAtomsByEntry, dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry, allEntriesCount) {
|
|
22178
|
+
// Unlike already loaded atoms, this is a union and not an intersection: If
|
|
22179
|
+
// any importer that is still evaluating while it awaits a dynamic entry has
|
|
22180
|
+
// loaded an atom, merging that atom into the chunk of this importer would
|
|
22181
|
+
// create a cycle. Entries that are not awaited have no such atoms.
|
|
22182
|
+
const awaitedAlreadyLoadedAtomsByEntry = new Array(allEntriesCount).fill(0n);
|
|
22183
|
+
for (const [dynamicEntryIndex, dynamicallyDependentEntries] of dynamicallyDependentEntriesByAwaitedDynamicEntry) {
|
|
22184
|
+
// We delete here so that they can be added again if necessary to be handled
|
|
22185
|
+
// again by the loop
|
|
22186
|
+
dynamicallyDependentEntriesByAwaitedDynamicEntry.delete(dynamicEntryIndex);
|
|
22187
|
+
const knownLoadedAtoms = awaitedAlreadyLoadedAtomsByEntry[dynamicEntryIndex];
|
|
22188
|
+
let updatedLoadedAtoms = knownLoadedAtoms;
|
|
22189
|
+
for (const entryIndex of dynamicallyDependentEntries) {
|
|
22190
|
+
updatedLoadedAtoms |=
|
|
22191
|
+
staticDependencyAtomsByEntry[entryIndex] | awaitedAlreadyLoadedAtomsByEntry[entryIndex];
|
|
22192
|
+
}
|
|
22193
|
+
// If the knownLoadedAtoms changed, all awaited dynamic imports of this
|
|
22194
|
+
// entry need to be updated again
|
|
22195
|
+
if (updatedLoadedAtoms !== knownLoadedAtoms) {
|
|
22196
|
+
awaitedAlreadyLoadedAtomsByEntry[dynamicEntryIndex] = updatedLoadedAtoms;
|
|
22197
|
+
for (const dynamicImport of awaitedDynamicImportsByEntry[dynamicEntryIndex]) {
|
|
22198
|
+
getOrCreate(dynamicallyDependentEntriesByAwaitedDynamicEntry, dynamicImport, (getNewSet)).add(dynamicEntryIndex);
|
|
22199
|
+
}
|
|
22200
|
+
}
|
|
22201
|
+
}
|
|
22202
|
+
return awaitedAlreadyLoadedAtomsByEntry;
|
|
22203
|
+
}
|
|
22108
22204
|
/**
|
|
22109
22205
|
* This removes all unnecessary dynamic entries from the dependentEntries in its
|
|
22110
22206
|
* first argument if a chunk is already loaded without that entry.
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
|
Binary file
|