rollup 3.7.5-0 → 3.7.6-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 CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  /*
4
4
  @license
5
- Rollup.js v3.7.5-0
6
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
5
+ Rollup.js v3.7.6-0
6
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
7
7
 
8
8
  https://github.com/rollup/rollup
9
9
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { promises } from 'node:fs';
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.7.5-0";
19
+ var version$1 = "3.7.6-0";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -11775,6 +11775,15 @@ class ExportDefaultVariable extends LocalVariable {
11775
11775
  this.name = identifier.name;
11776
11776
  }
11777
11777
  }
11778
+ forbidName(name) {
11779
+ const original = this.getOriginalVariable();
11780
+ if (original === this) {
11781
+ super.forbidName(name);
11782
+ }
11783
+ else {
11784
+ original.forbidName(name);
11785
+ }
11786
+ }
11778
11787
  getAssignedVariableName() {
11779
11788
  return (this.originalId && this.originalId.name) || null;
11780
11789
  }
@@ -12426,6 +12435,25 @@ class NamespaceVariable extends Variable {
12426
12435
  this.references.push(identifier);
12427
12436
  this.name = identifier.name;
12428
12437
  }
12438
+ deoptimizePath(path) {
12439
+ if (path.length > 1) {
12440
+ const key = path[0];
12441
+ if (typeof key === 'string') {
12442
+ this.getMemberVariables()[key]?.deoptimizePath(path.slice(1));
12443
+ }
12444
+ }
12445
+ }
12446
+ deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
12447
+ if (path.length > 1 || (path.length === 1 && interaction.type === INTERACTION_CALLED)) {
12448
+ const key = path[0];
12449
+ if (typeof key === 'string') {
12450
+ this.getMemberVariables()[key]?.deoptimizeThisOnInteractionAtPath(interaction, path.slice(1), recursionTracker);
12451
+ }
12452
+ else {
12453
+ interaction.thisArg.deoptimizePath(UNKNOWN_PATH);
12454
+ }
12455
+ }
12456
+ }
12429
12457
  getLiteralValueAtPath(path) {
12430
12458
  if (path[0] === SymbolToStringTag) {
12431
12459
  return 'Module';
@@ -12447,8 +12475,22 @@ class NamespaceVariable extends Variable {
12447
12475
  }
12448
12476
  return (this.memberVariables = memberVariables);
12449
12477
  }
12450
- hasEffectsOnInteractionAtPath() {
12451
- return false;
12478
+ hasEffectsOnInteractionAtPath(path, interaction, context) {
12479
+ const { type } = interaction;
12480
+ if (path.length === 0) {
12481
+ // This can only be a call anyway
12482
+ return true;
12483
+ }
12484
+ if (path.length === 1 && type !== INTERACTION_CALLED) {
12485
+ return type === INTERACTION_ASSIGNED;
12486
+ }
12487
+ const key = path[0];
12488
+ if (typeof key !== 'string') {
12489
+ return true;
12490
+ }
12491
+ const memberVariable = this.getMemberVariables()[key];
12492
+ return (!memberVariable ||
12493
+ memberVariable.hasEffectsOnInteractionAtPath(path.slice(1), interaction, context));
12452
12494
  }
12453
12495
  include() {
12454
12496
  this.included = true;
@@ -16055,15 +16097,14 @@ small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.sma
16055
16097
  big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
16056
16098
  Unoptimized chunks contain ${getNumberOfCycles(chunkPartition)} cycles.
16057
16099
  `);
16058
- const chunkAliases = new Map();
16059
16100
  if (chunkPartition.small.sideEffect.size > 0) {
16060
16101
  console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
16061
- mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition, chunkAliases);
16102
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16062
16103
  console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16063
16104
  }
16064
16105
  if (chunkPartition.small.pure.size > 0) {
16065
16106
  console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
16066
- mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition, chunkAliases);
16107
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16067
16108
  console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16068
16109
  }
16069
16110
  timeEnd('optimize chunks', 3);
@@ -16088,19 +16129,20 @@ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16088
16129
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16089
16130
  const chunkDescription = {
16090
16131
  dependencies: new Set(),
16132
+ dependentChunks: new Set(),
16091
16133
  modules,
16092
16134
  pure: true,
16093
16135
  signature,
16094
- size: 0,
16095
- transitiveDependencies: new Set(),
16096
- transitiveDependentChunks: new Set()
16136
+ size: 0
16097
16137
  };
16098
16138
  let size = 0;
16099
16139
  let pure = true;
16100
16140
  for (const module of modules) {
16101
16141
  chunkByModule.set(module, chunkDescription);
16102
16142
  pure && (pure = !module.hasEffects());
16103
- size += module.magicString.toString().length;
16143
+ // Unfortunately, we cannot take tree-shaking into account here because
16144
+ // rendering did not happen yet
16145
+ size += module.originalCode.length;
16104
16146
  }
16105
16147
  chunkDescription.pure = pure;
16106
16148
  chunkDescription.size = size;
@@ -16152,25 +16194,13 @@ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16152
16194
  for (const chunks of chunkLists) {
16153
16195
  chunks.sort(compareChunks);
16154
16196
  for (const chunk of chunks) {
16155
- const { dependencies, modules, transitiveDependencies } = chunk;
16156
- const transitiveDependencyModules = new Set();
16197
+ const { dependencies, modules } = chunk;
16157
16198
  for (const module of modules) {
16158
16199
  for (const dependency of module.getDependenciesToBeIncluded()) {
16159
16200
  const dependencyChunk = chunkByModule.get(dependency);
16160
16201
  if (dependencyChunk && dependencyChunk !== chunk) {
16161
16202
  dependencies.add(dependencyChunk);
16162
- transitiveDependencyModules.add(dependency);
16163
- }
16164
- }
16165
- }
16166
- for (const module of transitiveDependencyModules) {
16167
- const transitiveDependency = chunkByModule.get(module);
16168
- if (transitiveDependency !== chunk) {
16169
- transitiveDependencies.add(transitiveDependency);
16170
- for (const dependency of module.getDependenciesToBeIncluded()) {
16171
- if (!(dependency instanceof ExternalModule)) {
16172
- transitiveDependencyModules.add(dependency);
16173
- }
16203
+ dependencyChunk.dependentChunks.add(chunk);
16174
16204
  }
16175
16205
  }
16176
16206
  }
@@ -16180,9 +16210,8 @@ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16180
16210
  function compareChunks({ size: sizeA }, { size: sizeB }) {
16181
16211
  return sizeA - sizeB;
16182
16212
  }
16183
- function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition, chunkAliases) {
16213
+ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16184
16214
  for (const mergedChunk of chunksToBeMerged) {
16185
- replaceAliasedDependencies(mergedChunk, chunkAliases);
16186
16215
  let closestChunk = null;
16187
16216
  let closestChunkDistance = Infinity;
16188
16217
  const { signature, modules, pure, size } = mergedChunk;
@@ -16192,7 +16221,7 @@ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartitio
16192
16221
  const distance = pure
16193
16222
  ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16194
16223
  : getSignatureDistance(targetChunk.signature, signature, true);
16195
- if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk, chunkAliases)) {
16224
+ if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16196
16225
  if (distance === 1) {
16197
16226
  closestChunk = targetChunk;
16198
16227
  break;
@@ -16202,58 +16231,40 @@ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartitio
16202
16231
  }
16203
16232
  }
16204
16233
  if (closestChunk) {
16205
- chunkAliases.set(mergedChunk, closestChunk);
16206
16234
  chunksToBeMerged.delete(mergedChunk);
16207
16235
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16208
16236
  closestChunk.modules.push(...modules);
16209
16237
  closestChunk.size += size;
16210
16238
  closestChunk.pure && (closestChunk.pure = pure);
16211
16239
  closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16212
- const { dependencies, transitiveDependencies } = closestChunk;
16240
+ const { dependencies, dependentChunks } = closestChunk;
16213
16241
  for (const dependency of mergedChunk.dependencies) {
16214
16242
  dependencies.add(dependency);
16215
16243
  }
16216
- for (const dependency of mergedChunk.transitiveDependencies) {
16217
- transitiveDependencies.add(dependency);
16244
+ for (const dependentChunk of mergedChunk.dependentChunks) {
16245
+ dependentChunks.add(dependentChunk);
16246
+ dependentChunk.dependencies.delete(mergedChunk);
16247
+ dependentChunk.dependencies.add(closestChunk);
16218
16248
  }
16219
16249
  dependencies.delete(closestChunk);
16220
- dependencies.delete(mergedChunk);
16221
- transitiveDependencies.delete(closestChunk);
16222
- transitiveDependencies.delete(mergedChunk);
16223
16250
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16224
16251
  }
16225
16252
  }
16226
16253
  }
16227
- function replaceAliasedDependencies(chunk, chunkAliases) {
16228
- for (const [alias, aliased] of chunkAliases) {
16229
- if (chunk.dependencies.has(alias)) {
16230
- chunk.dependencies.delete(alias);
16231
- chunk.dependencies.add(aliased);
16232
- }
16233
- if (chunk.transitiveDependencies.has(alias)) {
16234
- chunk.transitiveDependencies.delete(alias);
16235
- chunk.transitiveDependencies.add(aliased);
16236
- }
16237
- }
16238
- }
16239
- // Merging will not produce cycles if
16240
- // - no chunk is a transitive dependency of the other, or
16241
- // - none of the direct non-merged dependencies of a chunk have the other
16242
- // chunk as a transitive dependency
16243
- function isValidMerge(mergedChunk, targetChunk, chunkAliases) {
16244
- if (hasTransitiveDependency(mergedChunk, targetChunk)) {
16245
- return false;
16246
- }
16247
- replaceAliasedDependencies(targetChunk, chunkAliases);
16248
- return !hasTransitiveDependency(targetChunk, mergedChunk);
16254
+ // Merging will not produce cycles if none of the direct non-merged dependencies
16255
+ // of a chunk have the other chunk as a transitive dependency
16256
+ function isValidMerge(mergedChunk, targetChunk) {
16257
+ return !(hasTransitiveDependency(mergedChunk, targetChunk) ||
16258
+ hasTransitiveDependency(targetChunk, mergedChunk));
16249
16259
  }
16250
16260
  function hasTransitiveDependency(dependentChunk, dependencyChunk) {
16251
- if (!dependentChunk.transitiveDependencies.has(dependencyChunk)) {
16252
- return false;
16253
- }
16254
- for (const dependency of dependentChunk.dependencies) {
16255
- if (dependency.transitiveDependencies.has(dependencyChunk)) {
16256
- return true;
16261
+ const chunksToCheck = new Set(dependentChunk.dependencies);
16262
+ for (const { dependencies } of chunksToCheck) {
16263
+ for (const dependency of dependencies) {
16264
+ if (dependency === dependencyChunk) {
16265
+ return true;
16266
+ }
16267
+ chunksToCheck.add(dependency);
16257
16268
  }
16258
16269
  }
16259
16270
  return false;
@@ -25212,23 +25223,24 @@ function handleError(error, recover = false) {
25212
25223
  const nameSection = name ? `${name}: ` : '';
25213
25224
  const pluginSection = error.plugin ? `(plugin ${error.plugin}) ` : '';
25214
25225
  const message = `${pluginSection}${nameSection}${error.message}`;
25215
- stderr(bold(red(`[!] ${bold(message.toString())}`)));
25226
+ const outputLines = [bold(red(`[!] ${bold(message.toString())}`))];
25216
25227
  if (error.url) {
25217
- stderr(cyan(error.url));
25228
+ outputLines.push(cyan(error.url));
25218
25229
  }
25219
25230
  if (error.loc) {
25220
- stderr(`${relativeId((error.loc.file || error.id))} (${error.loc.line}:${error.loc.column})`);
25231
+ outputLines.push(`${relativeId((error.loc.file || error.id))} (${error.loc.line}:${error.loc.column})`);
25221
25232
  }
25222
25233
  else if (error.id) {
25223
- stderr(relativeId(error.id));
25234
+ outputLines.push(relativeId(error.id));
25224
25235
  }
25225
25236
  if (error.frame) {
25226
- stderr(dim(error.frame));
25237
+ outputLines.push(dim(error.frame));
25227
25238
  }
25228
25239
  if (error.stack) {
25229
- stderr(dim(error.stack));
25240
+ outputLines.push(dim(error.stack?.replace(`${nameSection}${error.message}\n`, '')));
25230
25241
  }
25231
- stderr('');
25242
+ outputLines.push('', '');
25243
+ stderr(outputLines.join('\n'));
25232
25244
  // eslint-disable-next-line unicorn/no-process-exit
25233
25245
  if (!recover)
25234
25246
  process$1.exit(1);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -19,7 +19,7 @@ export type RollupWarning = RollupLog;
19
19
 
20
20
  export interface RollupLog {
21
21
  binding?: string;
22
- cause?: Error;
22
+ cause?: unknown;
23
23
  code?: string;
24
24
  exporter?: string;
25
25
  frame?: string;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
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$1 = "3.7.5-0";
34
+ var version$1 = "3.7.6-0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -1208,23 +1208,24 @@ function handleError(error, recover = false) {
1208
1208
  const nameSection = name ? `${name}: ` : '';
1209
1209
  const pluginSection = error.plugin ? `(plugin ${error.plugin}) ` : '';
1210
1210
  const message = `${pluginSection}${nameSection}${error.message}`;
1211
- stderr(bold(red(`[!] ${bold(message.toString())}`)));
1211
+ const outputLines = [bold(red(`[!] ${bold(message.toString())}`))];
1212
1212
  if (error.url) {
1213
- stderr(cyan(error.url));
1213
+ outputLines.push(cyan(error.url));
1214
1214
  }
1215
1215
  if (error.loc) {
1216
- stderr(`${relativeId((error.loc.file || error.id))} (${error.loc.line}:${error.loc.column})`);
1216
+ outputLines.push(`${relativeId((error.loc.file || error.id))} (${error.loc.line}:${error.loc.column})`);
1217
1217
  }
1218
1218
  else if (error.id) {
1219
- stderr(relativeId(error.id));
1219
+ outputLines.push(relativeId(error.id));
1220
1220
  }
1221
1221
  if (error.frame) {
1222
- stderr(dim(error.frame));
1222
+ outputLines.push(dim(error.frame));
1223
1223
  }
1224
1224
  if (error.stack) {
1225
- stderr(dim(error.stack));
1225
+ outputLines.push(dim(error.stack?.replace(`${nameSection}${error.message}\n`, '')));
1226
1226
  }
1227
- stderr('');
1227
+ outputLines.push('', '');
1228
+ stderr(outputLines.join('\n'));
1228
1229
  // eslint-disable-next-line unicorn/no-process-exit
1229
1230
  if (!recover)
1230
1231
  process$1.exit(1);
@@ -12290,6 +12291,15 @@ class ExportDefaultVariable extends LocalVariable {
12290
12291
  this.name = identifier.name;
12291
12292
  }
12292
12293
  }
12294
+ forbidName(name) {
12295
+ const original = this.getOriginalVariable();
12296
+ if (original === this) {
12297
+ super.forbidName(name);
12298
+ }
12299
+ else {
12300
+ original.forbidName(name);
12301
+ }
12302
+ }
12293
12303
  getAssignedVariableName() {
12294
12304
  return (this.originalId && this.originalId.name) || null;
12295
12305
  }
@@ -12941,6 +12951,25 @@ class NamespaceVariable extends Variable {
12941
12951
  this.references.push(identifier);
12942
12952
  this.name = identifier.name;
12943
12953
  }
12954
+ deoptimizePath(path) {
12955
+ if (path.length > 1) {
12956
+ const key = path[0];
12957
+ if (typeof key === 'string') {
12958
+ this.getMemberVariables()[key]?.deoptimizePath(path.slice(1));
12959
+ }
12960
+ }
12961
+ }
12962
+ deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
12963
+ if (path.length > 1 || (path.length === 1 && interaction.type === INTERACTION_CALLED)) {
12964
+ const key = path[0];
12965
+ if (typeof key === 'string') {
12966
+ this.getMemberVariables()[key]?.deoptimizeThisOnInteractionAtPath(interaction, path.slice(1), recursionTracker);
12967
+ }
12968
+ else {
12969
+ interaction.thisArg.deoptimizePath(UNKNOWN_PATH);
12970
+ }
12971
+ }
12972
+ }
12944
12973
  getLiteralValueAtPath(path) {
12945
12974
  if (path[0] === SymbolToStringTag) {
12946
12975
  return 'Module';
@@ -12962,8 +12991,22 @@ class NamespaceVariable extends Variable {
12962
12991
  }
12963
12992
  return (this.memberVariables = memberVariables);
12964
12993
  }
12965
- hasEffectsOnInteractionAtPath() {
12966
- return false;
12994
+ hasEffectsOnInteractionAtPath(path, interaction, context) {
12995
+ const { type } = interaction;
12996
+ if (path.length === 0) {
12997
+ // This can only be a call anyway
12998
+ return true;
12999
+ }
13000
+ if (path.length === 1 && type !== INTERACTION_CALLED) {
13001
+ return type === INTERACTION_ASSIGNED;
13002
+ }
13003
+ const key = path[0];
13004
+ if (typeof key !== 'string') {
13005
+ return true;
13006
+ }
13007
+ const memberVariable = this.getMemberVariables()[key];
13008
+ return (!memberVariable ||
13009
+ memberVariable.hasEffectsOnInteractionAtPath(path.slice(1), interaction, context));
12967
13010
  }
12968
13011
  include() {
12969
13012
  this.included = true;
@@ -16570,15 +16613,14 @@ small ${`${chunkPartition.small.pure.size}`.padEnd(5, ' ')} ${chunkPartition.sma
16570
16613
  big ${`${chunkPartition.big.pure.size}`.padEnd(5, ' ')} ${chunkPartition.big.sideEffect.size}
16571
16614
  Unoptimized chunks contain ${getNumberOfCycles(chunkPartition)} cycles.
16572
16615
  `);
16573
- const chunkAliases = new Map();
16574
16616
  if (chunkPartition.small.sideEffect.size > 0) {
16575
16617
  console.log(`Trying to find merge targets for ${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects...`);
16576
- mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition, chunkAliases);
16618
+ mergeChunks(chunkPartition.small.sideEffect, [chunkPartition.small.pure, chunkPartition.big.pure], minChunkSize, chunkPartition);
16577
16619
  console.log(`${chunkPartition.small.sideEffect.size} chunks smaller than ${prettyBytes(minChunkSize)} with side effects remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16578
16620
  }
16579
16621
  if (chunkPartition.small.pure.size > 0) {
16580
16622
  console.log(`Trying to find merge targets for ${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)}...`);
16581
- mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition, chunkAliases);
16623
+ mergeChunks(chunkPartition.small.pure, [chunkPartition.small.pure, chunkPartition.big.sideEffect, chunkPartition.big.pure], minChunkSize, chunkPartition);
16582
16624
  console.log(`${chunkPartition.small.pure.size} pure chunks smaller than ${prettyBytes(minChunkSize)} remaining.\nGenerated chunks contain ${getNumberOfCycles(chunkPartition)} cycles.\n`);
16583
16625
  }
16584
16626
  timeEnd('optimize chunks', 3);
@@ -16603,19 +16645,20 @@ function getPartitionedChunks(chunkModulesBySignature, minChunkSize) {
16603
16645
  for (const [signature, modules] of Object.entries(chunkModulesBySignature)) {
16604
16646
  const chunkDescription = {
16605
16647
  dependencies: new Set(),
16648
+ dependentChunks: new Set(),
16606
16649
  modules,
16607
16650
  pure: true,
16608
16651
  signature,
16609
- size: 0,
16610
- transitiveDependencies: new Set(),
16611
- transitiveDependentChunks: new Set()
16652
+ size: 0
16612
16653
  };
16613
16654
  let size = 0;
16614
16655
  let pure = true;
16615
16656
  for (const module of modules) {
16616
16657
  chunkByModule.set(module, chunkDescription);
16617
16658
  pure && (pure = !module.hasEffects());
16618
- size += module.magicString.toString().length;
16659
+ // Unfortunately, we cannot take tree-shaking into account here because
16660
+ // rendering did not happen yet
16661
+ size += module.originalCode.length;
16619
16662
  }
16620
16663
  chunkDescription.pure = pure;
16621
16664
  chunkDescription.size = size;
@@ -16667,25 +16710,13 @@ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16667
16710
  for (const chunks of chunkLists) {
16668
16711
  chunks.sort(compareChunks);
16669
16712
  for (const chunk of chunks) {
16670
- const { dependencies, modules, transitiveDependencies } = chunk;
16671
- const transitiveDependencyModules = new Set();
16713
+ const { dependencies, modules } = chunk;
16672
16714
  for (const module of modules) {
16673
16715
  for (const dependency of module.getDependenciesToBeIncluded()) {
16674
16716
  const dependencyChunk = chunkByModule.get(dependency);
16675
16717
  if (dependencyChunk && dependencyChunk !== chunk) {
16676
16718
  dependencies.add(dependencyChunk);
16677
- transitiveDependencyModules.add(dependency);
16678
- }
16679
- }
16680
- }
16681
- for (const module of transitiveDependencyModules) {
16682
- const transitiveDependency = chunkByModule.get(module);
16683
- if (transitiveDependency !== chunk) {
16684
- transitiveDependencies.add(transitiveDependency);
16685
- for (const dependency of module.getDependenciesToBeIncluded()) {
16686
- if (!(dependency instanceof ExternalModule)) {
16687
- transitiveDependencyModules.add(dependency);
16688
- }
16719
+ dependencyChunk.dependentChunks.add(chunk);
16689
16720
  }
16690
16721
  }
16691
16722
  }
@@ -16695,9 +16726,8 @@ function sortChunksAndAddDependencies(chunkLists, chunkByModule) {
16695
16726
  function compareChunks({ size: sizeA }, { size: sizeB }) {
16696
16727
  return sizeA - sizeB;
16697
16728
  }
16698
- function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition, chunkAliases) {
16729
+ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartition) {
16699
16730
  for (const mergedChunk of chunksToBeMerged) {
16700
- replaceAliasedDependencies(mergedChunk, chunkAliases);
16701
16731
  let closestChunk = null;
16702
16732
  let closestChunkDistance = Infinity;
16703
16733
  const { signature, modules, pure, size } = mergedChunk;
@@ -16707,7 +16737,7 @@ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartitio
16707
16737
  const distance = pure
16708
16738
  ? getSignatureDistance(signature, targetChunk.signature, !targetChunk.pure)
16709
16739
  : getSignatureDistance(targetChunk.signature, signature, true);
16710
- if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk, chunkAliases)) {
16740
+ if (distance < closestChunkDistance && isValidMerge(mergedChunk, targetChunk)) {
16711
16741
  if (distance === 1) {
16712
16742
  closestChunk = targetChunk;
16713
16743
  break;
@@ -16717,58 +16747,40 @@ function mergeChunks(chunksToBeMerged, targetChunks, minChunkSize, chunkPartitio
16717
16747
  }
16718
16748
  }
16719
16749
  if (closestChunk) {
16720
- chunkAliases.set(mergedChunk, closestChunk);
16721
16750
  chunksToBeMerged.delete(mergedChunk);
16722
16751
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).delete(closestChunk);
16723
16752
  closestChunk.modules.push(...modules);
16724
16753
  closestChunk.size += size;
16725
16754
  closestChunk.pure && (closestChunk.pure = pure);
16726
16755
  closestChunk.signature = mergeSignatures(signature, closestChunk.signature);
16727
- const { dependencies, transitiveDependencies } = closestChunk;
16756
+ const { dependencies, dependentChunks } = closestChunk;
16728
16757
  for (const dependency of mergedChunk.dependencies) {
16729
16758
  dependencies.add(dependency);
16730
16759
  }
16731
- for (const dependency of mergedChunk.transitiveDependencies) {
16732
- transitiveDependencies.add(dependency);
16760
+ for (const dependentChunk of mergedChunk.dependentChunks) {
16761
+ dependentChunks.add(dependentChunk);
16762
+ dependentChunk.dependencies.delete(mergedChunk);
16763
+ dependentChunk.dependencies.add(closestChunk);
16733
16764
  }
16734
16765
  dependencies.delete(closestChunk);
16735
- dependencies.delete(mergedChunk);
16736
- transitiveDependencies.delete(closestChunk);
16737
- transitiveDependencies.delete(mergedChunk);
16738
16766
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16739
16767
  }
16740
16768
  }
16741
16769
  }
16742
- function replaceAliasedDependencies(chunk, chunkAliases) {
16743
- for (const [alias, aliased] of chunkAliases) {
16744
- if (chunk.dependencies.has(alias)) {
16745
- chunk.dependencies.delete(alias);
16746
- chunk.dependencies.add(aliased);
16747
- }
16748
- if (chunk.transitiveDependencies.has(alias)) {
16749
- chunk.transitiveDependencies.delete(alias);
16750
- chunk.transitiveDependencies.add(aliased);
16751
- }
16752
- }
16753
- }
16754
- // Merging will not produce cycles if
16755
- // - no chunk is a transitive dependency of the other, or
16756
- // - none of the direct non-merged dependencies of a chunk have the other
16757
- // chunk as a transitive dependency
16758
- function isValidMerge(mergedChunk, targetChunk, chunkAliases) {
16759
- if (hasTransitiveDependency(mergedChunk, targetChunk)) {
16760
- return false;
16761
- }
16762
- replaceAliasedDependencies(targetChunk, chunkAliases);
16763
- return !hasTransitiveDependency(targetChunk, mergedChunk);
16770
+ // Merging will not produce cycles if none of the direct non-merged dependencies
16771
+ // of a chunk have the other chunk as a transitive dependency
16772
+ function isValidMerge(mergedChunk, targetChunk) {
16773
+ return !(hasTransitiveDependency(mergedChunk, targetChunk) ||
16774
+ hasTransitiveDependency(targetChunk, mergedChunk));
16764
16775
  }
16765
16776
  function hasTransitiveDependency(dependentChunk, dependencyChunk) {
16766
- if (!dependentChunk.transitiveDependencies.has(dependencyChunk)) {
16767
- return false;
16768
- }
16769
- for (const dependency of dependentChunk.dependencies) {
16770
- if (dependency.transitiveDependencies.has(dependencyChunk)) {
16771
- return true;
16777
+ const chunksToCheck = new Set(dependentChunk.dependencies);
16778
+ for (const { dependencies } of chunksToCheck) {
16779
+ for (const dependency of dependencies) {
16780
+ if (dependency === dependencyChunk) {
16781
+ return true;
16782
+ }
16783
+ chunksToCheck.add(dependency);
16772
16784
  }
16773
16785
  }
16774
16786
  return false;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.7.5-0
4
- Fri, 16 Dec 2022 10:54:15 GMT - commit 1ee5d10583f88926dc36b97e7b3870ee078327e2
3
+ Rollup.js v3.7.6-0
4
+ Sun, 18 Dec 2022 05:56:49 GMT - commit d226f7976dc543ff814af389e183d627d4e94ed4
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "3.7.5-0",
3
+ "version": "3.7.6-0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",