rollup 2.45.1 → 2.48.0
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 +52 -0
- package/LICENSE.md +1 -109
- package/README.md +9 -10
- package/dist/bin/rollup +37 -12
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +538 -632
- package/dist/es/shared/watch.js +42 -21
- 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 +2 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +30 -10
- package/dist/shared/loadConfigFile.js +8 -18
- package/dist/shared/mergeOptions.js +3 -2
- package/dist/shared/rollup.js +527 -621
- package/dist/shared/watch-cli.js +19 -32
- package/dist/shared/watch.js +13 -13
- package/package.json +24 -30
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
Sat,
|
|
3
|
+
Rollup.js v2.48.0
|
|
4
|
+
Sat, 15 May 2021 04:50:11 GMT - commit 07b3a02069594147665daa95d3fa3e041a82b2d0
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -32,7 +32,7 @@ function _interopNamespaceDefaultOnly(e) {
|
|
|
32
32
|
|
|
33
33
|
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
34
34
|
|
|
35
|
-
var version$1 = "2.
|
|
35
|
+
var version$1 = "2.48.0";
|
|
36
36
|
|
|
37
37
|
function ensureArray(items) {
|
|
38
38
|
if (Array.isArray(items)) {
|
|
@@ -74,14 +74,6 @@ function normalize(path) {
|
|
|
74
74
|
return path.replace(/\\/g, '/');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function sanitizeFileName(name) {
|
|
78
|
-
const match = /^[a-z]:/i.exec(name);
|
|
79
|
-
const driveLetter = match ? match[0] : "";
|
|
80
|
-
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
81
|
-
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
82
|
-
return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
77
|
function getAliasName(id) {
|
|
86
78
|
const base = path.basename(id);
|
|
87
79
|
return base.substr(0, base.length - path.extname(id).length);
|
|
@@ -91,12 +83,9 @@ function relativeId(id) {
|
|
|
91
83
|
return id;
|
|
92
84
|
return path.relative(path.resolve(), id);
|
|
93
85
|
}
|
|
94
|
-
function
|
|
95
|
-
//
|
|
96
|
-
return
|
|
97
|
-
!(name[0] === '.' && (name[1] === '/' || name[1] === '.')) &&
|
|
98
|
-
sanitizeFileName(name) === name &&
|
|
99
|
-
!isAbsolute(name));
|
|
86
|
+
function isPathFragment(name) {
|
|
87
|
+
// starting with "/", "./", "../", "C:/"
|
|
88
|
+
return name[0] === '/' || name[0] === '.' && (name[1] === '/' || name[1] === '.') || isAbsolute(name);
|
|
100
89
|
}
|
|
101
90
|
|
|
102
91
|
let fsEvents;
|
|
@@ -123,21 +112,6 @@ var fseventsImporter = {
|
|
|
123
112
|
getFsEvents: getFsEvents
|
|
124
113
|
};
|
|
125
114
|
|
|
126
|
-
function getAugmentedNamespace(n) {
|
|
127
|
-
if (n.__esModule) return n;
|
|
128
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
129
|
-
Object.keys(n).forEach(function (k) {
|
|
130
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
131
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function () {
|
|
134
|
-
return n[k];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
return a;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
115
|
var charToInteger = {};
|
|
142
116
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
143
117
|
for (var i = 0; i < chars$1.length; i++) {
|
|
@@ -4473,14 +4447,18 @@ class NamespaceVariable extends Variable {
|
|
|
4473
4447
|
this.references.push(identifier);
|
|
4474
4448
|
this.name = identifier.name;
|
|
4475
4449
|
}
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
// the reassignment to the right variable. This means we lost track of this variable and thus
|
|
4479
|
-
// need to reassign all exports.
|
|
4480
|
-
deoptimizePath() {
|
|
4450
|
+
deoptimizePath(path) {
|
|
4451
|
+
var _a;
|
|
4481
4452
|
const memberVariables = this.getMemberVariables();
|
|
4482
|
-
|
|
4483
|
-
|
|
4453
|
+
const memberPath = path.length <= 1 ? UNKNOWN_PATH : path.slice(1);
|
|
4454
|
+
const key = path[0];
|
|
4455
|
+
if (typeof key === 'string') {
|
|
4456
|
+
(_a = memberVariables[key]) === null || _a === void 0 ? void 0 : _a.deoptimizePath(memberPath);
|
|
4457
|
+
}
|
|
4458
|
+
else {
|
|
4459
|
+
for (const key of Object.keys(memberVariables)) {
|
|
4460
|
+
memberVariables[key].deoptimizePath(memberPath);
|
|
4461
|
+
}
|
|
4484
4462
|
}
|
|
4485
4463
|
}
|
|
4486
4464
|
getMemberVariables() {
|
|
@@ -4490,7 +4468,10 @@ class NamespaceVariable extends Variable {
|
|
|
4490
4468
|
const memberVariables = Object.create(null);
|
|
4491
4469
|
for (const name of this.context.getExports().concat(this.context.getReexports())) {
|
|
4492
4470
|
if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
|
|
4493
|
-
|
|
4471
|
+
const exportedVariable = this.context.traceExport(name);
|
|
4472
|
+
if (exportedVariable) {
|
|
4473
|
+
memberVariables[name] = exportedVariable;
|
|
4474
|
+
}
|
|
4494
4475
|
}
|
|
4495
4476
|
}
|
|
4496
4477
|
return (this.memberVariables = memberVariables);
|
|
@@ -4649,6 +4630,18 @@ function makeLegal(str) {
|
|
|
4649
4630
|
return str || '_';
|
|
4650
4631
|
}
|
|
4651
4632
|
|
|
4633
|
+
function printQuotedStringList(list, verbs) {
|
|
4634
|
+
const isSingleItem = list.length <= 1;
|
|
4635
|
+
const quotedList = list.map(item => `"${item}"`);
|
|
4636
|
+
let output = isSingleItem
|
|
4637
|
+
? quotedList[0]
|
|
4638
|
+
: `${quotedList.slice(0, -1).join(', ')} and ${quotedList.slice(-1)[0]}`;
|
|
4639
|
+
if (verbs) {
|
|
4640
|
+
output += ` ${isSingleItem ? verbs[0] : verbs[1]}`;
|
|
4641
|
+
}
|
|
4642
|
+
return output;
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4652
4645
|
class ExternalModule {
|
|
4653
4646
|
constructor(options, id, hasModuleSideEffects, meta, renormalizeRenderPath) {
|
|
4654
4647
|
this.options = options;
|
|
@@ -4726,17 +4719,20 @@ class ExternalModule {
|
|
|
4726
4719
|
});
|
|
4727
4720
|
if (unused.length === 0)
|
|
4728
4721
|
return;
|
|
4729
|
-
const
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
.
|
|
4734
|
-
|
|
4722
|
+
const importersSet = new Set();
|
|
4723
|
+
for (const name of unused) {
|
|
4724
|
+
const { importers } = this.declarations[name].module;
|
|
4725
|
+
for (const importer of importers) {
|
|
4726
|
+
importersSet.add(importer);
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
const importersArray = [...importersSet];
|
|
4735
4730
|
this.options.onwarn({
|
|
4736
4731
|
code: 'UNUSED_EXTERNAL_IMPORT',
|
|
4737
|
-
message: `${
|
|
4732
|
+
message: `${printQuotedStringList(unused, ['is', 'are'])} imported from external module "${this.id}" but never used in ${printQuotedStringList(importersArray.map(importer => relativeId(importer)))}.`,
|
|
4738
4733
|
names: unused,
|
|
4739
|
-
source: this.id
|
|
4734
|
+
source: this.id,
|
|
4735
|
+
sources: importersArray
|
|
4740
4736
|
});
|
|
4741
4737
|
}
|
|
4742
4738
|
}
|
|
@@ -5057,15 +5053,9 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
5057
5053
|
const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins);
|
|
5058
5054
|
if (!externalBuiltins.length)
|
|
5059
5055
|
return;
|
|
5060
|
-
const detail = externalBuiltins.length === 1
|
|
5061
|
-
? `module ('${externalBuiltins[0]}')`
|
|
5062
|
-
: `modules (${externalBuiltins
|
|
5063
|
-
.slice(0, -1)
|
|
5064
|
-
.map(name => `'${name}'`)
|
|
5065
|
-
.join(', ')} and '${externalBuiltins.slice(-1)}')`;
|
|
5066
5056
|
warn({
|
|
5067
5057
|
code: 'MISSING_NODE_BUILTINS',
|
|
5068
|
-
message: `Creating a browser bundle that depends on Node.js built-in ${
|
|
5058
|
+
message: `Creating a browser bundle that depends on Node.js built-in modules (${printQuotedStringList(externalBuiltins)}). You might need to include https://github.com/ionic-team/rollup-plugin-node-polyfills`,
|
|
5069
5059
|
modules: externalBuiltins
|
|
5070
5060
|
});
|
|
5071
5061
|
}
|
|
@@ -5348,6 +5338,7 @@ var Errors;
|
|
|
5348
5338
|
Errors["MISSING_IMPLICIT_DEPENDANT"] = "MISSING_IMPLICIT_DEPENDANT";
|
|
5349
5339
|
Errors["MIXED_EXPORTS"] = "MIXED_EXPORTS";
|
|
5350
5340
|
Errors["NAMESPACE_CONFLICT"] = "NAMESPACE_CONFLICT";
|
|
5341
|
+
Errors["AMBIGUOUS_EXTERNAL_NAMESPACES"] = "AMBIGUOUS_EXTERNAL_NAMESPACES";
|
|
5351
5342
|
Errors["NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE"] = "NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE";
|
|
5352
5343
|
Errors["PLUGIN_ERROR"] = "PLUGIN_ERROR";
|
|
5353
5344
|
Errors["PREFER_NAMED_EXPORTS"] = "PREFER_NAMED_EXPORTS";
|
|
@@ -5513,9 +5504,7 @@ function errImplicitDependantIsNotIncluded(module) {
|
|
|
5513
5504
|
const implicitDependencies = Array.from(module.implicitlyLoadedBefore, dependency => relativeId(dependency.id)).sort();
|
|
5514
5505
|
return {
|
|
5515
5506
|
code: Errors.MISSING_IMPLICIT_DEPENDANT,
|
|
5516
|
-
message: `Module "${relativeId(module.id)}" that should be implicitly loaded before
|
|
5517
|
-
? implicitDependencies[0]
|
|
5518
|
-
: `${implicitDependencies.slice(0, -1).join('", "')}" and "${implicitDependencies.slice(-1)[0]}`}" is not included in the module graph. Either it was not imported by an included module or only via a tree-shaken dynamic import, or no imported bindings were used and it had otherwise no side-effects.`
|
|
5507
|
+
message: `Module "${relativeId(module.id)}" that should be implicitly loaded before ${printQuotedStringList(implicitDependencies)} is not included in the module graph. Either it was not imported by an included module or only via a tree-shaken dynamic import, or no imported bindings were used and it had otherwise no side-effects.`
|
|
5519
5508
|
};
|
|
5520
5509
|
}
|
|
5521
5510
|
function errMixedExport(facadeModuleId, name) {
|
|
@@ -5529,12 +5518,21 @@ function errMixedExport(facadeModuleId, name) {
|
|
|
5529
5518
|
function errNamespaceConflict(name, reexportingModule, additionalExportAllModule) {
|
|
5530
5519
|
return {
|
|
5531
5520
|
code: Errors.NAMESPACE_CONFLICT,
|
|
5532
|
-
message: `Conflicting namespaces: ${relativeId(reexportingModule.id)} re-exports
|
|
5521
|
+
message: `Conflicting namespaces: "${relativeId(reexportingModule.id)}" re-exports "${name}" from both "${relativeId(reexportingModule.exportsAll[name])}" and "${relativeId(additionalExportAllModule.exportsAll[name])}" (will be ignored)`,
|
|
5533
5522
|
name,
|
|
5534
5523
|
reexporter: reexportingModule.id,
|
|
5535
5524
|
sources: [reexportingModule.exportsAll[name], additionalExportAllModule.exportsAll[name]]
|
|
5536
5525
|
};
|
|
5537
5526
|
}
|
|
5527
|
+
function errAmbiguousExternalNamespaces(name, reexportingModule, usedExternalModule, externalModules) {
|
|
5528
|
+
return {
|
|
5529
|
+
code: Errors.AMBIGUOUS_EXTERNAL_NAMESPACES,
|
|
5530
|
+
message: `Ambiguous external namespace resolution: "${relativeId(reexportingModule)}" re-exports "${name}" from one of the external modules ${printQuotedStringList(externalModules.map(module => relativeId(module)))}, guessing "${relativeId(usedExternalModule)}".`,
|
|
5531
|
+
name,
|
|
5532
|
+
reexporter: reexportingModule,
|
|
5533
|
+
sources: externalModules
|
|
5534
|
+
};
|
|
5535
|
+
}
|
|
5538
5536
|
function errNoTransformMapOrAstWithoutCode(pluginName) {
|
|
5539
5537
|
return {
|
|
5540
5538
|
code: Errors.NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE,
|
|
@@ -6600,15 +6598,9 @@ class MemberExpression extends NodeBase {
|
|
|
6600
6598
|
if (this.variable) {
|
|
6601
6599
|
this.variable.deoptimizePath(path);
|
|
6602
6600
|
}
|
|
6603
|
-
else {
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
this.object.deoptimizePath(UNKNOWN_PATH);
|
|
6607
|
-
}
|
|
6608
|
-
else {
|
|
6609
|
-
this.wasPathDeoptimizedWhileOptimized = true;
|
|
6610
|
-
this.object.deoptimizePath([propertyKey, ...path]);
|
|
6611
|
-
}
|
|
6601
|
+
else if (!this.replacement) {
|
|
6602
|
+
this.wasPathDeoptimizedWhileOptimized = true;
|
|
6603
|
+
this.object.deoptimizePath([this.getPropertyKey(), ...path]);
|
|
6612
6604
|
}
|
|
6613
6605
|
}
|
|
6614
6606
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
@@ -6856,7 +6848,8 @@ class CallExpression extends NodeBase {
|
|
|
6856
6848
|
if (argument.hasEffects(context))
|
|
6857
6849
|
return true;
|
|
6858
6850
|
}
|
|
6859
|
-
if (this.context.options.treeshake.annotations &&
|
|
6851
|
+
if (this.context.options.treeshake.annotations &&
|
|
6852
|
+
((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
|
|
6860
6853
|
return false;
|
|
6861
6854
|
return (this.callee.hasEffects(context) ||
|
|
6862
6855
|
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
@@ -8149,7 +8142,8 @@ class NewExpression extends NodeBase {
|
|
|
8149
8142
|
if (argument.hasEffects(context))
|
|
8150
8143
|
return true;
|
|
8151
8144
|
}
|
|
8152
|
-
if (this.context.options.treeshake.annotations &&
|
|
8145
|
+
if (this.context.options.treeshake.annotations &&
|
|
8146
|
+
((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
|
|
8153
8147
|
return false;
|
|
8154
8148
|
return (this.callee.hasEffects(context) ||
|
|
8155
8149
|
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
@@ -9606,8 +9600,11 @@ function findSourceMappingURLComments(ast, code) {
|
|
|
9606
9600
|
}
|
|
9607
9601
|
let sourcemappingUrlMatch;
|
|
9608
9602
|
const interStatmentCode = code.slice(start, end);
|
|
9609
|
-
while (sourcemappingUrlMatch = SOURCEMAPPING_URL_COMMENT_RE.exec(interStatmentCode)) {
|
|
9610
|
-
ret.push([
|
|
9603
|
+
while ((sourcemappingUrlMatch = SOURCEMAPPING_URL_COMMENT_RE.exec(interStatmentCode))) {
|
|
9604
|
+
ret.push([
|
|
9605
|
+
start + sourcemappingUrlMatch.index,
|
|
9606
|
+
start + SOURCEMAPPING_URL_COMMENT_RE.lastIndex
|
|
9607
|
+
]);
|
|
9611
9608
|
}
|
|
9612
9609
|
};
|
|
9613
9610
|
let prevStmtEnd = 0;
|
|
@@ -9618,7 +9615,7 @@ function findSourceMappingURLComments(ast, code) {
|
|
|
9618
9615
|
addCommentsPos(prevStmtEnd, code.length);
|
|
9619
9616
|
return ret;
|
|
9620
9617
|
}
|
|
9621
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()) {
|
|
9618
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), skipExternalNamespaceReexports) {
|
|
9622
9619
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
9623
9620
|
if (searchedModules) {
|
|
9624
9621
|
if (searchedModules.has(target)) {
|
|
@@ -9629,7 +9626,12 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
9629
9626
|
else {
|
|
9630
9627
|
searchedNamesAndModules.set(name, new Set([target]));
|
|
9631
9628
|
}
|
|
9632
|
-
return target.getVariableForExportName(name,
|
|
9629
|
+
return target.getVariableForExportName(name, {
|
|
9630
|
+
importerForSideEffects,
|
|
9631
|
+
isExportAllSearch,
|
|
9632
|
+
searchedNamesAndModules,
|
|
9633
|
+
skipExternalNamespaceReexports
|
|
9634
|
+
});
|
|
9633
9635
|
}
|
|
9634
9636
|
function getAndExtendSideEffectModules(variable, module) {
|
|
9635
9637
|
const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, () => new Set());
|
|
@@ -9694,6 +9696,7 @@ class Module {
|
|
|
9694
9696
|
this.exportAllModules = [];
|
|
9695
9697
|
this.exportNamesByVariable = null;
|
|
9696
9698
|
this.exportShimVariable = new ExportShimVariable(this);
|
|
9699
|
+
this.namespaceReexportsByName = Object.create(null);
|
|
9697
9700
|
this.relevantDependencies = null;
|
|
9698
9701
|
this.syntheticExports = new Map();
|
|
9699
9702
|
this.syntheticNamespace = null;
|
|
@@ -9785,7 +9788,10 @@ class Module {
|
|
|
9785
9788
|
this.implicitlyLoadedAfter.size > 0) {
|
|
9786
9789
|
dependencyVariables = new Set(dependencyVariables);
|
|
9787
9790
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
9788
|
-
|
|
9791
|
+
const exportedVariable = this.getVariableForExportName(exportName);
|
|
9792
|
+
if (exportedVariable) {
|
|
9793
|
+
dependencyVariables.add(exportedVariable);
|
|
9794
|
+
}
|
|
9789
9795
|
}
|
|
9790
9796
|
}
|
|
9791
9797
|
for (let variable of dependencyVariables) {
|
|
@@ -9890,7 +9896,7 @@ class Module {
|
|
|
9890
9896
|
}
|
|
9891
9897
|
return this.syntheticNamespace;
|
|
9892
9898
|
}
|
|
9893
|
-
getVariableForExportName(name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules) {
|
|
9899
|
+
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules, skipExternalNamespaceReexports } = EMPTY_OBJECT) {
|
|
9894
9900
|
if (name[0] === '*') {
|
|
9895
9901
|
if (name.length === 1) {
|
|
9896
9902
|
// export * from './other'
|
|
@@ -9905,7 +9911,7 @@ class Module {
|
|
|
9905
9911
|
// export { foo } from './other'
|
|
9906
9912
|
const reexportDeclaration = this.reexportDescriptions[name];
|
|
9907
9913
|
if (reexportDeclaration) {
|
|
9908
|
-
const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules);
|
|
9914
|
+
const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, false);
|
|
9909
9915
|
if (!variable) {
|
|
9910
9916
|
return this.error(errMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id), reexportDeclaration.start);
|
|
9911
9917
|
}
|
|
@@ -9928,20 +9934,11 @@ class Module {
|
|
|
9928
9934
|
return variable;
|
|
9929
9935
|
}
|
|
9930
9936
|
if (name !== 'default') {
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
return declaration;
|
|
9937
|
-
}
|
|
9938
|
-
if (!foundSyntheticDeclaration) {
|
|
9939
|
-
foundSyntheticDeclaration = declaration;
|
|
9940
|
-
}
|
|
9941
|
-
}
|
|
9942
|
-
}
|
|
9943
|
-
if (foundSyntheticDeclaration) {
|
|
9944
|
-
return foundSyntheticDeclaration;
|
|
9937
|
+
const foundNamespaceReexport = name in this.namespaceReexportsByName
|
|
9938
|
+
? this.namespaceReexportsByName[name]
|
|
9939
|
+
: (this.namespaceReexportsByName[name] = this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports));
|
|
9940
|
+
if (foundNamespaceReexport) {
|
|
9941
|
+
return foundNamespaceReexport;
|
|
9945
9942
|
}
|
|
9946
9943
|
}
|
|
9947
9944
|
if (this.info.syntheticNamedExports) {
|
|
@@ -9989,12 +9986,14 @@ class Module {
|
|
|
9989
9986
|
}
|
|
9990
9987
|
for (const name of this.getReexports()) {
|
|
9991
9988
|
const variable = this.getVariableForExportName(name);
|
|
9992
|
-
variable
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
variable
|
|
9989
|
+
if (variable) {
|
|
9990
|
+
variable.deoptimizePath(UNKNOWN_PATH);
|
|
9991
|
+
if (!variable.included) {
|
|
9992
|
+
this.includeVariable(variable);
|
|
9993
|
+
}
|
|
9994
|
+
if (variable instanceof ExternalVariable) {
|
|
9995
|
+
variable.module.reexported = true;
|
|
9996
|
+
}
|
|
9998
9997
|
}
|
|
9999
9998
|
}
|
|
10000
9999
|
if (includeNamespaceMembers) {
|
|
@@ -10133,7 +10132,9 @@ class Module {
|
|
|
10133
10132
|
if (otherModule instanceof Module && importDeclaration.name === '*') {
|
|
10134
10133
|
return otherModule.namespace;
|
|
10135
10134
|
}
|
|
10136
|
-
const declaration = otherModule.getVariableForExportName(importDeclaration.name,
|
|
10135
|
+
const declaration = otherModule.getVariableForExportName(importDeclaration.name, {
|
|
10136
|
+
importerForSideEffects: importerForSideEffects || this
|
|
10137
|
+
});
|
|
10137
10138
|
if (!declaration) {
|
|
10138
10139
|
return this.error(errMissingExport(importDeclaration.name, this.id, otherModule.id), importDeclaration.start);
|
|
10139
10140
|
}
|
|
@@ -10331,6 +10332,42 @@ class Module {
|
|
|
10331
10332
|
addSideEffectDependencies(this.dependencies);
|
|
10332
10333
|
addSideEffectDependencies(alwaysCheckedDependencies);
|
|
10333
10334
|
}
|
|
10335
|
+
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports = false) {
|
|
10336
|
+
let foundSyntheticDeclaration = null;
|
|
10337
|
+
const skipExternalNamespaceValues = new Set([true, skipExternalNamespaceReexports]);
|
|
10338
|
+
for (const skipExternalNamespaces of skipExternalNamespaceValues) {
|
|
10339
|
+
const foundDeclarations = new Set();
|
|
10340
|
+
for (const module of this.exportAllModules) {
|
|
10341
|
+
if (module instanceof Module || !skipExternalNamespaces) {
|
|
10342
|
+
const declaration = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules, skipExternalNamespaces);
|
|
10343
|
+
if (declaration) {
|
|
10344
|
+
if (!(declaration instanceof SyntheticNamedExportVariable)) {
|
|
10345
|
+
foundDeclarations.add(declaration);
|
|
10346
|
+
}
|
|
10347
|
+
else if (!foundSyntheticDeclaration) {
|
|
10348
|
+
foundSyntheticDeclaration = declaration;
|
|
10349
|
+
}
|
|
10350
|
+
}
|
|
10351
|
+
}
|
|
10352
|
+
}
|
|
10353
|
+
if (foundDeclarations.size === 1) {
|
|
10354
|
+
return [...foundDeclarations][0];
|
|
10355
|
+
}
|
|
10356
|
+
if (foundDeclarations.size > 1) {
|
|
10357
|
+
if (skipExternalNamespaces) {
|
|
10358
|
+
return null;
|
|
10359
|
+
}
|
|
10360
|
+
const foundDeclarationList = [...foundDeclarations];
|
|
10361
|
+
const usedDeclaration = foundDeclarationList[0];
|
|
10362
|
+
this.options.onwarn(errAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
10363
|
+
return usedDeclaration;
|
|
10364
|
+
}
|
|
10365
|
+
}
|
|
10366
|
+
if (foundSyntheticDeclaration) {
|
|
10367
|
+
return foundSyntheticDeclaration;
|
|
10368
|
+
}
|
|
10369
|
+
return null;
|
|
10370
|
+
}
|
|
10334
10371
|
includeAndGetAdditionalMergedNamespaces() {
|
|
10335
10372
|
const mergedNamespaces = [];
|
|
10336
10373
|
for (const module of this.exportAllModules) {
|
|
@@ -10870,14 +10907,14 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
|
|
|
10870
10907
|
}
|
|
10871
10908
|
|
|
10872
10909
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
10873
|
-
if (
|
|
10874
|
-
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths
|
|
10910
|
+
if (isPathFragment(pattern))
|
|
10911
|
+
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths.`));
|
|
10875
10912
|
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
|
|
10876
10913
|
if (!replacements.hasOwnProperty(type)) {
|
|
10877
10914
|
return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
|
|
10878
10915
|
}
|
|
10879
10916
|
const replacement = replacements[type]();
|
|
10880
|
-
if (
|
|
10917
|
+
if (isPathFragment(replacement))
|
|
10881
10918
|
return error(errFailedValidation(`Invalid substitution "${replacement}" for placeholder "[${type}]" in "${patternName}" pattern, can be neither absolute nor relative path.`));
|
|
10882
10919
|
return replacement;
|
|
10883
10920
|
});
|
|
@@ -10932,6 +10969,7 @@ class Chunk {
|
|
|
10932
10969
|
this.dependencies = new Set();
|
|
10933
10970
|
this.dynamicDependencies = new Set();
|
|
10934
10971
|
this.dynamicEntryModules = [];
|
|
10972
|
+
this.dynamicName = null;
|
|
10935
10973
|
this.exportNamesByVariable = new Map();
|
|
10936
10974
|
this.exports = new Set();
|
|
10937
10975
|
this.exportsByName = Object.create(null);
|
|
@@ -11096,7 +11134,7 @@ class Chunk {
|
|
|
11096
11134
|
this.facadeModule = module;
|
|
11097
11135
|
this.facadeChunkByModule.set(module, this);
|
|
11098
11136
|
this.strictFacade = true;
|
|
11099
|
-
this.
|
|
11137
|
+
this.dynamicName = getChunkNameFromModule(module);
|
|
11100
11138
|
}
|
|
11101
11139
|
else if (this.facadeModule === module &&
|
|
11102
11140
|
!this.strictFacade &&
|
|
@@ -11127,17 +11165,16 @@ class Chunk {
|
|
|
11127
11165
|
}
|
|
11128
11166
|
generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
|
|
11129
11167
|
const id = this.orderedModules[0].id;
|
|
11130
|
-
const sanitizedId = sanitizeFileName(id);
|
|
11168
|
+
const sanitizedId = this.outputOptions.sanitizeFileName(id);
|
|
11131
11169
|
let path$1;
|
|
11132
11170
|
if (isAbsolute(id)) {
|
|
11133
11171
|
const extension = path.extname(id);
|
|
11134
11172
|
const pattern = unsetOptions.has('entryFileNames')
|
|
11135
|
-
?
|
|
11136
|
-
? '[name].js'
|
|
11137
|
-
: '[name][extname].js'
|
|
11173
|
+
? '[name][assetExtname].js'
|
|
11138
11174
|
: options.entryFileNames;
|
|
11139
11175
|
const currentDir = path.dirname(sanitizedId);
|
|
11140
11176
|
const fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getChunkInfo()) : pattern, 'output.entryFileNames', {
|
|
11177
|
+
assetExtname: () => NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension,
|
|
11141
11178
|
ext: () => extension.substr(1),
|
|
11142
11179
|
extname: () => extension,
|
|
11143
11180
|
format: () => options.format,
|
|
@@ -11186,7 +11223,7 @@ class Chunk {
|
|
|
11186
11223
|
});
|
|
11187
11224
|
}
|
|
11188
11225
|
getChunkName() {
|
|
11189
|
-
return this.name || (this.name = sanitizeFileName(this.getFallbackChunkName()));
|
|
11226
|
+
return this.name || (this.name = this.outputOptions.sanitizeFileName(this.getFallbackChunkName()));
|
|
11190
11227
|
}
|
|
11191
11228
|
getExportNames() {
|
|
11192
11229
|
return (this.sortedExportNames || (this.sortedExportNames = Object.keys(this.exportsByName).sort()));
|
|
@@ -11445,7 +11482,7 @@ class Chunk {
|
|
|
11445
11482
|
this.fileName = fileName;
|
|
11446
11483
|
}
|
|
11447
11484
|
else {
|
|
11448
|
-
this.name = sanitizeFileName(name ||
|
|
11485
|
+
this.name = this.outputOptions.sanitizeFileName(name || getChunkNameFromModule(facadedModule));
|
|
11449
11486
|
}
|
|
11450
11487
|
}
|
|
11451
11488
|
checkCircularDependencyImport(variable, importingModule) {
|
|
@@ -11664,6 +11701,9 @@ class Chunk {
|
|
|
11664
11701
|
if (this.manualChunkAlias) {
|
|
11665
11702
|
return this.manualChunkAlias;
|
|
11666
11703
|
}
|
|
11704
|
+
if (this.dynamicName) {
|
|
11705
|
+
return this.dynamicName;
|
|
11706
|
+
}
|
|
11667
11707
|
if (this.fileName) {
|
|
11668
11708
|
return getAliasName(this.fileName);
|
|
11669
11709
|
}
|
|
@@ -11913,6 +11953,9 @@ class Chunk {
|
|
|
11913
11953
|
}
|
|
11914
11954
|
}
|
|
11915
11955
|
}
|
|
11956
|
+
function getChunkNameFromModule(module) {
|
|
11957
|
+
return module.chunkName || getAliasName(module.id);
|
|
11958
|
+
}
|
|
11916
11959
|
|
|
11917
11960
|
const concatSep = (out, next) => (next ? `${out}\n${next}` : out);
|
|
11918
11961
|
const concatDblSep = (out, next) => (next ? `${out}\n\n${next}` : out);
|
|
@@ -12169,11 +12212,11 @@ var BuildPhase;
|
|
|
12169
12212
|
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
12170
12213
|
})(BuildPhase || (BuildPhase = {}));
|
|
12171
12214
|
|
|
12172
|
-
function generateAssetFileName(name, source,
|
|
12173
|
-
const emittedName = name || 'asset';
|
|
12174
|
-
return makeUnique(renderNamePattern(typeof
|
|
12175
|
-
?
|
|
12176
|
-
:
|
|
12215
|
+
function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
12216
|
+
const emittedName = outputOptions.sanitizeFileName(name || 'asset');
|
|
12217
|
+
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
12218
|
+
? outputOptions.assetFileNames({ name, source, type: 'asset' })
|
|
12219
|
+
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
12177
12220
|
hash() {
|
|
12178
12221
|
const hash = createHash();
|
|
12179
12222
|
hash.update(emittedName);
|
|
@@ -12184,7 +12227,7 @@ function generateAssetFileName(name, source, output) {
|
|
|
12184
12227
|
ext: () => path.extname(emittedName).substr(1),
|
|
12185
12228
|
extname: () => path.extname(emittedName),
|
|
12186
12229
|
name: () => emittedName.substr(0, emittedName.length - path.extname(emittedName).length)
|
|
12187
|
-
}),
|
|
12230
|
+
}), bundle);
|
|
12188
12231
|
}
|
|
12189
12232
|
function reserveFileNameInBundle(fileName, bundle, warn) {
|
|
12190
12233
|
if (fileName in bundle) {
|
|
@@ -12202,7 +12245,7 @@ function hasValidType(emittedFile) {
|
|
|
12202
12245
|
}
|
|
12203
12246
|
function hasValidName(emittedFile) {
|
|
12204
12247
|
const validatedName = emittedFile.fileName || emittedFile.name;
|
|
12205
|
-
return
|
|
12248
|
+
return !validatedName || typeof validatedName === 'string' && !isPathFragment(validatedName);
|
|
12206
12249
|
}
|
|
12207
12250
|
function getValidSource(source, emittedFile, fileReferenceId) {
|
|
12208
12251
|
if (!(typeof source === 'string' || source instanceof Uint8Array)) {
|
|
@@ -12228,8 +12271,9 @@ class FileEmitter {
|
|
|
12228
12271
|
constructor(graph, options, baseFileEmitter) {
|
|
12229
12272
|
this.graph = graph;
|
|
12230
12273
|
this.options = options;
|
|
12274
|
+
this.bundle = null;
|
|
12231
12275
|
this.facadeChunkByModule = null;
|
|
12232
|
-
this.
|
|
12276
|
+
this.outputOptions = null;
|
|
12233
12277
|
this.assertAssetsFinalized = () => {
|
|
12234
12278
|
for (const [referenceId, emittedFile] of this.filesByReferenceId.entries()) {
|
|
12235
12279
|
if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
|
|
@@ -12241,7 +12285,7 @@ class FileEmitter {
|
|
|
12241
12285
|
return error(errFailedValidation(`Emitted files must be of type "asset" or "chunk", received "${emittedFile && emittedFile.type}".`));
|
|
12242
12286
|
}
|
|
12243
12287
|
if (!hasValidName(emittedFile)) {
|
|
12244
|
-
return error(errFailedValidation(`The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths
|
|
12288
|
+
return error(errFailedValidation(`The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "${emittedFile.fileName || emittedFile.name}".`));
|
|
12245
12289
|
}
|
|
12246
12290
|
if (emittedFile.type === 'chunk') {
|
|
12247
12291
|
return this.emitChunk(emittedFile);
|
|
@@ -12272,27 +12316,25 @@ class FileEmitter {
|
|
|
12272
12316
|
return error(errAssetSourceAlreadySet(consumedFile.name || referenceId));
|
|
12273
12317
|
}
|
|
12274
12318
|
const source = getValidSource(requestedSource, consumedFile, referenceId);
|
|
12275
|
-
if (this.
|
|
12276
|
-
this.finalizeAsset(consumedFile, source, referenceId, this.
|
|
12319
|
+
if (this.bundle) {
|
|
12320
|
+
this.finalizeAsset(consumedFile, source, referenceId, this.bundle);
|
|
12277
12321
|
}
|
|
12278
12322
|
else {
|
|
12279
12323
|
consumedFile.source = source;
|
|
12280
12324
|
}
|
|
12281
12325
|
};
|
|
12282
|
-
this.setOutputBundle = (outputBundle,
|
|
12283
|
-
this.
|
|
12284
|
-
|
|
12285
|
-
bundle: outputBundle
|
|
12286
|
-
};
|
|
12326
|
+
this.setOutputBundle = (outputBundle, outputOptions, facadeChunkByModule) => {
|
|
12327
|
+
this.outputOptions = outputOptions;
|
|
12328
|
+
this.bundle = outputBundle;
|
|
12287
12329
|
this.facadeChunkByModule = facadeChunkByModule;
|
|
12288
12330
|
for (const emittedFile of this.filesByReferenceId.values()) {
|
|
12289
12331
|
if (emittedFile.fileName) {
|
|
12290
|
-
reserveFileNameInBundle(emittedFile.fileName, this.
|
|
12332
|
+
reserveFileNameInBundle(emittedFile.fileName, this.bundle, this.options.onwarn);
|
|
12291
12333
|
}
|
|
12292
12334
|
}
|
|
12293
12335
|
for (const [referenceId, consumedFile] of this.filesByReferenceId.entries()) {
|
|
12294
12336
|
if (consumedFile.type === 'asset' && consumedFile.source !== undefined) {
|
|
12295
|
-
this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.
|
|
12337
|
+
this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.bundle);
|
|
12296
12338
|
}
|
|
12297
12339
|
}
|
|
12298
12340
|
};
|
|
@@ -12326,12 +12368,12 @@ class FileEmitter {
|
|
|
12326
12368
|
type: 'asset'
|
|
12327
12369
|
};
|
|
12328
12370
|
const referenceId = this.assignReferenceId(consumedAsset, emittedAsset.fileName || emittedAsset.name || emittedAsset.type);
|
|
12329
|
-
if (this.
|
|
12371
|
+
if (this.bundle) {
|
|
12330
12372
|
if (emittedAsset.fileName) {
|
|
12331
|
-
reserveFileNameInBundle(emittedAsset.fileName, this.
|
|
12373
|
+
reserveFileNameInBundle(emittedAsset.fileName, this.bundle, this.options.onwarn);
|
|
12332
12374
|
}
|
|
12333
12375
|
if (source !== undefined) {
|
|
12334
|
-
this.finalizeAsset(consumedAsset, source, referenceId, this.
|
|
12376
|
+
this.finalizeAsset(consumedAsset, source, referenceId, this.bundle);
|
|
12335
12377
|
}
|
|
12336
12378
|
}
|
|
12337
12379
|
return referenceId;
|
|
@@ -12358,15 +12400,15 @@ class FileEmitter {
|
|
|
12358
12400
|
});
|
|
12359
12401
|
return this.assignReferenceId(consumedChunk, emittedChunk.id);
|
|
12360
12402
|
}
|
|
12361
|
-
finalizeAsset(consumedFile, source, referenceId,
|
|
12403
|
+
finalizeAsset(consumedFile, source, referenceId, bundle) {
|
|
12362
12404
|
const fileName = consumedFile.fileName ||
|
|
12363
|
-
findExistingAssetFileNameWithSource(
|
|
12364
|
-
generateAssetFileName(consumedFile.name, source,
|
|
12405
|
+
findExistingAssetFileNameWithSource(bundle, source) ||
|
|
12406
|
+
generateAssetFileName(consumedFile.name, source, this.outputOptions, bundle);
|
|
12365
12407
|
// We must not modify the original assets to avoid interaction between outputs
|
|
12366
12408
|
const assetWithFileName = { ...consumedFile, source, fileName };
|
|
12367
12409
|
this.filesByReferenceId.set(referenceId, assetWithFileName);
|
|
12368
12410
|
const options = this.options;
|
|
12369
|
-
|
|
12411
|
+
bundle[fileName] = {
|
|
12370
12412
|
fileName,
|
|
12371
12413
|
name: consumedFile.name,
|
|
12372
12414
|
get isAsset() {
|
|
@@ -12420,7 +12462,7 @@ class Bundle {
|
|
|
12420
12462
|
async generate(isWrite) {
|
|
12421
12463
|
timeStart('GENERATE', 1);
|
|
12422
12464
|
const outputBundle = Object.create(null);
|
|
12423
|
-
this.pluginDriver.setOutputBundle(outputBundle, this.outputOptions
|
|
12465
|
+
this.pluginDriver.setOutputBundle(outputBundle, this.outputOptions, this.facadeChunkByModule);
|
|
12424
12466
|
try {
|
|
12425
12467
|
await this.pluginDriver.hookParallel('renderStart', [this.outputOptions, this.inputOptions]);
|
|
12426
12468
|
timeStart('generate chunks', 2);
|
|
@@ -12768,6 +12810,7 @@ var types = {
|
|
|
12768
12810
|
regexp: new TokenType("regexp", startsExpr),
|
|
12769
12811
|
string: new TokenType("string", startsExpr),
|
|
12770
12812
|
name: new TokenType("name", startsExpr),
|
|
12813
|
+
privateId: new TokenType("privateId", startsExpr),
|
|
12771
12814
|
eof: new TokenType("eof"),
|
|
12772
12815
|
|
|
12773
12816
|
// Punctuation token types.
|
|
@@ -12962,7 +13005,8 @@ var defaultOptions = {
|
|
|
12962
13005
|
// error.
|
|
12963
13006
|
allowReturnOutsideFunction: false,
|
|
12964
13007
|
// When enabled, import/export statements are not constrained to
|
|
12965
|
-
// appearing at the top of the program.
|
|
13008
|
+
// appearing at the top of the program, and an import.meta expression
|
|
13009
|
+
// in a script isn't considered an error.
|
|
12966
13010
|
allowImportExportEverywhere: false,
|
|
12967
13011
|
// When enabled, await identifiers are allowed to appear at the top-level scope,
|
|
12968
13012
|
// but they are still not allowed in non-async functions.
|
|
@@ -13153,6 +13197,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
13153
13197
|
|
|
13154
13198
|
// Used to signify the start of a potential arrow function
|
|
13155
13199
|
this.potentialArrowAt = -1;
|
|
13200
|
+
this.potentialArrowInForAwait = false;
|
|
13156
13201
|
|
|
13157
13202
|
// Positions to delayed-check that yield/await does not exist in default parameters.
|
|
13158
13203
|
this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
|
|
@@ -13171,6 +13216,11 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
13171
13216
|
|
|
13172
13217
|
// For RegExp validation
|
|
13173
13218
|
this.regexpState = null;
|
|
13219
|
+
|
|
13220
|
+
// The stack of private names.
|
|
13221
|
+
// Each element has two properties: 'declared' and 'used'.
|
|
13222
|
+
// When it exited from the outermost class definition, all used private names must be declared.
|
|
13223
|
+
this.privateNameStack = [];
|
|
13174
13224
|
};
|
|
13175
13225
|
|
|
13176
13226
|
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },inNonArrowFunction: { configurable: true } };
|
|
@@ -13182,12 +13232,22 @@ Parser.prototype.parse = function parse () {
|
|
|
13182
13232
|
};
|
|
13183
13233
|
|
|
13184
13234
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
13185
|
-
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
|
|
13186
|
-
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
|
|
13187
|
-
prototypeAccessors.allowSuper.get = function () {
|
|
13235
|
+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
13236
|
+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
13237
|
+
prototypeAccessors.allowSuper.get = function () {
|
|
13238
|
+
var ref = this.currentThisScope();
|
|
13239
|
+
var flags = ref.flags;
|
|
13240
|
+
var inClassFieldInit = ref.inClassFieldInit;
|
|
13241
|
+
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit
|
|
13242
|
+
};
|
|
13188
13243
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
13189
13244
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
13190
|
-
prototypeAccessors.inNonArrowFunction.get = function () {
|
|
13245
|
+
prototypeAccessors.inNonArrowFunction.get = function () {
|
|
13246
|
+
var ref = this.currentThisScope();
|
|
13247
|
+
var flags = ref.flags;
|
|
13248
|
+
var inClassFieldInit = ref.inClassFieldInit;
|
|
13249
|
+
return (flags & SCOPE_FUNCTION) > 0 || inClassFieldInit
|
|
13250
|
+
};
|
|
13191
13251
|
|
|
13192
13252
|
Parser.extend = function extend () {
|
|
13193
13253
|
var plugins = [], len = arguments.length;
|
|
@@ -13594,7 +13654,7 @@ pp$1.parseForStatement = function(node) {
|
|
|
13594
13654
|
return this.parseFor(node, init$1)
|
|
13595
13655
|
}
|
|
13596
13656
|
var refDestructuringErrors = new DestructuringErrors;
|
|
13597
|
-
var init = this.parseExpression(true, refDestructuringErrors);
|
|
13657
|
+
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
13598
13658
|
if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
13599
13659
|
if (this.options.ecmaVersion >= 9) {
|
|
13600
13660
|
if (this.type === types._in) {
|
|
@@ -13940,6 +14000,7 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
13940
14000
|
|
|
13941
14001
|
this.parseClassId(node, isStatement);
|
|
13942
14002
|
this.parseClassSuper(node);
|
|
14003
|
+
var privateNameMap = this.enterClassBody();
|
|
13943
14004
|
var classBody = this.startNode();
|
|
13944
14005
|
var hadConstructor = false;
|
|
13945
14006
|
classBody.body = [];
|
|
@@ -13951,77 +14012,154 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
13951
14012
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
13952
14013
|
if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
|
|
13953
14014
|
hadConstructor = true;
|
|
14015
|
+
} else if (element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
14016
|
+
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
13954
14017
|
}
|
|
13955
14018
|
}
|
|
13956
14019
|
}
|
|
13957
14020
|
this.strict = oldStrict;
|
|
13958
14021
|
this.next();
|
|
13959
14022
|
node.body = this.finishNode(classBody, "ClassBody");
|
|
14023
|
+
this.exitClassBody();
|
|
13960
14024
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
13961
14025
|
};
|
|
13962
14026
|
|
|
13963
14027
|
pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
13964
|
-
var this$1 = this;
|
|
13965
|
-
|
|
13966
14028
|
if (this.eat(types.semi)) { return null }
|
|
13967
14029
|
|
|
13968
|
-
var
|
|
13969
|
-
var
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
var start = this$1.start, startLoc = this$1.startLoc;
|
|
13973
|
-
if (!this$1.eatContextual(k)) { return false }
|
|
13974
|
-
if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
|
|
13975
|
-
if (method.key) { this$1.unexpected(); }
|
|
13976
|
-
method.computed = false;
|
|
13977
|
-
method.key = this$1.startNodeAt(start, startLoc);
|
|
13978
|
-
method.key.name = k;
|
|
13979
|
-
this$1.finishNode(method.key, "Identifier");
|
|
13980
|
-
return false
|
|
13981
|
-
};
|
|
13982
|
-
|
|
13983
|
-
method.kind = "method";
|
|
13984
|
-
method.static = tryContextual("static");
|
|
13985
|
-
var isGenerator = this.eat(types.star);
|
|
14030
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
14031
|
+
var node = this.startNode();
|
|
14032
|
+
var keyName = "";
|
|
14033
|
+
var isGenerator = false;
|
|
13986
14034
|
var isAsync = false;
|
|
13987
|
-
|
|
13988
|
-
|
|
14035
|
+
var kind = "method";
|
|
14036
|
+
|
|
14037
|
+
// Parse modifiers
|
|
14038
|
+
node.static = false;
|
|
14039
|
+
if (this.eatContextual("static")) {
|
|
14040
|
+
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
14041
|
+
node.static = true;
|
|
14042
|
+
} else {
|
|
14043
|
+
keyName = "static";
|
|
14044
|
+
}
|
|
14045
|
+
}
|
|
14046
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
14047
|
+
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
13989
14048
|
isAsync = true;
|
|
13990
|
-
|
|
13991
|
-
|
|
13992
|
-
|
|
13993
|
-
|
|
13994
|
-
|
|
14049
|
+
} else {
|
|
14050
|
+
keyName = "async";
|
|
14051
|
+
}
|
|
14052
|
+
}
|
|
14053
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
14054
|
+
isGenerator = true;
|
|
14055
|
+
}
|
|
14056
|
+
if (!keyName && !isAsync && !isGenerator) {
|
|
14057
|
+
var lastValue = this.value;
|
|
14058
|
+
if (this.eatContextual("get") || this.eatContextual("set")) {
|
|
14059
|
+
if (this.isClassElementNameStart()) {
|
|
14060
|
+
kind = lastValue;
|
|
14061
|
+
} else {
|
|
14062
|
+
keyName = lastValue;
|
|
14063
|
+
}
|
|
14064
|
+
}
|
|
14065
|
+
}
|
|
14066
|
+
|
|
14067
|
+
// Parse element name
|
|
14068
|
+
if (keyName) {
|
|
14069
|
+
// 'async', 'get', 'set', or 'static' were not a keyword contextually.
|
|
14070
|
+
// The last token is any of those. Make it the element name.
|
|
14071
|
+
node.computed = false;
|
|
14072
|
+
node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
|
|
14073
|
+
node.key.name = keyName;
|
|
14074
|
+
this.finishNode(node.key, "Identifier");
|
|
14075
|
+
} else {
|
|
14076
|
+
this.parseClassElementName(node);
|
|
14077
|
+
}
|
|
14078
|
+
|
|
14079
|
+
// Parse element value
|
|
14080
|
+
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
14081
|
+
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
14082
|
+
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
14083
|
+
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
14084
|
+
if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
|
|
14085
|
+
node.kind = isConstructor ? "constructor" : kind;
|
|
14086
|
+
this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
|
|
14087
|
+
} else {
|
|
14088
|
+
this.parseClassField(node);
|
|
14089
|
+
}
|
|
14090
|
+
|
|
14091
|
+
return node
|
|
14092
|
+
};
|
|
14093
|
+
|
|
14094
|
+
pp$1.isClassElementNameStart = function() {
|
|
14095
|
+
return (
|
|
14096
|
+
this.type === types.name ||
|
|
14097
|
+
this.type === types.privateId ||
|
|
14098
|
+
this.type === types.num ||
|
|
14099
|
+
this.type === types.string ||
|
|
14100
|
+
this.type === types.bracketL ||
|
|
14101
|
+
this.type.keyword
|
|
14102
|
+
)
|
|
14103
|
+
};
|
|
14104
|
+
|
|
14105
|
+
pp$1.parseClassElementName = function(element) {
|
|
14106
|
+
if (this.type === types.privateId) {
|
|
14107
|
+
if (this.value === "constructor") {
|
|
14108
|
+
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
13995
14109
|
}
|
|
14110
|
+
element.computed = false;
|
|
14111
|
+
element.key = this.parsePrivateIdent();
|
|
14112
|
+
} else {
|
|
14113
|
+
this.parsePropertyName(element);
|
|
13996
14114
|
}
|
|
13997
|
-
|
|
14115
|
+
};
|
|
14116
|
+
|
|
14117
|
+
pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
14118
|
+
// Check key and flags
|
|
13998
14119
|
var key = method.key;
|
|
13999
|
-
|
|
14000
|
-
if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
|
|
14001
|
-
key.type === "Literal" && key.value === "constructor")) {
|
|
14002
|
-
if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
|
|
14120
|
+
if (method.kind === "constructor") {
|
|
14003
14121
|
if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
|
|
14004
14122
|
if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
|
|
14005
|
-
|
|
14006
|
-
allowsDirectSuper = constructorAllowsSuper;
|
|
14007
|
-
} else if (method.static && key.type === "Identifier" && key.name === "prototype") {
|
|
14123
|
+
} else if (method.static && checkKeyName(method, "prototype")) {
|
|
14008
14124
|
this.raise(key.start, "Classes may not have a static property named prototype");
|
|
14009
14125
|
}
|
|
14010
|
-
this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
|
|
14011
|
-
if (method.kind === "get" && method.value.params.length !== 0)
|
|
14012
|
-
{ this.raiseRecoverable(method.value.start, "getter should have no params"); }
|
|
14013
|
-
if (method.kind === "set" && method.value.params.length !== 1)
|
|
14014
|
-
{ this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
|
|
14015
|
-
if (method.kind === "set" && method.value.params[0].type === "RestElement")
|
|
14016
|
-
{ this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
|
|
14017
|
-
return method
|
|
14018
|
-
};
|
|
14019
14126
|
|
|
14020
|
-
|
|
14021
|
-
method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
|
14127
|
+
// Parse value
|
|
14128
|
+
var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
|
14129
|
+
|
|
14130
|
+
// Check value
|
|
14131
|
+
if (method.kind === "get" && value.params.length !== 0)
|
|
14132
|
+
{ this.raiseRecoverable(value.start, "getter should have no params"); }
|
|
14133
|
+
if (method.kind === "set" && value.params.length !== 1)
|
|
14134
|
+
{ this.raiseRecoverable(value.start, "setter should have exactly one param"); }
|
|
14135
|
+
if (method.kind === "set" && value.params[0].type === "RestElement")
|
|
14136
|
+
{ this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); }
|
|
14137
|
+
|
|
14022
14138
|
return this.finishNode(method, "MethodDefinition")
|
|
14023
14139
|
};
|
|
14024
14140
|
|
|
14141
|
+
pp$1.parseClassField = function(field) {
|
|
14142
|
+
if (checkKeyName(field, "constructor")) {
|
|
14143
|
+
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
14144
|
+
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
14145
|
+
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
14146
|
+
}
|
|
14147
|
+
|
|
14148
|
+
if (this.eat(types.eq)) {
|
|
14149
|
+
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
14150
|
+
var scope = this.currentThisScope();
|
|
14151
|
+
var inClassFieldInit = scope.inClassFieldInit;
|
|
14152
|
+
scope.inClassFieldInit = true;
|
|
14153
|
+
field.value = this.parseMaybeAssign();
|
|
14154
|
+
scope.inClassFieldInit = inClassFieldInit;
|
|
14155
|
+
} else {
|
|
14156
|
+
field.value = null;
|
|
14157
|
+
}
|
|
14158
|
+
this.semicolon();
|
|
14159
|
+
|
|
14160
|
+
return this.finishNode(field, "PropertyDefinition")
|
|
14161
|
+
};
|
|
14162
|
+
|
|
14025
14163
|
pp$1.parseClassId = function(node, isStatement) {
|
|
14026
14164
|
if (this.type === types.name) {
|
|
14027
14165
|
node.id = this.parseIdent();
|
|
@@ -14038,6 +14176,65 @@ pp$1.parseClassSuper = function(node) {
|
|
|
14038
14176
|
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
|
|
14039
14177
|
};
|
|
14040
14178
|
|
|
14179
|
+
pp$1.enterClassBody = function() {
|
|
14180
|
+
var element = {declared: Object.create(null), used: []};
|
|
14181
|
+
this.privateNameStack.push(element);
|
|
14182
|
+
return element.declared
|
|
14183
|
+
};
|
|
14184
|
+
|
|
14185
|
+
pp$1.exitClassBody = function() {
|
|
14186
|
+
var ref = this.privateNameStack.pop();
|
|
14187
|
+
var declared = ref.declared;
|
|
14188
|
+
var used = ref.used;
|
|
14189
|
+
var len = this.privateNameStack.length;
|
|
14190
|
+
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
14191
|
+
for (var i = 0; i < used.length; ++i) {
|
|
14192
|
+
var id = used[i];
|
|
14193
|
+
if (!has(declared, id.name)) {
|
|
14194
|
+
if (parent) {
|
|
14195
|
+
parent.used.push(id);
|
|
14196
|
+
} else {
|
|
14197
|
+
this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class"));
|
|
14198
|
+
}
|
|
14199
|
+
}
|
|
14200
|
+
}
|
|
14201
|
+
};
|
|
14202
|
+
|
|
14203
|
+
function isPrivateNameConflicted(privateNameMap, element) {
|
|
14204
|
+
var name = element.key.name;
|
|
14205
|
+
var curr = privateNameMap[name];
|
|
14206
|
+
|
|
14207
|
+
var next = "true";
|
|
14208
|
+
if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
|
|
14209
|
+
next = (element.static ? "s" : "i") + element.kind;
|
|
14210
|
+
}
|
|
14211
|
+
|
|
14212
|
+
// `class { get #a(){}; static set #a(_){} }` is also conflict.
|
|
14213
|
+
if (
|
|
14214
|
+
curr === "iget" && next === "iset" ||
|
|
14215
|
+
curr === "iset" && next === "iget" ||
|
|
14216
|
+
curr === "sget" && next === "sset" ||
|
|
14217
|
+
curr === "sset" && next === "sget"
|
|
14218
|
+
) {
|
|
14219
|
+
privateNameMap[name] = "true";
|
|
14220
|
+
return false
|
|
14221
|
+
} else if (!curr) {
|
|
14222
|
+
privateNameMap[name] = next;
|
|
14223
|
+
return false
|
|
14224
|
+
} else {
|
|
14225
|
+
return true
|
|
14226
|
+
}
|
|
14227
|
+
}
|
|
14228
|
+
|
|
14229
|
+
function checkKeyName(node, name) {
|
|
14230
|
+
var computed = node.computed;
|
|
14231
|
+
var key = node.key;
|
|
14232
|
+
return !computed && (
|
|
14233
|
+
key.type === "Identifier" && key.name === name ||
|
|
14234
|
+
key.type === "Literal" && key.value === name
|
|
14235
|
+
)
|
|
14236
|
+
}
|
|
14237
|
+
|
|
14041
14238
|
// Parses module export declaration.
|
|
14042
14239
|
|
|
14043
14240
|
pp$1.parseExport = function(node, exports) {
|
|
@@ -14656,13 +14853,13 @@ pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
14656
14853
|
// and object pattern might appear (so it's possible to raise
|
|
14657
14854
|
// delayed syntax error at correct position).
|
|
14658
14855
|
|
|
14659
|
-
pp$3.parseExpression = function(
|
|
14856
|
+
pp$3.parseExpression = function(forInit, refDestructuringErrors) {
|
|
14660
14857
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14661
|
-
var expr = this.parseMaybeAssign(
|
|
14858
|
+
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
14662
14859
|
if (this.type === types.comma) {
|
|
14663
14860
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14664
14861
|
node.expressions = [expr];
|
|
14665
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(
|
|
14862
|
+
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
14666
14863
|
return this.finishNode(node, "SequenceExpression")
|
|
14667
14864
|
}
|
|
14668
14865
|
return expr
|
|
@@ -14671,9 +14868,9 @@ pp$3.parseExpression = function(noIn, refDestructuringErrors) {
|
|
|
14671
14868
|
// Parse an assignment expression. This includes applications of
|
|
14672
14869
|
// operators like `+=`.
|
|
14673
14870
|
|
|
14674
|
-
pp$3.parseMaybeAssign = function(
|
|
14871
|
+
pp$3.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
14675
14872
|
if (this.isContextual("yield")) {
|
|
14676
|
-
if (this.inGenerator) { return this.parseYield(
|
|
14873
|
+
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
14677
14874
|
// The tokenizer will assume an expression is allowed after
|
|
14678
14875
|
// `yield`, but this isn't that kind of yield
|
|
14679
14876
|
else { this.exprAllowed = false; }
|
|
@@ -14690,9 +14887,11 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
|
14690
14887
|
}
|
|
14691
14888
|
|
|
14692
14889
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14693
|
-
if (this.type === types.parenL || this.type === types.name)
|
|
14694
|
-
|
|
14695
|
-
|
|
14890
|
+
if (this.type === types.parenL || this.type === types.name) {
|
|
14891
|
+
this.potentialArrowAt = this.start;
|
|
14892
|
+
this.potentialArrowInForAwait = forInit === "await";
|
|
14893
|
+
}
|
|
14894
|
+
var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
|
|
14696
14895
|
if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
|
|
14697
14896
|
if (this.type.isAssign) {
|
|
14698
14897
|
var node = this.startNodeAt(startPos, startLoc);
|
|
@@ -14710,7 +14909,7 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
|
14710
14909
|
{ this.checkLValSimple(left); }
|
|
14711
14910
|
node.left = left;
|
|
14712
14911
|
this.next();
|
|
14713
|
-
node.right = this.parseMaybeAssign(
|
|
14912
|
+
node.right = this.parseMaybeAssign(forInit);
|
|
14714
14913
|
return this.finishNode(node, "AssignmentExpression")
|
|
14715
14914
|
} else {
|
|
14716
14915
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -14722,16 +14921,16 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
|
14722
14921
|
|
|
14723
14922
|
// Parse a ternary conditional (`?:`) operator.
|
|
14724
14923
|
|
|
14725
|
-
pp$3.parseMaybeConditional = function(
|
|
14924
|
+
pp$3.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
14726
14925
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14727
|
-
var expr = this.parseExprOps(
|
|
14926
|
+
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
14728
14927
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
14729
14928
|
if (this.eat(types.question)) {
|
|
14730
14929
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14731
14930
|
node.test = expr;
|
|
14732
14931
|
node.consequent = this.parseMaybeAssign();
|
|
14733
14932
|
this.expect(types.colon);
|
|
14734
|
-
node.alternate = this.parseMaybeAssign(
|
|
14933
|
+
node.alternate = this.parseMaybeAssign(forInit);
|
|
14735
14934
|
return this.finishNode(node, "ConditionalExpression")
|
|
14736
14935
|
}
|
|
14737
14936
|
return expr
|
|
@@ -14739,11 +14938,11 @@ pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
|
|
|
14739
14938
|
|
|
14740
14939
|
// Start the precedence parser.
|
|
14741
14940
|
|
|
14742
|
-
pp$3.parseExprOps = function(
|
|
14941
|
+
pp$3.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
14743
14942
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14744
14943
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false);
|
|
14745
14944
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
14746
|
-
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1,
|
|
14945
|
+
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
|
|
14747
14946
|
};
|
|
14748
14947
|
|
|
14749
14948
|
// Parse binary operators with the operator precedence parsing
|
|
@@ -14752,9 +14951,9 @@ pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
|
|
|
14752
14951
|
// defer further parser to one of its callers when it encounters an
|
|
14753
14952
|
// operator that has a lower precedence than the set it is parsing.
|
|
14754
14953
|
|
|
14755
|
-
pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec,
|
|
14954
|
+
pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
14756
14955
|
var prec = this.type.binop;
|
|
14757
|
-
if (prec != null && (!
|
|
14956
|
+
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
14758
14957
|
if (prec > minPrec) {
|
|
14759
14958
|
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
14760
14959
|
var coalesce = this.type === types.coalesce;
|
|
@@ -14766,12 +14965,12 @@ pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
|
|
|
14766
14965
|
var op = this.value;
|
|
14767
14966
|
this.next();
|
|
14768
14967
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14769
|
-
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec,
|
|
14968
|
+
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, forInit);
|
|
14770
14969
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
14771
14970
|
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
14772
14971
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
14773
14972
|
}
|
|
14774
|
-
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec,
|
|
14973
|
+
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
14775
14974
|
}
|
|
14776
14975
|
}
|
|
14777
14976
|
return left
|
|
@@ -14787,7 +14986,7 @@ pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
14787
14986
|
|
|
14788
14987
|
// Parse unary operators, both prefix and postfix.
|
|
14789
14988
|
|
|
14790
|
-
pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
14989
|
+
pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec) {
|
|
14791
14990
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
14792
14991
|
if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
|
|
14793
14992
|
expr = this.parseAwait();
|
|
@@ -14797,12 +14996,14 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
|
14797
14996
|
node.operator = this.value;
|
|
14798
14997
|
node.prefix = true;
|
|
14799
14998
|
this.next();
|
|
14800
|
-
node.argument = this.parseMaybeUnary(null, true);
|
|
14999
|
+
node.argument = this.parseMaybeUnary(null, true, update);
|
|
14801
15000
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
14802
15001
|
if (update) { this.checkLValSimple(node.argument); }
|
|
14803
15002
|
else if (this.strict && node.operator === "delete" &&
|
|
14804
15003
|
node.argument.type === "Identifier")
|
|
14805
15004
|
{ this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
|
|
15005
|
+
else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
|
|
15006
|
+
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
14806
15007
|
else { sawUnary = true; }
|
|
14807
15008
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
14808
15009
|
} else {
|
|
@@ -14819,12 +15020,23 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
|
14819
15020
|
}
|
|
14820
15021
|
}
|
|
14821
15022
|
|
|
14822
|
-
if (!
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
15023
|
+
if (!incDec && this.eat(types.starstar)) {
|
|
15024
|
+
if (sawUnary)
|
|
15025
|
+
{ this.unexpected(this.lastTokStart); }
|
|
15026
|
+
else
|
|
15027
|
+
{ return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
|
|
15028
|
+
} else {
|
|
15029
|
+
return expr
|
|
15030
|
+
}
|
|
14826
15031
|
};
|
|
14827
15032
|
|
|
15033
|
+
function isPrivateFieldAccess(node) {
|
|
15034
|
+
return (
|
|
15035
|
+
node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
|
|
15036
|
+
node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
|
|
15037
|
+
)
|
|
15038
|
+
}
|
|
15039
|
+
|
|
14828
15040
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
14829
15041
|
|
|
14830
15042
|
pp$3.parseExprSubscripts = function(refDestructuringErrors) {
|
|
@@ -14836,6 +15048,7 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) {
|
|
|
14836
15048
|
if (refDestructuringErrors && result.type === "MemberExpression") {
|
|
14837
15049
|
if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
|
|
14838
15050
|
if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
|
|
15051
|
+
if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
|
|
14839
15052
|
}
|
|
14840
15053
|
return result
|
|
14841
15054
|
};
|
|
@@ -14872,9 +15085,15 @@ pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
14872
15085
|
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
14873
15086
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14874
15087
|
node.object = base;
|
|
14875
|
-
|
|
15088
|
+
if (computed) {
|
|
15089
|
+
node.property = this.parseExpression();
|
|
15090
|
+
this.expect(types.bracketR);
|
|
15091
|
+
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
15092
|
+
node.property = this.parsePrivateIdent();
|
|
15093
|
+
} else {
|
|
15094
|
+
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
15095
|
+
}
|
|
14876
15096
|
node.computed = !!computed;
|
|
14877
|
-
if (computed) { this.expect(types.bracketR); }
|
|
14878
15097
|
if (optionalSupported) {
|
|
14879
15098
|
node.optional = optional;
|
|
14880
15099
|
}
|
|
@@ -14960,7 +15179,8 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
|
|
|
14960
15179
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
14961
15180
|
if (this.eat(types.arrow))
|
|
14962
15181
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
|
|
14963
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc
|
|
15182
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
15183
|
+
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
14964
15184
|
id = this.parseIdent(false);
|
|
14965
15185
|
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
14966
15186
|
{ this.unexpected(); }
|
|
@@ -15078,7 +15298,7 @@ pp$3.parseImportMeta = function(node) {
|
|
|
15078
15298
|
{ this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
|
|
15079
15299
|
if (containsEsc)
|
|
15080
15300
|
{ this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
|
|
15081
|
-
if (this.options.sourceType !== "module")
|
|
15301
|
+
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere)
|
|
15082
15302
|
{ this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
|
|
15083
15303
|
|
|
15084
15304
|
return this.finishNode(node, "MetaProperty")
|
|
@@ -15546,6 +15766,8 @@ pp$3.checkUnreserved = function(ref) {
|
|
|
15546
15766
|
{ this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
|
|
15547
15767
|
if (this.inAsync && name === "await")
|
|
15548
15768
|
{ this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
|
|
15769
|
+
if (this.currentThisScope().inClassFieldInit && name === "arguments")
|
|
15770
|
+
{ this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
|
|
15549
15771
|
if (this.keywords.test(name))
|
|
15550
15772
|
{ this.raise(start, ("Unexpected keyword '" + name + "'")); }
|
|
15551
15773
|
if (this.options.ecmaVersion < 6 &&
|
|
@@ -15590,9 +15812,29 @@ pp$3.parseIdent = function(liberal, isBinding) {
|
|
|
15590
15812
|
return node
|
|
15591
15813
|
};
|
|
15592
15814
|
|
|
15815
|
+
pp$3.parsePrivateIdent = function() {
|
|
15816
|
+
var node = this.startNode();
|
|
15817
|
+
if (this.type === types.privateId) {
|
|
15818
|
+
node.name = this.value;
|
|
15819
|
+
} else {
|
|
15820
|
+
this.unexpected();
|
|
15821
|
+
}
|
|
15822
|
+
this.next();
|
|
15823
|
+
this.finishNode(node, "PrivateIdentifier");
|
|
15824
|
+
|
|
15825
|
+
// For validating existence
|
|
15826
|
+
if (this.privateNameStack.length === 0) {
|
|
15827
|
+
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
|
|
15828
|
+
} else {
|
|
15829
|
+
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
|
|
15830
|
+
}
|
|
15831
|
+
|
|
15832
|
+
return node
|
|
15833
|
+
};
|
|
15834
|
+
|
|
15593
15835
|
// Parses yield expression inside generator.
|
|
15594
15836
|
|
|
15595
|
-
pp$3.parseYield = function(
|
|
15837
|
+
pp$3.parseYield = function(forInit) {
|
|
15596
15838
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
15597
15839
|
|
|
15598
15840
|
var node = this.startNode();
|
|
@@ -15602,7 +15844,7 @@ pp$3.parseYield = function(noIn) {
|
|
|
15602
15844
|
node.argument = null;
|
|
15603
15845
|
} else {
|
|
15604
15846
|
node.delegate = this.eat(types.star);
|
|
15605
|
-
node.argument = this.parseMaybeAssign(
|
|
15847
|
+
node.argument = this.parseMaybeAssign(forInit);
|
|
15606
15848
|
}
|
|
15607
15849
|
return this.finishNode(node, "YieldExpression")
|
|
15608
15850
|
};
|
|
@@ -15650,6 +15892,8 @@ var Scope = function Scope(flags) {
|
|
|
15650
15892
|
this.lexical = [];
|
|
15651
15893
|
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
|
|
15652
15894
|
this.functions = [];
|
|
15895
|
+
// A switch to disallow the identifier reference 'arguments'
|
|
15896
|
+
this.inClassFieldInit = false;
|
|
15653
15897
|
};
|
|
15654
15898
|
|
|
15655
15899
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
@@ -17126,9 +17370,9 @@ pp$9.readToken = function(code) {
|
|
|
17126
17370
|
|
|
17127
17371
|
pp$9.fullCharCodeAtPos = function() {
|
|
17128
17372
|
var code = this.input.charCodeAt(this.pos);
|
|
17129
|
-
if (code <= 0xd7ff || code >=
|
|
17373
|
+
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
17130
17374
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
17131
|
-
return (code << 10) + next - 0x35fdc00
|
|
17375
|
+
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
17132
17376
|
};
|
|
17133
17377
|
|
|
17134
17378
|
pp$9.skipBlockComment = function() {
|
|
@@ -17347,6 +17591,20 @@ pp$9.readToken_question = function() { // '?'
|
|
|
17347
17591
|
return this.finishOp(types.question, 1)
|
|
17348
17592
|
};
|
|
17349
17593
|
|
|
17594
|
+
pp$9.readToken_numberSign = function() { // '#'
|
|
17595
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
17596
|
+
var code = 35; // '#'
|
|
17597
|
+
if (ecmaVersion >= 13) {
|
|
17598
|
+
++this.pos;
|
|
17599
|
+
code = this.fullCharCodeAtPos();
|
|
17600
|
+
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
17601
|
+
return this.finishToken(types.privateId, this.readWord1())
|
|
17602
|
+
}
|
|
17603
|
+
}
|
|
17604
|
+
|
|
17605
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
|
|
17606
|
+
};
|
|
17607
|
+
|
|
17350
17608
|
pp$9.getTokenFromCode = function(code) {
|
|
17351
17609
|
switch (code) {
|
|
17352
17610
|
// The interpretation of a dot depends on whether it is followed
|
|
@@ -17418,6 +17676,9 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
17418
17676
|
|
|
17419
17677
|
case 126: // '~'
|
|
17420
17678
|
return this.finishOp(types.prefix, 1)
|
|
17679
|
+
|
|
17680
|
+
case 35: // '#'
|
|
17681
|
+
return this.readToken_numberSign()
|
|
17421
17682
|
}
|
|
17422
17683
|
|
|
17423
17684
|
this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
|
|
@@ -17829,7 +18090,7 @@ pp$9.readWord = function() {
|
|
|
17829
18090
|
|
|
17830
18091
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
17831
18092
|
|
|
17832
|
-
var version = "8.
|
|
18093
|
+
var version = "8.2.4";
|
|
17833
18094
|
|
|
17834
18095
|
Parser.acorn = {
|
|
17835
18096
|
Parser: Parser,
|
|
@@ -17864,47 +18125,6 @@ function parse(input, options) {
|
|
|
17864
18125
|
return Parser.parse(input, options)
|
|
17865
18126
|
}
|
|
17866
18127
|
|
|
17867
|
-
// This function tries to parse a single expression at a given
|
|
17868
|
-
// offset in a string. Useful for parsing mixed-language formats
|
|
17869
|
-
// that embed JavaScript expressions.
|
|
17870
|
-
|
|
17871
|
-
function parseExpressionAt(input, pos, options) {
|
|
17872
|
-
return Parser.parseExpressionAt(input, pos, options)
|
|
17873
|
-
}
|
|
17874
|
-
|
|
17875
|
-
// Acorn is organized as a tokenizer and a recursive-descent parser.
|
|
17876
|
-
// The `tokenizer` export provides an interface to the tokenizer.
|
|
17877
|
-
|
|
17878
|
-
function tokenizer(input, options) {
|
|
17879
|
-
return Parser.tokenizer(input, options)
|
|
17880
|
-
}
|
|
17881
|
-
|
|
17882
|
-
var acorn = {
|
|
17883
|
-
__proto__: null,
|
|
17884
|
-
Node: Node,
|
|
17885
|
-
Parser: Parser,
|
|
17886
|
-
Position: Position,
|
|
17887
|
-
SourceLocation: SourceLocation,
|
|
17888
|
-
TokContext: TokContext,
|
|
17889
|
-
Token: Token,
|
|
17890
|
-
TokenType: TokenType,
|
|
17891
|
-
defaultOptions: defaultOptions,
|
|
17892
|
-
getLineInfo: getLineInfo,
|
|
17893
|
-
isIdentifierChar: isIdentifierChar,
|
|
17894
|
-
isIdentifierStart: isIdentifierStart,
|
|
17895
|
-
isNewLine: isNewLine,
|
|
17896
|
-
keywordTypes: keywords$1,
|
|
17897
|
-
lineBreak: lineBreak,
|
|
17898
|
-
lineBreakG: lineBreakG,
|
|
17899
|
-
nonASCIIwhitespace: nonASCIIwhitespace,
|
|
17900
|
-
parse: parse,
|
|
17901
|
-
parseExpressionAt: parseExpressionAt,
|
|
17902
|
-
tokContexts: types$1,
|
|
17903
|
-
tokTypes: types,
|
|
17904
|
-
tokenizer: tokenizer,
|
|
17905
|
-
version: version
|
|
17906
|
-
};
|
|
17907
|
-
|
|
17908
18128
|
class GlobalScope extends Scope$1 {
|
|
17909
18129
|
constructor() {
|
|
17910
18130
|
super();
|
|
@@ -18654,7 +18874,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
18654
18874
|
cache: cacheInstance,
|
|
18655
18875
|
emitAsset: getDeprecatedContextHandler((name, source) => fileEmitter.emitFile({ type: 'asset', name, source }), 'emitAsset', 'emitFile', plugin.name, true, options),
|
|
18656
18876
|
emitChunk: getDeprecatedContextHandler((id, options) => fileEmitter.emitFile({ type: 'chunk', id, name: options && options.name }), 'emitChunk', 'emitFile', plugin.name, true, options),
|
|
18657
|
-
emitFile: fileEmitter.emitFile,
|
|
18877
|
+
emitFile: fileEmitter.emitFile.bind(fileEmitter),
|
|
18658
18878
|
error(err) {
|
|
18659
18879
|
return throwPluginError(err, plugin.name);
|
|
18660
18880
|
},
|
|
@@ -18729,10 +18949,10 @@ class PluginDriver {
|
|
|
18729
18949
|
warnDeprecatedHooks(userPlugins, options);
|
|
18730
18950
|
this.pluginCache = pluginCache;
|
|
18731
18951
|
this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
|
|
18732
|
-
this.emitFile = this.fileEmitter.emitFile;
|
|
18733
|
-
this.getFileName = this.fileEmitter.getFileName;
|
|
18734
|
-
this.finaliseAssets = this.fileEmitter.assertAssetsFinalized;
|
|
18735
|
-
this.setOutputBundle = this.fileEmitter.setOutputBundle;
|
|
18952
|
+
this.emitFile = this.fileEmitter.emitFile.bind(this.fileEmitter);
|
|
18953
|
+
this.getFileName = this.fileEmitter.getFileName.bind(this.fileEmitter);
|
|
18954
|
+
this.finaliseAssets = this.fileEmitter.assertAssetsFinalized.bind(this.fileEmitter);
|
|
18955
|
+
this.setOutputBundle = this.fileEmitter.setOutputBundle.bind(this.fileEmitter);
|
|
18736
18956
|
this.plugins = userPlugins.concat(basePluginDriver ? basePluginDriver.plugins : []);
|
|
18737
18957
|
const existingPluginNames = new Set();
|
|
18738
18958
|
for (const plugin of this.plugins) {
|
|
@@ -19132,7 +19352,7 @@ base.ImportDeclaration = function (node, st, c) {
|
|
|
19132
19352
|
base.ImportExpression = function (node, st, c) {
|
|
19133
19353
|
c(node.source, st, "Expression");
|
|
19134
19354
|
};
|
|
19135
|
-
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
|
19355
|
+
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
|
|
19136
19356
|
|
|
19137
19357
|
base.TaggedTemplateExpression = function (node, st, c) {
|
|
19138
19358
|
c(node.tag, st, "Expression");
|
|
@@ -19152,9 +19372,9 @@ base.ClassBody = function (node, st, c) {
|
|
|
19152
19372
|
c(elt, st);
|
|
19153
19373
|
}
|
|
19154
19374
|
};
|
|
19155
|
-
base.MethodDefinition = base.Property = function (node, st, c) {
|
|
19375
|
+
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
|
|
19156
19376
|
if (node.computed) { c(node.key, st, "Expression"); }
|
|
19157
|
-
c(node.value, st, "Expression");
|
|
19377
|
+
if (node.value) { c(node.value, st, "Expression"); }
|
|
19158
19378
|
};
|
|
19159
19379
|
|
|
19160
19380
|
// patch up acorn-walk until class-fields are officially supported
|
|
@@ -19166,10 +19386,30 @@ base.PropertyDefinition = function (node, st, c) {
|
|
|
19166
19386
|
c(node.value, st, 'Expression');
|
|
19167
19387
|
}
|
|
19168
19388
|
};
|
|
19389
|
+
function isOnlyWhitespaceOrComments(code) {
|
|
19390
|
+
// streamline the typical case
|
|
19391
|
+
if (/^\s*$/.test(code))
|
|
19392
|
+
return true;
|
|
19393
|
+
try {
|
|
19394
|
+
// successful only if it's a valid Program without statements
|
|
19395
|
+
const ast = parse(code, { ecmaVersion: 'latest' });
|
|
19396
|
+
return ast.body && ast.body.length === 0;
|
|
19397
|
+
}
|
|
19398
|
+
catch (_a) {
|
|
19399
|
+
// should only be reached by invalid annotations like:
|
|
19400
|
+
//
|
|
19401
|
+
// foo() /*@__PURE__*/ /* other */, bar();
|
|
19402
|
+
//
|
|
19403
|
+
// where `code` is " /* other */, "
|
|
19404
|
+
}
|
|
19405
|
+
return false;
|
|
19406
|
+
}
|
|
19169
19407
|
function handlePureAnnotationsOfNode(node, state, type = node.type) {
|
|
19170
19408
|
let commentNode = state.commentNodes[state.commentIndex];
|
|
19171
19409
|
while (commentNode && node.start >= commentNode.end) {
|
|
19172
|
-
|
|
19410
|
+
const between = state.code.substring(commentNode.end, node.start);
|
|
19411
|
+
if (isOnlyWhitespaceOrComments(between))
|
|
19412
|
+
markPureNode(node, commentNode);
|
|
19173
19413
|
commentNode = state.commentNodes[++state.commentIndex];
|
|
19174
19414
|
}
|
|
19175
19415
|
if (commentNode && commentNode.end <= node.end) {
|
|
@@ -19197,8 +19437,9 @@ function markPureNode(node, comment) {
|
|
|
19197
19437
|
}
|
|
19198
19438
|
const pureCommentRegex = /[@#]__PURE__/;
|
|
19199
19439
|
const isPureComment = (comment) => pureCommentRegex.test(comment.value);
|
|
19200
|
-
function markPureCallExpressions(comments, esTreeAst) {
|
|
19440
|
+
function markPureCallExpressions(comments, esTreeAst, code) {
|
|
19201
19441
|
handlePureAnnotationsOfNode(esTreeAst, {
|
|
19442
|
+
code,
|
|
19202
19443
|
commentIndex: 0,
|
|
19203
19444
|
commentNodes: comments.filter(isPureComment)
|
|
19204
19445
|
});
|
|
@@ -19305,7 +19546,7 @@ class Graph {
|
|
|
19305
19546
|
onCommentOrig.push(...comments);
|
|
19306
19547
|
}
|
|
19307
19548
|
options.onComment = onCommentOrig;
|
|
19308
|
-
markPureCallExpressions(comments, ast);
|
|
19549
|
+
markPureCallExpressions(comments, ast, code);
|
|
19309
19550
|
return ast;
|
|
19310
19551
|
}
|
|
19311
19552
|
getCache() {
|
|
@@ -19419,348 +19660,6 @@ class Graph {
|
|
|
19419
19660
|
}
|
|
19420
19661
|
}
|
|
19421
19662
|
|
|
19422
|
-
var require$$1 = /*@__PURE__*/getAugmentedNamespace(acorn);
|
|
19423
|
-
|
|
19424
|
-
const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
|
|
19425
|
-
|
|
19426
|
-
const getAcorn$1 = Parser => {
|
|
19427
|
-
if (Parser.acorn) return Parser.acorn
|
|
19428
|
-
|
|
19429
|
-
const acorn = require$$1;
|
|
19430
|
-
|
|
19431
|
-
if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
|
|
19432
|
-
throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
|
|
19433
|
-
}
|
|
19434
|
-
|
|
19435
|
-
// Make sure `Parser` comes from the same acorn as we `require`d,
|
|
19436
|
-
// otherwise the comparisons fail.
|
|
19437
|
-
for (let cur = Parser; cur && cur !== acorn.Parser; cur = getPrototype(cur)) {
|
|
19438
|
-
if (cur !== acorn.Parser) {
|
|
19439
|
-
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
|
|
19440
|
-
}
|
|
19441
|
-
}
|
|
19442
|
-
return acorn
|
|
19443
|
-
};
|
|
19444
|
-
|
|
19445
|
-
var acornPrivateClassElements = function(Parser) {
|
|
19446
|
-
// Only load this plugin once.
|
|
19447
|
-
if (Parser.prototype.parsePrivateName) {
|
|
19448
|
-
return Parser
|
|
19449
|
-
}
|
|
19450
|
-
|
|
19451
|
-
const acorn = getAcorn$1(Parser);
|
|
19452
|
-
|
|
19453
|
-
Parser = class extends Parser {
|
|
19454
|
-
_branch() {
|
|
19455
|
-
this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input);
|
|
19456
|
-
this.__branch.end = this.end;
|
|
19457
|
-
this.__branch.pos = this.pos;
|
|
19458
|
-
this.__branch.type = this.type;
|
|
19459
|
-
this.__branch.value = this.value;
|
|
19460
|
-
this.__branch.containsEsc = this.containsEsc;
|
|
19461
|
-
return this.__branch
|
|
19462
|
-
}
|
|
19463
|
-
|
|
19464
|
-
parsePrivateClassElementName(element) {
|
|
19465
|
-
element.computed = false;
|
|
19466
|
-
element.key = this.parsePrivateName();
|
|
19467
|
-
if (element.key.name == "constructor") this.raise(element.key.start, "Classes may not have a private element named constructor");
|
|
19468
|
-
const accept = {get: "set", set: "get"}[element.kind];
|
|
19469
|
-
const privateBoundNames = this._privateBoundNames;
|
|
19470
|
-
if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
|
|
19471
|
-
this.raise(element.start, "Duplicate private element");
|
|
19472
|
-
}
|
|
19473
|
-
privateBoundNames[element.key.name] = element.kind || true;
|
|
19474
|
-
delete this._unresolvedPrivateNames[element.key.name];
|
|
19475
|
-
return element.key
|
|
19476
|
-
}
|
|
19477
|
-
|
|
19478
|
-
parsePrivateName() {
|
|
19479
|
-
const node = this.startNode();
|
|
19480
|
-
node.name = this.value;
|
|
19481
|
-
this.next();
|
|
19482
|
-
this.finishNode(node, "PrivateIdentifier");
|
|
19483
|
-
if (this.options.allowReserved == "never") this.checkUnreserved(node);
|
|
19484
|
-
return node
|
|
19485
|
-
}
|
|
19486
|
-
|
|
19487
|
-
// Parse # token
|
|
19488
|
-
getTokenFromCode(code) {
|
|
19489
|
-
if (code === 35) {
|
|
19490
|
-
++this.pos;
|
|
19491
|
-
const word = this.readWord1();
|
|
19492
|
-
return this.finishToken(this.privateIdentifierToken, word)
|
|
19493
|
-
}
|
|
19494
|
-
return super.getTokenFromCode(code)
|
|
19495
|
-
}
|
|
19496
|
-
|
|
19497
|
-
// Manage stacks and check for undeclared private names
|
|
19498
|
-
parseClass(node, isStatement) {
|
|
19499
|
-
const oldOuterPrivateBoundNames = this._outerPrivateBoundNames;
|
|
19500
|
-
this._outerPrivateBoundNames = this._privateBoundNames;
|
|
19501
|
-
this._privateBoundNames = Object.create(this._privateBoundNames || null);
|
|
19502
|
-
const oldOuterUnresolvedPrivateNames = this._outerUnresolvedPrivateNames;
|
|
19503
|
-
this._outerUnresolvedPrivateNames = this._unresolvedPrivateNames;
|
|
19504
|
-
this._unresolvedPrivateNames = Object.create(null);
|
|
19505
|
-
|
|
19506
|
-
const _return = super.parseClass(node, isStatement);
|
|
19507
|
-
|
|
19508
|
-
const unresolvedPrivateNames = this._unresolvedPrivateNames;
|
|
19509
|
-
this._privateBoundNames = this._outerPrivateBoundNames;
|
|
19510
|
-
this._outerPrivateBoundNames = oldOuterPrivateBoundNames;
|
|
19511
|
-
this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
|
|
19512
|
-
this._outerUnresolvedPrivateNames = oldOuterUnresolvedPrivateNames;
|
|
19513
|
-
if (!this._unresolvedPrivateNames) {
|
|
19514
|
-
const names = Object.keys(unresolvedPrivateNames);
|
|
19515
|
-
if (names.length) {
|
|
19516
|
-
names.sort((n1, n2) => unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]);
|
|
19517
|
-
this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name");
|
|
19518
|
-
}
|
|
19519
|
-
} else Object.assign(this._unresolvedPrivateNames, unresolvedPrivateNames);
|
|
19520
|
-
return _return
|
|
19521
|
-
}
|
|
19522
|
-
|
|
19523
|
-
// Class heritage is evaluated with outer private environment
|
|
19524
|
-
parseClassSuper(node) {
|
|
19525
|
-
const privateBoundNames = this._privateBoundNames;
|
|
19526
|
-
this._privateBoundNames = this._outerPrivateBoundNames;
|
|
19527
|
-
const unresolvedPrivateNames = this._unresolvedPrivateNames;
|
|
19528
|
-
this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
|
|
19529
|
-
const _return = super.parseClassSuper(node);
|
|
19530
|
-
this._privateBoundNames = privateBoundNames;
|
|
19531
|
-
this._unresolvedPrivateNames = unresolvedPrivateNames;
|
|
19532
|
-
return _return
|
|
19533
|
-
}
|
|
19534
|
-
|
|
19535
|
-
// Parse private element access
|
|
19536
|
-
parseSubscript(base, startPos, startLoc, _noCalls, _maybeAsyncArrow, _optionalChained) {
|
|
19537
|
-
const optionalSupported = this.options.ecmaVersion >= 11 && acorn.tokTypes.questionDot;
|
|
19538
|
-
const branch = this._branch();
|
|
19539
|
-
if (!(
|
|
19540
|
-
(branch.eat(acorn.tokTypes.dot) || (optionalSupported && branch.eat(acorn.tokTypes.questionDot))) &&
|
|
19541
|
-
branch.type == this.privateIdentifierToken
|
|
19542
|
-
)) {
|
|
19543
|
-
return super.parseSubscript.apply(this, arguments)
|
|
19544
|
-
}
|
|
19545
|
-
let optional = false;
|
|
19546
|
-
if (!this.eat(acorn.tokTypes.dot)) {
|
|
19547
|
-
this.expect(acorn.tokTypes.questionDot);
|
|
19548
|
-
optional = true;
|
|
19549
|
-
}
|
|
19550
|
-
let node = this.startNodeAt(startPos, startLoc);
|
|
19551
|
-
node.object = base;
|
|
19552
|
-
node.computed = false;
|
|
19553
|
-
if (optionalSupported) {
|
|
19554
|
-
node.optional = optional;
|
|
19555
|
-
}
|
|
19556
|
-
if (this.type == this.privateIdentifierToken) {
|
|
19557
|
-
if (base.type == "Super") {
|
|
19558
|
-
this.raise(this.start, "Cannot access private element on super");
|
|
19559
|
-
}
|
|
19560
|
-
node.property = this.parsePrivateName();
|
|
19561
|
-
if (!this._privateBoundNames || !this._privateBoundNames[node.property.name]) {
|
|
19562
|
-
if (!this._unresolvedPrivateNames) {
|
|
19563
|
-
this.raise(node.property.start, "Usage of undeclared private name");
|
|
19564
|
-
}
|
|
19565
|
-
this._unresolvedPrivateNames[node.property.name] = node.property.start;
|
|
19566
|
-
}
|
|
19567
|
-
} else {
|
|
19568
|
-
node.property = this.parseIdent(true);
|
|
19569
|
-
}
|
|
19570
|
-
return this.finishNode(node, "MemberExpression")
|
|
19571
|
-
}
|
|
19572
|
-
|
|
19573
|
-
// Prohibit delete of private class elements
|
|
19574
|
-
parseMaybeUnary(refDestructuringErrors, sawUnary) {
|
|
19575
|
-
const _return = super.parseMaybeUnary(refDestructuringErrors, sawUnary);
|
|
19576
|
-
if (_return.operator == "delete") {
|
|
19577
|
-
if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateIdentifier") {
|
|
19578
|
-
this.raise(_return.start, "Private elements may not be deleted");
|
|
19579
|
-
}
|
|
19580
|
-
}
|
|
19581
|
-
return _return
|
|
19582
|
-
}
|
|
19583
|
-
};
|
|
19584
|
-
Parser.prototype.privateIdentifierToken = new acorn.TokenType("privateIdentifier");
|
|
19585
|
-
return Parser
|
|
19586
|
-
};
|
|
19587
|
-
|
|
19588
|
-
const privateClassElements$1 = acornPrivateClassElements;
|
|
19589
|
-
|
|
19590
|
-
var acornClassFields = function(Parser) {
|
|
19591
|
-
const acorn = Parser.acorn || require$$1;
|
|
19592
|
-
const tt = acorn.tokTypes;
|
|
19593
|
-
|
|
19594
|
-
Parser = privateClassElements$1(Parser);
|
|
19595
|
-
return class extends Parser {
|
|
19596
|
-
_maybeParseFieldValue(field) {
|
|
19597
|
-
if (this.eat(tt.eq)) {
|
|
19598
|
-
const oldInFieldValue = this._inFieldValue;
|
|
19599
|
-
this._inFieldValue = true;
|
|
19600
|
-
if (this.type === tt.name && this.value === "await" && (this.inAsync || this.options.allowAwaitOutsideFunction)) {
|
|
19601
|
-
field.value = this.parseAwait();
|
|
19602
|
-
} else field.value = this.parseExpression();
|
|
19603
|
-
this._inFieldValue = oldInFieldValue;
|
|
19604
|
-
} else field.value = null;
|
|
19605
|
-
}
|
|
19606
|
-
|
|
19607
|
-
// Parse fields
|
|
19608
|
-
parseClassElement(_constructorAllowsSuper) {
|
|
19609
|
-
if (this.options.ecmaVersion >= 8 && (this.type == tt.name || this.type.keyword || this.type == this.privateIdentifierToken || this.type == tt.bracketL || this.type == tt.string || this.type == tt.num)) {
|
|
19610
|
-
const branch = this._branch();
|
|
19611
|
-
if (branch.type == tt.bracketL) {
|
|
19612
|
-
let count = 0;
|
|
19613
|
-
do {
|
|
19614
|
-
if (branch.eat(tt.bracketL)) ++count;
|
|
19615
|
-
else if (branch.eat(tt.bracketR)) --count;
|
|
19616
|
-
else branch.next();
|
|
19617
|
-
} while (count > 0)
|
|
19618
|
-
} else branch.next(true);
|
|
19619
|
-
let isField = branch.type == tt.eq || branch.type == tt.semi;
|
|
19620
|
-
if (!isField && branch.canInsertSemicolon()) {
|
|
19621
|
-
isField = branch.type != tt.parenL;
|
|
19622
|
-
}
|
|
19623
|
-
if (isField) {
|
|
19624
|
-
const node = this.startNode();
|
|
19625
|
-
if (this.type == this.privateIdentifierToken) {
|
|
19626
|
-
this.parsePrivateClassElementName(node);
|
|
19627
|
-
} else {
|
|
19628
|
-
this.parsePropertyName(node);
|
|
19629
|
-
}
|
|
19630
|
-
if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
|
|
19631
|
-
(node.key.type === "Literal" && node.key.value === "constructor")) {
|
|
19632
|
-
this.raise(node.key.start, "Classes may not have a field called constructor");
|
|
19633
|
-
}
|
|
19634
|
-
this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
|
|
19635
|
-
this._maybeParseFieldValue(node);
|
|
19636
|
-
this.exitScope();
|
|
19637
|
-
this.finishNode(node, "PropertyDefinition");
|
|
19638
|
-
this.semicolon();
|
|
19639
|
-
return node
|
|
19640
|
-
}
|
|
19641
|
-
}
|
|
19642
|
-
|
|
19643
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19644
|
-
}
|
|
19645
|
-
|
|
19646
|
-
// Prohibit arguments in class field initializers
|
|
19647
|
-
parseIdent(liberal, isBinding) {
|
|
19648
|
-
const ident = super.parseIdent(liberal, isBinding);
|
|
19649
|
-
if (this._inFieldValue && ident.name == "arguments") this.raise(ident.start, "A class field initializer may not contain arguments");
|
|
19650
|
-
return ident
|
|
19651
|
-
}
|
|
19652
|
-
}
|
|
19653
|
-
};
|
|
19654
|
-
|
|
19655
|
-
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
19656
|
-
|
|
19657
|
-
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
19658
|
-
function privateMethods(Parser) {
|
|
19659
|
-
const ExtendedParser = acornPrivateClassElements(Parser);
|
|
19660
|
-
|
|
19661
|
-
return class extends ExtendedParser {
|
|
19662
|
-
// Parse private methods
|
|
19663
|
-
parseClassElement(_constructorAllowsSuper) {
|
|
19664
|
-
const oldInClassMemberName = this._inClassMemberName;
|
|
19665
|
-
this._inClassMemberName = true;
|
|
19666
|
-
const result = super.parseClassElement.apply(this, arguments);
|
|
19667
|
-
this._inClassMemberName = oldInClassMemberName;
|
|
19668
|
-
return result
|
|
19669
|
-
}
|
|
19670
|
-
|
|
19671
|
-
parsePropertyName(prop) {
|
|
19672
|
-
const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateIdentifierToken && !prop.static;
|
|
19673
|
-
this._inClassMemberName = false;
|
|
19674
|
-
if (!isPrivate) return super.parsePropertyName(prop)
|
|
19675
|
-
return this.parsePrivateClassElementName(prop)
|
|
19676
|
-
}
|
|
19677
|
-
}
|
|
19678
|
-
}
|
|
19679
|
-
|
|
19680
|
-
const privateClassElements = acornPrivateClassElements;
|
|
19681
|
-
|
|
19682
|
-
var acornStaticClassFeatures = function(Parser) {
|
|
19683
|
-
const ExtendedParser = privateClassElements(Parser);
|
|
19684
|
-
|
|
19685
|
-
const acorn = Parser.acorn || require$$1;
|
|
19686
|
-
const tt = acorn.tokTypes;
|
|
19687
|
-
|
|
19688
|
-
return class extends ExtendedParser {
|
|
19689
|
-
_maybeParseFieldValue(field) {
|
|
19690
|
-
if (this.eat(tt.eq)) {
|
|
19691
|
-
const oldInFieldValue = this._inStaticFieldScope;
|
|
19692
|
-
this._inStaticFieldScope = this.currentThisScope();
|
|
19693
|
-
field.value = this.parseExpression();
|
|
19694
|
-
this._inStaticFieldScope = oldInFieldValue;
|
|
19695
|
-
} else field.value = null;
|
|
19696
|
-
}
|
|
19697
|
-
|
|
19698
|
-
// Parse fields
|
|
19699
|
-
parseClassElement(_constructorAllowsSuper) {
|
|
19700
|
-
if (this.options.ecmaVersion < 8 || !this.isContextual("static")) {
|
|
19701
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19702
|
-
}
|
|
19703
|
-
|
|
19704
|
-
const branch = this._branch();
|
|
19705
|
-
branch.next();
|
|
19706
|
-
if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateIdentifierToken].indexOf(branch.type) == -1 && !branch.type.keyword) {
|
|
19707
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19708
|
-
}
|
|
19709
|
-
if (branch.type == tt.bracketL) {
|
|
19710
|
-
let count = 0;
|
|
19711
|
-
do {
|
|
19712
|
-
if (branch.eat(tt.bracketL)) ++count;
|
|
19713
|
-
else if (branch.eat(tt.bracketR)) --count;
|
|
19714
|
-
else branch.next();
|
|
19715
|
-
} while (count > 0)
|
|
19716
|
-
} else branch.next();
|
|
19717
|
-
if (branch.type != tt.eq && !branch.canInsertSemicolon() && branch.type != tt.semi) {
|
|
19718
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19719
|
-
}
|
|
19720
|
-
|
|
19721
|
-
const node = this.startNode();
|
|
19722
|
-
node.static = this.eatContextual("static");
|
|
19723
|
-
if (this.type == this.privateIdentifierToken) {
|
|
19724
|
-
this.parsePrivateClassElementName(node);
|
|
19725
|
-
} else {
|
|
19726
|
-
this.parsePropertyName(node);
|
|
19727
|
-
}
|
|
19728
|
-
if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
|
|
19729
|
-
(node.key.type === "Literal" && !node.computed && node.key.value === "constructor")) {
|
|
19730
|
-
this.raise(node.key.start, "Classes may not have a field called constructor");
|
|
19731
|
-
}
|
|
19732
|
-
if ((node.key.name || node.key.value) === "prototype" && !node.computed) {
|
|
19733
|
-
this.raise(node.key.start, "Classes may not have a static property named prototype");
|
|
19734
|
-
}
|
|
19735
|
-
|
|
19736
|
-
this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
|
|
19737
|
-
this._maybeParseFieldValue(node);
|
|
19738
|
-
this.exitScope();
|
|
19739
|
-
this.finishNode(node, "PropertyDefinition");
|
|
19740
|
-
this.semicolon();
|
|
19741
|
-
return node
|
|
19742
|
-
}
|
|
19743
|
-
|
|
19744
|
-
// Parse private static methods
|
|
19745
|
-
parsePropertyName(prop) {
|
|
19746
|
-
if (prop.static && this.type == this.privateIdentifierToken) {
|
|
19747
|
-
this.parsePrivateClassElementName(prop);
|
|
19748
|
-
} else {
|
|
19749
|
-
super.parsePropertyName(prop);
|
|
19750
|
-
}
|
|
19751
|
-
}
|
|
19752
|
-
|
|
19753
|
-
// Prohibit arguments in class field initializers
|
|
19754
|
-
parseIdent(liberal, isBinding) {
|
|
19755
|
-
const ident = super.parseIdent(liberal, isBinding);
|
|
19756
|
-
if (this._inStaticFieldScope && this.currentThisScope() === this._inStaticFieldScope && ident.name == "arguments") {
|
|
19757
|
-
this.raise(ident.start, "A static class field initializer may not contain arguments");
|
|
19758
|
-
}
|
|
19759
|
-
return ident
|
|
19760
|
-
}
|
|
19761
|
-
}
|
|
19762
|
-
};
|
|
19763
|
-
|
|
19764
19663
|
function normalizeInputOptions(config) {
|
|
19765
19664
|
var _a, _b, _c;
|
|
19766
19665
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -19817,12 +19716,7 @@ const getAcorn = (config) => ({
|
|
|
19817
19716
|
sourceType: 'module',
|
|
19818
19717
|
...config.acorn
|
|
19819
19718
|
});
|
|
19820
|
-
const getAcornInjectPlugins = (config) =>
|
|
19821
|
-
acornClassFields,
|
|
19822
|
-
privateMethods,
|
|
19823
|
-
acornStaticClassFeatures,
|
|
19824
|
-
...ensureArray(config.acornInjectPlugins)
|
|
19825
|
-
];
|
|
19719
|
+
const getAcornInjectPlugins = (config) => ensureArray(config.acornInjectPlugins);
|
|
19826
19720
|
const getCache = (config) => {
|
|
19827
19721
|
var _a;
|
|
19828
19722
|
return ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.cache) || config.cache;
|
|
@@ -19942,6 +19836,14 @@ const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules, w
|
|
|
19942
19836
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
19943
19837
|
};
|
|
19944
19838
|
|
|
19839
|
+
function sanitizeFileName(name) {
|
|
19840
|
+
const match = /^[a-z]:/i.exec(name);
|
|
19841
|
+
const driveLetter = match ? match[0] : "";
|
|
19842
|
+
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
19843
|
+
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
19844
|
+
return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
|
|
19845
|
+
}
|
|
19846
|
+
|
|
19945
19847
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
19946
19848
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
19947
19849
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -19986,6 +19888,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19986
19888
|
preferConst: config.preferConst || false,
|
|
19987
19889
|
preserveModules,
|
|
19988
19890
|
preserveModulesRoot: getPreserveModulesRoot(config),
|
|
19891
|
+
sanitizeFileName: (typeof config.sanitizeFileName === 'function' ? config.sanitizeFileName : config.sanitizeFileName === false ? (id) => id : sanitizeFileName),
|
|
19989
19892
|
sourcemap: config.sourcemap || false,
|
|
19990
19893
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
19991
19894
|
sourcemapFile: config.sourcemapFile,
|
|
@@ -20214,7 +20117,10 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
20214
20117
|
}
|
|
20215
20118
|
return configManualChunks || {};
|
|
20216
20119
|
};
|
|
20217
|
-
const getMinifyInternalExports = (config, format, compact) => {
|
|
20120
|
+
const getMinifyInternalExports = (config, format, compact) => {
|
|
20121
|
+
var _a;
|
|
20122
|
+
return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system');
|
|
20123
|
+
};
|
|
20218
20124
|
|
|
20219
20125
|
function rollup(rawInputOptions) {
|
|
20220
20126
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -20412,9 +20318,9 @@ exports.ensureArray = ensureArray;
|
|
|
20412
20318
|
exports.error = error;
|
|
20413
20319
|
exports.fseventsImporter = fseventsImporter;
|
|
20414
20320
|
exports.getAliasName = getAliasName;
|
|
20415
|
-
exports.getAugmentedNamespace = getAugmentedNamespace;
|
|
20416
20321
|
exports.getOrCreate = getOrCreate;
|
|
20417
20322
|
exports.loadFsEvents = loadFsEvents;
|
|
20323
|
+
exports.printQuotedStringList = printQuotedStringList;
|
|
20418
20324
|
exports.relativeId = relativeId;
|
|
20419
20325
|
exports.rollup = rollup;
|
|
20420
20326
|
exports.rollupInternal = rollupInternal;
|