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/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/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
|
|
@@ -28,7 +28,7 @@ function _interopNamespaceDefault(e) {
|
|
|
28
28
|
return n;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var version$1 = "2.66.
|
|
31
|
+
var version$1 = "2.66.1";
|
|
32
32
|
|
|
33
33
|
function ensureArray$1(items) {
|
|
34
34
|
if (Array.isArray(items)) {
|
|
@@ -381,22 +381,22 @@ function errMixedExport(facadeModuleId, name) {
|
|
|
381
381
|
url: `https://rollupjs.org/guide/en/#outputexports`
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
function errNamespaceConflict(name,
|
|
384
|
+
function errNamespaceConflict(name, reexportingModuleId, sources) {
|
|
385
385
|
return {
|
|
386
386
|
code: Errors.NAMESPACE_CONFLICT,
|
|
387
|
-
message: `Conflicting namespaces: "${relativeId(
|
|
387
|
+
message: `Conflicting namespaces: "${relativeId(reexportingModuleId)}" re-exports "${name}" from one of the modules ${printQuotedStringList(sources.map(moduleId => relativeId(moduleId)))} (will be ignored)`,
|
|
388
388
|
name,
|
|
389
|
-
reexporter:
|
|
390
|
-
sources
|
|
389
|
+
reexporter: reexportingModuleId,
|
|
390
|
+
sources
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
|
-
function errAmbiguousExternalNamespaces(name, reexportingModule,
|
|
393
|
+
function errAmbiguousExternalNamespaces(name, reexportingModule, usedModule, sources) {
|
|
394
394
|
return {
|
|
395
395
|
code: Errors.AMBIGUOUS_EXTERNAL_NAMESPACES,
|
|
396
|
-
message: `Ambiguous external namespace resolution: "${relativeId(reexportingModule)}" re-exports "${name}" from one of the external modules ${printQuotedStringList(
|
|
396
|
+
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)}".`,
|
|
397
397
|
name,
|
|
398
398
|
reexporter: reexportingModule,
|
|
399
|
-
sources
|
|
399
|
+
sources
|
|
400
400
|
};
|
|
401
401
|
}
|
|
402
402
|
function errNoTransformMapOrAstWithoutCode(pluginName) {
|
|
@@ -420,7 +420,7 @@ function errSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExportsOp
|
|
|
420
420
|
code: Errors.SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT,
|
|
421
421
|
id,
|
|
422
422
|
message: `Module "${relativeId(id)}" that is marked with 'syntheticNamedExports: ${JSON.stringify(syntheticNamedExportsOption)}' needs ${typeof syntheticNamedExportsOption === 'string' && syntheticNamedExportsOption !== 'default'
|
|
423
|
-
? `an export named "${syntheticNamedExportsOption}"`
|
|
423
|
+
? `an explicit export named "${syntheticNamedExportsOption}"`
|
|
424
424
|
: 'a default export'} that does not reexport an unresolved named export of the same module.`
|
|
425
425
|
};
|
|
426
426
|
}
|
|
@@ -2369,10 +2369,10 @@ class ExternalModule {
|
|
|
2369
2369
|
getVariableForExportName(name) {
|
|
2370
2370
|
let declaration = this.declarations[name];
|
|
2371
2371
|
if (declaration)
|
|
2372
|
-
return declaration;
|
|
2372
|
+
return [declaration];
|
|
2373
2373
|
this.declarations[name] = declaration = new ExternalVariable(this, name);
|
|
2374
2374
|
this.exportedVariables.set(declaration, name);
|
|
2375
|
-
return declaration;
|
|
2375
|
+
return [declaration];
|
|
2376
2376
|
}
|
|
2377
2377
|
setRenderPath(options, inputBase) {
|
|
2378
2378
|
this.renderPath =
|
|
@@ -12267,11 +12267,11 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
12267
12267
|
identifier: null,
|
|
12268
12268
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
12269
12269
|
};
|
|
12270
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()
|
|
12270
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map()) {
|
|
12271
12271
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
12272
12272
|
if (searchedModules) {
|
|
12273
12273
|
if (searchedModules.has(target)) {
|
|
12274
|
-
return isExportAllSearch ? null : error(errCircularReexport(name, target.id));
|
|
12274
|
+
return isExportAllSearch ? [null] : error(errCircularReexport(name, target.id));
|
|
12275
12275
|
}
|
|
12276
12276
|
searchedModules.add(target);
|
|
12277
12277
|
}
|
|
@@ -12281,8 +12281,7 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
12281
12281
|
return target.getVariableForExportName(name, {
|
|
12282
12282
|
importerForSideEffects,
|
|
12283
12283
|
isExportAllSearch,
|
|
12284
|
-
searchedNamesAndModules
|
|
12285
|
-
skipExternalNamespaceReexports
|
|
12284
|
+
searchedNamesAndModules
|
|
12286
12285
|
});
|
|
12287
12286
|
}
|
|
12288
12287
|
function getAndExtendSideEffectModules(variable, module) {
|
|
@@ -12328,7 +12327,6 @@ class Module {
|
|
|
12328
12327
|
this.execIndex = Infinity;
|
|
12329
12328
|
this.exportAllSources = new Set();
|
|
12330
12329
|
this.exports = Object.create(null);
|
|
12331
|
-
this.exportsAll = Object.create(null);
|
|
12332
12330
|
this.implicitlyLoadedAfter = new Set();
|
|
12333
12331
|
this.implicitlyLoadedBefore = new Set();
|
|
12334
12332
|
this.importDescriptions = Object.create(null);
|
|
@@ -12449,6 +12447,11 @@ class Module {
|
|
|
12449
12447
|
allExportNames.add(name);
|
|
12450
12448
|
}
|
|
12451
12449
|
}
|
|
12450
|
+
// We do not count the synthetic namespace as a regular export to hide it
|
|
12451
|
+
// from entry signatures and namespace objects
|
|
12452
|
+
if (typeof this.info.syntheticNamedExports === 'string') {
|
|
12453
|
+
allExportNames.delete(this.info.syntheticNamedExports);
|
|
12454
|
+
}
|
|
12452
12455
|
return allExportNames;
|
|
12453
12456
|
}
|
|
12454
12457
|
getDependenciesToBeIncluded() {
|
|
@@ -12463,7 +12466,7 @@ class Module {
|
|
|
12463
12466
|
this.namespace.included ||
|
|
12464
12467
|
this.implicitlyLoadedAfter.size > 0) {
|
|
12465
12468
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
12466
|
-
const exportedVariable = this.getVariableForExportName(exportName);
|
|
12469
|
+
const [exportedVariable] = this.getVariableForExportName(exportName);
|
|
12467
12470
|
if (exportedVariable) {
|
|
12468
12471
|
dependencyVariables.add(exportedVariable);
|
|
12469
12472
|
}
|
|
@@ -12503,9 +12506,7 @@ class Module {
|
|
|
12503
12506
|
}
|
|
12504
12507
|
const exportNamesByVariable = new Map();
|
|
12505
12508
|
for (const exportName of this.getAllExportNames()) {
|
|
12506
|
-
|
|
12507
|
-
continue;
|
|
12508
|
-
let tracedVariable = this.getVariableForExportName(exportName);
|
|
12509
|
+
let [tracedVariable] = this.getVariableForExportName(exportName);
|
|
12509
12510
|
if (tracedVariable instanceof ExportDefaultVariable) {
|
|
12510
12511
|
tracedVariable = tracedVariable.getOriginalVariable();
|
|
12511
12512
|
}
|
|
@@ -12554,7 +12555,7 @@ class Module {
|
|
|
12554
12555
|
const renderedExports = [];
|
|
12555
12556
|
const removedExports = [];
|
|
12556
12557
|
for (const exportName in this.exports) {
|
|
12557
|
-
const variable = this.getVariableForExportName(exportName);
|
|
12558
|
+
const [variable] = this.getVariableForExportName(exportName);
|
|
12558
12559
|
(variable && variable.included ? renderedExports : removedExports).push(exportName);
|
|
12559
12560
|
}
|
|
12560
12561
|
return { removedExports, renderedExports };
|
|
@@ -12562,20 +12563,20 @@ class Module {
|
|
|
12562
12563
|
getSyntheticNamespace() {
|
|
12563
12564
|
if (this.syntheticNamespace === null) {
|
|
12564
12565
|
this.syntheticNamespace = undefined;
|
|
12565
|
-
this.syntheticNamespace = this.getVariableForExportName(typeof this.info.syntheticNamedExports === 'string'
|
|
12566
|
+
[this.syntheticNamespace] = this.getVariableForExportName(typeof this.info.syntheticNamedExports === 'string'
|
|
12566
12567
|
? this.info.syntheticNamedExports
|
|
12567
|
-
: 'default');
|
|
12568
|
+
: 'default', { onlyExplicit: true });
|
|
12568
12569
|
}
|
|
12569
12570
|
if (!this.syntheticNamespace) {
|
|
12570
12571
|
return error(errSyntheticNamedExportsNeedNamespaceExport(this.id, this.info.syntheticNamedExports));
|
|
12571
12572
|
}
|
|
12572
12573
|
return this.syntheticNamespace;
|
|
12573
12574
|
}
|
|
12574
|
-
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch,
|
|
12575
|
+
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
12575
12576
|
if (name[0] === '*') {
|
|
12576
12577
|
if (name.length === 1) {
|
|
12577
12578
|
// export * from './other'
|
|
12578
|
-
return this.namespace;
|
|
12579
|
+
return [this.namespace];
|
|
12579
12580
|
}
|
|
12580
12581
|
else {
|
|
12581
12582
|
// export * from 'external'
|
|
@@ -12586,19 +12587,19 @@ class Module {
|
|
|
12586
12587
|
// export { foo } from './other'
|
|
12587
12588
|
const reexportDeclaration = this.reexportDescriptions[name];
|
|
12588
12589
|
if (reexportDeclaration) {
|
|
12589
|
-
const variable = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules
|
|
12590
|
+
const [variable] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules);
|
|
12590
12591
|
if (!variable) {
|
|
12591
12592
|
return this.error(errMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id), reexportDeclaration.start);
|
|
12592
12593
|
}
|
|
12593
12594
|
if (importerForSideEffects) {
|
|
12594
12595
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
12595
12596
|
}
|
|
12596
|
-
return variable;
|
|
12597
|
+
return [variable];
|
|
12597
12598
|
}
|
|
12598
12599
|
const exportDeclaration = this.exports[name];
|
|
12599
12600
|
if (exportDeclaration) {
|
|
12600
12601
|
if (exportDeclaration === MISSING_EXPORT_SHIM_DESCRIPTION) {
|
|
12601
|
-
return this.exportShimVariable;
|
|
12602
|
+
return [this.exportShimVariable];
|
|
12602
12603
|
}
|
|
12603
12604
|
const name = exportDeclaration.localName;
|
|
12604
12605
|
const variable = this.traceVariable(name, importerForSideEffects);
|
|
@@ -12606,38 +12607,34 @@ class Module {
|
|
|
12606
12607
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, () => new Set()).add(this);
|
|
12607
12608
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
12608
12609
|
}
|
|
12609
|
-
return variable;
|
|
12610
|
+
return [variable];
|
|
12611
|
+
}
|
|
12612
|
+
if (onlyExplicit) {
|
|
12613
|
+
return [null];
|
|
12610
12614
|
}
|
|
12611
12615
|
if (name !== 'default') {
|
|
12612
12616
|
const foundNamespaceReexport = name in this.namespaceReexportsByName
|
|
12613
12617
|
? this.namespaceReexportsByName[name]
|
|
12614
|
-
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
}
|
|
12618
|
-
if (foundNamespaceReexport) {
|
|
12618
|
+
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules);
|
|
12619
|
+
this.namespaceReexportsByName[name] = foundNamespaceReexport;
|
|
12620
|
+
if (foundNamespaceReexport[0]) {
|
|
12619
12621
|
return foundNamespaceReexport;
|
|
12620
12622
|
}
|
|
12621
12623
|
}
|
|
12622
12624
|
if (this.info.syntheticNamedExports) {
|
|
12623
|
-
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
syntheticExport = new SyntheticNamedExportVariable(this.astContext, name, syntheticNamespace);
|
|
12627
|
-
this.syntheticExports.set(name, syntheticExport);
|
|
12628
|
-
return syntheticExport;
|
|
12629
|
-
}
|
|
12630
|
-
return syntheticExport;
|
|
12625
|
+
return [
|
|
12626
|
+
getOrCreate(this.syntheticExports, name, () => new SyntheticNamedExportVariable(this.astContext, name, this.getSyntheticNamespace()))
|
|
12627
|
+
];
|
|
12631
12628
|
}
|
|
12632
12629
|
// we don't want to create shims when we are just
|
|
12633
12630
|
// probing export * modules for exports
|
|
12634
12631
|
if (!isExportAllSearch) {
|
|
12635
12632
|
if (this.options.shimMissingExports) {
|
|
12636
12633
|
this.shimMissingExport(name);
|
|
12637
|
-
return this.exportShimVariable;
|
|
12634
|
+
return [this.exportShimVariable];
|
|
12638
12635
|
}
|
|
12639
12636
|
}
|
|
12640
|
-
return null;
|
|
12637
|
+
return [null];
|
|
12641
12638
|
}
|
|
12642
12639
|
hasEffects() {
|
|
12643
12640
|
return (this.info.hasModuleSideEffects === 'no-treeshake' ||
|
|
@@ -12655,7 +12652,7 @@ class Module {
|
|
|
12655
12652
|
}
|
|
12656
12653
|
for (const exportName of this.getExports()) {
|
|
12657
12654
|
if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
|
|
12658
|
-
const variable = this.getVariableForExportName(exportName);
|
|
12655
|
+
const variable = this.getVariableForExportName(exportName)[0];
|
|
12659
12656
|
variable.deoptimizePath(UNKNOWN_PATH);
|
|
12660
12657
|
if (!variable.included) {
|
|
12661
12658
|
this.includeVariable(variable);
|
|
@@ -12663,7 +12660,7 @@ class Module {
|
|
|
12663
12660
|
}
|
|
12664
12661
|
}
|
|
12665
12662
|
for (const name of this.getReexports()) {
|
|
12666
|
-
const variable = this.getVariableForExportName(name);
|
|
12663
|
+
const [variable] = this.getVariableForExportName(name);
|
|
12667
12664
|
if (variable) {
|
|
12668
12665
|
variable.deoptimizePath(UNKNOWN_PATH);
|
|
12669
12666
|
if (!variable.included) {
|
|
@@ -12688,11 +12685,6 @@ class Module {
|
|
|
12688
12685
|
linkImports() {
|
|
12689
12686
|
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
12690
12687
|
this.addModulesToImportDescriptions(this.reexportDescriptions);
|
|
12691
|
-
for (const name in this.exports) {
|
|
12692
|
-
if (name !== 'default' && name !== this.info.syntheticNamedExports) {
|
|
12693
|
-
this.exportsAll[name] = this.id;
|
|
12694
|
-
}
|
|
12695
|
-
}
|
|
12696
12688
|
const externalExportAllModules = [];
|
|
12697
12689
|
for (const source of this.exportAllSources) {
|
|
12698
12690
|
const module = this.graph.modulesById.get(this.resolvedIds[source].id);
|
|
@@ -12701,14 +12693,6 @@ class Module {
|
|
|
12701
12693
|
continue;
|
|
12702
12694
|
}
|
|
12703
12695
|
this.exportAllModules.push(module);
|
|
12704
|
-
for (const name in module.exportsAll) {
|
|
12705
|
-
if (name in this.exportsAll) {
|
|
12706
|
-
this.options.onwarn(errNamespaceConflict(name, this, module));
|
|
12707
|
-
}
|
|
12708
|
-
else {
|
|
12709
|
-
this.exportsAll[name] = module.exportsAll[name];
|
|
12710
|
-
}
|
|
12711
|
-
}
|
|
12712
12696
|
}
|
|
12713
12697
|
this.exportAllModules.push(...externalExportAllModules);
|
|
12714
12698
|
}
|
|
@@ -12766,7 +12750,7 @@ class Module {
|
|
|
12766
12750
|
moduleContext: this.context,
|
|
12767
12751
|
options: this.options,
|
|
12768
12752
|
requestTreeshakingPass: () => (this.graph.needsTreeshakingPass = true),
|
|
12769
|
-
traceExport: this.getVariableForExportName
|
|
12753
|
+
traceExport: (name) => this.getVariableForExportName(name)[0],
|
|
12770
12754
|
traceVariable: this.traceVariable.bind(this),
|
|
12771
12755
|
usesTopLevelAwait: false,
|
|
12772
12756
|
warn: this.warn.bind(this)
|
|
@@ -12806,7 +12790,7 @@ class Module {
|
|
|
12806
12790
|
if (otherModule instanceof Module && importDeclaration.name === '*') {
|
|
12807
12791
|
return otherModule.namespace;
|
|
12808
12792
|
}
|
|
12809
|
-
const declaration = otherModule.getVariableForExportName(importDeclaration.name, {
|
|
12793
|
+
const [declaration] = otherModule.getVariableForExportName(importDeclaration.name, {
|
|
12810
12794
|
importerForSideEffects: importerForSideEffects || this
|
|
12811
12795
|
});
|
|
12812
12796
|
if (!declaration) {
|
|
@@ -13004,58 +12988,57 @@ class Module {
|
|
|
13004
12988
|
addSideEffectDependencies(this.dependencies);
|
|
13005
12989
|
addSideEffectDependencies(alwaysCheckedDependencies);
|
|
13006
12990
|
}
|
|
13007
|
-
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules
|
|
12991
|
+
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules) {
|
|
13008
12992
|
let foundSyntheticDeclaration = null;
|
|
13009
|
-
const
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
skipExternalNamespaceValues.push({
|
|
13016
|
-
searchedNamesAndModules: clonedSearchedNamesAndModules,
|
|
13017
|
-
skipExternalNamespaces: false
|
|
13018
|
-
});
|
|
13019
|
-
}
|
|
13020
|
-
for (const { skipExternalNamespaces, searchedNamesAndModules } of skipExternalNamespaceValues) {
|
|
13021
|
-
const foundDeclarations = new Set();
|
|
13022
|
-
for (const module of this.exportAllModules) {
|
|
13023
|
-
if (module instanceof Module || !skipExternalNamespaces) {
|
|
13024
|
-
const declaration = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules, skipExternalNamespaces);
|
|
13025
|
-
if (declaration) {
|
|
13026
|
-
if (!(declaration instanceof SyntheticNamedExportVariable)) {
|
|
13027
|
-
foundDeclarations.add(declaration);
|
|
13028
|
-
}
|
|
13029
|
-
else if (!foundSyntheticDeclaration) {
|
|
13030
|
-
foundSyntheticDeclaration = declaration;
|
|
13031
|
-
}
|
|
13032
|
-
}
|
|
13033
|
-
}
|
|
12993
|
+
const foundInternalDeclarations = new Map();
|
|
12994
|
+
const foundExternalDeclarations = new Set();
|
|
12995
|
+
for (const module of this.exportAllModules) {
|
|
12996
|
+
// Synthetic namespaces should not hide "regular" exports of the same name
|
|
12997
|
+
if (module.info.syntheticNamedExports === name) {
|
|
12998
|
+
continue;
|
|
13034
12999
|
}
|
|
13035
|
-
|
|
13036
|
-
|
|
13000
|
+
const [variable, indirectExternal] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true, searchedNamesAndModules);
|
|
13001
|
+
if (module instanceof ExternalModule || indirectExternal) {
|
|
13002
|
+
foundExternalDeclarations.add(variable);
|
|
13037
13003
|
}
|
|
13038
|
-
if (
|
|
13039
|
-
if (
|
|
13040
|
-
|
|
13004
|
+
else if (variable instanceof SyntheticNamedExportVariable) {
|
|
13005
|
+
if (!foundSyntheticDeclaration) {
|
|
13006
|
+
foundSyntheticDeclaration = variable;
|
|
13041
13007
|
}
|
|
13042
|
-
|
|
13043
|
-
|
|
13008
|
+
}
|
|
13009
|
+
else if (variable) {
|
|
13010
|
+
foundInternalDeclarations.set(variable, module);
|
|
13011
|
+
}
|
|
13012
|
+
}
|
|
13013
|
+
if (foundInternalDeclarations.size > 0) {
|
|
13014
|
+
const foundDeclarationList = [...foundInternalDeclarations];
|
|
13015
|
+
const usedDeclaration = foundDeclarationList[0][0];
|
|
13016
|
+
if (foundDeclarationList.length === 1) {
|
|
13017
|
+
return [usedDeclaration];
|
|
13018
|
+
}
|
|
13019
|
+
this.options.onwarn(errNamespaceConflict(name, this.id, foundDeclarationList.map(([, module]) => module.id)));
|
|
13020
|
+
// TODO we are pretending it was not found while it should behave like "undefined"
|
|
13021
|
+
return [null];
|
|
13022
|
+
}
|
|
13023
|
+
if (foundExternalDeclarations.size > 0) {
|
|
13024
|
+
const foundDeclarationList = [...foundExternalDeclarations];
|
|
13025
|
+
const usedDeclaration = foundDeclarationList[0];
|
|
13026
|
+
if (foundDeclarationList.length > 1) {
|
|
13044
13027
|
this.options.onwarn(errAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
13045
|
-
return usedDeclaration;
|
|
13046
13028
|
}
|
|
13029
|
+
return [usedDeclaration, true];
|
|
13047
13030
|
}
|
|
13048
13031
|
if (foundSyntheticDeclaration) {
|
|
13049
|
-
return foundSyntheticDeclaration;
|
|
13032
|
+
return [foundSyntheticDeclaration];
|
|
13050
13033
|
}
|
|
13051
|
-
return null;
|
|
13034
|
+
return [null];
|
|
13052
13035
|
}
|
|
13053
13036
|
includeAndGetAdditionalMergedNamespaces() {
|
|
13054
13037
|
const externalNamespaces = new Set();
|
|
13055
13038
|
const syntheticNamespaces = new Set();
|
|
13056
13039
|
for (const module of [this, ...this.exportAllModules]) {
|
|
13057
13040
|
if (module instanceof ExternalModule) {
|
|
13058
|
-
const externalVariable = module.getVariableForExportName('*');
|
|
13041
|
+
const [externalVariable] = module.getVariableForExportName('*');
|
|
13059
13042
|
externalVariable.include();
|
|
13060
13043
|
this.imports.add(externalVariable);
|
|
13061
13044
|
externalNamespaces.add(externalVariable);
|
|
@@ -14198,7 +14181,7 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14198
14181
|
let nameIndex = 0;
|
|
14199
14182
|
for (const variable of exports) {
|
|
14200
14183
|
let [exportName] = variable.name;
|
|
14201
|
-
if (exportsByName
|
|
14184
|
+
if (exportsByName.has(exportName)) {
|
|
14202
14185
|
do {
|
|
14203
14186
|
exportName = toBase64(++nameIndex);
|
|
14204
14187
|
// skip past leading number identifiers
|
|
@@ -14206,9 +14189,9 @@ function assignExportsToMangledNames(exports, exportsByName, exportNamesByVariab
|
|
|
14206
14189
|
nameIndex += 9 * 64 ** (exportName.length - 1);
|
|
14207
14190
|
exportName = toBase64(nameIndex);
|
|
14208
14191
|
}
|
|
14209
|
-
} while (RESERVED_NAMES$1.has(exportName) || exportsByName
|
|
14192
|
+
} while (RESERVED_NAMES$1.has(exportName) || exportsByName.has(exportName));
|
|
14210
14193
|
}
|
|
14211
|
-
exportsByName
|
|
14194
|
+
exportsByName.set(exportName, variable);
|
|
14212
14195
|
exportNamesByVariable.set(variable, [exportName]);
|
|
14213
14196
|
}
|
|
14214
14197
|
}
|
|
@@ -14216,10 +14199,10 @@ function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
|
|
|
14216
14199
|
for (const variable of exports) {
|
|
14217
14200
|
let nameIndex = 0;
|
|
14218
14201
|
let exportName = variable.name;
|
|
14219
|
-
while (exportsByName
|
|
14202
|
+
while (exportsByName.has(exportName)) {
|
|
14220
14203
|
exportName = variable.name + '$' + ++nameIndex;
|
|
14221
14204
|
}
|
|
14222
|
-
exportsByName
|
|
14205
|
+
exportsByName.set(exportName, variable);
|
|
14223
14206
|
exportNamesByVariable.set(variable, [exportName]);
|
|
14224
14207
|
}
|
|
14225
14208
|
}
|
|
@@ -14433,7 +14416,7 @@ class Chunk {
|
|
|
14433
14416
|
this.dynamicName = null;
|
|
14434
14417
|
this.exportNamesByVariable = new Map();
|
|
14435
14418
|
this.exports = new Set();
|
|
14436
|
-
this.exportsByName =
|
|
14419
|
+
this.exportsByName = new Map();
|
|
14437
14420
|
this.fileName = null;
|
|
14438
14421
|
this.implicitEntryModules = [];
|
|
14439
14422
|
this.implicitlyLoadedBefore = new Set();
|
|
@@ -14532,7 +14515,7 @@ class Chunk {
|
|
|
14532
14515
|
for (const [variable, exportNames] of exportNamesByVariable) {
|
|
14533
14516
|
this.exportNamesByVariable.set(variable, [...exportNames]);
|
|
14534
14517
|
for (const exportName of exportNames) {
|
|
14535
|
-
this.exportsByName
|
|
14518
|
+
this.exportsByName.set(exportName, variable);
|
|
14536
14519
|
}
|
|
14537
14520
|
remainingExports.delete(variable);
|
|
14538
14521
|
}
|
|
@@ -14693,10 +14676,12 @@ class Chunk {
|
|
|
14693
14676
|
});
|
|
14694
14677
|
}
|
|
14695
14678
|
getChunkName() {
|
|
14696
|
-
|
|
14679
|
+
var _a;
|
|
14680
|
+
return ((_a = this.name) !== null && _a !== void 0 ? _a : (this.name = this.outputOptions.sanitizeFileName(this.getFallbackChunkName())));
|
|
14697
14681
|
}
|
|
14698
14682
|
getExportNames() {
|
|
14699
|
-
|
|
14683
|
+
var _a;
|
|
14684
|
+
return ((_a = this.sortedExportNames) !== null && _a !== void 0 ? _a : (this.sortedExportNames = Array.from(this.exportsByName.keys()).sort()));
|
|
14700
14685
|
}
|
|
14701
14686
|
getRenderedHash() {
|
|
14702
14687
|
if (this.renderedHash)
|
|
@@ -14712,7 +14697,7 @@ class Chunk {
|
|
|
14712
14697
|
hash.update(this.renderedSource.toString());
|
|
14713
14698
|
hash.update(this.getExportNames()
|
|
14714
14699
|
.map(exportName => {
|
|
14715
|
-
const variable = this.exportsByName
|
|
14700
|
+
const variable = this.exportsByName.get(exportName);
|
|
14716
14701
|
return `${relativeId(variable.module.id).replace(/\\/g, '/')}:${variable.name}:${exportName}`;
|
|
14717
14702
|
})
|
|
14718
14703
|
.join(','));
|
|
@@ -14971,12 +14956,12 @@ class Chunk {
|
|
|
14971
14956
|
}
|
|
14972
14957
|
computeContentHashWithDependencies(addons, options, existingNames) {
|
|
14973
14958
|
const hash = createHash();
|
|
14974
|
-
hash.update([addons.intro, addons.outro, addons.banner, addons.footer].
|
|
14959
|
+
hash.update([addons.intro, addons.outro, addons.banner, addons.footer].join(':'));
|
|
14975
14960
|
hash.update(options.format);
|
|
14976
14961
|
const dependenciesForHashing = new Set([this]);
|
|
14977
14962
|
for (const current of dependenciesForHashing) {
|
|
14978
14963
|
if (current instanceof ExternalModule) {
|
|
14979
|
-
hash.update(
|
|
14964
|
+
hash.update(`:${current.renderPath}`);
|
|
14980
14965
|
}
|
|
14981
14966
|
else {
|
|
14982
14967
|
hash.update(current.getRenderedHash());
|
|
@@ -15083,7 +15068,7 @@ class Chunk {
|
|
|
15083
15068
|
for (const exportName of this.getExportNames()) {
|
|
15084
15069
|
if (exportName[0] === '*')
|
|
15085
15070
|
continue;
|
|
15086
|
-
const variable = this.exportsByName
|
|
15071
|
+
const variable = this.exportsByName.get(exportName);
|
|
15087
15072
|
if (!(variable instanceof SyntheticNamedExportVariable)) {
|
|
15088
15073
|
const module = variable.module;
|
|
15089
15074
|
if (module && this.chunkByModule.get(module) !== this)
|
|
@@ -15231,7 +15216,7 @@ class Chunk {
|
|
|
15231
15216
|
imported = exportName = '*';
|
|
15232
15217
|
}
|
|
15233
15218
|
else {
|
|
15234
|
-
const variable = this.exportsByName
|
|
15219
|
+
const variable = this.exportsByName.get(exportName);
|
|
15235
15220
|
if (variable instanceof SyntheticNamedExportVariable)
|
|
15236
15221
|
continue;
|
|
15237
15222
|
const module = variable.module;
|
|
@@ -15332,7 +15317,7 @@ class Chunk {
|
|
|
15332
15317
|
setIdentifierRenderResolutions({ format, interop, namespaceToStringTag }) {
|
|
15333
15318
|
const syntheticExports = new Set();
|
|
15334
15319
|
for (const exportName of this.getExportNames()) {
|
|
15335
|
-
const exportVariable = this.exportsByName
|
|
15320
|
+
const exportVariable = this.exportsByName.get(exportName);
|
|
15336
15321
|
if (format !== 'es' &&
|
|
15337
15322
|
format !== 'system' &&
|
|
15338
15323
|
exportVariable.isReassigned &&
|
|
@@ -23090,7 +23075,7 @@ class Graph {
|
|
|
23090
23075
|
for (const module of this.modules) {
|
|
23091
23076
|
for (const importDescription of Object.values(module.importDescriptions)) {
|
|
23092
23077
|
if (importDescription.name !== '*' &&
|
|
23093
|
-
!importDescription.module.getVariableForExportName(importDescription.name)) {
|
|
23078
|
+
!importDescription.module.getVariableForExportName(importDescription.name)[0]) {
|
|
23094
23079
|
module.warn({
|
|
23095
23080
|
code: 'NON_EXISTENT_EXPORT',
|
|
23096
23081
|
message: `Non-existent export '${importDescription.name}' is imported from ${relativeId(importDescription.module.id)}`,
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED