rollup 1.12.2 → 1.12.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 1.12.3
4
+ *2019-05-19*
5
+
6
+ ### Bug Fixes
7
+ * Prevent duplicate imports when exports are reexported as default exports (#2866)
8
+
9
+ ### Pull Requests
10
+ * [#2755](https://github.com/rollup/rollup/pull/2755): Enable TypeScript strictNullChecks (@edsrzf)
11
+ * [#2866](https://github.com/rollup/rollup/pull/2866): Properly deduplicate reexported default exports (@lukastaegert)
12
+
3
13
  ## 1.12.2
4
14
  *2019-05-17*
5
15
 
package/bin/rollup CHANGED
@@ -223,7 +223,7 @@ function isNumber(x) {
223
223
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
224
224
  }
225
225
 
226
- var version = "1.12.2";
226
+ var version = "1.12.3";
227
227
 
228
228
  const createGetOption = (config, command) => (name, defaultValue) => command[name] !== undefined
229
229
  ? command[name]
@@ -264,7 +264,11 @@ const getExternal = (config, command) => {
264
264
  const configExternal = config.external;
265
265
  return typeof configExternal === 'function'
266
266
  ? (id, ...rest) => configExternal(id, ...rest) || command.external.indexOf(id) !== -1
267
- : (configExternal || []).concat(command.external);
267
+ : (typeof config.external === 'string'
268
+ ? [configExternal]
269
+ : Array.isArray(configExternal)
270
+ ? configExternal
271
+ : []).concat(command.external);
268
272
  };
269
273
  const commandAliases = {
270
274
  c: 'config',
@@ -310,22 +314,21 @@ function addUnknownOptionErrors(errors, options, validOptions, optionType, ignor
310
314
  errors.push(`Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${validOptions.sort().join(', ')}`);
311
315
  }
312
316
  function getCommandOptions(rawCommandOptions) {
313
- const command = Object.assign({}, rawCommandOptions);
314
- command.external = rawCommandOptions.external ? rawCommandOptions.external.split(',') : [];
315
- if (rawCommandOptions.globals) {
316
- command.globals = Object.create(null);
317
- rawCommandOptions.globals.split(',').forEach((str) => {
318
- const names = str.split(':');
319
- command.globals[names[0]] = names[1];
320
- // Add missing Module IDs to external.
321
- if (command.external.indexOf(names[0]) === -1) {
322
- command.external.push(names[0]);
323
- }
324
- });
325
- }
326
- return command;
317
+ const external = rawCommandOptions.external && typeof rawCommandOptions.external === 'string'
318
+ ? rawCommandOptions.external.split(',')
319
+ : [];
320
+ return Object.assign({}, rawCommandOptions, { external, globals: typeof rawCommandOptions.globals === 'string'
321
+ ? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => {
322
+ const [id, variableName] = globalDefinition.split(':');
323
+ globals[id] = variableName;
324
+ if (external.indexOf(id) === -1) {
325
+ external.push(id);
326
+ }
327
+ return globals;
328
+ }, Object.create(null))
329
+ : undefined });
327
330
  }
328
- function getInputOptions(config, command = {}, defaultOnWarnHandler) {
331
+ function getInputOptions(config, command = { external: [], globals: undefined }, defaultOnWarnHandler) {
329
332
  const getOption = createGetOption(config, command);
330
333
  const inputOptions = {
331
334
  acorn: config.acorn,
@@ -516,7 +519,7 @@ function handleError(err, recover = false) {
516
519
  stderr(turbocolor.cyan(err.url));
517
520
  }
518
521
  if (err.loc) {
519
- stderr(`${relativeId(err.loc.file || err.id)} (${err.loc.line}:${err.loc.column})`);
522
+ stderr(`${relativeId((err.loc.file || err.id))} (${err.loc.line}:${err.loc.column})`);
520
523
  }
521
524
  else if (err.id) {
522
525
  stderr(relativeId(err.id));
@@ -563,7 +566,8 @@ function batchWarnings() {
563
566
  return -1;
564
567
  if (deferredHandlers[b])
565
568
  return 1;
566
- return allWarnings.get(b).length - allWarnings.get(a).length;
569
+ return (allWarnings.get(b).length -
570
+ allWarnings.get(a).length);
567
571
  });
568
572
  codes.forEach(code => {
569
573
  const handler = deferredHandlers[code];
@@ -939,9 +943,11 @@ function printTimings(timings) {
939
943
  function build(inputOptions, outputOptions, warnings, silent = false) {
940
944
  const useStdout = !outputOptions[0].file && !outputOptions[0].dir;
941
945
  const start = Date.now();
942
- const files = useStdout ? ['stdout'] : outputOptions.map(t => relativeId(t.file || t.dir));
946
+ const files = useStdout
947
+ ? ['stdout']
948
+ : outputOptions.map(t => relativeId(t.file || t.dir));
943
949
  if (!silent) {
944
- let inputFiles;
950
+ let inputFiles = undefined;
945
951
  if (typeof inputOptions.input === 'string') {
946
952
  inputFiles = inputOptions.input;
947
953
  }
@@ -974,7 +980,8 @@ function build(inputOptions, outputOptions, warnings, silent = false) {
974
980
  else {
975
981
  source = file.code;
976
982
  if (output.sourcemap === 'inline') {
977
- source += `\n//# ${SOURCEMAPPING_URL$1}=${file.map.toUrl()}\n`;
983
+ source += `\n//# ${SOURCEMAPPING_URL$1}=${file
984
+ .map.toUrl()}\n`;
978
985
  }
979
986
  }
980
987
  if (outputs.length > 1)