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/es/rollup.js
CHANGED
package/dist/es/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
|
|
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
15
15
|
import { promises } from 'fs';
|
|
16
16
|
import { EventEmitter } from 'events';
|
|
17
17
|
|
|
18
|
-
var version$1 = "2.
|
|
18
|
+
var version$1 = "2.68.0";
|
|
19
19
|
|
|
20
20
|
var charToInteger = {};
|
|
21
21
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1444,9 +1444,10 @@ Bundle$1.prototype.trimEnd = function trimEnd (charType) {
|
|
|
1444
1444
|
|
|
1445
1445
|
const MagicString$1 = MagicString;
|
|
1446
1446
|
|
|
1447
|
+
const ANY_SLASH_REGEX = /[/\\]/;
|
|
1447
1448
|
function relative(from, to) {
|
|
1448
|
-
const fromParts = from.split(
|
|
1449
|
-
const toParts = to.split(
|
|
1449
|
+
const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
1450
|
+
const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
1450
1451
|
if (fromParts[0] === '.')
|
|
1451
1452
|
fromParts.shift();
|
|
1452
1453
|
if (toParts[0] === '.')
|
|
@@ -1734,18 +1735,17 @@ function printQuotedStringList(list, verbs) {
|
|
|
1734
1735
|
return output;
|
|
1735
1736
|
}
|
|
1736
1737
|
|
|
1737
|
-
const
|
|
1738
|
-
const
|
|
1738
|
+
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
|
|
1739
|
+
const RELATIVE_PATH_REGEX = /^\.?\.\//;
|
|
1739
1740
|
function isAbsolute(path) {
|
|
1740
|
-
return
|
|
1741
|
+
return ABSOLUTE_PATH_REGEX.test(path);
|
|
1741
1742
|
}
|
|
1742
1743
|
function isRelative(path) {
|
|
1743
|
-
return
|
|
1744
|
+
return RELATIVE_PATH_REGEX.test(path);
|
|
1744
1745
|
}
|
|
1746
|
+
const BACKSLASH_REGEX = /\\/g;
|
|
1745
1747
|
function normalize(path) {
|
|
1746
|
-
|
|
1747
|
-
return path;
|
|
1748
|
-
return path.replace(/\\/g, '/');
|
|
1748
|
+
return path.replace(BACKSLASH_REGEX, '/');
|
|
1749
1749
|
}
|
|
1750
1750
|
|
|
1751
1751
|
function getAliasName(id) {
|
|
@@ -2181,14 +2181,14 @@ class ExternalModule {
|
|
|
2181
2181
|
this.options = options;
|
|
2182
2182
|
this.id = id;
|
|
2183
2183
|
this.renormalizeRenderPath = renormalizeRenderPath;
|
|
2184
|
-
this.declarations =
|
|
2184
|
+
this.declarations = new Map();
|
|
2185
2185
|
this.defaultVariableName = '';
|
|
2186
2186
|
this.dynamicImporters = [];
|
|
2187
2187
|
this.execIndex = Infinity;
|
|
2188
2188
|
this.exportedVariables = new Map();
|
|
2189
2189
|
this.importers = [];
|
|
2190
2190
|
this.mostCommonSuggestion = 0;
|
|
2191
|
-
this.nameSuggestions =
|
|
2191
|
+
this.nameSuggestions = new Map();
|
|
2192
2192
|
this.namespaceVariableName = '';
|
|
2193
2193
|
this.reexported = false;
|
|
2194
2194
|
this.renderPath = undefined;
|
|
@@ -2230,12 +2230,13 @@ class ExternalModule {
|
|
|
2230
2230
|
});
|
|
2231
2231
|
}
|
|
2232
2232
|
getVariableForExportName(name) {
|
|
2233
|
-
|
|
2233
|
+
const declaration = this.declarations.get(name);
|
|
2234
2234
|
if (declaration)
|
|
2235
2235
|
return [declaration];
|
|
2236
|
-
|
|
2237
|
-
this.
|
|
2238
|
-
|
|
2236
|
+
const externalVariable = new ExternalVariable(this, name);
|
|
2237
|
+
this.declarations.set(name, externalVariable);
|
|
2238
|
+
this.exportedVariables.set(externalVariable, name);
|
|
2239
|
+
return [externalVariable];
|
|
2239
2240
|
}
|
|
2240
2241
|
setRenderPath(options, inputBase) {
|
|
2241
2242
|
this.renderPath =
|
|
@@ -2248,27 +2249,23 @@ class ExternalModule {
|
|
|
2248
2249
|
return this.renderPath;
|
|
2249
2250
|
}
|
|
2250
2251
|
suggestName(name) {
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
this.nameSuggestions
|
|
2254
|
-
if (
|
|
2255
|
-
this.mostCommonSuggestion =
|
|
2252
|
+
var _a;
|
|
2253
|
+
const value = ((_a = this.nameSuggestions.get(name)) !== null && _a !== void 0 ? _a : 0) + 1;
|
|
2254
|
+
this.nameSuggestions.set(name, value);
|
|
2255
|
+
if (value > this.mostCommonSuggestion) {
|
|
2256
|
+
this.mostCommonSuggestion = value;
|
|
2256
2257
|
this.suggestedVariableName = name;
|
|
2257
2258
|
}
|
|
2258
2259
|
}
|
|
2259
2260
|
warnUnusedImports() {
|
|
2260
|
-
const unused =
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
const declaration = this.declarations[name];
|
|
2264
|
-
return !declaration.included && !this.reexported && !declaration.referenced;
|
|
2265
|
-
});
|
|
2261
|
+
const unused = Array.from(this.declarations)
|
|
2262
|
+
.filter(([name, declaration]) => name !== '*' && !declaration.included && !this.reexported && !declaration.referenced)
|
|
2263
|
+
.map(([name]) => name);
|
|
2266
2264
|
if (unused.length === 0)
|
|
2267
2265
|
return;
|
|
2268
2266
|
const importersSet = new Set();
|
|
2269
2267
|
for (const name of unused) {
|
|
2270
|
-
const
|
|
2271
|
-
for (const importer of importers) {
|
|
2268
|
+
for (const importer of this.declarations.get(name).module.importers) {
|
|
2272
2269
|
importersSet.add(importer);
|
|
2273
2270
|
}
|
|
2274
2271
|
}
|
|
@@ -12216,7 +12213,7 @@ class Module {
|
|
|
12216
12213
|
this.exportNamesByVariable = null;
|
|
12217
12214
|
this.exportShimVariable = new ExportShimVariable(this);
|
|
12218
12215
|
this.exports = new Map();
|
|
12219
|
-
this.namespaceReexportsByName =
|
|
12216
|
+
this.namespaceReexportsByName = new Map();
|
|
12220
12217
|
this.reexportDescriptions = new Map();
|
|
12221
12218
|
this.relevantDependencies = null;
|
|
12222
12219
|
this.syntheticExports = new Map();
|
|
@@ -12238,6 +12235,8 @@ class Module {
|
|
|
12238
12235
|
.filter(Boolean);
|
|
12239
12236
|
},
|
|
12240
12237
|
get dynamicallyImportedIds() {
|
|
12238
|
+
// We cannot use this.dynamicDependencies because this is needed before
|
|
12239
|
+
// dynamicDependencies are populated
|
|
12241
12240
|
const dynamicallyImportedIds = [];
|
|
12242
12241
|
for (const { id } of dynamicImports) {
|
|
12243
12242
|
if (id) {
|
|
@@ -12271,6 +12270,8 @@ class Module {
|
|
|
12271
12270
|
return Array.from(sources, source => module.resolvedIds[source]).filter(Boolean);
|
|
12272
12271
|
},
|
|
12273
12272
|
get importedIds() {
|
|
12273
|
+
// We cannot use this.dependencies because this is needed before
|
|
12274
|
+
// dependencies are populated
|
|
12274
12275
|
return Array.from(sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
12275
12276
|
},
|
|
12276
12277
|
get importers() {
|
|
@@ -12330,7 +12331,7 @@ class Module {
|
|
|
12330
12331
|
getDependenciesToBeIncluded() {
|
|
12331
12332
|
if (this.relevantDependencies)
|
|
12332
12333
|
return this.relevantDependencies;
|
|
12333
|
-
|
|
12334
|
+
this.relevantDependencies = new Set();
|
|
12334
12335
|
const necessaryDependencies = new Set();
|
|
12335
12336
|
const alwaysCheckedDependencies = new Set();
|
|
12336
12337
|
const dependencyVariables = new Set(this.imports);
|
|
@@ -12362,16 +12363,16 @@ class Module {
|
|
|
12362
12363
|
}
|
|
12363
12364
|
if (!this.options.treeshake || this.info.moduleSideEffects === 'no-treeshake') {
|
|
12364
12365
|
for (const dependency of this.dependencies) {
|
|
12365
|
-
relevantDependencies.add(dependency);
|
|
12366
|
+
this.relevantDependencies.add(dependency);
|
|
12366
12367
|
}
|
|
12367
12368
|
}
|
|
12368
12369
|
else {
|
|
12369
|
-
this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
|
|
12370
|
+
this.addRelevantSideEffectDependencies(this.relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
|
|
12370
12371
|
}
|
|
12371
12372
|
for (const dependency of necessaryDependencies) {
|
|
12372
|
-
relevantDependencies.add(dependency);
|
|
12373
|
+
this.relevantDependencies.add(dependency);
|
|
12373
12374
|
}
|
|
12374
|
-
return
|
|
12375
|
+
return this.relevantDependencies;
|
|
12375
12376
|
}
|
|
12376
12377
|
getExportNamesByVariable() {
|
|
12377
12378
|
if (this.exportNamesByVariable) {
|
|
@@ -12443,16 +12444,15 @@ class Module {
|
|
|
12443
12444
|
return this.syntheticNamespace;
|
|
12444
12445
|
}
|
|
12445
12446
|
getVariableForExportName(name, { importerForSideEffects, isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
12447
|
+
var _a;
|
|
12446
12448
|
if (name[0] === '*') {
|
|
12447
12449
|
if (name.length === 1) {
|
|
12448
12450
|
// export * from './other'
|
|
12449
12451
|
return [this.namespace];
|
|
12450
12452
|
}
|
|
12451
|
-
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
return module.getVariableForExportName('*');
|
|
12455
|
-
}
|
|
12453
|
+
// export * from 'external'
|
|
12454
|
+
const module = this.graph.modulesById.get(name.slice(1));
|
|
12455
|
+
return module.getVariableForExportName('*');
|
|
12456
12456
|
}
|
|
12457
12457
|
// export { foo } from './other'
|
|
12458
12458
|
const reexportDeclaration = this.reexportDescriptions.get(name);
|
|
@@ -12483,10 +12483,8 @@ class Module {
|
|
|
12483
12483
|
return [null];
|
|
12484
12484
|
}
|
|
12485
12485
|
if (name !== 'default') {
|
|
12486
|
-
const foundNamespaceReexport = name
|
|
12487
|
-
|
|
12488
|
-
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules);
|
|
12489
|
-
this.namespaceReexportsByName[name] = foundNamespaceReexport;
|
|
12486
|
+
const foundNamespaceReexport = (_a = this.namespaceReexportsByName.get(name)) !== null && _a !== void 0 ? _a : this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules);
|
|
12487
|
+
this.namespaceReexportsByName.set(name, foundNamespaceReexport);
|
|
12490
12488
|
if (foundNamespaceReexport[0]) {
|
|
12491
12489
|
return foundNamespaceReexport;
|
|
12492
12490
|
}
|
|
@@ -13463,7 +13461,7 @@ function trimEmptyImports(dependencies) {
|
|
|
13463
13461
|
|
|
13464
13462
|
function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, namedExportsMode, outro, snippets, warn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
13465
13463
|
const { _, cnst, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
13466
|
-
const isNamespaced = name && name.
|
|
13464
|
+
const isNamespaced = name && name.includes('.');
|
|
13467
13465
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
13468
13466
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
13469
13467
|
return error({
|
|
@@ -14094,7 +14092,7 @@ function getExportMode(chunk, { exports: exportMode, name, format }, unsetOption
|
|
|
14094
14092
|
exportMode = 'default';
|
|
14095
14093
|
}
|
|
14096
14094
|
else {
|
|
14097
|
-
if (format !== 'es' && format !== 'system' && exportKeys.
|
|
14095
|
+
if (format !== 'es' && format !== 'system' && exportKeys.includes('default')) {
|
|
14098
14096
|
warn(errMixedExport(facadeModuleId, name));
|
|
14099
14097
|
}
|
|
14100
14098
|
exportMode = 'named';
|
|
@@ -14612,7 +14610,7 @@ class Chunk {
|
|
|
14612
14610
|
const source = module.render(renderOptions).trim();
|
|
14613
14611
|
renderedLength = source.length();
|
|
14614
14612
|
if (renderedLength) {
|
|
14615
|
-
if (options.compact && source.lastLine().
|
|
14613
|
+
if (options.compact && source.lastLine().includes('//'))
|
|
14616
14614
|
source.append('\n');
|
|
14617
14615
|
this.renderedModuleSources.set(module, source);
|
|
14618
14616
|
magicString.addSource(source);
|
|
@@ -22048,6 +22046,7 @@ class ModuleLoader {
|
|
|
22048
22046
|
id: cachedModule.id,
|
|
22049
22047
|
meta: cachedModule.meta,
|
|
22050
22048
|
moduleSideEffects: cachedModule.moduleSideEffects,
|
|
22049
|
+
resolvedSources: cachedModule.resolvedIds,
|
|
22051
22050
|
syntheticNamedExports: cachedModule.syntheticNamedExports
|
|
22052
22051
|
}
|
|
22053
22052
|
]))) {
|
package/dist/es/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
|
|
@@ -60,7 +60,7 @@ function getCommandOptions(rawCommandOptions) {
|
|
|
60
60
|
? rawCommandOptions.globals.split(',').reduce((globals, globalDefinition) => {
|
|
61
61
|
const [id, variableName] = globalDefinition.split(':');
|
|
62
62
|
globals[id] = variableName;
|
|
63
|
-
if (external.
|
|
63
|
+
if (!external.includes(id)) {
|
|
64
64
|
external.push(id);
|
|
65
65
|
}
|
|
66
66
|
return globals;
|
|
@@ -100,7 +100,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
100
100
|
const getExternal = (config, overrides) => {
|
|
101
101
|
const configExternal = config.external;
|
|
102
102
|
return typeof configExternal === 'function'
|
|
103
|
-
? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.
|
|
103
|
+
? (source, importer, isResolved) => configExternal(source, importer, isResolved) || overrides.external.includes(source)
|
|
104
104
|
: ensureArray(configExternal).concat(overrides.external);
|
|
105
105
|
};
|
|
106
106
|
const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
|
|
@@ -4897,7 +4897,7 @@ class Task {
|
|
|
4897
4897
|
this.invalidated = true;
|
|
4898
4898
|
if (details.isTransformDependency) {
|
|
4899
4899
|
for (const module of this.cache.modules) {
|
|
4900
|
-
if (module.transformDependencies.
|
|
4900
|
+
if (!module.transformDependencies.includes(id))
|
|
4901
4901
|
continue;
|
|
4902
4902
|
// effective invalidation
|
|
4903
4903
|
module.originalCode = null;
|
package/dist/loadConfigFile.js
CHANGED