rollup 0.63.4 → 0.63.5

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,13 @@
1
1
  # rollup changelog
2
2
 
3
+ ## 0.63.5
4
+ *2018-08-01*
5
+ * Ensure onwrite plugin hooks execute in sequence ([#2364](https://github.com/rollup/rollup/pull/2364))
6
+ * Always warn when no name is provided for a global module ([#2359](https://github.com/rollup/rollup/pull/2359))
7
+ * Add utility type for user created plugins ([#2355](https://github.com/rollup/rollup/pull/2355))
8
+ * Remove deprecated es6 format from types ([#2349](https://github.com/rollup/rollup/pull/2349))
9
+ * Mark inlineDynamicImports as optional in types ([#2348](https://github.com/rollup/rollup/pull/2348))
10
+
3
11
  ## 0.63.4
4
12
  *2018-07-20*
5
13
  * Use turbocolor instead of chalk ([#2339](https://github.com/rollup/rollup/pull/2339))
package/bin/rollup CHANGED
@@ -251,7 +251,7 @@ function isNumber (x) {
251
251
  return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
252
252
  }
253
253
 
254
- var version = "0.63.4";
254
+ var version = "0.63.5";
255
255
 
256
256
  const __assign = Object.assign || function (target) {
257
257
  for (var source, i = 1; i < arguments.length; i++) {
@@ -1113,13 +1113,7 @@ var SOURCEMAPPING_URL$1 = SOURCEMAPPING_URL;
1113
1113
 
1114
1114
  function printTimings(timings) {
1115
1115
  Object.keys(timings).forEach(function (label) {
1116
- var color = turbocolor_1;
1117
- if (label[0] === '#') {
1118
- color = color.bold;
1119
- if (label[1] !== '#') {
1120
- color = color.underline;
1121
- }
1122
- }
1116
+ var color = label[0] === '#' ? (label[1] !== '#' ? turbocolor_1.underline : turbocolor_1.bold) : function (text) { return text; };
1123
1117
  console.info(color(label + ": " + timings[label].toFixed(0) + "ms"));
1124
1118
  });
1125
1119
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
- Rollup.js v0.63.4
3
- Fri, 20 Jul 2018 15:24:16 GMT - commit 738f2fc3661fad2bb3ed75c09a7d649846133d38
2
+ Rollup.js v0.63.5
3
+ Wed, 01 Aug 2018 07:02:50 GMT - commit dc9f3476a210231f02a4e6f4c66bc4f4979000bd
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -13867,10 +13867,16 @@
13867
13867
  }
13868
13868
 
13869
13869
  function getGlobalName(module, globals, graph, hasExports) {
13870
- if (typeof globals === 'function')
13871
- return globals(module.id);
13872
- if (globals)
13873
- return globals[module.id];
13870
+ var globalName;
13871
+ if (typeof globals === 'function') {
13872
+ globalName = globals(module.id);
13873
+ }
13874
+ else if (globals) {
13875
+ globalName = globals[module.id];
13876
+ }
13877
+ if (globalName) {
13878
+ return globalName;
13879
+ }
13874
13880
  if (hasExports) {
13875
13881
  graph.warn({
13876
13882
  code: 'MISSING_GLOBAL_NAME',
@@ -21980,6 +21986,21 @@
21980
21986
  return deprecations;
21981
21987
  }
21982
21988
 
21989
+ function mapSequence(array, fn) {
21990
+ var results = [];
21991
+ var promise = Promise.resolve();
21992
+ function next(member, i) {
21993
+ return Promise.resolve(fn(member)).then(function (value) { return (results[i] = value); });
21994
+ }
21995
+ var _loop_1 = function (i) {
21996
+ promise = promise.then(function () { return next(array[i], i); });
21997
+ };
21998
+ for (var i = 0; i < array.length; i += 1) {
21999
+ _loop_1(i);
22000
+ }
22001
+ return promise.then(function () { return results; });
22002
+ }
22003
+
21983
22004
  function addDeprecations(deprecations, warn) {
21984
22005
  var message = "The following options have been renamed \u2014 please update your config: " + deprecations
21985
22006
  .map(function (option) { return option.old + " -> " + option.new; })
@@ -22304,13 +22325,13 @@
22304
22325
  message: 'You must specify output.file.'
22305
22326
  });
22306
22327
  }
22307
- return generate(outputOptions, true).then(function (result) {
22308
- return Promise.all(Object.keys(result).map(function (chunkId) {
22309
- return writeOutputFile(graph_1, chunkId, result[chunkId], outputOptions);
22328
+ return generate(outputOptions, true).then(function (outputBundle) {
22329
+ return Promise.all(Object.keys(outputBundle).map(function (chunkId) {
22330
+ return writeOutputFile(graph_1, result, chunkId, outputBundle[chunkId], outputOptions);
22310
22331
  })).then(function () {
22311
22332
  return inputOptions_1.experimentalCodeSplitting
22312
- ? { output: result }
22313
- : result[chunks[0].id];
22333
+ ? { output: outputBundle }
22334
+ : outputBundle[chunks[0].id];
22314
22335
  });
22315
22336
  });
22316
22337
  })
@@ -22332,7 +22353,7 @@
22332
22353
  function isOutputChunk(file) {
22333
22354
  return typeof file.code === 'string';
22334
22355
  }
22335
- function writeOutputFile(graph, outputFileName, outputFile, outputOptions) {
22356
+ function writeOutputFile(graph, build, outputFileName, outputFile, outputOptions) {
22336
22357
  var filename = resolve(outputOptions.dir || dirname(outputOptions.file), outputFileName);
22337
22358
  var writeSourceMapPromise;
22338
22359
  var source;
@@ -22357,11 +22378,9 @@
22357
22378
  .then(function () { return writeSourceMapPromise; })
22358
22379
  .then(function () {
22359
22380
  return isOutputChunk(outputFile) &&
22360
- Promise.all(graph.plugins
22361
- .filter(function (plugin) { return plugin.onwrite; })
22362
- .map(function (plugin) {
22363
- return plugin.onwrite.call(graph.pluginContext, __assign({ bundle: outputFile }, outputOptions), outputFile);
22364
- }));
22381
+ mapSequence(graph.plugins.filter(function (plugin) { return plugin.onwrite; }), function (plugin) {
22382
+ return Promise.resolve(plugin.onwrite.call(graph.pluginContext, __assign({ bundle: build }, outputOptions), outputFile));
22383
+ });
22365
22384
  })
22366
22385
  .then(function () { });
22367
22386
  }
@@ -22391,7 +22410,7 @@
22391
22410
  return outputOptions;
22392
22411
  }
22393
22412
 
22394
- var version$1 = "0.63.4";
22413
+ var version$1 = "0.63.5";
22395
22414
 
22396
22415
  exports.rollup = rollup;
22397
22416
  exports.VERSION = version$1;
package/dist/rollup.d.ts CHANGED
@@ -148,6 +148,18 @@ export type ResolveDynamicImportHook = (
148
148
 
149
149
  export type AddonHook = string | ((this: PluginContext) => string | Promise<string>);
150
150
 
151
+ /**
152
+ * use this type for plugin annotation
153
+ * @example
154
+ * ```ts
155
+ * interface Options {
156
+ * ...
157
+ * }
158
+ * const myPlugin: PluginImpl<Options> = (options = {}) => { ... }
159
+ * ```
160
+ */
161
+ export type PluginImpl<O extends object = object> = (options?: O) => Plugin;
162
+
151
163
  export interface Plugin {
152
164
  name: string;
153
165
  options?: (options: InputOptions) => InputOptions | void | null;
@@ -213,7 +225,7 @@ export interface InputOptions {
213
225
  experimentalCodeSplitting?: boolean;
214
226
  experimentalDynamicImport?: boolean;
215
227
  experimentalTopLevelAwait?: boolean;
216
- inlineDynamicImports: boolean;
228
+ inlineDynamicImports?: boolean;
217
229
  preserveSymlinks?: boolean;
218
230
  experimentalPreserveModules?: boolean;
219
231
  optimizeChunks?: boolean;
@@ -233,7 +245,7 @@ export interface InputOptions {
233
245
  resolveExternal?: any;
234
246
  }
235
247
 
236
- export type ModuleFormat = 'amd' | 'cjs' | 'system' | 'es' | 'esm' | 'es6' | 'iife' | 'umd';
248
+ export type ModuleFormat = 'amd' | 'cjs' | 'system' | 'es' | 'esm' | 'iife' | 'umd';
237
249
 
238
250
  export type OptionsPaths = Record<string, string> | ((id: string) => string);
239
251
 
package/dist/rollup.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- Rollup.js v0.63.4
3
- Fri, 20 Jul 2018 15:24:16 GMT - commit 738f2fc3661fad2bb3ed75c09a7d649846133d38
2
+ Rollup.js v0.63.5
3
+ Wed, 01 Aug 2018 07:02:50 GMT - commit dc9f3476a210231f02a4e6f4c66bc4f4979000bd
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -13846,10 +13846,16 @@ function transformChunk(graph, chunk, code, sourcemapChain, options) {
13846
13846
  }
13847
13847
 
13848
13848
  function getGlobalName(module, globals, graph, hasExports) {
13849
- if (typeof globals === 'function')
13850
- return globals(module.id);
13851
- if (globals)
13852
- return globals[module.id];
13849
+ var globalName;
13850
+ if (typeof globals === 'function') {
13851
+ globalName = globals(module.id);
13852
+ }
13853
+ else if (globals) {
13854
+ globalName = globals[module.id];
13855
+ }
13856
+ if (globalName) {
13857
+ return globalName;
13858
+ }
13853
13859
  if (hasExports) {
13854
13860
  graph.warn({
13855
13861
  code: 'MISSING_GLOBAL_NAME',
@@ -21959,6 +21965,21 @@ function deprecate(config, command, deprecateConfig) {
21959
21965
  return deprecations;
21960
21966
  }
21961
21967
 
21968
+ function mapSequence(array, fn) {
21969
+ var results = [];
21970
+ var promise = Promise.resolve();
21971
+ function next(member, i) {
21972
+ return Promise.resolve(fn(member)).then(function (value) { return (results[i] = value); });
21973
+ }
21974
+ var _loop_1 = function (i) {
21975
+ promise = promise.then(function () { return next(array[i], i); });
21976
+ };
21977
+ for (var i = 0; i < array.length; i += 1) {
21978
+ _loop_1(i);
21979
+ }
21980
+ return promise.then(function () { return results; });
21981
+ }
21982
+
21962
21983
  function addDeprecations(deprecations, warn) {
21963
21984
  var message = "The following options have been renamed \u2014 please update your config: " + deprecations
21964
21985
  .map(function (option) { return option.old + " -> " + option.new; })
@@ -22286,13 +22307,13 @@ function rollup(rawInputOptions) {
22286
22307
  message: 'You must specify output.file.'
22287
22308
  });
22288
22309
  }
22289
- return generate(outputOptions, true).then(function (result) {
22290
- return Promise.all(Object.keys(result).map(function (chunkId) {
22291
- return writeOutputFile(graph_1, chunkId, result[chunkId], outputOptions);
22310
+ return generate(outputOptions, true).then(function (outputBundle) {
22311
+ return Promise.all(Object.keys(outputBundle).map(function (chunkId) {
22312
+ return writeOutputFile(graph_1, result, chunkId, outputBundle[chunkId], outputOptions);
22292
22313
  })).then(function () {
22293
22314
  return inputOptions_1.experimentalCodeSplitting
22294
- ? { output: result }
22295
- : result[chunks[0].id];
22315
+ ? { output: outputBundle }
22316
+ : outputBundle[chunks[0].id];
22296
22317
  });
22297
22318
  });
22298
22319
  })
@@ -22314,7 +22335,7 @@ function rollup(rawInputOptions) {
22314
22335
  function isOutputChunk(file) {
22315
22336
  return typeof file.code === 'string';
22316
22337
  }
22317
- function writeOutputFile(graph, outputFileName, outputFile, outputOptions) {
22338
+ function writeOutputFile(graph, build, outputFileName, outputFile, outputOptions) {
22318
22339
  var filename = resolve(outputOptions.dir || dirname(outputOptions.file), outputFileName);
22319
22340
  var writeSourceMapPromise;
22320
22341
  var source;
@@ -22339,11 +22360,9 @@ function writeOutputFile(graph, outputFileName, outputFile, outputOptions) {
22339
22360
  .then(function () { return writeSourceMapPromise; })
22340
22361
  .then(function () {
22341
22362
  return isOutputChunk(outputFile) &&
22342
- Promise.all(graph.plugins
22343
- .filter(function (plugin) { return plugin.onwrite; })
22344
- .map(function (plugin) {
22345
- return plugin.onwrite.call(graph.pluginContext, __assign({ bundle: outputFile }, outputOptions), outputFile);
22346
- }));
22363
+ mapSequence(graph.plugins.filter(function (plugin) { return plugin.onwrite; }), function (plugin) {
22364
+ return Promise.resolve(plugin.onwrite.call(graph.pluginContext, __assign({ bundle: build }, outputOptions), outputFile));
22365
+ });
22347
22366
  })
22348
22367
  .then(function () { });
22349
22368
  }
@@ -25847,21 +25866,6 @@ function isRegexp$1 ( val ) {
25847
25866
  return val instanceof RegExp;
25848
25867
  }
25849
25868
 
25850
- function mapSequence(array, fn) {
25851
- var results = [];
25852
- var promise = Promise.resolve();
25853
- function next(member, i) {
25854
- return Promise.resolve(fn(member)).then(function (value) { return (results[i] = value); });
25855
- }
25856
- var _loop_1 = function (i) {
25857
- promise = promise.then(function () { return next(array[i], i); });
25858
- };
25859
- for (var i = 0; i < array.length; i += 1) {
25860
- _loop_1(i);
25861
- }
25862
- return promise.then(function () { return results; });
25863
- }
25864
-
25865
25869
  var modules = {};
25866
25870
 
25867
25871
  var getModule = function(dir) {
@@ -26217,7 +26221,7 @@ function watch$1(configs) {
26217
26221
  return new Watcher(configs);
26218
26222
  }
26219
26223
 
26220
- var version$1 = "0.63.4";
26224
+ var version$1 = "0.63.5";
26221
26225
 
26222
26226
  export { rollup, watch$1 as watch, version$1 as VERSION };
26223
26227
  //# sourceMappingURL=rollup.es.js.map
package/dist/rollup.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
- Rollup.js v0.63.4
3
- Fri, 20 Jul 2018 15:24:16 GMT - commit 738f2fc3661fad2bb3ed75c09a7d649846133d38
2
+ Rollup.js v0.63.5
3
+ Wed, 01 Aug 2018 07:02:50 GMT - commit dc9f3476a210231f02a4e6f4c66bc4f4979000bd
4
4
 
5
5
 
6
6
  https://github.com/rollup/rollup
@@ -13853,10 +13853,16 @@ function transformChunk(graph, chunk, code, sourcemapChain, options) {
13853
13853
  }
13854
13854
 
13855
13855
  function getGlobalName(module, globals, graph, hasExports) {
13856
- if (typeof globals === 'function')
13857
- return globals(module.id);
13858
- if (globals)
13859
- return globals[module.id];
13856
+ var globalName;
13857
+ if (typeof globals === 'function') {
13858
+ globalName = globals(module.id);
13859
+ }
13860
+ else if (globals) {
13861
+ globalName = globals[module.id];
13862
+ }
13863
+ if (globalName) {
13864
+ return globalName;
13865
+ }
13860
13866
  if (hasExports) {
13861
13867
  graph.warn({
13862
13868
  code: 'MISSING_GLOBAL_NAME',
@@ -21966,6 +21972,21 @@ function deprecate(config, command, deprecateConfig) {
21966
21972
  return deprecations;
21967
21973
  }
21968
21974
 
21975
+ function mapSequence(array, fn) {
21976
+ var results = [];
21977
+ var promise = Promise.resolve();
21978
+ function next(member, i) {
21979
+ return Promise.resolve(fn(member)).then(function (value) { return (results[i] = value); });
21980
+ }
21981
+ var _loop_1 = function (i) {
21982
+ promise = promise.then(function () { return next(array[i], i); });
21983
+ };
21984
+ for (var i = 0; i < array.length; i += 1) {
21985
+ _loop_1(i);
21986
+ }
21987
+ return promise.then(function () { return results; });
21988
+ }
21989
+
21969
21990
  function addDeprecations(deprecations, warn) {
21970
21991
  var message = "The following options have been renamed \u2014 please update your config: " + deprecations
21971
21992
  .map(function (option) { return option.old + " -> " + option.new; })
@@ -22293,13 +22314,13 @@ function rollup(rawInputOptions) {
22293
22314
  message: 'You must specify output.file.'
22294
22315
  });
22295
22316
  }
22296
- return generate(outputOptions, true).then(function (result) {
22297
- return Promise.all(Object.keys(result).map(function (chunkId) {
22298
- return writeOutputFile(graph_1, chunkId, result[chunkId], outputOptions);
22317
+ return generate(outputOptions, true).then(function (outputBundle) {
22318
+ return Promise.all(Object.keys(outputBundle).map(function (chunkId) {
22319
+ return writeOutputFile(graph_1, result, chunkId, outputBundle[chunkId], outputOptions);
22299
22320
  })).then(function () {
22300
22321
  return inputOptions_1.experimentalCodeSplitting
22301
- ? { output: result }
22302
- : result[chunks[0].id];
22322
+ ? { output: outputBundle }
22323
+ : outputBundle[chunks[0].id];
22303
22324
  });
22304
22325
  });
22305
22326
  })
@@ -22321,7 +22342,7 @@ function rollup(rawInputOptions) {
22321
22342
  function isOutputChunk(file) {
22322
22343
  return typeof file.code === 'string';
22323
22344
  }
22324
- function writeOutputFile(graph, outputFileName, outputFile, outputOptions) {
22345
+ function writeOutputFile(graph, build, outputFileName, outputFile, outputOptions) {
22325
22346
  var filename = path.resolve(outputOptions.dir || path.dirname(outputOptions.file), outputFileName);
22326
22347
  var writeSourceMapPromise;
22327
22348
  var source;
@@ -22346,11 +22367,9 @@ function writeOutputFile(graph, outputFileName, outputFile, outputOptions) {
22346
22367
  .then(function () { return writeSourceMapPromise; })
22347
22368
  .then(function () {
22348
22369
  return isOutputChunk(outputFile) &&
22349
- Promise.all(graph.plugins
22350
- .filter(function (plugin) { return plugin.onwrite; })
22351
- .map(function (plugin) {
22352
- return plugin.onwrite.call(graph.pluginContext, __assign({ bundle: outputFile }, outputOptions), outputFile);
22353
- }));
22370
+ mapSequence(graph.plugins.filter(function (plugin) { return plugin.onwrite; }), function (plugin) {
22371
+ return Promise.resolve(plugin.onwrite.call(graph.pluginContext, __assign({ bundle: build }, outputOptions), outputFile));
22372
+ });
22354
22373
  })
22355
22374
  .then(function () { });
22356
22375
  }
@@ -25854,21 +25873,6 @@ function isRegexp$1 ( val ) {
25854
25873
  return val instanceof RegExp;
25855
25874
  }
25856
25875
 
25857
- function mapSequence(array, fn) {
25858
- var results = [];
25859
- var promise = Promise.resolve();
25860
- function next(member, i) {
25861
- return Promise.resolve(fn(member)).then(function (value) { return (results[i] = value); });
25862
- }
25863
- var _loop_1 = function (i) {
25864
- promise = promise.then(function () { return next(array[i], i); });
25865
- };
25866
- for (var i = 0; i < array.length; i += 1) {
25867
- _loop_1(i);
25868
- }
25869
- return promise.then(function () { return results; });
25870
- }
25871
-
25872
25876
  var modules = {};
25873
25877
 
25874
25878
  var getModule = function(dir) {
@@ -26224,7 +26228,7 @@ function watch(configs) {
26224
26228
  return new Watcher(configs);
26225
26229
  }
26226
26230
 
26227
- var version$1 = "0.63.4";
26231
+ var version$1 = "0.63.5";
26228
26232
 
26229
26233
  exports.rollup = rollup;
26230
26234
  exports.watch = watch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "0.63.4",
3
+ "version": "0.63.5",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/rollup.es.js",
@@ -117,10 +117,15 @@
117
117
  "README.md"
118
118
  ],
119
119
  "lint-staged": {
120
- "*.ts": [
120
+ "{src,bin,browser,typings}/**/*.ts": [
121
121
  "tslint --project . --fix",
122
122
  "prettier --write",
123
123
  "git add"
124
+ ],
125
+ "test/**/*.ts": [
126
+ "tslint --project test/typescript --fix",
127
+ "prettier --write",
128
+ "git add"
124
129
  ]
125
130
  }
126
131
  }