rollup 2.67.3 → 2.68.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 +17 -0
- package/dist/bin/rollup +5 -7
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +48 -49
- package/dist/es/shared/watch.js +5 -5
- 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 -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 +4 -4
- package/dist/shared/rollup.js +48 -49
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +3 -3
- package/package.json +2 -1
package/dist/rollup.d.ts
CHANGED
|
@@ -108,7 +108,6 @@ export interface TransformModuleJSON {
|
|
|
108
108
|
customTransformCache: boolean;
|
|
109
109
|
originalCode: string;
|
|
110
110
|
originalSourcemap: ExistingDecodedSourceMap | null;
|
|
111
|
-
resolvedIds?: ResolvedIdMap;
|
|
112
111
|
sourcemapChain: DecodedSourceMapOrMissing[];
|
|
113
112
|
transformDependencies: string[];
|
|
114
113
|
}
|
|
@@ -117,6 +116,7 @@ export interface ModuleJSON extends TransformModuleJSON, ModuleOptions {
|
|
|
117
116
|
ast: AcornNode;
|
|
118
117
|
dependencies: string[];
|
|
119
118
|
id: string;
|
|
119
|
+
resolvedIds: ResolvedIdMap;
|
|
120
120
|
transformFiles: EmittedFile[] | undefined;
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -254,6 +254,7 @@ export type ShouldTransformCachedModuleHook = (
|
|
|
254
254
|
id: string;
|
|
255
255
|
meta: CustomPluginOptions;
|
|
256
256
|
moduleSideEffects: boolean | 'no-treeshake';
|
|
257
|
+
resolvedSources: ResolvedIdMap;
|
|
257
258
|
syntheticNamedExports: boolean | string;
|
|
258
259
|
}
|
|
259
260
|
) => Promise<boolean> | boolean;
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.68.0
|
|
4
|
+
Tue, 22 Feb 2022 06:24:42 GMT - commit 51cab92373bcf8c844a8de2a6765869f7eb05a5d
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -53,7 +53,7 @@ function getCommandOptions(rawCommandOptions) {
|
|
|
53
53
|
? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => {
|
|
54
54
|
const [id, variableName] = globalDefinition.split(':');
|
|
55
55
|
globals[id] = variableName;
|
|
56
|
-
if (external.
|
|
56
|
+
if (!external.includes(id)) {
|
|
57
57
|
external.push(id);
|
|
58
58
|
}
|
|
59
59
|
return globals;
|
|
@@ -93,7 +93,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
93
93
|
const getExternal = (config, overrides) => {
|
|
94
94
|
const configExternal = config.external;
|
|
95
95
|
return typeof configExternal === 'function'
|
|
96
|
-
? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.
|
|
96
|
+
? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.includes(source)
|
|
97
97
|
: rollup.ensureArray(configExternal).concat(overrides.external);
|
|
98
98
|
};
|
|
99
99
|
const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
|
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.68.0
|
|
4
|
+
Tue, 22 Feb 2022 06:24:42 GMT - commit 51cab92373bcf8c844a8de2a6765869f7eb05a5d
|
|
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.
|
|
31
|
+
var version$1 = "2.68.0";
|
|
32
32
|
|
|
33
33
|
function ensureArray$1(items) {
|
|
34
34
|
if (Array.isArray(items)) {
|
|
@@ -127,18 +127,17 @@ function printQuotedStringList(list, verbs) {
|
|
|
127
127
|
return output;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
const
|
|
131
|
-
const
|
|
130
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
|
|
131
|
+
const RELATIVE_PATH_REGEX = /^\.?\.\//;
|
|
132
132
|
function isAbsolute(path) {
|
|
133
|
-
return
|
|
133
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
134
134
|
}
|
|
135
135
|
function isRelative(path) {
|
|
136
|
-
return
|
|
136
|
+
return RELATIVE_PATH_REGEX.test(path);
|
|
137
137
|
}
|
|
138
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
138
139
|
function normalize(path) {
|
|
139
|
-
|
|
140
|
-
return path;
|
|
141
|
-
return path.replace(/\\/g, '/');
|
|
140
|
+
return path.replace(BACKSLASH_REGEX, '/');
|
|
142
141
|
}
|
|
143
142
|
|
|
144
143
|
function getAliasName(id) {
|
|
@@ -2050,9 +2049,10 @@ Bundle$1.prototype.trimEnd = function trimEnd (charType) {
|
|
|
2050
2049
|
|
|
2051
2050
|
const MagicString$1 = MagicString;
|
|
2052
2051
|
|
|
2052
|
+
const ANY_SLASH_REGEX = /[/\\]/;
|
|
2053
2053
|
function relative(from, to) {
|
|
2054
|
-
const fromParts = from.split(
|
|
2055
|
-
const toParts = to.split(
|
|
2054
|
+
const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
2055
|
+
const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
2056
2056
|
if (fromParts[0] === '.')
|
|
2057
2057
|
fromParts.shift();
|
|
2058
2058
|
if (toParts[0] === '.')
|
|
@@ -2326,14 +2326,14 @@ class ExternalModule {
|
|
|
2326
2326
|
this.options = options;
|
|
2327
2327
|
this.id = id;
|
|
2328
2328
|
this.renormalizeRenderPath = renormalizeRenderPath;
|
|
2329
|
-
this.declarations =
|
|
2329
|
+
this.declarations = new Map();
|
|
2330
2330
|
this.defaultVariableName = '';
|
|
2331
2331
|
this.dynamicImporters = [];
|
|
2332
2332
|
this.execIndex = Infinity;
|
|
2333
2333
|
this.exportedVariables = new Map();
|
|
2334
2334
|
this.importers = [];
|
|
2335
2335
|
this.mostCommonSuggestion = 0;
|
|
2336
|
-
this.nameSuggestions =
|
|
2336
|
+
this.nameSuggestions = new Map();
|
|
2337
2337
|
this.namespaceVariableName = '';
|
|
2338
2338
|
this.reexported = false;
|
|
2339
2339
|
this.renderPath = undefined;
|
|
@@ -2375,12 +2375,13 @@ class ExternalModule {
|
|
|
2375
2375
|
});
|
|
2376
2376
|
}
|
|
2377
2377
|
getVariableForExportName(name) {
|
|
2378
|
-
|
|
2378
|
+
const declaration = this.declarations.get(name);
|
|
2379
2379
|
if (declaration)
|
|
2380
2380
|
return [declaration];
|
|
2381
|
-
|
|
2382
|
-
this.
|
|
2383
|
-
|
|
2381
|
+
const externalVariable = new ExternalVariable(this, name);
|
|
2382
|
+
this.declarations.set(name, externalVariable);
|
|
2383
|
+
this.exportedVariables.set(externalVariable, name);
|
|
2384
|
+
return [externalVariable];
|
|
2384
2385
|
}
|
|
2385
2386
|
setRenderPath(options, inputBase) {
|
|
2386
2387
|
this.renderPath =
|
|
@@ -2393,27 +2394,23 @@ class ExternalModule {
|
|
|
2393
2394
|
return this.renderPath;
|
|
2394
2395
|
}
|
|
2395
2396
|
suggestName(name) {
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
this.nameSuggestions
|
|
2399
|
-
if (
|
|
2400
|
-
this.mostCommonSuggestion =
|
|
2397
|
+
var _a;
|
|
2398
|
+
const value = ((_a = this.nameSuggestions.get(name)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
2399
|
+
this.nameSuggestions.set(name, value);
|
|
2400
|
+
if (value > this.mostCommonSuggestion) {
|
|
2401
|
+
this.mostCommonSuggestion = value;
|
|
2401
2402
|
this.suggestedVariableName = name;
|
|
2402
2403
|
}
|
|
2403
2404
|
}
|
|
2404
2405
|
warnUnusedImports() {
|
|
2405
|
-
const unused =
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
const declaration = this.declarations[name];
|
|
2409
|
-
return !declaration.included && !this.reexported && !declaration.referenced;
|
|
2410
|
-
});
|
|
2406
|
+
const unused = Array.from(this.declarations)
|
|
2407
|
+
.filter(([name, declaration]) => name !== '*' && !declaration.included && !this.reexported && !declaration.referenced)
|
|
2408
|
+
.map(([name]) => name);
|
|
2411
2409
|
if (unused.length === 0)
|
|
2412
2410
|
return;
|
|
2413
2411
|
const importersSet = new Set();
|
|
2414
2412
|
for (const name of unused) {
|
|
2415
|
-
const
|
|
2416
|
-
for (const importer of importers) {
|
|
2413
|
+
for (const importer of this.declarations.get(name).module.importers) {
|
|
2417
2414
|
importersSet.add(importer);
|
|
2418
2415
|
}
|
|
2419
2416
|
}
|
|
@@ -12346,7 +12343,7 @@ class Module {
|
|
|
12346
12343
|
this.exportNamesByVariable = null;
|
|
12347
12344
|
this.exportShimVariable = new ExportShimVariable(this);
|
|
12348
12345
|
this.exports = new Map();
|
|
12349
|
-
this.namespaceReexportsByName =
|
|
12346
|
+
this.namespaceReexportsByName = new Map();
|
|
12350
12347
|
this.reexportDescriptions = new Map();
|
|
12351
12348
|
this.relevantDependencies = null;
|
|
12352
12349
|
this.syntheticExports = new Map();
|
|
@@ -12368,6 +12365,8 @@ class Module {
|
|
|
12368
12365
|
.filter(Boolean);
|
|
12369
12366
|
},
|
|
12370
12367
|
get dynamicallyImportedIds() {
|
|
12368
|
+
// We cannot use this.dynamicDependencies because this is needed before
|
|
12369
|
+
// dynamicDependencies are populated
|
|
12371
12370
|
const dynamicallyImportedIds = [];
|
|
12372
12371
|
for (const { id } of dynamicImports) {
|
|
12373
12372
|
if (id) {
|
|
@@ -12401,6 +12400,8 @@ class Module {
|
|
|
12401
12400
|
return Array.from(sources, source => module.resolvedIds[source]).filter(Boolean);
|
|
12402
12401
|
},
|
|
12403
12402
|
get importedIds() {
|
|
12403
|
+
// We cannot use this.dependencies because this is needed before
|
|
12404
|
+
// dependencies are populated
|
|
12404
12405
|
return Array.from(sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
12405
12406
|
},
|
|
12406
12407
|
get importers() {
|
|
@@ -12460,7 +12461,7 @@ class Module {
|
|
|
12460
12461
|
getDependenciesToBeIncluded() {
|
|
12461
12462
|
if (this.relevantDependencies)
|
|
12462
12463
|
return this.relevantDependencies;
|
|
12463
|
-
|
|
12464
|
+
this.relevantDependencies = new Set();
|
|
12464
12465
|
const necessaryDependencies = new Set();
|
|
12465
12466
|
const alwaysCheckedDependencies = new Set();
|
|
12466
12467
|
const dependencyVariables = new Set(this.imports);
|
|
@@ -12492,16 +12493,16 @@ class Module {
|
|
|
12492
12493
|
}
|
|
12493
12494
|
if (!this.options.treeshake || this.info.moduleSideEffects === 'no-treeshake') {
|
|
12494
12495
|
for (const dependency of this.dependencies) {
|
|
12495
|
-
relevantDependencies.add(dependency);
|
|
12496
|
+
this.relevantDependencies.add(dependency);
|
|
12496
12497
|
}
|
|
12497
12498
|
}
|
|
12498
12499
|
else {
|
|
12499
|
-
this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
|
|
12500
|
+
this.addRelevantSideEffectDependencies(this.relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
|
|
12500
12501
|
}
|
|
12501
12502
|
for (const dependency of necessaryDependencies) {
|
|
12502
|
-
relevantDependencies.add(dependency);
|
|
12503
|
+
this.relevantDependencies.add(dependency);
|
|
12503
12504
|
}
|
|
12504
|
-
return
|
|
12505
|
+
return this.relevantDependencies;
|
|
12505
12506
|
}
|
|
12506
12507
|
getExportNamesByVariable() {
|
|
12507
12508
|
if (this.exportNamesByVariable) {
|
|
@@ -12573,16 +12574,15 @@ class Module {
|
|
|
12573
12574
|
return this.syntheticNamespace;
|
|
12574
12575
|
}
|
|
12575
12576
|
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
12577
|
+
var _a;
|
|
12576
12578
|
if (name[0] === '*') {
|
|
12577
12579
|
if (name.length === 1) {
|
|
12578
12580
|
// export * from './other'
|
|
12579
12581
|
return [this.namespace];
|
|
12580
12582
|
}
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
return module.getVariableForExportName('*');
|
|
12585
|
-
}
|
|
12583
|
+
// export * from 'external'
|
|
12584
|
+
const module = this.graph.modulesById.get(name.slice(1));
|
|
12585
|
+
return module.getVariableForExportName('*');
|
|
12586
12586
|
}
|
|
12587
12587
|
// export { foo } from './other'
|
|
12588
12588
|
const reexportDeclaration = this.reexportDescriptions.get(name);
|
|
@@ -12613,10 +12613,8 @@ class Module {
|
|
|
12613
12613
|
return [null];
|
|
12614
12614
|
}
|
|
12615
12615
|
if (name !== 'default') {
|
|
12616
|
-
const foundNamespaceReexport = name
|
|
12617
|
-
|
|
12618
|
-
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules);
|
|
12619
|
-
this.namespaceReexportsByName[name] = foundNamespaceReexport;
|
|
12616
|
+
const foundNamespaceReexport = (_a = this.namespaceReexportsByName.get(name)) !== null && _a !== void 0 ? _a : this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules);
|
|
12617
|
+
this.namespaceReexportsByName.set(name, foundNamespaceReexport);
|
|
12620
12618
|
if (foundNamespaceReexport[0]) {
|
|
12621
12619
|
return foundNamespaceReexport;
|
|
12622
12620
|
}
|
|
@@ -13593,7 +13591,7 @@ function trimEmptyImports(dependencies) {
|
|
|
13593
13591
|
|
|
13594
13592
|
function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, namedExportsMode, outro, snippets, warn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
13595
13593
|
const { _, cnst, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
13596
|
-
const isNamespaced = name && name.
|
|
13594
|
+
const isNamespaced = name && name.includes('.');
|
|
13597
13595
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
13598
13596
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
13599
13597
|
return error({
|
|
@@ -14224,7 +14222,7 @@ function getExportMode(chunk, { exports: exportMode, name, format }, unsetOption
|
|
|
14224
14222
|
exportMode = 'default';
|
|
14225
14223
|
}
|
|
14226
14224
|
else {
|
|
14227
|
-
if (format !== 'es' && format !== 'system' && exportKeys.
|
|
14225
|
+
if (format !== 'es' && format !== 'system' && exportKeys.includes('default')) {
|
|
14228
14226
|
warn(errMixedExport(facadeModuleId, name));
|
|
14229
14227
|
}
|
|
14230
14228
|
exportMode = 'named';
|
|
@@ -14742,7 +14740,7 @@ class Chunk {
|
|
|
14742
14740
|
const source = module.render(renderOptions).trim();
|
|
14743
14741
|
renderedLength = source.length();
|
|
14744
14742
|
if (renderedLength) {
|
|
14745
|
-
if (options.compact && source.lastLine().
|
|
14743
|
+
if (options.compact && source.lastLine().includes('//'))
|
|
14746
14744
|
source.append('\n');
|
|
14747
14745
|
this.renderedModuleSources.set(module, source);
|
|
14748
14746
|
magicString.addSource(source);
|
|
@@ -22178,6 +22176,7 @@ class ModuleLoader {
|
|
|
22178
22176
|
id: cachedModule.id,
|
|
22179
22177
|
meta: cachedModule.meta,
|
|
22180
22178
|
moduleSideEffects: cachedModule.moduleSideEffects,
|
|
22179
|
+
resolvedSources: cachedModule.resolvedIds,
|
|
22181
22180
|
syntheticNamedExports: cachedModule.syntheticNamedExports
|
|
22182
22181
|
}
|
|
22183
22182
|
]))) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.68.0
|
|
4
|
+
Tue, 22 Feb 2022 06:24:42 GMT - commit 51cab92373bcf8c844a8de2a6765869f7eb05a5d
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -201,7 +201,7 @@ class Task {
|
|
|
201
201
|
this.invalidated = true;
|
|
202
202
|
if (details.isTransformDependency) {
|
|
203
203
|
for (const module of this.cache.modules) {
|
|
204
|
-
if (module.transformDependencies.
|
|
204
|
+
if (!module.transformDependencies.includes(id))
|
|
205
205
|
continue;
|
|
206
206
|
// effective invalidation
|
|
207
207
|
module.originalCode = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.68.0",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
},
|
|
132
132
|
"exports": {
|
|
133
133
|
".": {
|
|
134
|
+
"types": "./dist/rollup.d.ts",
|
|
134
135
|
"node": {
|
|
135
136
|
"require": "./dist/rollup.js",
|
|
136
137
|
"import": "./dist/es/rollup.js"
|