rollup 3.3.0-0 → 3.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.3.0-0
6
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
5
+ Rollup.js v3.3.0
6
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
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.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
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.3.0-0";
19
+ var version$1 = "3.3.0";
20
20
 
21
21
  var charToInteger = {};
22
22
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -12618,13 +12618,21 @@ function getPluginWithTimers(plugin, index) {
12618
12618
  timerLabel += ` (${plugin.name})`;
12619
12619
  }
12620
12620
  timerLabel += ` - ${hook}`;
12621
- const hookFunction = plugin[hook];
12622
- plugin[hook] = function (...parameters) {
12621
+ const handler = function (...parameters) {
12623
12622
  timeStart(timerLabel, 4);
12624
12623
  const result = hookFunction.apply(this, parameters);
12625
12624
  timeEnd(timerLabel, 4);
12626
12625
  return result;
12627
12626
  };
12627
+ let hookFunction;
12628
+ if (typeof plugin[hook].handler === 'function') {
12629
+ hookFunction = plugin[hook].handler;
12630
+ plugin[hook].handler = handler;
12631
+ }
12632
+ else {
12633
+ hookFunction = plugin[hook];
12634
+ plugin[hook] = handler;
12635
+ }
12628
12636
  }
12629
12637
  }
12630
12638
  return plugin;
@@ -22846,17 +22854,17 @@ class GlobalScope extends Scope$1 {
22846
22854
  }
22847
22855
  }
22848
22856
 
22849
- function generateAssetFileName(name, source, outputOptions, bundle) {
22857
+ function getSourceHash(source) {
22858
+ return createHash().update(source).digest('hex');
22859
+ }
22860
+ function generateAssetFileName(name, source, sourceHash, outputOptions, bundle) {
22850
22861
  const emittedName = outputOptions.sanitizeFileName(name || 'asset');
22851
22862
  return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
22852
22863
  ? outputOptions.assetFileNames({ name, source, type: 'asset' })
22853
22864
  : outputOptions.assetFileNames, 'output.assetFileNames', {
22854
22865
  ext: () => extname(emittedName).slice(1),
22855
22866
  extname: () => extname(emittedName),
22856
- hash: size => createHash()
22857
- .update(source)
22858
- .digest('hex')
22859
- .slice(0, Math.max(0, size || defaultHashSize)),
22867
+ hash: size => sourceHash.slice(0, Math.max(0, size || defaultHashSize)),
22860
22868
  name: () => emittedName.slice(0, Math.max(0, emittedName.length - extname(emittedName).length))
22861
22869
  }), bundle);
22862
22870
  }
