rollup 2.62.0 → 2.66.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 +82 -1
- package/LICENSE.md +0 -7
- package/dist/bin/rollup +14 -68
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +4 -2
- package/dist/es/shared/rollup.js +350 -234
- package/dist/es/shared/watch.js +28 -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 +24 -4
- package/dist/rollup.js +4 -2
- package/dist/shared/index.js +21 -13
- package/dist/shared/loadConfigFile.js +10 -11
- package/dist/shared/mergeOptions.js +12 -5
- package/dist/shared/rollup.js +397 -280
- package/dist/shared/watch-cli.js +21 -30
- package/dist/shared/watch.js +8 -18
- package/package.json +19 -21
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;
|
|
@@ -160,11 +160,14 @@ interface ModuleInfo {
|
|
|
160
160
|
ast: AcornNode | null;
|
|
161
161
|
code: string | null;
|
|
162
162
|
dynamicImporters: readonly string[];
|
|
163
|
+
dynamicallyImportedIdResolutions: readonly ResolvedId[];
|
|
163
164
|
dynamicallyImportedIds: readonly string[];
|
|
165
|
+
hasDefaultExport: boolean | null;
|
|
164
166
|
hasModuleSideEffects: boolean | 'no-treeshake';
|
|
165
167
|
id: string;
|
|
166
168
|
implicitlyLoadedAfterOneOf: readonly string[];
|
|
167
169
|
implicitlyLoadedBefore: readonly string[];
|
|
170
|
+
importedIdResolutions: readonly ResolvedId[];
|
|
168
171
|
importedIds: readonly string[];
|
|
169
172
|
importers: readonly string[];
|
|
170
173
|
isEntry: boolean;
|
|
@@ -199,7 +202,9 @@ export interface PluginContext extends MinimalPluginContext {
|
|
|
199
202
|
getWatchFiles: () => string[];
|
|
200
203
|
/** @deprecated Use `this.resolve` instead */
|
|
201
204
|
isExternal: IsExternal;
|
|
202
|
-
load: (
|
|
205
|
+
load: (
|
|
206
|
+
options: { id: string; resolveDependencies?: boolean } & Partial<PartialNull<ModuleOptions>>
|
|
207
|
+
) => Promise<ModuleInfo>;
|
|
203
208
|
/** @deprecated Use `this.getModuleIds` instead */
|
|
204
209
|
moduleIds: IterableIterator<string>;
|
|
205
210
|
parse: (input: string, options?: any) => AcornNode;
|
|
@@ -242,6 +247,18 @@ export type ResolveIdHook = (
|
|
|
242
247
|
options: { custom?: CustomPluginOptions; isEntry: boolean }
|
|
243
248
|
) => Promise<ResolveIdResult> | ResolveIdResult;
|
|
244
249
|
|
|
250
|
+
export type ShouldTransformCachedModuleHook = (
|
|
251
|
+
this: PluginContext,
|
|
252
|
+
options: {
|
|
253
|
+
ast: AcornNode;
|
|
254
|
+
code: string;
|
|
255
|
+
id: string;
|
|
256
|
+
meta: CustomPluginOptions;
|
|
257
|
+
moduleSideEffects: boolean | 'no-treeshake';
|
|
258
|
+
syntheticNamedExports: boolean | string;
|
|
259
|
+
}
|
|
260
|
+
) => Promise<boolean> | boolean;
|
|
261
|
+
|
|
245
262
|
export type IsExternal = (
|
|
246
263
|
source: string,
|
|
247
264
|
importer: string | undefined,
|
|
@@ -367,6 +384,7 @@ export interface PluginHooks extends OutputPluginHooks {
|
|
|
367
384
|
) => Promise<InputOptions | null | undefined> | InputOptions | null | undefined;
|
|
368
385
|
resolveDynamicImport: ResolveDynamicImportHook;
|
|
369
386
|
resolveId: ResolveIdHook;
|
|
387
|
+
shouldTransformCachedModule: ShouldTransformCachedModuleHook;
|
|
370
388
|
transform: TransformHook;
|
|
371
389
|
watchChange: WatchChangeHook;
|
|
372
390
|
}
|
|
@@ -419,6 +437,7 @@ export type AsyncPluginHooks =
|
|
|
419
437
|
| 'renderStart'
|
|
420
438
|
| 'resolveDynamicImport'
|
|
421
439
|
| 'resolveId'
|
|
440
|
+
| 'shouldTransformCachedModule'
|
|
422
441
|
| 'transform'
|
|
423
442
|
| 'writeBundle'
|
|
424
443
|
| 'closeBundle';
|
|
@@ -434,7 +453,8 @@ export type FirstPluginHooks =
|
|
|
434
453
|
| 'resolveDynamicImport'
|
|
435
454
|
| 'resolveFileUrl'
|
|
436
455
|
| 'resolveId'
|
|
437
|
-
| 'resolveImportMeta'
|
|
456
|
+
| 'resolveImportMeta'
|
|
457
|
+
| 'shouldTransformCachedModule';
|
|
438
458
|
|
|
439
459
|
export type SequentialPluginHooks =
|
|
440
460
|
| 'augmentChunkHash'
|
package/dist/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.66.0
|
|
4
|
+
Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
|
|
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.66.0
|
|
4
|
+
Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
|
|
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 {
|
|
@@ -2830,7 +2830,15 @@ async _handleSymlink(entry, directory, path, item) {
|
|
|
2830
2830
|
if (!this.fsw.options.followSymlinks) {
|
|
2831
2831
|
// watch symlink directly (don't follow) and detect changes
|
|
2832
2832
|
this.fsw._incrReadyCount();
|
|
2833
|
-
|
|
2833
|
+
|
|
2834
|
+
let linkPath;
|
|
2835
|
+
try {
|
|
2836
|
+
linkPath = await fsrealpath(path);
|
|
2837
|
+
} catch (e) {
|
|
2838
|
+
this.fsw._emitReady();
|
|
2839
|
+
return true;
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2834
2842
|
if (this.fsw.closed) return;
|
|
2835
2843
|
if (dir.has(item)) {
|
|
2836
2844
|
if (this.fsw._symlinkPaths.get(full) !== linkPath) {
|
|
@@ -3059,7 +3067,7 @@ var fseventsHandler = {exports: {}};
|
|
|
3059
3067
|
const require$$3 = /*@__PURE__*/rollup.getAugmentedNamespace(rollup.fseventsImporter);
|
|
3060
3068
|
|
|
3061
3069
|
const fs$1 = fs$4;
|
|
3062
|
-
const sysPath$1 =
|
|
3070
|
+
const sysPath$1 = require$$0$1;
|
|
3063
3071
|
const { promisify: promisify$1 } = require$$2;
|
|
3064
3072
|
|
|
3065
3073
|
let fsevents;
|
|
@@ -3581,9 +3589,9 @@ async _addToFsEvents(path, transform, forceAdd, priorDepth) {
|
|
|
3581
3589
|
fseventsHandler.exports = FsEventsHandler$1;
|
|
3582
3590
|
fseventsHandler.exports.canUse = canUse;
|
|
3583
3591
|
|
|
3584
|
-
const { EventEmitter } = require$$0$
|
|
3592
|
+
const { EventEmitter } = require$$0$2;
|
|
3585
3593
|
const fs = fs$4;
|
|
3586
|
-
const sysPath =
|
|
3594
|
+
const sysPath = require$$0$1;
|
|
3587
3595
|
const { promisify } = require$$2;
|
|
3588
3596
|
const readdirp = readdirp_1;
|
|
3589
3597
|
const anymatch = anymatch$2.exports.default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.66.0
|
|
4
|
+
Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
|
|
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.66.0
|
|
4
|
+
Sat, 22 Jan 2022 06:33:58 GMT - commit 3ca594eb98846b6bca32a0280931b8356c522e0d
|
|
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
|