rollup 2.78.1 → 2.79.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/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.78.1
4
- Fri, 19 Aug 2022 05:19:43 GMT - commit 398d0c4970b679795025f36e320f8aecb2859d24
3
+ Rollup.js v2.79.0
4
+ Wed, 31 Aug 2022 04:52:13 GMT - commit 8477f8ff1fe80086556021542b22942ad27a0a69
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.78.1
4
- Fri, 19 Aug 2022 05:19:43 GMT - commit 398d0c4970b679795025f36e320f8aecb2859d24
3
+ Rollup.js v2.79.0
4
+ Wed, 31 Aug 2022 04:52:13 GMT - commit 8477f8ff1fe80086556021542b22942ad27a0a69
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -14,7 +14,7 @@ import { createHash as createHash$1 } from 'crypto';
14
14
  import { promises } from 'fs';
15
15
  import { EventEmitter } from 'events';
16
16
 
17
- var version$1 = "2.78.1";
17
+ var version$1 = "2.79.0";
18
18
 
19
19
  var charToInteger = {};
20
20
  var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -13315,11 +13315,18 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
13315
13315
  return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze, namespaceToStringTag)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
13316
13316
  }
13317
13317
 
13318
+ function addJsExtension(name) {
13319
+ return name.endsWith('.js') ? name : name + '.js';
13320
+ }
13321
+
13318
13322
  // AMD resolution will only respect the AMD baseUrl if the .js extension is omitted.
13319
13323
  // The assumption is that this makes sense for all relative ids:
13320
13324
  // https://requirejs.org/docs/api.html#jsfiles
13321
- function removeExtensionFromRelativeAmdId(id) {
13322
- return id[0] === '.' ? removeJsExtension(id) : id;
13325
+ function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
13326
+ if (id[0] !== '.') {
13327
+ return id;
13328
+ }
13329
+ return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
13323
13330
  }
13324
13331
 
13325
13332
  const builtins = {
@@ -13358,7 +13365,7 @@ function warnOnBuiltins(warn, dependencies) {
13358
13365
 
13359
13366
  function amd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets, warn }, { amd, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
13360
13367
  warnOnBuiltins(warn, dependencies);
13361
- const deps = dependencies.map(m => `'${removeExtensionFromRelativeAmdId(m.id)}'`);
13368
+ const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.id, amd.forceJsExtensionForImports)}'`);
13362
13369
  const args = dependencies.map(m => m.name);
13363
13370
  const { n, getNonArrowFunctionIntro, _ } = snippets;
13364
13371
  if (namedExportsMode && hasExports) {
@@ -13802,7 +13809,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
13802
13809
  });
13803
13810
  }
13804
13811
  warnOnBuiltins(warn, dependencies);
13805
- const amdDeps = dependencies.map(m => `'${removeExtensionFromRelativeAmdId(m.id)}'`);
13812
+ const amdDeps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.id, amd.forceJsExtensionForImports)}'`);
13806
13813
  const cjsDeps = dependencies.map(m => `require('${m.id}')`);
13807
13814
  const trimmedImports = trimEmptyImports(dependencies);
13808
13815
  const globalDeps = trimmedImports.map(module => globalProp(module.globalName, globalVar, getPropertyAccess));
@@ -15009,7 +15016,7 @@ class Chunk {
15009
15016
  }
15010
15017
  }
15011
15018
  finaliseDynamicImports(options, snippets) {
15012
- const stripKnownJsExtensions = options.format === 'amd';
15019
+ const stripKnownJsExtensions = options.format === 'amd' && !options.amd.forceJsExtensionForImports;
15013
15020
  for (const [module, code] of this.renderedModuleSources) {
15014
15021
  for (const { node, resolution } of module.dynamicImports) {
15015
15022
  const chunk = this.chunkByModule.get(resolution);
@@ -23523,6 +23530,7 @@ const getAmd = (config) => {
23523
23530
  autoId: false,
23524
23531
  basePath: '',
23525
23532
  define: 'define',
23533
+ forceJsExtensionForImports: false,
23526
23534
  ...config.amd
23527
23535
  };
23528
23536
  if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
@@ -23536,13 +23544,15 @@ const getAmd = (config) => {
23536
23544
  normalized = {
23537
23545
  autoId: true,
23538
23546
  basePath: mergedOption.basePath,
23539
- define: mergedOption.define
23547
+ define: mergedOption.define,
23548
+ forceJsExtensionForImports: mergedOption.forceJsExtensionForImports
23540
23549
  };
23541
23550
  }
23542
23551
  else {
23543
23552
  normalized = {
23544
23553
  autoId: false,
23545
23554
  define: mergedOption.define,
23555
+ forceJsExtensionForImports: mergedOption.forceJsExtensionForImports,
23546
23556
  id: mergedOption.id
23547
23557
  };
23548
23558
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.78.1
4
- Fri, 19 Aug 2022 05:19:43 GMT - commit 398d0c4970b679795025f36e320f8aecb2859d24
3
+ Rollup.js v2.79.0
4
+ Wed, 31 Aug 2022 04:52:13 GMT - commit 8477f8ff1fe80086556021542b22942ad27a0a69
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.78.1
4
- Fri, 19 Aug 2022 05:19:43 GMT - commit 398d0c4970b679795025f36e320f8aecb2859d24
3
+ Rollup.js v2.79.0
4
+ Wed, 31 Aug 2022 04:52:13 GMT - commit 8477f8ff1fe80086556021542b22942ad27a0a69
5
5
 
6
6
  https://github.com/rollup/rollup
7
7