rollup 4.41.2 → 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 CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v4.41.2
5
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -27,7 +27,7 @@ require('node:perf_hooks');
27
27
  require('node:url');
28
28
  require('../getLogFilter.js');
29
29
 
30
- const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
30
+ const help = "rollup version __VERSION__\n=====================================\n\nUsage: rollup [options] <entry file>\n\nBasic options:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, defaults to rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
31
31
 
32
32
  /**
33
33
  * @license
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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 { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
16
+ import * as promises from 'node:fs/promises';
17
17
 
18
- var version = "4.41.2";
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'),
@@ -23615,6 +23634,29 @@ async function mergeOutputOptions(config, overrides, log) {
23615
23634
  return outputOptions;
23616
23635
  }
23617
23636
 
23637
+ let fsEvents;
23638
+ let fsEventsImportError;
23639
+ async function loadFsEvents() {
23640
+ try {
23641
+ ({ default: fsEvents } = await import('fsevents'));
23642
+ }
23643
+ catch (error) {
23644
+ fsEventsImportError = error;
23645
+ }
23646
+ }
23647
+ // A call to this function will be injected into the chokidar code
23648
+ function getFsEvents() {
23649
+ if (fsEventsImportError)
23650
+ throw fsEventsImportError;
23651
+ return fsEvents;
23652
+ }
23653
+
23654
+ const fseventsImporter = /*#__PURE__*/Object.defineProperty({
23655
+ __proto__: null,
23656
+ getFsEvents,
23657
+ loadFsEvents
23658
+ }, Symbol.toStringTag, { value: 'Module' });
23659
+
23618
23660
  class WatchEmitter {
23619
23661
  constructor() {
23620
23662
  this.currentHandlers = Object.create(null);
@@ -23668,29 +23710,6 @@ class WatchEmitter {
23668
23710
  }
23669
23711
  }
23670
23712
 
23671
- let fsEvents;
23672
- let fsEventsImportError;
23673
- async function loadFsEvents() {
23674
- try {
23675
- ({ default: fsEvents } = await import('fsevents'));
23676
- }
23677
- catch (error) {
23678
- fsEventsImportError = error;
23679
- }
23680
- }
23681
- // A call to this function will be injected into the chokidar code
23682
- function getFsEvents() {
23683
- if (fsEventsImportError)
23684
- throw fsEventsImportError;
23685
- return fsEvents;
23686
- }
23687
-
23688
- const fseventsImporter = /*#__PURE__*/Object.defineProperty({
23689
- __proto__: null,
23690
- getFsEvents,
23691
- loadFsEvents
23692
- }, Symbol.toStringTag, { value: 'Module' });
23693
-
23694
23713
  function watch(configs) {
23695
23714
  const emitter = new WatchEmitter();
23696
23715
  watchInternal(configs, emitter).catch(error => {
@@ -23698,7 +23717,7 @@ function watch(configs) {
23698
23717
  });
23699
23718
  return emitter;
23700
23719
  }
23701
- function withTrailingSlash(path) {
23720
+ function ensureTrailingSlash(path) {
23702
23721
  if (path[path.length - 1] !== '/') {
23703
23722
  return `${path}/`;
23704
23723
  }
@@ -23706,21 +23725,20 @@ function withTrailingSlash(path) {
23706
23725
  }
23707
23726
  function checkWatchConfig(config) {
23708
23727
  for (const item of config) {
23728
+ if (typeof item.watch !== 'boolean' && item.watch?.allowInputInsideOutputPath) {
23729
+ break;
23730
+ }
23709
23731
  if (item.input && item.output) {
23710
23732
  const input = typeof item.input === 'string' ? ensureArray(item.input) : item.input;
23711
- const output = ensureArray(item.output);
23733
+ const outputs = ensureArray(item.output);
23712
23734
  for (const index in input) {
23713
23735
  const inputPath = input[index];
23714
- const subPath = output.find(o => {
23715
- if (!o.dir || typeof inputPath !== 'string') {
23716
- return false;
23717
- }
23718
- const _outPath = withTrailingSlash(o.dir);
23719
- const _inputPath = withTrailingSlash(inputPath);
23720
- return _inputPath.startsWith(_outPath);
23721
- });
23722
- if (subPath) {
23723
- error(logInvalidOption('watch', URL_WATCH, `the input "${inputPath}" is a subpath of the output "${subPath.dir}"`));
23736
+ if (typeof inputPath !== 'string') {
23737
+ continue;
23738
+ }
23739
+ const outputWithInputAsSubPath = outputs.find(({ dir }) => dir && ensureTrailingSlash(inputPath).startsWith(ensureTrailingSlash(dir)));
23740
+ if (outputWithInputAsSubPath) {
23741
+ error(logInvalidOption('watch', URL_WATCH, `the input "${inputPath}" is a subpath of the output "${outputWithInputAsSubPath.dir}"`));
23724
23742
  }
23725
23743
  }
23726
23744
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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 overided reserved namespace "${namespace}"`
897
+ message: `You have overridden reserved namespace "${namespace}"`
898
898
  };
899
899
  }
900
900
  function logModuleParseError(error, moduleId) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
package/dist/parseAst.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
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;
@@ -1009,6 +1012,7 @@ export interface ChokidarOptions {
1009
1012
  export type RollupWatchHooks = 'onError' | 'onStart' | 'onBundleStart' | 'onBundleEnd' | 'onEnd';
1010
1013
 
1011
1014
  export interface WatcherOptions {
1015
+ allowInputInsideOutputPath?: boolean;
1012
1016
  buildDelay?: number;
1013
1017
  chokidar?: ChokidarOptions;
1014
1018
  clearScreen?: boolean;
@@ -1102,3 +1106,76 @@ export function defineConfig(optionsFunction: RollupOptionsFunction): RollupOpti
1102
1106
  export type RollupOptionsFunction = (
1103
1107
  commandLineArguments: Record<string, any>
1104
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
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -81,7 +81,7 @@ function watch(configs) {
81
81
  });
82
82
  return emitter;
83
83
  }
84
- function withTrailingSlash(path) {
84
+ function ensureTrailingSlash(path) {
85
85
  if (path[path.length - 1] !== '/') {
86
86
  return `${path}/`;
87
87
  }
@@ -89,21 +89,20 @@ function withTrailingSlash(path) {
89
89
  }
90
90
  function checkWatchConfig(config) {
91
91
  for (const item of config) {
92
+ if (typeof item.watch !== 'boolean' && item.watch?.allowInputInsideOutputPath) {
93
+ break;
94
+ }
92
95
  if (item.input && item.output) {
93
96
  const input = typeof item.input === 'string' ? rollup.ensureArray(item.input) : item.input;
94
- const output = rollup.ensureArray(item.output);
97
+ const outputs = rollup.ensureArray(item.output);
95
98
  for (const index in input) {
96
99
  const inputPath = input[index];
97
- const subPath = output.find(o => {
98
- if (!o.dir || typeof inputPath !== 'string') {
99
- return false;
100
- }
101
- const _outPath = withTrailingSlash(o.dir);
102
- const _inputPath = withTrailingSlash(inputPath);
103
- return _inputPath.startsWith(_outPath);
104
- });
105
- if (subPath) {
106
- parseAst_js.error(parseAst_js.logInvalidOption('watch', parseAst_js.URL_WATCH, `the input "${inputPath}" is a subpath of the output "${subPath.dir}"`));
100
+ if (typeof inputPath !== 'string') {
101
+ continue;
102
+ }
103
+ const outputWithInputAsSubPath = outputs.find(({ dir }) => dir && ensureTrailingSlash(inputPath).startsWith(ensureTrailingSlash(dir)));
104
+ if (outputWithInputAsSubPath) {
105
+ parseAst_js.error(parseAst_js.logInvalidOption('watch', parseAst_js.URL_WATCH, `the input "${inputPath}" is a subpath of the output "${outputWithInputAsSubPath.dir}"`));
107
106
  }
108
107
  }
109
108
  }
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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 overided reserved namespace "${namespace}"`
839
+ message: `You have overridden reserved namespace "${namespace}"`
840
840
  };
841
841
  }
842
842
  function logModuleParseError(error, moduleId) {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
- var version = "4.41.2";
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 promises.lstat(file);
22139
+ const stats = await fs.lstat(file);
22113
22140
  if (!preserveSymlinks && stats.isSymbolicLink())
22114
- return await findFile(await promises.realpath(file), preserveSymlinks);
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 promises.readdir(path.dirname(file));
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 promises.readFile(id, 'utf8');
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 promises.mkdir(path.dirname(fileName), { recursive: true });
23614
- return promises.writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
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
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.41.2
4
- Fri, 06 Jun 2025 11:40:00 GMT - commit 13b4669dbc21cb738551cd725d2a18c77b3cea11
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "4.41.2",
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.41.2",
113
- "@rollup/rollup-android-arm64": "4.41.2",
114
- "@rollup/rollup-win32-arm64-msvc": "4.41.2",
115
- "@rollup/rollup-freebsd-arm64": "4.41.2",
116
- "@rollup/rollup-linux-arm64-gnu": "4.41.2",
117
- "@rollup/rollup-linux-arm64-musl": "4.41.2",
118
- "@rollup/rollup-android-arm-eabi": "4.41.2",
119
- "@rollup/rollup-linux-arm-gnueabihf": "4.41.2",
120
- "@rollup/rollup-linux-arm-musleabihf": "4.41.2",
121
- "@rollup/rollup-win32-ia32-msvc": "4.41.2",
122
- "@rollup/rollup-linux-loongarch64-gnu": "4.41.2",
123
- "@rollup/rollup-linux-riscv64-gnu": "4.41.2",
124
- "@rollup/rollup-linux-riscv64-musl": "4.41.2",
125
- "@rollup/rollup-linux-powerpc64le-gnu": "4.41.2",
126
- "@rollup/rollup-linux-s390x-gnu": "4.41.2",
127
- "@rollup/rollup-darwin-x64": "4.41.2",
128
- "@rollup/rollup-win32-x64-msvc": "4.41.2",
129
- "@rollup/rollup-freebsd-x64": "4.41.2",
130
- "@rollup/rollup-linux-x64-gnu": "4.41.2",
131
- "@rollup/rollup-linux-x64-musl": "4.41.2"
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",