rollup 3.17.2 → 3.17.3-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.17.2
6
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
5
+ Rollup.js v3.17.3-0
6
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
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.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -16,7 +16,7 @@ import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/pr
16
16
  import { EventEmitter } from 'node:events';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version$1 = "3.17.2";
19
+ var version$1 = "3.17.3-0";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -5701,8 +5701,8 @@ class NodeBase extends ExpressionEntity {
5701
5701
  }
5702
5702
  addExportedVariables(_variables, _exportNamesByVariable) { }
5703
5703
  /**
5704
- * Override this to bind assignments to variables and do any initialisations that
5705
- * require the scopes to be populated with variables.
5704
+ * Override this to bind assignments to variables and do any initialisations
5705
+ * that require the scopes to be populated with variables.
5706
5706
  */
5707
5707
  bind() {
5708
5708
  for (const key of this.keys) {
@@ -5718,7 +5718,8 @@ class NodeBase extends ExpressionEntity {
5718
5718
  }
5719
5719
  }
5720
5720
  /**
5721
- * Override if this node should receive a different scope than the parent scope.
5721
+ * Override if this node should receive a different scope than the parent
5722
+ * scope.
5722
5723
  */
5723
5724
  createScope(parentScope) {
5724
5725
  this.scope = parentScope;
@@ -5767,7 +5768,8 @@ class NodeBase extends ExpressionEntity {
5767
5768
  this.include(context, includeChildrenRecursively);
5768
5769
  }
5769
5770
  /**
5770
- * Override to perform special initialisation steps after the scope is initialised
5771
+ * Override to perform special initialisation steps after the scope is
5772
+ * initialised
5771
5773
  */
5772
5774
  initialise() { }
5773
5775
  insertSemicolon(code) {
@@ -5849,6 +5851,23 @@ class NodeBase extends ExpressionEntity {
5849
5851
  this.context.requestTreeshakingPass();
5850
5852
  }
5851
5853
  }
5854
+ function logNode(node) {
5855
+ return node.context.code.slice(node.start, node.end);
5856
+ }
5857
+ function logEffect(node, module) {
5858
+ if (!module.hasLoggedEffect) {
5859
+ module.hasLoggedEffect = true;
5860
+ let effect = logNode(node);
5861
+ let truncated = false;
5862
+ if (effect.length > 150) {
5863
+ truncated = true;
5864
+ effect = effect.slice(0, 150) + '...';
5865
+ }
5866
+ console.log(`==> First side effect in ${relativeId(module.id)}${truncated ? ' (truncated)' : ''}:`);
5867
+ console.log(effect);
5868
+ console.log('<==\n');
5869
+ }
5870
+ }
5852
5871
 
5853
5872
  class SpreadElement extends NodeBase {
5854
5873
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -8324,8 +8343,10 @@ class BlockStatement extends NodeBase {
8324
8343
  for (const node of this.body) {
8325
8344
  if (context.brokenFlow)
8326
8345
  break;
8327
- if (node.hasEffects(context))
8346
+ if (node.hasEffects(context)) {
8347
+ logEffect(node, this.context.module);
8328
8348
  return true;
8349
+ }
8329
8350
  }
8330
8351
  return false;
8331
8352
  }
@@ -11447,6 +11468,7 @@ class Program extends NodeBase {
11447
11468
  hasEffects(context) {
11448
11469
  for (const node of this.body) {
11449
11470
  if (node.hasEffects(context)) {
11471
+ logEffect(node, this.context.module);
11450
11472
  return (this.hasCachedEffect = true);
11451
11473
  }
11452
11474
  }
@@ -13012,6 +13034,7 @@ class Module {
13012
13034
  this.dynamicImporters = [];
13013
13035
  this.dynamicImports = [];
13014
13036
  this.execIndex = Infinity;
13037
+ this.hasLoggedEffect = false;
13015
13038
  this.implicitlyLoadedAfter = new Set();
13016
13039
  this.implicitlyLoadedBefore = new Set();
13017
13040
  this.importDescriptions = new Map();
@@ -16554,6 +16577,8 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
16554
16577
  return sizeA - sizeB;
16555
16578
  }
16556
16579
  function mergeChunks(chunkPartition, minChunkSize) {
16580
+ console.log('---- Initial chunks');
16581
+ printConsistencyCheck(chunkPartition);
16557
16582
  for (const allowArbitraryMerges of [false, true]) {
16558
16583
  for (const mergedChunk of chunkPartition.small) {
16559
16584
  let closestChunk = null;
@@ -16605,6 +16630,8 @@ function mergeChunks(chunkPartition, minChunkSize) {
16605
16630
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16606
16631
  }
16607
16632
  }
16633
+ console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
16634
+ printConsistencyCheck(chunkPartition);
16608
16635
  }
16609
16636
  }
16610
16637
  // Merging will not produce cycles if none of the direct non-merged dependencies
@@ -16660,6 +16687,57 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
16660
16687
  }
16661
16688
  return distance;
16662
16689
  }
16690
+ function printConsistencyCheck(partition) {
16691
+ const chunks = new Set([...partition.big, ...partition.small]);
16692
+ console.log('Number of cycles:', getNumberOfCycles(chunks));
16693
+ let missingDependencies = 0;
16694
+ let missingDependentChunks = 0;
16695
+ const seenModules = new Set();
16696
+ for (const { modules, dependencies, dependentChunks } of chunks) {
16697
+ for (const module of modules) {
16698
+ if (seenModules.has(module)) {
16699
+ console.log(`Module ${module.id} is duplicated between chunks.`);
16700
+ }
16701
+ seenModules.add(module);
16702
+ }
16703
+ for (const dependency of dependencies) {
16704
+ if (!chunks.has(dependency)) {
16705
+ missingDependencies++;
16706
+ }
16707
+ }
16708
+ for (const dependency of dependentChunks) {
16709
+ if (!chunks.has(dependency)) {
16710
+ missingDependentChunks++;
16711
+ }
16712
+ }
16713
+ }
16714
+ console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
16715
+ }
16716
+ function getNumberOfCycles(chunks) {
16717
+ const parents = new Set();
16718
+ const analysedChunks = new Set();
16719
+ let cycles = 0;
16720
+ const analyseChunk = (chunk) => {
16721
+ for (const dependency of chunk.dependencies) {
16722
+ if (parents.has(dependency)) {
16723
+ if (!analysedChunks.has(dependency)) {
16724
+ cycles++;
16725
+ }
16726
+ continue;
16727
+ }
16728
+ parents.add(dependency);
16729
+ analyseChunk(dependency);
16730
+ }
16731
+ analysedChunks.add(chunk);
16732
+ };
16733
+ for (const chunk of chunks) {
16734
+ if (!parents.has(chunk)) {
16735
+ parents.add(chunk);
16736
+ analyseChunk(chunk);
16737
+ }
16738
+ }
16739
+ return cycles;
16740
+ }
16663
16741
 
16664
16742
  // ported from https://github.com/substack/node-commondir
16665
16743
  function commondir(files) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
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.17.2";
34
+ var version$1 = "3.17.3-0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -6198,8 +6198,8 @@ class NodeBase extends ExpressionEntity {
6198
6198
  }
6199
6199
  addExportedVariables(_variables, _exportNamesByVariable) { }
6200
6200
  /**
6201
- * Override this to bind assignments to variables and do any initialisations that
6202
- * require the scopes to be populated with variables.
6201
+ * Override this to bind assignments to variables and do any initialisations
6202
+ * that require the scopes to be populated with variables.
6203
6203
  */
6204
6204
  bind() {
6205
6205
  for (const key of this.keys) {
@@ -6215,7 +6215,8 @@ class NodeBase extends ExpressionEntity {
6215
6215
  }
6216
6216
  }
6217
6217
  /**
6218
- * Override if this node should receive a different scope than the parent scope.
6218
+ * Override if this node should receive a different scope than the parent
6219
+ * scope.
6219
6220
  */
6220
6221
  createScope(parentScope) {
6221
6222
  this.scope = parentScope;
@@ -6264,7 +6265,8 @@ class NodeBase extends ExpressionEntity {
6264
6265
  this.include(context, includeChildrenRecursively);
6265
6266
  }
6266
6267
  /**
6267
- * Override to perform special initialisation steps after the scope is initialised
6268
+ * Override to perform special initialisation steps after the scope is
6269
+ * initialised
6268
6270
  */
6269
6271
  initialise() { }
6270
6272
  insertSemicolon(code) {
@@ -6346,6 +6348,23 @@ class NodeBase extends ExpressionEntity {
6346
6348
  this.context.requestTreeshakingPass();
6347
6349
  }
6348
6350
  }
6351
+ function logNode(node) {
6352
+ return node.context.code.slice(node.start, node.end);
6353
+ }
6354
+ function logEffect(node, module) {
6355
+ if (!module.hasLoggedEffect) {
6356
+ module.hasLoggedEffect = true;
6357
+ let effect = logNode(node);
6358
+ let truncated = false;
6359
+ if (effect.length > 150) {
6360
+ truncated = true;
6361
+ effect = effect.slice(0, 150) + '...';
6362
+ }
6363
+ console.log(`==> First side effect in ${relativeId(module.id)}${truncated ? ' (truncated)' : ''}:`);
6364
+ console.log(effect);
6365
+ console.log('<==\n');
6366
+ }
6367
+ }
6349
6368
 
6350
6369
  class SpreadElement extends NodeBase {
6351
6370
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -8821,8 +8840,10 @@ class BlockStatement extends NodeBase {
8821
8840
  for (const node of this.body) {
8822
8841
  if (context.brokenFlow)
8823
8842
  break;
8824
- if (node.hasEffects(context))
8843
+ if (node.hasEffects(context)) {
8844
+ logEffect(node, this.context.module);
8825
8845
  return true;
8846
+ }
8826
8847
  }
8827
8848
  return false;
8828
8849
  }
@@ -11944,6 +11965,7 @@ class Program extends NodeBase {
11944
11965
  hasEffects(context) {
11945
11966
  for (const node of this.body) {
11946
11967
  if (node.hasEffects(context)) {
11968
+ logEffect(node, this.context.module);
11947
11969
  return (this.hasCachedEffect = true);
11948
11970
  }
11949
11971
  }
@@ -13509,6 +13531,7 @@ class Module {
13509
13531
  this.dynamicImporters = [];
13510
13532
  this.dynamicImports = [];
13511
13533
  this.execIndex = Infinity;
13534
+ this.hasLoggedEffect = false;
13512
13535
  this.implicitlyLoadedAfter = new Set();
13513
13536
  this.implicitlyLoadedBefore = new Set();
13514
13537
  this.importDescriptions = new Map();
@@ -17051,6 +17074,8 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
17051
17074
  return sizeA - sizeB;
17052
17075
  }
17053
17076
  function mergeChunks(chunkPartition, minChunkSize) {
17077
+ console.log('---- Initial chunks');
17078
+ printConsistencyCheck(chunkPartition);
17054
17079
  for (const allowArbitraryMerges of [false, true]) {
17055
17080
  for (const mergedChunk of chunkPartition.small) {
17056
17081
  let closestChunk = null;
@@ -17102,6 +17127,8 @@ function mergeChunks(chunkPartition, minChunkSize) {
17102
17127
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
17103
17128
  }
17104
17129
  }
17130
+ console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
17131
+ printConsistencyCheck(chunkPartition);
17105
17132
  }
17106
17133
  }
17107
17134
  // Merging will not produce cycles if none of the direct non-merged dependencies
@@ -17157,6 +17184,57 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
17157
17184
  }
17158
17185
  return distance;
17159
17186
  }
17187
+ function printConsistencyCheck(partition) {
17188
+ const chunks = new Set([...partition.big, ...partition.small]);
17189
+ console.log('Number of cycles:', getNumberOfCycles(chunks));
17190
+ let missingDependencies = 0;
17191
+ let missingDependentChunks = 0;
17192
+ const seenModules = new Set();
17193
+ for (const { modules, dependencies, dependentChunks } of chunks) {
17194
+ for (const module of modules) {
17195
+ if (seenModules.has(module)) {
17196
+ console.log(`Module ${module.id} is duplicated between chunks.`);
17197
+ }
17198
+ seenModules.add(module);
17199
+ }
17200
+ for (const dependency of dependencies) {
17201
+ if (!chunks.has(dependency)) {
17202
+ missingDependencies++;
17203
+ }
17204
+ }
17205
+ for (const dependency of dependentChunks) {
17206
+ if (!chunks.has(dependency)) {
17207
+ missingDependentChunks++;
17208
+ }
17209
+ }
17210
+ }
17211
+ console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
17212
+ }
17213
+ function getNumberOfCycles(chunks) {
17214
+ const parents = new Set();
17215
+ const analysedChunks = new Set();
17216
+ let cycles = 0;
17217
+ const analyseChunk = (chunk) => {
17218
+ for (const dependency of chunk.dependencies) {
17219
+ if (parents.has(dependency)) {
17220
+ if (!analysedChunks.has(dependency)) {
17221
+ cycles++;
17222
+ }
17223
+ continue;
17224
+ }
17225
+ parents.add(dependency);
17226
+ analyseChunk(dependency);
17227
+ }
17228
+ analysedChunks.add(chunk);
17229
+ };
17230
+ for (const chunk of chunks) {
17231
+ if (!parents.has(chunk)) {
17232
+ parents.add(chunk);
17233
+ analyseChunk(chunk);
17234
+ }
17235
+ }
17236
+ return cycles;
17237
+ }
17160
17238
 
17161
17239
  // ported from https://github.com/substack/node-commondir
17162
17240
  function commondir(files) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.17.2
4
- Mon, 20 Feb 2023 05:45:09 GMT - commit 47061d8516922087cec1e50e40878313e220183e
3
+ Rollup.js v3.17.3-0
4
+ Wed, 22 Feb 2023 06:04:55 GMT - commit b4fddb7fd14781e68b8271c09b41f248afb8e4c1
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.17.2",
3
+ "version": "3.17.3-0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",