rollup 2.66.0 → 2.66.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +101 -116
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +101 -116
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/es/rollup.js
CHANGED
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.66.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.66.1
|
|
4
|
+
Tue, 25 Jan 2022 07:58:28 GMT - commit f523f0098d3e98f87abef54f48f39d06a7cc7eec
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
15
15
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
16
16
|
import { EventEmitter } from 'events';
|
|
17
17
|
|
|
18
|
-
var version$1 = "2.66.
|
|
18
|
+
var version$1 = "2.66.1";
|
|
19
19
|
|
|
20
20
|
var charToInteger = {};
|
|
21
21
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1803,10 +1803,10 @@ class ExternalModule {
|
|
|
1803
1803
|
getVariableForExportName(name) {
|
|
1804
1804
|
let declaration = this.declarations[name];
|
|
1805
1805
|
if (declaration)
|
|
1806
|
-
return declaration;
|
|
1806
|
+
return [declaration];
|
|
1807
1807
|
this.declarations[name] = declaration = new ExternalVariable(this, name);
|
|
1808
1808
|
this.exportedVariables.set(declaration, name);
|
|
1809
|
-
return declaration;
|
|
1809
|
+
return [declaration];
|
|
1810
1810
|
}
|
|
1811
1811
|
setRenderPath(options, inputBase) {
|
|
1812
1812
|
this.renderPath =
|
|
@@ -10594,22 +10594,22 @@ function errMixedExport(facadeModuleId, name) {
|
|
|
10594
10594
|
url: `https://rollupjs.org/guide/en/#outputexports`
|
|
10595
10595
|
};
|
|
10596
10596
|
}
|
|
10597
|
-
function errNamespaceConflict(name,
|
|
10597
|
+
function errNamespaceConflict(name, reexportingModuleId, sources) {
|
|
10598
10598
|
return {
|
|
10599
10599
|
code: Errors.NAMESPACE_CONFLICT,
|
|
10600
|
-
message: `Conflicting namespaces: "${relativeId(
|
|
10600
|
+
message: `Conflicting namespaces: "${relativeId(reexportingModuleId)}" re-exports "${name}" from one of the modules ${printQuotedStringList(sources.map(moduleId => relativeId(moduleId)))} (will be ignored)`,
|
|
10601
10601
|
name,
|
|
10602
|
-
reexporter:
|
|
10603
|
-
sources
|
|
10602
|
+
reexporter: reexportingModuleId,
|
|
10603
|
+
sources
|
|
10604
10604
|
};
|
|
10605
10605
|
}
|
|
10606
|
-
function errAmbiguousExternalNamespaces(name, reexportingModule,
|
|
10606
|
+
function errAmbiguousExternalNamespaces(name, reexportingModule, usedModule, sources) {
|
|
10607
10607
|
return {
|
|
10608
10608
|
code: Errors.AMBIGUOUS_EXTERNAL_NAMESPACES,
|
|
10609
|
-
message: `Ambiguous external namespace resolution: "${relativeId(reexportingModule)}" re-exports "${name}" from one of the external modules ${printQuotedStringList(
|
|
10609
|
+
message: `Ambiguous external namespace resolution: "${relativeId(reexportingModule)}" re-exports "${name}" from one of the external modules ${printQuotedStringList(sources.map(module => relativeId(module)))}, guessing "${relativeId(usedModule)}".`,
|
|
10610
10610
|
name,
|
|
10611
10611
|
reexporter: reexportingModule,
|
|
10612
|
-
sources
|
|
10612
|
+
sources
|
|
10613
10613
|
};
|
|
10614
10614
|
}
|
|
10615
10615
|
function errNoTransformMapOrAstWithoutCode(pluginName) {
|
|
@@ -10633,7 +10633,7 @@ function errSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExportsOp
|
|
|
10633
10633
|
code: Errors.SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT,
|
|
10634
10634
|
id,
|
|
10635
10635
|
message: `Module "${relativeId(id)}" that is marked with 'syntheticNamedExports: ${JSON.stringify(syntheticNamedExportsOption)}' needs ${typeof syntheticNamedExportsOption === 'string' && syntheticNamedExportsOption !== 'default'
|
|
10636
|
-
? `an export named "${syntheticNamedExportsOption}"`
|
|
10636
|
+
? `an explicit export named "${syntheticNamedExportsOption}"`
|
|
10637
10637
|
: 'a default export'} that does not reexport an unresolved named export of the same module.`
|
|
10638
10638
|
};
|
|
10639
10639
|
}
|
|
@@ -12137,11 +12137,11 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
12137
12137
|
identifier: null,
|
|
12138
12138
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
12139
12139
|
};
|
|
12140
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()
|
|
12140
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()) {
|
|
12141
12141
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
12142
12142
|
if (searchedModules) {
|
|
12143
12143
|
if (searchedModules.has(target)) {
|
|
12144
|
-
return isExportAllSearch ? null : error(errCircularReexport(name, target.id));
|
|
12144
|
+
return isExportAllSearch ? [null] : error(errCircularReexport(name, target.id));
|
|
12145
12145
|
}
|
|
12146
12146
|
searchedModules.add(target);
|
|
12147
12147
|
}
|
|
@@ -12151,8 +12151,7 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
12151
12151
|
return target.getVariableForExportName(name, {
|
|
12152
12152
|
importerForSideEffects,
|
|
12153
12153
|
isExportAllSearch,
|
|
12154
|
-
searchedNamesAndModules
|
|
12155
|
-
skipExternalNamespaceReexports
|
|
12154
|
+
searchedNamesAndModules
|
|
12156
12155
|
});
|
|
12157
12156
|
}
|
|
12158
12157
|
function getAndExtendSideEffectModules(variable, module) {
|
|
@@ -12198,7 +12197,6 @@ class Module {
|
|
|
12198
12197
|
this.execIndex = Infinity;
|
|
12199
12198
|
this.exportAllSources = new Set();
|
|
12200
12199
|
this.exports = Object.create(null);
|
|
12201
|
-
this.exportsAll = Object.create(null);
|
|
12202
12200
|
this.implicitlyLoadedAfter = new Set();
|
|
12203
12201
|
this.implicitlyLoadedBefore = new Set();
|
|
12204
12202
|
this.importDescriptions = Object.create(null);
|
|
@@ -12319,6 +12317,11 @@ class Module {
|
|
|
12319
12317
|
allExportNames.add(name);
|
|
12320
12318
|
}
|
|
12321
12319
|
}
|
|
12320
|
+
// We do not count the synthetic namespace as a regular export to hide it
|
|
12321
|
+
// from entry signatures and namespace objects
|
|
12322
|
+
if (typeof this.info.syntheticNamedExports === 'string') {
|
|
12323
|
+
allExportNames.delete(this.info.syntheticNamedExports);
|
|
12324
|
+
}
|
|
12322
12325
|
return allExportNames;
|
|
12323
12326
|
}
|
|
12324
12327
|
getDependenciesToBeIncluded() {
|
|
@@ -12333,7 +12336,7 @@ class Module {
|
|
|
12333
12336
|
this.namespace.included ||
|
|
12334
12337
|
this.implicitlyLoadedAfter.size > 0) {
|
|
12335
12338
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
12336
|
-
const exportedVariable = this.getVariableForExportName(exportName);
|
|
12339
|
+
const [exportedVariable] = this.getVariableForExportName(exportName);
|
|
12337
12340
|
if (exportedVariable) {
|
|
12338
12341
|
dependencyVariables.add(exportedVariable);
|
|
12339
12342
|
}
|
|
@@ -12373,9 +12376,7 @@ class Module {
|
|
|
12373
12376
|
}
|
|
12374
12377
|
const exportNamesByVariable = new Map();
|
|
12375
12378
|
for (const exportName of this.getAllExportNames()) {
|
|
12376
|
-
|
|
12377
|
-
continue;
|
|
12378
|
-
let tracedVariable = this.getVariableForExportName(exportName);
|
|
12379
|
+
let [tracedVariable] = this.getVariableForExportName(exportName);
|
|
12379
12380
|
if (tracedVariable instanceof ExportDefaultVariable) {
|
|
12380
12381
|
tracedVariable = tracedVariable.getOriginalVariable();
|
|
12381
12382
|
}
|
|
@@ -12424,7 +12425,7 @@ class Module {
|
|
|
12424
12425
|
const renderedExports = [];
|
|
12425
12426
|
const removedExports = [];
|
|
12426
12427
|
for (const exportName in this.exports) {
|
|
12427
|
-
const variable = this.getVariableForExportName(exportName);
|
|
12428
|
+
const [variable] = this.getVariableForExportName(exportName);
|
|
12428
12429
|
(variable && variable.included ? renderedExports : removedExports).push(exportName);
|
|
12429
12430
|
}
|
|
12430
12431
|
return { removedExports, renderedExports };
|
|
@@ -12432,20 +12433,20 @@ class Module {
|
|
|
12432
12433
|
getSyntheticNamespace() {
|
|
12433
12434
|
if (this.syntheticNamespace === null) {
|
|
12434
12435
|
this.syntheticNamespace = undefined;
|
|
12435
|
-
this.syntheticNamespace = this.getVariableForExportName(typeof this.info.syntheticNamedExports === 'string'
|
|
12436
|
+
[this.syntheticNamespace] = this.getVariableForExportName(typeof this.info.syntheticNamedExports === 'string'
|
|
12436
12437
|
? this.info.syntheticNamedExports
|
|
12437
|
-
: 'default');
|
|
12438
|
+
: 'default', { onlyExplicit: true });
|
|
12438
12439
|
}
|
|
12439
12440
|
if (!this.syntheticNamespace) {
|
|
12440
12441
|
return error(errSyntheticNamedExportsNeedNamespaceExport(this.id, this.info.syntheticNamedExports));
|
|
12441
12442
|
}
|
|
12442
12443
|
return this.syntheticNamespace;
|
|
12443
12444
|
}
|
|
12444
|
-
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch,
|
|
12445
|
+
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
12445
12446
|
if (name[0] === '*') {
|
|
12446
12447
|
if (name.length === 1) {
|
|
12447
12448
|
// export * from './other'
|
|
12448
|
-
return this.namespace;
|
|
12449
|
+
return [this.namespace];
|
|
12449
12450
|
}
|
|
12450
12451
|
else {
|
|
12451
12452
|
// export * from 'external'
|
|
@@ -12456,19 +12457,19 @@ class Module {
|
|
|
12456
12457
|
// export { foo } from './other'
|
|
12457
12458
|
const reexportDeclaration = this.reexportDescriptions[name];
|
|
12458
12459
|
if (reexportDeclaration) {
|
|
12459
|
-
const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules
|
|
12460
|
+
const [variable] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules);
|
|
12460
12461
|
if (!variable) {
|
|
12461
12462
|
return this.error(errMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id), reexportDeclaration.start);
|
|
12462
12463
|
}
|
|
12463
12464
|
if (importerForSideEffects) {
|
|
12464
12465
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
12465
12466
|
}
|
|
12466
|
-
return variable;
|
|
12467
|
+
return [variable];
|
|
12467
12468
|
}
|
|
12468
12469
|
const exportDeclaration = this.exports[name];
|
|
12469
12470
|
if (exportDeclaration) {
|
|
12470
12471
|
if (exportDeclaration === MISSING_EXPORT_SHIM_DESCRIPTION) {
|
|
12471
|
-
return this.exportShimVariable;
|
|
12472
|
+
return [this.exportShimVariable];
|
|
12472
12473
|
}
|
|
12473
12474
|
const name = exportDeclaration.localName;
|
|
12474
12475
|
const variable = this.traceVariable(name, importerForSideEffects);
|
|
@@ -12476,38 +12477,34 @@ class Module {
|
|
|
12476
12477
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
|
|
12477
12478
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
12478
12479
|
}
|
|
12479
|
-
return variable;
|
|
12480
|
+
return [variable];
|
|
12481
|
+
}
|
|
12482
|
+
if (onlyExplicit) {
|
|
12483
|
+
return [null];
|
|
12480
12484
|
}
|
|
12481
12485
|
if (name !== 'default') {
|
|
12482
12486
|
const foundNamespaceReexport = name in this.namespaceReexportsByName
|
|
12483
12487
|
? this.namespaceReexportsByName[name]
|
|
12484
|
-
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
}
|
|
12488
|
-
if (foundNamespaceReexport) {
|
|
12488
|
+
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules);
|
|
12489
|
+
this.namespaceReexportsByName[name] = foundNamespaceReexport;
|
|
12490
|
+
if (foundNamespaceReexport[0]) {
|
|
12489
12491
|
return foundNamespaceReexport;
|
|
12490
12492
|
}
|
|
12491
12493
|
}
|
|
12492
12494
|
if (this.info.syntheticNamedExports) {
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
syntheticExport = new SyntheticNamedExportVariable(this.astContext, name, syntheticNamespace);
|
|
12497
|
-
this.syntheticExports.set(name, syntheticExport);
|
|
12498
|
-
return syntheticExport;
|
|
12499
|
-
}
|
|
12500
|
-
return syntheticExport;
|
|
12495
|
+
return [
|
|
12496
|
+
getOrCreate(this.syntheticExports, name, () => new SyntheticNamedExportVariable(this.astContext, name, this.getSyntheticNamespace()))
|
|
12497
|
+
];
|
|
12501
12498
|
}
|
|
12502
12499
|
// we don't want to create shims when we are just
|
|
12503
12500
|
// probing export * modules for exports
|
|
12504
12501
|
if (!isExportAllSearch) {
|
|
12505
12502
|
if (this.options.shimMissingExports) {
|
|
12506
12503
|
this.shimMissingExport(name);
|
|
12507
|
-
return this.exportShimVariable;
|
|
12504
|
+
return [this.exportShimVariable];
|
|
12508
12505
|
}
|
|
12509
12506
|
}
|
|
12510
|
-
return null;
|
|
12507
|
+
return [null];
|
|
12511
12508
|
}
|
|
12512
12509
|
hasEffects() {
|
|
12513
12510
|
return (this.info.hasModuleSideEffects === 'no-treeshake' ||
|
|
@@ -12525,7 +12522,7 @@ class Module {
|
|
|
12525
12522
|
}
|
|
12526
12523
|
for (const exportName of this.getExports()) {
|
|
12527
12524
|
if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
|
|
12528
|
-
const variable = this.getVariableForExportName(exportName);
|
|
12525
|
+
const variable = this.getVariableForExportName(exportName)[0];
|
|
12529
12526
|
variable.deoptimizePath(UNKNOWN_PATH);
|
|
12530
12527
|
if (!variable.included) {
|
|
12531
12528
|
this.includeVariable(variable);
|
|
@@ -12533,7 +12530,7 @@ class Module {
|
|
|
12533
12530
|
}
|
|
12534
12531
|
}
|
|
12535
12532
|
for (const name of this.getReexports()) {
|
|
12536
|
-
const variable = this.getVariableForExportName(name);
|
|
12533
|
+
const [variable] = this.getVariableForExportName(name);
|
|
12537
12534
|
if (variable) {
|
|
12538
12535
|
variable.deoptimizePath(UNKNOWN_PATH);
|
|
12539
12536
|
if (!variable.included) {
|
|
@@ -12558,11 +12555,6 @@ class Module {
|
|
|
12558
12555
|
linkImports() {
|
|
12559
12556
|
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
12560
12557
|
this.addModulesToImportDescriptions(this.reexportDescriptions);
|
|
12561
|
-
for (const name in this.exports) {
|
|
12562
|
-
if (name !== 'default' && name !== this.info.syntheticNamedExports) {
|
|
12563
|
-
this.exportsAll[name] = this.id;
|
|
12564
|
-
}
|
|
12565
|
-
}
|
|
12566
12558
|
const externalExportAllModules = [];
|
|
12567
12559
|
for (const source of this.exportAllSources) {
|
|
12568
12560
|
const module = this.graph.modulesById.get(this.resolvedIds[source].id);
|
|
@@ -12571,14 +12563,6 @@ class Module {
|
|
|
12571
12563
|
continue;
|
|
12572
12564
|
}
|
|
12573
12565
|
this.exportAllModules.push(module);
|
|
12574
|
-
for (const name in module.exportsAll) {
|
|
12575
|
-
if (name in this.exportsAll) {
|
|
12576
|
-
this.options.onwarn(errNamespaceConflict(name, this, module));
|
|
12577
|
-
}
|
|
12578
|
-
else {
|
|
12579
|
-
this.exportsAll[name] = module.exportsAll[name];
|
|
12580
|
-
}
|
|
12581
|
-
}
|
|
12582
12566
|
}
|
|
12583
12567
|
this.exportAllModules.push(...externalExportAllModules);
|
|
12584
12568
|
}
|
|
@@ -12636,7 +12620,7 @@ class Module {
|
|
|
12636
12620
|
moduleContext: this.context,
|
|
12637
12621
|
options: this.options,
|
|
12638
12622
|
requestTreeshakingPass: () => (this.graph.needsTreeshakingPass = true),
|
|
12639
|
-
traceExport: this.getVariableForExportName
|
|
12623
|
+
traceExport: (name) => this.getVariableForExportName(name)[0],
|
|
12640
12624
|
traceVariable: this.traceVariable.bind(this),
|
|
12641
12625
|
usesTopLevelAwait: false,
|
|
12642
12626
|
warn: this.warn.bind(this)
|
|
@@ -12676,7 +12660,7 @@ class Module {
|
|
|
12676
12660
|
if (otherModule instanceof Module && importDeclaration.name === '*') {
|
|
12677
12661
|
return otherModule.namespace;
|
|
12678
12662
|
}
|
|
12679
|
-
const declaration = otherModule.getVariableForExportName(importDeclaration.name, {
|
|
12663
|
+
const [declaration] = otherModule.getVariableForExportName(importDeclaration.name, {
|
|
12680
12664
|
importerForSideEffects: importerForSideEffects || this
|
|
12681
12665
|
});
|
|
12682
12666
|
if (!declaration) {
|
|
@@ -12874,58 +12858,57 @@ class Module {
|
|
|
12874
12858
|
addSideEffectDependencies(this.dependencies);
|
|
12875
12859
|
addSideEffectDependencies(alwaysCheckedDependencies);
|
|
12876
12860
|
}
|
|
12877
|
-
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules
|
|
12861
|
+
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules) {
|
|
12878
12862
|
let foundSyntheticDeclaration = null;
|
|
12879
|
-
const
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
skipExternalNamespaceValues.push({
|
|
12886
|
-
searchedNamesAndModules: clonedSearchedNamesAndModules,
|
|
12887
|
-
skipExternalNamespaces: false
|
|
12888
|
-
});
|
|
12889
|
-
}
|
|
12890
|
-
for (const { skipExternalNamespaces, searchedNamesAndModules } of skipExternalNamespaceValues) {
|
|
12891
|
-
const foundDeclarations = new Set();
|
|
12892
|
-
for (const module of this.exportAllModules) {
|
|
12893
|
-
if (module instanceof Module || !skipExternalNamespaces) {
|
|
12894
|
-
const declaration = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules, skipExternalNamespaces);
|
|
12895
|
-
if (declaration) {
|
|
12896
|
-
if (!(declaration instanceof SyntheticNamedExportVariable)) {
|
|
12897
|
-
foundDeclarations.add(declaration);
|
|
12898
|
-
}
|
|
12899
|
-
else if (!foundSyntheticDeclaration) {
|
|
12900
|
-
foundSyntheticDeclaration = declaration;
|
|
12901
|
-
}
|
|
12902
|
-
}
|
|
12903
|
-
}
|
|
12863
|
+
const foundInternalDeclarations = new Map();
|
|
12864
|
+
const foundExternalDeclarations = new Set();
|
|
12865
|
+
for (const module of this.exportAllModules) {
|
|
12866
|
+
// Synthetic namespaces should not hide "regular" exports of the same name
|
|
12867
|
+
if (module.info.syntheticNamedExports === name) {
|
|
12868
|
+
continue;
|
|
12904
12869
|
}
|
|
12905
|
-
|
|
12906
|
-
|
|
12870
|
+
const [variable, indirectExternal] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules);
|
|
12871
|
+
if (module instanceof ExternalModule || indirectExternal) {
|
|
12872
|
+
foundExternalDeclarations.add(variable);
|
|
12907
12873
|
}
|
|
12908
|
-
if (
|
|
12909
|
-
if (
|
|
12910
|
-
|
|
12874
|
+
else if (variable instanceof SyntheticNamedExportVariable) {
|
|
12875
|
+
if (!foundSyntheticDeclaration) {
|
|
12876
|
+
foundSyntheticDeclaration = variable;
|
|
12911
12877
|
}
|
|
12912
|
-
|
|
12913
|
-
|
|
12878
|
+
}
|
|
12879
|
+
else if (variable) {
|
|
12880
|
+
foundInternalDeclarations.set(variable, module);
|
|
12881
|
+
}
|
|
12882
|
+
}
|
|
12883
|
+
if (foundInternalDeclarations.size > 0) {
|
|
12884
|
+
const foundDeclarationList = [...foundInternalDeclarations];
|
|
12885
|
+
const usedDeclaration = foundDeclarationList[0][0];
|
|
12886
|
+
if (foundDeclarationList.length === 1) {
|
|
12887
|
+
return [usedDeclaration];
|
|
12888
|
+
}
|
|
12889
|
+
this.options.onwarn(errNamespaceConflict(name, this.id, foundDeclarationList.map(([, module]) => module.id)));
|
|
12890
|
+
// TODO we are pretending it was not found while it should behave like "undefined"
|
|
12891
|
+
return [null];
|
|
12892
|
+
}
|
|
12893
|
+
if (foundExternalDeclarations.size > 0) {
|
|
12894
|
+
const foundDeclarationList = [...foundExternalDeclarations];
|
|
12895
|
+
const usedDeclaration = foundDeclarationList[0];
|
|
12896
|
+
if (foundDeclarationList.length > 1) {
|
|
12914
12897
|
this.options.onwarn(errAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
12915
|
-
return usedDeclaration;
|
|
12916
12898
|
}
|
|
12899
|
+
return [usedDeclaration, true];
|
|
12917
12900
|
}
|
|
12918
12901
|
if (foundSyntheticDeclaration) {
|
|
12919
|
-
return foundSyntheticDeclaration;
|
|
12902
|
+
return [foundSyntheticDeclaration];
|
|
12920
12903
|
}
|
|
12921
|
-
return null;
|
|
12904
|
+
return [null];
|
|
12922
12905
|
}
|
|
12923
12906
|
includeAndGetAdditionalMergedNamespaces() {
|
|
12924
12907
|
const externalNamespaces = new Set();
|
|
12925
12908
|
const syntheticNamespaces = new Set();
|
|
12926
12909
|
for (const module of [this, ...this.exportAllModules]) {
|
|
12927
12910
|
if (module instanceof ExternalModule) {
|
|
12928
|
-
const externalVariable = module.getVariableForExportName('*');
|
|
12911
|
+
const [externalVariable] = module.getVariableForExportName('*');
|
|
12929
12912
|
externalVariable.include();
|
|
12930
12913
|
this.imports.add(externalVariable);
|
|
12931
12914
|
externalNamespaces.add(externalVariable);
|
|
@@ -14068,7 +14051,7 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14068
14051
|
let nameIndex = 0;
|
|
14069
14052
|
for (const variable of exports) {
|
|
14070
14053
|
let [exportName] = variable.name;
|
|
14071
|
-
if (exportsByName
|
|
14054
|
+
if (exportsByName.has(exportName)) {
|
|
14072
14055
|
do {
|
|
14073
14056
|
exportName = toBase64(++nameIndex);
|
|
14074
14057
|
// skip past leading number identifiers
|
|
@@ -14076,9 +14059,9 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14076
14059
|
nameIndex += 9 * 64 ** (exportName.length - 1);
|
|
14077
14060
|
exportName = toBase64(nameIndex);
|
|
14078
14061
|
}
|
|
14079
|
-
} while (RESERVED_NAMES$1.has(exportName) || exportsByName
|
|
14062
|
+
} while (RESERVED_NAMES$1.has(exportName) || exportsByName.has(exportName));
|
|
14080
14063
|
}
|
|
14081
|
-
exportsByName
|
|
14064
|
+
exportsByName.set(exportName, variable);
|
|
14082
14065
|
exportNamesByVariable.set(variable, [exportName]);
|
|
14083
14066
|
}
|
|
14084
14067
|
}
|
|
@@ -14086,10 +14069,10 @@ function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
|
|
|
14086
14069
|
for (const variable of exports) {
|
|
14087
14070
|
let nameIndex = 0;
|
|
14088
14071
|
let exportName = variable.name;
|
|
14089
|
-
while (exportsByName
|
|
14072
|
+
while (exportsByName.has(exportName)) {
|
|
14090
14073
|
exportName = variable.name + '$' + ++nameIndex;
|
|
14091
14074
|
}
|
|
14092
|
-
exportsByName
|
|
14075
|
+
exportsByName.set(exportName, variable);
|
|
14093
14076
|
exportNamesByVariable.set(variable, [exportName]);
|
|
14094
14077
|
}
|
|
14095
14078
|
}
|
|
@@ -14303,7 +14286,7 @@ class Chunk {
|
|
|
14303
14286
|
this.dynamicName = null;
|
|
14304
14287
|
this.exportNamesByVariable = new Map();
|
|
14305
14288
|
this.exports = new Set();
|
|
14306
|
-
this.exportsByName =
|
|
14289
|
+
this.exportsByName = new Map();
|
|
14307
14290
|
this.fileName = null;
|
|
14308
14291
|
this.implicitEntryModules = [];
|
|
14309
14292
|
this.implicitlyLoadedBefore = new Set();
|
|
@@ -14402,7 +14385,7 @@ class Chunk {
|
|
|
14402
14385
|
for (const [variable, exportNames] of exportNamesByVariable) {
|
|
14403
14386
|
this.exportNamesByVariable.set(variable, [...exportNames]);
|
|
14404
14387
|
for (const exportName of exportNames) {
|
|
14405
|
-
this.exportsByName
|
|
14388
|
+
this.exportsByName.set(exportName, variable);
|
|
14406
14389
|
}
|
|
14407
14390
|
remainingExports.delete(variable);
|
|
14408
14391
|
}
|
|
@@ -14563,10 +14546,12 @@ class Chunk {
|
|
|
14563
14546
|
});
|
|
14564
14547
|
}
|
|
14565
14548
|
getChunkName() {
|
|
14566
|
-
|
|
14549
|
+
var _a;
|
|
14550
|
+
return ((_a = this.name) !== null && _a !== void 0 ? _a : (this.name = this.outputOptions.sanitizeFileName(this.getFallbackChunkName())));
|
|
14567
14551
|
}
|
|
14568
14552
|
getExportNames() {
|
|
14569
|
-
|
|
14553
|
+
var _a;
|
|
14554
|
+
return ((_a = this.sortedExportNames) !== null && _a !== void 0 ? _a : (this.sortedExportNames = Array.from(this.exportsByName.keys()).sort()));
|
|
14570
14555
|
}
|
|
14571
14556
|
getRenderedHash() {
|
|
14572
14557
|
if (this.renderedHash)
|
|
@@ -14582,7 +14567,7 @@ class Chunk {
|
|
|
14582
14567
|
hash.update(this.renderedSource.toString());
|
|
14583
14568
|
hash.update(this.getExportNames()
|
|
14584
14569
|
.map(exportName => {
|
|
14585
|
-
const variable = this.exportsByName
|
|
14570
|
+
const variable = this.exportsByName.get(exportName);
|
|
14586
14571
|
return `${relativeId(variable.module.id).replace(/\\/g, '/')}:${variable.name}:${exportName}`;
|
|
14587
14572
|
})
|
|
14588
14573
|
.join(','));
|
|
@@ -14841,12 +14826,12 @@ class Chunk {
|
|
|
14841
14826
|
}
|
|
14842
14827
|
computeContentHashWithDependencies(addons, options, existingNames) {
|
|
14843
14828
|
const hash = createHash();
|
|
14844
|
-
hash.update([addons.intro, addons.outro, addons.banner, addons.footer].
|
|
14829
|
+
hash.update([addons.intro, addons.outro, addons.banner, addons.footer].join(':'));
|
|
14845
14830
|
hash.update(options.format);
|
|
14846
14831
|
const dependenciesForHashing = new Set([this]);
|
|
14847
14832
|
for (const current of dependenciesForHashing) {
|
|
14848
14833
|
if (current instanceof ExternalModule) {
|
|
14849
|
-
hash.update(
|
|
14834
|
+
hash.update(`:${current.renderPath}`);
|
|
14850
14835
|
}
|
|
14851
14836
|
else {
|
|
14852
14837
|
hash.update(current.getRenderedHash());
|
|
@@ -14953,7 +14938,7 @@ class Chunk {
|
|
|
14953
14938
|
for (const exportName of this.getExportNames()) {
|
|
14954
14939
|
if (exportName[0] === '*')
|
|
14955
14940
|
continue;
|
|
14956
|
-
const variable = this.exportsByName
|
|
14941
|
+
const variable = this.exportsByName.get(exportName);
|
|
14957
14942
|
if (!(variable instanceof SyntheticNamedExportVariable)) {
|
|
14958
14943
|
const module = variable.module;
|
|
14959
14944
|
if (module && this.chunkByModule.get(module) !== this)
|
|
@@ -15101,7 +15086,7 @@ class Chunk {
|
|
|
15101
15086
|
imported = exportName = '*';
|
|
15102
15087
|
}
|
|
15103
15088
|
else {
|
|
15104
|
-
const variable = this.exportsByName
|
|
15089
|
+
const variable = this.exportsByName.get(exportName);
|
|
15105
15090
|
if (variable instanceof SyntheticNamedExportVariable)
|
|
15106
15091
|
continue;
|
|
15107
15092
|
const module = variable.module;
|
|
@@ -15202,7 +15187,7 @@ class Chunk {
|
|
|
15202
15187
|
setIdentifierRenderResolutions({ format, interop, namespaceToStringTag }) {
|
|
15203
15188
|
const syntheticExports = new Set();
|
|
15204
15189
|
for (const exportName of this.getExportNames()) {
|
|
15205
|
-
const exportVariable = this.exportsByName
|
|
15190
|
+
const exportVariable = this.exportsByName.get(exportName);
|
|
15206
15191
|
if (format !== 'es' &&
|
|
15207
15192
|
format !== 'system' &&
|
|
15208
15193
|
exportVariable.isReassigned &&
|
|
@@ -22960,7 +22945,7 @@ class Graph {
|
|
|
22960
22945
|
for (const module of this.modules) {
|
|
22961
22946
|
for (const importDescription of Object.values(module.importDescriptions)) {
|
|
22962
22947
|
if (importDescription.name !== '*' &&
|
|
22963
|
-
!importDescription.module.getVariableForExportName(importDescription.name)) {
|
|
22948
|
+
!importDescription.module.getVariableForExportName(importDescription.name)[0]) {
|
|
22964
22949
|
module.warn({
|
|
22965
22950
|
code: 'NON_EXISTENT_EXPORT',
|
|
22966
22951
|
message: `Non-existent export '${importDescription.name}' is imported from ${relativeId(importDescription.module.id)}`,
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED