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/rollup.d.ts
CHANGED
|
@@ -553,6 +553,8 @@ export interface InputOptions {
|
|
|
553
553
|
makeAbsoluteExternalsRelative?: boolean | 'ifRelativeSource';
|
|
554
554
|
/** @deprecated Use the "manualChunks" output option instead. */
|
|
555
555
|
manualChunks?: ManualChunksOption;
|
|
556
|
+
maxParallelFileOps?: number;
|
|
557
|
+
/** @deprecated Use the "maxParallelFileOps" option instead. */
|
|
556
558
|
maxParallelFileReads?: number;
|
|
557
559
|
moduleContext?: ((id: string) => string | null | void) | { [id: string]: string };
|
|
558
560
|
onwarn?: WarningHandlerWithDefault;
|
|
@@ -581,6 +583,8 @@ export interface NormalizedInputOptions {
|
|
|
581
583
|
makeAbsoluteExternalsRelative: boolean | 'ifRelativeSource';
|
|
582
584
|
/** @deprecated Use the "manualChunks" output option instead. */
|
|
583
585
|
manualChunks: ManualChunksOption | undefined;
|
|
586
|
+
maxParallelFileOps: number;
|
|
587
|
+
/** @deprecated Use the "maxParallelFileOps" option instead. */
|
|
584
588
|
maxParallelFileReads: number;
|
|
585
589
|
moduleContext: (id: string) => string;
|
|
586
590
|
onwarn: WarningHandler;
|
|
@@ -692,6 +696,7 @@ export interface OutputOptions {
|
|
|
692
696
|
preserveModulesRoot?: string;
|
|
693
697
|
sanitizeFileName?: boolean | ((fileName: string) => string);
|
|
694
698
|
sourcemap?: boolean | 'inline' | 'hidden';
|
|
699
|
+
sourcemapBaseUrl?: string;
|
|
695
700
|
sourcemapExcludeSources?: boolean;
|
|
696
701
|
sourcemapFile?: string;
|
|
697
702
|
sourcemapPathTransform?: SourcemapPathTransformOption;
|
|
@@ -739,6 +744,7 @@ export interface NormalizedOutputOptions {
|
|
|
739
744
|
preserveModulesRoot: string | undefined;
|
|
740
745
|
sanitizeFileName: (fileName: string) => string;
|
|
741
746
|
sourcemap: boolean | 'inline' | 'hidden';
|
|
747
|
+
sourcemapBaseUrl: string | undefined;
|
|
742
748
|
sourcemapExcludeSources: boolean;
|
|
743
749
|
sourcemapFile: string | undefined;
|
|
744
750
|
sourcemapPathTransform: SourcemapPathTransformOption | undefined;
|
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.77.0
|
|
4
|
+
Fri, 15 Jul 2022 10:23:18 GMT - commit 87da8ef24f61d6601dc550026fc59f8066bbb95d
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
const require$$0 = require('path');
|
|
13
13
|
const process$1 = require('process');
|
|
14
14
|
const url = require('url');
|
|
15
|
-
const rollup = require('./rollup.js');
|
|
16
15
|
const tty = require('tty');
|
|
16
|
+
const rollup = require('./rollup.js');
|
|
17
17
|
const mergeOptions = require('./mergeOptions.js');
|
|
18
18
|
|
|
19
19
|
function _interopNamespaceDefault(e) {
|
|
@@ -29,22 +29,27 @@ function _interopNamespaceDefault(e) {
|
|
|
29
29
|
|
|
30
30
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
|
|
32
|
+
const {
|
|
33
|
+
env = {},
|
|
34
|
+
argv = [],
|
|
35
|
+
platform = "",
|
|
36
|
+
} = typeof process === "undefined" ? {} : process;
|
|
34
37
|
|
|
35
38
|
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
36
39
|
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
37
|
-
const isWindows =
|
|
40
|
+
const isWindows = platform === "win32";
|
|
41
|
+
const isDumbTerminal = env.TERM === "dumb";
|
|
38
42
|
|
|
39
43
|
const isCompatibleTerminal =
|
|
40
|
-
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM &&
|
|
44
|
+
tty__namespace && tty__namespace.isatty && tty__namespace.isatty(1) && env.TERM && !isDumbTerminal;
|
|
41
45
|
|
|
42
46
|
const isCI =
|
|
43
47
|
"CI" in env &&
|
|
44
48
|
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
45
49
|
|
|
46
50
|
const isColorSupported =
|
|
47
|
-
!isDisabled &&
|
|
51
|
+
!isDisabled &&
|
|
52
|
+
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
|
|
48
53
|
|
|
49
54
|
const replaceClose = (
|
|
50
55
|
index,
|
|
@@ -121,13 +126,11 @@ const colors = {
|
|
|
121
126
|
bgWhiteBright: init(107, 49),
|
|
122
127
|
};
|
|
123
128
|
|
|
124
|
-
const none = (any) => any;
|
|
125
|
-
|
|
126
129
|
const createColors = ({ useColor = isColorSupported } = {}) =>
|
|
127
130
|
useColor
|
|
128
131
|
? colors
|
|
129
132
|
: Object.keys(colors).reduce(
|
|
130
|
-
(colors, key) => ({ ...colors, [key]:
|
|
133
|
+
(colors, key) => ({ ...colors, [key]: String }),
|
|
131
134
|
{}
|
|
132
135
|
);
|
|
133
136
|
|
|
@@ -474,7 +477,7 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
474
477
|
plugin = new Function('return ' + pluginText);
|
|
475
478
|
}
|
|
476
479
|
else {
|
|
477
|
-
const match = pluginText.match(/^([
|
|
480
|
+
const match = pluginText.match(/^([@.:/\\\w|^{}-]+)(=(.*))?$/);
|
|
478
481
|
if (match) {
|
|
479
482
|
// -p plugin
|
|
480
483
|
// -p plugin=arg
|
|
@@ -501,6 +504,11 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
501
504
|
try {
|
|
502
505
|
if (pluginText[0] == '.')
|
|
503
506
|
pluginText = require$$0.resolve(pluginText);
|
|
507
|
+
// Windows absolute paths must be specified as file:// protocol URL
|
|
508
|
+
// Note that we do not have coverage for Windows-only code paths
|
|
509
|
+
else if (pluginText.match(/^[A-Za-z]:\\/)) {
|
|
510
|
+
pluginText = url.pathToFileURL(require$$0.resolve(pluginText)).href;
|
|
511
|
+
}
|
|
504
512
|
plugin = await requireOrImport(pluginText);
|
|
505
513
|
}
|
|
506
514
|
catch (err) {
|
|
@@ -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
|
|
|
@@ -73,6 +73,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
73
73
|
input: getOption('input') || [],
|
|
74
74
|
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
|
|
75
75
|
manualChunks: getOption('manualChunks'),
|
|
76
|
+
maxParallelFileOps: getOption('maxParallelFileOps'),
|
|
76
77
|
maxParallelFileReads: getOption('maxParallelFileReads'),
|
|
77
78
|
moduleContext: getOption('moduleContext'),
|
|
78
79
|
onwarn: getOnWarn(config, defaultOnWarnHandler),
|
|
@@ -161,6 +162,7 @@ function mergeOutputOptions(config, overrides, warn) {
|
|
|
161
162
|
preserveModulesRoot: getOption('preserveModulesRoot'),
|
|
162
163
|
sanitizeFileName: getOption('sanitizeFileName'),
|
|
163
164
|
sourcemap: getOption('sourcemap'),
|
|
165
|
+
sourcemapBaseUrl: getOption('sourcemapBaseUrl'),
|
|
164
166
|
sourcemapExcludeSources: getOption('sourcemapExcludeSources'),
|
|
165
167
|
sourcemapFile: getOption('sourcemapFile'),
|
|
166
168
|
sourcemapPathTransform: getOption('sourcemapPathTransform'),
|
package/dist/shared/rollup.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
|
|
|
@@ -27,7 +27,7 @@ function _interopNamespaceDefault(e) {
|
|
|
27
27
|
return n;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version$1 = "2.
|
|
30
|
+
var version$1 = "2.77.0";
|
|
31
31
|
|
|
32
32
|
function ensureArray$1(items) {
|
|
33
33
|
if (Array.isArray(items)) {
|
|
@@ -6098,8 +6098,8 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
6098
6098
|
flat: METHOD_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
6099
6099
|
flatMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_NEW_ARRAY,
|
|
6100
6100
|
forEach: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6101
|
-
|
|
6102
|
-
|
|
6101
|
+
group: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6102
|
+
groupToMap: METHOD_CALLS_ARG_DEOPTS_SELF_RETURNS_UNKNOWN,
|
|
6103
6103
|
includes: METHOD_RETURNS_BOOLEAN,
|
|
6104
6104
|
indexOf: METHOD_RETURNS_NUMBER,
|
|
6105
6105
|
join: METHOD_RETURNS_STRING,
|
|
@@ -8555,8 +8555,9 @@ class BinaryExpression extends NodeBase {
|
|
|
8555
8555
|
// support some implicit type coercion runtime errors
|
|
8556
8556
|
if (this.operator === '+' &&
|
|
8557
8557
|
this.parent instanceof ExpressionStatement &&
|
|
8558
|
-
this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '')
|
|
8558
|
+
this.left.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) === '') {
|
|
8559
8559
|
return true;
|
|
8560
|
+
}
|
|
8560
8561
|
return super.hasEffects(context);
|
|
8561
8562
|
}
|
|
8562
8563
|
hasEffectsOnInteractionAtPath(path, { type }) {
|
|
@@ -9104,10 +9105,6 @@ class CallExpression extends CallExpressionBase {
|
|
|
9104
9105
|
this.callee.include(context, false);
|
|
9105
9106
|
}
|
|
9106
9107
|
this.callee.includeCallArguments(context, this.arguments);
|
|
9107
|
-
const returnExpression = this.getReturnExpression();
|
|
9108
|
-
if (!returnExpression.included) {
|
|
9109
|
-
returnExpression.include(context, false);
|
|
9110
|
-
}
|
|
9111
9108
|
}
|
|
9112
9109
|
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
9113
9110
|
this.callee.render(code, options, {
|
|
@@ -9477,15 +9474,6 @@ class MultiExpression extends ExpressionEntity {
|
|
|
9477
9474
|
}
|
|
9478
9475
|
return false;
|
|
9479
9476
|
}
|
|
9480
|
-
include(context, includeChildrenRecursively) {
|
|
9481
|
-
// This is only relevant to include values that do not have an AST representation,
|
|
9482
|
-
// such as UnknownArrayExpression. Thus we only need to include them once.
|
|
9483
|
-
for (const expression of this.expressions) {
|
|
9484
|
-
if (!expression.included) {
|
|
9485
|
-
expression.include(context, includeChildrenRecursively);
|
|
9486
|
-
}
|
|
9487
|
-
}
|
|
9488
|
-
}
|
|
9489
9477
|
}
|
|
9490
9478
|
|
|
9491
9479
|
class ConditionalExpression extends NodeBase {
|
|
@@ -10869,8 +10857,9 @@ class NewExpression extends NodeBase {
|
|
|
10869
10857
|
return true;
|
|
10870
10858
|
}
|
|
10871
10859
|
if (this.context.options.treeshake.annotations &&
|
|
10872
|
-
this.annotations)
|
|
10860
|
+
this.annotations) {
|
|
10873
10861
|
return false;
|
|
10862
|
+
}
|
|
10874
10863
|
return (this.callee.hasEffects(context) ||
|
|
10875
10864
|
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
10876
10865
|
}
|
|
@@ -14463,7 +14452,7 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
|
|
|
14463
14452
|
|
|
14464
14453
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
14465
14454
|
if (isPathFragment(pattern))
|
|
14466
|
-
return error(errFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths.`));
|
|
14455
|
+
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.`));
|
|
14467
14456
|
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
|
|
14468
14457
|
if (!replacements.hasOwnProperty(type)) {
|
|
14469
14458
|
return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
|
|
@@ -21830,37 +21819,6 @@ Parser.acorn = {
|
|
|
21830
21819
|
nonASCIIwhitespace: nonASCIIwhitespace
|
|
21831
21820
|
};
|
|
21832
21821
|
|
|
21833
|
-
class Queue {
|
|
21834
|
-
constructor(maxParallel) {
|
|
21835
|
-
this.maxParallel = maxParallel;
|
|
21836
|
-
this.queue = [];
|
|
21837
|
-
this.workerCount = 0;
|
|
21838
|
-
}
|
|
21839
|
-
run(task) {
|
|
21840
|
-
return new Promise((resolve, reject) => {
|
|
21841
|
-
this.queue.push({ reject, resolve, task });
|
|
21842
|
-
this.work();
|
|
21843
|
-
});
|
|
21844
|
-
}
|
|
21845
|
-
async work() {
|
|
21846
|
-
if (this.workerCount >= this.maxParallel)
|
|
21847
|
-
return;
|
|
21848
|
-
this.workerCount++;
|
|
21849
|
-
let entry;
|
|
21850
|
-
while ((entry = this.queue.shift())) {
|
|
21851
|
-
const { reject, resolve, task } = entry;
|
|
21852
|
-
try {
|
|
21853
|
-
const result = await task();
|
|
21854
|
-
resolve(result);
|
|
21855
|
-
}
|
|
21856
|
-
catch (err) {
|
|
21857
|
-
reject(err);
|
|
21858
|
-
}
|
|
21859
|
-
}
|
|
21860
|
-
this.workerCount--;
|
|
21861
|
-
}
|
|
21862
|
-
}
|
|
21863
|
-
|
|
21864
21822
|
function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
|
|
21865
21823
|
let skipped = null;
|
|
21866
21824
|
let replaceContext = null;
|
|
@@ -22187,7 +22145,6 @@ class ModuleLoader {
|
|
|
22187
22145
|
this.hasModuleSideEffects = options.treeshake
|
|
22188
22146
|
? options.treeshake.moduleSideEffects
|
|
22189
22147
|
: () => true;
|
|
22190
|
-
this.readQueue = new Queue(options.maxParallelFileReads);
|
|
22191
22148
|
}
|
|
22192
22149
|
async addAdditionalModules(unresolvedModules) {
|
|
22193
22150
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -22266,7 +22223,7 @@ class ModuleLoader {
|
|
|
22266
22223
|
timeStart('load modules', 3);
|
|
22267
22224
|
let source;
|
|
22268
22225
|
try {
|
|
22269
|
-
source = await this.
|
|
22226
|
+
source = await this.graph.fileOperationQueue.run(async () => { var _a; return (_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await require$$0$1.promises.readFile(id, 'utf8')); });
|
|
22270
22227
|
}
|
|
22271
22228
|
catch (err) {
|
|
22272
22229
|
timeEnd('load modules', 3);
|
|
@@ -22923,6 +22880,37 @@ class PluginDriver {
|
|
|
22923
22880
|
}
|
|
22924
22881
|
}
|
|
22925
22882
|
|
|
22883
|
+
class Queue {
|
|
22884
|
+
constructor(maxParallel) {
|
|
22885
|
+
this.maxParallel = maxParallel;
|
|
22886
|
+
this.queue = [];
|
|
22887
|
+
this.workerCount = 0;
|
|
22888
|
+
}
|
|
22889
|
+
run(task) {
|
|
22890
|
+
return new Promise((resolve, reject) => {
|
|
22891
|
+
this.queue.push({ reject, resolve, task });
|
|
22892
|
+
this.work();
|
|
22893
|
+
});
|
|
22894
|
+
}
|
|
22895
|
+
async work() {
|
|
22896
|
+
if (this.workerCount >= this.maxParallel)
|
|
22897
|
+
return;
|
|
22898
|
+
this.workerCount++;
|
|
22899
|
+
let entry;
|
|
22900
|
+
while ((entry = this.queue.shift())) {
|
|
22901
|
+
const { reject, resolve, task } = entry;
|
|
22902
|
+
try {
|
|
22903
|
+
const result = await task();
|
|
22904
|
+
resolve(result);
|
|
22905
|
+
}
|
|
22906
|
+
catch (err) {
|
|
22907
|
+
reject(err);
|
|
22908
|
+
}
|
|
22909
|
+
}
|
|
22910
|
+
this.workerCount--;
|
|
22911
|
+
}
|
|
22912
|
+
}
|
|
22913
|
+
|
|
22926
22914
|
function normalizeEntryModules(entryModules) {
|
|
22927
22915
|
if (Array.isArray(entryModules)) {
|
|
22928
22916
|
return entryModules.map(id => ({
|
|
@@ -22986,6 +22974,7 @@ class Graph {
|
|
|
22986
22974
|
this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
|
|
22987
22975
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
22988
22976
|
this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
|
|
22977
|
+
this.fileOperationQueue = new Queue(options.maxParallelFileOps);
|
|
22989
22978
|
}
|
|
22990
22979
|
async build() {
|
|
22991
22980
|
timeStart('generate module graph', 2);
|
|
@@ -23182,6 +23171,7 @@ function normalizeInputOptions(config) {
|
|
|
23182
23171
|
const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
|
|
23183
23172
|
const onwarn = getOnwarn(config);
|
|
23184
23173
|
const strictDeprecations = config.strictDeprecations || false;
|
|
23174
|
+
const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
|
|
23185
23175
|
const options = {
|
|
23186
23176
|
acorn: getAcorn(config),
|
|
23187
23177
|
acornInjectPlugins: getAcornInjectPlugins(config),
|
|
@@ -23193,7 +23183,8 @@ function normalizeInputOptions(config) {
|
|
|
23193
23183
|
input: getInput(config),
|
|
23194
23184
|
makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
|
|
23195
23185
|
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
23196
|
-
|
|
23186
|
+
maxParallelFileOps,
|
|
23187
|
+
maxParallelFileReads: maxParallelFileOps,
|
|
23197
23188
|
moduleContext: getModuleContext(config, context),
|
|
23198
23189
|
onwarn,
|
|
23199
23190
|
perf: config.perf || false,
|
|
@@ -23274,12 +23265,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
|
23274
23265
|
}
|
|
23275
23266
|
return configManualChunks;
|
|
23276
23267
|
};
|
|
23277
|
-
const
|
|
23268
|
+
const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
|
|
23269
|
+
var _a;
|
|
23278
23270
|
const maxParallelFileReads = config.maxParallelFileReads;
|
|
23279
23271
|
if (typeof maxParallelFileReads === 'number') {
|
|
23280
|
-
|
|
23272
|
+
warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', false, warn, strictDeprecations);
|
|
23273
|
+
}
|
|
23274
|
+
const maxParallelFileOps = (_a = config.maxParallelFileOps) !== null && _a !== void 0 ? _a : maxParallelFileReads;
|
|
23275
|
+
if (typeof maxParallelFileOps === 'number') {
|
|
23276
|
+
if (maxParallelFileOps <= 0)
|
|
23281
23277
|
return Infinity;
|
|
23282
|
-
return
|
|
23278
|
+
return maxParallelFileOps;
|
|
23283
23279
|
}
|
|
23284
23280
|
return 20;
|
|
23285
23281
|
};
|
|
@@ -23366,6 +23362,16 @@ function sanitizeFileName(name) {
|
|
|
23366
23362
|
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_REGEX, '_');
|
|
23367
23363
|
}
|
|
23368
23364
|
|
|
23365
|
+
function isValidUrl(url) {
|
|
23366
|
+
try {
|
|
23367
|
+
new URL(url);
|
|
23368
|
+
}
|
|
23369
|
+
catch (_) {
|
|
23370
|
+
return false;
|
|
23371
|
+
}
|
|
23372
|
+
return true;
|
|
23373
|
+
}
|
|
23374
|
+
|
|
23369
23375
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
23370
23376
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
23371
23377
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -23419,6 +23425,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23419
23425
|
? id => id
|
|
23420
23426
|
: sanitizeFileName,
|
|
23421
23427
|
sourcemap: config.sourcemap || false,
|
|
23428
|
+
sourcemapBaseUrl: getSourcemapBaseUrl(config),
|
|
23422
23429
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
23423
23430
|
sourcemapFile: config.sourcemapFile,
|
|
23424
23431
|
sourcemapPathTransform: config.sourcemapPathTransform,
|
|
@@ -23644,6 +23651,15 @@ const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
|
23644
23651
|
}
|
|
23645
23652
|
return generatedCode.symbols || false;
|
|
23646
23653
|
};
|
|
23654
|
+
const getSourcemapBaseUrl = (config) => {
|
|
23655
|
+
const { sourcemapBaseUrl } = config;
|
|
23656
|
+
if (sourcemapBaseUrl) {
|
|
23657
|
+
if (isValidUrl(sourcemapBaseUrl)) {
|
|
23658
|
+
return sourcemapBaseUrl;
|
|
23659
|
+
}
|
|
23660
|
+
return error(errInvalidOption('output.sourcemapBaseUrl', 'outputsourcemapbaseurl', `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
|
|
23661
|
+
}
|
|
23662
|
+
};
|
|
23647
23663
|
|
|
23648
23664
|
function rollup(rawInputOptions) {
|
|
23649
23665
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -23735,7 +23751,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
|
|
|
23735
23751
|
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
23736
23752
|
});
|
|
23737
23753
|
}
|
|
23738
|
-
await Promise.all(Object.values(generated).map(chunk => writeOutputFile(chunk, outputOptions)));
|
|
23754
|
+
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
|
|
23739
23755
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23740
23756
|
}
|
|
23741
23757
|
return createOutput(generated);
|
|
@@ -23806,7 +23822,11 @@ async function writeOutputFile(outputFile, outputOptions) {
|
|
|
23806
23822
|
url = outputFile.map.toUrl();
|
|
23807
23823
|
}
|
|
23808
23824
|
else {
|
|
23809
|
-
|
|
23825
|
+
const { sourcemapBaseUrl } = outputOptions;
|
|
23826
|
+
const sourcemapFileName = `${require$$0.basename(outputFile.fileName)}.map`;
|
|
23827
|
+
url = sourcemapBaseUrl
|
|
23828
|
+
? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
|
|
23829
|
+
: sourcemapFileName;
|
|
23810
23830
|
writeSourceMapPromise = require$$0$1.promises.writeFile(`${fileName}.map`, outputFile.map.toString());
|
|
23811
23831
|
}
|
|
23812
23832
|
if (outputOptions.sourcemap !== 'hidden') {
|
package/dist/shared/watch-cli.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
|
|
|
@@ -18,7 +18,7 @@ const cli = require('../bin/rollup');
|
|
|
18
18
|
const rollup = require('./rollup.js');
|
|
19
19
|
const require$$0 = require('assert');
|
|
20
20
|
const require$$0$1 = require('events');
|
|
21
|
-
const
|
|
21
|
+
const loadConfigFile_js = require('./loadConfigFile.js');
|
|
22
22
|
const child_process = require('child_process');
|
|
23
23
|
require('util');
|
|
24
24
|
require('stream');
|
|
@@ -347,12 +347,12 @@ function getResetScreen(configs, allowClearScreen) {
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
if (clearScreen) {
|
|
350
|
-
return (heading) =>
|
|
350
|
+
return (heading) => loadConfigFile_js.stderr(CLEAR_SCREEN + heading);
|
|
351
351
|
}
|
|
352
352
|
let firstRun = true;
|
|
353
353
|
return (heading) => {
|
|
354
354
|
if (firstRun) {
|
|
355
|
-
|
|
355
|
+
loadConfigFile_js.stderr(heading);
|
|
356
356
|
firstRun = false;
|
|
357
357
|
}
|
|
358
358
|
};
|
|
@@ -371,7 +371,7 @@ function createWatchHooks(command) {
|
|
|
371
371
|
if (watchHooks[hook]) {
|
|
372
372
|
const cmd = watchHooks[hook];
|
|
373
373
|
if (!command.silent) {
|
|
374
|
-
|
|
374
|
+
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`watch.${hook} ${loadConfigFile_js.bold(`$ ${cmd}`)}`));
|
|
375
375
|
}
|
|
376
376
|
try {
|
|
377
377
|
// !! important - use stderr for all writes from execSync
|
|
@@ -379,7 +379,7 @@ function createWatchHooks(command) {
|
|
|
379
379
|
child_process.execSync(cmd, { stdio: command.silent ? 'ignore' : stdio });
|
|
380
380
|
}
|
|
381
381
|
catch (e) {
|
|
382
|
-
|
|
382
|
+
loadConfigFile_js.stderr(e.message);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
};
|
|
@@ -414,10 +414,10 @@ async function watch(command) {
|
|
|
414
414
|
configFileRevision++;
|
|
415
415
|
const currentConfigFileRevision = configFileRevision;
|
|
416
416
|
if (configFileData) {
|
|
417
|
-
|
|
417
|
+
loadConfigFile_js.stderr(`\nReloading updated config...`);
|
|
418
418
|
}
|
|
419
419
|
configFileData = newConfigFileData;
|
|
420
|
-
const { options, warnings } = await
|
|
420
|
+
const { options, warnings } = await loadConfigFile_js.loadAndParseConfigFile(configFile, command);
|
|
421
421
|
if (currentConfigFileRevision !== configFileRevision) {
|
|
422
422
|
return;
|
|
423
423
|
}
|
|
@@ -427,7 +427,7 @@ async function watch(command) {
|
|
|
427
427
|
start(options, warnings);
|
|
428
428
|
}
|
|
429
429
|
catch (err) {
|
|
430
|
-
|
|
430
|
+
loadConfigFile_js.handleError(err, true);
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
}
|
|
@@ -443,13 +443,13 @@ async function watch(command) {
|
|
|
443
443
|
watcher = rollup.watch(configs);
|
|
444
444
|
}
|
|
445
445
|
catch (err) {
|
|
446
|
-
return
|
|
446
|
+
return loadConfigFile_js.handleError(err);
|
|
447
447
|
}
|
|
448
448
|
watcher.on('event', event => {
|
|
449
449
|
switch (event.code) {
|
|
450
450
|
case 'ERROR':
|
|
451
451
|
warnings.flush();
|
|
452
|
-
|
|
452
|
+
loadConfigFile_js.handleError(event.error, true);
|
|
453
453
|
runWatchHook('onError');
|
|
454
454
|
break;
|
|
455
455
|
case 'START':
|
|
@@ -457,7 +457,7 @@ async function watch(command) {
|
|
|
457
457
|
if (!resetScreen) {
|
|
458
458
|
resetScreen = getResetScreen(configs, isTTY);
|
|
459
459
|
}
|
|
460
|
-
resetScreen(
|
|
460
|
+
resetScreen(loadConfigFile_js.underline(`rollup v${rollup.version}`));
|
|
461
461
|
}
|
|
462
462
|
runWatchHook('onStart');
|
|
463
463
|
break;
|
|
@@ -469,14 +469,14 @@ async function watch(command) {
|
|
|
469
469
|
? input.join(', ')
|
|
470
470
|
: Object.values(input).join(', ');
|
|
471
471
|
}
|
|
472
|
-
|
|
472
|
+
loadConfigFile_js.stderr(loadConfigFile_js.cyan(`bundles ${loadConfigFile_js.bold(input)} → ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))}...`));
|
|
473
473
|
}
|
|
474
474
|
runWatchHook('onBundleStart');
|
|
475
475
|
break;
|
|
476
476
|
case 'BUNDLE_END':
|
|
477
477
|
warnings.flush();
|
|
478
478
|
if (!silent)
|
|
479
|
-
|
|
479
|
+
loadConfigFile_js.stderr(loadConfigFile_js.green(`created ${loadConfigFile_js.bold(event.output.map(rollup.relativeId).join(', '))} in ${loadConfigFile_js.bold(cli.ms(event.duration))}`));
|
|
480
480
|
runWatchHook('onBundleEnd');
|
|
481
481
|
if (event.result && event.result.getTimings) {
|
|
482
482
|
cli.printTimings(event.result.getTimings());
|
|
@@ -485,11 +485,11 @@ async function watch(command) {
|
|
|
485
485
|
case 'END':
|
|
486
486
|
runWatchHook('onEnd');
|
|
487
487
|
if (!silent && isTTY) {
|
|
488
|
-
|
|
488
|
+
loadConfigFile_js.stderr(`\n[${dateTime()}] waiting for changes...`);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
if ('result' in event && event.result) {
|
|
492
|
-
event.result.close().catch(error =>
|
|
492
|
+
event.result.close().catch(error => loadConfigFile_js.handleError(error, true));
|
|
493
493
|
}
|
|
494
494
|
});
|
|
495
495
|
}
|
package/dist/shared/watch.js
CHANGED