@rollup/wasm-node 5.0.0-0 → 5.0.0-2

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.
Files changed (50) hide show
  1. package/LICENSE.md +0 -17
  2. package/dist/bin/rollup +119 -108
  3. package/dist/es/getLogFilter.js +2 -2
  4. package/dist/es/parseAst.js +2 -2
  5. package/dist/es/rollup.js +2 -2
  6. package/dist/es/shared/node-entry.js +1637 -1092
  7. package/dist/es/shared/parseAst.js +123 -31
  8. package/dist/es/shared/watch.js +3204 -1008
  9. package/dist/getLogFilter.js +2 -2
  10. package/dist/loadConfigFile.js +2 -2
  11. package/dist/native.js +19 -3
  12. package/dist/parseAst.js +2 -2
  13. package/dist/rollup.android-arm-eabi.node +0 -0
  14. package/dist/rollup.android-arm64.node +0 -0
  15. package/dist/rollup.android-x64.node +0 -0
  16. package/dist/rollup.d.ts +23 -9
  17. package/dist/rollup.darwin-arm64.node +0 -0
  18. package/dist/rollup.darwin-x64.node +0 -0
  19. package/dist/rollup.freebsd-arm64.node +0 -0
  20. package/dist/rollup.freebsd-x64.node +0 -0
  21. package/dist/rollup.js +2 -2
  22. package/dist/rollup.linux-arm-gnueabihf.node +0 -0
  23. package/dist/rollup.linux-arm-musleabihf.node +0 -0
  24. package/dist/rollup.linux-arm64-gnu.node +0 -0
  25. package/dist/rollup.linux-arm64-musl.node +0 -0
  26. package/dist/rollup.linux-loong64-gnu.node +0 -0
  27. package/dist/rollup.linux-loong64-musl.node +0 -0
  28. package/dist/rollup.linux-ppc64-gnu.node +0 -0
  29. package/dist/rollup.linux-ppc64-musl.node +0 -0
  30. package/dist/rollup.linux-riscv64-gnu.node +0 -0
  31. package/dist/rollup.linux-riscv64-musl.node +0 -0
  32. package/dist/rollup.linux-s390x-gnu.node +0 -0
  33. package/dist/rollup.linux-x64-gnu.node +0 -0
  34. package/dist/rollup.linux-x64-musl.node +0 -0
  35. package/dist/rollup.openbsd-x64.node +0 -0
  36. package/dist/rollup.openharmony-arm64.node +0 -0
  37. package/dist/rollup.win32-arm64-msvc.node +0 -0
  38. package/dist/rollup.win32-ia32-msvc.node +0 -0
  39. package/dist/rollup.win32-x64-gnu.node +0 -0
  40. package/dist/rollup.win32-x64-msvc.node +0 -0
  41. package/dist/shared/index.js +3198 -1002
  42. package/dist/shared/loadConfigFile.js +2 -2
  43. package/dist/shared/node-entry.js +2 -2
  44. package/dist/shared/parseAst.js +129 -37
  45. package/dist/shared/rollup.js +1594 -1049
  46. package/dist/shared/watch-cli.js +2 -2
  47. package/dist/shared/watch.js +2 -2
  48. package/dist/wasm-node/bindings_wasm.js +2 -18
  49. package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
  50. package/package.json +26 -26
package/LICENSE.md CHANGED
@@ -164,23 +164,6 @@ Repository: git+https://github.com/Rich-Harris/magic-string.git
164
164
 
165
165
  ---------------------------------------
166
166
 
167
- ## parse-ms
168
- License: MIT
169
- By: Sindre Sorhus
170
- Repository: sindresorhus/parse-ms
171
-
172
- > MIT License
173
- >
174
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
175
- >
176
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
177
- >
178
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
179
- >
180
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
181
-
182
- ---------------------------------------
183
-
184
167
  ## picocolors
185
168
  License: ISC
186
169
  By: Alexey Raspopov
