rollup 2.59.0 → 2.60.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 +16 -0
- package/dist/bin/rollup +5 -5
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +65 -28
- 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.d.ts +1 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +26 -15
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +65 -28
- 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.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.60.0
|
|
4
|
+
Fri, 12 Nov 2021 05:12:41 GMT - commit 8d98341bf746d4baa57bbd730b1fa6449555cfca
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -13,7 +13,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
13
13
|
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
14
14
|
import { EventEmitter } from 'events';
|
|
15
15
|
|
|
16
|
-
var version$1 = "2.
|
|
16
|
+
var version$1 = "2.60.0";
|
|
17
17
|
|
|
18
18
|
var charToInteger = {};
|
|
19
19
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -12227,7 +12227,7 @@ class Module {
|
|
|
12227
12227
|
return Array.from(module.implicitlyLoadedBefore, getId);
|
|
12228
12228
|
},
|
|
12229
12229
|
get importedIds() {
|
|
12230
|
-
return Array.from(module.sources, source => module.resolvedIds[source].id);
|
|
12230
|
+
return Array.from(module.sources, source => { var _a; return (_a = module.resolvedIds[source]) === null || _a === void 0 ? void 0 : _a.id; }).filter(Boolean);
|
|
12231
12231
|
},
|
|
12232
12232
|
get importers() {
|
|
12233
12233
|
return module.importers.sort();
|
|
@@ -21890,6 +21890,7 @@ class ModuleLoader {
|
|
|
21890
21890
|
this.implicitEntryModules = new Set();
|
|
21891
21891
|
this.indexedEntryModules = [];
|
|
21892
21892
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
21893
|
+
this.moduleLoadPromises = new Map();
|
|
21893
21894
|
this.nextEntryModuleIndex = 0;
|
|
21894
21895
|
this.readQueue = new Queue();
|
|
21895
21896
|
this.resolveId = async (source, importer, customOptions, isEntry, skip = null) => {
|
|
@@ -21951,6 +21952,9 @@ class ModuleLoader {
|
|
|
21951
21952
|
}
|
|
21952
21953
|
return module;
|
|
21953
21954
|
}
|
|
21955
|
+
preloadModule(resolvedId) {
|
|
21956
|
+
return this.fetchModule(this.addDefaultsToResolvedId(resolvedId), undefined, false, true).then(module => module.info);
|
|
21957
|
+
}
|
|
21954
21958
|
addDefaultsToResolvedId(resolvedId) {
|
|
21955
21959
|
var _a, _b;
|
|
21956
21960
|
if (!resolvedId) {
|
|
@@ -22051,39 +22055,45 @@ class ModuleLoader {
|
|
|
22051
22055
|
}
|
|
22052
22056
|
}
|
|
22053
22057
|
}
|
|
22054
|
-
|
|
22058
|
+
// If this is a preload, then this method always waits for the dependencies of the module to be resolved.
|
|
22059
|
+
// Otherwise if the module does not exist, it waits for the module and all its dependencies to be loaded.
|
|
22060
|
+
// Otherwise it returns immediately.
|
|
22061
|
+
async fetchModule({ id, meta, moduleSideEffects, syntheticNamedExports }, importer, isEntry, isPreload) {
|
|
22055
22062
|
const existingModule = this.modulesById.get(id);
|
|
22056
22063
|
if (existingModule instanceof Module) {
|
|
22057
|
-
|
|
22058
|
-
existingModule.info.isEntry = true;
|
|
22059
|
-
this.implicitEntryModules.delete(existingModule);
|
|
22060
|
-
for (const dependant of existingModule.implicitlyLoadedAfter) {
|
|
22061
|
-
dependant.implicitlyLoadedBefore.delete(existingModule);
|
|
22062
|
-
}
|
|
22063
|
-
existingModule.implicitlyLoadedAfter.clear();
|
|
22064
|
-
}
|
|
22064
|
+
await this.handleExistingModule(existingModule, isEntry, isPreload);
|
|
22065
22065
|
return existingModule;
|
|
22066
22066
|
}
|
|
22067
22067
|
const module = new Module(this.graph, id, this.options, isEntry, moduleSideEffects, syntheticNamedExports, meta);
|
|
22068
22068
|
this.modulesById.set(id, module);
|
|
22069
22069
|
this.graph.watchFiles[id] = true;
|
|
22070
|
-
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
...resolveDynamicImportPromises
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
/* rejections thrown here are also handled within PluginDriver - they are safe to ignore */
|
|
22070
|
+
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
22071
|
+
this.getResolveStaticDependencyPromises(module),
|
|
22072
|
+
this.getResolveDynamicImportPromises(module)
|
|
22073
|
+
]);
|
|
22074
|
+
const loadAndResolveDependenciesPromise = loadPromise
|
|
22075
|
+
.then(([resolveStaticDependencyPromises, resolveDynamicImportPromises]) => Promise.all([...resolveStaticDependencyPromises, ...resolveDynamicImportPromises]))
|
|
22076
|
+
.then(() => this.pluginDriver.hookParallel('moduleParsed', [module.info]));
|
|
22077
|
+
loadAndResolveDependenciesPromise.catch(() => {
|
|
22078
|
+
/* avoid unhandled promise rejections */
|
|
22080
22079
|
});
|
|
22080
|
+
if (isPreload) {
|
|
22081
|
+
this.moduleLoadPromises.set(module, loadPromise);
|
|
22082
|
+
await loadPromise;
|
|
22083
|
+
}
|
|
22084
|
+
else {
|
|
22085
|
+
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22086
|
+
// To handle errors when resolving dependencies or in moduleParsed
|
|
22087
|
+
await loadAndResolveDependenciesPromise;
|
|
22088
|
+
}
|
|
22089
|
+
return module;
|
|
22090
|
+
}
|
|
22091
|
+
async fetchModuleDependencies(module, resolveStaticDependencyPromises, resolveDynamicDependencyPromises) {
|
|
22081
22092
|
await Promise.all([
|
|
22082
22093
|
this.fetchStaticDependencies(module, resolveStaticDependencyPromises),
|
|
22083
|
-
this.fetchDynamicDependencies(module,
|
|
22094
|
+
this.fetchDynamicDependencies(module, resolveDynamicDependencyPromises)
|
|
22084
22095
|
]);
|
|
22085
22096
|
module.linkImports();
|
|
22086
|
-
return module;
|
|
22087
22097
|
}
|
|
22088
22098
|
fetchResolvedDependency(source, importer, resolvedId) {
|
|
22089
22099
|
if (resolvedId.external) {
|
|
@@ -22098,7 +22108,7 @@ class ModuleLoader {
|
|
|
22098
22108
|
return Promise.resolve(externalModule);
|
|
22099
22109
|
}
|
|
22100
22110
|
else {
|
|
22101
|
-
return this.fetchModule(resolvedId, importer, false);
|
|
22111
|
+
return this.fetchModule(resolvedId, importer, false, false);
|
|
22102
22112
|
}
|
|
22103
22113
|
}
|
|
22104
22114
|
async fetchStaticDependencies(module, resolveStaticDependencyPromises) {
|
|
@@ -22169,6 +22179,26 @@ class ModuleLoader {
|
|
|
22169
22179
|
this.handleResolveId(await this.resolveId(source, module.id, EMPTY_OBJECT, false), source, module.id))
|
|
22170
22180
|
]);
|
|
22171
22181
|
}
|
|
22182
|
+
async handleExistingModule(module, isEntry, isPreload) {
|
|
22183
|
+
const loadPromise = this.moduleLoadPromises.get(module);
|
|
22184
|
+
if (isPreload) {
|
|
22185
|
+
await loadPromise;
|
|
22186
|
+
return;
|
|
22187
|
+
}
|
|
22188
|
+
if (isEntry) {
|
|
22189
|
+
module.info.isEntry = true;
|
|
22190
|
+
this.implicitEntryModules.delete(module);
|
|
22191
|
+
for (const dependant of module.implicitlyLoadedAfter) {
|
|
22192
|
+
dependant.implicitlyLoadedBefore.delete(module);
|
|
22193
|
+
}
|
|
22194
|
+
module.implicitlyLoadedAfter.clear();
|
|
22195
|
+
}
|
|
22196
|
+
if (loadPromise) {
|
|
22197
|
+
this.moduleLoadPromises.delete(module);
|
|
22198
|
+
await this.fetchModuleDependencies(module, ...(await loadPromise));
|
|
22199
|
+
}
|
|
22200
|
+
return;
|
|
22201
|
+
}
|
|
22172
22202
|
handleResolveId(resolvedId, source, importer) {
|
|
22173
22203
|
if (resolvedId === null) {
|
|
22174
22204
|
if (isRelative(source)) {
|
|
@@ -22205,7 +22235,7 @@ class ModuleLoader {
|
|
|
22205
22235
|
}
|
|
22206
22236
|
return this.fetchModule(this.addDefaultsToResolvedId(typeof resolveIdResult === 'object'
|
|
22207
22237
|
? resolveIdResult
|
|
22208
|
-
: { id: resolveIdResult }), undefined, isEntry);
|
|
22238
|
+
: { id: resolveIdResult }), undefined, isEntry, false);
|
|
22209
22239
|
}
|
|
22210
22240
|
async resolveDynamicImport(module, specifier, importer) {
|
|
22211
22241
|
const resolution = await this.pluginDriver.hookFirst('resolveDynamicImport', [
|
|
@@ -22333,12 +22363,16 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
22333
22363
|
getModuleInfo: graph.getModuleInfo,
|
|
22334
22364
|
getWatchFiles: () => Object.keys(graph.watchFiles),
|
|
22335
22365
|
isExternal: getDeprecatedContextHandler((id, parentId, isResolved = false) => options.external(id, parentId, isResolved), 'isExternal', 'resolve', plugin.name, true, options),
|
|
22366
|
+
load(resolvedId) {
|
|
22367
|
+
return graph.moduleLoader.preloadModule(resolvedId);
|
|
22368
|
+
},
|
|
22336
22369
|
meta: {
|
|
22337
22370
|
rollupVersion: version$1,
|
|
22338
22371
|
watchMode: graph.watchMode
|
|
22339
22372
|
},
|
|
22340
22373
|
get moduleIds() {
|
|
22341
22374
|
function* wrappedModuleIds() {
|
|
22375
|
+
// We are wrapping this in a generator to only show the message once we are actually iterating
|
|
22342
22376
|
warnDeprecation({
|
|
22343
22377
|
message: `Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`,
|
|
22344
22378
|
plugin: plugin.name
|
|
@@ -23050,12 +23084,15 @@ const getHasModuleSideEffects = (moduleSideEffectsOption, pureExternalModules) =
|
|
|
23050
23084
|
return (id, external) => !(external && isPureExternalModule(id));
|
|
23051
23085
|
};
|
|
23052
23086
|
|
|
23087
|
+
// https://datatracker.ietf.org/doc/html/rfc2396
|
|
23088
|
+
// eslint-disable-next-line no-control-regex
|
|
23089
|
+
const INVALID_CHAR_RE = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
23053
23090
|
function sanitizeFileName(name) {
|
|
23054
23091
|
const match = /^[a-z]:/i.exec(name);
|
|
23055
23092
|
const driveLetter = match ? match[0] : '';
|
|
23056
23093
|
// A `:` is only allowed as part of a windows drive letter (ex: C:\foo)
|
|
23057
23094
|
// Otherwise, avoid them because they can refer to NTFS alternate data streams.
|
|
23058
|
-
return driveLetter + name.substr(driveLetter.length).replace(
|
|
23095
|
+
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_RE, '_');
|
|
23059
23096
|
}
|
|
23060
23097
|
|
|
23061
23098
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
package/dist/es/shared/watch.js
CHANGED
package/dist/loadConfigFile.js
CHANGED