@rollup/wasm-node 4.53.5 → 4.55.0
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 +4 -4
- 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 +222 -145
- package/dist/es/shared/parseAst.js +13 -4
- 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 +13 -3
- package/dist/shared/rollup.js +221 -144
- 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 +17 -18
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.55.0
|
|
4
|
+
Mon, 05 Jan 2026 08:05:39 GMT - commit 570b7ee21ce3ca143bdfad918fcb31b1792d308f
|
|
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.
|
|
45
|
+
var version = "4.55.0";
|
|
46
46
|
|
|
47
47
|
function ensureArray$1(items) {
|
|
48
48
|
if (Array.isArray(items)) {
|
|
@@ -5792,11 +5792,22 @@ function renderSystemExportSequenceBeforeExpression(exportedVariable, expression
|
|
|
5792
5792
|
const UnknownKey = Symbol('Unknown Key');
|
|
5793
5793
|
const UnknownNonAccessorKey = Symbol('Unknown Non-Accessor Key');
|
|
5794
5794
|
const UnknownInteger = Symbol('Unknown Integer');
|
|
5795
|
+
const UnknownWellKnown = Symbol('Unknown Well-Known');
|
|
5795
5796
|
const SymbolToStringTag = Symbol('Symbol.toStringTag');
|
|
5796
5797
|
const SymbolDispose = Symbol('Symbol.asyncDispose');
|
|
5797
5798
|
const SymbolAsyncDispose = Symbol('Symbol.dispose');
|
|
5798
|
-
const
|
|
5799
|
+
const SymbolHasInstance = Symbol('Symbol.hasInstance');
|
|
5800
|
+
const WELL_KNOWN_SYMBOLS_LIST = [
|
|
5801
|
+
SymbolToStringTag,
|
|
5802
|
+
SymbolDispose,
|
|
5803
|
+
SymbolAsyncDispose,
|
|
5804
|
+
SymbolHasInstance
|
|
5805
|
+
];
|
|
5799
5806
|
const WELL_KNOWN_SYMBOLS = new Set(WELL_KNOWN_SYMBOLS_LIST);
|
|
5807
|
+
const isAnyWellKnown = (v) => WELL_KNOWN_SYMBOLS.has(v) || v === UnknownWellKnown;
|
|
5808
|
+
const TREE_SHAKEABLE_SYMBOLS_LIST = [SymbolHasInstance, SymbolDispose, SymbolAsyncDispose];
|
|
5809
|
+
const TREE_SHAKEABLE_SYMBOLS = new Set(TREE_SHAKEABLE_SYMBOLS_LIST);
|
|
5810
|
+
const isConcreteKey = (v) => typeof v === 'string' || WELL_KNOWN_SYMBOLS.has(v);
|
|
5800
5811
|
const EMPTY_PATH = [];
|
|
5801
5812
|
const UNKNOWN_PATH = [UnknownKey];
|
|
5802
5813
|
// For deoptimizations, this means we are modifying an unknown property but did
|
|
@@ -5806,6 +5817,7 @@ const UNKNOWN_PATH = [UnknownKey];
|
|
|
5806
5817
|
// Object.defineProperty
|
|
5807
5818
|
const UNKNOWN_NON_ACCESSOR_PATH = [UnknownNonAccessorKey];
|
|
5808
5819
|
const UNKNOWN_INTEGER_PATH = [UnknownInteger];
|
|
5820
|
+
const INSTANCEOF_PATH = [SymbolHasInstance];
|
|
5809
5821
|
const EntitiesKey = Symbol('Entities');
|
|
5810
5822
|
class EntityPathTracker {
|
|
5811
5823
|
constructor() {
|
|
@@ -5878,7 +5890,7 @@ class IncludedFullPathTracker {
|
|
|
5878
5890
|
}
|
|
5879
5891
|
// Including UnknownKey automatically includes all nested paths.
|
|
5880
5892
|
// From above, we know that UnknownKey is not included yet.
|
|
5881
|
-
if (
|
|
5893
|
+
if (!isConcreteKey(pathSegment)) {
|
|
5882
5894
|
// Hopefully, this saves some memory over just setting
|
|
5883
5895
|
// currentPaths[UnknownKey] = EMPTY_OBJECT
|
|
5884
5896
|
parent[parentSegment] = UNKNOWN_INCLUDED_PATH;
|
|
@@ -5909,7 +5921,7 @@ class IncludedTopLevelPathTracker {
|
|
|
5909
5921
|
if (!firstPathSegment) {
|
|
5910
5922
|
return included;
|
|
5911
5923
|
}
|
|
5912
|
-
if (
|
|
5924
|
+
if (!isConcreteKey(firstPathSegment)) {
|
|
5913
5925
|
this.includedPaths = UNKNOWN_INCLUDED_TOP_LEVEL_PATH;
|
|
5914
5926
|
return false;
|
|
5915
5927
|
}
|
|
@@ -7130,12 +7142,13 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7130
7142
|
this.immutable = immutable;
|
|
7131
7143
|
this.additionalExpressionsToBeDeoptimized = new Set();
|
|
7132
7144
|
this.allProperties = [];
|
|
7133
|
-
this.
|
|
7134
|
-
this.
|
|
7135
|
-
this.
|
|
7136
|
-
this.
|
|
7137
|
-
this.
|
|
7138
|
-
this.
|
|
7145
|
+
this.alwaysIncludedProperties = new Set();
|
|
7146
|
+
this.deoptimizedPaths = new Map();
|
|
7147
|
+
this.expressionsToBeDeoptimizedByKey = new Map();
|
|
7148
|
+
this.gettersByKey = new Map();
|
|
7149
|
+
this.propertiesAndGettersByKey = new Map();
|
|
7150
|
+
this.propertiesAndSettersByKey = new Map();
|
|
7151
|
+
this.settersByKey = new Map();
|
|
7139
7152
|
this.unknownIntegerProps = [];
|
|
7140
7153
|
this.unmatchableGetters = [];
|
|
7141
7154
|
this.unmatchablePropertiesAndGetters = [];
|
|
@@ -7146,7 +7159,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7146
7159
|
}
|
|
7147
7160
|
else {
|
|
7148
7161
|
this.propertiesAndGettersByKey = this.propertiesAndSettersByKey = properties;
|
|
7149
|
-
for (const propertiesForKey of
|
|
7162
|
+
for (const propertiesForKey of properties.values()) {
|
|
7150
7163
|
this.allProperties.push(...propertiesForKey);
|
|
7151
7164
|
}
|
|
7152
7165
|
}
|
|
@@ -7163,8 +7176,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7163
7176
|
return;
|
|
7164
7177
|
}
|
|
7165
7178
|
for (const properties of [
|
|
7166
|
-
...
|
|
7167
|
-
...
|
|
7179
|
+
...this.propertiesAndGettersByKey.values(),
|
|
7180
|
+
...this.settersByKey.values()
|
|
7168
7181
|
]) {
|
|
7169
7182
|
for (const property of properties) {
|
|
7170
7183
|
property.deoptimizePath(UNKNOWN_PATH);
|
|
@@ -7181,7 +7194,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7181
7194
|
// single paths that are deoptimized will not become getters or setters
|
|
7182
7195
|
((type === INTERACTION_CALLED || path.length > 1) &&
|
|
7183
7196
|
(this.hasUnknownDeoptimizedProperty ||
|
|
7184
|
-
(
|
|
7197
|
+
(isConcreteKey(key) && this.deoptimizedPaths.get(key))))) {
|
|
7185
7198
|
deoptimizeInteraction(interaction);
|
|
7186
7199
|
return;
|
|
7187
7200
|
}
|
|
@@ -7194,9 +7207,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7194
7207
|
: type === INTERACTION_ACCESSED
|
|
7195
7208
|
? [this.propertiesAndGettersByKey, this.gettersByKey, this.unmatchableGetters]
|
|
7196
7209
|
: [this.propertiesAndSettersByKey, this.settersByKey, this.unmatchableSetters];
|
|
7197
|
-
if (
|
|
7198
|
-
if (propertiesForExactMatchByKey
|
|
7199
|
-
const properties = relevantPropertiesByKey
|
|
7210
|
+
if (isConcreteKey(key)) {
|
|
7211
|
+
if (propertiesForExactMatchByKey.get(key)) {
|
|
7212
|
+
const properties = relevantPropertiesByKey.get(key);
|
|
7200
7213
|
if (properties) {
|
|
7201
7214
|
for (const property of properties) {
|
|
7202
7215
|
property.deoptimizeArgumentsOnInteractionAtPath(interaction, subPath, recursionTracker);
|
|
@@ -7214,7 +7227,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7214
7227
|
for (const property of relevantUnmatchableProperties) {
|
|
7215
7228
|
property.deoptimizeArgumentsOnInteractionAtPath(interaction, subPath, recursionTracker);
|
|
7216
7229
|
}
|
|
7217
|
-
if (INTEGER_REG_EXP.test(key)) {
|
|
7230
|
+
if (typeof key === 'string' && INTEGER_REG_EXP.test(key)) {
|
|
7218
7231
|
for (const property of this.unknownIntegerProps) {
|
|
7219
7232
|
property.deoptimizeArgumentsOnInteractionAtPath(interaction, subPath, recursionTracker);
|
|
7220
7233
|
}
|
|
@@ -7222,7 +7235,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7222
7235
|
}
|
|
7223
7236
|
else {
|
|
7224
7237
|
for (const properties of [
|
|
7225
|
-
...
|
|
7238
|
+
...relevantPropertiesByKey.values(),
|
|
7226
7239
|
relevantUnmatchableProperties
|
|
7227
7240
|
]) {
|
|
7228
7241
|
for (const property of properties) {
|
|
@@ -7249,8 +7262,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7249
7262
|
return;
|
|
7250
7263
|
}
|
|
7251
7264
|
this.hasUnknownDeoptimizedInteger = true;
|
|
7252
|
-
|
|
7253
|
-
|
|
7265
|
+
// Omits symbol keys but that's unimportant here
|
|
7266
|
+
for (const [key, propertiesAndGetters] of this.propertiesAndGettersByKey.entries()) {
|
|
7267
|
+
if (typeof key === 'string' && INTEGER_REG_EXP.test(key)) {
|
|
7254
7268
|
for (const property of propertiesAndGetters) {
|
|
7255
7269
|
property.deoptimizePath(UNKNOWN_PATH);
|
|
7256
7270
|
}
|
|
@@ -7268,14 +7282,14 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7268
7282
|
if (key === UnknownInteger) {
|
|
7269
7283
|
return this.deoptimizeIntegerProperties();
|
|
7270
7284
|
}
|
|
7271
|
-
else if (
|
|
7285
|
+
else if (!isConcreteKey(key)) {
|
|
7272
7286
|
return this.deoptimizeAllProperties(key === UnknownNonAccessorKey);
|
|
7273
7287
|
}
|
|
7274
|
-
if (!this.deoptimizedPaths
|
|
7275
|
-
this.deoptimizedPaths
|
|
7288
|
+
if (!this.deoptimizedPaths.get(key)) {
|
|
7289
|
+
this.deoptimizedPaths.set(key, true);
|
|
7276
7290
|
// we only deoptimizeCache exact matches as in all other cases,
|
|
7277
7291
|
// we do not return a literal value or return expression
|
|
7278
|
-
const expressionsToBeDeoptimized = this.expressionsToBeDeoptimizedByKey
|
|
7292
|
+
const expressionsToBeDeoptimized = this.expressionsToBeDeoptimizedByKey.get(key);
|
|
7279
7293
|
if (expressionsToBeDeoptimized) {
|
|
7280
7294
|
for (const expression of expressionsToBeDeoptimized) {
|
|
7281
7295
|
expression.deoptimizeCache();
|
|
@@ -7284,10 +7298,10 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7284
7298
|
}
|
|
7285
7299
|
}
|
|
7286
7300
|
const subPath = path.length === 1 ? UNKNOWN_PATH : path.slice(1);
|
|
7287
|
-
for (const property of
|
|
7301
|
+
for (const property of isConcreteKey(key)
|
|
7288
7302
|
? [
|
|
7289
|
-
...(this.propertiesAndGettersByKey
|
|
7290
|
-
...(this.settersByKey
|
|
7303
|
+
...(this.propertiesAndGettersByKey.get(key) || this.unmatchablePropertiesAndGetters),
|
|
7304
|
+
...(this.settersByKey.get(key) || this.unmatchableSetters)
|
|
7291
7305
|
]
|
|
7292
7306
|
: this.allProperties) {
|
|
7293
7307
|
property.deoptimizePath(subPath);
|
|
@@ -7349,9 +7363,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7349
7363
|
const [propertiesAndAccessorsByKey, accessorsByKey, unmatchableAccessors] = interaction.type === INTERACTION_ACCESSED
|
|
7350
7364
|
? [this.propertiesAndGettersByKey, this.gettersByKey, this.unmatchableGetters]
|
|
7351
7365
|
: [this.propertiesAndSettersByKey, this.settersByKey, this.unmatchableSetters];
|
|
7352
|
-
if (
|
|
7353
|
-
if (propertiesAndAccessorsByKey
|
|
7354
|
-
const accessors = accessorsByKey
|
|
7366
|
+
if (isConcreteKey(key)) {
|
|
7367
|
+
if (propertiesAndAccessorsByKey.get(key)) {
|
|
7368
|
+
const accessors = accessorsByKey.get(key);
|
|
7355
7369
|
if (accessors) {
|
|
7356
7370
|
for (const accessor of accessors) {
|
|
7357
7371
|
if (accessor.hasEffectsOnInteractionAtPath(subPath, interaction, context))
|
|
@@ -7367,7 +7381,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7367
7381
|
}
|
|
7368
7382
|
}
|
|
7369
7383
|
else {
|
|
7370
|
-
for (const accessors of [...
|
|
7384
|
+
for (const accessors of [...accessorsByKey.values(), unmatchableAccessors]) {
|
|
7371
7385
|
for (const accessor of accessors) {
|
|
7372
7386
|
if (accessor.hasEffectsOnInteractionAtPath(subPath, interaction, context))
|
|
7373
7387
|
return true;
|
|
@@ -7382,7 +7396,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7382
7396
|
include(context, includeChildrenRecursively) {
|
|
7383
7397
|
this.included = true;
|
|
7384
7398
|
for (const property of this.allProperties) {
|
|
7385
|
-
if (includeChildrenRecursively ||
|
|
7399
|
+
if (includeChildrenRecursively ||
|
|
7400
|
+
property.shouldBeIncluded(context) ||
|
|
7401
|
+
this.alwaysIncludedProperties.has(property)) {
|
|
7386
7402
|
property.include(context, includeChildrenRecursively);
|
|
7387
7403
|
}
|
|
7388
7404
|
}
|
|
@@ -7390,14 +7406,17 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7390
7406
|
}
|
|
7391
7407
|
includePath(path, context) {
|
|
7392
7408
|
this.included = true;
|
|
7409
|
+
for (const property of this.alwaysIncludedProperties) {
|
|
7410
|
+
property.includePath(UNKNOWN_PATH, context);
|
|
7411
|
+
}
|
|
7393
7412
|
if (path.length === 0)
|
|
7394
7413
|
return;
|
|
7395
7414
|
const [key, ...subPath] = path;
|
|
7396
|
-
const [includedMembers, includedPath] =
|
|
7415
|
+
const [includedMembers, includedPath] = isConcreteKey(key)
|
|
7397
7416
|
? [
|
|
7398
7417
|
new Set([
|
|
7399
|
-
...(this.propertiesAndGettersByKey
|
|
7400
|
-
...(this.propertiesAndSettersByKey
|
|
7418
|
+
...(this.propertiesAndGettersByKey.get(key) || this.unmatchablePropertiesAndGetters),
|
|
7419
|
+
...(this.propertiesAndSettersByKey.get(key) || this.unmatchablePropertiesAndSetters)
|
|
7401
7420
|
]),
|
|
7402
7421
|
subPath
|
|
7403
7422
|
]
|
|
@@ -7408,29 +7427,36 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7408
7427
|
this.prototypeExpression?.includePath(path, context);
|
|
7409
7428
|
}
|
|
7410
7429
|
buildPropertyMaps(properties) {
|
|
7411
|
-
const { allProperties, propertiesAndGettersByKey, propertiesAndSettersByKey, settersByKey, gettersByKey, unknownIntegerProps, unmatchablePropertiesAndGetters, unmatchablePropertiesAndSetters, unmatchableGetters, unmatchableSetters } = this;
|
|
7430
|
+
const { allProperties, alwaysIncludedProperties, propertiesAndGettersByKey, propertiesAndSettersByKey, settersByKey, gettersByKey, unknownIntegerProps, unmatchablePropertiesAndGetters, unmatchablePropertiesAndSetters, unmatchableGetters, unmatchableSetters } = this;
|
|
7412
7431
|
for (let index = properties.length - 1; index >= 0; index--) {
|
|
7413
7432
|
const { key, kind, property } = properties[index];
|
|
7414
7433
|
allProperties.push(property);
|
|
7415
|
-
if (
|
|
7434
|
+
if (isAnyWellKnown(key) && !TREE_SHAKEABLE_SYMBOLS.has(key)) {
|
|
7435
|
+
// Never treeshake well-known symbols (unless Rollup can optimize them)
|
|
7436
|
+
// They are most likely called implicitly by language semantics, don't get rid of them
|
|
7437
|
+
alwaysIncludedProperties.add(property);
|
|
7438
|
+
if (key === UnknownWellKnown)
|
|
7439
|
+
continue;
|
|
7440
|
+
}
|
|
7441
|
+
if (isConcreteKey(key)) {
|
|
7416
7442
|
if (kind === 'set') {
|
|
7417
|
-
if (!propertiesAndSettersByKey
|
|
7418
|
-
propertiesAndSettersByKey
|
|
7419
|
-
settersByKey
|
|
7443
|
+
if (!propertiesAndSettersByKey.has(key)) {
|
|
7444
|
+
propertiesAndSettersByKey.set(key, [property, ...unmatchablePropertiesAndSetters]);
|
|
7445
|
+
settersByKey.set(key, [property, ...unmatchableSetters]);
|
|
7420
7446
|
}
|
|
7421
7447
|
}
|
|
7422
7448
|
else if (kind === 'get') {
|
|
7423
|
-
if (!propertiesAndGettersByKey
|
|
7424
|
-
propertiesAndGettersByKey
|
|
7425
|
-
gettersByKey
|
|
7449
|
+
if (!propertiesAndGettersByKey.has(key)) {
|
|
7450
|
+
propertiesAndGettersByKey.set(key, [property, ...unmatchablePropertiesAndGetters]);
|
|
7451
|
+
gettersByKey.set(key, [property, ...unmatchableGetters]);
|
|
7426
7452
|
}
|
|
7427
7453
|
}
|
|
7428
7454
|
else {
|
|
7429
|
-
if (!propertiesAndSettersByKey
|
|
7430
|
-
propertiesAndSettersByKey
|
|
7455
|
+
if (!propertiesAndSettersByKey.has(key)) {
|
|
7456
|
+
propertiesAndSettersByKey.set(key, [property, ...unmatchablePropertiesAndSetters]);
|
|
7431
7457
|
}
|
|
7432
|
-
if (!propertiesAndGettersByKey
|
|
7433
|
-
propertiesAndGettersByKey
|
|
7458
|
+
if (!propertiesAndGettersByKey.has(key)) {
|
|
7459
|
+
propertiesAndGettersByKey.set(key, [property, ...unmatchablePropertiesAndGetters]);
|
|
7434
7460
|
}
|
|
7435
7461
|
}
|
|
7436
7462
|
}
|
|
@@ -7451,7 +7477,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7451
7477
|
}
|
|
7452
7478
|
}
|
|
7453
7479
|
deoptimizeCachedEntities() {
|
|
7454
|
-
for (const expressionsToBeDeoptimized of
|
|
7480
|
+
for (const expressionsToBeDeoptimized of this.expressionsToBeDeoptimizedByKey.values()) {
|
|
7455
7481
|
for (const expression of expressionsToBeDeoptimized) {
|
|
7456
7482
|
expression.deoptimizeCache();
|
|
7457
7483
|
}
|
|
@@ -7461,8 +7487,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7461
7487
|
}
|
|
7462
7488
|
}
|
|
7463
7489
|
deoptimizeCachedIntegerEntities() {
|
|
7464
|
-
for (const [key, expressionsToBeDeoptimized] of
|
|
7465
|
-
if (INTEGER_REG_EXP.test(key)) {
|
|
7490
|
+
for (const [key, expressionsToBeDeoptimized] of this.expressionsToBeDeoptimizedByKey.entries()) {
|
|
7491
|
+
if (typeof key === 'string' && INTEGER_REG_EXP.test(key)) {
|
|
7466
7492
|
for (const expression of expressionsToBeDeoptimized) {
|
|
7467
7493
|
expression.deoptimizeCache();
|
|
7468
7494
|
}
|
|
@@ -7475,30 +7501,32 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7475
7501
|
getMemberExpression(key) {
|
|
7476
7502
|
if (this.hasLostTrack ||
|
|
7477
7503
|
this.hasUnknownDeoptimizedProperty ||
|
|
7478
|
-
|
|
7479
|
-
(this.hasUnknownDeoptimizedInteger && INTEGER_REG_EXP.test(key)) ||
|
|
7480
|
-
this.deoptimizedPaths
|
|
7504
|
+
!isConcreteKey(key) ||
|
|
7505
|
+
(this.hasUnknownDeoptimizedInteger && typeof key === 'string' && INTEGER_REG_EXP.test(key)) ||
|
|
7506
|
+
this.deoptimizedPaths.get(key)) {
|
|
7481
7507
|
return UNKNOWN_EXPRESSION;
|
|
7482
7508
|
}
|
|
7483
|
-
const properties = this.propertiesAndGettersByKey
|
|
7509
|
+
const properties = this.propertiesAndGettersByKey.get(key);
|
|
7484
7510
|
if (properties?.length === 1) {
|
|
7485
7511
|
return properties[0];
|
|
7486
7512
|
}
|
|
7487
7513
|
if (properties ||
|
|
7488
7514
|
this.unmatchablePropertiesAndGetters.length > 0 ||
|
|
7489
|
-
(this.unknownIntegerProps.length > 0 && INTEGER_REG_EXP.test(key))) {
|
|
7515
|
+
(this.unknownIntegerProps.length > 0 && typeof key === 'string' && INTEGER_REG_EXP.test(key))) {
|
|
7490
7516
|
return UNKNOWN_EXPRESSION;
|
|
7491
7517
|
}
|
|
7492
7518
|
return null;
|
|
7493
7519
|
}
|
|
7494
7520
|
getMemberExpressionAndTrackDeopt(key, origin) {
|
|
7495
|
-
if (
|
|
7521
|
+
if (!isConcreteKey(key)) {
|
|
7496
7522
|
return UNKNOWN_EXPRESSION;
|
|
7497
7523
|
}
|
|
7498
7524
|
const expression = this.getMemberExpression(key);
|
|
7499
7525
|
if (!(expression === UNKNOWN_EXPRESSION || this.immutable)) {
|
|
7500
|
-
|
|
7501
|
-
|
|
7526
|
+
let expressionsToBeDeoptimized = this.expressionsToBeDeoptimizedByKey.get(key);
|
|
7527
|
+
if (!expressionsToBeDeoptimized) {
|
|
7528
|
+
this.expressionsToBeDeoptimizedByKey.set(key, (expressionsToBeDeoptimized = []));
|
|
7529
|
+
}
|
|
7502
7530
|
expressionsToBeDeoptimized.push(origin);
|
|
7503
7531
|
}
|
|
7504
7532
|
return expression;
|
|
@@ -7526,15 +7554,14 @@ const OBJECT_PROTOTYPE_FALLBACK = new (class ObjectPrototypeFallbackExpression e
|
|
|
7526
7554
|
return path.length > 1 || type === INTERACTION_CALLED;
|
|
7527
7555
|
}
|
|
7528
7556
|
})();
|
|
7529
|
-
const OBJECT_PROTOTYPE = new ObjectEntity(
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
}, OBJECT_PROTOTYPE_FALLBACK, true);
|
|
7557
|
+
const OBJECT_PROTOTYPE = new ObjectEntity(new Map([
|
|
7558
|
+
['hasOwnProperty', METHOD_RETURNS_BOOLEAN],
|
|
7559
|
+
['isPrototypeOf', METHOD_RETURNS_BOOLEAN],
|
|
7560
|
+
['propertyIsEnumerable', METHOD_RETURNS_BOOLEAN],
|
|
7561
|
+
['toLocaleString', METHOD_RETURNS_STRING],
|
|
7562
|
+
['toString', METHOD_RETURNS_STRING],
|
|
7563
|
+
['valueOf', METHOD_RETURNS_UNKNOWN]
|
|
7564
|
+
]), OBJECT_PROTOTYPE_FALLBACK, true);
|
|
7538
7565
|
|
|
7539
7566
|
const NEW_ARRAY_PROPERTIES = [
|
|
7540
7567
|
{ key: UnknownInteger, kind: 'init', property: UNKNOWN_EXPRESSION },
|
|
@@ -7639,44 +7666,43 @@ const METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF = [
|
|
|
7639
7666
|
returnsPrimitive: null
|
|
7640
7667
|
})
|
|
7641
7668
|
];
|
|
7642
|
-
const ARRAY_PROTOTYPE = new ObjectEntity(
|
|
7643
|
-
__proto__: null,
|
|
7669
|
+
const ARRAY_PROTOTYPE = new ObjectEntity(new Map([
|
|
7644
7670
|
// We assume that accessors have effects as we do not track the accessed value afterwards
|
|
7645
|
-
at
|
|
7646
|
-
concat
|
|
7647
|
-
copyWithin
|
|
7648
|
-
entries
|
|
7649
|
-
every
|
|
7650
|
-
fill
|
|
7651
|
-
filter
|
|
7652
|
-
find
|
|
7653
|
-
findIndex
|
|
7654
|
-
findLast
|
|
7655
|
-
findLastIndex
|
|
7656
|
-
flat
|
|
7657
|
-
flatMap
|
|
7658
|
-
forEach
|
|
7659
|
-
includes
|
|
7660
|
-
indexOf
|
|
7661
|
-
join
|
|
7662
|
-
keys
|
|
7663
|
-
lastIndexOf
|
|
7664
|
-
map
|
|
7665
|
-
pop
|
|
7666
|
-
push
|
|
7667
|
-
reduce
|
|
7668
|
-
reduceRight
|
|
7669
|
-
reverse
|
|
7670
|
-
shift
|
|
7671
|
-
slice
|
|
7672
|
-
some
|
|
7673
|
-
sort
|
|
7674
|
-
splice
|
|
7675
|
-
toLocaleString
|
|
7676
|
-
toString
|
|
7677
|
-
unshift
|
|
7678
|
-
values
|
|
7679
|
-
|
|
7671
|
+
['at', METHOD_DEOPTS_SELF_RETURNS_UNKNOWN],
|
|
7672
|
+
['concat', METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7673
|
+
['copyWithin', METHOD_MUTATES_SELF_RETURNS_SELF],
|
|
7674
|
+
['entries', METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7675
|
+
['every', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN],
|
|
7676
|
+
['fill', METHOD_MUTATES_SELF_RETURNS_SELF],
|
|
7677
|
+
['filter', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7678
|
+
['find', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN],
|
|
7679
|
+
['findIndex', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER],
|
|
7680
|
+
['findLast', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN],
|
|
7681
|
+
['findLastIndex', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NUMBER],
|
|
7682
|
+
['flat', METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7683
|
+
['flatMap', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7684
|
+
['forEach', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN],
|
|
7685
|
+
['includes', METHOD_RETURNS_BOOLEAN],
|
|
7686
|
+
['indexOf', METHOD_RETURNS_NUMBER],
|
|
7687
|
+
['join', METHOD_RETURNS_STRING],
|
|
7688
|
+
['keys', METHOD_RETURNS_UNKNOWN],
|
|
7689
|
+
['lastIndexOf', METHOD_RETURNS_NUMBER],
|
|
7690
|
+
['map', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7691
|
+
['pop', METHOD_MUTATES_SELF_RETURNS_UNKNOWN],
|
|
7692
|
+
['push', METHOD_MUTATES_SELF_AND_ARGS_RETURNS_NUMBER],
|
|
7693
|
+
['reduce', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN],
|
|
7694
|
+
['reduceRight', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN],
|
|
7695
|
+
['reverse', METHOD_MUTATES_SELF_RETURNS_SELF],
|
|
7696
|
+
['shift', METHOD_MUTATES_SELF_RETURNS_UNKNOWN],
|
|
7697
|
+
['slice', METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY],
|
|
7698
|
+
['some', METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_BOOLEAN],
|
|
7699
|
+
['sort', METHOD_CALLS_ARG_MUTATES_SELF_RETURNS_SELF],
|
|
7700
|
+
['splice', METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY],
|
|
7701
|
+
['toLocaleString', METHOD_RETURNS_STRING],
|
|
7702
|
+
['toString', METHOD_RETURNS_STRING],
|
|
7703
|
+
['unshift', METHOD_MUTATES_SELF_AND_ARGS_RETURNS_NUMBER],
|
|
7704
|
+
['values', METHOD_DEOPTS_SELF_RETURNS_UNKNOWN]
|
|
7705
|
+
]), OBJECT_PROTOTYPE, true);
|
|
7680
7706
|
|
|
7681
7707
|
class SpreadElement extends NodeBase {
|
|
7682
7708
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
@@ -7783,6 +7809,14 @@ const ValueProperties = Symbol('Value Properties');
|
|
|
7783
7809
|
const getUnknownValue = () => UnknownValue;
|
|
7784
7810
|
const returnFalse = () => false;
|
|
7785
7811
|
const returnTrue = () => true;
|
|
7812
|
+
const getWellKnownSymbol = (symbol) => ({
|
|
7813
|
+
__proto__: null,
|
|
7814
|
+
[ValueProperties]: {
|
|
7815
|
+
deoptimizeArgumentsOnCall: doNothing,
|
|
7816
|
+
getLiteralValue: () => symbol,
|
|
7817
|
+
hasEffectsWhenCalled: returnTrue
|
|
7818
|
+
}
|
|
7819
|
+
});
|
|
7786
7820
|
const PURE = {
|
|
7787
7821
|
deoptimizeArgumentsOnCall: doNothing,
|
|
7788
7822
|
getLiteralValue: getUnknownValue,
|
|
@@ -7868,6 +7902,11 @@ const INTL_MEMBER = {
|
|
|
7868
7902
|
[ValueProperties]: PURE,
|
|
7869
7903
|
supportedLocalesOf: PC
|
|
7870
7904
|
};
|
|
7905
|
+
const UNKNOWN_WELL_KNOWN = {
|
|
7906
|
+
deoptimizeArgumentsOnCall: doNothing,
|
|
7907
|
+
getLiteralValue: () => UnknownWellKnown,
|
|
7908
|
+
hasEffectsWhenCalled: returnTrue
|
|
7909
|
+
};
|
|
7871
7910
|
const knownGlobals = {
|
|
7872
7911
|
// Placeholders for global objects to avoid shape mutations
|
|
7873
7912
|
global: O,
|
|
@@ -8063,37 +8102,10 @@ const knownGlobals = {
|
|
|
8063
8102
|
for: PF,
|
|
8064
8103
|
keyFor: PF,
|
|
8065
8104
|
prototype: O,
|
|
8066
|
-
asyncDispose:
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
getLiteralValue() {
|
|
8071
|
-
return SymbolAsyncDispose;
|
|
8072
|
-
},
|
|
8073
|
-
// This might not be needed, but then we need to check a few more cases
|
|
8074
|
-
hasEffectsWhenCalled: returnTrue
|
|
8075
|
-
}
|
|
8076
|
-
},
|
|
8077
|
-
dispose: {
|
|
8078
|
-
__proto__: null,
|
|
8079
|
-
[ValueProperties]: {
|
|
8080
|
-
deoptimizeArgumentsOnCall: doNothing,
|
|
8081
|
-
getLiteralValue() {
|
|
8082
|
-
return SymbolDispose;
|
|
8083
|
-
},
|
|
8084
|
-
hasEffectsWhenCalled: returnTrue
|
|
8085
|
-
}
|
|
8086
|
-
},
|
|
8087
|
-
toStringTag: {
|
|
8088
|
-
__proto__: null,
|
|
8089
|
-
[ValueProperties]: {
|
|
8090
|
-
deoptimizeArgumentsOnCall: doNothing,
|
|
8091
|
-
getLiteralValue() {
|
|
8092
|
-
return SymbolToStringTag;
|
|
8093
|
-
},
|
|
8094
|
-
hasEffectsWhenCalled: returnTrue
|
|
8095
|
-
}
|
|
8096
|
-
}
|
|
8105
|
+
asyncDispose: getWellKnownSymbol(SymbolAsyncDispose),
|
|
8106
|
+
dispose: getWellKnownSymbol(SymbolDispose),
|
|
8107
|
+
hasInstance: getWellKnownSymbol(SymbolHasInstance),
|
|
8108
|
+
toStringTag: getWellKnownSymbol(SymbolToStringTag)
|
|
8097
8109
|
},
|
|
8098
8110
|
SyntaxError: PC,
|
|
8099
8111
|
toLocaleString: O,
|
|
@@ -8767,7 +8779,9 @@ function getGlobalAtPath(path) {
|
|
|
8767
8779
|
}
|
|
8768
8780
|
currentGlobal = currentGlobal[pathSegment];
|
|
8769
8781
|
if (!currentGlobal) {
|
|
8770
|
-
|
|
8782
|
+
// Well-known symbols very often have a complex meaning and are invoked implicitly by the language.
|
|
8783
|
+
// Resolve them to a special value so they can be distinguished and excluded from treeshaking.
|
|
8784
|
+
return path[0] === 'Symbol' && path.length === 2 ? UNKNOWN_WELL_KNOWN : null;
|
|
8771
8785
|
}
|
|
8772
8786
|
}
|
|
8773
8787
|
return currentGlobal[ValueProperties];
|
|
@@ -9701,7 +9715,11 @@ class ClassNode extends NodeBase {
|
|
|
9701
9715
|
if (definition.computed) {
|
|
9702
9716
|
const keyValue = definition.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
9703
9717
|
if (typeof keyValue === 'symbol') {
|
|
9704
|
-
properties.push({
|
|
9718
|
+
properties.push({
|
|
9719
|
+
key: isAnyWellKnown(keyValue) ? keyValue : UnknownKey,
|
|
9720
|
+
kind,
|
|
9721
|
+
property: definition
|
|
9722
|
+
});
|
|
9705
9723
|
continue;
|
|
9706
9724
|
}
|
|
9707
9725
|
else {
|
|
@@ -10586,7 +10604,7 @@ class FunctionNode extends FunctionBase {
|
|
|
10586
10604
|
}
|
|
10587
10605
|
createScope(parentScope) {
|
|
10588
10606
|
this.scope = new FunctionScope(parentScope, this);
|
|
10589
|
-
this.constructedEntity = new ObjectEntity(
|
|
10607
|
+
this.constructedEntity = new ObjectEntity(new Map(), OBJECT_PROTOTYPE);
|
|
10590
10608
|
// This makes sure that all deoptimizations of "this" are applied to the
|
|
10591
10609
|
// constructed entity.
|
|
10592
10610
|
this.scope.thisVariable.addArgumentForDeoptimization(this.constructedEntity);
|
|
@@ -11321,6 +11339,9 @@ class MemberExpression extends NodeBase {
|
|
|
11321
11339
|
this.includeNode(context);
|
|
11322
11340
|
this.object.include(context, includeChildrenRecursively);
|
|
11323
11341
|
this.property.include(context, includeChildrenRecursively);
|
|
11342
|
+
if (includeChildrenRecursively) {
|
|
11343
|
+
this.variable?.includePath(UNKNOWN_PATH, context);
|
|
11344
|
+
}
|
|
11324
11345
|
}
|
|
11325
11346
|
includeNode(context) {
|
|
11326
11347
|
this.included = true;
|
|
@@ -13569,6 +13590,9 @@ class BinaryExpression extends NodeBase {
|
|
|
13569
13590
|
if (typeof this.getRenderedLiteralValue() === 'symbol') {
|
|
13570
13591
|
this.left.include(context, includeChildrenRecursively, options);
|
|
13571
13592
|
this.right.include(context, includeChildrenRecursively, options);
|
|
13593
|
+
// `instanceof` will attempt to call RHS's `Symbol.hasInstance` if it exists.
|
|
13594
|
+
if (this.operator === 'instanceof')
|
|
13595
|
+
this.right.includePath(INSTANCEOF_PATH, context);
|
|
13572
13596
|
}
|
|
13573
13597
|
}
|
|
13574
13598
|
includeNode(context) {
|
|
@@ -16068,7 +16092,11 @@ class ObjectExpression extends NodeBase {
|
|
|
16068
16092
|
if (property.computed) {
|
|
16069
16093
|
const keyValue = property.key.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
16070
16094
|
if (typeof keyValue === 'symbol') {
|
|
16071
|
-
properties.push({
|
|
16095
|
+
properties.push({
|
|
16096
|
+
key: isAnyWellKnown(keyValue) ? keyValue : UnknownKey,
|
|
16097
|
+
kind: property.kind,
|
|
16098
|
+
property
|
|
16099
|
+
});
|
|
16072
16100
|
continue;
|
|
16073
16101
|
}
|
|
16074
16102
|
else {
|
|
@@ -19748,6 +19776,7 @@ class Chunk {
|
|
|
19748
19776
|
this.facadeModule = null;
|
|
19749
19777
|
this.namespaceVariableName = '';
|
|
19750
19778
|
this.variableName = '';
|
|
19779
|
+
this.isManualChunk = false;
|
|
19751
19780
|
this.accessedGlobalsByScope = new Map();
|
|
19752
19781
|
this.dynamicEntryModules = [];
|
|
19753
19782
|
this.dynamicName = null;
|
|
@@ -19802,6 +19831,7 @@ class Chunk {
|
|
|
19802
19831
|
}
|
|
19803
19832
|
}
|
|
19804
19833
|
this.suggestedVariableName = makeLegal(this.generateVariableName());
|
|
19834
|
+
this.isManualChunk = manualChunkAlias !== null;
|
|
19805
19835
|
}
|
|
19806
19836
|
static generateFacade(inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, externalChunkByModule, facadeChunkByModule, includedNamespaces, facadedModule, facadeName, getPlaceholder, bundle, inputBase, snippets) {
|
|
19807
19837
|
const chunk = new Chunk([], inputOptions, outputOptions, unsetOptions, pluginDriver, modulesById, chunkByModule, externalChunkByModule, facadeChunkByModule, includedNamespaces, null, getPlaceholder, bundle, inputBase, snippets);
|
|
@@ -20947,7 +20977,7 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, log
|
|
|
20947
20977
|
const { chunkDefinitions, modulesInManualChunks } = getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry, isManualChunksFunctionForm, onlyExplicitManualChunks);
|
|
20948
20978
|
const { allEntries, dependentEntriesByModule, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, dynamicallyDependentEntriesByAwaitedDynamicEntry, awaitedDynamicImportsByEntry } = analyzeModuleGraph(entries);
|
|
20949
20979
|
// Each chunk is identified by its position in this array
|
|
20950
|
-
const chunkAtoms = getChunksWithSameDependentEntries(
|
|
20980
|
+
const chunkAtoms = getChunksWithSameDependentEntries(getModulesWithDependentEntriesAndHandleTLACycles(dependentEntriesByModule, modulesInManualChunks, chunkDefinitions));
|
|
20951
20981
|
const staticDependencyAtomsByEntry = getStaticDependencyAtomsByEntry(allEntries, chunkAtoms);
|
|
20952
20982
|
// Warning: This will consume dynamicallyDependentEntriesByDynamicEntry.
|
|
20953
20983
|
// If we no longer want this, we should make a copy here.
|
|
@@ -21114,9 +21144,16 @@ function getChunksWithSameDependentEntries(modulesWithDependentEntries) {
|
|
|
21114
21144
|
}
|
|
21115
21145
|
return Object.values(chunkModules);
|
|
21116
21146
|
}
|
|
21117
|
-
function*
|
|
21147
|
+
function* getModulesWithDependentEntriesAndHandleTLACycles(dependentEntriesByModule, modulesInManualChunks, chunkDefinitions) {
|
|
21118
21148
|
for (const [module, dependentEntries] of dependentEntriesByModule) {
|
|
21119
21149
|
if (!modulesInManualChunks.has(module)) {
|
|
21150
|
+
if (module.cycles.size > 0 && module.includedTopLevelAwaitingDynamicImporters.size > 0) {
|
|
21151
|
+
chunkDefinitions.push({
|
|
21152
|
+
alias: null,
|
|
21153
|
+
modules: [module]
|
|
21154
|
+
});
|
|
21155
|
+
continue;
|
|
21156
|
+
}
|
|
21120
21157
|
yield { dependentEntries, modules: [module] };
|
|
21121
21158
|
}
|
|
21122
21159
|
}
|
|
@@ -22178,12 +22215,52 @@ class Bundle {
|
|
|
22178
22215
|
for (const chunk of chunks) {
|
|
22179
22216
|
chunk.link();
|
|
22180
22217
|
}
|
|
22218
|
+
if (!inlineDynamicImports && !preserveModules) {
|
|
22219
|
+
this.checkCircularChunks(chunks);
|
|
22220
|
+
}
|
|
22181
22221
|
const facades = [];
|
|
22182
22222
|
for (const chunk of chunks) {
|
|
22183
22223
|
facades.push(...chunk.generateFacades());
|
|
22184
22224
|
}
|
|
22185
22225
|
return [...chunks, ...facades];
|
|
22186
22226
|
}
|
|
22227
|
+
checkCircularChunks(chunks) {
|
|
22228
|
+
const visited = new Set();
|
|
22229
|
+
const parents = new Map();
|
|
22230
|
+
const handleDependency = (chunk, parent) => {
|
|
22231
|
+
if (parents.has(chunk)) {
|
|
22232
|
+
if (!visited.has(chunk)) {
|
|
22233
|
+
const path = [chunk.getChunkName()];
|
|
22234
|
+
let isManualChunkConflict = chunk.isManualChunk;
|
|
22235
|
+
let nextChunk = parent;
|
|
22236
|
+
while (nextChunk !== chunk && nextChunk) {
|
|
22237
|
+
path.push(nextChunk.getChunkName());
|
|
22238
|
+
isManualChunkConflict &&= nextChunk.isManualChunk;
|
|
22239
|
+
nextChunk = parents.get(nextChunk);
|
|
22240
|
+
}
|
|
22241
|
+
path.push(path[0]);
|
|
22242
|
+
path.reverse();
|
|
22243
|
+
this.inputOptions.onLog(parseAst_js.LOGLEVEL_WARN, parseAst_js.logCircularChunk(path, isManualChunkConflict));
|
|
22244
|
+
}
|
|
22245
|
+
return;
|
|
22246
|
+
}
|
|
22247
|
+
parents.set(chunk, parent);
|
|
22248
|
+
analyseChunk(chunk);
|
|
22249
|
+
};
|
|
22250
|
+
const analyseChunk = (chunk) => {
|
|
22251
|
+
for (const dependency of chunk.dependencies) {
|
|
22252
|
+
if (dependency instanceof Chunk) {
|
|
22253
|
+
handleDependency(dependency, chunk);
|
|
22254
|
+
}
|
|
22255
|
+
}
|
|
22256
|
+
visited.add(chunk);
|
|
22257
|
+
};
|
|
22258
|
+
for (const chunk of chunks) {
|
|
22259
|
+
if (!parents.has(chunk)) {
|
|
22260
|
+
analyseChunk(chunk);
|
|
22261
|
+
}
|
|
22262
|
+
}
|
|
22263
|
+
}
|
|
22187
22264
|
}
|
|
22188
22265
|
function validateOptionsForMultiChunkOutput(outputOptions, log) {
|
|
22189
22266
|
if (outputOptions.format === 'umd' || outputOptions.format === 'iife')
|