rollup 2.26.11 → 2.28.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/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.26.11
4
- Tue, 08 Sep 2020 05:49:27 GMT - commit 022770a8058cb3598ea8b0c5df12384bcf7bc7ff
3
+ Rollup.js v2.28.1
4
+ Mon, 21 Sep 2020 06:38:23 GMT - commit 1040292e0b1ad6496d8cf0a3eee63b17d9a39a4f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.26.11
4
- Tue, 08 Sep 2020 05:49:27 GMT - commit 022770a8058cb3598ea8b0c5df12384bcf7bc7ff
3
+ Rollup.js v2.28.1
4
+ Mon, 21 Sep 2020 06:38:23 GMT - commit 1040292e0b1ad6496d8cf0a3eee63b17d9a39a4f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
13
13
  import { writeFile as writeFile$1, readdirSync, mkdirSync, readFile as readFile$1, lstatSync, realpathSync } from 'fs';
14
14
  import { EventEmitter } from 'events';
15
15
 
16
- var version = "2.26.11";
16
+ var version = "2.28.1";
17
17
 
18
18
  var charToInteger = {};
19
19
  var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
@@ -4651,9 +4651,8 @@ const HELPER_GENERATORS = {
4651
4651
  [INTEROP_NAMESPACE_VARIABLE]: (_, n, s, t, liveBindings, freeze, usedHelpers) => `function ${INTEROP_NAMESPACE_VARIABLE}(e)${_}{${n}` +
4652
4652
  (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)
4653
4653
  ? `${t}return e${_}&&${_}e.__esModule${_}?${_}e${_}:${_}${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${s}${n}`
4654
- : `${t}if${_}(e${_}&&${_}e.__esModule)${_}{${_}return e${s}${_}}${_}else${_}{${n}` +
4655
- createNamespaceObject(_, n, t, t + t, liveBindings, freeze) +
4656
- `${t}}${n}`) +
4654
+ : `${t}if${_}(e${_}&&${_}e.__esModule)${_}return e;${n}` +
4655
+ createNamespaceObject(_, n, t, t, liveBindings, freeze)) +
4657
4656
  `}${n}${n}`,
4658
4657
  [INTEROP_NAMESPACE_DEFAULT_VARIABLE]: (_, n, _s, t, liveBindings, freeze) => `function ${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${_}{${n}` +
4659
4658
  createNamespaceObject(_, n, t, t, liveBindings, freeze) +
@@ -7302,7 +7301,7 @@ class IfStatement extends NodeBase {
7302
7301
  hoistedDeclarations.push(...this.alternateScope.hoistedDeclarations);
7303
7302
  }
7304
7303
  }
7305
- renderHoistedDeclarations(hoistedDeclarations, this.start, code);
7304
+ this.renderHoistedDeclarations(hoistedDeclarations, code);
7306
7305
  }
7307
7306
  getTestValue() {
7308
7307
  if (this.testValue === unset) {
@@ -7343,6 +7342,24 @@ class IfStatement extends NodeBase {
7343
7342
  context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
7344
7343
  }
7345
7344
  }
7345
+ renderHoistedDeclarations(hoistedDeclarations, code) {
7346
+ const hoistedVars = [
7347
+ ...new Set(hoistedDeclarations.map(identifier => {
7348
+ const variable = identifier.variable;
7349
+ return variable.included ? variable.getName() : '';
7350
+ }))
7351
+ ]
7352
+ .filter(Boolean)
7353
+ .join(', ');
7354
+ if (hoistedVars) {
7355
+ const parentType = this.parent.type;
7356
+ const needsBraces = parentType !== Program && parentType !== BlockStatement;
7357
+ code.prependRight(this.start, `${needsBraces ? '{ ' : ''}var ${hoistedVars}; `);
7358
+ if (needsBraces) {
7359
+ code.appendLeft(this.end, ` }`);
7360
+ }
7361
+ }
7362
+ }
7346
7363
  shouldKeepAlternateBranch() {
7347
7364
  let currentParent = this.parent;
7348
7365
  do {
@@ -7357,14 +7374,6 @@ class IfStatement extends NodeBase {
7357
7374
  return false;
7358
7375
  }
7359
7376
  }
7360
- function renderHoistedDeclarations(hoistedDeclarations, prependPosition, code) {
7361
- const hoistedVars = [
7362
- ...new Set(hoistedDeclarations.map(identifier => identifier.variable.getName()))
7363
- ].join(', ');
7364
- if (hoistedVars) {
7365
- code.prependRight(prependPosition, `var ${hoistedVars}; `);
7366
- }
7367
- }
7368
7377
 
7369
7378
  class ImportDeclaration extends NodeBase {
7370
7379
  bind() { }
@@ -10988,12 +10997,21 @@ class Chunk$1 {
10988
10997
  ? '[name].js'
10989
10998
  : '[name][extname].js'
10990
10999
  : options.entryFileNames;
10991
- path = relative(preserveModulesRelativeDir, `${dirname(sanitizedId)}/${renderNamePattern(pattern, 'output.entryFileNames', {
11000
+ const currentDir = dirname(sanitizedId);
11001
+ const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
10992
11002
  ext: () => extension.substr(1),
10993
11003
  extname: () => extension,
10994
11004
  format: () => options.format,
10995
11005
  name: () => this.getChunkName()
10996
- }, this.getChunkInfo.bind(this))}`);
11006
+ }, this.getChunkInfo.bind(this));
11007
+ const currentPath = `${currentDir}/${fileName}`;
11008
+ const { preserveModulesRoot } = options;
11009
+ if (preserveModulesRoot && currentPath.startsWith(preserveModulesRoot)) {
11010
+ path = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, '');
11011
+ }
11012
+ else {
11013
+ path = relative(preserveModulesRelativeDir, currentPath);
11014
+ }
10997
11015
  }
