rollup 2.75.6 → 2.77.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 +58 -0
- 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 +81 -61
- 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 +20 -12
- package/dist/shared/mergeOptions.js +4 -2
- package/dist/shared/rollup.js +80 -60
- package/dist/shared/watch-cli.js +17 -17
- package/dist/shared/watch.js +2 -2
- package/package.json +19 -19
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.0
|
|
4
|
+
Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
|
|
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.0";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -5967,8 +5967,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
5967
5967
|
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
5968
5968
|
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
5969
5969
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
5970
|
-
|
|
5971
|
-
|
|
5970
|
+
group: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
5971
|
+
groupToMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
5972
5972
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
5973
5973
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
5974
5974
|
join: METHOD_RETURNS_STRING,
|
|
@@ -8424,8 +8424,9 @@ class BinaryExpression extends NodeBase {
|
|
|
8424
8424
|
// support some implicit type coercion runtime errors
|
|
8425
8425
|
if (this.operator === '+' &&
|
|
8426
8426
|
this.parent instanceof ExpressionStatement &&
|
|
8427
|
-
this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '')
|
|
8427
|
+
this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '') {
|
|
8428
8428
|
return true;
|
|
8429
|
+
}
|
|
8429
8430
|
return super.hasEffects(context);
|
|
8430
8431
|
}
|
|
8431
8432
|
hasEffectsOnInteractionAtPath(path, { type }) {
|
|
@@ -8973,10 +8974,6 @@ class CallExpression extends CallExpressionBase {
|
|
|
8973
8974
|
this.callee.include(context, false);
|
|
8974
8975
|
}
|
|
8975
8976
|
this.callee.includeCallArguments(context, this.arguments);
|
|
8976
|
-
const returnExpression = this.getReturnExpression();
|
|
8977
|
-
if (!returnExpression.included) {
|
|
8978
|
-
returnExpression.include(context, false);
|
|
8979
|
-
}
|
|
8980
8977
|
}
|
|
8981
8978
|
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
8982
8979
|
this.callee.render(code, options, {
|
|
@@ -9346,15 +9343,6 @@ class MultiExpression extends ExpressionEntity {
|
|
|
9346
9343
|
}
|
|
9347
9344
|
return false;
|
|
9348
9345
|
}
|
|
9349
|
-
include(context, includeChildrenRecursively) {
|
|
9350
|
-
// This is only relevant to include values that do not have an AST representation,
|
|
9351
|
-
// such as UnknownArrayExpression. Thus we only need to include them once.
|
|
9352
|
-
for (const expression of this.expressions) {
|
|
9353
|
-
if (!expression.included) {
|
|
9354
|
-
expression.include(context, includeChildrenRecursively);
|
|
9355
|
-
}
|
|
9356
|
-
}
|
|
9357
|
-
}
|
|
9358
9346
|
}
|
|
9359
9347
|
|
|
9360
9348
|
class ConditionalExpression extends NodeBase {
|
|
@@ -10738,8 +10726,9 @@ class NewExpression extends NodeBase {
|
|
|
10738
10726
|
return true;
|
|
10739
10727
|
}
|
|
10740
10728
|
if (this.context.options.treeshake.annotations &&
|
|
10741
|
-
this.annotations)
|
|
10729
|
+
this.annotations) {
|
|
10742
10730
|
return false;
|
|
10731
|
+
}
|
|
10743
10732
|
return (this.callee.hasEffects(context) ||
|
|
10744
10733
|
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
10745
10734
|
}
|
|
@@ -14332,7 +14321,7 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
|
|
|
14332
14321
|
|
|
14333
14322
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
14334
14323
|
if (isPathFragment(pattern))
|
|
14335
|
-
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.`));
|
|
14336
14325
|
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
|
|
14337
14326
|
if (!replacements.hasOwnProperty(type)) {
|
|
14338
14327
|
return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
|
|
@@ -21699,37 +21688,6 @@ Parser.acorn = {
|
|
|
21699
21688
|
nonASCIIwhitespace: nonASCIIwhitespace
|
|
21700
21689
|
};
|
|
21701
21690
|
|
|
21702
|
-
class Queue {
|
|
21703
|
-
constructor(maxParallel) {
|
|
21704
|
-
this.maxParallel = maxParallel;
|
|
21705
|
-
this.queue = [];
|
|
21706
|
-
this.workerCount = 0;
|
|
21707
|
-
}
|
|
21708
|
-
run(task) {
|
|
21709
|
-
return new Promise((resolve, reject) => {
|
|
21710
|
-
this.queue.push({ reject, resolve, task });
|
|
21711
|
-
this.work();
|
|
21712
|
-
});
|
|
21713
|
-
}
|
|
21714
|
-
async work() {
|
|
21715
|
-
if (this.workerCount >= this.maxParallel)
|
|
21716
|
-
return;
|
|
21717
|
-
this.workerCount++;
|
|
21718
|
-
let entry;
|
|
21719
|
-
while ((entry = this.queue.shift())) {
|
|
21720
|
-
const { reject, resolve, task } = entry;
|
|
21721
|
-
try {
|
|
21722
|
-
const result = await task();
|
|
21723
|
-
resolve(result);
|
|
21724
|
-
}
|
|
21725
|
-
catch (err) {
|
|
21726
|
-
reject(err);
|
|
21727
|
-
}
|
|
21728
|
-
}
|
|
21729
|
-
this.workerCount--;
|
|
21730
|
-
}
|
|
21731
|
-
}
|
|
21732
|
-
|
|
21733
21691
|
function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
|
|
21734
21692
|
let skipped = null;
|
|
21735
21693
|
let replaceContext = null;
|
|
@@ -22056,7 +22014,6 @@ class ModuleLoader {
|
|
|
22056
22014
|
this.hasModuleSideEffects = options.treeshake
|
|
22057
22015
|
? options.treeshake.moduleSideEffects
|
|
22058
22016
|
: () => true;
|
|
22059
|
-
this.readQueue = new Queue(options.maxParallelFileReads);
|
|
22060
22017
|
}
|
|
22061
22018
|
async addAdditionalModules(unresolvedModules) {
|
|
22062
22019
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -22135,7 +22092,7 @@ class ModuleLoader {
|
|
|
22135
22092
|
timeStart('load modules', 3);
|
|
22136
22093
|
let source;
|
|
22137
22094
|
try {
|
|
22138
|
-
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')); });
|
|
22139
22096
|
}
|
|
22140
22097
|
catch (err) {
|
|
22141
22098
|
timeEnd('load modules', 3);
|
|
@@ -22792,6 +22749,37 @@ class PluginDriver {
|
|
|
22792
22749
|
}
|
|
22793
22750
|
}
|
|
22794
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
|
+
|
|
22795
22783
|
function normalizeEntryModules(entryModules) {
|
|
22796
22784
|
if (Array.isArray(entryModules)) {
|
|
22797
22785
|
return entryModules.map(id => ({
|
|
@@ -22855,6 +22843,7 @@ class Graph {
|
|
|
22855
22843
|
this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
|
|
22856
22844
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
22857
22845
|
this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
|
|
22846
|
+
this.fileOperationQueue = new Queue(options.maxParallelFileOps);
|
|
22858
22847
|
}
|
|
22859
22848
|
async build() {
|
|
22860
22849
|
timeStart('generate module graph', 2);
|
|
@@ -23144,6 +23133,7 @@ function normalizeInputOptions(config) {
|
|
|
23144
23133
|
const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
|
|
23145
23134
|
const onwarn = getOnwarn(config);
|
|
23146
23135
|
const strictDeprecations = config.strictDeprecations || false;
|
|
23136
|
+
const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
|
|
23147
23137
|
const options = {
|
|
23148
23138
|
acorn: getAcorn(config),
|
|
23149
23139
|
acornInjectPlugins: getAcornInjectPlugins(config),
|
|
@@ -23155,7 +23145,8 @@ function normalizeInputOptions(config) {
|
|
|
23155
23145
|
input: getInput(config),
|
|
23156
23146
|
makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
|
|
23157
23147
|
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
23158
|
-
|
|
23148
|
+
maxParallelFileOps,
|
|
23149
|
+
maxParallelFileReads: maxParallelFileOps,
|
|
23159
23150
|
moduleContext: getModuleContext(config, context),
|
|
23160
23151
|
onwarn,
|
|
23161
23152
|
perf: config.perf || false,
|
|
@@ -23236,12 +23227,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
|
23236
23227
|
}
|
|
23237
23228
|
return configManualChunks;
|
|
23238
23229
|
};
|
|
23239
|
-
const
|
|
23230
|
+
const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
|
|
23231
|
+
var _a;
|
|
23240
23232
|
const maxParallelFileReads = config.maxParallelFileReads;
|
|
23241
23233
|
if (typeof maxParallelFileReads === 'number') {
|
|
23242
|
-
|
|
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)
|
|
23243
23239
|
return Infinity;
|
|
23244
|
-
return
|
|
23240
|
+
return maxParallelFileOps;
|
|
23245
23241
|
}
|
|
23246
23242
|
return 20;
|
|
23247
23243
|
};
|
|
@@ -23328,6 +23324,16 @@ function sanitizeFileName(name) {
|
|
|
23328
23324
|
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_REGEX, '_');
|
|
23329
23325
|
}
|
|
23330
23326
|
|
|
23327
|
+
function isValidUrl(url) {
|
|
23328
|
+
try {
|
|
23329
|
+
new URL(url);
|
|
23330
|
+
}
|
|
23331
|
+
catch (_) {
|
|
23332
|
+
return false;
|
|
23333
|
+
}
|
|
23334
|
+
return true;
|
|
23335
|
+
}
|
|
23336
|
+
|
|
23331
23337
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
23332
23338
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
23333
23339
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -23381,6 +23387,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23381
23387
|
? id => id
|
|
23382
23388
|
: sanitizeFileName,
|
|
23383
23389
|
sourcemap: config.sourcemap || false,
|
|
23390
|
+
sourcemapBaseUrl: getSourcemapBaseUrl(config),
|
|
23384
23391
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
23385
23392
|
sourcemapFile: config.sourcemapFile,
|
|
23386
23393
|
sourcemapPathTransform: config.sourcemapPathTransform,
|
|
@@ -23606,6 +23613,15 @@ const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
|
23606
23613
|
}
|
|
23607
23614
|
return generatedCode.symbols || false;
|
|
23608
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
|
+
};
|
|
23609
23625
|
|
|
23610
23626
|
function rollup(rawInputOptions) {
|
|
23611
23627
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -23697,7 +23713,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
|
|
|
23697
23713
|
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
23698
23714
|
});
|
|
23699
23715
|
}
|
|
23700
|
-
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))));
|
|
23701
23717
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23702
23718
|
}
|
|
23703
23719
|
return createOutput(generated);
|
|
@@ -23768,7 +23784,11 @@ async function writeOutputFile(outputFile, outputOptions) {
|
|
|
23768
23784
|
url = outputFile.map.toUrl();
|
|
23769
23785
|
}
|
|
23770
23786
|
else {
|
|
23771
|
-
|
|
23787
|
+
const { sourcemapBaseUrl } = outputOptions;
|
|
23788
|
+
const sourcemapFileName = `${basename(outputFile.fileName)}.map`;
|
|
23789
|
+
url = sourcemapBaseUrl
|
|
23790
|
+
? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
|
|
23791
|
+
: sourcemapFileName;
|
|
23772
23792
|
writeSourceMapPromise = promises.writeFile(`${fileName}.map`, outputFile.map.toString());
|
|
23773
23793
|
}
|
|
23774
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.0
|
|
4
|
+
Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
|
|
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.0
|
|
4
|
+
Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
|
|
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
|