rollup 2.75.7 → 2.77.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 +57 -0
- package/README.md +1 -3
- package/dist/bin/rollup +18 -18
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +77 -59
- package/dist/es/shared/watch.js +4 -2
- package/dist/loadConfigFile.js +6 -6
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +6 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +17 -8
- package/dist/shared/mergeOptions.js +4 -2
- package/dist/shared/rollup.js +76 -58
- package/dist/shared/watch-cli.js +17 -17
- package/dist/shared/watch.js +2 -2
- package/package.json +16 -16
package/dist/es/rollup.js
CHANGED
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.77.1
|
|
4
|
+
Tue, 26 Jul 2022 08:02:21 GMT - commit 3be1609e95cf81046bb325b3e3c1cb23a7e972b7
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
8
8
|
Released under the MIT License.
|
|
9
9
|
*/
|
|
10
|
-
import require$$0, { resolve,
|
|
10
|
+
import require$$0, { resolve, basename, extname, dirname, relative as relative$1, win32, posix, isAbsolute as isAbsolute$1 } from 'path';
|
|
11
11
|
import process$1 from 'process';
|
|
12
12
|
import { performance } from 'perf_hooks';
|
|
13
13
|
import { createHash as createHash$1 } from 'crypto';
|
|
14
14
|
import { promises } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.
|
|
17
|
+
var version$1 = "2.77.1";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -8974,10 +8974,6 @@ class CallExpression extends CallExpressionBase {
|
|
|
8974
8974
|
this.callee.include(context, false);
|
|
8975
8975
|
}
|
|
8976
8976
|
this.callee.includeCallArguments(context, this.arguments);
|
|
8977
|
-
const returnExpression = this.getReturnExpression();
|
|
8978
|
-
if (!returnExpression.included) {
|
|
8979
|
-
returnExpression.include(context, false);
|
|
8980
|
-
}
|
|
8981
8977
|
}
|
|
8982
8978
|
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
8983
8979
|
this.callee.render(code, options, {
|
|
@@ -9347,15 +9343,6 @@ class MultiExpression extends ExpressionEntity {
|
|
|
9347
9343
|
}
|
|
9348
9344
|
return false;
|
|
9349
9345
|
}
|
|
9350
|
-
include(context, includeChildrenRecursively) {
|
|
9351
|
-
// This is only relevant to include values that do not have an AST representation,
|
|
9352
|
-
// such as UnknownArrayExpression. Thus we only need to include them once.
|
|
9353
|
-
for (const expression of this.expressions) {
|
|
9354
|
-
if (!expression.included) {
|
|
9355
|
-
expression.include(context, includeChildrenRecursively);
|
|
9356
|
-
}
|
|
9357
|
-
}
|
|
9358
|
-
}
|
|
9359
9346
|
}
|
|
9360
9347
|
|
|
9361
9348
|
class ConditionalExpression extends NodeBase {
|
|
@@ -13586,7 +13573,7 @@ function trimEmptyImports(dependencies) {
|
|
|
13586
13573
|
}
|
|
13587
13574
|
|
|
13588
13575
|
function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, namedExportsMode, outro, snippets, warn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
13589
|
-
const { _,
|
|
13576
|
+
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
13590
13577
|
const isNamespaced = name && name.includes('.');
|
|
13591
13578
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
13592
13579
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
@@ -13625,7 +13612,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13625
13612
|
if (hasExports) {
|
|
13626
13613
|
if (name && !(extend && namedExportsMode)) {
|
|
13627
13614
|
wrapperIntro =
|
|
13628
|
-
(useVariableAssignment ?
|
|
13615
|
+
(useVariableAssignment ? `var ${name}` : `this${keypath(name, getPropertyAccess)}`) +
|
|
13629
13616
|
`${_}=${_}${wrapperIntro}`;
|
|
13630
13617
|
}
|
|
13631
13618
|
if (isNamespaced) {
|
|
@@ -14334,7 +14321,7 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
|
|
|
14334
14321
|
|
|
14335
14322
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
14336
14323
|
if (isPathFragment(pattern))
|
|
14337
|
-
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths.`));
|
|
14324
|
+
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.`));
|
|
14338
14325
|
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
|
|
14339
14326
|
if (!replacements.hasOwnProperty(type)) {
|
|
14340
14327
|
return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
|
|
@@ -21701,37 +21688,6 @@ Parser.acorn = {
|
|
|
21701
21688
|
nonASCIIwhitespace: nonASCIIwhitespace
|
|
21702
21689
|
};
|
|
21703
21690
|
|
|
21704
|
-
class Queue {
|
|
21705
|
-
constructor(maxParallel) {
|
|
21706
|
-
this.maxParallel = maxParallel;
|
|
21707
|
-
this.queue = [];
|
|
21708
|
-
this.workerCount = 0;
|
|
21709
|
-
}
|
|
21710
|
-
run(task) {
|
|
21711
|
-
return new Promise((resolve, reject) => {
|
|
21712
|
-
this.queue.push({ reject, resolve, task });
|
|
21713
|
-
this.work();
|
|
21714
|
-
});
|
|
21715
|
-
}
|
|
21716
|
-
async work() {
|
|
21717
|
-
if (this.workerCount >= this.maxParallel)
|
|
21718
|
-
return;
|
|
21719
|
-
this.workerCount++;
|
|
21720
|
-
let entry;
|
|
21721
|
-
while ((entry = this.queue.shift())) {
|
|
21722
|
-
const { reject, resolve, task } = entry;
|
|
21723
|
-
try {
|
|
21724
|
-
const result = await task();
|
|
21725
|
-
resolve(result);
|
|
21726
|
-
}
|
|
21727
|
-
catch (err) {
|
|
21728
|
-
reject(err);
|
|
21729
|
-
}
|
|
21730
|
-
}
|
|
21731
|
-
this.workerCount--;
|
|
21732
|
-
}
|
|
21733
|
-
}
|
|
21734
|
-
|
|
21735
21691
|
function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
|
|
21736
21692
|
let skipped = null;
|
|
21737
21693
|
let replaceContext = null;
|
|
@@ -22058,7 +22014,6 @@ class ModuleLoader {
|
|
|
22058
22014
|
this.hasModuleSideEffects = options.treeshake
|
|
22059
22015
|
? options.treeshake.moduleSideEffects
|
|
22060
22016
|
: () => true;
|
|
22061
|
-
this.readQueue = new Queue(options.maxParallelFileReads);
|
|
22062
22017
|
}
|
|
22063
22018
|
async addAdditionalModules(unresolvedModules) {
|
|
22064
22019
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -22137,7 +22092,7 @@ class ModuleLoader {
|
|
|
22137
22092
|
timeStart('load modules', 3);
|
|
22138
22093
|
let source;
|
|
22139
22094
|
try {
|
|
22140
|
-
source = await this.
|
|
22095
|
+
source = await this.graph.fileOperationQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await promises.readFile(id, 'utf8')); });
|
|
22141
22096
|
}
|
|
22142
22097
|
catch (err) {
|
|
22143
22098
|
timeEnd('load modules', 3);
|
|
@@ -22794,6 +22749,37 @@ class PluginDriver {
|
|
|
22794
22749
|
}
|
|
22795
22750
|
}
|
|
22796
22751
|
|
|
22752
|
+
class Queue {
|
|
22753
|
+
constructor(maxParallel) {
|
|
22754
|
+
this.maxParallel = maxParallel;
|
|
22755
|
+
this.queue = [];
|
|
22756
|
+
this.workerCount = 0;
|
|
22757
|
+
}
|
|
22758
|
+
run(task) {
|
|
22759
|
+
return new Promise((resolve, reject) => {
|
|
22760
|
+
this.queue.push({ reject, resolve, task });
|
|
22761
|
+
this.work();
|
|
22762
|
+
});
|
|
22763
|
+
}
|
|
22764
|
+
async work() {
|
|
22765
|
+
if (this.workerCount >= this.maxParallel)
|
|
22766
|
+
return;
|
|
22767
|
+
this.workerCount++;
|
|
22768
|
+
let entry;
|
|
22769
|
+
while ((entry = this.queue.shift())) {
|
|
22770
|
+
const { reject, resolve, task } = entry;
|
|
22771
|
+
try {
|
|
22772
|
+
const result = await task();
|
|
22773
|
+
resolve(result);
|
|
22774
|
+
}
|
|
22775
|
+
catch (err) {
|
|
22776
|
+
reject(err);
|
|
22777
|
+
}
|
|
22778
|
+
}
|
|
22779
|
+
this.workerCount--;
|
|
22780
|
+
}
|
|
22781
|
+
}
|
|
22782
|
+
|
|
22797
22783
|
function normalizeEntryModules(entryModules) {
|
|
22798
22784
|
if (Array.isArray(entryModules)) {
|
|
22799
22785
|
return entryModules.map(id => ({
|
|
@@ -22857,6 +22843,7 @@ class Graph {
|
|
|
22857
22843
|
this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
|
|
22858
22844
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
22859
22845
|
this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
|
|
22846
|
+
this.fileOperationQueue = new Queue(options.maxParallelFileOps);
|
|
22860
22847
|
}
|
|
22861
22848
|
async build() {
|
|
22862
22849
|
timeStart('generate module graph', 2);
|
|
@@ -23146,6 +23133,7 @@ function normalizeInputOptions(config) {
|
|
|
23146
23133
|
const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
|
|
23147
23134
|
const onwarn = getOnwarn(config);
|
|
23148
23135
|
const strictDeprecations = config.strictDeprecations || false;
|
|
23136
|
+
const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
|
|
23149
23137
|
const options = {
|
|
23150
23138
|
acorn: getAcorn(config),
|
|
23151
23139
|
acornInjectPlugins: getAcornInjectPlugins(config),
|
|
@@ -23157,7 +23145,8 @@ function normalizeInputOptions(config) {
|
|
|
23157
23145
|
input: getInput(config),
|
|
23158
23146
|
makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
|
|
23159
23147
|
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
23160
|
-
|
|
23148
|
+
maxParallelFileOps,
|
|
23149
|
+
maxParallelFileReads: maxParallelFileOps,
|
|
23161
23150
|
moduleContext: getModuleContext(config, context),
|
|
23162
23151
|
onwarn,
|
|
23163
23152
|
perf: config.perf || false,
|
|
@@ -23238,12 +23227,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
|
23238
23227
|
}
|
|
23239
23228
|
return configManualChunks;
|
|
23240
23229
|
};
|
|
23241
|
-
const
|
|
23230
|
+
const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
|
|
23231
|
+
var _a;
|
|
23242
23232
|
const maxParallelFileReads = config.maxParallelFileReads;
|
|
23243
23233
|
if (typeof maxParallelFileReads === 'number') {
|
|
23244
|
-
|
|
23234
|
+
warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', false, warn, strictDeprecations);
|
|
23235
|
+
}
|
|
23236
|
+
const maxParallelFileOps = (_a = config.maxParallelFileOps) !== null && _a !== void 0 ? _a : maxParallelFileReads;
|
|
23237
|
+
if (typeof maxParallelFileOps === 'number') {
|
|
23238
|
+
if (maxParallelFileOps <= 0)
|
|
23245
23239
|
return Infinity;
|
|
23246
|
-
return
|
|
23240
|
+
return maxParallelFileOps;
|
|
23247
23241
|
}
|
|
23248
23242
|
return 20;
|
|
23249
23243
|
};
|
|
@@ -23330,6 +23324,16 @@ function sanitizeFileName(name) {
|
|
|
23330
23324
|
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_REGEX, '_');
|
|
23331
23325
|
}
|
|
23332
23326
|
|
|
23327
|
+
function isValidUrl(url) {
|
|
23328
|
+
try {
|
|
23329
|
+
new URL(url);
|
|
23330
|
+
}
|
|
23331
|
+
catch (_) {
|
|
23332
|
+
return false;
|
|
23333
|
+
}
|
|
23334
|
+
return true;
|
|
23335
|
+
}
|
|
23336
|
+
|
|
23333
23337
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
23334
23338
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
23335
23339
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -23383,6 +23387,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23383
23387
|
? id => id
|
|
23384
23388
|
: sanitizeFileName,
|
|
23385
23389
|
sourcemap: config.sourcemap || false,
|
|
23390
|
+
sourcemapBaseUrl: getSourcemapBaseUrl(config),
|
|
23386
23391
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
23387
23392
|
sourcemapFile: config.sourcemapFile,
|
|
23388
23393
|
sourcemapPathTransform: config.sourcemapPathTransform,
|
|
@@ -23608,6 +23613,15 @@ const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
|
23608
23613
|
}
|
|
23609
23614
|
return generatedCode.symbols || false;
|
|
23610
23615
|
};
|
|
23616
|
+
const getSourcemapBaseUrl = (config) => {
|
|
23617
|
+
const { sourcemapBaseUrl } = config;
|
|
23618
|
+
if (sourcemapBaseUrl) {
|
|
23619
|
+
if (isValidUrl(sourcemapBaseUrl)) {
|
|
23620
|
+
return sourcemapBaseUrl;
|
|
23621
|
+
}
|
|
23622
|
+
return error(errInvalidOption('output.sourcemapBaseUrl', 'outputsourcemapbaseurl', `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
|
|
23623
|
+
}
|
|
23624
|
+
};
|
|
23611
23625
|
|
|
23612
23626
|
function rollup(rawInputOptions) {
|
|
23613
23627
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -23699,7 +23713,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
|
|
|
23699
23713
|
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
23700
23714
|
});
|
|
23701
23715
|
}
|
|
23702
|
-
await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
|
|
23716
|
+
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
|
|
23703
23717
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23704
23718
|
}
|
|
23705
23719
|
return createOutput(generated);
|
|
@@ -23770,7 +23784,11 @@ async function writeOutputFile(outputFile, outputOptions) {
|
|
|
23770
23784
|
url = outputFile.map.toUrl();
|
|
23771
23785
|
}
|
|
23772
23786
|
else {
|
|
23773
|
-
|
|
23787
|
+
const { sourcemapBaseUrl } = outputOptions;
|
|
23788
|
+
const sourcemapFileName = `${basename(outputFile.fileName)}.map`;
|
|
23789
|
+
url = sourcemapBaseUrl
|
|
23790
|
+
? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
|
|
23791
|
+
: sourcemapFileName;
|
|
23774
23792
|
writeSourceMapPromise = promises.writeFile(`${fileName}.map`, outputFile.map.toString());
|
|
23775
23793
|
}
|
|
23776
23794
|
if (outputOptions.sourcemap !== 'hidden') {
|
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.77.1
|
|
4
|
+
Tue, 26 Jul 2022 08:02:21 GMT - commit 3be1609e95cf81046bb325b3e3c1cb23a7e972b7
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -80,6 +80,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
80
80
|
input: getOption('input') || [],
|
|
81
81
|
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
|
|
82
82
|
manualChunks: getOption('manualChunks'),
|
|
83
|
+
maxParallelFileOps: getOption('maxParallelFileOps'),
|
|
83
84
|
maxParallelFileReads: getOption('maxParallelFileReads'),
|
|
84
85
|
moduleContext: getOption('moduleContext'),
|
|
85
86
|
onwarn: getOnWarn(config, defaultOnWarnHandler),
|
|
@@ -162,6 +163,7 @@ function mergeOutputOptions(config, overrides, warn) {
|
|
|
162
163
|
preserveModulesRoot: getOption('preserveModulesRoot'),
|
|
163
164
|
sanitizeFileName: getOption('sanitizeFileName'),
|
|
164
165
|
sourcemap: getOption('sourcemap'),
|
|
166
|
+
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
|
|
165
167
|
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
|
|
166
168
|
sourcemapFile: getOption('sourcemapFile'),
|
|
167
169
|
sourcemapPathTransform: getOption('sourcemapPathTransform'),
|
package/dist/loadConfigFile.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.77.1
|
|
4
|
+
Tue, 26 Jul 2022 08:02:21 GMT - commit 3be1609e95cf81046bb325b3e3c1cb23a7e972b7
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
const loadConfigFile = require('./shared/loadConfigFile.js');
|
|
13
12
|
require('path');
|
|
14
13
|
require('process');
|
|
15
14
|
require('url');
|
|
15
|
+
const loadConfigFile_js = require('./shared/loadConfigFile.js');
|
|
16
16
|
require('./shared/rollup.js');
|
|
17
|
+
require('./shared/mergeOptions.js');
|
|
18
|
+
require('tty');
|
|
17
19
|
require('perf_hooks');
|
|
18
20
|
require('crypto');
|
|
19
21
|
require('fs');
|
|
20
22
|
require('events');
|
|
21
|
-
require('tty');
|
|
22
|
-
require('./shared/mergeOptions.js');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
module.exports =
|
|
26
|
+
module.exports = loadConfigFile_js.loadAndParseConfigFile;
|
|
27
27
|
//# sourceMappingURL=loadConfigFile.js.map
|