10998
11016
  else {
10999
11017
  path = `_virtual/${basename(sanitizedId)}`;
@@ -19381,7 +19399,7 @@ const getIdMatcher = (option) => {
19381
19399
  ids.add(value);
19382
19400
  }
19383
19401
  }
19384
- return (id => ids.has(id) || matchers.some(matcher => matcher.test(id)));
19402
+ return (id, ..._args) => ids.has(id) || matchers.some(matcher => matcher.test(id));
19385
19403
  }
19386
19404
  return () => false;
19387
19405
  };
@@ -19520,6 +19538,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
19520
19538
  plugins: ensureArray(config.plugins),
19521
19539
  preferConst: config.preferConst || false,
19522
19540
  preserveModules,
19541
+ preserveModulesRoot: getPreserveModulesRoot(config),
19523
19542
  sourcemap: config.sourcemap || false,
19524
19543
  sourcemapExcludeSources: config.sourcemapExcludeSources || false,
19525
19544
  sourcemapFile: config.sourcemapFile,
@@ -19604,6 +19623,13 @@ const getPreserveModules$1 = (config, inlineDynamicImports, inputOptions) => {
19604
19623
  }
19605
19624
  return preserveModules;
19606
19625
  };
19626
+ const getPreserveModulesRoot = (config) => {
19627
+ const preserveModulesRoot = config.preserveModulesRoot;
19628
+ if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
19629
+ return undefined;
19630
+ }
19631
+ return resolve(preserveModulesRoot);
19632
+ };
19607
19633
  const getAmd = (config) => ({
19608
19634
  define: 'define',
19609
19635
  ...config.amd
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.26.11
4
- Tue, 08 Sep 2020 05:49:27 GMT - commit 022770a8058cb3598ea8b0c5df12384bcf7bc7ff
3
+ Rollup.js v2.28.1
4
+ Mon, 21 Sep 2020 06:38:23 GMT - commit 1040292e0b1ad6496d8cf0a3eee63b17d9a39a4f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -4090,6 +4090,7 @@ function mergeOutputOptions(config, overrides, warn) {
4090
4090
  plugins: ensureArray$1(config.plugins),
4091
4091
  preferConst: getOption('preferConst'),
4092
4092
  preserveModules: getOption('preserveModules'),
4093
+ preserveModulesRoot: getOption('preserveModulesRoot'),
4093
4094
  sourcemap: getOption('sourcemap'),
4094
4095
  sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
4095
4096
  sourcemapFile: getOption('sourcemapFile'),
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.26.11
4
- Tue, 08 Sep 2020 05:49:27 GMT - commit 022770a8058cb3598ea8b0c5df12384bcf7bc7ff
3
+ Rollup.js v2.28.1
4
+ Mon, 21 Sep 2020 06:38:23 GMT - commit 1040292e0b1ad6496d8cf0a3eee63b17d9a39a4f
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup