rollup 2.16.1 → 2.18.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
@@ -490,14 +490,17 @@ export interface InputOptions {
490
490
  context?: string;
491
491
  experimentalCacheExpiry?: number;
492
492
  external?: ExternalOption;
493
+ /** @deprecated Use the "inlineDynamicImports" output option instead. */
493
494
  inlineDynamicImports?: boolean;
494
495
  input?: InputOption;
496
+ /** @deprecated Use the "manualChunks" output option instead. */
495
497
  manualChunks?: ManualChunksOption;
496
498
  moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
497
499
  onwarn?: WarningHandlerWithDefault;
498
500
  perf?: boolean;
499
501
  plugins?: Plugin[];
500
502
  preserveEntrySignatures?: PreserveEntrySignaturesOption;
503
+ /** @deprecated Use the "preserveModules" output option instead. */
501
504
  preserveModules?: boolean;
502
505
  preserveSymlinks?: boolean;
503
506
  shimMissingExports?: boolean;
@@ -513,15 +516,18 @@ export interface NormalizedInputOptions {
513
516
  context: string;
514
517
  experimentalCacheExpiry: number;
515
518
  external: IsExternal;
516
- inlineDynamicImports: boolean;
519
+ /** @deprecated Use the "inlineDynamicImports" output option instead. */
520
+ inlineDynamicImports: boolean | undefined;
517
521
  input: string[] | { [entryAlias: string]: string };
518
- manualChunks: ManualChunksOption;
522
+ /** @deprecated Use the "manualChunks" output option instead. */
523
+ manualChunks: ManualChunksOption | undefined;
519
524
  moduleContext: (id: string) => string;
520
525
  onwarn: WarningHandler;
521
526
  perf: boolean;
522
527
  plugins: Plugin[];
523
528
  preserveEntrySignatures: PreserveEntrySignaturesOption;
524
- preserveModules: boolean;
529
+ /** @deprecated Use the "preserveModules" output option instead. */
530
+ preserveModules: boolean | undefined;
525
531
  preserveSymlinks: boolean;
526
532
  shimMissingExports: boolean;
527
533
  strictDeprecations: boolean;
@@ -560,8 +566,10 @@ export interface OutputOptions {
560
566
  globals?: GlobalsOption;
561
567
  hoistTransitiveImports?: boolean;
562
568
  indent?: string | boolean;
569
+ inlineDynamicImports?: boolean;
563
570
  interop?: boolean;
564
571
  intro?: string | (() => string | Promise<string>);
572
+ manualChunks?: ManualChunksOption;
565
573
  minifyInternalExports?: boolean;
566
574
  name?: string;
567
575
  namespaceToStringTag?: boolean;
@@ -570,6 +578,7 @@ export interface OutputOptions {
570
578
  paths?: OptionsPaths;
571
579
  plugins?: OutputPlugin[];
572
580
  preferConst?: boolean;
581
+ preserveModules?: boolean;
573
582
  sourcemap?: boolean | 'inline' | 'hidden';
574
583
  sourcemapExcludeSources?: boolean;
575
584
  sourcemapFile?: string;
@@ -602,8 +611,10 @@ export interface NormalizedOutputOptions {
602
611
  globals: GlobalsOption;
603
612
  hoistTransitiveImports: boolean;
604
613
  indent: true | string;
614
+ inlineDynamicImports: boolean;
605
615
  interop: boolean;
606
616
  intro: () => string | Promise<string>;
617
+ manualChunks: ManualChunksOption;
607
618
  minifyInternalExports: boolean;
608
619
  name: string | undefined;
609
620
  namespaceToStringTag: boolean;
@@ -612,6 +623,7 @@ export interface NormalizedOutputOptions {
612
623
  paths: OptionsPaths;
613
624
  plugins: OutputPlugin[];
614
625
  preferConst: boolean;
626
+ preserveModules: boolean;
615
627
  sourcemap: boolean | 'inline' | 'hidden';
616
628
  sourcemapExcludeSources: boolean;
617
629
  sourcemapFile: string | undefined;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.16.1
4
- Sat, 13 Jun 2020 19:46:34 GMT - commit 08a6255ce0af2dca775e828919f035b433b35fed
3
+ Rollup.js v2.18.1
4
+ Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -12,7 +12,7 @@
12
12
 
13
13
  Object.defineProperty(exports, '__esModule', { value: true });
14
14
 
15
- var rollup_js = require('./shared/rollup.js');
15
+ var rollup = require('./shared/rollup.js');
16
16
  require('path');
17
17
  require('crypto');
18
18
  require('fs');
@@ -20,7 +20,7 @@ require('events');
20
20
 
21
21
 
22
22
 
23
- exports.VERSION = rollup_js.version;
24
- exports.rollup = rollup_js.rollup;
25
- exports.watch = rollup_js.watch;
23
+ exports.VERSION = rollup.version;
24
+ exports.rollup = rollup.rollup;
25
+ exports.watch = rollup.watch;
26
26
  //# sourceMappingURL=rollup.js.map
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.16.1
4
- Sat, 13 Jun 2020 19:46:34 GMT - commit 08a6255ce0af2dca775e828919f035b433b35fed
3
+ Rollup.js v2.18.1
4
+ Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -10,7 +10,7 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- var rollup_js = require('./rollup.js');
13
+ var rollup = require('./rollup.js');
14
14
  var path = require('path');
15
15
  var util = require('util');
16
16
  var fs = require('fs');
@@ -18,7 +18,7 @@ var events = require('events');
18
18
  var stream = require('stream');
19
19
  var os = require('os');
20
20
 
21
- var utils = rollup_js.createCommonjsModule(function (module, exports) {
21
+ var utils = rollup.createCommonjsModule(function (module, exports) {
22
22
 
23
23
  exports.isInteger = num => {
24
24
  if (typeof num === 'number') {
@@ -1578,7 +1578,7 @@ var constants$1 = {
1578
1578
  }
1579
1579
  };
1580
1580
 
1581
- var utils$1 = rollup_js.createCommonjsModule(function (module, exports) {
1581
+ var utils$1 = rollup.createCommonjsModule(function (module, exports) {
1582
1582
 
1583
1583
 
1584
1584
  const win32 = process.platform === 'win32';
@@ -3736,7 +3736,7 @@ var normalizePath = function(path, stripTrailing) {
3736
3736
  return prefix + segs.join('/');
3737
3737
  };
3738
3738
 
3739
- var anymatch_1 = rollup_js.createCommonjsModule(function (module, exports) {
3739
+ var anymatch_1 = rollup.createCommonjsModule(function (module, exports) {
3740
3740
 
3741
3741
  Object.defineProperty(exports, "__esModule", { value: true });
3742
3742
 
@@ -4207,7 +4207,7 @@ var binaryExtensions$1 = {
4207
4207
  'default': binaryExtensions
4208
4208
  };
4209
4209
 
4210
- var require$$0 = rollup_js.getCjsExportFromNamespace(binaryExtensions$1);
4210
+ var require$$0 = rollup.getCjsExportFromNamespace(binaryExtensions$1);
4211
4211
 
4212
4212
  var binaryExtensions$2 = require$$0;
4213
4213
 
@@ -4215,7 +4215,7 @@ const extensions = new Set(binaryExtensions$2);
4215
4215
 
4216
4216
  var isBinaryPath = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase());
4217
4217
 
4218
- var constants$2 = rollup_js.createCommonjsModule(function (module, exports) {
4218
+ var constants$2 = rollup.createCommonjsModule(function (module, exports) {
4219
4219
 
4220
4220
  const {sep} = path;
4221
4221
  const {platform} = process;
@@ -4902,7 +4902,7 @@ async _addToNodeFs(path$1, initialAdd, priorWh, depth, target) {
4902
4902
 
4903
4903
  var nodefsHandler = NodeFsHandler;
4904
4904
 
4905
- var require$$1 = rollup_js.getCjsExportFromNamespace(rollup_js.fseventsImporter);
4905
+ var require$$1 = rollup.getCjsExportFromNamespace(rollup.fseventsImporter);
4906
4906
 
4907
4907
  const { promisify: promisify$2 } = util;
4908
4908
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.16.1
4
- Sat, 13 Jun 2020 19:46:34 GMT - commit 08a6255ce0af2dca775e828919f035b433b35fed
3
+ Rollup.js v2.18.1
4
+ Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -23,7 +23,7 @@ function _interopNamespace(e) {
23
23
  }
24
24
  }
25
25
 
26
- var rollup_js = require('./rollup.js');
26
+ var rollup = require('./rollup.js');
27
27
  var path = require('path');
28
28
  var mergeOptions = require('./mergeOptions.js');
29
29
  var url = require('url');
@@ -122,10 +122,10 @@ function handleError(err, recover = false) {
122
122
  stderr(colorette.cyan(err.url));
123
123
  }
124
124
  if (err.loc) {
125
- stderr(`${rollup_js.relativeId((err.loc.file || err.id))} (${err.loc.line}:${err.loc.column})`);
125
+ stderr(`${rollup.relativeId((err.loc.file || err.id))} (${err.loc.line}:${err.loc.column})`);
126
126
  }
127
127
  else if (err.id) {
128
- stderr(rollup_js.relativeId(err.id));
128
+ stderr(rollup.relativeId(err.id));
129
129
  }
130
130
  if (err.frame) {
131
131
  stderr(colorette.dim(err.frame));
@@ -162,9 +162,9 @@ function batchWarnings() {
162
162
  const id = (warning.loc && warning.loc.file) || warning.id;
163
163
  if (id) {
164
164
  const loc = warning.loc
165
- ? `${rollup_js.relativeId(id)}: (${warning.loc.line}:${warning.loc.column})`
166
- : rollup_js.relativeId(id);
167
- stderr(colorette.bold(rollup_js.relativeId(loc)));
165
+ ? `${rollup.relativeId(id)}: (${warning.loc.line}:${warning.loc.column})`
166
+ : rollup.relativeId(id);
167
+ stderr(colorette.bold(rollup.relativeId(loc)));
168
168
  }
169
169
  if (warning.frame)
170
170
  info(warning.frame);
@@ -240,7 +240,7 @@ const deferredHandlers = {
240
240
  stderr(colorette.bold('The following entry modules are using named and default exports together:'));
241
241
  const displayedWarnings = warnings.length > 5 ? warnings.slice(0, 3) : warnings;
242
242
  for (const warning of displayedWarnings) {
243
- stderr(rollup_js.relativeId(warning.id));
243
+ stderr(rollup.relativeId(warning.id));
244
244
  }
245
245
  if (displayedWarnings.length < warnings.length) {
246
246
  stderr(`...and ${warnings.length - displayedWarnings.length} other entry modules`);
@@ -250,7 +250,7 @@ const deferredHandlers = {
250
250
  NAMESPACE_CONFLICT(warnings) {
251
251
  title(`Conflicting re-exports`);
252
252
  for (const warning of warnings) {
253
- stderr(`${colorette.bold(rollup_js.relativeId(warning.reexporter))} re-exports '${warning.name}' from both ${rollup_js.relativeId(warning.sources[0])} and ${rollup_js.relativeId(warning.sources[1])} (will be ignored)`);
253
+ stderr(`${colorette.bold(rollup.relativeId(warning.reexporter))} re-exports '${warning.name}' from both ${rollup.relativeId(warning.sources[0])} and ${rollup.relativeId(warning.sources[1])} (will be ignored)`);
254
254
  }
255
255
  },
256
256
  NON_EXISTENT_EXPORT(warnings) {
@@ -268,7 +268,7 @@ const deferredHandlers = {
268
268
  if (warning.url && warning.url !== lastUrl)
269
269
  info((lastUrl = warning.url));
270
270
  if (warning.id) {
271
- let loc = rollup_js.relativeId(warning.id);
271
+ let loc = rollup.relativeId(warning.id);
272
272
  if (warning.loc) {
273
273
  loc += `: (${warning.loc.line}:${warning.loc.column})`;
274
274
  }
@@ -344,7 +344,7 @@ function showTruncatedWarnings(warnings) {
344
344
  const nestedByModule = nest(warnings, 'id');
345
345
  const displayedByModule = nestedByModule.length > 5 ? nestedByModule.slice(0, 3) : nestedByModule;
346
346
  for (const { key: id, items } of displayedByModule) {
347
- stderr(colorette.bold(rollup_js.relativeId(id)));
347
+ stderr(colorette.bold(rollup.relativeId(id)));
348
348
  stderr(colorette.gray(items[0].frame));
349
349
  if (items.length > 1) {
350
350
  stderr(`...and ${items.length - 1} other ${items.length > 2 ? 'occurrences' : 'occurrence'}`);
@@ -475,17 +475,30 @@ function loadAndRegisterPlugin(inputOptions, pluginText) {
475
475
  plugin = require(pluginText);
476
476
  }
477
477
  catch (ex) {
478
- throw new Error(`Cannot load plugin "${pluginText}"`);
478
+ throw new Error(`Cannot load plugin "${pluginText}": ${ex.message}.`);
479
479
  }
480
480
  }
481
481
  }
482
482
  // some plugins do not use `module.exports` for their entry point,
483
483
  // in which case we try the named default export and the plugin name
484
484
  if (typeof plugin === 'object') {
485
- plugin = plugin.default || plugin[pluginText];
485
+ plugin = plugin.default || plugin[getCamelizedPluginBaseName(pluginText)];
486
+ }
487
+ if (!plugin) {
488
+ throw new Error(`Cannot find entry for plugin "${pluginText}". The plugin needs to export a function either as "default" or "${getCamelizedPluginBaseName(pluginText)}" for Rollup to recognize it.`);
486
489
  }
487
490
  inputOptions.plugins.push(typeof plugin === 'function' ? plugin.call(plugin, pluginArg) : plugin);
488
491
  }
492
+ function getCamelizedPluginBaseName(pluginText) {
493
+ var _a;
494
+ return (((_a = pluginText.match(/(@rollup\/plugin-|rollup-plugin-)(.+)$/)) === null || _a === void 0 ? void 0 : _a[2]) || pluginText)
495
+ .split(/[\\/]/)
496
+ .slice(-1)[0]
497
+ .split('.')[0]
498
+ .split('-')
499
+ .map((part, index) => (index === 0 || !part ? part : part[0].toUpperCase() + part.slice(1)))
500
+ .join('');
501
+ }
489
502
 
490
503
  function supportsNativeESM() {
491
504
  return Number(/^v(\d+)/.exec(process.version)[1]) >= 13;
@@ -520,14 +533,14 @@ function getDefaultFromCjs(namespace) {
520
533
  }
521
534
  async function getDefaultFromTranspiledConfigFile(fileName, silent) {
522
535
  const warnings = batchWarnings();
523
- const bundle = await rollup_js.rollup({
536
+ const bundle = await rollup.rollup({
524
537
  external: (id) => (id[0] !== '.' && !path.isAbsolute(id)) || id.slice(-5, id.length) === '.json',
525
538
  input: fileName,
526
539
  onwarn: warnings.add,
527
540
  treeshake: false,
528
541
  });
529
542
  if (!silent && warnings.count > 0) {
530
- stderr(colorette.bold(`loaded ${rollup_js.relativeId(fileName)} with warnings`));
543
+ stderr(colorette.bold(`loaded ${rollup.relativeId(fileName)} with warnings`));
531
544
  warnings.flush();
532
545
  }
533
546
  const { output: [{ code }], } = await bundle.generate({
@@ -555,9 +568,9 @@ async function loadConfigFromBundledFile(fileName, bundledCode) {
555
568
  }
556
569
  catch (err) {
557
570
  if (err.code === 'ERR_REQUIRE_ESM') {
558
- return rollup_js.error({
571
+ return rollup.error({
559
572
  code: 'TRANSPILED_ESM_CONFIG',
560
- message: `While loading the Rollup configuration from "${rollup_js.relativeId(fileName)}", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.`,
573
+ message: `While loading the Rollup configuration from "${rollup.relativeId(fileName)}", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.`,
561
574
  url: 'https://rollupjs.org/guide/en/#using-untranspiled-config-files',
562
575
  });
563
576
  }
@@ -569,7 +582,7 @@ async function getConfigList(configFileExport, commandOptions) {
569
582
  ? configFileExport(commandOptions)
570
583
  : configFileExport);
571
584
  if (Object.keys(config).length === 0) {
572
- return rollup_js.error({
585
+ return rollup.error({
573
586
  code: 'MISSING_CONFIG',
574
587
  message: 'Config file must export an options object, or an array of options objects',
575
588
  url: 'https://rollupjs.org/guide/en/#configuration-files',
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.16.1
4
- Sat, 13 Jun 2020 19:46:34 GMT - commit 08a6255ce0af2dca775e828919f035b433b35fed
3
+ Rollup.js v2.18.1
4
+ Fri, 26 Jun 2020 19:42:28 GMT - commit 1aeb23b23ef1aafe2edcbfd5c4062dd97186f700
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -10,7 +10,7 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- var rollup_js = require('./rollup.js');
13
+ var rollup = require('./rollup.js');
14
14
 
15
15
  const commandAliases = {
16
16
  c: 'config',
@@ -27,18 +27,18 @@ const commandAliases = {
27
27
  v: 'version',
28
28
  w: 'watch'
29
29
  };
30
- function mergeOptions(config, rawCommandOptions = { external: [], globals: undefined }, defaultOnWarnHandler = rollup_js.defaultOnWarn) {
30
+ function mergeOptions(config, rawCommandOptions = { external: [], globals: undefined }, defaultOnWarnHandler = rollup.defaultOnWarn) {
31
31
  const command = getCommandOptions(rawCommandOptions);
32
32
  const inputOptions = mergeInputOptions(config, command, defaultOnWarnHandler);
33
33
  const warn = inputOptions.onwarn;
34
34
  if (command.output) {
35
35
  Object.assign(command, command.output);
36
36
  }
37
- const outputOptionsArray = rollup_js.ensureArray(config.output);
37
+ const outputOptionsArray = rollup.ensureArray(config.output);
38
38
  if (outputOptionsArray.length === 0)
39
39
  outputOptionsArray.push({});
40
40
  const outputOptions = outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, warn));
41
- rollup_js.warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'stdin', 'waitForBundleInput'), 'CLI flags', warn, /^_$|output$|config/);
41
+ rollup.warnUnknownOptions(command, Object.keys(inputOptions).concat(Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapPathTransform'), Object.keys(commandAliases), 'config', 'environment', 'plugin', 'silent', 'stdin', 'waitForBundleInput'), 'CLI flags', warn, /^_$|output$|config/);
42
42
  inputOptions.output = outputOptions;
43
43
  return inputOptions;
44
44
  }
@@ -76,7 +76,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
76
76
  moduleContext: getOption('moduleContext'),
77
77
  onwarn: getOnWarn(config, defaultOnWarnHandler),
78
78
  perf: getOption('perf'),
79
- plugins: rollup_js.ensureArray(config.plugins),
79
+ plugins: rollup.ensureArray(config.plugins),
80
80
  preserveEntrySignatures: getOption('preserveEntrySignatures'),
81
81
  preserveModules: getOption('preserveModules'),
82
82
  preserveSymlinks: getOption('preserveSymlinks'),
@@ -85,14 +85,14 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
85
85
  treeshake: getObjectOption(config, overrides, 'treeshake'),
86
86
  watch: getWatch(config, overrides, 'watch')
87
87
  };
88
- rollup_js.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
88
+ rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
89
89
  return inputOptions;
90
90
  }
91
91
  const getExternal = (config, overrides) => {
92
92
  const configExternal = config.external;
93
93
  return typeof configExternal === 'function'
94
94
  ? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.indexOf(source) !== -1
95
- : rollup_js.ensureArray(configExternal).concat(overrides.external);
95
+ : rollup.ensureArray(configExternal).concat(overrides.external);
96
96
  };
97
97
  const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
98
98
  ? warning => config.onwarn(warning, defaultOnWarnHandler)
@@ -140,16 +140,19 @@ function mergeOutputOptions(config, overrides, warn) {
140
140
  globals: getOption('globals'),
141
141
  hoistTransitiveImports: getOption('hoistTransitiveImports'),
142
142
  indent: getOption('indent'),
143
+ inlineDynamicImports: getOption('inlineDynamicImports'),
143
144
  interop: getOption('interop'),
144
145
  intro: getOption('intro'),
146
+ manualChunks: getOption('manualChunks'),
145
147
  minifyInternalExports: getOption('minifyInternalExports'),
146
148
  name: getOption('name'),
147
149
  namespaceToStringTag: getOption('namespaceToStringTag'),
148
150
  noConflict: getOption('noConflict'),
149
151
  outro: getOption('outro'),
150
152
  paths: getOption('paths'),
151
- plugins: rollup_js.ensureArray(config.plugins),
153
+ plugins: rollup.ensureArray(config.plugins),
152
154
  preferConst: getOption('preferConst'),
155
+ preserveModules: getOption('preserveModules'),
153
156
  sourcemap: getOption('sourcemap'),
154
157
  sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
155
158
  sourcemapFile: getOption('sourcemapFile'),
@@ -157,7 +160,7 @@ function mergeOutputOptions(config, overrides, warn) {
157
160
  strict: getOption('strict'),
158
161
  systemNullSetters: getOption('systemNullSetters')
159
162
  };
160
- rollup_js.warnUnknownOptions(config, Object.keys(outputOptions), 'output options', warn);
163
+ rollup.warnUnknownOptions(config, Object.keys(outputOptions), 'output options', warn);
161
164
  return outputOptions;
162
165
  }
163
166