rollup 4.42.0 → 4.43.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/dist/bin/rollup +2 -2
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +39 -20
- package/dist/es/shared/parseAst.js +3 -3
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +76 -0
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +3 -3
- package/dist/shared/rollup.js +53 -21
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +22 -21
package/dist/bin/rollup
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
3
|
@license
|
|
4
|
-
Rollup.js v4.
|
|
5
|
-
|
|
4
|
+
Rollup.js v4.43.0
|
|
5
|
+
Wed, 11 Jun 2025 05:22:04 GMT - commit 72858cb1474b81c91902794ab7d28c79f34b8ca8
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
package/dist/es/getLogFilter.js
CHANGED
package/dist/es/parseAst.js
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.43.0
|
|
4
|
+
Wed, 11 Jun 2025 05:22:04 GMT - commit 72858cb1474b81c91902794ab7d28c79f34b8ca8
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -13,9 +13,21 @@ import { posix, isAbsolute, resolve, win32 } from 'path';
|
|
|
13
13
|
import { parseAsync, xxhashBase16, xxhashBase64Url, xxhashBase36 } from '../../native.js';
|
|
14
14
|
import process$1, { env } from 'node:process';
|
|
15
15
|
import { performance } from 'node:perf_hooks';
|
|
16
|
-
import
|
|
16
|
+
import * as promises from 'node:fs/promises';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function _mergeNamespaces(n, m) {
|
|
19
|
+
for (var i = 0; i < m.length; i++) {
|
|
20
|
+
const e = m[i];
|
|
21
|
+
if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
|
|
22
|
+
if (k !== 'default' && !(k in n)) {
|
|
23
|
+
n[k] = e[k];
|
|
24
|
+
}
|
|
25
|
+
} }
|
|
26
|
+
}
|
|
27
|
+
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var version = "4.43.0";
|
|
19
31
|
|
|
20
32
|
const comma = ','.charCodeAt(0);
|
|
21
33
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -20616,7 +20628,7 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
|
|
20616
20628
|
return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { attributes, custom: customOptions, isEntry }], replaceContext, skipped);
|
|
20617
20629
|
}
|
|
20618
20630
|
|
|
20619
|
-
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes) {
|
|
20631
|
+
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes, fs) {
|
|
20620
20632
|
const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes);
|
|
20621
20633
|
if (pluginResult != null) {
|
|
20622
20634
|
const [resolveIdResult, plugin] = pluginResult;
|
|
@@ -20642,22 +20654,22 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
|
|
|
20642
20654
|
// absolute path is created. Absolute importees therefore shortcircuit the
|
|
20643
20655
|
// resolve call and require no special handing on our part.
|
|
20644
20656
|
// See https://nodejs.org/api/path.html#path_path_resolve_paths
|
|
20645
|
-
return addJsExtensionIfNecessary(importer ? resolve$1(dirname(importer), source) : resolve$1(source), preserveSymlinks);
|
|
20657
|
+
return addJsExtensionIfNecessary(importer ? resolve$1(dirname(importer), source) : resolve$1(source), preserveSymlinks, fs);
|
|
20646
20658
|
}
|
|
20647
|
-
async function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
|
20648
|
-
return ((await findFile(file, preserveSymlinks)) ??
|
|
20649
|
-
(await findFile(file + '.mjs', preserveSymlinks)) ??
|
|
20650
|
-
(await findFile(file + '.js', preserveSymlinks)));
|
|
20659
|
+
async function addJsExtensionIfNecessary(file, preserveSymlinks, fs) {
|
|
20660
|
+
return ((await findFile(file, preserveSymlinks, fs)) ??
|
|
20661
|
+
(await findFile(file + '.mjs', preserveSymlinks, fs)) ??
|
|
20662
|
+
(await findFile(file + '.js', preserveSymlinks, fs)));
|
|
20651
20663
|
}
|
|
20652
|
-
async function findFile(file, preserveSymlinks) {
|
|
20664
|
+
async function findFile(file, preserveSymlinks, fs) {
|
|
20653
20665
|
try {
|
|
20654
|
-
const stats = await lstat(file);
|
|
20666
|
+
const stats = await fs.lstat(file);
|
|
20655
20667
|
if (!preserveSymlinks && stats.isSymbolicLink())
|
|
20656
|
-
return await findFile(await realpath(file), preserveSymlinks);
|
|
20668
|
+
return await findFile(await fs.realpath(file), preserveSymlinks, fs);
|
|
20657
20669
|
if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
|
|
20658
20670
|
// check case
|
|
20659
20671
|
const name = basename(file);
|
|
20660
|
-
const files = await readdir(dirname(file));
|
|
20672
|
+
const files = await fs.readdir(dirname(file));
|
|
20661
20673
|
if (files.includes(name))
|
|
20662
20674
|
return file;
|
|
20663
20675
|
}
|
|
@@ -21053,7 +21065,7 @@ class ModuleLoader {
|
|
|
21053
21065
|
this.nextEntryModuleIndex = 0;
|
|
21054
21066
|
this.resolveId = async (source, importer, customOptions, isEntry, attributes, skip = null) => this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
|
|
21055
21067
|
? false
|
|
21056
|
-
: await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer, attributes), importer, source), attributes);
|
|
21068
|
+
: await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer, attributes, this.options.fs), importer, source), attributes);
|
|
21057
21069
|
this.hasModuleSideEffects = options.treeshake
|
|
21058
21070
|
? options.treeshake.moduleSideEffects
|
|
21059
21071
|
: () => true;
|
|
@@ -21144,7 +21156,7 @@ class ModuleLoader {
|
|
|
21144
21156
|
if (content !== null)
|
|
21145
21157
|
return content;
|
|
21146
21158
|
this.graph.watchFiles[id] = true;
|
|
21147
|
-
return await readFile(id, 'utf8');
|
|
21159
|
+
return (await this.options.fs.readFile(id, { encoding: 'utf8' }));
|
|
21148
21160
|
});
|
|
21149
21161
|
}
|
|
21150
21162
|
catch (error_) {
|
|
@@ -21412,7 +21424,7 @@ class ModuleLoader {
|
|
|
21412
21424
|
return resolvedId;
|
|
21413
21425
|
}
|
|
21414
21426
|
async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore, isLoadForManualChunks = false) {
|
|
21415
|
-
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT, true, EMPTY_OBJECT);
|
|
21427
|
+
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT, true, EMPTY_OBJECT, this.options.fs);
|
|
21416
21428
|
if (resolveIdResult == null) {
|
|
21417
21429
|
return error(implicitlyLoadedBefore === null
|
|
21418
21430
|
? logUnresolvedEntry(unresolvedId)
|
|
@@ -21934,6 +21946,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
21934
21946
|
error(error_) {
|
|
21935
21947
|
return error(logPluginError(normalizeLog(error_), plugin.name));
|
|
21936
21948
|
},
|
|
21949
|
+
fs: options.fs,
|
|
21937
21950
|
getFileName: fileEmitter.getFileName,
|
|
21938
21951
|
getModuleIds: () => graph.modulesById.keys(),
|
|
21939
21952
|
getModuleInfo: graph.getModuleInfo,
|
|
@@ -22653,6 +22666,10 @@ function getLogger(plugins, onLog, watchMode, logLevel) {
|
|
|
22653
22666
|
return logger;
|
|
22654
22667
|
}
|
|
22655
22668
|
|
|
22669
|
+
const fs = /*#__PURE__*/_mergeNamespaces({
|
|
22670
|
+
__proto__: null
|
|
22671
|
+
}, [promises]);
|
|
22672
|
+
|
|
22656
22673
|
async function normalizeInputOptions(config, watchMode) {
|
|
22657
22674
|
// These are options that may trigger special warnings or behaviour later
|
|
22658
22675
|
// if the user did not select an explicit value
|
|
@@ -22669,6 +22686,7 @@ async function normalizeInputOptions(config, watchMode) {
|
|
|
22669
22686
|
experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10,
|
|
22670
22687
|
experimentalLogSideEffects: config.experimentalLogSideEffects || false,
|
|
22671
22688
|
external: getIdMatcher(config.external),
|
|
22689
|
+
fs: config.fs ?? fs,
|
|
22672
22690
|
input: getInput(config),
|
|
22673
22691
|
jsx: getJsx(config),
|
|
22674
22692
|
logLevel,
|
|
@@ -23236,7 +23254,7 @@ async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, raw
|
|
|
23236
23254
|
if (!outputOptions.dir && !outputOptions.file) {
|
|
23237
23255
|
return error(logMissingFileOrDirOption());
|
|
23238
23256
|
}
|
|
23239
|
-
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
|
|
23257
|
+
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions, inputOptions))));
|
|
23240
23258
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23241
23259
|
timeEnd('WRITE', 1);
|
|
23242
23260
|
}
|
|
@@ -23285,7 +23303,7 @@ function getSortingFileType(file) {
|
|
|
23285
23303
|
}
|
|
23286
23304
|
return SortingFileType.SECONDARY_CHUNK;
|
|
23287
23305
|
}
|
|
23288
|
-
async function writeOutputFile(outputFile, outputOptions) {
|
|
23306
|
+
async function writeOutputFile(outputFile, outputOptions, { fs: { mkdir, writeFile } }) {
|
|
23289
23307
|
const fileName = resolve$1(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
|
|
23290
23308
|
// 'recursive: true' does not throw if the folder structure, or parts of it, already exist
|
|
23291
23309
|
await mkdir(dirname(fileName), { recursive: true });
|
|
@@ -23466,7 +23484,7 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
|
|
23466
23484
|
outputOptionsArray.push({});
|
|
23467
23485
|
const outputOptions = await Promise.all(outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, log)));
|
|
23468
23486
|
warnUnknownOptions(command, [
|
|
23469
|
-
...Object.keys(inputOptions),
|
|
23487
|
+
...Object.keys(inputOptions).filter(option => option !== 'fs'),
|
|
23470
23488
|
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapIgnoreList' && option !== 'sourcemapPathTransform'),
|
|
23471
23489
|
...Object.keys(commandAliases),
|
|
23472
23490
|
'bundleConfigAsCjs',
|
|
@@ -23512,6 +23530,7 @@ function mergeInputOptions(config, overrides, plugins, log, onLog) {
|
|
|
23512
23530
|
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
|
|
23513
23531
|
experimentalLogSideEffects: getOption('experimentalLogSideEffects'),
|
|
23514
23532
|
external: getExternal(config, overrides),
|
|
23533
|
+
fs: getOption('fs'),
|
|
23515
23534
|
input: getOption('input') || [],
|
|
23516
23535
|
jsx: getObjectOption(config, overrides, 'jsx', objectifyOptionWithPresets(jsxPresets, 'jsx', URL_JSX, 'false, ')),
|
|
23517
23536
|
logLevel: getOption('logLevel'),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.43.0
|
|
4
|
+
Wed, 11 Jun 2025 05:22:04 GMT - commit 72858cb1474b81c91902794ab7d28c79f34b8ca8
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -894,7 +894,7 @@ function logRedeclarationError(name) {
|
|
|
894
894
|
function logReservedNamespace(namespace) {
|
|
895
895
|
return {
|
|
896
896
|
code: RESERVED_NAMESPACE,
|
|
897
|
-
message: `You have
|
|
897
|
+
message: `You have overridden reserved namespace "${namespace}"`
|
|
898
898
|
};
|
|
899
899
|
}
|
|
900
900
|
function logModuleParseError(error, moduleId) {
|
package/dist/es/shared/watch.js
CHANGED
package/dist/getLogFilter.js
CHANGED
package/dist/loadConfigFile.js
CHANGED
package/dist/parseAst.js
CHANGED
package/dist/rollup.d.ts
CHANGED
|
@@ -244,6 +244,7 @@ export interface PluginContext extends MinimalPluginContext {
|
|
|
244
244
|
debug: LoggingFunction;
|
|
245
245
|
emitFile: EmitFile;
|
|
246
246
|
error: (error: RollupError | string) => never;
|
|
247
|
+
fs: RollupFsModule;
|
|
247
248
|
getFileName: (fileReferenceId: string) => string;
|
|
248
249
|
getModuleIds: () => IterableIterator<string>;
|
|
249
250
|
getModuleInfo: GetModuleInfo;
|
|
@@ -671,6 +672,7 @@ export interface InputOptions {
|
|
|
671
672
|
experimentalCacheExpiry?: number;
|
|
672
673
|
experimentalLogSideEffects?: boolean;
|
|
673
674
|
external?: ExternalOption;
|
|
675
|
+
fs?: RollupFsModule;
|
|
674
676
|
input?: InputOption;
|
|
675
677
|
jsx?: false | JsxPreset | JsxOptions;
|
|
676
678
|
logLevel?: LogLevelOption;
|
|
@@ -699,6 +701,7 @@ export interface NormalizedInputOptions {
|
|
|
699
701
|
experimentalCacheExpiry: number;
|
|
700
702
|
experimentalLogSideEffects: boolean;
|
|
701
703
|
external: IsExternal;
|
|
704
|
+
fs: RollupFsModule;
|
|
702
705
|
input: string[] | Record<string, string>;
|
|
703
706
|
jsx: false | NormalizedJsxOptions;
|
|
704
707
|
logLevel: LogLevelOption;
|
|
@@ -1103,3 +1106,76 @@ export function defineConfig(optionsFunction: RollupOptionsFunction): RollupOpti
|
|
|
1103
1106
|
export type RollupOptionsFunction = (
|
|
1104
1107
|
commandLineArguments: Record<string, any>
|
|
1105
1108
|
) => MaybePromise<RollupOptions | RollupOptions[]>;
|
|
1109
|
+
|
|
1110
|
+
export interface RollupFsModule {
|
|
1111
|
+
appendFile(
|
|
1112
|
+
path: string,
|
|
1113
|
+
data: string | Uint8Array,
|
|
1114
|
+
options?: { encoding?: BufferEncoding | null; mode?: string | number; flag?: string | number }
|
|
1115
|
+
): Promise<void>;
|
|
1116
|
+
|
|
1117
|
+
copyFile(source: string, destination: string, mode?: string | number): Promise<void>;
|
|
1118
|
+
|
|
1119
|
+
mkdir(path: string, options?: { recursive?: boolean; mode?: string | number }): Promise<void>;
|
|
1120
|
+
|
|
1121
|
+
mkdtemp(prefix: string): Promise<string>;
|
|
1122
|
+
|
|
1123
|
+
readdir(path: string, options?: { withFileTypes?: false }): Promise<string[]>;
|
|
1124
|
+
readdir(path: string, options?: { withFileTypes: true }): Promise<RollupDirectoryEntry[]>;
|
|
1125
|
+
|
|
1126
|
+
readFile(
|
|
1127
|
+
path: string,
|
|
1128
|
+
options?: { encoding?: null; flag?: string | number; signal?: AbortSignal }
|
|
1129
|
+
): Promise<Uint8Array>;
|
|
1130
|
+
readFile(
|
|
1131
|
+
path: string,
|
|
1132
|
+
options?: { encoding: BufferEncoding; flag?: string | number; signal?: AbortSignal }
|
|
1133
|
+
): Promise<string>;
|
|
1134
|
+
|
|
1135
|
+
realpath(path: string): Promise<string>;
|
|
1136
|
+
|
|
1137
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
1138
|
+
|
|
1139
|
+
rmdir(path: string, options?: { recursive?: boolean }): Promise<void>;
|
|
1140
|
+
|
|
1141
|
+
stat(path: string): Promise<RollupFileStats>;
|
|
1142
|
+
|
|
1143
|
+
lstat(path: string): Promise<RollupFileStats>;
|
|
1144
|
+
|
|
1145
|
+
unlink(path: string): Promise<void>;
|
|
1146
|
+
|
|
1147
|
+
writeFile(
|
|
1148
|
+
path: string,
|
|
1149
|
+
data: string | Uint8Array,
|
|
1150
|
+
options?: { encoding?: BufferEncoding | null; mode?: string | number; flag?: string | number }
|
|
1151
|
+
): Promise<void>;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
export type BufferEncoding =
|
|
1155
|
+
| 'ascii'
|
|
1156
|
+
| 'utf8'
|
|
1157
|
+
| 'utf16le'
|
|
1158
|
+
| 'ucs2'
|
|
1159
|
+
| 'base64'
|
|
1160
|
+
| 'base64url'
|
|
1161
|
+
| 'latin1'
|
|
1162
|
+
| 'binary'
|
|
1163
|
+
| 'hex';
|
|
1164
|
+
|
|
1165
|
+
export interface RollupDirectoryEntry {
|
|
1166
|
+
isFile(): boolean;
|
|
1167
|
+
isDirectory(): boolean;
|
|
1168
|
+
isSymbolicLink(): boolean;
|
|
1169
|
+
name: string;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
export interface RollupFileStats {
|
|
1173
|
+
isFile(): boolean;
|
|
1174
|
+
isDirectory(): boolean;
|
|
1175
|
+
isSymbolicLink(): boolean;
|
|
1176
|
+
size: number;
|
|
1177
|
+
mtime: Date;
|
|
1178
|
+
ctime: Date;
|
|
1179
|
+
atime: Date;
|
|
1180
|
+
birthtime: Date;
|
|
1181
|
+
}
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/parseAst.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.43.0
|
|
4
|
+
Wed, 11 Jun 2025 05:22:04 GMT - commit 72858cb1474b81c91902794ab7d28c79f34b8ca8
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -836,7 +836,7 @@ function logRedeclarationError(name) {
|
|
|
836
836
|
function logReservedNamespace(namespace) {
|
|
837
837
|
return {
|
|
838
838
|
code: RESERVED_NAMESPACE,
|
|
839
|
-
message: `You have
|
|
839
|
+
message: `You have overridden reserved namespace "${namespace}"`
|
|
840
840
|
};
|
|
841
841
|
}
|
|
842
842
|
function logModuleParseError(error, moduleId) {
|
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.43.0
|
|
4
|
+
Wed, 11 Jun 2025 05:22:04 GMT - commit 72858cb1474b81c91902794ab7d28c79f34b8ca8
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -17,7 +17,32 @@ const native_js = require('../native.js');
|
|
|
17
17
|
const node_perf_hooks = require('node:perf_hooks');
|
|
18
18
|
const promises = require('node:fs/promises');
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function _interopNamespaceDefault(e) {
|
|
21
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
22
|
+
if (e) {
|
|
23
|
+
for (const k in e) {
|
|
24
|
+
n[k] = e[k];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _mergeNamespaces(n, m) {
|
|
32
|
+
for (var i = 0; i < m.length; i++) {
|
|
33
|
+
const e = m[i];
|
|
34
|
+
if (typeof e !== 'string' && !Array.isArray(e)) { for (const k in e) {
|
|
35
|
+
if (k !== 'default' && !(k in n)) {
|
|
36
|
+
n[k] = e[k];
|
|
37
|
+
}
|
|
38
|
+
} }
|
|
39
|
+
}
|
|
40
|
+
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
|
44
|
+
|
|
45
|
+
var version = "4.43.0";
|
|
21
46
|
|
|
22
47
|
function ensureArray$1(items) {
|
|
23
48
|
if (Array.isArray(items)) {
|
|
@@ -887,6 +912,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
887
912
|
error(error_) {
|
|
888
913
|
return parseAst_js.error(parseAst_js.logPluginError(normalizeLog(error_), plugin.name));
|
|
889
914
|
},
|
|
915
|
+
fs: options.fs,
|
|
890
916
|
getFileName: fileEmitter.getFileName,
|
|
891
917
|
getModuleIds: () => graph.modulesById.keys(),
|
|
892
918
|
getModuleInfo: graph.getModuleInfo,
|
|
@@ -3514,7 +3540,7 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
|
|
3514
3540
|
outputOptionsArray.push({});
|
|
3515
3541
|
const outputOptions = await Promise.all(outputOptionsArray.map(singleOutputOptions => mergeOutputOptions(singleOutputOptions, command, log)));
|
|
3516
3542
|
warnUnknownOptions(command, [
|
|
3517
|
-
...Object.keys(inputOptions),
|
|
3543
|
+
...Object.keys(inputOptions).filter(option => option !== 'fs'),
|
|
3518
3544
|
...Object.keys(outputOptions[0]).filter(option => option !== 'sourcemapIgnoreList' && option !== 'sourcemapPathTransform'),
|
|
3519
3545
|
...Object.keys(commandAliases),
|
|
3520
3546
|
'bundleConfigAsCjs',
|
|
@@ -3560,6 +3586,7 @@ function mergeInputOptions(config, overrides, plugins, log, onLog) {
|
|
|
3560
3586
|
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
|
|
3561
3587
|
experimentalLogSideEffects: getOption('experimentalLogSideEffects'),
|
|
3562
3588
|
external: getExternal(config, overrides),
|
|
3589
|
+
fs: getOption('fs'),
|
|
3563
3590
|
input: getOption('input') || [],
|
|
3564
3591
|
jsx: getObjectOption(config, overrides, 'jsx', objectifyOptionWithPresets(jsxPresets, 'jsx', parseAst_js.URL_JSX, 'false, ')),
|
|
3565
3592
|
logLevel: getOption('logLevel'),
|
|
@@ -22074,7 +22101,7 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
|
|
22074
22101
|
return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { attributes, custom: customOptions, isEntry }], replaceContext, skipped);
|
|
22075
22102
|
}
|
|
22076
22103
|
|
|
22077
|
-
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes) {
|
|
22104
|
+
async function resolveId(source, importer, preserveSymlinks, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes, fs) {
|
|
22078
22105
|
const pluginResult = await resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions, isEntry, attributes);
|
|
22079
22106
|
if (pluginResult != null) {
|
|
22080
22107
|
const [resolveIdResult, plugin] = pluginResult;
|
|
@@ -22100,22 +22127,22 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
|
|
|
22100
22127
|
// absolute path is created. Absolute importees therefore shortcircuit the
|
|
22101
22128
|
// resolve call and require no special handing on our part.
|
|
22102
22129
|
// See https://nodejs.org/api/path.html#path_path_resolve_paths
|
|
22103
|
-
return addJsExtensionIfNecessary(importer ? path.resolve(path.dirname(importer), source) : path.resolve(source), preserveSymlinks);
|
|
22130
|
+
return addJsExtensionIfNecessary(importer ? path.resolve(path.dirname(importer), source) : path.resolve(source), preserveSymlinks, fs);
|
|
22104
22131
|
}
|
|
22105
|
-
async function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
|
22106
|
-
return ((await findFile(file, preserveSymlinks)) ??
|
|
22107
|
-
(await findFile(file + '.mjs', preserveSymlinks)) ??
|
|
22108
|
-
(await findFile(file + '.js', preserveSymlinks)));
|
|
22132
|
+
async function addJsExtensionIfNecessary(file, preserveSymlinks, fs) {
|
|
22133
|
+
return ((await findFile(file, preserveSymlinks, fs)) ??
|
|
22134
|
+
(await findFile(file + '.mjs', preserveSymlinks, fs)) ??
|
|
22135
|
+
(await findFile(file + '.js', preserveSymlinks, fs)));
|
|
22109
22136
|
}
|
|
22110
|
-
async function findFile(file, preserveSymlinks) {
|
|
22137
|
+
async function findFile(file, preserveSymlinks, fs) {
|
|
22111
22138
|
try {
|
|
22112
|
-
const stats = await
|
|
22139
|
+
const stats = await fs.lstat(file);
|
|
22113
22140
|
if (!preserveSymlinks && stats.isSymbolicLink())
|
|
22114
|
-
return await findFile(await
|
|
22141
|
+
return await findFile(await fs.realpath(file), preserveSymlinks, fs);
|
|
22115
22142
|
if ((preserveSymlinks && stats.isSymbolicLink()) || stats.isFile()) {
|
|
22116
22143
|
// check case
|
|
22117
22144
|
const name = path.basename(file);
|
|
22118
|
-
const files = await
|
|
22145
|
+
const files = await fs.readdir(path.dirname(file));
|
|
22119
22146
|
if (files.includes(name))
|
|
22120
22147
|
return file;
|
|
22121
22148
|
}
|
|
@@ -22266,7 +22293,7 @@ class ModuleLoader {
|
|
|
22266
22293
|
this.nextEntryModuleIndex = 0;
|
|
22267
22294
|
this.resolveId = async (source, importer, customOptions, isEntry, attributes, skip = null) => this.getResolvedIdWithDefaults(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
|
|
22268
22295
|
? false
|
|
22269
|
-
: await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer, attributes), importer, source), attributes);
|
|
22296
|
+
: await resolveId(source, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, skip, customOptions, typeof isEntry === 'boolean' ? isEntry : !importer, attributes, this.options.fs), importer, source), attributes);
|
|
22270
22297
|
this.hasModuleSideEffects = options.treeshake
|
|
22271
22298
|
? options.treeshake.moduleSideEffects
|
|
22272
22299
|
: () => true;
|
|
@@ -22357,7 +22384,7 @@ class ModuleLoader {
|
|
|
22357
22384
|
if (content !== null)
|
|
22358
22385
|
return content;
|
|
22359
22386
|
this.graph.watchFiles[id] = true;
|
|
22360
|
-
return await
|
|
22387
|
+
return (await this.options.fs.readFile(id, { encoding: 'utf8' }));
|
|
22361
22388
|
});
|
|
22362
22389
|
}
|
|
22363
22390
|
catch (error_) {
|
|
@@ -22625,7 +22652,7 @@ class ModuleLoader {
|
|
|
22625
22652
|
return resolvedId;
|
|
22626
22653
|
}
|
|
22627
22654
|
async loadEntryModule(unresolvedId, isEntry, importer, implicitlyLoadedBefore, isLoadForManualChunks = false) {
|
|
22628
|
-
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, parseAst_js.EMPTY_OBJECT, true, parseAst_js.EMPTY_OBJECT);
|
|
22655
|
+
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, parseAst_js.EMPTY_OBJECT, true, parseAst_js.EMPTY_OBJECT, this.options.fs);
|
|
22629
22656
|
if (resolveIdResult == null) {
|
|
22630
22657
|
return parseAst_js.error(implicitlyLoadedBefore === null
|
|
22631
22658
|
? parseAst_js.logUnresolvedEntry(unresolvedId)
|
|
@@ -22975,6 +23002,10 @@ async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
|
22975
23002
|
|
|
22976
23003
|
async function initWasm() { }
|
|
22977
23004
|
|
|
23005
|
+
const fs = /*#__PURE__*/_mergeNamespaces({
|
|
23006
|
+
__proto__: null
|
|
23007
|
+
}, [promises__namespace]);
|
|
23008
|
+
|
|
22978
23009
|
async function normalizeInputOptions(config, watchMode) {
|
|
22979
23010
|
// These are options that may trigger special warnings or behaviour later
|
|
22980
23011
|
// if the user did not select an explicit value
|
|
@@ -22991,6 +23022,7 @@ async function normalizeInputOptions(config, watchMode) {
|
|
|
22991
23022
|
experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10,
|
|
22992
23023
|
experimentalLogSideEffects: config.experimentalLogSideEffects || false,
|
|
22993
23024
|
external: getIdMatcher(config.external),
|
|
23025
|
+
fs: config.fs ?? fs,
|
|
22994
23026
|
input: getInput(config),
|
|
22995
23027
|
jsx: getJsx(config),
|
|
22996
23028
|
logLevel,
|
|
@@ -23558,7 +23590,7 @@ async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, raw
|
|
|
23558
23590
|
if (!outputOptions.dir && !outputOptions.file) {
|
|
23559
23591
|
return parseAst_js.error(parseAst_js.logMissingFileOrDirOption());
|
|
23560
23592
|
}
|
|
23561
|
-
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
|
|
23593
|
+
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions, inputOptions))));
|
|
23562
23594
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
23563
23595
|
timeEnd('WRITE', 1);
|
|
23564
23596
|
}
|
|
@@ -23607,11 +23639,11 @@ function getSortingFileType(file) {
|
|
|
23607
23639
|
}
|
|
23608
23640
|
return SortingFileType.SECONDARY_CHUNK;
|
|
23609
23641
|
}
|
|
23610
|
-
async function writeOutputFile(outputFile, outputOptions) {
|
|
23642
|
+
async function writeOutputFile(outputFile, outputOptions, { fs: { mkdir, writeFile } }) {
|
|
23611
23643
|
const fileName = path.resolve(outputOptions.dir || path.dirname(outputOptions.file), outputFile.fileName);
|
|
23612
23644
|
// 'recursive: true' does not throw if the folder structure, or parts of it, already exist
|
|
23613
|
-
await
|
|
23614
|
-
return
|
|
23645
|
+
await mkdir(path.dirname(fileName), { recursive: true });
|
|
23646
|
+
return writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
|
|
23615
23647
|
}
|
|
23616
23648
|
/**
|
|
23617
23649
|
* Auxiliary function for defining rollup configuration
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.43.0",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -109,26 +109,26 @@
|
|
|
109
109
|
"homepage": "https://rollupjs.org/",
|
|
110
110
|
"optionalDependencies": {
|
|
111
111
|
"fsevents": "~2.3.2",
|
|
112
|
-
"@rollup/rollup-darwin-arm64": "4.
|
|
113
|
-
"@rollup/rollup-android-arm64": "4.
|
|
114
|
-
"@rollup/rollup-win32-arm64-msvc": "4.
|
|
115
|
-
"@rollup/rollup-freebsd-arm64": "4.
|
|
116
|
-
"@rollup/rollup-linux-arm64-gnu": "4.
|
|
117
|
-
"@rollup/rollup-linux-arm64-musl": "4.
|
|
118
|
-
"@rollup/rollup-android-arm-eabi": "4.
|
|
119
|
-
"@rollup/rollup-linux-arm-gnueabihf": "4.
|
|
120
|
-
"@rollup/rollup-linux-arm-musleabihf": "4.
|
|
121
|
-
"@rollup/rollup-win32-ia32-msvc": "4.
|
|
122
|
-
"@rollup/rollup-linux-loongarch64-gnu": "4.
|
|
123
|
-
"@rollup/rollup-linux-riscv64-gnu": "4.
|
|
124
|
-
"@rollup/rollup-linux-riscv64-musl": "4.
|
|
125
|
-
"@rollup/rollup-linux-powerpc64le-gnu": "4.
|
|
126
|
-
"@rollup/rollup-linux-s390x-gnu": "4.
|
|
127
|
-
"@rollup/rollup-darwin-x64": "4.
|
|
128
|
-
"@rollup/rollup-win32-x64-msvc": "4.
|
|
129
|
-
"@rollup/rollup-freebsd-x64": "4.
|
|
130
|
-
"@rollup/rollup-linux-x64-gnu": "4.
|
|
131
|
-
"@rollup/rollup-linux-x64-musl": "4.
|
|
112
|
+
"@rollup/rollup-darwin-arm64": "4.43.0",
|
|
113
|
+
"@rollup/rollup-android-arm64": "4.43.0",
|
|
114
|
+
"@rollup/rollup-win32-arm64-msvc": "4.43.0",
|
|
115
|
+
"@rollup/rollup-freebsd-arm64": "4.43.0",
|
|
116
|
+
"@rollup/rollup-linux-arm64-gnu": "4.43.0",
|
|
117
|
+
"@rollup/rollup-linux-arm64-musl": "4.43.0",
|
|
118
|
+
"@rollup/rollup-android-arm-eabi": "4.43.0",
|
|
119
|
+
"@rollup/rollup-linux-arm-gnueabihf": "4.43.0",
|
|
120
|
+
"@rollup/rollup-linux-arm-musleabihf": "4.43.0",
|
|
121
|
+
"@rollup/rollup-win32-ia32-msvc": "4.43.0",
|
|
122
|
+
"@rollup/rollup-linux-loongarch64-gnu": "4.43.0",
|
|
123
|
+
"@rollup/rollup-linux-riscv64-gnu": "4.43.0",
|
|
124
|
+
"@rollup/rollup-linux-riscv64-musl": "4.43.0",
|
|
125
|
+
"@rollup/rollup-linux-powerpc64le-gnu": "4.43.0",
|
|
126
|
+
"@rollup/rollup-linux-s390x-gnu": "4.43.0",
|
|
127
|
+
"@rollup/rollup-darwin-x64": "4.43.0",
|
|
128
|
+
"@rollup/rollup-win32-x64-msvc": "4.43.0",
|
|
129
|
+
"@rollup/rollup-freebsd-x64": "4.43.0",
|
|
130
|
+
"@rollup/rollup-linux-x64-gnu": "4.43.0",
|
|
131
|
+
"@rollup/rollup-linux-x64-musl": "4.43.0"
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
134
|
"@types/estree": "1.0.7"
|
|
@@ -191,6 +191,7 @@
|
|
|
191
191
|
"lint-staged": "^16.1.0",
|
|
192
192
|
"locate-character": "^3.0.0",
|
|
193
193
|
"magic-string": "^0.30.17",
|
|
194
|
+
"memfs": "^4.17.0",
|
|
194
195
|
"mocha": "^11.5.0",
|
|
195
196
|
"nodemon": "^3.1.10",
|
|
196
197
|
"nyc": "^17.1.0",
|