rollup 2.50.4 → 2.51.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
@@ -883,3 +883,6 @@ interface AcornNode {
883
883
  start: number;
884
884
  type: string;
885
885
  }
886
+
887
+ export function defineConfig(options: RollupOptions): RollupOptions;
888
+ export function defineConfig(options: RollupOptions[]): RollupOptions[];
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -21,6 +21,7 @@ require('events');
21
21
 
22
22
 
23
23
  exports.VERSION = rollup.version;
24
+ exports.defineConfig = rollup.defineConfig;
24
25
  exports.rollup = rollup.rollup;
25
26
  exports.watch = rollup.watch;
26
27
  //# sourceMappingURL=rollup.js.map
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -32,7 +32,7 @@ function _interopNamespaceDefault(e) {
32
32
 
33
33
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
34
 
35
- var version$1 = "2.50.4";
35
+ var version$1 = "2.51.1";
36
36
 
37
37
  function ensureArray(items) {
38
38
  if (Array.isArray(items)) {
@@ -3465,10 +3465,11 @@ const knownGlobals = {
3465
3465
  Promise: {
3466
3466
  __proto__: null,
3467
3467
  [ValueProperties]: IMPURE,
3468
- all: PF,
3468
+ all: O,
3469
3469
  prototype: O,
3470
- race: PF,
3471
- resolve: PF
3470
+ race: O,
3471
+ reject: O,
3472
+ resolve: O
3472
3473
  },
3473
3474
  propertyIsEnumerable: O,
3474
3475
  Proxy: O,
@@ -5055,8 +5056,14 @@ class SpreadElement extends NodeBase {
5055
5056
  }
5056
5057
  }
5057
5058
  hasEffects(context) {
5059
+ if (!this.deoptimized)
5060
+ this.applyDeoptimizations();
5061
+ const { propertyReadSideEffects } = this.context.options
5062
+ .treeshake;
5058
5063
  return (this.argument.hasEffects(context) ||
5059
- this.argument.hasEffectsWhenAccessedAtPath(UNKNOWN_PATH, context));
5064
+ (propertyReadSideEffects &&
5065
+ (propertyReadSideEffects === 'always' ||
5066
+ this.argument.hasEffectsWhenAccessedAtPath(UNKNOWN_PATH, context))));
5060
5067
  }
5061
5068
  applyDeoptimizations() {
5062
5069
  this.deoptimized = true;
@@ -5251,7 +5258,7 @@ class FunctionNode extends NodeBase {
5251
5258
  }
5252
5259
  }
5253
5260
  getReturnExpressionWhenCalledAtPath(path) {
5254
- return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5261
+ return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
5255
5262
  }
5256
5263
  hasEffects() {
5257
5264
  return this.id !== null && this.id.hasEffects();
@@ -5270,6 +5277,17 @@ class FunctionNode extends NodeBase {
5270
5277
  hasEffectsWhenCalledAtPath(path, callOptions, context) {
5271
5278
  if (path.length > 0)
5272
5279
  return true;
5280
+ if (this.async) {
5281
+ const { propertyReadSideEffects } = this.context.options
5282
+ .treeshake;
5283
+ const returnExpression = this.scope.getReturnExpression();
5284
+ if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
5285
+ (propertyReadSideEffects &&
5286
+ (propertyReadSideEffects === 'always' ||
5287
+ returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
5288
+ return true;
5289
+ }
5290
+ }
5273
5291
  for (const param of this.params) {
5274
5292
  if (param.hasEffects(context))
5275
5293
  return true;
@@ -6009,7 +6027,7 @@ class ArrowFunctionExpression extends NodeBase {
6009
6027
  // Arrow functions do not mutate their context
6010
6028
  deoptimizeThisOnEventAtPath() { }
6011
6029
  getReturnExpressionWhenCalledAtPath(path) {
6012
- return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
6030
+ return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
6013
6031
  }
6014
6032
  hasEffects() {
6015
6033
  return false;
@@ -6023,6 +6041,17 @@ class ArrowFunctionExpression extends NodeBase {
6023
6041
  hasEffectsWhenCalledAtPath(path, _callOptions, context) {
6024
6042
  if (path.length > 0)
6025
6043
  return true;
6044
+ if (this.async) {
6045
+ const { propertyReadSideEffects } = this.context.options
6046
+ .treeshake;
6047
+ const returnExpression = this.scope.getReturnExpression();
6048
+ if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
6049
+ (propertyReadSideEffects &&
6050
+ (propertyReadSideEffects === 'always' ||
6051
+ returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
6052
+ return true;
6053
+ }
6054
+ }
6026
6055
  for (const param of this.params) {
6027
6056
  if (param.hasEffects(context))
6028
6057
  return true;
@@ -6178,7 +6207,14 @@ class AssignmentPattern extends NodeBase {
6178
6207
 
6179
6208
  class AwaitExpression extends NodeBase {
6180
6209
  hasEffects(context) {
6181
- return !context.ignore.returnAwaitYield || this.argument.hasEffects(context);
6210
+ const { propertyReadSideEffects } = this.context.options
6211
+ .treeshake;
6212
+ return (!context.ignore.returnAwaitYield ||
6213
+ this.argument.hasEffects(context) ||
6214
+ this.argument.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
6215
+ (propertyReadSideEffects &&
6216
+ (propertyReadSideEffects === 'always' ||
6217
+ this.argument.hasEffectsWhenAccessedAtPath(['then'], context))));
6182
6218
  }
6183
6219
  include(context, includeChildrenRecursively) {
6184
6220
  if (!this.included) {
@@ -11308,6 +11344,7 @@ class Link {
11308
11344
  const sources = [];
11309
11345
  const sourcesContent = [];
11310
11346
  const names = [];
11347
+ const nameIndexMap = new Map();
11311
11348
  const mappings = [];
11312
11349
  for (const line of this.mappings) {
11313
11350
  const tracedLine = [];
@@ -11342,10 +11379,11 @@ class Link {
11342
11379
  traced.column
11343
11380
  ];
11344
11381
  if (traced.name) {
11345
- let nameIndex = names.indexOf(traced.name);
11346
- if (nameIndex === -1) {
11382
+ let nameIndex = nameIndexMap.get(traced.name);
11383
+ if (nameIndex === undefined) {
11347
11384
  nameIndex = names.length;
11348
11385
  names.push(traced.name);
11386
+ nameIndexMap.set(traced.name, nameIndex);
11349
11387
  }
11350
11388
  tracedSegment[4] = nameIndex;
11351
11389
  }
@@ -20788,6 +20826,14 @@ function writeOutputFile(outputFile, outputOptions) {
20788
20826
  }
20789
20827
  return Promise.all([writeFile(fileName, source), writeSourceMapPromise]);
20790
20828
  }
20829
+ /**
20830
+ * Auxiliary function for defining rollup configuration
20831
+ * Mainly to facilitate IDE code prompts, after all, export default does not prompt, even if you add @type annotations, it is not accurate
20832
+ * @param options
20833
+ */
20834
+ function defineConfig(options) {
20835
+ return options;
20836
+ }
20791
20837
 
20792
20838
  class WatchEmitter extends require$$0.EventEmitter {
20793
20839
  constructor() {
@@ -20812,6 +20858,7 @@ function watch(configs) {
20812
20858
  }
20813
20859
 
20814
20860
  exports.defaultOnWarn = defaultOnWarn;
20861
+ exports.defineConfig = defineConfig;
20815
20862
  exports.ensureArray = ensureArray;
20816
20863
  exports.error = error;
20817
20864
  exports.fseventsImporter = fseventsImporter;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
5
5
 
6
6
 
7
7
  https://github.com/rollup/rollup
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v2.50.4
4
- Sat, 29 May 2021 04:39:28 GMT - commit 184eb6006e0e9a7f170a9208f923af0d568a31b6
3
+ Rollup.js v2.51.1
4
+ Tue, 08 Jun 2021 05:41:03 GMT - commit 76dedd65e6059f60964684ac7c3cfb89ce5c5523
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.50.4",
3
+ "version": "2.51.1",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -15,7 +15,7 @@
15
15
  "ci:lint": "npm run lint:nofix",
16
16
  "ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all",
17
17
  "ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only",
18
- "ci:coverage": "npm run build:cjs && nyc --reporter lcovonly mocha",
18
+ "ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha",
19
19
  "lint": "npx eslint . --fix --cache && npm run lint:markdown",
20
20
  "lint:nofix": "npx eslint . && npm run lint:markdown",
21
21
  "lint:markdown": "markdownlint --config markdownlint.json docs/**/*.md",