rollup 3.17.2 → 3.17.3-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/rollup 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-1
6
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1";
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,9 @@ 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
+ }
5852
5857
 
5853
5858
  class SpreadElement extends NodeBase {
5854
5859
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -11438,6 +11443,7 @@ class Program extends NodeBase {
11438
11443
  constructor() {
11439
11444
  super(...arguments);
11440
11445
  this.hasCachedEffect = null;
11446
+ this.hasLoggedEffect = false;
11441
11447
  }
11442
11448
  hasCachedEffects() {
11443
11449
  return this.hasCachedEffect === null
@@ -11447,6 +11453,18 @@ class Program extends NodeBase {
11447
11453
  hasEffects(context) {
11448
11454
  for (const node of this.body) {
11449
11455
  if (node.hasEffects(context)) {
11456
+ if (!this.hasLoggedEffect) {
11457
+ this.hasLoggedEffect = true;
11458
+ let effect = logNode(node);
11459
+ let truncated = false;
11460
+ if (effect.length > 150) {
11461
+ truncated = true;
11462
+ effect = effect.slice(0, 150) + '...';
11463
+ }
11464
+ console.log(`==> First side effect in ${relativeId(this.context.module.id)}${truncated ? ' (truncated)' : ''}:`);
11465
+ console.log(effect);
11466
+ console.log('<==\n');
11467
+ }
11450
11468
  return (this.hasCachedEffect = true);
11451
11469
  }
11452
11470
  }
@@ -16554,6 +16572,8 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
16554
16572
  return sizeA - sizeB;
16555
16573
  }
16556
16574
  function mergeChunks(chunkPartition, minChunkSize) {
16575
+ console.log('---- Initial chunks');
16576
+ printConsistencyCheck(chunkPartition);
16557
16577
  for (const allowArbitraryMerges of [false, true]) {
16558
16578
  for (const mergedChunk of chunkPartition.small) {
16559
16579
  let closestChunk = null;
@@ -16605,6 +16625,8 @@ function mergeChunks(chunkPartition, minChunkSize) {
16605
16625
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
16606
16626
  }
16607
16627
  }
16628
+ console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
16629
+ printConsistencyCheck(chunkPartition);
16608
16630
  }
16609
16631
  }
16610
16632
  // Merging will not produce cycles if none of the direct non-merged dependencies
@@ -16660,6 +16682,57 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
16660
16682
  }
16661
16683
  return distance;
16662
16684
  }
16685
+ function printConsistencyCheck(partition) {
16686
+ const chunks = new Set([...partition.big, ...partition.small]);
16687
+ console.log('Number of cycles:', getNumberOfCycles(chunks));
16688
+ let missingDependencies = 0;
16689
+ let missingDependentChunks = 0;
16690
+ const seenModules = new Set();
16691
+ for (const { modules, dependencies, dependentChunks } of chunks) {
16692
+ for (const module of modules) {
16693
+ if (seenModules.has(module)) {
16694
+ console.log(`Module ${module.id} is duplicated between chunks.`);
16695
+ }
16696
+ seenModules.add(module);
16697
+ }
16698
+ for (const dependency of dependencies) {
16699
+ if (!chunks.has(dependency)) {
16700
+ missingDependencies++;
16701
+ }
16702
+ }
16703
+ for (const dependency of dependentChunks) {
16704
+ if (!chunks.has(dependency)) {
16705
+ missingDependentChunks++;
16706
+ }
16707
+ }
16708
+ }
16709
+ console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
16710
+ }
16711
+ function getNumberOfCycles(chunks) {
16712
+ const parents = new Set();
16713
+ const analysedChunks = new Set();
16714
+ let cycles = 0;
16715
+ const analyseChunk = (chunk) => {
16716
+ for (const dependency of chunk.dependencies) {
16717
+ if (parents.has(dependency)) {
16718
+ if (!analysedChunks.has(dependency)) {
16719
+ cycles++;
16720
+ }
16721
+ continue;
16722
+ }
16723
+ parents.add(dependency);
16724
+ analyseChunk(dependency);
16725
+ }
16726
+ analysedChunks.add(chunk);
16727
+ };
16728
+ for (const chunk of chunks) {
16729
+ if (!parents.has(chunk)) {
16730
+ parents.add(chunk);
16731
+ analyseChunk(chunk);
16732
+ }
16733
+ }
16734
+ return cycles;
16735
+ }
16663
16736
 
16664
16737
  // ported from https://github.com/substack/node-commondir
16665
16738
  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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1";
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,9 @@ 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
+ }
6349
6354
 
6350
6355
  class SpreadElement extends NodeBase {
6351
6356
  deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker) {
@@ -11935,6 +11940,7 @@ class Program extends NodeBase {
11935
11940
  constructor() {
11936
11941
  super(...arguments);
11937
11942
  this.hasCachedEffect = null;
11943
+ this.hasLoggedEffect = false;
11938
11944
  }
11939
11945
  hasCachedEffects() {
11940
11946
  return this.hasCachedEffect === null
@@ -11944,6 +11950,18 @@ class Program extends NodeBase {
11944
11950
  hasEffects(context) {
11945
11951
  for (const node of this.body) {
11946
11952
  if (node.hasEffects(context)) {
11953
+ if (!this.hasLoggedEffect) {
11954
+ this.hasLoggedEffect = true;
11955
+ let effect = logNode(node);
11956
+ let truncated = false;
11957
+ if (effect.length > 150) {
11958
+ truncated = true;
11959
+ effect = effect.slice(0, 150) + '...';
11960
+ }
11961
+ console.log(`==> First side effect in ${relativeId(this.context.module.id)}${truncated ? ' (truncated)' : ''}:`);
11962
+ console.log(effect);
11963
+ console.log('<==\n');
11964
+ }
11947
11965
  return (this.hasCachedEffect = true);
11948
11966
  }
11949
11967
  }
@@ -17051,6 +17069,8 @@ function compareChunkSize({ size: sizeA }, { size: sizeB }) {
17051
17069
  return sizeA - sizeB;
17052
17070
  }
17053
17071
  function mergeChunks(chunkPartition, minChunkSize) {
17072
+ console.log('---- Initial chunks');
17073
+ printConsistencyCheck(chunkPartition);
17054
17074
  for (const allowArbitraryMerges of [false, true]) {
17055
17075
  for (const mergedChunk of chunkPartition.small) {
17056
17076
  let closestChunk = null;
@@ -17102,6 +17122,8 @@ function mergeChunks(chunkPartition, minChunkSize) {
17102
17122
  getChunksInPartition(closestChunk, minChunkSize, chunkPartition).add(closestChunk);
17103
17123
  }
17104
17124
  }
17125
+ console.log('---- After run with arbitrary merges:', allowArbitraryMerges);
17126
+ printConsistencyCheck(chunkPartition);
17105
17127
  }
17106
17128
  }
17107
17129
  // Merging will not produce cycles if none of the direct non-merged dependencies
@@ -17157,6 +17179,57 @@ function getChunkEntryDistance({ dependentEntries: sourceEntries }, { dependentE
17157
17179
  }
17158
17180
  return distance;
17159
17181
  }
17182
+ function printConsistencyCheck(partition) {
17183
+ const chunks = new Set([...partition.big, ...partition.small]);
17184
+ console.log('Number of cycles:', getNumberOfCycles(chunks));
17185
+ let missingDependencies = 0;
17186
+ let missingDependentChunks = 0;
17187
+ const seenModules = new Set();
17188
+ for (const { modules, dependencies, dependentChunks } of chunks) {
17189
+ for (const module of modules) {
17190
+ if (seenModules.has(module)) {
17191
+ console.log(`Module ${module.id} is duplicated between chunks.`);
17192
+ }
17193
+ seenModules.add(module);
17194
+ }
17195
+ for (const dependency of dependencies) {
17196
+ if (!chunks.has(dependency)) {
17197
+ missingDependencies++;
17198
+ }
17199
+ }
17200
+ for (const dependency of dependentChunks) {
17201
+ if (!chunks.has(dependency)) {
17202
+ missingDependentChunks++;
17203
+ }
17204
+ }
17205
+ }
17206
+ console.log(`Missing\n dependencies: ${missingDependencies},\n missing dependent chunks: ${missingDependentChunks}\n`);
17207
+ }
17208
+ function getNumberOfCycles(chunks) {
17209
+ const parents = new Set();
17210
+ const analysedChunks = new Set();
17211
+ let cycles = 0;
17212
+ const analyseChunk = (chunk) => {
17213
+ for (const dependency of chunk.dependencies) {
17214
+ if (parents.has(dependency)) {
17215
+ if (!analysedChunks.has(dependency)) {
17216
+ cycles++;
17217
+ }
17218
+ continue;
17219
+ }
17220
+ parents.add(dependency);
17221
+ analyseChunk(dependency);
17222
+ }
17223
+ analysedChunks.add(chunk);
17224
+ };
17225
+ for (const chunk of chunks) {
17226
+ if (!parents.has(chunk)) {
17227
+ parents.add(chunk);
17228
+ analyseChunk(chunk);
17229
+ }
17230
+ }
17231
+ return cycles;
17232
+ }
17160
17233
 
17161
17234
  // ported from https://github.com/substack/node-commondir
17162
17235
  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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1
4
+ Thu, 23 Feb 2023 18:26:12 GMT - commit a44e087fa8b10fcbee144d5d296611c72c4f489c
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-1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",