rollup 3.19.0 → 3.20.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.19.0
6
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
5
+ Rollup.js v3.20.0
6
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
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.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
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.19.0";
19
+ var version$1 = "3.20.0";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -11847,7 +11847,8 @@ class StaticBlock extends NodeBase {
11847
11847
  }
11848
11848
  render(code, options) {
11849
11849
  if (this.body.length > 0) {
11850
- renderStatementList(this.body, code, this.start + 1, this.end - 1, options);
11850
+ const bodyStartPos = findFirstOccurrenceOutsideComment(code.original.slice(this.start, this.end), '{') + 1;
11851
+ renderStatementList(this.body, code, this.start + bodyStartPos, this.end - 1, options);
11851
11852
  }
11852
11853
  else {
11853
11854
  super.render(code, options);
@@ -15277,7 +15278,7 @@ class Chunk {
15277
15278
  const chunkModules = new Set(orderedModules);
15278
15279
  for (const module of orderedModules) {
15279
15280
  chunkByModule.set(module, this);
15280
- if (module.namespace.included) {
15281
+ if (module.namespace.included && !outputOptions.preserveModules) {
15281
15282
  includedNamespaces.add(module);
15282
15283
  }
15283
15284
  if (this.isEmpty && module.isIncluded()) {
@@ -15290,7 +15291,7 @@ class Chunk {
15290
15291
  if (!chunkModules.has(importer)) {
15291
15292
  this.dynamicEntryModules.push(module);
15292
15293
  // Modules with synthetic exports need an artificial namespace for dynamic imports
15293
- if (module.info.syntheticNamedExports && !outputOptions.preserveModules) {
15294
+ if (module.info.syntheticNamedExports) {
15294
15295
  includedNamespaces.add(module);
15295
15296
  this.exports.add(module.namespace);
15296
15297
  }
@@ -15406,12 +15407,11 @@ class Chunk {
15406
15407
  requiredFacades.push({});
15407
15408
  }
15408
15409
  if (!this.facadeModule) {
15409
- const needsStrictFacade = module.preserveSignature === 'strict' ||
15410
- (module.preserveSignature === 'exports-only' &&
15411
- module.getExportNamesByVariable().size > 0);
15412
- if (!needsStrictFacade ||
15413
- this.outputOptions.preserveModules ||
15414
- this.canModuleBeFacade(module, exposedVariables)) {
15410
+ const needsStrictFacade = !this.outputOptions.preserveModules &&
15411
+ (module.preserveSignature === 'strict' ||
15412
+ (module.preserveSignature === 'exports-only' &&
15413
+ module.getExportNamesByVariable().size > 0));
15414
+ if (!needsStrictFacade || this.canModuleBeFacade(module, exposedVariables)) {
15415
15415
  this.facadeModule = module;
15416
15416
  this.facadeChunkByModule.set(module, this);
15417
15417
  if (module.preserveSignature) {
@@ -15999,7 +15999,7 @@ class Chunk {
15999
15999
  // This method changes properties on the AST before rendering and must not be async
16000
16000
  renderModules(fileName) {
16001
16001
  const { accessedGlobalsByScope, dependencies, exportNamesByVariable, includedNamespaces, inputOptions: { onwarn }, isEmpty, orderedModules, outputOptions, pluginDriver, renderedModules, snippets } = this;
16002
- const { compact, dynamicImportFunction, format, freeze, namespaceToStringTag, preserveModules } = outputOptions;
16002
+ const { compact, dynamicImportFunction, format, freeze, namespaceToStringTag } = outputOptions;
16003
16003
  const { _, cnst, n } = snippets;
16004
16004
  this.setDynamicImportResolutions(fileName);
16005
16005
  this.setImportMetaResolutions(fileName);
@@ -16038,7 +16038,7 @@ class Chunk {
16038
16038
  usedModules.push(module);
16039
16039
  }
16040
16040
  const namespace = module.namespace;
16041
- if (includedNamespaces.has(module) && !preserveModules) {
16041
+ if (includedNamespaces.has(module)) {
16042
16042
  const rendered = namespace.renderBlock(renderOptions);
16043
16043
  if (namespace.renderFirst())
16044
16044
  hoistedSource += n + rendered;
@@ -16147,12 +16147,12 @@ class Chunk {
16147
16147
  deconflictChunk(this.orderedModules, this.getDependenciesToBeDeconflicted(format !== 'es' && format !== 'system', format === 'amd' || format === 'umd' || format === 'iife', interop), this.imports, usedNames, format, interop, preserveModules, externalLiveBindings, this.chunkByModule, this.externalChunkByModule, syntheticExports, this.exportNamesByVariable, this.accessedGlobalsByScope, this.includedNamespaces);
16148
16148
  }
16149
16149
  setImportMetaResolutions(fileName) {
16150
- const { accessedGlobalsByScope, includedNamespaces, orderedModules, outputOptions: { format, preserveModules } } = this;
16150
+ const { accessedGlobalsByScope, includedNamespaces, orderedModules, outputOptions: { format } } = this;
16151
16151
  for (const module of orderedModules) {
16152
16152
  for (const importMeta of module.importMetas) {
16153
16153
  importMeta.setResolution(format, accessedGlobalsByScope, fileName);
16154
16154
  }
16155
- if (includedNamespaces.has(module) && !preserveModules) {
16155
+ if (includedNamespaces.has(module)) {
16156
16156
  module.namespace.prepare(accessedGlobalsByScope);
16157
16157
  }
16158
16158
  }
@@ -24089,8 +24089,15 @@ class FileEmitter {
24089
24089
  if (!fileName) {
24090
24090
  const sourceHash = getSourceHash(source);
24091
24091
  fileName = fileNamesBySource.get(sourceHash);
24092
- if (!fileName) {
24093
- fileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
24092
+ const newFileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
24093
+ // make sure file name deterministic in parallel emits, always use the shorter and smaller file name
24094
+ if (!fileName ||
24095
+ fileName.length > newFileName.length ||
24096
+ (fileName.length === newFileName.length && fileName > newFileName)) {
24097
+ if (fileName) {
24098
+ delete bundle[fileName];
24099
+ }
24100
+ fileName = newFileName;
24094
24101
  fileNamesBySource.set(sourceHash, fileName);
24095
24102
  }
24096
24103
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
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.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
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.19.0";
34
+ var version$1 = "3.20.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -12345,7 +12345,8 @@ class StaticBlock extends NodeBase {
12345
12345
  }
12346
12346
  render(code, options) {
12347
12347
  if (this.body.length > 0) {
12348
- renderStatementList(this.body, code, this.start + 1, this.end - 1, options);
12348
+ const bodyStartPos = findFirstOccurrenceOutsideComment(code.original.slice(this.start, this.end), '{') + 1;
12349
+ renderStatementList(this.body, code, this.start + bodyStartPos, this.end - 1, options);
12349
12350
  }
12350
12351
  else {
12351
12352
  super.render(code, options);
@@ -15775,7 +15776,7 @@ class Chunk {
15775
15776
  const chunkModules = new Set(orderedModules);
15776
15777
  for (const module of orderedModules) {
15777
15778
  chunkByModule.set(module, this);
15778
- if (module.namespace.included) {
15779
+ if (module.namespace.included && !outputOptions.preserveModules) {
15779
15780
  includedNamespaces.add(module);
15780
15781
  }
15781
15782
  if (this.isEmpty && module.isIncluded()) {
@@ -15788,7 +15789,7 @@ class Chunk {
15788
15789
  if (!chunkModules.has(importer)) {
15789
15790
  this.dynamicEntryModules.push(module);
15790
15791
  // Modules with synthetic exports need an artificial namespace for dynamic imports
15791
- if (module.info.syntheticNamedExports && !outputOptions.preserveModules) {
15792
+ if (module.info.syntheticNamedExports) {
15792
15793
  includedNamespaces.add(module);
15793
15794
  this.exports.add(module.namespace);
15794
15795
  }
@@ -15904,12 +15905,11 @@ class Chunk {
15904
15905
  requiredFacades.push({});
15905
15906
  }
15906
15907
  if (!this.facadeModule) {
15907
- const needsStrictFacade = module.preserveSignature === 'strict' ||
15908
- (module.preserveSignature === 'exports-only' &&
15909
- module.getExportNamesByVariable().size > 0);
15910
- if (!needsStrictFacade ||
15911
- this.outputOptions.preserveModules ||
15912
- this.canModuleBeFacade(module, exposedVariables)) {
15908
+ const needsStrictFacade = !this.outputOptions.preserveModules &&
15909
+ (module.preserveSignature === 'strict' ||
15910
+ (module.preserveSignature === 'exports-only' &&
15911
+ module.getExportNamesByVariable().size > 0));
15912
+ if (!needsStrictFacade || this.canModuleBeFacade(module, exposedVariables)) {
15913
15913
  this.facadeModule = module;
15914
15914
  this.facadeChunkByModule.set(module, this);
15915
15915
  if (module.preserveSignature) {
@@ -16497,7 +16497,7 @@ class Chunk {
16497
16497
  // This method changes properties on the AST before rendering and must not be async
16498
16498
  renderModules(fileName) {
16499
16499
  const { accessedGlobalsByScope, dependencies, exportNamesByVariable, includedNamespaces, inputOptions: { onwarn }, isEmpty, orderedModules, outputOptions, pluginDriver, renderedModules, snippets } = this;
16500
- const { compact, dynamicImportFunction, format, freeze, namespaceToStringTag, preserveModules } = outputOptions;
16500
+ const { compact, dynamicImportFunction, format, freeze, namespaceToStringTag } = outputOptions;
16501
16501
  const { _, cnst, n } = snippets;
16502
16502
  this.setDynamicImportResolutions(fileName);
16503
16503
  this.setImportMetaResolutions(fileName);
@@ -16536,7 +16536,7 @@ class Chunk {
16536
16536
  usedModules.push(module);
16537
16537
  }
16538
16538
  const namespace = module.namespace;
16539
- if (includedNamespaces.has(module) && !preserveModules) {
16539
+ if (includedNamespaces.has(module)) {
16540
16540
  const rendered = namespace.renderBlock(renderOptions);
16541
16541
  if (namespace.renderFirst())
16542
16542
  hoistedSource += n + rendered;
@@ -16645,12 +16645,12 @@ class Chunk {
16645
16645
  deconflictChunk(this.orderedModules, this.getDependenciesToBeDeconflicted(format !== 'es' && format !== 'system', format === 'amd' || format === 'umd' || format === 'iife', interop), this.imports, usedNames, format, interop, preserveModules, externalLiveBindings, this.chunkByModule, this.externalChunkByModule, syntheticExports, this.exportNamesByVariable, this.accessedGlobalsByScope, this.includedNamespaces);
16646
16646
  }
16647
16647
  setImportMetaResolutions(fileName) {
16648
- const { accessedGlobalsByScope, includedNamespaces, orderedModules, outputOptions: { format, preserveModules } } = this;
16648
+ const { accessedGlobalsByScope, includedNamespaces, orderedModules, outputOptions: { format } } = this;
16649
16649
  for (const module of orderedModules) {
16650
16650
  for (const importMeta of module.importMetas) {
16651
16651
  importMeta.setResolution(format, accessedGlobalsByScope, fileName);
16652
16652
  }
16653
- if (includedNamespaces.has(module) && !preserveModules) {
16653
+ if (includedNamespaces.has(module)) {
16654
16654
  module.namespace.prepare(accessedGlobalsByScope);
16655
16655
  }
16656
16656
  }
@@ -24587,8 +24587,15 @@ class FileEmitter {
24587
24587
  if (!fileName) {
24588
24588
  const sourceHash = getSourceHash(source);
24589
24589
  fileName = fileNamesBySource.get(sourceHash);
24590
- if (!fileName) {
24591
- fileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
24590
+ const newFileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
24591
+ // make sure file name deterministic in parallel emits, always use the shorter and smaller file name
24592
+ if (!fileName ||
24593
+ fileName.length > newFileName.length ||
24594
+ (fileName.length === newFileName.length && fileName > newFileName)) {
24595
+ if (fileName) {
24596
+ delete bundle[fileName];
24597
+ }
24598
+ fileName = newFileName;
24592
24599
  fileNamesBySource.set(sourceHash, fileName);
24593
24600
  }
24594
24601
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.19.0
4
- Thu, 09 Mar 2023 19:00:13 GMT - commit cff3bbcb34cf35a765a8bcbbd56ba643bd1de68d
3
+ Rollup.js v3.20.0
4
+ Mon, 20 Mar 2023 06:08:57 GMT - commit eb9777c1a8a9923951037294b56ceccb1921a5c0
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.19.0",
3
+ "version": "3.20.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",