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/es/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
|
|
@@ -14,7 +14,7 @@ import * as fs from 'fs';
|
|
|
14
14
|
import { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.
|
|
17
|
+
var version$1 = "2.48.0";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -4351,14 +4351,18 @@ class NamespaceVariable extends Variable {
|
|
|
4351
4351
|
this.references.push(identifier);
|
|
4352
4352
|
this.name = identifier.name;
|
|
4353
4353
|
}
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
// the reassignment to the right variable. This means we lost track of this variable and thus
|
|
4357
|
-
// need to reassign all exports.
|
|
4358
|
-
deoptimizePath() {
|
|
4354
|
+
deoptimizePath(path) {
|
|
4355
|
+
var _a;
|
|
4359
4356
|
const memberVariables = this.getMemberVariables();
|
|
4360
|
-
|
|
4361
|
-
|
|
4357
|
+
const memberPath = path.length <= 1 ? UNKNOWN_PATH : path.slice(1);
|
|
4358
|
+
const key = path[0];
|
|
4359
|
+
if (typeof key === 'string') {
|
|
4360
|
+
(_a = memberVariables[key]) === null || _a === void 0 ? void 0 : _a.deoptimizePath(memberPath);
|
|
4361
|
+
}
|
|
4362
|
+
else {
|
|
4363
|
+
for (const key of Object.keys(memberVariables)) {
|
|
4364
|
+
memberVariables[key].deoptimizePath(memberPath);
|
|
4365
|
+
}
|
|
4362
4366
|
}
|
|
4363
4367
|
}
|
|
4364
4368
|
getMemberVariables() {
|
|
@@ -4368,7 +4372,10 @@ class NamespaceVariable extends Variable {
|
|
|
4368
4372
|
const memberVariables = Object.create(null);
|
|
4369
4373
|
for (const name of this.context.getExports().concat(this.context.getReexports())) {
|
|
4370
4374
|
if (name[0] !== '*' && name !== this.module.info.syntheticNamedExports) {
|
|
4371
|
-
|
|
4375
|
+
const exportedVariable = this.context.traceExport(name);
|
|
4376
|
+
if (exportedVariable) {
|
|
4377
|
+
memberVariables[name] = exportedVariable;
|
|
4378
|
+
}
|
|
4372
4379
|
}
|
|
4373
4380
|
}
|
|
4374
4381
|
return (this.memberVariables = memberVariables);
|
|
@@ -4541,6 +4548,32 @@ function normalize(path) {
|
|
|
4541
4548
|
return path.replace(/\\/g, '/');
|
|
4542
4549
|
}
|
|
4543
4550
|
|
|
4551
|
+
function printQuotedStringList(list, verbs) {
|
|
4552
|
+
const isSingleItem = list.length <= 1;
|
|
4553
|
+
const quotedList = list.map(item => `"${item}"`);
|
|
4554
|
+
let output = isSingleItem
|
|
4555
|
+
? quotedList[0]
|
|
4556
|
+
: `${quotedList.slice(0, -1).join(', ')} and ${quotedList.slice(-1)[0]}`;
|
|
4557
|
+
if (verbs) {
|
|
4558
|
+
output += ` ${isSingleItem ? verbs[0] : verbs[1]}`;
|
|
4559
|
+
}
|
|
4560
|
+
return output;
|
|
4561
|
+
}
|
|
4562
|
+
|
|
4563
|
+
function getAliasName(id) {
|
|
4564
|
+
const base = basename(id);
|
|
4565
|
+
return base.substr(0, base.length - extname(id).length);
|
|
4566
|
+
}
|
|
4567
|
+
function relativeId(id) {
|
|
4568
|
+
if (!isAbsolute(id))
|
|
4569
|
+
return id;
|
|
4570
|
+
return relative$1(resolve(), id);
|
|
4571
|
+
}
|
|
4572
|
+
function isPathFragment(name) {
|
|
4573
|
+
// starting with "/", "./", "../", "C:/"
|
|
4574
|
+
return name[0] === '/' || name[0] === '.' && (name[1] === '/' || name[1] === '.') || isAbsolute(name);
|
|
4575
|
+
}
|
|
4576
|
+
|
|
4544
4577
|
class ExternalModule {
|
|
4545
4578
|
constructor(options, id, hasModuleSideEffects, meta, renormalizeRenderPath) {
|
|
4546
4579
|
this.options = options;
|
|
@@ -4618,17 +4651,20 @@ class ExternalModule {
|
|
|
4618
4651
|
});
|
|
4619
4652
|
if (unused.length === 0)
|
|
4620
4653
|
return;
|
|
4621
|
-
const
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
.
|
|
4626
|
-
|
|
4654
|
+
const importersSet = new Set();
|
|
4655
|
+
for (const name of unused) {
|
|
4656
|
+
const { importers } = this.declarations[name].module;
|
|
4657
|
+
for (const importer of importers) {
|
|
4658
|
+
importersSet.add(importer);
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
const importersArray = [...importersSet];
|
|
4627
4662
|
this.options.onwarn({
|
|
4628
4663
|
code: 'UNUSED_EXTERNAL_IMPORT',
|
|
4629
|
-
message: `${
|
|
4664
|
+
message: `${printQuotedStringList(unused, ['is', 'are'])} imported from external module "${this.id}" but never used in ${printQuotedStringList(importersArray.map(importer => relativeId(importer)))}.`,
|
|
4630
4665
|
names: unused,
|
|
4631
|
-
source: this.id
|
|
4666
|
+
source: this.id,
|
|
4667
|
+
sources: importersArray
|
|
4632
4668
|
});
|
|
4633
4669
|
}
|
|
4634
4670
|
}
|
|
@@ -4949,15 +4985,9 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
4949
4985
|
const externalBuiltins = dependencies.map(({ id }) => id).filter(id => id in builtins);
|
|
4950
4986
|
if (!externalBuiltins.length)
|
|
4951
4987
|
return;
|
|
4952
|
-
const detail = externalBuiltins.length === 1
|
|
4953
|
-
? `module ('${externalBuiltins[0]}')`
|
|
4954
|
-
: `modules (${externalBuiltins
|
|
4955
|
-
.slice(0, -1)
|
|
4956
|
-
.map(name => `'${name}'`)
|
|
4957
|
-
.join(', ')} and '${externalBuiltins.slice(-1)}')`;
|
|
4958
4988
|
warn({
|
|
4959
4989
|
code: 'MISSING_NODE_BUILTINS',
|
|
4960
|
-
message: `Creating a browser bundle that depends on Node.js built-in ${
|
|
4990
|
+
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`,
|
|
4961
4991
|
modules: externalBuiltins
|
|
4962
4992
|
});
|
|
4963
4993
|
}
|
|
@@ -5192,31 +5222,6 @@ function getCodeFrame(source, line, column) {
|
|
|
5192
5222
|
.join('\n');
|
|
5193
5223
|
}
|
|
5194
5224
|
|
|
5195
|
-
function sanitizeFileName(name) {
|
|
5196
|
-
const match = /^[a-z]:/i.exec(name);
|
|
5197
|
-
const driveLetter = match ? match[0] : "";
|
|
5198
|
-
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
5199
|
-
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
5200
|
-
return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
|
|
5201
|
-
}
|
|
5202
|
-
|
|
5203
|
-
function getAliasName(id) {
|
|
5204
|
-
const base = basename(id);
|
|
5205
|
-
return base.substr(0, base.length - extname(id).length);
|
|
5206
|
-
}
|
|
5207
|
-
function relativeId(id) {
|
|
5208
|
-
if (!isAbsolute(id))
|
|
5209
|
-
return id;
|
|
5210
|
-
return relative$1(resolve(), id);
|
|
5211
|
-
}
|
|
5212
|
-
function isPlainPathFragment(name) {
|
|
5213
|
-
// not starting with "/", "./", "../"
|
|
5214
|
-
return (name[0] !== '/' &&
|
|
5215
|
-
!(name[0] === '.' && (name[1] === '/' || name[1] === '.')) &&
|
|
5216
|
-
sanitizeFileName(name) === name &&
|
|
5217
|
-
!isAbsolute(name));
|
|
5218
|
-
}
|
|
5219
|
-
|
|
5220
5225
|
function error(base) {
|
|
5221
5226
|
if (!(base instanceof Error))
|
|
5222
5227
|
base = Object.assign(new Error(base.message), base);
|
|
@@ -5265,6 +5270,7 @@ var Errors;
|
|
|
5265
5270
|
Errors["MISSING_IMPLICIT_DEPENDANT"] = "MISSING_IMPLICIT_DEPENDANT";
|
|
5266
5271
|
Errors["MIXED_EXPORTS"] = "MIXED_EXPORTS";
|
|
5267
5272
|
Errors["NAMESPACE_CONFLICT"] = "NAMESPACE_CONFLICT";
|
|
5273
|
+
Errors["AMBIGUOUS_EXTERNAL_NAMESPACES"] = "AMBIGUOUS_EXTERNAL_NAMESPACES";
|
|
5268
5274
|
Errors["NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE"] = "NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE";
|
|
5269
5275
|
Errors["PLUGIN_ERROR"] = "PLUGIN_ERROR";
|
|
5270
5276
|
Errors["PREFER_NAMED_EXPORTS"] = "PREFER_NAMED_EXPORTS";
|
|
@@ -5430,9 +5436,7 @@ function errImplicitDependantIsNotIncluded(module) {
|
|
|
5430
5436
|
const implicitDependencies = Array.from(module.implicitlyLoadedBefore, dependency => relativeId(dependency.id)).sort();
|
|
5431
5437
|
return {
|
|
5432
5438
|
code: Errors.MISSING_IMPLICIT_DEPENDANT,
|
|
5433
|
-
message: `Module "${relativeId(module.id)}" that should be implicitly loaded before
|
|
5434
|
-
? implicitDependencies[0]
|
|
5435
|
-
: `${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.`
|
|
5439
|
+
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.`
|
|
5436
5440
|
};
|
|
5437
5441
|
}
|
|
5438
5442
|
function errMixedExport(facadeModuleId, name) {
|
|
@@ -5446,12 +5450,21 @@ function errMixedExport(facadeModuleId, name) {
|
|
|
5446
5450
|
function errNamespaceConflict(name, reexportingModule, additionalExportAllModule) {
|
|
5447
5451
|
return {
|
|
5448
5452
|
code: Errors.NAMESPACE_CONFLICT,
|
|
5449
|
-
message: `Conflicting namespaces: ${relativeId(reexportingModule.id)} re-exports
|
|
5453
|
+
message: `Conflicting namespaces: "${relativeId(reexportingModule.id)}" re-exports "${name}" from both "${relativeId(reexportingModule.exportsAll[name])}" and "${relativeId(additionalExportAllModule.exportsAll[name])}" (will be ignored)`,
|
|
5450
5454
|
name,
|
|
5451
5455
|
reexporter: reexportingModule.id,
|
|
5452
5456
|
sources: [reexportingModule.exportsAll[name], additionalExportAllModule.exportsAll[name]]
|
|
5453
5457
|
};
|
|
5454
5458
|
}
|
|
5459
|
+
function errAmbiguousExternalNamespaces(name, reexportingModule, usedExternalModule, externalModules) {
|
|
5460
|
+
return {
|
|
5461
|
+
code: Errors.AMBIGUOUS_EXTERNAL_NAMESPACES,
|
|
5462
|
+
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)}".`,
|
|
5463
|
+
name,
|
|
5464
|
+
reexporter: reexportingModule,
|
|
5465
|
+
sources: externalModules
|
|
5466
|
+
};
|
|
5467
|
+
}
|
|
5455
5468
|
function errNoTransformMapOrAstWithoutCode(pluginName) {
|
|
5456
5469
|
return {
|
|
5457
5470
|
code: Errors.NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE,
|
|
@@ -6517,15 +6530,9 @@ class MemberExpression extends NodeBase {
|
|
|
6517
6530
|
if (this.variable) {
|
|
6518
6531
|
this.variable.deoptimizePath(path);
|
|
6519
6532
|
}
|
|
6520
|
-
else {
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
this.object.deoptimizePath(UNKNOWN_PATH);
|
|
6524
|
-
}
|
|
6525
|
-
else {
|
|
6526
|
-
this.wasPathDeoptimizedWhileOptimized = true;
|
|
6527
|
-
this.object.deoptimizePath([propertyKey, ...path]);
|
|
6528
|
-
}
|
|
6533
|
+
else if (!this.replacement) {
|
|
6534
|
+
this.wasPathDeoptimizedWhileOptimized = true;
|
|
6535
|
+
this.object.deoptimizePath([this.getPropertyKey(), ...path]);
|
|
6529
6536
|
}
|
|
6530
6537
|
}
|
|
6531
6538
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
@@ -6773,7 +6780,8 @@ class CallExpression extends NodeBase {
|
|
|
6773
6780
|
if (argument.hasEffects(context))
|
|
6774
6781
|
return true;
|
|
6775
6782
|
}
|
|
6776
|
-
if (this.context.options.treeshake.annotations &&
|
|
6783
|
+
if (this.context.options.treeshake.annotations &&
|
|
6784
|
+
((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
|
|
6777
6785
|
return false;
|
|
6778
6786
|
return (this.callee.hasEffects(context) ||
|
|
6779
6787
|
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
@@ -8066,7 +8074,8 @@ class NewExpression extends NodeBase {
|
|
|
8066
8074
|
if (argument.hasEffects(context))
|
|
8067
8075
|
return true;
|
|
8068
8076
|
}
|
|
8069
|
-
if (this.context.options.treeshake.annotations &&
|
|
8077
|
+
if (this.context.options.treeshake.annotations &&
|
|
8078
|
+
((_a = this.annotations) === null || _a === void 0 ? void 0 : _a.some((a) => a.pure)))
|
|
8070
8079
|
return false;
|
|
8071
8080
|
return (this.callee.hasEffects(context) ||
|
|
8072
8081
|
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
@@ -9523,8 +9532,11 @@ function findSourceMappingURLComments(ast, code) {
|
|
|
9523
9532
|
}
|
|
9524
9533
|
let sourcemappingUrlMatch;
|
|
9525
9534
|
const interStatmentCode = code.slice(start, end);
|
|
9526
|
-
while (sourcemappingUrlMatch = SOURCEMAPPING_URL_COMMENT_RE.exec(interStatmentCode)) {
|
|
9527
|
-
ret.push([
|
|
9535
|
+
while ((sourcemappingUrlMatch = SOURCEMAPPING_URL_COMMENT_RE.exec(interStatmentCode))) {
|
|
9536
|
+
ret.push([
|
|
9537
|
+
start + sourcemappingUrlMatch.index,
|
|
9538
|
+
start + SOURCEMAPPING_URL_COMMENT_RE.lastIndex
|
|
9539
|
+
]);
|
|
9528
9540
|
}
|
|
9529
9541
|
};
|
|
9530
9542
|
let prevStmtEnd = 0;
|
|
@@ -9535,7 +9547,7 @@ function findSourceMappingURLComments(ast, code) {
|
|
|
9535
9547
|
addCommentsPos(prevStmtEnd, code.length);
|
|
9536
9548
|
return ret;
|
|
9537
9549
|
}
|
|
9538
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()) {
|
|
9550
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), skipExternalNamespaceReexports) {
|
|
9539
9551
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
9540
9552
|
if (searchedModules) {
|
|
9541
9553
|
if (searchedModules.has(target)) {
|
|
@@ -9546,7 +9558,12 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
9546
9558
|
else {
|
|
9547
9559
|
searchedNamesAndModules.set(name, new Set([target]));
|
|
9548
9560
|
}
|
|
9549
|
-
return target.getVariableForExportName(name,
|
|
9561
|
+
return target.getVariableForExportName(name, {
|
|
9562
|
+
importerForSideEffects,
|
|
9563
|
+
isExportAllSearch,
|
|
9564
|
+
searchedNamesAndModules,
|
|
9565
|
+
skipExternalNamespaceReexports
|
|
9566
|
+
});
|
|
9550
9567
|
}
|
|
9551
9568
|
function getAndExtendSideEffectModules(variable, module) {
|
|
9552
9569
|
const sideEffectModules = getOrCreate(module.sideEffectDependenciesByVariable, variable, () => new Set());
|
|
@@ -9611,6 +9628,7 @@ class Module {
|
|
|
9611
9628
|
this.exportAllModules = [];
|
|
9612
9629
|
this.exportNamesByVariable = null;
|
|
9613
9630
|
this.exportShimVariable = new ExportShimVariable(this);
|
|
9631
|
+
this.namespaceReexportsByName = Object.create(null);
|
|
9614
9632
|
this.relevantDependencies = null;
|
|
9615
9633
|
this.syntheticExports = new Map();
|
|
9616
9634
|
this.syntheticNamespace = null;
|
|
@@ -9702,7 +9720,10 @@ class Module {
|
|
|
9702
9720
|
this.implicitlyLoadedAfter.size > 0) {
|
|
9703
9721
|
dependencyVariables = new Set(dependencyVariables);
|
|
9704
9722
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
9705
|
-
|
|
9723
|
+
const exportedVariable = this.getVariableForExportName(exportName);
|
|
9724
|
+
if (exportedVariable) {
|
|
9725
|
+
dependencyVariables.add(exportedVariable);
|
|
9726
|
+
}
|
|
9706
9727
|
}
|
|
9707
9728
|
}
|
|
9708
9729
|
for (let variable of dependencyVariables) {
|
|
@@ -9807,7 +9828,7 @@ class Module {
|
|
|
9807
9828
|
}
|
|
9808
9829
|
return this.syntheticNamespace;
|
|
9809
9830
|
}
|
|
9810
|
-
getVariableForExportName(name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules) {
|
|
9831
|
+
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules, skipExternalNamespaceReexports } = EMPTY_OBJECT) {
|
|
9811
9832
|
if (name[0] === '*') {
|
|
9812
9833
|
if (name.length === 1) {
|
|
9813
9834
|
// export * from './other'
|
|
@@ -9822,7 +9843,7 @@ class Module {
|
|
|
9822
9843
|
// export { foo } from './other'
|
|
9823
9844
|
const reexportDeclaration = this.reexportDescriptions[name];
|
|
9824
9845
|
if (reexportDeclaration) {
|
|
9825
|
-
const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules);
|
|
9846
|
+
const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, false);
|
|
9826
9847
|
if (!variable) {
|
|
9827
9848
|
return this.error(errMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id), reexportDeclaration.start);
|
|
9828
9849
|
}
|
|
@@ -9845,20 +9866,11 @@ class Module {
|
|
|
9845
9866
|
return variable;
|
|
9846
9867
|
}
|
|
9847
9868
|
if (name !== 'default') {
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
return declaration;
|
|
9854
|
-
}
|
|
9855
|
-
if (!foundSyntheticDeclaration) {
|
|
9856
|
-
foundSyntheticDeclaration = declaration;
|
|
9857
|
-
}
|
|
9858
|
-
}
|
|
9859
|
-
}
|
|
9860
|
-
if (foundSyntheticDeclaration) {
|
|
9861
|
-
return foundSyntheticDeclaration;
|
|
9869
|
+
const foundNamespaceReexport = name in this.namespaceReexportsByName
|
|
9870
|
+
? this.namespaceReexportsByName[name]
|
|
9871
|
+
: (this.namespaceReexportsByName[name] = this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports));
|
|
9872
|
+
if (foundNamespaceReexport) {
|
|
9873
|
+
return foundNamespaceReexport;
|
|
9862
9874
|
}
|
|
9863
9875
|
}
|
|
9864
9876
|
if (this.info.syntheticNamedExports) {
|
|
@@ -9906,12 +9918,14 @@ class Module {
|
|
|
9906
9918
|
}
|
|
9907
9919
|
for (const name of this.getReexports()) {
|
|
9908
9920
|
const variable = this.getVariableForExportName(name);
|
|
9909
|
-
variable
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
variable
|
|
9921
|
+
if (variable) {
|
|
9922
|
+
variable.deoptimizePath(UNKNOWN_PATH);
|
|
9923
|
+
if (!variable.included) {
|
|
9924
|
+
this.includeVariable(variable);
|
|
9925
|
+
}
|
|
9926
|
+
if (variable instanceof ExternalVariable) {
|
|
9927
|
+
variable.module.reexported = true;
|
|
9928
|
+
}
|
|
9915
9929
|
}
|
|
9916
9930
|
}
|
|
9917
9931
|
if (includeNamespaceMembers) {
|
|
@@ -10050,7 +10064,9 @@ class Module {
|
|
|
10050
10064
|
if (otherModule instanceof Module && importDeclaration.name === '*') {
|
|
10051
10065
|
return otherModule.namespace;
|
|
10052
10066
|
}
|
|
10053
|
-
const declaration = otherModule.getVariableForExportName(importDeclaration.name,
|
|
10067
|
+
const declaration = otherModule.getVariableForExportName(importDeclaration.name, {
|
|
10068
|
+
importerForSideEffects: importerForSideEffects || this
|
|
10069
|
+
});
|
|
10054
10070
|
if (!declaration) {
|
|
10055
10071
|
return this.error(errMissingExport(importDeclaration.name, this.id, otherModule.id), importDeclaration.start);
|
|
10056
10072
|
}
|
|
@@ -10248,6 +10264,42 @@ class Module {
|
|
|
10248
10264
|
addSideEffectDependencies(this.dependencies);
|
|
10249
10265
|
addSideEffectDependencies(alwaysCheckedDependencies);
|
|
10250
10266
|
}
|
|
10267
|
+
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports = false) {
|
|
10268
|
+
let foundSyntheticDeclaration = null;
|
|
10269
|
+
const skipExternalNamespaceValues = new Set([true, skipExternalNamespaceReexports]);
|
|
10270
|
+
for (const skipExternalNamespaces of skipExternalNamespaceValues) {
|
|
10271
|
+
const foundDeclarations = new Set();
|
|
10272
|
+
for (const module of this.exportAllModules) {
|
|
10273
|
+
if (module instanceof Module || !skipExternalNamespaces) {
|
|
10274
|
+
const declaration = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules, skipExternalNamespaces);
|
|
10275
|
+
if (declaration) {
|
|
10276
|
+
if (!(declaration instanceof SyntheticNamedExportVariable)) {
|
|
10277
|
+
foundDeclarations.add(declaration);
|
|
10278
|
+
}
|
|
10279
|
+
else if (!foundSyntheticDeclaration) {
|
|
10280
|
+
foundSyntheticDeclaration = declaration;
|
|
10281
|
+
}
|
|
10282
|
+
}
|
|
10283
|
+
}
|
|
10284
|
+
}
|
|
10285
|
+
if (foundDeclarations.size === 1) {
|
|
10286
|
+
return [...foundDeclarations][0];
|
|
10287
|
+
}
|
|
10288
|
+
if (foundDeclarations.size > 1) {
|
|
10289
|
+
if (skipExternalNamespaces) {
|
|
10290
|
+
return null;
|
|
10291
|
+
}
|
|
10292
|
+
const foundDeclarationList = [...foundDeclarations];
|
|
10293
|
+
const usedDeclaration = foundDeclarationList[0];
|
|
10294
|
+
this.options.onwarn(errAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
10295
|
+
return usedDeclaration;
|
|
10296
|
+
}
|
|
10297
|
+
}
|
|
10298
|
+
if (foundSyntheticDeclaration) {
|
|
10299
|
+
return foundSyntheticDeclaration;
|
|
10300
|
+
}
|
|
10301
|
+
return null;
|
|
10302
|
+
}
|
|
10251
10303
|
includeAndGetAdditionalMergedNamespaces() {
|
|
10252
10304
|
const mergedNamespaces = [];
|
|
10253
10305
|
for (const module of this.exportAllModules) {
|
|
@@ -10787,14 +10839,14 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
|
|
|
10787
10839
|
}
|
|
10788
10840
|
|
|
10789
10841
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
10790
|
-
if (
|
|
10791
|
-
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths
|
|
10842
|
+
if (isPathFragment(pattern))
|
|
10843
|
+
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths.`));
|
|
10792
10844
|
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
|
|
10793
10845
|
if (!replacements.hasOwnProperty(type)) {
|
|
10794
10846
|
return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
|
|
10795
10847
|
}
|
|
10796
10848
|
const replacement = replacements[type]();
|
|
10797
|
-
if (
|
|
10849
|
+
if (isPathFragment(replacement))
|
|
10798
10850
|
return error(errFailedValidation(`Invalid substitution "${replacement}" for placeholder "[${type}]" in "${patternName}" pattern, can be neither absolute nor relative path.`));
|
|
10799
10851
|
return replacement;
|
|
10800
10852
|
});
|
|
@@ -10849,6 +10901,7 @@ class Chunk {
|
|
|
10849
10901
|
this.dependencies = new Set();
|
|
10850
10902
|
this.dynamicDependencies = new Set();
|
|
10851
10903
|
this.dynamicEntryModules = [];
|
|
10904
|
+
this.dynamicName = null;
|
|
10852
10905
|
this.exportNamesByVariable = new Map();
|
|
10853
10906
|
this.exports = new Set();
|
|
10854
10907
|
this.exportsByName = Object.create(null);
|
|
@@ -11013,7 +11066,7 @@ class Chunk {
|
|
|
11013
11066
|
this.facadeModule = module;
|
|
11014
11067
|
this.facadeChunkByModule.set(module, this);
|
|
11015
11068
|
this.strictFacade = true;
|
|
11016
|
-
this.
|
|
11069
|
+
this.dynamicName = getChunkNameFromModule(module);
|
|
11017
11070
|
}
|
|
11018
11071
|
else if (this.facadeModule === module &&
|
|
11019
11072
|
!this.strictFacade &&
|
|
@@ -11044,17 +11097,16 @@ class Chunk {
|
|
|
11044
11097
|
}
|
|
11045
11098
|
generateIdPreserveModules(preserveModulesRelativeDir, options, existingNames, unsetOptions) {
|
|
11046
11099
|
const id = this.orderedModules[0].id;
|
|
11047
|
-
const sanitizedId = sanitizeFileName(id);
|
|
11100
|
+
const sanitizedId = this.outputOptions.sanitizeFileName(id);
|
|
11048
11101
|
let path;
|
|
11049
11102
|
if (isAbsolute(id)) {
|
|
11050
11103
|
const extension = extname(id);
|
|
11051
11104
|
const pattern = unsetOptions.has('entryFileNames')
|
|
11052
|
-
?
|
|
11053
|
-
? '[name].js'
|
|
11054
|
-
: '[name][extname].js'
|
|
11105
|
+
? '[name][assetExtname].js'
|
|
11055
11106
|
: options.entryFileNames;
|
|
11056
11107
|
const currentDir = dirname(sanitizedId);
|
|
11057
11108
|
const fileName = renderNamePattern(typeof pattern === 'function' ? pattern(this.getChunkInfo()) : pattern, 'output.entryFileNames', {
|
|
11109
|
+
assetExtname: () => NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension,
|
|
11058
11110
|
ext: () => extension.substr(1),
|
|
11059
11111
|
extname: () => extension,
|
|
11060
11112
|
format: () => options.format,
|
|
@@ -11103,7 +11155,7 @@ class Chunk {
|
|
|
11103
11155
|
});
|
|
11104
11156
|
}
|
|
11105
11157
|
getChunkName() {
|
|
11106
|
-
return this.name || (this.name = sanitizeFileName(this.getFallbackChunkName()));
|
|
11158
|
+
return this.name || (this.name = this.outputOptions.sanitizeFileName(this.getFallbackChunkName()));
|
|
11107
11159
|
}
|
|
11108
11160
|
getExportNames() {
|
|
11109
11161
|
return (this.sortedExportNames || (this.sortedExportNames = Object.keys(this.exportsByName).sort()));
|
|
@@ -11362,7 +11414,7 @@ class Chunk {
|
|
|
11362
11414
|
this.fileName = fileName;
|
|
11363
11415
|
}
|
|
11364
11416
|
else {
|
|
11365
|
-
this.name = sanitizeFileName(name ||
|
|
11417
|
+
this.name = this.outputOptions.sanitizeFileName(name || getChunkNameFromModule(facadedModule));
|
|
11366
11418
|
}
|
|
11367
11419
|
}
|
|
11368
11420
|
checkCircularDependencyImport(variable, importingModule) {
|
|
@@ -11581,6 +11633,9 @@ class Chunk {
|
|
|
11581
11633
|
if (this.manualChunkAlias) {
|
|
11582
11634
|
return this.manualChunkAlias;
|
|
11583
11635
|
}
|
|
11636
|
+
if (this.dynamicName) {
|
|
11637
|
+
return this.dynamicName;
|
|
11638
|
+
}
|
|
11584
11639
|
if (this.fileName) {
|
|
11585
11640
|
return getAliasName(this.fileName);
|
|
11586
11641
|
}
|
|
@@ -11830,6 +11885,9 @@ class Chunk {
|
|
|
11830
11885
|
}
|
|
11831
11886
|
}
|
|
11832
11887
|
}
|
|
11888
|
+
function getChunkNameFromModule(module) {
|
|
11889
|
+
return module.chunkName || getAliasName(module.id);
|
|
11890
|
+
}
|
|
11833
11891
|
|
|
11834
11892
|
const concatSep = (out, next) => (next ? `${out}\n${next}` : out);
|
|
11835
11893
|
const concatDblSep = (out, next) => (next ? `${out}\n\n${next}` : out);
|
|
@@ -12086,11 +12144,11 @@ var BuildPhase;
|
|
|
12086
12144
|
BuildPhase[BuildPhase["GENERATE"] = 2] = "GENERATE";
|
|
12087
12145
|
})(BuildPhase || (BuildPhase = {}));
|
|
12088
12146
|
|
|
12089
|
-
function generateAssetFileName(name, source,
|
|
12090
|
-
const emittedName = name || 'asset';
|
|
12091
|
-
return makeUnique(renderNamePattern(typeof
|
|
12092
|
-
?
|
|
12093
|
-
:
|
|
12147
|
+
function generateAssetFileName(name, source, outputOptions, bundle) {
|
|
12148
|
+
const emittedName = outputOptions.sanitizeFileName(name || 'asset');
|
|
12149
|
+
return makeUnique(renderNamePattern(typeof outputOptions.assetFileNames === 'function'
|
|
12150
|
+
? outputOptions.assetFileNames({ name, source, type: 'asset' })
|
|
12151
|
+
: outputOptions.assetFileNames, 'output.assetFileNames', {
|
|
12094
12152
|
hash() {
|
|
12095
12153
|
const hash = createHash();
|
|
12096
12154
|
hash.update(emittedName);
|
|
@@ -12101,7 +12159,7 @@ function generateAssetFileName(name, source, output) {
|
|
|
12101
12159
|
ext: () => extname(emittedName).substr(1),
|
|
12102
12160
|
extname: () => extname(emittedName),
|
|
12103
12161
|
name: () => emittedName.substr(0, emittedName.length - extname(emittedName).length)
|
|
12104
|
-
}),
|
|
12162
|
+
}), bundle);
|
|
12105
12163
|
}
|
|
12106
12164
|
function reserveFileNameInBundle(fileName, bundle, warn) {
|
|
12107
12165
|
if (fileName in bundle) {
|
|
@@ -12119,7 +12177,7 @@ function hasValidType(emittedFile) {
|
|
|
12119
12177
|
}
|
|
12120
12178
|
function hasValidName(emittedFile) {
|
|
12121
12179
|
const validatedName = emittedFile.fileName || emittedFile.name;
|
|
12122
|
-
return
|
|
12180
|
+
return !validatedName || typeof validatedName === 'string' && !isPathFragment(validatedName);
|
|
12123
12181
|
}
|
|
12124
12182
|
function getValidSource(source, emittedFile, fileReferenceId) {
|
|
12125
12183
|
if (!(typeof source === 'string' || source instanceof Uint8Array)) {
|
|
@@ -12145,8 +12203,9 @@ class FileEmitter {
|
|
|
12145
12203
|
constructor(graph, options, baseFileEmitter) {
|
|
12146
12204
|
this.graph = graph;
|
|
12147
12205
|
this.options = options;
|
|
12206
|
+
this.bundle = null;
|
|
12148
12207
|
this.facadeChunkByModule = null;
|
|
12149
|
-
this.
|
|
12208
|
+
this.outputOptions = null;
|
|
12150
12209
|
this.assertAssetsFinalized = () => {
|
|
12151
12210
|
for (const [referenceId, emittedFile] of this.filesByReferenceId.entries()) {
|
|
12152
12211
|
if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
|
|
@@ -12158,7 +12217,7 @@ class FileEmitter {
|
|
|
12158
12217
|
return error(errFailedValidation(`Emitted files must be of type "asset" or "chunk", received "${emittedFile && emittedFile.type}".`));
|
|
12159
12218
|
}
|
|
12160
12219
|
if (!hasValidName(emittedFile)) {
|
|
12161
|
-
return error(errFailedValidation(`The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths
|
|
12220
|
+
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}".`));
|
|
12162
12221
|
}
|
|
12163
12222
|
if (emittedFile.type === 'chunk') {
|
|
12164
12223
|
return this.emitChunk(emittedFile);
|
|
@@ -12189,27 +12248,25 @@ class FileEmitter {
|
|
|
12189
12248
|
return error(errAssetSourceAlreadySet(consumedFile.name || referenceId));
|
|
12190
12249
|
}
|
|
12191
12250
|
const source = getValidSource(requestedSource, consumedFile, referenceId);
|
|
12192
|
-
if (this.
|
|
12193
|
-
this.finalizeAsset(consumedFile, source, referenceId, this.
|
|
12251
|
+
if (this.bundle) {
|
|
12252
|
+
this.finalizeAsset(consumedFile, source, referenceId, this.bundle);
|
|
12194
12253
|
}
|
|
12195
12254
|
else {
|
|
12196
12255
|
consumedFile.source = source;
|
|
12197
12256
|
}
|
|
12198
12257
|
};
|
|
12199
|
-
this.setOutputBundle = (outputBundle,
|
|
12200
|
-
this.
|
|
12201
|
-
|
|
12202
|
-
bundle: outputBundle
|
|
12203
|
-
};
|
|
12258
|
+
this.setOutputBundle = (outputBundle, outputOptions, facadeChunkByModule) => {
|
|
12259
|
+
this.outputOptions = outputOptions;
|
|
12260
|
+
this.bundle = outputBundle;
|
|
12204
12261
|
this.facadeChunkByModule = facadeChunkByModule;
|
|
12205
12262
|
for (const emittedFile of this.filesByReferenceId.values()) {
|
|
12206
12263
|
if (emittedFile.fileName) {
|
|
12207
|
-
reserveFileNameInBundle(emittedFile.fileName, this.
|
|
12264
|
+
reserveFileNameInBundle(emittedFile.fileName, this.bundle, this.options.onwarn);
|
|
12208
12265
|
}
|
|
12209
12266
|
}
|
|
12210
12267
|
for (const [referenceId, consumedFile] of this.filesByReferenceId.entries()) {
|
|
12211
12268
|
if (consumedFile.type === 'asset' && consumedFile.source !== undefined) {
|
|
12212
|
-
this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.
|
|
12269
|
+
this.finalizeAsset(consumedFile, consumedFile.source, referenceId, this.bundle);
|
|
12213
12270
|
}
|
|
12214
12271
|
}
|
|
12215
12272
|
};
|
|
@@ -12243,12 +12300,12 @@ class FileEmitter {
|
|
|
12243
12300
|
type: 'asset'
|
|
12244
12301
|
};
|
|
12245
12302
|
const referenceId = this.assignReferenceId(consumedAsset, emittedAsset.fileName || emittedAsset.name || emittedAsset.type);
|
|
12246
|
-
if (this.
|
|
12303
|
+
if (this.bundle) {
|
|
12247
12304
|
if (emittedAsset.fileName) {
|
|
12248
|
-
reserveFileNameInBundle(emittedAsset.fileName, this.
|
|
12305
|
+
reserveFileNameInBundle(emittedAsset.fileName, this.bundle, this.options.onwarn);
|
|
12249
12306
|
}
|
|
12250
12307
|
if (source !== undefined) {
|
|
12251
|
-
this.finalizeAsset(consumedAsset, source, referenceId, this.
|
|
12308
|
+
this.finalizeAsset(consumedAsset, source, referenceId, this.bundle);
|
|
12252
12309
|
}
|
|
12253
12310
|
}
|
|
12254
12311
|
return referenceId;
|
|
@@ -12275,15 +12332,15 @@ class FileEmitter {
|
|
|
12275
12332
|
});
|
|
12276
12333
|
return this.assignReferenceId(consumedChunk, emittedChunk.id);
|
|
12277
12334
|
}
|
|
12278
|
-
finalizeAsset(consumedFile, source, referenceId,
|
|
12335
|
+
finalizeAsset(consumedFile, source, referenceId, bundle) {
|
|
12279
12336
|
const fileName = consumedFile.fileName ||
|
|
12280
|
-
findExistingAssetFileNameWithSource(
|
|
12281
|
-
generateAssetFileName(consumedFile.name, source,
|
|
12337
|
+
findExistingAssetFileNameWithSource(bundle, source) ||
|
|
12338
|
+
generateAssetFileName(consumedFile.name, source, this.outputOptions, bundle);
|
|
12282
12339
|
// We must not modify the original assets to avoid interaction between outputs
|
|
12283
12340
|
const assetWithFileName = { ...consumedFile, source, fileName };
|
|
12284
12341
|
this.filesByReferenceId.set(referenceId, assetWithFileName);
|
|
12285
12342
|
const options = this.options;
|
|
12286
|
-
|
|
12343
|
+
bundle[fileName] = {
|
|
12287
12344
|
fileName,
|
|
12288
12345
|
name: consumedFile.name,
|
|
12289
12346
|
get isAsset() {
|
|
@@ -12337,7 +12394,7 @@ class Bundle {
|
|
|
12337
12394
|
async generate(isWrite) {
|
|
12338
12395
|
timeStart('GENERATE', 1);
|
|
12339
12396
|
const outputBundle = Object.create(null);
|
|
12340
|
-
this.pluginDriver.setOutputBundle(outputBundle, this.outputOptions
|
|
12397
|
+
this.pluginDriver.setOutputBundle(outputBundle, this.outputOptions, this.facadeChunkByModule);
|
|
12341
12398
|
try {
|
|
12342
12399
|
await this.pluginDriver.hookParallel('renderStart', [this.outputOptions, this.inputOptions]);
|
|
12343
12400
|
timeStart('generate chunks', 2);
|
|
@@ -12685,6 +12742,7 @@ var types = {
|
|
|
12685
12742
|
regexp: new TokenType("regexp", startsExpr),
|
|
12686
12743
|
string: new TokenType("string", startsExpr),
|
|
12687
12744
|
name: new TokenType("name", startsExpr),
|
|
12745
|
+
privateId: new TokenType("privateId", startsExpr),
|
|
12688
12746
|
eof: new TokenType("eof"),
|
|
12689
12747
|
|
|
12690
12748
|
// Punctuation token types.
|
|
@@ -12879,7 +12937,8 @@ var defaultOptions = {
|
|
|
12879
12937
|
// error.
|
|
12880
12938
|
allowReturnOutsideFunction: false,
|
|
12881
12939
|
// When enabled, import/export statements are not constrained to
|
|
12882
|
-
// appearing at the top of the program.
|
|
12940
|
+
// appearing at the top of the program, and an import.meta expression
|
|
12941
|
+
// in a script isn't considered an error.
|
|
12883
12942
|
allowImportExportEverywhere: false,
|
|
12884
12943
|
// When enabled, await identifiers are allowed to appear at the top-level scope,
|
|
12885
12944
|
// but they are still not allowed in non-async functions.
|
|
@@ -13070,6 +13129,7 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
13070
13129
|
|
|
13071
13130
|
// Used to signify the start of a potential arrow function
|
|
13072
13131
|
this.potentialArrowAt = -1;
|
|
13132
|
+
this.potentialArrowInForAwait = false;
|
|
13073
13133
|
|
|
13074
13134
|
// Positions to delayed-check that yield/await does not exist in default parameters.
|
|
13075
13135
|
this.yieldPos = this.awaitPos = this.awaitIdentPos = 0;
|
|
@@ -13088,6 +13148,11 @@ var Parser = function Parser(options, input, startPos) {
|
|
|
13088
13148
|
|
|
13089
13149
|
// For RegExp validation
|
|
13090
13150
|
this.regexpState = null;
|
|
13151
|
+
|
|
13152
|
+
// The stack of private names.
|
|
13153
|
+
// Each element has two properties: 'declared' and 'used'.
|
|
13154
|
+
// When it exited from the outermost class definition, all used private names must be declared.
|
|
13155
|
+
this.privateNameStack = [];
|
|
13091
13156
|
};
|
|
13092
13157
|
|
|
13093
13158
|
var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },inNonArrowFunction: { configurable: true } };
|
|
@@ -13099,12 +13164,22 @@ Parser.prototype.parse = function parse () {
|
|
|
13099
13164
|
};
|
|
13100
13165
|
|
|
13101
13166
|
prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
|
|
13102
|
-
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
|
|
13103
|
-
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
|
|
13104
|
-
prototypeAccessors.allowSuper.get = function () {
|
|
13167
|
+
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
13168
|
+
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit };
|
|
13169
|
+
prototypeAccessors.allowSuper.get = function () {
|
|
13170
|
+
var ref = this.currentThisScope();
|
|
13171
|
+
var flags = ref.flags;
|
|
13172
|
+
var inClassFieldInit = ref.inClassFieldInit;
|
|
13173
|
+
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit
|
|
13174
|
+
};
|
|
13105
13175
|
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
|
|
13106
13176
|
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
|
|
13107
|
-
prototypeAccessors.inNonArrowFunction.get = function () {
|
|
13177
|
+
prototypeAccessors.inNonArrowFunction.get = function () {
|
|
13178
|
+
var ref = this.currentThisScope();
|
|
13179
|
+
var flags = ref.flags;
|
|
13180
|
+
var inClassFieldInit = ref.inClassFieldInit;
|
|
13181
|
+
return (flags & SCOPE_FUNCTION) > 0 || inClassFieldInit
|
|
13182
|
+
};
|
|
13108
13183
|
|
|
13109
13184
|
Parser.extend = function extend () {
|
|
13110
13185
|
var plugins = [], len = arguments.length;
|
|
@@ -13511,7 +13586,7 @@ pp$1.parseForStatement = function(node) {
|
|
|
13511
13586
|
return this.parseFor(node, init$1)
|
|
13512
13587
|
}
|
|
13513
13588
|
var refDestructuringErrors = new DestructuringErrors;
|
|
13514
|
-
var init = this.parseExpression(true, refDestructuringErrors);
|
|
13589
|
+
var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors);
|
|
13515
13590
|
if (this.type === types._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
|
|
13516
13591
|
if (this.options.ecmaVersion >= 9) {
|
|
13517
13592
|
if (this.type === types._in) {
|
|
@@ -13857,6 +13932,7 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
13857
13932
|
|
|
13858
13933
|
this.parseClassId(node, isStatement);
|
|
13859
13934
|
this.parseClassSuper(node);
|
|
13935
|
+
var privateNameMap = this.enterClassBody();
|
|
13860
13936
|
var classBody = this.startNode();
|
|
13861
13937
|
var hadConstructor = false;
|
|
13862
13938
|
classBody.body = [];
|
|
@@ -13868,77 +13944,154 @@ pp$1.parseClass = function(node, isStatement) {
|
|
|
13868
13944
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
13869
13945
|
if (hadConstructor) { this.raise(element.start, "Duplicate constructor in the same class"); }
|
|
13870
13946
|
hadConstructor = true;
|
|
13947
|
+
} else if (element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
13948
|
+
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
13871
13949
|
}
|
|
13872
13950
|
}
|
|
13873
13951
|
}
|
|
13874
13952
|
this.strict = oldStrict;
|
|
13875
13953
|
this.next();
|
|
13876
13954
|
node.body = this.finishNode(classBody, "ClassBody");
|
|
13955
|
+
this.exitClassBody();
|
|
13877
13956
|
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression")
|
|
13878
13957
|
};
|
|
13879
13958
|
|
|
13880
13959
|
pp$1.parseClassElement = function(constructorAllowsSuper) {
|
|
13881
|
-
var this$1 = this;
|
|
13882
|
-
|
|
13883
13960
|
if (this.eat(types.semi)) { return null }
|
|
13884
13961
|
|
|
13885
|
-
var
|
|
13886
|
-
var
|
|
13887
|
-
|
|
13888
|
-
|
|
13889
|
-
var start = this$1.start, startLoc = this$1.startLoc;
|
|
13890
|
-
if (!this$1.eatContextual(k)) { return false }
|
|
13891
|
-
if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { return true }
|
|
13892
|
-
if (method.key) { this$1.unexpected(); }
|
|
13893
|
-
method.computed = false;
|
|
13894
|
-
method.key = this$1.startNodeAt(start, startLoc);
|
|
13895
|
-
method.key.name = k;
|
|
13896
|
-
this$1.finishNode(method.key, "Identifier");
|
|
13897
|
-
return false
|
|
13898
|
-
};
|
|
13899
|
-
|
|
13900
|
-
method.kind = "method";
|
|
13901
|
-
method.static = tryContextual("static");
|
|
13902
|
-
var isGenerator = this.eat(types.star);
|
|
13962
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
13963
|
+
var node = this.startNode();
|
|
13964
|
+
var keyName = "";
|
|
13965
|
+
var isGenerator = false;
|
|
13903
13966
|
var isAsync = false;
|
|
13904
|
-
|
|
13905
|
-
|
|
13967
|
+
var kind = "method";
|
|
13968
|
+
|
|
13969
|
+
// Parse modifiers
|
|
13970
|
+
node.static = false;
|
|
13971
|
+
if (this.eatContextual("static")) {
|
|
13972
|
+
if (this.isClassElementNameStart() || this.type === types.star) {
|
|
13973
|
+
node.static = true;
|
|
13974
|
+
} else {
|
|
13975
|
+
keyName = "static";
|
|
13976
|
+
}
|
|
13977
|
+
}
|
|
13978
|
+
if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) {
|
|
13979
|
+
if ((this.isClassElementNameStart() || this.type === types.star) && !this.canInsertSemicolon()) {
|
|
13906
13980
|
isAsync = true;
|
|
13907
|
-
|
|
13908
|
-
|
|
13909
|
-
method.kind = "get";
|
|
13910
|
-
} else if (tryContextual("set")) {
|
|
13911
|
-
method.kind = "set";
|
|
13981
|
+
} else {
|
|
13982
|
+
keyName = "async";
|
|
13912
13983
|
}
|
|
13913
13984
|
}
|
|
13914
|
-
if (!
|
|
13985
|
+
if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types.star)) {
|
|
13986
|
+
isGenerator = true;
|
|
13987
|
+
}
|
|
13988
|
+
if (!keyName && !isAsync && !isGenerator) {
|
|
13989
|
+
var lastValue = this.value;
|
|
13990
|
+
if (this.eatContextual("get") || this.eatContextual("set")) {
|
|
13991
|
+
if (this.isClassElementNameStart()) {
|
|
13992
|
+
kind = lastValue;
|
|
13993
|
+
} else {
|
|
13994
|
+
keyName = lastValue;
|
|
13995
|
+
}
|
|
13996
|
+
}
|
|
13997
|
+
}
|
|
13998
|
+
|
|
13999
|
+
// Parse element name
|
|
14000
|
+
if (keyName) {
|
|
14001
|
+
// 'async', 'get', 'set', or 'static' were not a keyword contextually.
|
|
14002
|
+
// The last token is any of those. Make it the element name.
|
|
14003
|
+
node.computed = false;
|
|
14004
|
+
node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc);
|
|
14005
|
+
node.key.name = keyName;
|
|
14006
|
+
this.finishNode(node.key, "Identifier");
|
|
14007
|
+
} else {
|
|
14008
|
+
this.parseClassElementName(node);
|
|
14009
|
+
}
|
|
14010
|
+
|
|
14011
|
+
// Parse element value
|
|
14012
|
+
if (ecmaVersion < 13 || this.type === types.parenL || kind !== "method" || isGenerator || isAsync) {
|
|
14013
|
+
var isConstructor = !node.static && checkKeyName(node, "constructor");
|
|
14014
|
+
var allowsDirectSuper = isConstructor && constructorAllowsSuper;
|
|
14015
|
+
// Couldn't move this check into the 'parseClassMethod' method for backward compatibility.
|
|
14016
|
+
if (isConstructor && kind !== "method") { this.raise(node.key.start, "Constructor can't have get/set modifier"); }
|
|
14017
|
+
node.kind = isConstructor ? "constructor" : kind;
|
|
14018
|
+
this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper);
|
|
14019
|
+
} else {
|
|
14020
|
+
this.parseClassField(node);
|
|
14021
|
+
}
|
|
14022
|
+
|
|
14023
|
+
return node
|
|
14024
|
+
};
|
|
14025
|
+
|
|
14026
|
+
pp$1.isClassElementNameStart = function() {
|
|
14027
|
+
return (
|
|
14028
|
+
this.type === types.name ||
|
|
14029
|
+
this.type === types.privateId ||
|
|
14030
|
+
this.type === types.num ||
|
|
14031
|
+
this.type === types.string ||
|
|
14032
|
+
this.type === types.bracketL ||
|
|
14033
|
+
this.type.keyword
|
|
14034
|
+
)
|
|
14035
|
+
};
|
|
14036
|
+
|
|
14037
|
+
pp$1.parseClassElementName = function(element) {
|
|
14038
|
+
if (this.type === types.privateId) {
|
|
14039
|
+
if (this.value === "constructor") {
|
|
14040
|
+
this.raise(this.start, "Classes can't have an element named '#constructor'");
|
|
14041
|
+
}
|
|
14042
|
+
element.computed = false;
|
|
14043
|
+
element.key = this.parsePrivateIdent();
|
|
14044
|
+
} else {
|
|
14045
|
+
this.parsePropertyName(element);
|
|
14046
|
+
}
|
|
14047
|
+
};
|
|
14048
|
+
|
|
14049
|
+
pp$1.parseClassMethod = function(method, isGenerator, isAsync, allowsDirectSuper) {
|
|
14050
|
+
// Check key and flags
|
|
13915
14051
|
var key = method.key;
|
|
13916
|
-
|
|
13917
|
-
if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" ||
|
|
13918
|
-
key.type === "Literal" && key.value === "constructor")) {
|
|
13919
|
-
if (method.kind !== "method") { this.raise(key.start, "Constructor can't have get/set modifier"); }
|
|
14052
|
+
if (method.kind === "constructor") {
|
|
13920
14053
|
if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); }
|
|
13921
14054
|
if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); }
|
|
13922
|
-
|
|
13923
|
-
allowsDirectSuper = constructorAllowsSuper;
|
|
13924
|
-
} else if (method.static && key.type === "Identifier" && key.name === "prototype") {
|
|
14055
|
+
} else if (method.static && checkKeyName(method, "prototype")) {
|
|
13925
14056
|
this.raise(key.start, "Classes may not have a static property named prototype");
|
|
13926
14057
|
}
|
|
13927
|
-
this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper);
|
|
13928
|
-
if (method.kind === "get" && method.value.params.length !== 0)
|
|
13929
|
-
{ this.raiseRecoverable(method.value.start, "getter should have no params"); }
|
|
13930
|
-
if (method.kind === "set" && method.value.params.length !== 1)
|
|
13931
|
-
{ this.raiseRecoverable(method.value.start, "setter should have exactly one param"); }
|
|
13932
|
-
if (method.kind === "set" && method.value.params[0].type === "RestElement")
|
|
13933
|
-
{ this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); }
|
|
13934
|
-
return method
|
|
13935
|
-
};
|
|
13936
14058
|
|
|
13937
|
-
|
|
13938
|
-
method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
|
14059
|
+
// Parse value
|
|
14060
|
+
var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper);
|
|
14061
|
+
|
|
14062
|
+
// Check value
|
|
14063
|
+
if (method.kind === "get" && value.params.length !== 0)
|
|
14064
|
+
{ this.raiseRecoverable(value.start, "getter should have no params"); }
|
|
14065
|
+
if (method.kind === "set" && value.params.length !== 1)
|
|
14066
|
+
{ this.raiseRecoverable(value.start, "setter should have exactly one param"); }
|
|
14067
|
+
if (method.kind === "set" && value.params[0].type === "RestElement")
|
|
14068
|
+
{ this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); }
|
|
14069
|
+
|
|
13939
14070
|
return this.finishNode(method, "MethodDefinition")
|
|
13940
14071
|
};
|
|
13941
14072
|
|
|
14073
|
+
pp$1.parseClassField = function(field) {
|
|
14074
|
+
if (checkKeyName(field, "constructor")) {
|
|
14075
|
+
this.raise(field.key.start, "Classes can't have a field named 'constructor'");
|
|
14076
|
+
} else if (field.static && checkKeyName(field, "prototype")) {
|
|
14077
|
+
this.raise(field.key.start, "Classes can't have a static field named 'prototype'");
|
|
14078
|
+
}
|
|
14079
|
+
|
|
14080
|
+
if (this.eat(types.eq)) {
|
|
14081
|
+
// To raise SyntaxError if 'arguments' exists in the initializer.
|
|
14082
|
+
var scope = this.currentThisScope();
|
|
14083
|
+
var inClassFieldInit = scope.inClassFieldInit;
|
|
14084
|
+
scope.inClassFieldInit = true;
|
|
14085
|
+
field.value = this.parseMaybeAssign();
|
|
14086
|
+
scope.inClassFieldInit = inClassFieldInit;
|
|
14087
|
+
} else {
|
|
14088
|
+
field.value = null;
|
|
14089
|
+
}
|
|
14090
|
+
this.semicolon();
|
|
14091
|
+
|
|
14092
|
+
return this.finishNode(field, "PropertyDefinition")
|
|
14093
|
+
};
|
|
14094
|
+
|
|
13942
14095
|
pp$1.parseClassId = function(node, isStatement) {
|
|
13943
14096
|
if (this.type === types.name) {
|
|
13944
14097
|
node.id = this.parseIdent();
|
|
@@ -13955,6 +14108,65 @@ pp$1.parseClassSuper = function(node) {
|
|
|
13955
14108
|
node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
|
|
13956
14109
|
};
|
|
13957
14110
|
|
|
14111
|
+
pp$1.enterClassBody = function() {
|
|
14112
|
+
var element = {declared: Object.create(null), used: []};
|
|
14113
|
+
this.privateNameStack.push(element);
|
|
14114
|
+
return element.declared
|
|
14115
|
+
};
|
|
14116
|
+
|
|
14117
|
+
pp$1.exitClassBody = function() {
|
|
14118
|
+
var ref = this.privateNameStack.pop();
|
|
14119
|
+
var declared = ref.declared;
|
|
14120
|
+
var used = ref.used;
|
|
14121
|
+
var len = this.privateNameStack.length;
|
|
14122
|
+
var parent = len === 0 ? null : this.privateNameStack[len - 1];
|
|
14123
|
+
for (var i = 0; i < used.length; ++i) {
|
|
14124
|
+
var id = used[i];
|
|
14125
|
+
if (!has(declared, id.name)) {
|
|
14126
|
+
if (parent) {
|
|
14127
|
+
parent.used.push(id);
|
|
14128
|
+
} else {
|
|
14129
|
+
this.raiseRecoverable(id.start, ("Private field '#" + (id.name) + "' must be declared in an enclosing class"));
|
|
14130
|
+
}
|
|
14131
|
+
}
|
|
14132
|
+
}
|
|
14133
|
+
};
|
|
14134
|
+
|
|
14135
|
+
function isPrivateNameConflicted(privateNameMap, element) {
|
|
14136
|
+
var name = element.key.name;
|
|
14137
|
+
var curr = privateNameMap[name];
|
|
14138
|
+
|
|
14139
|
+
var next = "true";
|
|
14140
|
+
if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) {
|
|
14141
|
+
next = (element.static ? "s" : "i") + element.kind;
|
|
14142
|
+
}
|
|
14143
|
+
|
|
14144
|
+
// `class { get #a(){}; static set #a(_){} }` is also conflict.
|
|
14145
|
+
if (
|
|
14146
|
+
curr === "iget" && next === "iset" ||
|
|
14147
|
+
curr === "iset" && next === "iget" ||
|
|
14148
|
+
curr === "sget" && next === "sset" ||
|
|
14149
|
+
curr === "sset" && next === "sget"
|
|
14150
|
+
) {
|
|
14151
|
+
privateNameMap[name] = "true";
|
|
14152
|
+
return false
|
|
14153
|
+
} else if (!curr) {
|
|
14154
|
+
privateNameMap[name] = next;
|
|
14155
|
+
return false
|
|
14156
|
+
} else {
|
|
14157
|
+
return true
|
|
14158
|
+
}
|
|
14159
|
+
}
|
|
14160
|
+
|
|
14161
|
+
function checkKeyName(node, name) {
|
|
14162
|
+
var computed = node.computed;
|
|
14163
|
+
var key = node.key;
|
|
14164
|
+
return !computed && (
|
|
14165
|
+
key.type === "Identifier" && key.name === name ||
|
|
14166
|
+
key.type === "Literal" && key.value === name
|
|
14167
|
+
)
|
|
14168
|
+
}
|
|
14169
|
+
|
|
13958
14170
|
// Parses module export declaration.
|
|
13959
14171
|
|
|
13960
14172
|
pp$1.parseExport = function(node, exports) {
|
|
@@ -14573,13 +14785,13 @@ pp$3.checkPropClash = function(prop, propHash, refDestructuringErrors) {
|
|
|
14573
14785
|
// and object pattern might appear (so it's possible to raise
|
|
14574
14786
|
// delayed syntax error at correct position).
|
|
14575
14787
|
|
|
14576
|
-
pp$3.parseExpression = function(
|
|
14788
|
+
pp$3.parseExpression = function(forInit, refDestructuringErrors) {
|
|
14577
14789
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14578
|
-
var expr = this.parseMaybeAssign(
|
|
14790
|
+
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
|
|
14579
14791
|
if (this.type === types.comma) {
|
|
14580
14792
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14581
14793
|
node.expressions = [expr];
|
|
14582
|
-
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(
|
|
14794
|
+
while (this.eat(types.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
|
|
14583
14795
|
return this.finishNode(node, "SequenceExpression")
|
|
14584
14796
|
}
|
|
14585
14797
|
return expr
|
|
@@ -14588,9 +14800,9 @@ pp$3.parseExpression = function(noIn, refDestructuringErrors) {
|
|
|
14588
14800
|
// Parse an assignment expression. This includes applications of
|
|
14589
14801
|
// operators like `+=`.
|
|
14590
14802
|
|
|
14591
|
-
pp$3.parseMaybeAssign = function(
|
|
14803
|
+
pp$3.parseMaybeAssign = function(forInit, refDestructuringErrors, afterLeftParse) {
|
|
14592
14804
|
if (this.isContextual("yield")) {
|
|
14593
|
-
if (this.inGenerator) { return this.parseYield(
|
|
14805
|
+
if (this.inGenerator) { return this.parseYield(forInit) }
|
|
14594
14806
|
// The tokenizer will assume an expression is allowed after
|
|
14595
14807
|
// `yield`, but this isn't that kind of yield
|
|
14596
14808
|
else { this.exprAllowed = false; }
|
|
@@ -14607,9 +14819,11 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
|
14607
14819
|
}
|
|
14608
14820
|
|
|
14609
14821
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14610
|
-
if (this.type === types.parenL || this.type === types.name)
|
|
14611
|
-
|
|
14612
|
-
|
|
14822
|
+
if (this.type === types.parenL || this.type === types.name) {
|
|
14823
|
+
this.potentialArrowAt = this.start;
|
|
14824
|
+
this.potentialArrowInForAwait = forInit === "await";
|
|
14825
|
+
}
|
|
14826
|
+
var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
|
|
14613
14827
|
if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); }
|
|
14614
14828
|
if (this.type.isAssign) {
|
|
14615
14829
|
var node = this.startNodeAt(startPos, startLoc);
|
|
@@ -14627,7 +14841,7 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
|
14627
14841
|
{ this.checkLValSimple(left); }
|
|
14628
14842
|
node.left = left;
|
|
14629
14843
|
this.next();
|
|
14630
|
-
node.right = this.parseMaybeAssign(
|
|
14844
|
+
node.right = this.parseMaybeAssign(forInit);
|
|
14631
14845
|
return this.finishNode(node, "AssignmentExpression")
|
|
14632
14846
|
} else {
|
|
14633
14847
|
if (ownDestructuringErrors) { this.checkExpressionErrors(refDestructuringErrors, true); }
|
|
@@ -14639,16 +14853,16 @@ pp$3.parseMaybeAssign = function(noIn, refDestructuringErrors, afterLeftParse) {
|
|
|
14639
14853
|
|
|
14640
14854
|
// Parse a ternary conditional (`?:`) operator.
|
|
14641
14855
|
|
|
14642
|
-
pp$3.parseMaybeConditional = function(
|
|
14856
|
+
pp$3.parseMaybeConditional = function(forInit, refDestructuringErrors) {
|
|
14643
14857
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14644
|
-
var expr = this.parseExprOps(
|
|
14858
|
+
var expr = this.parseExprOps(forInit, refDestructuringErrors);
|
|
14645
14859
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
14646
14860
|
if (this.eat(types.question)) {
|
|
14647
14861
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14648
14862
|
node.test = expr;
|
|
14649
14863
|
node.consequent = this.parseMaybeAssign();
|
|
14650
14864
|
this.expect(types.colon);
|
|
14651
|
-
node.alternate = this.parseMaybeAssign(
|
|
14865
|
+
node.alternate = this.parseMaybeAssign(forInit);
|
|
14652
14866
|
return this.finishNode(node, "ConditionalExpression")
|
|
14653
14867
|
}
|
|
14654
14868
|
return expr
|
|
@@ -14656,11 +14870,11 @@ pp$3.parseMaybeConditional = function(noIn, refDestructuringErrors) {
|
|
|
14656
14870
|
|
|
14657
14871
|
// Start the precedence parser.
|
|
14658
14872
|
|
|
14659
|
-
pp$3.parseExprOps = function(
|
|
14873
|
+
pp$3.parseExprOps = function(forInit, refDestructuringErrors) {
|
|
14660
14874
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14661
14875
|
var expr = this.parseMaybeUnary(refDestructuringErrors, false);
|
|
14662
14876
|
if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
|
|
14663
|
-
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1,
|
|
14877
|
+
return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit)
|
|
14664
14878
|
};
|
|
14665
14879
|
|
|
14666
14880
|
// Parse binary operators with the operator precedence parsing
|
|
@@ -14669,9 +14883,9 @@ pp$3.parseExprOps = function(noIn, refDestructuringErrors) {
|
|
|
14669
14883
|
// defer further parser to one of its callers when it encounters an
|
|
14670
14884
|
// operator that has a lower precedence than the set it is parsing.
|
|
14671
14885
|
|
|
14672
|
-
pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec,
|
|
14886
|
+
pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, forInit) {
|
|
14673
14887
|
var prec = this.type.binop;
|
|
14674
|
-
if (prec != null && (!
|
|
14888
|
+
if (prec != null && (!forInit || this.type !== types._in)) {
|
|
14675
14889
|
if (prec > minPrec) {
|
|
14676
14890
|
var logical = this.type === types.logicalOR || this.type === types.logicalAND;
|
|
14677
14891
|
var coalesce = this.type === types.coalesce;
|
|
@@ -14683,12 +14897,12 @@ pp$3.parseExprOp = function(left, leftStartPos, leftStartLoc, minPrec, noIn) {
|
|
|
14683
14897
|
var op = this.value;
|
|
14684
14898
|
this.next();
|
|
14685
14899
|
var startPos = this.start, startLoc = this.startLoc;
|
|
14686
|
-
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec,
|
|
14900
|
+
var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, forInit);
|
|
14687
14901
|
var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce);
|
|
14688
14902
|
if ((logical && this.type === types.coalesce) || (coalesce && (this.type === types.logicalOR || this.type === types.logicalAND))) {
|
|
14689
14903
|
this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");
|
|
14690
14904
|
}
|
|
14691
|
-
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec,
|
|
14905
|
+
return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit)
|
|
14692
14906
|
}
|
|
14693
14907
|
}
|
|
14694
14908
|
return left
|
|
@@ -14704,7 +14918,7 @@ pp$3.buildBinary = function(startPos, startLoc, left, right, op, logical) {
|
|
|
14704
14918
|
|
|
14705
14919
|
// Parse unary operators, both prefix and postfix.
|
|
14706
14920
|
|
|
14707
|
-
pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
14921
|
+
pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary, incDec) {
|
|
14708
14922
|
var startPos = this.start, startLoc = this.startLoc, expr;
|
|
14709
14923
|
if (this.isContextual("await") && (this.inAsync || (!this.inFunction && this.options.allowAwaitOutsideFunction))) {
|
|
14710
14924
|
expr = this.parseAwait();
|
|
@@ -14714,12 +14928,14 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
|
14714
14928
|
node.operator = this.value;
|
|
14715
14929
|
node.prefix = true;
|
|
14716
14930
|
this.next();
|
|
14717
|
-
node.argument = this.parseMaybeUnary(null, true);
|
|
14931
|
+
node.argument = this.parseMaybeUnary(null, true, update);
|
|
14718
14932
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
14719
14933
|
if (update) { this.checkLValSimple(node.argument); }
|
|
14720
14934
|
else if (this.strict && node.operator === "delete" &&
|
|
14721
14935
|
node.argument.type === "Identifier")
|
|
14722
14936
|
{ this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); }
|
|
14937
|
+
else if (node.operator === "delete" && isPrivateFieldAccess(node.argument))
|
|
14938
|
+
{ this.raiseRecoverable(node.start, "Private fields can not be deleted"); }
|
|
14723
14939
|
else { sawUnary = true; }
|
|
14724
14940
|
expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
|
|
14725
14941
|
} else {
|
|
@@ -14736,12 +14952,23 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) {
|
|
|
14736
14952
|
}
|
|
14737
14953
|
}
|
|
14738
14954
|
|
|
14739
|
-
if (!
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14955
|
+
if (!incDec && this.eat(types.starstar)) {
|
|
14956
|
+
if (sawUnary)
|
|
14957
|
+
{ this.unexpected(this.lastTokStart); }
|
|
14958
|
+
else
|
|
14959
|
+
{ return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false) }
|
|
14960
|
+
} else {
|
|
14961
|
+
return expr
|
|
14962
|
+
}
|
|
14743
14963
|
};
|
|
14744
14964
|
|
|
14965
|
+
function isPrivateFieldAccess(node) {
|
|
14966
|
+
return (
|
|
14967
|
+
node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" ||
|
|
14968
|
+
node.type === "ChainExpression" && isPrivateFieldAccess(node.expression)
|
|
14969
|
+
)
|
|
14970
|
+
}
|
|
14971
|
+
|
|
14745
14972
|
// Parse call, dot, and `[]`-subscript expressions.
|
|
14746
14973
|
|
|
14747
14974
|
pp$3.parseExprSubscripts = function(refDestructuringErrors) {
|
|
@@ -14753,6 +14980,7 @@ pp$3.parseExprSubscripts = function(refDestructuringErrors) {
|
|
|
14753
14980
|
if (refDestructuringErrors && result.type === "MemberExpression") {
|
|
14754
14981
|
if (refDestructuringErrors.parenthesizedAssign >= result.start) { refDestructuringErrors.parenthesizedAssign = -1; }
|
|
14755
14982
|
if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; }
|
|
14983
|
+
if (refDestructuringErrors.trailingComma >= result.start) { refDestructuringErrors.trailingComma = -1; }
|
|
14756
14984
|
}
|
|
14757
14985
|
return result
|
|
14758
14986
|
};
|
|
@@ -14789,9 +15017,15 @@ pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
14789
15017
|
if (computed || (optional && this.type !== types.parenL && this.type !== types.backQuote) || this.eat(types.dot)) {
|
|
14790
15018
|
var node = this.startNodeAt(startPos, startLoc);
|
|
14791
15019
|
node.object = base;
|
|
14792
|
-
|
|
15020
|
+
if (computed) {
|
|
15021
|
+
node.property = this.parseExpression();
|
|
15022
|
+
this.expect(types.bracketR);
|
|
15023
|
+
} else if (this.type === types.privateId && base.type !== "Super") {
|
|
15024
|
+
node.property = this.parsePrivateIdent();
|
|
15025
|
+
} else {
|
|
15026
|
+
node.property = this.parseIdent(this.options.allowReserved !== "never");
|
|
15027
|
+
}
|
|
14793
15028
|
node.computed = !!computed;
|
|
14794
|
-
if (computed) { this.expect(types.bracketR); }
|
|
14795
15029
|
if (optionalSupported) {
|
|
14796
15030
|
node.optional = optional;
|
|
14797
15031
|
}
|
|
@@ -14877,7 +15111,8 @@ pp$3.parseExprAtom = function(refDestructuringErrors) {
|
|
|
14877
15111
|
if (canBeArrow && !this.canInsertSemicolon()) {
|
|
14878
15112
|
if (this.eat(types.arrow))
|
|
14879
15113
|
{ return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false) }
|
|
14880
|
-
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc
|
|
15114
|
+
if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc &&
|
|
15115
|
+
(!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) {
|
|
14881
15116
|
id = this.parseIdent(false);
|
|
14882
15117
|
if (this.canInsertSemicolon() || !this.eat(types.arrow))
|
|
14883
15118
|
{ this.unexpected(); }
|
|
@@ -14995,7 +15230,7 @@ pp$3.parseImportMeta = function(node) {
|
|
|
14995
15230
|
{ this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'"); }
|
|
14996
15231
|
if (containsEsc)
|
|
14997
15232
|
{ this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); }
|
|
14998
|
-
if (this.options.sourceType !== "module")
|
|
15233
|
+
if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere)
|
|
14999
15234
|
{ this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); }
|
|
15000
15235
|
|
|
15001
15236
|
return this.finishNode(node, "MetaProperty")
|
|
@@ -15463,6 +15698,8 @@ pp$3.checkUnreserved = function(ref) {
|
|
|
15463
15698
|
{ this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator"); }
|
|
15464
15699
|
if (this.inAsync && name === "await")
|
|
15465
15700
|
{ this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); }
|
|
15701
|
+
if (this.currentThisScope().inClassFieldInit && name === "arguments")
|
|
15702
|
+
{ this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); }
|
|
15466
15703
|
if (this.keywords.test(name))
|
|
15467
15704
|
{ this.raise(start, ("Unexpected keyword '" + name + "'")); }
|
|
15468
15705
|
if (this.options.ecmaVersion < 6 &&
|
|
@@ -15507,9 +15744,29 @@ pp$3.parseIdent = function(liberal, isBinding) {
|
|
|
15507
15744
|
return node
|
|
15508
15745
|
};
|
|
15509
15746
|
|
|
15747
|
+
pp$3.parsePrivateIdent = function() {
|
|
15748
|
+
var node = this.startNode();
|
|
15749
|
+
if (this.type === types.privateId) {
|
|
15750
|
+
node.name = this.value;
|
|
15751
|
+
} else {
|
|
15752
|
+
this.unexpected();
|
|
15753
|
+
}
|
|
15754
|
+
this.next();
|
|
15755
|
+
this.finishNode(node, "PrivateIdentifier");
|
|
15756
|
+
|
|
15757
|
+
// For validating existence
|
|
15758
|
+
if (this.privateNameStack.length === 0) {
|
|
15759
|
+
this.raise(node.start, ("Private field '#" + (node.name) + "' must be declared in an enclosing class"));
|
|
15760
|
+
} else {
|
|
15761
|
+
this.privateNameStack[this.privateNameStack.length - 1].used.push(node);
|
|
15762
|
+
}
|
|
15763
|
+
|
|
15764
|
+
return node
|
|
15765
|
+
};
|
|
15766
|
+
|
|
15510
15767
|
// Parses yield expression inside generator.
|
|
15511
15768
|
|
|
15512
|
-
pp$3.parseYield = function(
|
|
15769
|
+
pp$3.parseYield = function(forInit) {
|
|
15513
15770
|
if (!this.yieldPos) { this.yieldPos = this.start; }
|
|
15514
15771
|
|
|
15515
15772
|
var node = this.startNode();
|
|
@@ -15519,7 +15776,7 @@ pp$3.parseYield = function(noIn) {
|
|
|
15519
15776
|
node.argument = null;
|
|
15520
15777
|
} else {
|
|
15521
15778
|
node.delegate = this.eat(types.star);
|
|
15522
|
-
node.argument = this.parseMaybeAssign(
|
|
15779
|
+
node.argument = this.parseMaybeAssign(forInit);
|
|
15523
15780
|
}
|
|
15524
15781
|
return this.finishNode(node, "YieldExpression")
|
|
15525
15782
|
};
|
|
@@ -15567,6 +15824,8 @@ var Scope = function Scope(flags) {
|
|
|
15567
15824
|
this.lexical = [];
|
|
15568
15825
|
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
|
|
15569
15826
|
this.functions = [];
|
|
15827
|
+
// A switch to disallow the identifier reference 'arguments'
|
|
15828
|
+
this.inClassFieldInit = false;
|
|
15570
15829
|
};
|
|
15571
15830
|
|
|
15572
15831
|
// The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names.
|
|
@@ -17043,9 +17302,9 @@ pp$9.readToken = function(code) {
|
|
|
17043
17302
|
|
|
17044
17303
|
pp$9.fullCharCodeAtPos = function() {
|
|
17045
17304
|
var code = this.input.charCodeAt(this.pos);
|
|
17046
|
-
if (code <= 0xd7ff || code >=
|
|
17305
|
+
if (code <= 0xd7ff || code >= 0xdc00) { return code }
|
|
17047
17306
|
var next = this.input.charCodeAt(this.pos + 1);
|
|
17048
|
-
return (code << 10) + next - 0x35fdc00
|
|
17307
|
+
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00
|
|
17049
17308
|
};
|
|
17050
17309
|
|
|
17051
17310
|
pp$9.skipBlockComment = function() {
|
|
@@ -17264,6 +17523,20 @@ pp$9.readToken_question = function() { // '?'
|
|
|
17264
17523
|
return this.finishOp(types.question, 1)
|
|
17265
17524
|
};
|
|
17266
17525
|
|
|
17526
|
+
pp$9.readToken_numberSign = function() { // '#'
|
|
17527
|
+
var ecmaVersion = this.options.ecmaVersion;
|
|
17528
|
+
var code = 35; // '#'
|
|
17529
|
+
if (ecmaVersion >= 13) {
|
|
17530
|
+
++this.pos;
|
|
17531
|
+
code = this.fullCharCodeAtPos();
|
|
17532
|
+
if (isIdentifierStart(code, true) || code === 92 /* '\' */) {
|
|
17533
|
+
return this.finishToken(types.privateId, this.readWord1())
|
|
17534
|
+
}
|
|
17535
|
+
}
|
|
17536
|
+
|
|
17537
|
+
this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
|
|
17538
|
+
};
|
|
17539
|
+
|
|
17267
17540
|
pp$9.getTokenFromCode = function(code) {
|
|
17268
17541
|
switch (code) {
|
|
17269
17542
|
// The interpretation of a dot depends on whether it is followed
|
|
@@ -17335,6 +17608,9 @@ pp$9.getTokenFromCode = function(code) {
|
|
|
17335
17608
|
|
|
17336
17609
|
case 126: // '~'
|
|
17337
17610
|
return this.finishOp(types.prefix, 1)
|
|
17611
|
+
|
|
17612
|
+
case 35: // '#'
|
|
17613
|
+
return this.readToken_numberSign()
|
|
17338
17614
|
}
|
|
17339
17615
|
|
|
17340
17616
|
this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'");
|
|
@@ -17746,7 +18022,7 @@ pp$9.readWord = function() {
|
|
|
17746
18022
|
|
|
17747
18023
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
17748
18024
|
|
|
17749
|
-
var version = "8.
|
|
18025
|
+
var version = "8.2.4";
|
|
17750
18026
|
|
|
17751
18027
|
Parser.acorn = {
|
|
17752
18028
|
Parser: Parser,
|
|
@@ -17781,47 +18057,6 @@ function parse(input, options) {
|
|
|
17781
18057
|
return Parser.parse(input, options)
|
|
17782
18058
|
}
|
|
17783
18059
|
|
|
17784
|
-
// This function tries to parse a single expression at a given
|
|
17785
|
-
// offset in a string. Useful for parsing mixed-language formats
|
|
17786
|
-
// that embed JavaScript expressions.
|
|
17787
|
-
|
|
17788
|
-
function parseExpressionAt(input, pos, options) {
|
|
17789
|
-
return Parser.parseExpressionAt(input, pos, options)
|
|
17790
|
-
}
|
|
17791
|
-
|
|
17792
|
-
// Acorn is organized as a tokenizer and a recursive-descent parser.
|
|
17793
|
-
// The `tokenizer` export provides an interface to the tokenizer.
|
|
17794
|
-
|
|
17795
|
-
function tokenizer(input, options) {
|
|
17796
|
-
return Parser.tokenizer(input, options)
|
|
17797
|
-
}
|
|
17798
|
-
|
|
17799
|
-
var acorn = {
|
|
17800
|
-
__proto__: null,
|
|
17801
|
-
Node: Node,
|
|
17802
|
-
Parser: Parser,
|
|
17803
|
-
Position: Position,
|
|
17804
|
-
SourceLocation: SourceLocation,
|
|
17805
|
-
TokContext: TokContext,
|
|
17806
|
-
Token: Token,
|
|
17807
|
-
TokenType: TokenType,
|
|
17808
|
-
defaultOptions: defaultOptions,
|
|
17809
|
-
getLineInfo: getLineInfo,
|
|
17810
|
-
isIdentifierChar: isIdentifierChar,
|
|
17811
|
-
isIdentifierStart: isIdentifierStart,
|
|
17812
|
-
isNewLine: isNewLine,
|
|
17813
|
-
keywordTypes: keywords$1,
|
|
17814
|
-
lineBreak: lineBreak,
|
|
17815
|
-
lineBreakG: lineBreakG,
|
|
17816
|
-
nonASCIIwhitespace: nonASCIIwhitespace,
|
|
17817
|
-
parse: parse,
|
|
17818
|
-
parseExpressionAt: parseExpressionAt,
|
|
17819
|
-
tokContexts: types$1,
|
|
17820
|
-
tokTypes: types,
|
|
17821
|
-
tokenizer: tokenizer,
|
|
17822
|
-
version: version
|
|
17823
|
-
};
|
|
17824
|
-
|
|
17825
18060
|
class GlobalScope extends Scope$1 {
|
|
17826
18061
|
constructor() {
|
|
17827
18062
|
super();
|
|
@@ -18571,7 +18806,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
18571
18806
|
cache: cacheInstance,
|
|
18572
18807
|
emitAsset: getDeprecatedContextHandler((name, source) => fileEmitter.emitFile({ type: 'asset', name, source }), 'emitAsset', 'emitFile', plugin.name, true, options),
|
|
18573
18808
|
emitChunk: getDeprecatedContextHandler((id, options) => fileEmitter.emitFile({ type: 'chunk', id, name: options && options.name }), 'emitChunk', 'emitFile', plugin.name, true, options),
|
|
18574
|
-
emitFile: fileEmitter.emitFile,
|
|
18809
|
+
emitFile: fileEmitter.emitFile.bind(fileEmitter),
|
|
18575
18810
|
error(err) {
|
|
18576
18811
|
return throwPluginError(err, plugin.name);
|
|
18577
18812
|
},
|
|
@@ -18646,10 +18881,10 @@ class PluginDriver {
|
|
|
18646
18881
|
warnDeprecatedHooks(userPlugins, options);
|
|
18647
18882
|
this.pluginCache = pluginCache;
|
|
18648
18883
|
this.fileEmitter = new FileEmitter(graph, options, basePluginDriver && basePluginDriver.fileEmitter);
|
|
18649
|
-
this.emitFile = this.fileEmitter.emitFile;
|
|
18650
|
-
this.getFileName = this.fileEmitter.getFileName;
|
|
18651
|
-
this.finaliseAssets = this.fileEmitter.assertAssetsFinalized;
|
|
18652
|
-
this.setOutputBundle = this.fileEmitter.setOutputBundle;
|
|
18884
|
+
this.emitFile = this.fileEmitter.emitFile.bind(this.fileEmitter);
|
|
18885
|
+
this.getFileName = this.fileEmitter.getFileName.bind(this.fileEmitter);
|
|
18886
|
+
this.finaliseAssets = this.fileEmitter.assertAssetsFinalized.bind(this.fileEmitter);
|
|
18887
|
+
this.setOutputBundle = this.fileEmitter.setOutputBundle.bind(this.fileEmitter);
|
|
18653
18888
|
this.plugins = userPlugins.concat(basePluginDriver ? basePluginDriver.plugins : []);
|
|
18654
18889
|
const existingPluginNames = new Set();
|
|
18655
18890
|
for (const plugin of this.plugins) {
|
|
@@ -19049,7 +19284,7 @@ base.ImportDeclaration = function (node, st, c) {
|
|
|
19049
19284
|
base.ImportExpression = function (node, st, c) {
|
|
19050
19285
|
c(node.source, st, "Expression");
|
|
19051
19286
|
};
|
|
19052
|
-
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.Literal = ignore;
|
|
19287
|
+
base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore;
|
|
19053
19288
|
|
|
19054
19289
|
base.TaggedTemplateExpression = function (node, st, c) {
|
|
19055
19290
|
c(node.tag, st, "Expression");
|
|
@@ -19069,9 +19304,9 @@ base.ClassBody = function (node, st, c) {
|
|
|
19069
19304
|
c(elt, st);
|
|
19070
19305
|
}
|
|
19071
19306
|
};
|
|
19072
|
-
base.MethodDefinition = base.Property = function (node, st, c) {
|
|
19307
|
+
base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) {
|
|
19073
19308
|
if (node.computed) { c(node.key, st, "Expression"); }
|
|
19074
|
-
c(node.value, st, "Expression");
|
|
19309
|
+
if (node.value) { c(node.value, st, "Expression"); }
|
|
19075
19310
|
};
|
|
19076
19311
|
|
|
19077
19312
|
// patch up acorn-walk until class-fields are officially supported
|
|
@@ -19083,10 +19318,30 @@ base.PropertyDefinition = function (node, st, c) {
|
|
|
19083
19318
|
c(node.value, st, 'Expression');
|
|
19084
19319
|
}
|
|
19085
19320
|
};
|
|
19321
|
+
function isOnlyWhitespaceOrComments(code) {
|
|
19322
|
+
// streamline the typical case
|
|
19323
|
+
if (/^\s*$/.test(code))
|
|
19324
|
+
return true;
|
|
19325
|
+
try {
|
|
19326
|
+
// successful only if it's a valid Program without statements
|
|
19327
|
+
const ast = parse(code, { ecmaVersion: 'latest' });
|
|
19328
|
+
return ast.body && ast.body.length === 0;
|
|
19329
|
+
}
|
|
19330
|
+
catch (_a) {
|
|
19331
|
+
// should only be reached by invalid annotations like:
|
|
19332
|
+
//
|
|
19333
|
+
// foo() /*@__PURE__*/ /* other */, bar();
|
|
19334
|
+
//
|
|
19335
|
+
// where `code` is " /* other */, "
|
|
19336
|
+
}
|
|
19337
|
+
return false;
|
|
19338
|
+
}
|
|
19086
19339
|
function handlePureAnnotationsOfNode(node, state, type = node.type) {
|
|
19087
19340
|
let commentNode = state.commentNodes[state.commentIndex];
|
|
19088
19341
|
while (commentNode && node.start >= commentNode.end) {
|
|
19089
|
-
|
|
19342
|
+
const between = state.code.substring(commentNode.end, node.start);
|
|
19343
|
+
if (isOnlyWhitespaceOrComments(between))
|
|
19344
|
+
markPureNode(node, commentNode);
|
|
19090
19345
|
commentNode = state.commentNodes[++state.commentIndex];
|
|
19091
19346
|
}
|
|
19092
19347
|
if (commentNode && commentNode.end <= node.end) {
|
|
@@ -19114,8 +19369,9 @@ function markPureNode(node, comment) {
|
|
|
19114
19369
|
}
|
|
19115
19370
|
const pureCommentRegex = /[@#]__PURE__/;
|
|
19116
19371
|
const isPureComment = (comment) => pureCommentRegex.test(comment.value);
|
|
19117
|
-
function markPureCallExpressions(comments, esTreeAst) {
|
|
19372
|
+
function markPureCallExpressions(comments, esTreeAst, code) {
|
|
19118
19373
|
handlePureAnnotationsOfNode(esTreeAst, {
|
|
19374
|
+
code,
|
|
19119
19375
|
commentIndex: 0,
|
|
19120
19376
|
commentNodes: comments.filter(isPureComment)
|
|
19121
19377
|
});
|
|
@@ -19222,7 +19478,7 @@ class Graph {
|
|
|
19222
19478
|
onCommentOrig.push(...comments);
|
|
19223
19479
|
}
|
|
19224
19480
|
options.onComment = onCommentOrig;
|
|
19225
|
-
markPureCallExpressions(comments, ast);
|
|
19481
|
+
markPureCallExpressions(comments, ast, code);
|
|
19226
19482
|
return ast;
|
|
19227
19483
|
}
|
|
19228
19484
|
getCache() {
|
|
@@ -19346,363 +19602,6 @@ function ensureArray(items) {
|
|
|
19346
19602
|
return [];
|
|
19347
19603
|
}
|
|
19348
19604
|
|
|
19349
|
-
function getAugmentedNamespace(n) {
|
|
19350
|
-
if (n.__esModule) return n;
|
|
19351
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
19352
|
-
Object.keys(n).forEach(function (k) {
|
|
19353
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
19354
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
19355
|
-
enumerable: true,
|
|
19356
|
-
get: function () {
|
|
19357
|
-
return n[k];
|
|
19358
|
-
}
|
|
19359
|
-
});
|
|
19360
|
-
});
|
|
19361
|
-
return a;
|
|
19362
|
-
}
|
|
19363
|
-
|
|
19364
|
-
var require$$1 = /*@__PURE__*/getAugmentedNamespace(acorn);
|
|
19365
|
-
|
|
19366
|
-
const getPrototype = Object.getPrototypeOf || (o => o.__proto__);
|
|
19367
|
-
|
|
19368
|
-
const getAcorn$1 = Parser => {
|
|
19369
|
-
if (Parser.acorn) return Parser.acorn
|
|
19370
|
-
|
|
19371
|
-
const acorn = require$$1;
|
|
19372
|
-
|
|
19373
|
-
if (acorn.version.indexOf("6.") != 0 && acorn.version.indexOf("6.0.") == 0 && acorn.version.indexOf("7.") != 0) {
|
|
19374
|
-
throw new Error(`acorn-private-class-elements requires acorn@^6.1.0 or acorn@7.0.0, not ${acorn.version}`)
|
|
19375
|
-
}
|
|
19376
|
-
|
|
19377
|
-
// Make sure `Parser` comes from the same acorn as we `require`d,
|
|
19378
|
-
// otherwise the comparisons fail.
|
|
19379
|
-
for (let cur = Parser; cur && cur !== acorn.Parser; cur = getPrototype(cur)) {
|
|
19380
|
-
if (cur !== acorn.Parser) {
|
|
19381
|
-
throw new Error("acorn-private-class-elements does not support mixing different acorn copies")
|
|
19382
|
-
}
|
|
19383
|
-
}
|
|
19384
|
-
return acorn
|
|
19385
|
-
};
|
|
19386
|
-
|
|
19387
|
-
var acornPrivateClassElements = function(Parser) {
|
|
19388
|
-
// Only load this plugin once.
|
|
19389
|
-
if (Parser.prototype.parsePrivateName) {
|
|
19390
|
-
return Parser
|
|
19391
|
-
}
|
|
19392
|
-
|
|
19393
|
-
const acorn = getAcorn$1(Parser);
|
|
19394
|
-
|
|
19395
|
-
Parser = class extends Parser {
|
|
19396
|
-
_branch() {
|
|
19397
|
-
this.__branch = this.__branch || new Parser({ecmaVersion: this.options.ecmaVersion}, this.input);
|
|
19398
|
-
this.__branch.end = this.end;
|
|
19399
|
-
this.__branch.pos = this.pos;
|
|
19400
|
-
this.__branch.type = this.type;
|
|
19401
|
-
this.__branch.value = this.value;
|
|
19402
|
-
this.__branch.containsEsc = this.containsEsc;
|
|
19403
|
-
return this.__branch
|
|
19404
|
-
}
|
|
19405
|
-
|
|
19406
|
-
parsePrivateClassElementName(element) {
|
|
19407
|
-
element.computed = false;
|
|
19408
|
-
element.key = this.parsePrivateName();
|
|
19409
|
-
if (element.key.name == "constructor") this.raise(element.key.start, "Classes may not have a private element named constructor");
|
|
19410
|
-
const accept = {get: "set", set: "get"}[element.kind];
|
|
19411
|
-
const privateBoundNames = this._privateBoundNames;
|
|
19412
|
-
if (Object.prototype.hasOwnProperty.call(privateBoundNames, element.key.name) && privateBoundNames[element.key.name] !== accept) {
|
|
19413
|
-
this.raise(element.start, "Duplicate private element");
|
|
19414
|
-
}
|
|
19415
|
-
privateBoundNames[element.key.name] = element.kind || true;
|
|
19416
|
-
delete this._unresolvedPrivateNames[element.key.name];
|
|
19417
|
-
return element.key
|
|
19418
|
-
}
|
|
19419
|
-
|
|
19420
|
-
parsePrivateName() {
|
|
19421
|
-
const node = this.startNode();
|
|
19422
|
-
node.name = this.value;
|
|
19423
|
-
this.next();
|
|
19424
|
-
this.finishNode(node, "PrivateIdentifier");
|
|
19425
|
-
if (this.options.allowReserved == "never") this.checkUnreserved(node);
|
|
19426
|
-
return node
|
|
19427
|
-
}
|
|
19428
|
-
|
|
19429
|
-
// Parse # token
|
|
19430
|
-
getTokenFromCode(code) {
|
|
19431
|
-
if (code === 35) {
|
|
19432
|
-
++this.pos;
|
|
19433
|
-
const word = this.readWord1();
|
|
19434
|
-
return this.finishToken(this.privateIdentifierToken, word)
|
|
19435
|
-
}
|
|
19436
|
-
return super.getTokenFromCode(code)
|
|
19437
|
-
}
|
|
19438
|
-
|
|
19439
|
-
// Manage stacks and check for undeclared private names
|
|
19440
|
-
parseClass(node, isStatement) {
|
|
19441
|
-
const oldOuterPrivateBoundNames = this._outerPrivateBoundNames;
|
|
19442
|
-
this._outerPrivateBoundNames = this._privateBoundNames;
|
|
19443
|
-
this._privateBoundNames = Object.create(this._privateBoundNames || null);
|
|
19444
|
-
const oldOuterUnresolvedPrivateNames = this._outerUnresolvedPrivateNames;
|
|
19445
|
-
this._outerUnresolvedPrivateNames = this._unresolvedPrivateNames;
|
|
19446
|
-
this._unresolvedPrivateNames = Object.create(null);
|
|
19447
|
-
|
|
19448
|
-
const _return = super.parseClass(node, isStatement);
|
|
19449
|
-
|
|
19450
|
-
const unresolvedPrivateNames = this._unresolvedPrivateNames;
|
|
19451
|
-
this._privateBoundNames = this._outerPrivateBoundNames;
|
|
19452
|
-
this._outerPrivateBoundNames = oldOuterPrivateBoundNames;
|
|
19453
|
-
this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
|
|
19454
|
-
this._outerUnresolvedPrivateNames = oldOuterUnresolvedPrivateNames;
|
|
19455
|
-
if (!this._unresolvedPrivateNames) {
|
|
19456
|
-
const names = Object.keys(unresolvedPrivateNames);
|
|
19457
|
-
if (names.length) {
|
|
19458
|
-
names.sort((n1, n2) => unresolvedPrivateNames[n1] - unresolvedPrivateNames[n2]);
|
|
19459
|
-
this.raise(unresolvedPrivateNames[names[0]], "Usage of undeclared private name");
|
|
19460
|
-
}
|
|
19461
|
-
} else Object.assign(this._unresolvedPrivateNames, unresolvedPrivateNames);
|
|
19462
|
-
return _return
|
|
19463
|
-
}
|
|
19464
|
-
|
|
19465
|
-
// Class heritage is evaluated with outer private environment
|
|
19466
|
-
parseClassSuper(node) {
|
|
19467
|
-
const privateBoundNames = this._privateBoundNames;
|
|
19468
|
-
this._privateBoundNames = this._outerPrivateBoundNames;
|
|
19469
|
-
const unresolvedPrivateNames = this._unresolvedPrivateNames;
|
|
19470
|
-
this._unresolvedPrivateNames = this._outerUnresolvedPrivateNames;
|
|
19471
|
-
const _return = super.parseClassSuper(node);
|
|
19472
|
-
this._privateBoundNames = privateBoundNames;
|
|
19473
|
-
this._unresolvedPrivateNames = unresolvedPrivateNames;
|
|
19474
|
-
return _return
|
|
19475
|
-
}
|
|
19476
|
-
|
|
19477
|
-
// Parse private element access
|
|
19478
|
-
parseSubscript(base, startPos, startLoc, _noCalls, _maybeAsyncArrow, _optionalChained) {
|
|
19479
|
-
const optionalSupported = this.options.ecmaVersion >= 11 && acorn.tokTypes.questionDot;
|
|
19480
|
-
const branch = this._branch();
|
|
19481
|
-
if (!(
|
|
19482
|
-
(branch.eat(acorn.tokTypes.dot) || (optionalSupported && branch.eat(acorn.tokTypes.questionDot))) &&
|
|
19483
|
-
branch.type == this.privateIdentifierToken
|
|
19484
|
-
)) {
|
|
19485
|
-
return super.parseSubscript.apply(this, arguments)
|
|
19486
|
-
}
|
|
19487
|
-
let optional = false;
|
|
19488
|
-
if (!this.eat(acorn.tokTypes.dot)) {
|
|
19489
|
-
this.expect(acorn.tokTypes.questionDot);
|
|
19490
|
-
optional = true;
|
|
19491
|
-
}
|
|
19492
|
-
let node = this.startNodeAt(startPos, startLoc);
|
|
19493
|
-
node.object = base;
|
|
19494
|
-
node.computed = false;
|
|
19495
|
-
if (optionalSupported) {
|
|
19496
|
-
node.optional = optional;
|
|
19497
|
-
}
|
|
19498
|
-
if (this.type == this.privateIdentifierToken) {
|
|
19499
|
-
if (base.type == "Super") {
|
|
19500
|
-
this.raise(this.start, "Cannot access private element on super");
|
|
19501
|
-
}
|
|
19502
|
-
node.property = this.parsePrivateName();
|
|
19503
|
-
if (!this._privateBoundNames || !this._privateBoundNames[node.property.name]) {
|
|
19504
|
-
if (!this._unresolvedPrivateNames) {
|
|
19505
|
-
this.raise(node.property.start, "Usage of undeclared private name");
|
|
19506
|
-
}
|
|
19507
|
-
this._unresolvedPrivateNames[node.property.name] = node.property.start;
|
|
19508
|
-
}
|
|
19509
|
-
} else {
|
|
19510
|
-
node.property = this.parseIdent(true);
|
|
19511
|
-
}
|
|
19512
|
-
return this.finishNode(node, "MemberExpression")
|
|
19513
|
-
}
|
|
19514
|
-
|
|
19515
|
-
// Prohibit delete of private class elements
|
|
19516
|
-
parseMaybeUnary(refDestructuringErrors, sawUnary) {
|
|
19517
|
-
const _return = super.parseMaybeUnary(refDestructuringErrors, sawUnary);
|
|
19518
|
-
if (_return.operator == "delete") {
|
|
19519
|
-
if (_return.argument.type == "MemberExpression" && _return.argument.property.type == "PrivateIdentifier") {
|
|
19520
|
-
this.raise(_return.start, "Private elements may not be deleted");
|
|
19521
|
-
}
|
|
19522
|
-
}
|
|
19523
|
-
return _return
|
|
19524
|
-
}
|
|
19525
|
-
};
|
|
19526
|
-
Parser.prototype.privateIdentifierToken = new acorn.TokenType("privateIdentifier");
|
|
19527
|
-
return Parser
|
|
19528
|
-
};
|
|
19529
|
-
|
|
19530
|
-
const privateClassElements$1 = acornPrivateClassElements;
|
|
19531
|
-
|
|
19532
|
-
var acornClassFields = function(Parser) {
|
|
19533
|
-
const acorn = Parser.acorn || require$$1;
|
|
19534
|
-
const tt = acorn.tokTypes;
|
|
19535
|
-
|
|
19536
|
-
Parser = privateClassElements$1(Parser);
|
|
19537
|
-
return class extends Parser {
|
|
19538
|
-
_maybeParseFieldValue(field) {
|
|
19539
|
-
if (this.eat(tt.eq)) {
|
|
19540
|
-
const oldInFieldValue = this._inFieldValue;
|
|
19541
|
-
this._inFieldValue = true;
|
|
19542
|
-
if (this.type === tt.name && this.value === "await" && (this.inAsync || this.options.allowAwaitOutsideFunction)) {
|
|
19543
|
-
field.value = this.parseAwait();
|
|
19544
|
-
} else field.value = this.parseExpression();
|
|
19545
|
-
this._inFieldValue = oldInFieldValue;
|
|
19546
|
-
} else field.value = null;
|
|
19547
|
-
}
|
|
19548
|
-
|
|
19549
|
-
// Parse fields
|
|
19550
|
-
parseClassElement(_constructorAllowsSuper) {
|
|
19551
|
-
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)) {
|
|
19552
|
-
const branch = this._branch();
|
|
19553
|
-
if (branch.type == tt.bracketL) {
|
|
19554
|
-
let count = 0;
|
|
19555
|
-
do {
|
|
19556
|
-
if (branch.eat(tt.bracketL)) ++count;
|
|
19557
|
-
else if (branch.eat(tt.bracketR)) --count;
|
|
19558
|
-
else branch.next();
|
|
19559
|
-
} while (count > 0)
|
|
19560
|
-
} else branch.next(true);
|
|
19561
|
-
let isField = branch.type == tt.eq || branch.type == tt.semi;
|
|
19562
|
-
if (!isField && branch.canInsertSemicolon()) {
|
|
19563
|
-
isField = branch.type != tt.parenL;
|
|
19564
|
-
}
|
|
19565
|
-
if (isField) {
|
|
19566
|
-
const node = this.startNode();
|
|
19567
|
-
if (this.type == this.privateIdentifierToken) {
|
|
19568
|
-
this.parsePrivateClassElementName(node);
|
|
19569
|
-
} else {
|
|
19570
|
-
this.parsePropertyName(node);
|
|
19571
|
-
}
|
|
19572
|
-
if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
|
|
19573
|
-
(node.key.type === "Literal" && node.key.value === "constructor")) {
|
|
19574
|
-
this.raise(node.key.start, "Classes may not have a field called constructor");
|
|
19575
|
-
}
|
|
19576
|
-
this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
|
|
19577
|
-
this._maybeParseFieldValue(node);
|
|
19578
|
-
this.exitScope();
|
|
19579
|
-
this.finishNode(node, "PropertyDefinition");
|
|
19580
|
-
this.semicolon();
|
|
19581
|
-
return node
|
|
19582
|
-
}
|
|
19583
|
-
}
|
|
19584
|
-
|
|
19585
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19586
|
-
}
|
|
19587
|
-
|
|
19588
|
-
// Prohibit arguments in class field initializers
|
|
19589
|
-
parseIdent(liberal, isBinding) {
|
|
19590
|
-
const ident = super.parseIdent(liberal, isBinding);
|
|
19591
|
-
if (this._inFieldValue && ident.name == "arguments") this.raise(ident.start, "A class field initializer may not contain arguments");
|
|
19592
|
-
return ident
|
|
19593
|
-
}
|
|
19594
|
-
}
|
|
19595
|
-
};
|
|
19596
|
-
|
|
19597
|
-
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
19598
|
-
|
|
19599
|
-
// eslint-disable-next-line node/no-unsupported-features/es-syntax
|
|
19600
|
-
function privateMethods(Parser) {
|
|
19601
|
-
const ExtendedParser = acornPrivateClassElements(Parser);
|
|
19602
|
-
|
|
19603
|
-
return class extends ExtendedParser {
|
|
19604
|
-
// Parse private methods
|
|
19605
|
-
parseClassElement(_constructorAllowsSuper) {
|
|
19606
|
-
const oldInClassMemberName = this._inClassMemberName;
|
|
19607
|
-
this._inClassMemberName = true;
|
|
19608
|
-
const result = super.parseClassElement.apply(this, arguments);
|
|
19609
|
-
this._inClassMemberName = oldInClassMemberName;
|
|
19610
|
-
return result
|
|
19611
|
-
}
|
|
19612
|
-
|
|
19613
|
-
parsePropertyName(prop) {
|
|
19614
|
-
const isPrivate = this.options.ecmaVersion >= 8 && this._inClassMemberName && this.type == this.privateIdentifierToken && !prop.static;
|
|
19615
|
-
this._inClassMemberName = false;
|
|
19616
|
-
if (!isPrivate) return super.parsePropertyName(prop)
|
|
19617
|
-
return this.parsePrivateClassElementName(prop)
|
|
19618
|
-
}
|
|
19619
|
-
}
|
|
19620
|
-
}
|
|
19621
|
-
|
|
19622
|
-
const privateClassElements = acornPrivateClassElements;
|
|
19623
|
-
|
|
19624
|
-
var acornStaticClassFeatures = function(Parser) {
|
|
19625
|
-
const ExtendedParser = privateClassElements(Parser);
|
|
19626
|
-
|
|
19627
|
-
const acorn = Parser.acorn || require$$1;
|
|
19628
|
-
const tt = acorn.tokTypes;
|
|
19629
|
-
|
|
19630
|
-
return class extends ExtendedParser {
|
|
19631
|
-
_maybeParseFieldValue(field) {
|
|
19632
|
-
if (this.eat(tt.eq)) {
|
|
19633
|
-
const oldInFieldValue = this._inStaticFieldScope;
|
|
19634
|
-
this._inStaticFieldScope = this.currentThisScope();
|
|
19635
|
-
field.value = this.parseExpression();
|
|
19636
|
-
this._inStaticFieldScope = oldInFieldValue;
|
|
19637
|
-
} else field.value = null;
|
|
19638
|
-
}
|
|
19639
|
-
|
|
19640
|
-
// Parse fields
|
|
19641
|
-
parseClassElement(_constructorAllowsSuper) {
|
|
19642
|
-
if (this.options.ecmaVersion < 8 || !this.isContextual("static")) {
|
|
19643
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19644
|
-
}
|
|
19645
|
-
|
|
19646
|
-
const branch = this._branch();
|
|
19647
|
-
branch.next();
|
|
19648
|
-
if ([tt.name, tt.bracketL, tt.string, tt.num, this.privateIdentifierToken].indexOf(branch.type) == -1 && !branch.type.keyword) {
|
|
19649
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19650
|
-
}
|
|
19651
|
-
if (branch.type == tt.bracketL) {
|
|
19652
|
-
let count = 0;
|
|
19653
|
-
do {
|
|
19654
|
-
if (branch.eat(tt.bracketL)) ++count;
|
|
19655
|
-
else if (branch.eat(tt.bracketR)) --count;
|
|
19656
|
-
else branch.next();
|
|
19657
|
-
} while (count > 0)
|
|
19658
|
-
} else branch.next();
|
|
19659
|
-
if (branch.type != tt.eq && !branch.canInsertSemicolon() && branch.type != tt.semi) {
|
|
19660
|
-
return super.parseClassElement.apply(this, arguments)
|
|
19661
|
-
}
|
|
19662
|
-
|
|
19663
|
-
const node = this.startNode();
|
|
19664
|
-
node.static = this.eatContextual("static");
|
|
19665
|
-
if (this.type == this.privateIdentifierToken) {
|
|
19666
|
-
this.parsePrivateClassElementName(node);
|
|
19667
|
-
} else {
|
|
19668
|
-
this.parsePropertyName(node);
|
|
19669
|
-
}
|
|
19670
|
-
if ((node.key.type === "Identifier" && node.key.name === "constructor") ||
|
|
19671
|
-
(node.key.type === "Literal" && !node.computed && node.key.value === "constructor")) {
|
|
19672
|
-
this.raise(node.key.start, "Classes may not have a field called constructor");
|
|
19673
|
-
}
|
|
19674
|
-
if ((node.key.name || node.key.value) === "prototype" && !node.computed) {
|
|
19675
|
-
this.raise(node.key.start, "Classes may not have a static property named prototype");
|
|
19676
|
-
}
|
|
19677
|
-
|
|
19678
|
-
this.enterScope(64 | 2 | 1); // See acorn's scopeflags.js
|
|
19679
|
-
this._maybeParseFieldValue(node);
|
|
19680
|
-
this.exitScope();
|
|
19681
|
-
this.finishNode(node, "PropertyDefinition");
|
|
19682
|
-
this.semicolon();
|
|
19683
|
-
return node
|
|
19684
|
-
}
|
|
19685
|
-
|
|
19686
|
-
// Parse private static methods
|
|
19687
|
-
parsePropertyName(prop) {
|
|
19688
|
-
if (prop.static && this.type == this.privateIdentifierToken) {
|
|
19689
|
-
this.parsePrivateClassElementName(prop);
|
|
19690
|
-
} else {
|
|
19691
|
-
super.parsePropertyName(prop);
|
|
19692
|
-
}
|
|
19693
|
-
}
|
|
19694
|
-
|
|
19695
|
-
// Prohibit arguments in class field initializers
|
|
19696
|
-
parseIdent(liberal, isBinding) {
|
|
19697
|
-
const ident = super.parseIdent(liberal, isBinding);
|
|
19698
|
-
if (this._inStaticFieldScope && this.currentThisScope() === this._inStaticFieldScope && ident.name == "arguments") {
|
|
19699
|
-
this.raise(ident.start, "A static class field initializer may not contain arguments");
|
|
19700
|
-
}
|
|
19701
|
-
return ident
|
|
19702
|
-
}
|
|
19703
|
-
}
|
|
19704
|
-
};
|
|
19705
|
-
|
|
19706
19605
|
const defaultOnWarn = warning => console.warn(warning.message || warning);
|
|
19707
19606
|
function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignoredKeys = /$./) {
|
|
19708
19607
|
const validOptionSet = new Set(validOptions);
|
|
@@ -19775,12 +19674,7 @@ const getAcorn = (config) => ({
|
|
|
19775
19674
|
sourceType: 'module',
|
|
19776
19675
|
...config.acorn
|
|
19777
19676
|
});
|
|
19778
|
-
const getAcornInjectPlugins = (config) =>
|
|
19779
|
-
acornClassFields,
|
|
19780
|
-
privateMethods,
|
|
19781
|
-
acornStaticClassFeatures,
|
|
19782
|
-
...ensureArray(config.acornInjectPlugins)
|
|
19783
|
-
];
|
|
19677
|
+
const getAcornInjectPlugins = (config) => ensureArray(config.acornInjectPlugins);
|
|
19784
19678
|
const getCache = (config) => {
|
|
19785
19679
|
var _a;
|
|
19786
19680
|
return ((_a = config.cache) === null || _a === void 0 ? void 0 : _a.cache) || config.cache;
|
|
@@ -19900,6 +19794,14 @@ const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules, w
|
|
|
19900
19794
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
19901
19795
|
};
|
|
19902
19796
|
|
|
19797
|
+
function sanitizeFileName(name) {
|
|
19798
|
+
const match = /^[a-z]:/i.exec(name);
|
|
19799
|
+
const driveLetter = match ? match[0] : "";
|
|
19800
|
+
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
19801
|
+
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
19802
|
+
return driveLetter + name.substr(driveLetter.length).replace(/[\0?*:]/g, '_');
|
|
19803
|
+
}
|
|
19804
|
+
|
|
19903
19805
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
19904
19806
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
19905
19807
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -19944,6 +19846,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
19944
19846
|
preferConst: config.preferConst || false,
|
|
19945
19847
|
preserveModules,
|
|
19946
19848
|
preserveModulesRoot: getPreserveModulesRoot(config),
|
|
19849
|
+
sanitizeFileName: (typeof config.sanitizeFileName === 'function' ? config.sanitizeFileName : config.sanitizeFileName === false ? (id) => id : sanitizeFileName),
|
|
19947
19850
|
sourcemap: config.sourcemap || false,
|
|
19948
19851
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
19949
19852
|
sourcemapFile: config.sourcemapFile,
|
|
@@ -20172,7 +20075,10 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
20172
20075
|
}
|
|
20173
20076
|
return configManualChunks || {};
|
|
20174
20077
|
};
|
|
20175
|
-
const getMinifyInternalExports = (config, format, compact) => {
|
|
20078
|
+
const getMinifyInternalExports = (config, format, compact) => {
|
|
20079
|
+
var _a;
|
|
20080
|
+
return (_a = config.minifyInternalExports) !== null && _a !== void 0 ? _a : (compact || format === 'es' || format === 'system');
|
|
20081
|
+
};
|
|
20176
20082
|
|
|
20177
20083
|
function rollup(rawInputOptions) {
|
|
20178
20084
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -20389,4 +20295,4 @@ function watch(configs) {
|
|
|
20389
20295
|
return emitter;
|
|
20390
20296
|
}
|
|
20391
20297
|
|
|
20392
|
-
export { defaultOnWarn, ensureArray, fseventsImporter,
|
|
20298
|
+
export { defaultOnWarn, ensureArray, fseventsImporter, rollup, rollupInternal, version$1 as version, warnUnknownOptions, watch };
|