package/dist/bin/rollup CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v5.0.0-0
5
- Tue, 06 Oct 2026 08:24:44 GMT - commit d78bf6bee48e411672e05d8977473f76e6758c35
4
+ Rollup.js v5.0.0-2
5
+ Sun, 01 Nov 2026 08:56:25 GMT - commit 4009894760dbcbff5ba6cefa494787cc54ffaa62
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -28,7 +28,7 @@ require('node:url');
28
28
  require('../getLogFilter.js');
29
29
 
30
30
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
31
- const help = "rollup version 5.0.0-0\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> 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
+ const help = "rollup version 5.0.0-2\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> 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--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 file system operations to run 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";
32
32
 
33
33
  /**
34
34
  * @license
@@ -1318,57 +1318,48 @@ function __disposeResources(env) {
1318
1318
  return next();
1319
1319
  }
1320
1320
 
1321
- const toZeroIfInfinity = value => Number.isFinite(value) ? value : 0;
1322
-
1323
- function parseNumber(milliseconds) {
1324
- return {
1325
- days: Math.trunc(milliseconds / 86_400_000),
1326
- hours: Math.trunc(milliseconds / 3_600_000 % 24),
1327
- minutes: Math.trunc(milliseconds / 60_000 % 60),
1328
- seconds: Math.trunc(milliseconds / 1000 % 60),
1329
- milliseconds: Math.trunc(milliseconds % 1000),
1330
- microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1000) % 1000),
1331
- nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1000),
1332
- };
1333
- }
1334
-
1335
- function parseBigint(milliseconds) {
1336
- return {
1337
- days: milliseconds / 86_400_000n,
1338
- hours: milliseconds / 3_600_000n % 24n,
1339
- minutes: milliseconds / 60_000n % 60n,
1340
- seconds: milliseconds / 1000n % 60n,
1341
- milliseconds: milliseconds % 1000n,
1342
- microseconds: 0n,
1343
- nanoseconds: 0n,
1344
- };
1345
- }
1321
+ const isZero = value => value === 0 || value === 0n;
1322
+ const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
1346
1323
 
1347
- function parseMilliseconds(milliseconds) {
1348
- switch (typeof milliseconds) {
1349
- case 'number': {
1350
- if (Number.isFinite(milliseconds)) {
1351
- return parseNumber(milliseconds);
1352
- }
1324
+ const ONE_SECOND_IN_MILLISECONDS = 1000n;
1325
+ const ONE_MINUTE_IN_MILLISECONDS = 60n * ONE_SECOND_IN_MILLISECONDS;
1326
+ const ONE_HOUR_IN_MILLISECONDS = 60n * ONE_MINUTE_IN_MILLISECONDS;
1327
+ const ONE_DAY_IN_MILLISECONDS = 24n * ONE_HOUR_IN_MILLISECONDS;
1328
+ const MAX_DECIMAL_DIGITS = 100; // The same limit as `Number#toFixed()`, which keeps the output a sensible size.
1329
+
1330
+ // A negative or fractional count is not a digit count, and a `NaN` count would leak into the output as `NaN`.
1331
+ const decimalDigits = (value, defaultValue) => typeof value === 'number' && !Number.isNaN(value)
1332
+ ? Math.min(Math.max(Math.trunc(value), 0), MAX_DECIMAL_DIGITS)
1333
+ : defaultValue;
1334
+
1335
+ // The duration as the exact fraction `value / scale` milliseconds, so every field can be derived with exact BigInt arithmetic.
1336
+ // An integer is exact at any size, including a number past the safe range. A fractional number is rounded to 15 significant digits, counting the whole duration, as that is all the precision a double has. This turns float noise back into the intended value: `0.57 * 100_000` is `56999.99999999999`, which is read as `57000`, and `999.9999999999999` is read as `1000`. Digits past the 15th are rounded away, so they are not exact.
1337
+ const toExactMilliseconds = milliseconds => {
1338
+ // eslint-disable-next-line unicorn/prefer-number-is-safe-integer -- An integer past the safe range is still exact.
1339
+ if (typeof milliseconds === 'bigint' || Number.isInteger(milliseconds)) {
1340
+ return {value: BigInt(milliseconds), scale: 1n};
1341
+ }
1353
1342
 
1354
- break;
1355
- }
1343
+ const [significand, exponent = '0'] = milliseconds.toPrecision(15).split('e', 2);
1344
+ const [whole, fraction = ''] = significand.split('.', 2);
1345
+ const digits = BigInt(whole + fraction);
1346
+ const decimals = fraction.length - Number(exponent);
1356
1347
 
1357
- case 'bigint': {
1358
- return parseBigint(milliseconds);
1359
- }
1348
+ // From `1e15` up, the 15 digits end before the decimal point, so the exponent is positive. The fraction is then dropped and the duration is rounded to the nearest 10 milliseconds. A number from `2 ** 52` up is always an integer, so this only applies below that.
1349
+ return decimals < 0
1350
+ ? {value: digits * (10n ** BigInt(-decimals)), scale: 1n}
1351
+ : {value: digits, scale: 10n ** BigInt(decimals)};
1352
+ };
1360
1353
 
1361
- // No default
1354
+ // Places the decimal point in a count of steps of `10 ** -digits`.
1355
+ const formatSteps = (steps, digits) => {
1356
+ if (digits === 0) {
1357
+ return String(steps);
1362
1358
  }
1363
1359
 
1364
- throw new TypeError('Expected a finite number or bigint');
1365
- }
1366
-
1367
- const isZero = value => value === 0 || value === 0n;
1368
- const pluralize = (word, count) => (count === 1 || count === 1n) ? word : `${word}s`;
1369
-
1370
- const SECOND_ROUNDING_EPSILON = 0.000_000_1;
1371
- const ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
1360
+ const padded = String(steps).padStart(digits + 1, '0');
1361
+ return `${padded.slice(0, -digits)}.${padded.slice(-digits)}`;
1362
+ };
1372
1363
 
1373
1364
  function prettyMilliseconds(milliseconds, options) {
1374
1365
  const isBigInt = typeof milliseconds === 'bigint';
@@ -1379,6 +1370,7 @@ function prettyMilliseconds(milliseconds, options) {
1379
1370
  options = {...options};
1380
1371
 
1381
1372
  const sign = milliseconds < 0 ? '-' : '';
1373
+ // eslint-disable-next-line unicorn/prefer-math-abs -- `Math.abs()` throws on a bigint, and the bigint path reaches here.
1382
1374
  milliseconds = milliseconds < 0 ? -milliseconds : milliseconds; // Cannot use `Math.abs()` because of BigInt support.
1383
1375
 
1384
1376
  if (options.colonNotation) {
@@ -1386,6 +1378,8 @@ function prettyMilliseconds(milliseconds, options) {
1386
1378
  options.formatSubMilliseconds = false;
1387
1379
  options.separateMilliseconds = false;
1388
1380
  options.verbose = false;
1381
+ // Dropping a field from the right would change what the remaining fields mean: `1:01:01` would become `1:01`, which reads as 1 minute.
1382
+ options.unitCount = undefined;
1389
1383
  }
1390
1384
 
1391
1385
  if (options.compact) {
@@ -1396,24 +1390,26 @@ function prettyMilliseconds(milliseconds, options) {
1396
1390
 
1397
1391
  let result = [];
1398
1392
 
1399
- const floorDecimals = (value, decimalDigits) => {
1400
- const flooredInterimValue = Math.floor((value * (10 ** decimalDigits)) + SECOND_ROUNDING_EPSILON);
1401
- const flooredValue = Math.round(flooredInterimValue) / (10 ** decimalDigits);
1402
- return flooredValue.toFixed(decimalDigits);
1403
- };
1404
-
1405
1393
  const add = (value, long, short, valueString) => {
1394
+ // Colon notation always shows the minutes, and the hours too when the seconds are hidden, so the last fields read as `m:ss`, or as `h:mm` without the seconds. A duration under a minute keeps its seconds, so it reads as `h:mm:ss` there.
1395
+ const isAlwaysShown = options.colonNotation && (short === 'm' || (short === 'h' && options.hideSeconds));
1396
+
1406
1397
  if (
1407
- (result.length === 0 || !options.colonNotation)
1408
- && isZero(value)
1409
- && !(options.colonNotation && short === 'm')) {
1398
+ !isAlwaysShown
1399
+ && (result.length === 0 || !options.colonNotation)
1400
+ && isZero(value)) {
1410
1401
  return;
1411
1402
  }
1412
1403
 
1413
1404
  valueString ??= String(value);
1414
1405
  if (options.colonNotation) {
1415
- const wholeDigits = valueString.includes('.') ? valueString.split('.')[0].length : valueString.length;
1416
- const minLength = result.length > 0 ? 2 : 1;
1406
+ const wholeDigits = valueString.includes('.') ? valueString.split('.', 1)[0].length : valueString.length;
1407
+ // The first field is not padded. The days after a year go up to 364, so they get 3 digits to keep the width.
1408
+ let minLength = 1;
1409
+ if (result.length > 0) {
1410
+ minLength = short === 'd' ? 3 : 2;
1411
+ }
1412
+
1417
1413
  valueString = '0'.repeat(Math.max(0, minLength - wholeDigits)) + valueString;
1418
1414
  } else {
1419
1415
  valueString += options.verbose ? ' ' + pluralize(long, value) : short;
@@ -1422,11 +1418,19 @@ function prettyMilliseconds(milliseconds, options) {
1422
1418
  result.push(valueString);
1423
1419
  };
1424
1420
 
1425
- const parsed = parseMilliseconds(milliseconds);
1426
- const days = BigInt(parsed.days);
1421
+ const {value, scale} = toExactMilliseconds(milliseconds);
1422
+ const second = ONE_SECOND_IN_MILLISECONDS * scale;
1423
+ const minute = ONE_MINUTE_IN_MILLISECONDS * scale;
1424
+ const hour = ONE_HOUR_IN_MILLISECONDS * scale;
1425
+ const day = ONE_DAY_IN_MILLISECONDS * scale;
1426
+
1427
+ // The days, hours, minutes, seconds, and sub-millisecond fields are floored from the exact value, so none of them can round up into the next unit. Only the milliseconds, when they are the last unit, are rounded (see below).
1428
+ const days = value / day;
1429
+ const hoursWithinDay = (value % day) / hour;
1430
+ const minutesWithinHour = (value % hour) / minute;
1427
1431
 
1428
1432
  if (options.hideYearAndDays) {
1429
- add((BigInt(days) * 24n) + BigInt(parsed.hours), 'hour', 'h');
1433
+ add((days * 24n) + hoursWithinDay, 'hour', 'h');
1430
1434
  } else {
1431
1435
  if (options.hideYear) {
1432
1436
  add(days, 'day', 'd');
@@ -1435,82 +1439,89 @@ function prettyMilliseconds(milliseconds, options) {
1435
1439
  add(days % 365n, 'day', 'd');
1436
1440
  }
1437
1441
 
1438
- add(Number(parsed.hours), 'hour', 'h');
1442
+ add(hoursWithinDay, 'hour', 'h');
1439
1443
  }
1440
1444
 
1441
- add(Number(parsed.minutes), 'minute', 'm');
1445
+ add(minutesWithinHour, 'minute', 'm');
1446
+
1447
+ const secondsDecimalDigits = decimalDigits(options.secondsDecimalDigits, 1);
1448
+ const secondsStepsPerSecond = 10n ** BigInt(secondsDecimalDigits);
1449
+
1450
+ // A duration under a minute has no coarser field, so hiding the seconds would leave nothing to carry its value.
1451
+ const hideSeconds = options.hideSeconds && value >= minute;
1452
+
1453
+ // `subSecondsAsDecimals` moves the value into the seconds field, so it only applies when that field is rendered and can represent the value, at least one step of the seconds digits. Otherwise the value is lost.
1454
+ const canShowAsDecimalSeconds = options.subSecondsAsDecimals
1455
+ && !hideSeconds
1456
+ && value * secondsStepsPerSecond >= second;
1457
+
1458
+ if (!hideSeconds) {
1459
+ const withinMinute = value % minute;
1442
1460
 
1443
- if (!options.hideSeconds) {
1444
1461
  if (
1445
1462
  options.separateMilliseconds
1446
1463
  || options.formatSubMilliseconds
1447
- || (!options.colonNotation && milliseconds < 1000 && !options.subSecondsAsDecimals)
1464
+ || (!canShowAsDecimalSeconds && !options.colonNotation && value < second)
1448
1465
  ) {
1449
- const seconds = Number(parsed.seconds);
1450
- const milliseconds = Number(parsed.milliseconds);
1451
- const microseconds = Number(parsed.microseconds);
1452
- const nanoseconds = Number(parsed.nanoseconds);
1453
-
1454
- add(seconds, 'second', 's');
1466
+ add(withinMinute / second, 'second', 's');
1455
1467
 
1456
1468
  if (options.formatSubMilliseconds) {
1457
- add(milliseconds, 'millisecond', 'ms');
1458
- add(microseconds, 'microsecond', 'µs');
1459
- add(nanoseconds, 'nanosecond', 'ns');
1460
- } else {
1461
- const millisecondsAndBelow
1462
- = milliseconds
1463
- + (microseconds / 1000)
1464
- + (nanoseconds / 1e6);
1469
+ // Floored to whole nanoseconds, the smallest unit shown. `formatSubMilliseconds` shows these as they are, so a duration under 1 nanosecond is `0ms` there.
1470
+ const subMillisecondNanoseconds = ((value % scale) * 1_000_000n) / scale;
1465
1471
 
1472
+ add((value % second) / scale, 'millisecond', 'ms');
1473
+ add(subMillisecondNanoseconds / 1000n, 'microsecond', 'µs');
1474
+ add(subMillisecondNanoseconds % 1000n, 'nanosecond', 'ns');
1475
+ } else {
1466
1476
  const millisecondsDecimalDigits
1467
- = typeof options.millisecondsDecimalDigits === 'number'
1468
- ? options.millisecondsDecimalDigits
1469
- : 0;
1477
+ = decimalDigits(options.millisecondsDecimalDigits, 0);
1478
+ const stepsPerMillisecond = 10n ** BigInt(millisecondsDecimalDigits);
1479
+
1480
+ // Rounded half up in exact steps of the last digit, as a float sum of the parts can land a midpoint like `1.005` below it.
1481
+ let steps = ((2n * (value % second) * stepsPerMillisecond) + scale) / (2n * scale);
1470
1482
 
1471
- const roundedMilliseconds = millisecondsAndBelow >= 1
1472
- ? Math.round(millisecondsAndBelow)
1473
- : Math.ceil(millisecondsAndBelow);
1474
- const maximumMilliseconds = 1000 - (10 ** -millisecondsDecimalDigits);
1483
+ // Under a second, the zero field is dropped entirely, so a nonzero duration is clamped to the smallest representable value instead of rounding down onto it. From a second up, the seconds field carries the value, so the milliseconds round normally.
1484
+ if (steps === 0n && value > 0n && value < second) {
1485
+ steps = 1n;
1486
+ }
1475
1487
 
1476
- const millisecondsString = millisecondsDecimalDigits
1477
- ? Math.min(millisecondsAndBelow, maximumMilliseconds).toFixed(millisecondsDecimalDigits)
1478
- : Math.min(roundedMilliseconds, maximumMilliseconds);
1488
+ // The milliseconds are rounded, not floored, but never up to a full second, which would need the seconds field.
1489
+ const maximumSteps = (1000n * stepsPerMillisecond) - 1n;
1490
+ if (steps > maximumSteps) {
1491
+ steps = maximumSteps;
1492
+ }
1493
+
1494
+ const millisecondsString = formatSteps(steps, millisecondsDecimalDigits);
1479
1495
 
1480
1496
  add(
1481
- Number.parseFloat(millisecondsString),
1497
+ Number(millisecondsString),
1482
1498
  'millisecond',
1483
1499
  'ms',
1484
1500
  millisecondsString,
1485
1501
  );
1486
1502
  }
1487
1503
  } else {
1488
- const seconds = (
1489
- (isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds)
1490
- / 1000
1491
- ) % 60;
1492
- const secondsDecimalDigits
1493
- = typeof options.secondsDecimalDigits === 'number'
1494
- ? options.secondsDecimalDigits
1495
- : 1;
1496
- const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
1504
+ // Floored to the digit count, so the seconds never round up into the next step, or to `60s`.
1505
+ const secondsFixed = formatSteps((withinMinute * secondsStepsPerSecond) / second, secondsDecimalDigits);
1497
1506
  const secondsString = options.keepDecimalsOnWholeSeconds
1498
1507
  ? secondsFixed
1499
- : secondsFixed.replace(/\.0+$/, '');
1500
- add(Number.parseFloat(secondsString), 'second', 's', secondsString);
1508
+ : secondsFixed.replace(/\.0+$/v, '');
1509
+ add(Number(secondsString), 'second', 's', secondsString);
1501
1510
  }
1502
1511
  }
1503
1512
 
1504
- if (result.length === 0) {
1505
- return sign + '0' + (options.verbose ? ' milliseconds' : 'ms');
1506
- }
1507
-
1508
1513
  const separator = options.colonNotation ? ':' : ' ';
1509
1514
  if (typeof options.unitCount === 'number') {
1510
- result = result.slice(0, Math.max(options.unitCount, 1));
1515
+ // `Math.max()` propagates `NaN`, and `slice(0, NaN)` is an empty slice, which would drop every unit.
1516
+ result = result.slice(0, Math.max(options.unitCount, 1) || Infinity);
1511
1517
  }
1512
1518
 
1513
- return sign + result.join(separator);
1519
+ const output = result.length === 0
1520
+ ? '0' + (options.verbose ? ' milliseconds' : 'ms')
1521
+ : result.join(separator);
1522
+
1523
+ // Rounding can leave nothing but zeros behind, and a signed zero reads as a negative duration.
1524
+ return /[1-9]/v.test(output) ? sign + output : output;
1514
1525
  }
1515
1526
 
1516
1527
  const BYTE_UNITS = [
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v5.0.0-0
4
- Tue, 06 Oct 2026 08:24:44 GMT - commit d78bf6bee48e411672e05d8977473f76e6758c35
3
+ Rollup.js v5.0.0-2
4
+ Sun, 01 Nov 2026 08:56:25 GMT - commit 4009894760dbcbff5ba6cefa494787cc54ffaa62
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v5.0.0-0
4
- Tue, 06 Oct 2026 08:24:44 GMT - commit d78bf6bee48e411672e05d8977473f76e6758c35
3
+ Rollup.js v5.0.0-2
4
+ Sun, 01 Nov 2026 08:56:25 GMT - commit 4009894760dbcbff5ba6cefa494787cc54ffaa62
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 v5.0.0-0
4
- Tue, 06 Oct 2026 08:24:44 GMT - commit d78bf6bee48e411672e05d8977473f76e6758c35
3
+ Rollup.js v5.0.0-2
4
+ Sun, 01 Nov 2026 08:56:25 GMT - commit 4009894760dbcbff5ba6cefa494787cc54ffaa62
5
5
 
6
6
  https://github.com/rollup/rollup
7
7