rollup 2.51.0 → 2.52.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/CHANGELOG.md +46 -5
- package/LICENSE.md +70 -0
- package/dist/bin/rollup +3 -3
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +3 -3
- package/dist/es/shared/rollup.js +147 -91
- package/dist/es/shared/watch.js +97 -61
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +6 -1
- package/dist/rollup.js +3 -2
- package/dist/shared/index.js +78 -49
- package/dist/shared/loadConfigFile.js +16 -10
- package/dist/shared/mergeOptions.js +20 -13
- package/dist/shared/rollup.js +7139 -7080
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +21 -20
package/dist/es/rollup.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.52.1
|
|
4
|
+
Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
|
9
9
|
Released under the MIT License.
|
|
10
10
|
*/
|
|
11
|
-
export { version as VERSION, rollup, watch } from './shared/rollup.js';
|
|
11
|
+
export { version as VERSION, defineConfig, rollup, watch } from './shared/rollup.js';
|
|
12
12
|
import 'path';
|
|
13
13
|
import 'crypto';
|
|
14
14
|
import 'fs';
|
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.52.1
|
|
4
|
+
Thu, 17 Jun 2021 05:22:05 GMT - commit bef5fe8a573648f73c258ce9adf1a7ff3ffb129d
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -14,7 +14,7 @@ import * as fs from 'fs';
|
|
|
14
14
|
import { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.
|
|
17
|
+
var version$1 = "2.52.1";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -3027,9 +3027,7 @@ class LocalVariable extends Variable {
|
|
|
3027
3027
|
if (path.length > MAX_PATH_DEPTH || this.isReassigned)
|
|
3028
3028
|
return true;
|
|
3029
3029
|
return (this.init &&
|
|
3030
|
-
!(callOptions.withNew
|
|
3031
|
-
? context.instantiated
|
|
3032
|
-
: context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
3030
|
+
!(callOptions.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
3033
3031
|
this.init.hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
3034
3032
|
}
|
|
3035
3033
|
include() {
|
|
@@ -4104,9 +4102,10 @@ class Identifier extends NodeBase {
|
|
|
4104
4102
|
}
|
|
4105
4103
|
declare(kind, init) {
|
|
4106
4104
|
let variable;
|
|
4105
|
+
const { treeshake } = this.context.options;
|
|
4107
4106
|
switch (kind) {
|
|
4108
4107
|
case 'var':
|
|
4109
|
-
variable = this.scope.addDeclaration(this, this.context, init, true);
|
|
4108
|
+
variable = this.scope.addDeclaration(this, this.context, treeshake && treeshake.correctVarValueBeforeDeclaration ? UNKNOWN_EXPRESSION : init, true);
|
|
4110
4109
|
break;
|
|
4111
4110
|
case 'function':
|
|
4112
4111
|
// in strict mode, functions are only hoisted within a scope but not across block scopes
|
|
@@ -4280,9 +4279,10 @@ const INTEGER_REG_EXP = /^\d+$/;
|
|
|
4280
4279
|
class ObjectEntity extends ExpressionEntity {
|
|
4281
4280
|
// If a PropertyMap is used, this will be taken as propertiesAndGettersByKey
|
|
4282
4281
|
// and we assume there are no setters or getters
|
|
4283
|
-
constructor(properties, prototypeExpression) {
|
|
4282
|
+
constructor(properties, prototypeExpression, immutable = false) {
|
|
4284
4283
|
super();
|
|
4285
4284
|
this.prototypeExpression = prototypeExpression;
|
|
4285
|
+
this.immutable = immutable;
|
|
4286
4286
|
this.allProperties = [];
|
|
4287
4287
|
this.deoptimizedPaths = Object.create(null);
|
|
4288
4288
|
this.expressionsToBeDeoptimizedByKey = Object.create(null);
|
|
@@ -4338,7 +4338,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4338
4338
|
}
|
|
4339
4339
|
deoptimizePath(path) {
|
|
4340
4340
|
var _a;
|
|
4341
|
-
if (this.hasUnknownDeoptimizedProperty)
|
|
4341
|
+
if (this.hasUnknownDeoptimizedProperty || this.immutable)
|
|
4342
4342
|
return;
|
|
4343
4343
|
const key = path[0];
|
|
4344
4344
|
if (path.length === 1) {
|
|
@@ -4370,9 +4370,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4370
4370
|
}
|
|
4371
4371
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
4372
4372
|
var _a;
|
|
4373
|
-
if (path.length === 0) {
|
|
4374
|
-
return;
|
|
4375
|
-
}
|
|
4376
4373
|
const [key, ...subPath] = path;
|
|
4377
4374
|
if (this.hasUnknownDeoptimizedProperty ||
|
|
4378
4375
|
// single paths that are deoptimized will not become getters or setters
|
|
@@ -4399,7 +4396,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4399
4396
|
property.deoptimizeThisOnEventAtPath(event, subPath, thisParameter, recursionTracker);
|
|
4400
4397
|
}
|
|
4401
4398
|
}
|
|
4402
|
-
this.
|
|
4399
|
+
if (!this.immutable) {
|
|
4400
|
+
this.thisParametersToBeDeoptimized.add(thisParameter);
|
|
4401
|
+
}
|
|
4403
4402
|
return;
|
|
4404
4403
|
}
|
|
4405
4404
|
for (const property of relevantUnmatchableProperties) {
|
|
@@ -4423,7 +4422,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4423
4422
|
property.deoptimizeThisOnEventAtPath(event, subPath, thisParameter, recursionTracker);
|
|
4424
4423
|
}
|
|
4425
4424
|
}
|
|
4426
|
-
this.
|
|
4425
|
+
if (!this.immutable) {
|
|
4426
|
+
this.thisParametersToBeDeoptimized.add(thisParameter);
|
|
4427
|
+
}
|
|
4427
4428
|
(_a = this.prototypeExpression) === null || _a === void 0 ? void 0 : _a.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
4428
4429
|
}
|
|
4429
4430
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
@@ -4486,8 +4487,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4486
4487
|
return false;
|
|
4487
4488
|
}
|
|
4488
4489
|
for (const getter of this.unmatchableGetters) {
|
|
4489
|
-
if (getter.hasEffectsWhenAccessedAtPath(subPath, context))
|
|
4490
|
+
if (getter.hasEffectsWhenAccessedAtPath(subPath, context)) {
|
|
4490
4491
|
return true;
|
|
4492
|
+
}
|
|
4491
4493
|
}
|
|
4492
4494
|
}
|
|
4493
4495
|
else {
|
|
@@ -4520,6 +4522,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4520
4522
|
}
|
|
4521
4523
|
if (this.hasUnknownDeoptimizedProperty)
|
|
4522
4524
|
return true;
|
|
4525
|
+
// We do not need to test for unknown properties as in that case, hasUnknownDeoptimizedProperty is true
|
|
4523
4526
|
if (typeof key === 'string') {
|
|
4524
4527
|
if (this.propertiesAndSettersByKey[key]) {
|
|
4525
4528
|
const setters = this.settersByKey[key];
|
|
@@ -4532,15 +4535,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4532
4535
|
return false;
|
|
4533
4536
|
}
|
|
4534
4537
|
for (const property of this.unmatchableSetters) {
|
|
4535
|
-
if (property.hasEffectsWhenAssignedAtPath(subPath, context))
|
|
4538
|
+
if (property.hasEffectsWhenAssignedAtPath(subPath, context)) {
|
|
4536
4539
|
return true;
|
|
4537
|
-
}
|
|
4538
|
-
}
|
|
4539
|
-
else {
|
|
4540
|
-
for (const setters of Object.values(this.settersByKey).concat([this.unmatchableSetters])) {
|
|
4541
|
-
for (const setter of setters) {
|
|
4542
|
-
if (setter.hasEffectsWhenAssignedAtPath(subPath, context))
|
|
4543
|
-
return true;
|
|
4544
4540
|
}
|
|
4545
4541
|
}
|
|
4546
4542
|
}
|
|
@@ -4599,11 +4595,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4599
4595
|
}
|
|
4600
4596
|
if (!propertiesAndGettersByKey[key]) {
|
|
4601
4597
|
propertiesAndGettersByKey[key] = [property, ...unmatchablePropertiesAndGetters];
|
|
4602
|
-
if (INTEGER_REG_EXP.test(key)) {
|
|
4603
|
-
for (const integerProperty of unknownIntegerProps) {
|
|
4604
|
-
propertiesAndGettersByKey[key].push(integerProperty);
|
|
4605
|
-
}
|
|
4606
|
-
}
|
|
4607
4598
|
}
|
|
4608
4599
|
}
|
|
4609
4600
|
}
|
|
@@ -4654,7 +4645,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4654
4645
|
return UNKNOWN_EXPRESSION;
|
|
4655
4646
|
}
|
|
4656
4647
|
const expression = this.getMemberExpression(key);
|
|
4657
|
-
if (expression
|
|
4648
|
+
if (!(expression === UNKNOWN_EXPRESSION || this.immutable)) {
|
|
4658
4649
|
const expressionsToBeDeoptimized = (this.expressionsToBeDeoptimizedByKey[key] =
|
|
4659
4650
|
this.expressionsToBeDeoptimizedByKey[key] || []);
|
|
4660
4651
|
expressionsToBeDeoptimized.push(origin);
|
|
@@ -4787,7 +4778,7 @@ const OBJECT_PROTOTYPE = new ObjectEntity({
|
|
|
4787
4778
|
toLocaleString: METHOD_RETURNS_STRING,
|
|
4788
4779
|
toString: METHOD_RETURNS_STRING,
|
|
4789
4780
|
valueOf: METHOD_RETURNS_UNKNOWN
|
|
4790
|
-
}, null);
|
|
4781
|
+
}, null, true);
|
|
4791
4782
|
|
|
4792
4783
|
class ClassNode extends NodeBase {
|
|
4793
4784
|
constructor() {
|
|
@@ -5766,7 +5757,7 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
5766
5757
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
5767
5758
|
unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
|
|
5768
5759
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
5769
|
-
}, OBJECT_PROTOTYPE);
|
|
5760
|
+
}, OBJECT_PROTOTYPE, true);
|
|
5770
5761
|
|
|
5771
5762
|
class ArrayExpression extends NodeBase {
|
|
5772
5763
|
constructor() {
|
|
@@ -5801,10 +5792,14 @@ class ArrayExpression extends NodeBase {
|
|
|
5801
5792
|
const properties = [
|
|
5802
5793
|
{ key: 'length', kind: 'init', property: UNKNOWN_LITERAL_NUMBER }
|
|
5803
5794
|
];
|
|
5795
|
+
let hasSpread = false;
|
|
5804
5796
|
for (let index = 0; index < this.elements.length; index++) {
|
|
5805
5797
|
const element = this.elements[index];
|
|
5806
|
-
if (element instanceof SpreadElement) {
|
|
5807
|
-
|
|
5798
|
+
if (element instanceof SpreadElement || hasSpread) {
|
|
5799
|
+
if (element) {
|
|
5800
|
+
hasSpread = true;
|
|
5801
|
+
properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
|
|
5802
|
+
}
|
|
5808
5803
|
}
|
|
5809
5804
|
else if (!element) {
|
|
5810
5805
|
properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
|
|
@@ -6618,9 +6613,7 @@ class CallExpression extends NodeBase {
|
|
|
6618
6613
|
this.getReturnExpression().hasEffectsWhenAssignedAtPath(path, context));
|
|
6619
6614
|
}
|
|
6620
6615
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
6621
|
-
return (!(callOptions.withNew
|
|
6622
|
-
? context.instantiated
|
|
6623
|
-
: context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
6616
|
+
return (!(callOptions.withNew ? context.instantiated : context.called).trackEntityAtPathAndGetIfTracked(path, callOptions, this) &&
|
|
6624
6617
|
this.getReturnExpression().hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
6625
6618
|
}
|
|
6626
6619
|
include(context, includeChildrenRecursively) {
|
|
@@ -8326,7 +8319,11 @@ const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
|
|
|
8326
8319
|
const getRelativeUrlFromDocument = (relativePath) => getResolveUrl(`'${relativePath}', document.currentScript && document.currentScript.src || document.baseURI`);
|
|
8327
8320
|
const getGenericImportMetaMechanism = (getUrl) => (prop, chunkId) => {
|
|
8328
8321
|
const urlMechanism = getUrl(chunkId);
|
|
8329
|
-
return prop === null
|
|
8322
|
+
return prop === null
|
|
8323
|
+
? `({ url: ${urlMechanism} })`
|
|
8324
|
+
: prop === 'url'
|
|
8325
|
+
? urlMechanism
|
|
8326
|
+
: 'undefined';
|
|
8330
8327
|
};
|
|
8331
8328
|
const getUrlFromDocument = (chunkId) => `(document.currentScript && document.currentScript.src || new URL('${chunkId}', document.baseURI).href)`;
|
|
8332
8329
|
const relativeUrlMechanisms = {
|
|
@@ -9718,6 +9715,7 @@ class Module {
|
|
|
9718
9715
|
this.implicitlyLoadedBefore = new Set();
|
|
9719
9716
|
this.importDescriptions = Object.create(null);
|
|
9720
9717
|
this.importMetas = [];
|
|
9718
|
+
this.importedFromNotTreeshaken = false;
|
|
9721
9719
|
this.importers = [];
|
|
9722
9720
|
this.imports = new Set();
|
|
9723
9721
|
this.includedDynamicImporters = [];
|
|
@@ -9849,12 +9847,12 @@ class Module {
|
|
|
9849
9847
|
}
|
|
9850
9848
|
if (!this.options.treeshake || this.info.hasModuleSideEffects === 'no-treeshake') {
|
|
9851
9849
|
for (const dependency of this.dependencies) {
|
|
9852
|
-
|
|
9853
|
-
relevantDependencies.add(dependency);
|
|
9854
|
-
}
|
|
9850
|
+
relevantDependencies.add(dependency);
|
|
9855
9851
|
}
|
|
9856
9852
|
}
|
|
9857
|
-
|
|
9853
|
+
else {
|
|
9854
|
+
this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
|
|
9855
|
+
}
|
|
9858
9856
|
for (const dependency of necessaryDependencies) {
|
|
9859
9857
|
relevantDependencies.add(dependency);
|
|
9860
9858
|
}
|
|
@@ -10042,7 +10040,7 @@ class Module {
|
|
|
10042
10040
|
this.ast.include(createInclusionContext(), true);
|
|
10043
10041
|
}
|
|
10044
10042
|
isIncluded() {
|
|
10045
|
-
return this.ast.included || this.namespace.included;
|
|
10043
|
+
return this.ast.included || this.namespace.included || this.importedFromNotTreeshaken;
|
|
10046
10044
|
}
|
|
10047
10045
|
linkImports() {
|
|
10048
10046
|
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
@@ -13787,9 +13785,10 @@ function getLineInfo(input, offset) {
|
|
|
13787
13785
|
var defaultOptions = {
|
|
13788
13786
|
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
|
13789
13787
|
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
|
13790
|
-
// (2019), 11 (2020), 12 (2021), or `"latest"` (the
|
|
13791
|
-
// the library supports). This influences support
|
|
13792
|
-
// the set of reserved words, and support for
|
|
13788
|
+
// (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the
|
|
13789
|
+
// latest version the library supports). This influences support
|
|
13790
|
+
// for strict mode, the set of reserved words, and support for
|
|
13791
|
+
// new syntax features.
|
|
13793
13792
|
ecmaVersion: null,
|
|
13794
13793
|
// `sourceType` indicates the mode the code should be parsed in.
|
|
13795
13794
|
// Can be either `"script"` or `"module"`. This influences global
|
|
@@ -13816,9 +13815,13 @@ var defaultOptions = {
|
|
|
13816
13815
|
// appearing at the top of the program, and an import.meta expression
|
|
13817
13816
|
// in a script isn't considered an error.
|
|
13818
13817
|
allowImportExportEverywhere: false,
|
|
13818
|
+
// By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022.
|
|
13819
13819
|
// When enabled, await identifiers are allowed to appear at the top-level scope,
|
|
13820
13820
|
// but they are still not allowed in non-async functions.
|
|
13821
|
-
allowAwaitOutsideFunction:
|
|
13821
|
+
allowAwaitOutsideFunction: null,
|
|
13822
|
+
// When enabled, super identifiers are not constrained to
|
|
13823
|
+
// appearing in methods and do not raise an error when they appear elsewhere.
|
|
13824
|
+
allowSuperOutsideMethod: null,
|
|
13822
13825
|
// When enabled, hashbang directive in the beginning of file
|
|
13823
13826
|
// is allowed and treated as a line comment.
|
|
13824
13827
|
allowHashBang: false,
|
|
@@ -13894,6 +13897,8 @@ function getOptions(opts) {
|
|
|
13894
13897
|
|
|
13895
13898
|
if (options.allowReserved == null)
|
|
13896
13899
|
{ options.allowReserved = options.ecmaVersion < 5; }
|
|
13900
|
+
if (options.allowAwaitOutsideFunction == null)
|
|
13901
|
+
{ options.allowAwaitOutsideFunction = options.ecmaVersion >= 13; }
|
|
13897
13902
|
|
|
13898
13903
|
if (isArray(options.onToken)) {
|
|
13899
13904
|
var tokens = options.onToken;
|
|
@@ -14046,7 +14051,7 @@ prototypeAccessors.allowSuper.get = function () {
|
|
|
14046
14051
|
var ref = this.currentThisScope();
|
|
14047
14052
|
var flags = ref.flags;
|
|
14048
14053
|
var inClassFieldInit = ref.inClassFieldInit;
|
|
14049
|
-
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit
|
|
14054
|
+
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod
|
|
14050
14055
|
};
|
|
14051
14056
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
14052
14057
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
@@ -14271,13 +14276,14 @@ pp$1.isLet = function(context) {
|
|
|
14271
14276
|
// Statement) is allowed here. If context is not empty then only a Statement
|
|
14272
14277
|
// is allowed. However, `let [` is an explicit negative lookahead for
|
|
14273
14278
|
// ExpressionStatement, so special-case it first.
|
|
14274
|
-
if (nextCh === 91) { return true } // '['
|
|
14279
|
+
if (nextCh === 91 || nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true } // '[', '/', astral
|
|
14275
14280
|
if (context) { return false }
|
|
14276
14281
|
|
|
14277
14282
|
if (nextCh === 123) { return true } // '{'
|
|
14278
14283
|
if (isIdentifierStart(nextCh, true)) {
|
|
14279
14284
|
var pos = next + 1;
|
|
14280
|
-
while (isIdentifierChar(this.input.charCodeAt(pos), true)) { ++pos; }
|
|
14285
|
+
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
|
|
14286
|
+
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
|
|
14281
14287
|
var ident = this.input.slice(next, pos);
|
|
14282
14288
|
if (!keywordRelationalOperator.test(ident)) { return true }
|
|
14283
14289
|
}
|
|
@@ -14293,10 +14299,11 @@ pp$1.isAsyncFunction = function() {
|
|
|
14293
14299
|
|
|
14294
14300
|
skipWhiteSpace.lastIndex = this.pos;
|
|
14295
14301
|
var skip = skipWhiteSpace.exec(this.input);
|
|
14296
|
-
var next = this.pos + skip[0].length;
|
|
14302
|
+
var next = this.pos + skip[0].length, after;
|
|
14297
14303
|
return !lineBreak.test(this.input.slice(this.pos, next)) &&
|
|
14298
14304
|
this.input.slice(next, next + 8) === "function" &&
|
|
14299
|
-
(next + 8 === this.input.length ||
|
|
14305
|
+
(next + 8 === this.input.length ||
|
|
14306
|
+
!(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
|
|
14300
14307
|
};
|
|
14301
14308
|
|
|
14302
14309
|
// Parse a single statement.
|
|
@@ -17033,7 +17040,7 @@ var pp$8 = Parser.prototype;
|
|
|
17033
17040
|
|
|
17034
17041
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
17035
17042
|
this.parser = parser;
|
|
17036
|
-
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "");
|
|
17043
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
|
|
17037
17044
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 12 ? 12 : parser.options.ecmaVersion];
|
|
17038
17045
|
this.source = "";
|
|
17039
17046
|
this.flags = "";
|
|
@@ -18898,7 +18905,7 @@ pp$9.readWord = function() {
|
|
|
18898
18905
|
|
|
18899
18906
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
18900
18907
|
|
|
18901
|
-
var version = "8.
|
|
18908
|
+
var version = "8.4.0";
|
|
18902
18909
|
|
|
18903
18910
|
Parser.acorn = {
|
|
18904
18911
|
Parser: Parser,
|
|
@@ -19483,6 +19490,13 @@ class ModuleLoader {
|
|
|
19483
19490
|
module.dependencies.add(dependency);
|
|
19484
19491
|
dependency.importers.push(module.id);
|
|
19485
19492
|
}
|
|
19493
|
+
if (!this.options.treeshake || module.info.hasModuleSideEffects === 'no-treeshake') {
|
|
19494
|
+
for (const dependency of module.dependencies) {
|
|
19495
|
+
if (dependency instanceof Module) {
|
|
19496
|
+
dependency.importedFromNotTreeshaken = true;
|
|
19497
|
+
}
|
|
19498
|
+
}
|
|
19499
|
+
}
|
|
19486
19500
|
}
|
|
19487
19501
|
getNormalizedResolvedIdWithoutDefaults(resolveIdResult, importer, source) {
|
|
19488
19502
|
const { makeAbsoluteExternalsRelative } = this.options;
|
|
@@ -20036,10 +20050,8 @@ class Graph {
|
|
|
20036
20050
|
};
|
|
20037
20051
|
}
|
|
20038
20052
|
async generateModuleGraph() {
|
|
20039
|
-
({
|
|
20040
|
-
|
|
20041
|
-
implicitEntryModules: this.implicitEntryModules
|
|
20042
|
-
} = await this.moduleLoader.addEntryModules(normalizeEntryModules(this.options.input), true));
|
|
20053
|
+
({ entryModules: this.entryModules, implicitEntryModules: this.implicitEntryModules } =
|
|
20054
|
+
await this.moduleLoader.addEntryModules(normalizeEntryModules(this.options.input), true));
|
|
20043
20055
|
if (this.entryModules.length === 0) {
|
|
20044
20056
|
throw new Error('You must supply options.input to rollup');
|
|
20045
20057
|
}
|
|
@@ -20151,6 +20163,32 @@ function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignor
|
|
|
20151
20163
|
});
|
|
20152
20164
|
}
|
|
20153
20165
|
}
|
|
20166
|
+
const treeshakePresets = {
|
|
20167
|
+
recommended: {
|
|
20168
|
+
annotations: true,
|
|
20169
|
+
correctVarValueBeforeDeclaration: false,
|
|
20170
|
+
moduleSideEffects: () => true,
|
|
20171
|
+
propertyReadSideEffects: true,
|
|
20172
|
+
tryCatchDeoptimization: true,
|
|
20173
|
+
unknownGlobalSideEffects: false
|
|
20174
|
+
},
|
|
20175
|
+
safest: {
|
|
20176
|
+
annotations: true,
|
|
20177
|
+
correctVarValueBeforeDeclaration: true,
|
|
20178
|
+
moduleSideEffects: () => true,
|
|
20179
|
+
propertyReadSideEffects: true,
|
|
20180
|
+
tryCatchDeoptimization: true,
|
|
20181
|
+
unknownGlobalSideEffects: true
|
|
20182
|
+
},
|
|
20183
|
+
smallest: {
|
|
20184
|
+
annotations: true,
|
|
20185
|
+
correctVarValueBeforeDeclaration: false,
|
|
20186
|
+
moduleSideEffects: () => false,
|
|
20187
|
+
propertyReadSideEffects: false,
|
|
20188
|
+
tryCatchDeoptimization: false,
|
|
20189
|
+
unknownGlobalSideEffects: false
|
|
20190
|
+
}
|
|
20191
|
+
};
|
|
20154
20192
|
|
|
20155
20193
|
function normalizeInputOptions(config) {
|
|
20156
20194
|
var _a, _b, _c;
|
|
@@ -20186,7 +20224,8 @@ function normalizeInputOptions(config) {
|
|
|
20186
20224
|
return { options, unsetOptions };
|
|
20187
20225
|
}
|
|
20188
20226
|
const getOnwarn = (config) => {
|
|
20189
|
-
|
|
20227
|
+
const { onwarn } = config;
|
|
20228
|
+
return onwarn
|
|
20190
20229
|
? warning => {
|
|
20191
20230
|
warning.toString = () => {
|
|
20192
20231
|
let str = '';
|
|
@@ -20197,7 +20236,7 @@ const getOnwarn = (config) => {
|
|
|
20197
20236
|
str += warning.message;
|
|
20198
20237
|
return str;
|
|
20199
20238
|
};
|
|
20200
|
-
|
|
20239
|
+
onwarn(warning, defaultOnWarn);
|
|
20201
20240
|
}
|
|
20202
20241
|
: defaultOnWarn;
|
|
20203
20242
|
};
|
|
@@ -20209,10 +20248,7 @@ const getAcorn = (config) => ({
|
|
|
20209
20248
|
...config.acorn
|
|
20210
20249
|
});
|
|
20211
20250
|
const getAcornInjectPlugins = (config) => ensureArray(config.acornInjectPlugins);
|
|
20212
|
-
const getCache = (config) => {
|
|
20213
|
-
var _a;
|
|
20214
|
-
return ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.cache) || config.cache;
|
|
20215
|
-
};
|
|
20251
|
+
const getCache = (config) => { var _a; return ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.cache) || config.cache; };
|
|
20216
20252
|
const getIdMatcher = (option) => {
|
|
20217
20253
|
if (option === true) {
|
|
20218
20254
|
return () => true;
|
|
@@ -20286,28 +20322,44 @@ const getTreeshake = (config, warn, strictDeprecations) => {
|
|
|
20286
20322
|
if (configTreeshake === false) {
|
|
20287
20323
|
return false;
|
|
20288
20324
|
}
|
|
20289
|
-
if (
|
|
20325
|
+
if (typeof configTreeshake === 'string') {
|
|
20326
|
+
const preset = treeshakePresets[configTreeshake];
|
|
20327
|
+
if (preset) {
|
|
20328
|
+
return preset;
|
|
20329
|
+
}
|
|
20330
|
+
error(errInvalidOption('treeshake', `valid values are false, true, ${printQuotedStringList(Object.keys(treeshakePresets))}. You can also supply an object for more fine-grained control`));
|
|
20331
|
+
}
|
|
20332
|
+
let configWithPreset = {};
|
|
20333
|
+
if (typeof configTreeshake === 'object') {
|
|
20290
20334
|
if (typeof configTreeshake.pureExternalModules !== 'undefined') {
|
|
20291
20335
|
warnDeprecationWithOptions(`The "treeshake.pureExternalModules" option is deprecated. The "treeshake.moduleSideEffects" option should be used instead. "treeshake.pureExternalModules: true" is equivalent to "treeshake.moduleSideEffects: 'no-external'"`, true, warn, strictDeprecations);
|
|
20292
20336
|
}
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
|
|
20337
|
+
configWithPreset = configTreeshake;
|
|
20338
|
+
const presetName = configTreeshake.preset;
|
|
20339
|
+
if (presetName) {
|
|
20340
|
+
const preset = treeshakePresets[presetName];
|
|
20341
|
+
if (preset) {
|
|
20342
|
+
configWithPreset = { ...preset, ...configTreeshake };
|
|
20343
|
+
}
|
|
20344
|
+
else {
|
|
20345
|
+
error(errInvalidOption('treeshake.preset', `valid values are ${printQuotedStringList(Object.keys(treeshakePresets))}`));
|
|
20346
|
+
}
|
|
20347
|
+
}
|
|
20301
20348
|
}
|
|
20302
20349
|
return {
|
|
20303
|
-
annotations:
|
|
20304
|
-
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20350
|
+
annotations: configWithPreset.annotations !== false,
|
|
20351
|
+
correctVarValueBeforeDeclaration: configWithPreset.correctVarValueBeforeDeclaration === true,
|
|
20352
|
+
moduleSideEffects: typeof configTreeshake === 'object' && configTreeshake.pureExternalModules
|
|
20353
|
+
? getHasModuleSideEffects(configTreeshake.moduleSideEffects, configTreeshake.pureExternalModules)
|
|
20354
|
+
: getHasModuleSideEffects(configWithPreset.moduleSideEffects, undefined),
|
|
20355
|
+
propertyReadSideEffects: configWithPreset.propertyReadSideEffects === 'always'
|
|
20356
|
+
? 'always'
|
|
20357
|
+
: configWithPreset.propertyReadSideEffects !== false,
|
|
20358
|
+
tryCatchDeoptimization: configWithPreset.tryCatchDeoptimization !== false,
|
|
20359
|
+
unknownGlobalSideEffects: configWithPreset.unknownGlobalSideEffects !== false
|
|
20308
20360
|
};
|
|
20309
20361
|
};
|
|
20310
|
-
const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules
|
|
20362
|
+
const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules) => {
|
|
20311
20363
|
if (typeof moduleSideEffectsOption === 'boolean') {
|
|
20312
20364
|
return () => moduleSideEffectsOption;
|
|
20313
20365
|
}
|
|
@@ -20322,7 +20374,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules, w
|
|
|
20322
20374
|
return id => ids.has(id);
|
|
20323
20375
|
}
|
|
20324
20376
|
if (moduleSideEffectsOption) {
|
|
20325
|
-
|
|
20377
|
+
error(errInvalidOption('treeshake.moduleSideEffects', 'please use one of false, "no-external", a function or an array'));
|
|
20326
20378
|
}
|
|
20327
20379
|
const isPureExternalModule = getIdMatcher(pureExternalModules);
|
|
20328
20380
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
@@ -20380,11 +20432,11 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
20380
20432
|
preferConst: config.preferConst || false,
|
|
20381
20433
|
preserveModules,
|
|
20382
20434
|
preserveModulesRoot: getPreserveModulesRoot(config),
|
|
20383
|
-
sanitizeFileName:
|
|
20435
|
+
sanitizeFileName: typeof config.sanitizeFileName === 'function'
|
|
20384
20436
|
? config.sanitizeFileName
|
|
20385
20437
|
: config.sanitizeFileName === false
|
|
20386
20438
|
? id => id
|
|
20387
|
-
: sanitizeFileName
|
|
20439
|
+
: sanitizeFileName,
|
|
20388
20440
|
sourcemap: config.sourcemap || false,
|
|
20389
20441
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
20390
20442
|
sourcemapFile: config.sourcemapFile,
|
|
@@ -20397,7 +20449,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
20397
20449
|
return { options: outputOptions, unsetOptions };
|
|
20398
20450
|
}
|
|
20399
20451
|
const getFile = (config, preserveModules, inputOptions) => {
|
|
20400
|
-
const file = config
|
|
20452
|
+
const { file } = config;
|
|
20401
20453
|
if (typeof file === 'string') {
|
|
20402
20454
|
if (preserveModules) {
|
|
20403
20455
|
return error({
|
|
@@ -20440,8 +20492,7 @@ const getFormat = (config) => {
|
|
|
20440
20492
|
};
|
|
20441
20493
|
const getInlineDynamicImports = (config, inputOptions) => {
|
|
20442
20494
|
var _a;
|
|
20443
|
-
const inlineDynamicImports = ((_a = config.inlineDynamicImports) !== null && _a !== void 0 ? _a : inputOptions.inlineDynamicImports) ||
|
|
20444
|
-
false;
|
|
20495
|
+
const inlineDynamicImports = ((_a = config.inlineDynamicImports) !== null && _a !== void 0 ? _a : inputOptions.inlineDynamicImports) || false;
|
|
20445
20496
|
const { input } = inputOptions;
|
|
20446
20497
|
if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
|
|
20447
20498
|
return error({
|
|
@@ -20471,7 +20522,7 @@ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
|
20471
20522
|
return preserveModules;
|
|
20472
20523
|
};
|
|
20473
20524
|
const getPreserveModulesRoot = (config) => {
|
|
20474
|
-
const preserveModulesRoot = config
|
|
20525
|
+
const { preserveModulesRoot } = config;
|
|
20475
20526
|
if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
|
|
20476
20527
|
return undefined;
|
|
20477
20528
|
}
|
|
@@ -20521,7 +20572,7 @@ const getAddon = (config, name) => {
|
|
|
20521
20572
|
return () => configAddon || '';
|
|
20522
20573
|
};
|
|
20523
20574
|
const getDir = (config, file) => {
|
|
20524
|
-
const dir = config
|
|
20575
|
+
const { dir } = config;
|
|
20525
20576
|
if (typeof dir === 'string' && typeof file === 'string') {
|
|
20526
20577
|
return error({
|
|
20527
20578
|
code: 'INVALID_OPTION',
|
|
@@ -20613,10 +20664,7 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
20613
20664
|
}
|
|
20614
20665
|
return configManualChunks || {};
|
|
20615
20666
|
};
|
|
20616
|
-
const getMinifyInternalExports = (config, format, compact) => {
|
|
20617
|
-
var _a;
|
|
20618
|
-
return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system');
|
|
20619
|
-
};
|
|
20667
|
+
const getMinifyInternalExports = (config, format, compact) => { var _a; return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system'); };
|
|
20620
20668
|
|
|
20621
20669
|
function rollup(rawInputOptions) {
|
|
20622
20670
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -20784,6 +20832,14 @@ function writeOutputFile(outputFile, outputOptions) {
|
|
|
20784
20832
|
}
|
|
20785
20833
|
return Promise.all([writeFile(fileName, source), writeSourceMapPromise]);
|
|
20786
20834
|
}
|
|
20835
|
+
/**
|
|
20836
|
+
* Auxiliary function for defining rollup configuration
|
|
20837
|
+
* Mainly to facilitate IDE code prompts, after all, export default does not prompt, even if you add @type annotations, it is not accurate
|
|
20838
|
+
* @param options
|
|
20839
|
+
*/
|
|
20840
|
+
function defineConfig(options) {
|
|
20841
|
+
return options;
|
|
20842
|
+
}
|
|
20787
20843
|
|
|
20788
20844
|
let fsEvents;
|
|
20789
20845
|
let fsEventsImportError;
|
|
@@ -20831,4 +20887,4 @@ function watch(configs) {
|
|
|
20831
20887
|
return emitter;
|
|
20832
20888
|
}
|
|
20833
20889
|
|
|
20834
|
-
export { defaultOnWarn, ensureArray, fseventsImporter, rollup, rollupInternal, version$1 as version, warnUnknownOptions, watch };
|
|
20890
|
+
export { defaultOnWarn, defineConfig, ensureArray, errInvalidOption, error, fseventsImporter, printQuotedStringList, rollup, rollupInternal, treeshakePresets, version$1 as version, warnUnknownOptions, watch };
|