rollup 2.61.0 → 2.64.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 +88 -0
- package/dist/bin/rollup +11 -23
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +4 -2
- package/dist/es/shared/rollup.js +382 -268
- package/dist/es/shared/watch.js +22 -18
- package/dist/loadConfigFile.js +3 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +19 -3
- package/dist/rollup.js +4 -2
- package/dist/shared/index.js +15 -13
- package/dist/shared/loadConfigFile.js +10 -11
- package/dist/shared/mergeOptions.js +12 -5
- package/dist/shared/rollup.js +427 -310
- package/dist/shared/watch-cli.js +21 -29
- package/dist/shared/watch.js +8 -18
- package/package.json +9 -9
package/dist/rollup.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ export interface SourceDescription extends Partial<PartialNull<ModuleOptions>> {
|
|
|
101
101
|
map?: SourceMapInput;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
export interface TransformModuleJSON
|
|
104
|
+
export interface TransformModuleJSON {
|
|
105
105
|
ast?: AcornNode;
|
|
106
106
|
code: string;
|
|
107
107
|
// note if plugins use new this.cache to opt-out auto transform cache
|
|
@@ -113,7 +113,7 @@ export interface TransformModuleJSON extends Partial<PartialNull<ModuleOptions>>
|
|
|
113
113
|
transformDependencies: string[];
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export interface ModuleJSON extends TransformModuleJSON {
|
|
116
|
+
export interface ModuleJSON extends TransformModuleJSON, ModuleOptions {
|
|
117
117
|
ast: AcornNode;
|
|
118
118
|
dependencies: string[];
|
|
119
119
|
id: string;
|
|
@@ -169,6 +169,7 @@ interface ModuleInfo {
|
|
|
169
169
|
importers: readonly string[];
|
|
170
170
|
isEntry: boolean;
|
|
171
171
|
isExternal: boolean;
|
|
172
|
+
isIncluded: boolean | null;
|
|
172
173
|
meta: CustomPluginOptions;
|
|
173
174
|
syntheticNamedExports: boolean | string;
|
|
174
175
|
}
|
|
@@ -241,6 +242,18 @@ export type ResolveIdHook = (
|
|
|
241
242
|
options: { custom?: CustomPluginOptions; isEntry: boolean }
|
|
242
243
|
) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
243
244
|
|
|
245
|
+
export type ShouldTransformCachedModuleHook = (
|
|
246
|
+
this: PluginContext,
|
|
247
|
+
options: {
|
|
248
|
+
ast: AcornNode;
|
|
249
|
+
code: string;
|
|
250
|
+
id: string;
|
|
251
|
+
meta: CustomPluginOptions;
|
|
252
|
+
moduleSideEffects: boolean | 'no-treeshake';
|
|
253
|
+
syntheticNamedExports: boolean | string;
|
|
254
|
+
}
|
|
255
|
+
) => Promise<boolean> | boolean;
|
|
256
|
+
|
|
244
257
|
export type IsExternal = (
|
|
245
258
|
source: string,
|
|
246
259
|
importer: string | undefined,
|
|
@@ -366,6 +379,7 @@ export interface PluginHooks extends OutputPluginHooks {
|
|
|
366
379
|
) => Promise<InputOptions | null | undefined> | InputOptions | null | undefined;
|
|
367
380
|
resolveDynamicImport: ResolveDynamicImportHook;
|
|
368
381
|
resolveId: ResolveIdHook;
|
|
382
|
+
shouldTransformCachedModule: ShouldTransformCachedModuleHook;
|
|
369
383
|
transform: TransformHook;
|
|
370
384
|
watchChange: WatchChangeHook;
|
|
371
385
|
}
|
|
@@ -418,6 +432,7 @@ export type AsyncPluginHooks =
|
|
|
418
432
|
| 'renderStart'
|
|
419
433
|
| 'resolveDynamicImport'
|
|
420
434
|
| 'resolveId'
|
|
435
|
+
| 'shouldTransformCachedModule'
|
|
421
436
|
| 'transform'
|
|
422
437
|
| 'writeBundle'
|
|
423
438
|
| 'closeBundle';
|
|
@@ -433,7 +448,8 @@ export type FirstPluginHooks =
|
|
|
433
448
|
| 'resolveDynamicImport'
|
|
434
449
|
| 'resolveFileUrl'
|
|
435
450
|
| 'resolveId'
|
|
436
|
-
| 'resolveImportMeta'
|
|
451
|
+
| 'resolveImportMeta'
|
|
452
|
+
| 'shouldTransformCachedModule';
|
|
437
453
|
|
|
438
454
|
export type SequentialPluginHooks =
|
|
439
455
|
| 'augmentChunkHash'
|
package/dist/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.64.0
|
|
4
|
+
Fri, 14 Jan 2022 14:02:32 GMT - commit 82a3e2634a9d51b5040752e4fb2fd264651d504e
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -14,6 +14,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
14
14
|
|
|
15
15
|
const rollup = require('./shared/rollup.js');
|
|
16
16
|
require('path');
|
|
17
|
+
require('process');
|
|
18
|
+
require('perf_hooks');
|
|
17
19
|
require('crypto');
|
|
18
20
|
require('fs');
|
|
19
21
|
require('events');
|
package/dist/shared/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.64.0
|
|
4
|
+
Fri, 14 Jan 2022 14:02:32 GMT - commit 82a3e2634a9d51b5040752e4fb2fd264651d504e
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
const require$$0$
|
|
13
|
+
const require$$0$2 = require('events');
|
|
14
14
|
const fs$4 = require('fs');
|
|
15
|
-
const
|
|
15
|
+
const require$$0$1 = require('path');
|
|
16
16
|
const require$$2 = require('util');
|
|
17
17
|
const require$$1 = require('stream');
|
|
18
18
|
const rollup = require('./rollup.js');
|
|
@@ -22,7 +22,7 @@ var chokidar$1 = {};
|
|
|
22
22
|
|
|
23
23
|
const fs$3 = fs$4;
|
|
24
24
|
const { Readable } = require$$1;
|
|
25
|
-
const sysPath$3 =
|
|
25
|
+
const sysPath$3 = require$$0$1;
|
|
26
26
|
const { promisify: promisify$3 } = require$$2;
|
|
27
27
|
const picomatch$1 = rollup.picomatch;
|
|
28
28
|
|
|
@@ -620,7 +620,7 @@ var isGlob$2 = function isGlob(str, options) {
|
|
|
620
620
|
};
|
|
621
621
|
|
|
622
622
|
var isGlob$1 = isGlob$2;
|
|
623
|
-
var pathPosixDirname =
|
|
623
|
+
var pathPosixDirname = require$$0$1.posix.dirname;
|
|
624
624
|
var isWin32 = require$$2$1.platform() === 'win32';
|
|
625
625
|
|
|
626
626
|
var slash = '/';
|
|
@@ -2343,7 +2343,7 @@ const require$$0 = [
|
|
|
2343
2343
|
|
|
2344
2344
|
var binaryExtensions$1 = require$$0;
|
|
2345
2345
|
|
|
2346
|
-
const path =
|
|
2346
|
+
const path = require$$0$1;
|
|
2347
2347
|
const binaryExtensions = binaryExtensions$1;
|
|
2348
2348
|
|
|
2349
2349
|
const extensions = new Set(binaryExtensions);
|
|
@@ -2354,7 +2354,7 @@ var constants = {};
|
|
|
2354
2354
|
|
|
2355
2355
|
(function (exports) {
|
|
2356
2356
|
|
|
2357
|
-
const {sep} =
|
|
2357
|
+
const {sep} = require$$0$1;
|
|
2358
2358
|
const {platform} = process;
|
|
2359
2359
|
const os = require$$2$1;
|
|
2360
2360
|
|
|
@@ -2420,7 +2420,7 @@ exports.isIBMi = os.type() === 'OS400';
|
|
|
2420
2420
|
}(constants));
|
|
2421
2421
|
|
|
2422
2422
|
const fs$2 = fs$4;
|
|
2423
|
-
const sysPath$2 =
|
|
2423
|
+
const sysPath$2 = require$$0$1;
|
|
2424
2424
|
const { promisify: promisify$2 } = require$$2;
|
|
2425
2425
|
const isBinaryPath = isBinaryPath$1;
|
|
2426
2426
|
const {
|
|
@@ -3056,13 +3056,15 @@ var nodefsHandler = NodeFsHandler$1;
|
|
|
3056
3056
|
|
|
3057
3057
|
var fseventsHandler = {exports: {}};
|
|
3058
3058
|
|
|
3059
|
+
const require$$3 = /*@__PURE__*/rollup.getAugmentedNamespace(rollup.fseventsImporter);
|
|
3060
|
+
|
|
3059
3061
|
const fs$1 = fs$4;
|
|
3060
|
-
const sysPath$1 =
|
|
3062
|
+
const sysPath$1 = require$$0$1;
|
|
3061
3063
|
const { promisify: promisify$1 } = require$$2;
|
|
3062
3064
|
|
|
3063
3065
|
let fsevents;
|
|
3064
3066
|
try {
|
|
3065
|
-
fsevents = require
|
|
3067
|
+
fsevents = require$$3.getFsEvents();
|
|
3066
3068
|
} catch (error) {
|
|
3067
3069
|
if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error);
|
|
3068
3070
|
}
|
|
@@ -3579,9 +3581,9 @@ async _addToFsEvents(path, transform, forceAdd, priorDepth) {
|
|
|
3579
3581
|
fseventsHandler.exports = FsEventsHandler$1;
|
|
3580
3582
|
fseventsHandler.exports.canUse = canUse;
|
|
3581
3583
|
|
|
3582
|
-
const { EventEmitter } = require$$0$
|
|
3584
|
+
const { EventEmitter } = require$$0$2;
|
|
3583
3585
|
const fs = fs$4;
|
|
3584
|
-
const sysPath =
|
|
3586
|
+
const sysPath = require$$0$1;
|
|
3585
3587
|
const { promisify } = require$$2;
|
|
3586
3588
|
const readdirp = readdirp_1;
|
|
3587
3589
|
const anymatch = anymatch$2.exports.default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.64.0
|
|
4
|
+
Fri, 14 Jan 2022 14:02:32 GMT - commit 82a3e2634a9d51b5040752e4fb2fd264651d504e
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
13
|
const fs = require('fs');
|
|
14
|
-
const
|
|
14
|
+
const require$$0 = require('path');
|
|
15
15
|
const url = require('url');
|
|
16
16
|
const process$1 = require('process');
|
|
17
17
|
const tty = require('tty');
|
|
@@ -29,8 +29,7 @@ function _interopNamespaceDefault(e) {
|
|
|
29
29
|
return n;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
32
|
+
const require$$0__namespace = /*#__PURE__*/_interopNamespaceDefault(require$$0);
|
|
34
33
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
35
34
|
|
|
36
35
|
const env = process.env || {};
|
|
@@ -144,7 +143,7 @@ const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({
|
|
|
144
143
|
});
|
|
145
144
|
|
|
146
145
|
// log to stderr to keep `rollup main.js > bundle.js` from breaking
|
|
147
|
-
const stderr =
|
|
146
|
+
const stderr = (...args) => process.stderr.write(`${args.join('')}\n`);
|
|
148
147
|
function handleError(err, recover = false) {
|
|
149
148
|
let description = err.message || err;
|
|
150
149
|
if (err.name)
|
|
@@ -506,7 +505,7 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
|
|
506
505
|
if (!plugin) {
|
|
507
506
|
try {
|
|
508
507
|
if (pluginText[0] == '.')
|
|
509
|
-
pluginText =
|
|
508
|
+
pluginText = require$$0__namespace.resolve(pluginText);
|
|
510
509
|
plugin = await requireOrImport(pluginText);
|
|
511
510
|
}
|
|
512
511
|
catch (err) {
|
|
@@ -564,7 +563,7 @@ async function loadAndParseConfigFile(fileName, commandOptions = {}) {
|
|
|
564
563
|
}
|
|
565
564
|
}
|
|
566
565
|
async function loadConfigFile(fileName, commandOptions) {
|
|
567
|
-
const extension =
|
|
566
|
+
const extension = require$$0.extname(fileName);
|
|
568
567
|
const configFileExport = commandOptions.configPlugin ||
|
|
569
568
|
!(extension === '.cjs' || (extension === '.mjs' && supportsNativeESM()))
|
|
570
569
|
? await getDefaultFromTranspiledConfigFile(fileName, commandOptions)
|
|
@@ -579,7 +578,7 @@ function getDefaultFromCjs(namespace) {
|
|
|
579
578
|
async function getDefaultFromTranspiledConfigFile(fileName, commandOptions) {
|
|
580
579
|
const warnings = batchWarnings();
|
|
581
580
|
const inputOptions = {
|
|
582
|
-
external: (id) => (id[0] !== '.' && !
|
|
581
|
+
external: (id) => (id[0] !== '.' && !require$$0.isAbsolute(id)) || id.slice(-5, id.length) === '.json',
|
|
583
582
|
input: fileName,
|
|
584
583
|
onwarn: warnings.add,
|
|
585
584
|
plugins: [],
|
|
@@ -611,8 +610,8 @@ async function getDefaultFromTranspiledConfigFile(fileName, commandOptions) {
|
|
|
611
610
|
return loadConfigFromBundledFile(fileName, code);
|
|
612
611
|
}
|
|
613
612
|
async function loadConfigFromBundledFile(fileName, bundledCode) {
|
|
614
|
-
const resolvedFileName =
|
|
615
|
-
const extension =
|
|
613
|
+
const resolvedFileName = fs.realpathSync(fileName);
|
|
614
|
+
const extension = require$$0.extname(resolvedFileName);
|
|
616
615
|
const defaultLoader = require.extensions[extension];
|
|
617
616
|
require.extensions[extension] = (module, requiredFileName) => {
|
|
618
617
|
if (requiredFileName === resolvedFileName) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.64.0
|
|
4
|
+
Fri, 14 Jan 2022 14:02:32 GMT - commit 82a3e2634a9d51b5040752e4fb2fd264651d504e
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -85,7 +85,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
85
85
|
shimMissingExports: getOption('shimMissingExports'),
|
|
86
86
|
strictDeprecations: getOption('strictDeprecations'),
|
|
87
87
|
treeshake: getObjectOption(config, overrides, 'treeshake', rollup.objectifyOptionWithPresets(rollup.treeshakePresets, 'treeshake', 'false, true, ')),
|
|
88
|
-
watch: getWatch(config, overrides
|
|
88
|
+
watch: getWatch(config, overrides)
|
|
89
89
|
};
|
|
90
90
|
rollup.warnUnknownOptions(config, Object.keys(inputOptions), 'input options', inputOptions.onwarn, /^output$/);
|
|
91
91
|
return inputOptions;
|
|
@@ -99,7 +99,7 @@ const getExternal = (config, overrides) => {
|
|
|
99
99
|
const getOnWarn = (config, defaultOnWarnHandler) => config.onwarn
|
|
100
100
|
? warning => config.onwarn(warning, defaultOnWarnHandler)
|
|
101
101
|
: defaultOnWarnHandler;
|
|
102
|
-
const getObjectOption = (config, overrides, name, objectifyValue =
|
|
102
|
+
const getObjectOption = (config, overrides, name, objectifyValue = rollup.objectifyOption) => {
|
|
103
103
|
const commandOption = normalizeObjectOptionValue(overrides[name], objectifyValue);
|
|
104
104
|
const configOption = normalizeObjectOptionValue(config[name], objectifyValue);
|
|
105
105
|
if (commandOption !== undefined) {
|
|
@@ -107,7 +107,13 @@ const getObjectOption = (config, overrides, name, objectifyValue = value => (typ
|
|
|
107
107
|
}
|
|
108
108
|
return configOption;
|
|
109
109
|
};
|
|
110
|
-
const getWatch = (config, overrides
|
|
110
|
+
const getWatch = (config, overrides) => config.watch !== false && getObjectOption(config, overrides, 'watch');
|
|
111
|
+
const isWatchEnabled = (optionValue) => {
|
|
112
|
+
if (Array.isArray(optionValue)) {
|
|
113
|
+
return optionValue.reduce((result, value) => (typeof value === 'boolean' ? value : result), false);
|
|
114
|
+
}
|
|
115
|
+
return optionValue === true;
|
|
116
|
+
};
|
|
111
117
|
const normalizeObjectOptionValue = (optionValue, objectifyValue) => {
|
|
112
118
|
if (!optionValue) {
|
|
113
119
|
return optionValue;
|
|
@@ -168,5 +174,6 @@ function mergeOutputOptions(config, overrides, warn) {
|
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
exports.commandAliases = commandAliases;
|
|
177
|
+
exports.isWatchEnabled = isWatchEnabled;
|
|
171
178
|
exports.mergeOptions = mergeOptions;
|
|
172
179
|
//# sourceMappingURL=mergeOptions.js.map
|