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/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.1
|
|
4
|
+
Tue, 26 Jul 2022 08:02:21 GMT - commit 3be1609e95cf81046bb325b3e3c1cb23a7e972b7
|
|
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,12 +29,15 @@ 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";
|
|
38
41
|
const isDumbTerminal = env.TERM === "dumb";
|
|
39
42
|
|
|
40
43
|
const isCompatibleTerminal =
|
|
@@ -45,7 +48,8 @@ const isCI =
|
|
|
45
48
|
("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
46
49
|
|
|
47
50
|
const isColorSupported =
|
|
48
|
-
!isDisabled &&
|
|
51
|
+
!isDisabled &&
|
|
52
|
+
(isForced || (isWindows && !isDumbTerminal) || isCompatibleTerminal || isCI);
|
|
49
53
|
|
|
50
54
|
const replaceClose = (
|
|
51
55
|
index,
|
|
@@ -473,7 +477,7 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
473
477
|
plugin = new Function('return ' + pluginText);
|
|
474
478
|
}
|
|
475
479
|
else {
|
|
476
|
-
const match = pluginText.match(/^([
|
|
480
|
+
const match = pluginText.match(/^([@.:/\\\w|^{}-]+)(=(.*))?$/);
|
|
477
481
|
if (match) {
|
|
478
482
|
// -p plugin
|
|
479
483
|
// -p plugin=arg
|
|
@@ -500,6 +504,11 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
500
504
|
try {
|
|
501
505
|
if (pluginText[0] == '.')
|
|
502
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
|
+
}
|
|
503
512
|
plugin = await requireOrImport(pluginText);
|
|
504
513
|
}
|
|
505
514
|
catch (err) {
|
|
@@ -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
|
|
|
@@ -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.1
|
|
4
|
+
Tue, 26 Jul 2022 08:02:21 GMT - commit 3be1609e95cf81046bb325b3e3c1cb23a7e972b7
|
|
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.1";
|
|
31
31
|
|
|
32
32
|
function ensureArray$1(items) {
|
|
33
33
|
if (Array.isArray(items)) {
|
|
@@ -9105,10 +9105,6 @@ class CallExpression extends CallExpressionBase {
|
|
|
9105
9105
|
this.callee.include(context, false);
|
|
9106
9106
|
}
|
|
9107
9107
|
this.callee.includeCallArguments(context, this.arguments);
|
|
9108
|
-
const returnExpression = this.getReturnExpression();
|
|
9109
|
-
if (!returnExpression.included) {
|
|
9110
|
-
returnExpression.include(context, false);
|
|
9111
|
-
}
|
|
9112
9108
|
}
|
|
9113
9109
|
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
9114
9110
|
this.callee.render(code, options, {
|
|
@@ -9478,15 +9474,6 @@ class MultiExpression extends ExpressionEntity {
|
|
|
9478
9474
|
}
|
|
9479
9475
|
return false;
|
|
9480
9476
|
}
|
|
9481
|
-
include(context, includeChildrenRecursively) {
|
|
9482
|
-
// This is only relevant to include values that do not have an AST representation,
|
|
9483
|
-
// such as UnknownArrayExpression. Thus we only need to include them once.
|
|
9484
|
-
for (const expression of this.expressions) {
|
|
9485
|
-
if (!expression.included) {
|
|
9486
|
-
expression.include(context, includeChildrenRecursively);
|
|
9487
|
-
}
|
|
9488
|
-
}
|
|
9489
|
-
}
|
|
9490
9477
|
}
|
|
9491
9478
|
|
|
9492
9479
|
class ConditionalExpression extends NodeBase {
|
|
@@ -13717,7 +13704,7 @@ function trimEmptyImports(dependencies) {
|
|
|
13717
13704
|
}
|
|
13718
13705
|
|
|
13719
13706
|
function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, namedExportsMode, outro, snippets, warn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
13720
|
-
const { _,
|
|
13707
|
+
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
13721
13708
|
const isNamespaced = name && name.includes('.');
|
|
13722
13709
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
13723
13710
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
@@ -13756,7 +13743,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13756
13743
|
if (hasExports) {
|
|
13757
13744
|
if (name && !(extend && namedExportsMode)) {
|
|
13758
13745
|
wrapperIntro =
|
|
13759
|
-
(useVariableAssignment ?
|
|
13746
|
+
(useVariableAssignment ? `var ${name}` : `this${keypath(name, getPropertyAccess)}`) +
|
|
13760
13747
|
`${_}=${_}${wrapperIntro}`;
|
|
13761
13748
|
}
|
|
13762
13749
|
if (isNamespaced) {
|
|
@@ -14465,7 +14452,7 @@ function renderChunk({ code, options, outputPluginDriver, renderChunk, sourcemap
|
|
|
14465
14452
|
|
|
14466
14453
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
14467
14454
|
if (isPathFragment(pattern))
|
|
14468
|
-
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.`));
|
|
14469
14456
|
return pattern.replace(/\[(\w+)\]/g, (_match, type) => {
|
|
14470
14457
|
if (!replacements.hasOwnProperty(type)) {
|
|
14471
14458
|
return error(errFailedValidation(`"[${type}]" is not a valid placeholder in "${patternName}" pattern.`));
|
|
@@ -21832,37 +21819,6 @@ Parser.acorn = {
|
|
|
21832
21819
|
nonASCIIwhitespace: nonASCIIwhitespace
|
|
21833
21820
|
};
|
|
21834
21821
|
|
|
21835
|
-
class Queue {
|
|
21836
|
-
constructor(maxParallel) {
|
|
21837
|
-
this.maxParallel = maxParallel;
|
|
21838
|
-
this.queue = [];
|
|
21839
|
-
this.workerCount = 0;
|
|
21840
|
-
}
|
|
21841
|
-
run(task) {
|
|
21842
|
-
return new Promise((resolve, reject) => {
|
|
21843
|
-
this.queue.push({ reject, resolve, task });
|
|
21844
|
-
this.work();
|
|
21845
|
-
});
|
|
21846
|
-
}
|
|
21847
|
-
async work() {
|
|
21848
|
-
if (this.workerCount >= this.maxParallel)
|
|
21849
|
-
return;
|
|
21850
|
-
this.workerCount++;
|
|
21851
|
-
let entry;
|
|
21852
|
-
while ((entry = this.queue.shift())) {
|
|
21853
|
-
const { reject, resolve, task } = entry;
|
|
21854
|
-
try {
|
|
21855
|
-
const result = await task();
|
|
21856
|
-
resolve(result);
|
|
21857
|
-
}
|
|
21858
|
-
catch (err) {
|
|
21859
|
-
reject(err);
|
|
21860
|
-
}
|
|
21861
|
-
}
|
|
21862
|
-
this.workerCount--;
|
|
21863
|
-
}
|
|
21864
|
-
}
|
|
21865
|
-
|
|
21866
21822
|
function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry) {
|
|
21867
21823
|
let skipped = null;
|
|
21868
21824
|
let replaceContext = null;
|
|
@@ -22189,7 +22145,6 @@ class ModuleLoader {
|
|
|
22189
22145
|
this.hasModuleSideEffects = options.treeshake
|
|
22190
22146
|
? options.treeshake.moduleSideEffects
|
|
22191
22147
|
: () => true;
|
|
22192
|
-
this.readQueue = new Queue(options.maxParallelFileReads);
|
|
22193
22148
|
}
|
|
22194
22149
|
async addAdditionalModules(unresolvedModules) {
|
|
22195
22150
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -22268,7 +22223,7 @@ class ModuleLoader {
|
|
|
22268
22223
|
timeStart('load modules', 3);
|
|
22269
22224
|
let source;
|
|
22270
22225
|
try {
|
|
22271
|
-
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')); });
|
|
22272
22227
|
}
|
|
22273
22228
|
catch (err) {
|
|
22274
22229
|
timeEnd('load modules', 3);
|
|
@@ -22925,6 +22880,37 @@ class PluginDriver {
|
|
|
22925
22880
|
}
|
|
22926
22881
|
}
|
|
22927
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
|
+
|
|
22928
22914
|
function normalizeEntryModules(entryModules) {
|
|
22929
22915
|
if (Array.isArray(entryModules)) {
|
|
22930
22916
|
return entryModules.map(id => ({
|
|
@@ -22988,6 +22974,7 @@ class Graph {
|
|
|
22988
22974
|
this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
|
|
22989
22975
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
22990
22976
|
this.moduleLoader = new ModuleLoader(this, this.modulesById, this.options, this.pluginDriver);
|
|
22977
|
+
this.fileOperationQueue = new Queue(options.maxParallelFileOps);
|
|
22991
22978
|
}
|
|
22992
22979
|
async build() {
|
|
22993
22980
|
timeStart('generate module graph', 2);
|
|
@@ -23184,6 +23171,7 @@ function normalizeInputOptions(config) {
|
|
|
23184
23171
|
const context = (_a = config.context) !== null && _a !== void 0 ? _a : 'undefined';
|
|
23185
23172
|
const onwarn = getOnwarn(config);
|
|
23186
23173
|
const strictDeprecations = config.strictDeprecations || false;
|
|
23174
|
+
const maxParallelFileOps = getmaxParallelFileOps(config, onwarn, strictDeprecations);
|
|
23187
23175
|
const options = {
|
|
23188
23176
|
acorn: getAcorn(config),
|
|
23189
23177
|
acornInjectPlugins: getAcornInjectPlugins(config),
|
|
@@ -23195,7 +23183,8 @@ function normalizeInputOptions(config) {
|
|
|
23195
23183
|
input: getInput(config),
|
|
23196
23184
|
makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
|
|
23197
23185
|
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
23198
|
-
|
|
23186
|
+
maxParallelFileOps,
|
|
23187
|
+
maxParallelFileReads: maxParallelFileOps,
|
|
23199
23188
|
moduleContext: getModuleContext(config, context),
|
|
23200
23189
|
onwarn,
|
|
23201
23190
|
perf: config.perf || false,
|
|
@@ -23276,12 +23265,17 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
|
23276
23265
|
}
|
|
23277
23266
|
return configManualChunks;
|
|
23278
23267
|
};
|
|
23279
|
-
const
|
|
23268
|
+
const getmaxParallelFileOps = (config, warn, strictDeprecations) => {
|
|
23269
|
+
var _a;
|
|
23280
23270
|
const maxParallelFileReads = config.maxParallelFileReads;
|
|
23281
23271
|
if (typeof maxParallelFileReads === 'number') {
|
|
23282
|
-
|
|
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)
|
|
23283
23277
|
return Infinity;
|
|
23284
|
-
return
|
|
23278
|
+
return maxParallelFileOps;
|
|
23285
23279
|
}
|
|
23286
23280
|
return 20;
|
|
23287
23281
|
};
|
|
@@ -23368,6 +23362,16 @@ function sanitizeFileName(name) {
|
|
|
23368
23362
|
return driveLetter + name.substr(driveLetter.length).replace(INVALID_CHAR_REGEX, '_');
|
|
23369
23363
|
}
|
|
23370
23364
|
|
|
23365
|
+
function isValidUrl(url) {
|
|
23366
|
+
try {
|
|
23367
|
+
new URL(url);
|
|
23368
|
+
}
|
|
23369
|
+
catch (_) {
|
|
23370
|
+
return false;
|
|
23371
|
+
}
|
|
23372
|
+
return true;
|
|
23373
|
+
}
|
|
23374
|
+
|
|
23371
23375
|
function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
23372
23376
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
23373
23377
|
// These are options that may trigger special warnings or behaviour later
|
|
@@ -23421,6 +23425,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23421
23425
|
? id => id
|
|
23422
23426
|
: sanitizeFileName,
|
|
23423
23427
|
sourcemap: config.sourcemap || false,
|
|
23428
|
+
sourcemapBaseUrl: getSourcemapBaseUrl(config),
|
|
23424
23429
|
sourcemapExcludeSources: config.sourcemapExcludeSources || false,
|
|
23425
23430
|
sourcemapFile: config.sourcemapFile,
|
|
23426
23431
|
sourcemapPathTransform: config.sourcemapPathTransform,
|
|
@@ -23646,6 +23651,15 @@ const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
|
23646
23651
|
}
|
|
23647
23652
|
return generatedCode.symbols || false;
|
|
23648
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
|
+
};
|
|
23649
23663
|
|
|
23650
23664
|
function rollup(rawInputOptions) {
|
|
23651
23665
|
return rollupInternal(rawInputOptions, null);
|
|
@@ -23737,7 +23751,7 @@ function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, rawOutput
|
|
|
23737
23751
|
message: 'You must specify "output.file" or "output.dir" for the build.'
|
|
23738
23752
|
});
|
|
23739
23753
|
}
|
|
23740
|
-
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))));
|
|
23741
23755
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23742
23756
|
}
|
|
23743
23757
|
return createOutput(generated);
|
|
@@ -23808,7 +23822,11 @@ async function writeOutputFile(outputFile, outputOptions) {
|
|
|
23808
23822
|
url = outputFile.map.toUrl();
|
|
23809
23823
|
}
|
|
23810
23824
|
else {
|
|
23811
|
-
|
|
23825
|
+
const { sourcemapBaseUrl } = outputOptions;
|
|
23826
|
+
const sourcemapFileName = `${require$$0.basename(outputFile.fileName)}.map`;
|
|
23827
|
+
url = sourcemapBaseUrl
|
|
23828
|
+
? new URL(sourcemapFileName, sourcemapBaseUrl).toString()
|
|
23829
|
+
: sourcemapFileName;
|
|
23812
23830
|
writeSourceMapPromise = require$$0$1.promises.writeFile(`${fileName}.map`, outputFile.map.toString());
|
|
23813
23831
|
}
|
|
23814
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.1
|
|
4
|
+
Tue, 26 Jul 2022 08:02:21 GMT - commit 3be1609e95cf81046bb325b3e3c1cb23a7e972b7
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.77.1",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only",
|
|
18
18
|
"ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha",
|
|
19
19
|
"lint": "eslint . --fix --cache && prettier --write \"**/*.md\"",
|
|
20
|
-
"lint:nofix": "eslint . && prettier --check \"**/*.md\"",
|
|
20
|
+
"lint:nofix": "eslint . --cache && prettier --check \"**/*.md\"",
|
|
21
21
|
"lint:markdown": "prettier --write \"**/*.md\"",
|
|
22
22
|
"perf": "npm run build:cjs && node --expose-gc scripts/perf.js",
|
|
23
23
|
"perf:debug": "node --inspect-brk scripts/perf-debug.js",
|
|
@@ -59,32 +59,32 @@
|
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@rollup/plugin-alias": "^3.1.9",
|
|
61
61
|
"@rollup/plugin-buble": "^0.21.3",
|
|
62
|
-
"@rollup/plugin-commonjs": "^22.0.
|
|
62
|
+
"@rollup/plugin-commonjs": "^22.0.1",
|
|
63
63
|
"@rollup/plugin-json": "^4.1.0",
|
|
64
64
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
65
65
|
"@rollup/plugin-replace": "^4.0.0",
|
|
66
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
66
|
+
"@rollup/plugin-typescript": "^8.3.3",
|
|
67
67
|
"@rollup/pluginutils": "^4.2.1",
|
|
68
|
-
"@types/estree": "0.0.
|
|
68
|
+
"@types/estree": "0.0.52",
|
|
69
69
|
"@types/node": "^10.17.60",
|
|
70
70
|
"@types/signal-exit": "^3.0.1",
|
|
71
71
|
"@types/yargs-parser": "^20.2.2",
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
73
|
-
"@typescript-eslint/parser": "^5.
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^5.30.7",
|
|
73
|
+
"@typescript-eslint/parser": "^5.30.7",
|
|
74
74
|
"acorn": "^8.7.1",
|
|
75
75
|
"acorn-jsx": "^5.3.2",
|
|
76
76
|
"acorn-walk": "^8.2.0",
|
|
77
77
|
"buble": "^0.20.0",
|
|
78
78
|
"chokidar": "^3.5.3",
|
|
79
|
-
"colorette": "^2.0.
|
|
80
|
-
"core-js": "^3.
|
|
79
|
+
"colorette": "^2.0.19",
|
|
80
|
+
"core-js": "^3.23.5",
|
|
81
81
|
"date-time": "^4.0.0",
|
|
82
82
|
"es5-shim": "^4.6.7",
|
|
83
83
|
"es6-shim": "^0.35.6",
|
|
84
|
-
"eslint": "^8.
|
|
84
|
+
"eslint": "^8.20.0",
|
|
85
85
|
"eslint-config-prettier": "^8.5.0",
|
|
86
86
|
"eslint-plugin-import": "^2.26.0",
|
|
87
|
-
"eslint-plugin-prettier": "^4.
|
|
87
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
88
88
|
"execa": "^5.1.1",
|
|
89
89
|
"fixturify": "^2.1.1",
|
|
90
90
|
"fs-extra": "^10.1.0",
|
|
@@ -96,12 +96,12 @@
|
|
|
96
96
|
"magic-string": "^0.26.2",
|
|
97
97
|
"mocha": "^9.2.2",
|
|
98
98
|
"nyc": "^15.1.0",
|
|
99
|
-
"prettier": "^2.
|
|
99
|
+
"prettier": "^2.7.1",
|
|
100
100
|
"pretty-bytes": "^5.6.0",
|
|
101
101
|
"pretty-ms": "^7.0.1",
|
|
102
102
|
"requirejs": "^2.3.6",
|
|
103
|
-
"rollup": "^2.
|
|
104
|
-
"rollup-plugin-license": "^2.8.
|
|
103
|
+
"rollup": "^2.77.0",
|
|
104
|
+
"rollup-plugin-license": "^2.8.1",
|
|
105
105
|
"rollup-plugin-string": "^3.0.0",
|
|
106
106
|
"rollup-plugin-terser": "^7.0.2",
|
|
107
107
|
"rollup-plugin-thatworks": "^1.0.4",
|
|
@@ -111,9 +111,9 @@
|
|
|
111
111
|
"source-map-support": "^0.5.21",
|
|
112
112
|
"sourcemap-codec": "^1.4.8",
|
|
113
113
|
"systemjs": "^6.12.1",
|
|
114
|
-
"terser": "^5.14.
|
|
114
|
+
"terser": "^5.14.2",
|
|
115
115
|
"tslib": "^2.4.0",
|
|
116
|
-
"typescript": "^4.7.
|
|
116
|
+
"typescript": "^4.7.4",
|
|
117
117
|
"weak-napi": "^2.0.2",
|
|
118
118
|
"yargs-parser": "^20.2.9"
|
|
119
119
|
},
|