@@ -22961,9 +22969,6 @@ class FileEmitter {
22961
22969
  for (const emittedFile of this.filesByReferenceId.values()) {
22962
22970
  if (emittedFile.fileName) {
22963
22971
  reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
22964
- if (emittedFile.type === 'asset' && typeof emittedFile.source === 'string') {
22965
- fileNamesBySource.set(emittedFile.source, emittedFile.fileName);
22966
- }
22967
22972
  }
22968
22973
  }
22969
22974
  for (const [referenceId, consumedFile] of this.filesByReferenceId) {
@@ -23031,15 +23036,19 @@ class FileEmitter {
23031
23036
  return this.assignReferenceId(consumedChunk, emittedChunk.id);
23032
23037
  }
23033
23038
  finalizeAsset(consumedFile, source, referenceId, { bundle, fileNamesBySource, outputOptions }) {
23034
- const fileName = consumedFile.fileName ||
23035
- (typeof source === 'string' && fileNamesBySource.get(source)) ||
23036
- generateAssetFileName(consumedFile.name, source, outputOptions, bundle);
23039
+ let fileName = consumedFile.fileName;
23040
+ // Deduplicate assets if an explicit fileName is not provided
23041
+ if (!fileName) {
23042
+ const sourceHash = getSourceHash(source);
23043
+ fileName = fileNamesBySource.get(sourceHash);
23044
+ if (!fileName) {
23045
+ fileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
23046
+ fileNamesBySource.set(sourceHash, fileName);
23047
+ }
23048
+ }
23037
23049
  // We must not modify the original assets to avoid interaction between outputs
23038
23050
  const assetWithFileName = { ...consumedFile, fileName, source };
23039
23051
  this.filesByReferenceId.set(referenceId, assetWithFileName);
23040
- if (typeof source === 'string') {
23041
- fileNamesBySource.set(source, fileName);
23042
- }
23043
23052
  bundle[fileName] = {
23044
23053
  fileName,
23045
23054
  name: consumedFile.name,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
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.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
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.3.0-0";
34
+ var version$1 = "3.3.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -13130,13 +13130,21 @@ function getPluginWithTimers(plugin, index) {
13130
13130
  timerLabel += ` (${plugin.name})`;
13131
13131
  }
13132
13132
  timerLabel += ` - ${hook}`;
13133
- const hookFunction = plugin[hook];
13134
- plugin[hook] = function (...parameters) {
13133
+ const handler = function (...parameters) {
13135
13134
  timeStart(timerLabel, 4);
13136
13135
  const result = hookFunction.apply(this, parameters);
13137
13136
  timeEnd(timerLabel, 4);
13138
13137
  return result;
13139
13138
  };
13139
+ let hookFunction;
13140
+ if (typeof plugin[hook].handler === 'function') {
13141
+ hookFunction = plugin[hook].handler;
13142
+ plugin[hook].handler = handler;
13143
+ }
13144
+ else {
13145
+ hookFunction = plugin[hook];
13146
+ plugin[hook] = handler;
13147
+ }
13140
13148
  }
13141
13149
  }
13142
13150
  return plugin;
@@ -23358,17 +23366,17 @@ class GlobalScope extends Scope$1 {
23358
23366
  }
23359
23367
  }
23360
23368
 
23361
- function generateAssetFileName(name, source, outputOptions, bundle) {
23369
+ function getSourceHash(source) {
23370
+ return createHash().update(source).digest('hex');
23371
+ }
23372
+ function generateAssetFileName(name, source, sourceHash, outputOptions, bundle) {
23362
23373
  const emittedName = outputOptions.sanitizeFileName(name || 'asset');
23363
23374
  return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
23364
23375
  ? outputOptions.assetFileNames({ name, source, type: 'asset' })
23365
23376
  : outputOptions.assetFileNames, 'output.assetFileNames', {
23366
23377
  ext: () => node_path.extname(emittedName).slice(1),
23367
23378
  extname: () => node_path.extname(emittedName),
23368
- hash: size => createHash()
23369
- .update(source)
23370
- .digest('hex')
23371
- .slice(0, Math.max(0, size || defaultHashSize)),
23379
+ hash: size => sourceHash.slice(0, Math.max(0, size || defaultHashSize)),
23372
23380
  name: () => emittedName.slice(0, Math.max(0, emittedName.length - node_path.extname(emittedName).length))
23373
23381
  }), bundle);
23374
23382
  }
@@ -23473,9 +23481,6 @@ class FileEmitter {
23473
23481
  for (const emittedFile of this.filesByReferenceId.values()) {
23474
23482
  if (emittedFile.fileName) {
23475
23483
  reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn);
23476
- if (emittedFile.type === 'asset' && typeof emittedFile.source === 'string') {
23477
- fileNamesBySource.set(emittedFile.source, emittedFile.fileName);
23478
- }
23479
23484
  }
23480
23485
  }
23481
23486
  for (const [referenceId, consumedFile] of this.filesByReferenceId) {
@@ -23543,15 +23548,19 @@ class FileEmitter {
23543
23548
  return this.assignReferenceId(consumedChunk, emittedChunk.id);
23544
23549
  }
23545
23550
  finalizeAsset(consumedFile, source, referenceId, { bundle, fileNamesBySource, outputOptions }) {
23546
- const fileName = consumedFile.fileName ||
23547
- (typeof source === 'string' && fileNamesBySource.get(source)) ||
23548
- generateAssetFileName(consumedFile.name, source, outputOptions, bundle);
23551
+ let fileName = consumedFile.fileName;
23552
+ // Deduplicate assets if an explicit fileName is not provided
23553
+ if (!fileName) {
23554
+ const sourceHash = getSourceHash(source);
23555
+ fileName = fileNamesBySource.get(sourceHash);
23556
+ if (!fileName) {
23557
+ fileName = generateAssetFileName(consumedFile.name, source, sourceHash, outputOptions, bundle);
23558
+ fileNamesBySource.set(sourceHash, fileName);
23559
+ }
23560
+ }
23549
23561
  // We must not modify the original assets to avoid interaction between outputs
23550
23562
  const assetWithFileName = { ...consumedFile, fileName, source };
23551
23563
  this.filesByReferenceId.set(referenceId, assetWithFileName);
23552
- if (typeof source === 'string') {
23553
- fileNamesBySource.set(source, fileName);
23554
- }
23555
23564
  bundle[fileName] = {
23556
23565
  fileName,
23557
23566
  name: consumedFile.name,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v3.3.0-0
4
- Tue, 08 Nov 2022 05:35:30 GMT - commit f696b4c205bee65f18b34761ec9d0be88be90ca1
3
+ Rollup.js v3.3.0
4
+ Sat, 12 Nov 2022 05:21:34 GMT - commit ff286e5a14e32b6e820b188ccd63ac27bdd8adc9
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.3.0-0",
3
+ "version": "3.3.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",