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/rollup.d.ts CHANGED
@@ -583,6 +583,7 @@ export interface OutputOptions {
583
583
  plugins?: OutputPlugin[];
584
584
  preferConst?: boolean;
585
585
  preserveModules?: boolean;
586
+ preserveModulesRoot?: string;
586
587
  sourcemap?: boolean | 'inline' | 'hidden';
587
588
  sourcemapExcludeSources?: boolean;
588
589
  sourcemapFile?: string;
@@ -628,6 +629,7 @@ export interface NormalizedOutputOptions {
628
629
  plugins: OutputPlugin[];
629
630
  preferConst: boolean;
630
631
  preserveModules: boolean;
632
+ preserveModulesRoot: string | undefined;
631
633
  sourcemap: boolean | 'inline' | 'hidden';
632
634
  sourcemapExcludeSources: boolean;
633
635
  sourcemapFile: string | undefined;
package/dist/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
@@ -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
@@ -11,6 +11,7 @@
11
11
  'use strict';
12
12
 
13
13
  var rollup = require('./rollup.js');
14
+ var fs = require('fs');
14
15
  var sysPath = require('path');
15
16
  var mergeOptions = require('./mergeOptions.js');
16
17
  var url = require('url');
@@ -308,16 +309,17 @@ function showTruncatedWarnings(warnings) {
308
309
 
309
310
  const stdinName = '-';
310
311
  let stdinResult = null;
311
- function stdinPlugin() {
312
+ function stdinPlugin(arg) {
313
+ const suffix = typeof arg == 'string' && arg.length ? '.' + arg : '';
312
314
  return {
313
315
  name: 'stdin',
314
316
  resolveId(id) {
315
317
  if (id === stdinName) {
316
- return id;
318
+ return id + suffix;
317
319
  }
318
320
  },
319
321
  load(id) {
320
- if (id === stdinName) {
322
+ if (id === stdinName || id.startsWith(stdinName + '.')) {
321
323
  return stdinResult || (stdinResult = readStdin());
322
324
  }
323
325
  }
@@ -366,7 +368,7 @@ function waitForInputPlugin() {
366
368
 
367
369
  function addCommandPluginsToInputOptions(inputOptions, command) {
368
370
  if (command.stdin !== false) {
369
- inputOptions.plugins.push(stdinPlugin());
371
+ inputOptions.plugins.push(stdinPlugin(command.stdin));
370
372
  }
371
373
  if (command.waitForBundleInput === true) {
372
374
  inputOptions.plugins.push(waitForInputPlugin());
@@ -501,17 +503,18 @@ async function getDefaultFromTranspiledConfigFile(fileName, silent) {
501
503
  return loadConfigFromBundledFile(fileName, code);
502
504
  }
503
505
  async function loadConfigFromBundledFile(fileName, bundledCode) {
504
- const extension = sysPath.extname(fileName);
506
+ const resolvedFileName = fs.realpathSync(fileName);
507
+ const extension = sysPath.extname(resolvedFileName);
505
508
  const defaultLoader = require.extensions[extension];
506
- require.extensions[extension] = (module, filename) => {
507
- if (filename === fileName) {
508
- module._compile(bundledCode, filename);
509
+ require.extensions[extension] = (module, requiredFileName) => {
510
+ if (requiredFileName === resolvedFileName) {
511
+ module._compile(bundledCode, requiredFileName);
509
512
  }
510
513
  else {
511
- defaultLoader(module, filename);
514
+ defaultLoader(module, requiredFileName);
512
515
  }
513
516
  };
514
- delete require.cache[fileName];
517
+ delete require.cache[resolvedFileName];
515
518
  try {
516
519
  const config = getDefaultFromCjs(require(fileName));
517
520
  require.extensions[extension] = defaultLoader;
@@ -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
@@ -153,6 +153,7 @@ function mergeOutputOptions(config, overrides, warn) {
153
153
  plugins: rollup.ensureArray(config.plugins),
154
154
  preferConst: getOption('preferConst'),
155
155
  preserveModules: getOption('preserveModules'),
156
+ preserveModulesRoot: getOption('preserveModulesRoot'),
156
157
  sourcemap: getOption('sourcemap'),
157
158
  sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
158
159
  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
@@ -19,7 +19,7 @@ function _interopNamespaceDefaultOnly(e) {
19
19
  return {__proto__: null, 'default': e};
20
20
  }
21
21
 
22
- var version = "2.26.11";
22
+ var version = "2.28.1";
23
23
 
24
24
  function ensureArray(items) {
25
25
  if (Array.isArray(items)) {
@@ -4728,9 +4728,8 @@ const HELPER_GENERATORS = {
4728
4728
  [INTEROP_NAMESPACE_VARIABLE]: (_, n, s, t, liveBindings, freeze, usedHelpers) => `function ${INTEROP_NAMESPACE_VARIABLE}(e)${_}{${n}` +
4729
4729
  (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)
4730
4730
  ? `${t}return e${_}&&${_}e.__esModule${_}?${_}e${_}:${_}${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${s}${n}`
4731
- : `${t}if${_}(e${_}&&${_}e.__esModule)${_}{${_}return e${s}${_}}${_}else${_}{${n}` +
4732
- createNamespaceObject(_, n, t, t + t, liveBindings, freeze) +
4733
- `${t}}${n}`) +
4731
+ : `${t}if${_}(e${_}&&${_}e.__esModule)${_}return e;${n}` +
4732
+ createNamespaceObject(_, n, t, t, liveBindings, freeze)) +
4734
4733
  `}${n}${n}`,
4735
4734
  [INTEROP_NAMESPACE_DEFAULT_VARIABLE]: (_, n, _s, t, liveBindings, freeze) => `function ${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${_}{${n}` +
4736
4735
  createNamespaceObject(_, n, t, t, liveBindings, freeze) +
@@ -7358,7 +7357,7 @@ class IfStatement extends NodeBase {
7358
7357
  hoistedDeclarations.push(...this.alternateScope.hoistedDeclarations);
7359
7358
  }
7360
7359
  }
7361
- renderHoistedDeclarations(hoistedDeclarations, this.start, code);
7360
+ this.renderHoistedDeclarations(hoistedDeclarations, code);
7362
7361
  }
7363
7362
  getTestValue() {
7364
7363
  if (this.testValue === unset) {
@@ -7399,6 +7398,24 @@ class IfStatement extends NodeBase {
7399
7398
  context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
7400
7399
  }
7401
7400
  }
7401
+ renderHoistedDeclarations(hoistedDeclarations, code) {
7402
+ const hoistedVars = [
7403
+ ...new Set(hoistedDeclarations.map(identifier => {
7404
+ const variable = identifier.variable;
7405
+ return variable.included ? variable.getName() : '';
7406
+ }))
7407
+ ]
7408
+ .filter(Boolean)
7409
+ .join(', ');
7410
+ if (hoistedVars) {
7411
+ const parentType = this.parent.type;
7412
+ const needsBraces = parentType !== Program && parentType !== BlockStatement;
7413
+ code.prependRight(this.start, `${needsBraces ? '{ ' : ''}var ${hoistedVars}; `);
7414
+ if (needsBraces) {
7415
+ code.appendLeft(this.end, ` }`);
7416
+ }
7417
+ }
7418
+ }
7402
7419
  shouldKeepAlternateBranch() {
7403
7420
  let currentParent = this.parent;
7404
7421
  do {
@@ -7413,14 +7430,6 @@ class IfStatement extends NodeBase {
7413
7430
  return false;
7414
7431
  }
7415
7432
  }
7416
- function renderHoistedDeclarations(hoistedDeclarations, prependPosition, code) {
7417
- const hoistedVars = [
7418
- ...new Set(hoistedDeclarations.map(identifier => identifier.variable.getName()))
7419
- ].join(', ');
7420
- if (hoistedVars) {
7421
- code.prependRight(prependPosition, `var ${hoistedVars}; `);
7422
- }
7423
- }
7424
7433
 
7425
7434
  class ImportDeclaration extends NodeBase {
7426
7435
  bind() { }
@@ -11044,12 +11053,21 @@ class Chunk$1 {
11044
11053
  ? '[name].js'
11045
11054
  : '[name][extname].js'
11046
11055
  : options.entryFileNames;
11047
- path = relative(preserveModulesRelativeDir, `${sysPath.dirname(sanitizedId)}/${renderNamePattern(pattern, 'output.entryFileNames', {
11056
+ const currentDir = sysPath.dirname(sanitizedId);
11057
+ const fileName = renderNamePattern(pattern, 'output.entryFileNames', {
11048
11058
  ext: () => extension.substr(1),
11049
11059
  extname: () => extension,
11050
11060
  format: () => options.format,
11051
11061
  name: () => this.getChunkName()
11052
- }, this.getChunkInfo.bind(this))}`);
11062
+ }, this.getChunkInfo.bind(this));
11063
+ const currentPath = `${currentDir}/${fileName}`;
11064
+ const { preserveModulesRoot } = options;
11065
+ if (preserveModulesRoot && currentPath.startsWith(preserveModulesRoot)) {
11066
+ path = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, '');
11067
+ }
11068
+ else {
11069
+ path = relative(preserveModulesRelativeDir, currentPath);
11070
+ }
11053
11071
  }
11054
11072
  else {
11055
11073
  path = `_virtual/${sysPath.basename(sanitizedId)}`;
@@ -19411,7 +19429,7 @@ const getIdMatcher = (option) => {
19411
19429
  ids.add(value);
19412
19430
  }
19413
19431
  }
19414
- return (id => ids.has(id) || matchers.some(matcher => matcher.test(id)));
19432
+ return (id, ..._args) => ids.has(id) || matchers.some(matcher => matcher.test(id));
19415
19433
  }
19416
19434
  return () => false;
19417
19435
  };
@@ -19550,6 +19568,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
19550
19568
  plugins: ensureArray(config.plugins),
19551
19569
  preferConst: config.preferConst || false,
19552
19570
  preserveModules,
19571
+ preserveModulesRoot: getPreserveModulesRoot(config),
19553
19572
  sourcemap: config.sourcemap || false,
19554
19573
  sourcemapExcludeSources: config.sourcemapExcludeSources || false,
19555
19574
  sourcemapFile: config.sourcemapFile,
@@ -19634,6 +19653,13 @@ const getPreserveModules$1 = (config, inlineDynamicImports, inputOptions) => {
19634
19653
  }
19635
19654
  return preserveModules;
19636
19655
  };
19656
+ const getPreserveModulesRoot = (config) => {
19657
+ const preserveModulesRoot = config.preserveModulesRoot;
19658
+ if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
19659
+ return undefined;
19660
+ }
19661
+ return sysPath.resolve(preserveModulesRoot);
19662
+ };
19637
19663
  const getAmd = (config) => ({
19638
19664
  define: 'define',
19639
19665
  ...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
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "2.26.11",
3
+ "version": "2.28.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -71,13 +71,13 @@
71
71
  "@rollup/plugin-node-resolve": "^9.0.0",
72
72
  "@rollup/plugin-replace": "^2.3.3",
73
73
  "@types/micromatch": "^4.0.1",
74
- "@types/node": "^14.0.27",
74
+ "@types/node": "^14.10.2",
75
75
  "@types/require-relative": "^0.8.0",
76
76
  "@types/signal-exit": "^3.0.0",
77
77
  "@types/yargs-parser": "^15.0.0",
78
78
  "acorn": "^8.0.1",
79
79
  "acorn-class-fields": "^0.3.7",
80
- "acorn-jsx": "^5.2.0",
80
+ "acorn-jsx": "^5.3.1",
81
81
  "acorn-numeric-separator": "^0.3.6",
82
82
  "acorn-static-class-features": "^0.2.4",
83
83
  "acorn-walk": "^8.0.0",
@@ -90,30 +90,30 @@
90
90
  "date-time": "^3.1.0",
91
91
  "es5-shim": "^4.5.14",
92
92
  "es6-shim": "^0.35.5",
93
- "eslint": "^7.6.0",
93
+ "eslint": "^7.9.0",
94
94
  "eslint-plugin-import": "^2.22.0",
95
95
  "execa": "^4.0.3",
96
96
  "fixturify": "^2.1.0",
97
97
  "hash.js": "^1.1.7",
98
- "husky": "^4.2.5",
98
+ "husky": "^4.3.0",
99
99
  "is-reference": "^1.2.1",
100
- "lint-staged": "^10.2.11",
100
+ "lint-staged": "^10.3.0",
101
101
  "locate-character": "^2.0.5",
102
102
  "magic-string": "^0.25.7",
103
103
  "markdownlint-cli": "^0.23.2",
104
104
  "micromatch": "^4.0.2",
105
- "mocha": "^8.1.1",
106
- "node-fetch": "^2.6.0",
105
+ "mocha": "^8.1.3",
106
+ "node-fetch": "^2.6.1",
107
107
  "nyc": "^15.1.0",
108
- "prettier": "^2.0.5",
109
- "pretty-bytes": "^5.3.0",
108
+ "prettier": "^2.1.2",
109
+ "pretty-bytes": "^5.4.1",
110
110
  "pretty-ms": "^7.0.0",
111
111
  "require-relative": "^0.8.7",
112
112
  "requirejs": "^2.3.6",
113
- "rollup": "^2.23.1",
113
+ "rollup": "^2.26.11",
114
114
  "rollup-plugin-license": "^2.2.0",
115
115
  "rollup-plugin-string": "^3.0.0",
116
- "rollup-plugin-terser": "^7.0.0",
116
+ "rollup-plugin-terser": "^7.0.2",
117
117
  "rollup-plugin-thatworks": "^1.0.4",
118
118
  "rollup-plugin-typescript": "^1.0.1",
119
119
  "rollup-pluginutils": "^2.8.2",
@@ -123,13 +123,13 @@
123
123
  "source-map": "^0.7.3",
124
124
  "source-map-support": "^0.5.19",
125
125
  "sourcemap-codec": "^1.4.8",
126
- "systemjs": "^6.5.0",
127
- "terser": "^5.0.0",
126
+ "systemjs": "^6.6.1",
127
+ "terser": "^5.3.1",
128
128
  "tslib": "^2.0.1",
129
129
  "tslint": "^6.1.3",
130
- "typescript": "^3.9.7",
130
+ "typescript": "^4.0.2",
131
131
  "url-parse": "^1.4.7",
132
- "yargs-parser": "^19.0.1"
132
+ "yargs-parser": "^20.0.0"
133
133
  },
134
134
  "files": [
135
135
  "dist/**/*.js",