rolldown 0.15.1-commit.f9fc700 → 1.0.0-beta.1

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/cjs/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-DcDu70oa.cjs');
3
+ const require_src = require('../shared/src-PS2X1Won.cjs');
4
4
  const require_consola_36c0034f = require('../shared/consola_36c0034f-C_-uQ5ge.cjs');
5
5
  const node_fs = require_chunk.__toESM(require("node:fs"));
6
6
  const zod = require_chunk.__toESM(require("zod"));
@@ -364,12 +364,11 @@ async function bundleWithConfig(configPath, cliOptions) {
364
364
  logger.error(`No configuration found at ${config}`);
365
365
  process.exit(1);
366
366
  }
367
- const configList = require_src.arraify(config);
368
- const operation = cliOptions.watch ? watchInner : bundleInner;
369
- for (const config$1 of configList) await operation(config$1, cliOptions);
367
+ if (cliOptions.watch) await watchInner(config, cliOptions);
368
+ else await bundleInner(config, cliOptions);
370
369
  }
371
370
  async function bundleWithCliOptions(cliOptions) {
372
- if (cliOptions.output.dir) {
371
+ if (cliOptions.output.dir || cliOptions.output.file) {
373
372
  const operation = cliOptions.watch ? watchInner : bundleInner;
374
373
  await operation({}, cliOptions);
375
374
  return;
@@ -393,15 +392,20 @@ async function bundleWithCliOptions(cliOptions) {
393
392
  await build.close();
394
393
  }
395
394
  }
396
- async function watchInner(options$1, cliOptions) {
397
- const watcher = await require_src.watch({
398
- ...options$1,
399
- ...cliOptions.input,
400
- output: {
401
- ...options$1?.output,
402
- ...cliOptions.output
403
- }
395
+ async function watchInner(config, cliOptions) {
396
+ let normalizedConfig = require_src.arraify(config).map((option) => {
397
+ return {
398
+ ...option,
399
+ ...cliOptions.input,
400
+ output: require_src.arraify(option.output || {}).map((output) => {
401
+ return {
402
+ ...output,
403
+ ...cliOptions.output
404
+ };
405
+ })
406
+ };
404
407
  });
408
+ const watcher = await require_src.watch(normalizedConfig);
405
409
  onExit((code) => {
406
410
  Promise.resolve(watcher.close()).finally(() => {
407
411
  process.exit(typeof code === "number" ? code : 0);
@@ -429,25 +433,32 @@ async function watchInner(options$1, cliOptions) {
429
433
  });
430
434
  logger.log(`Waiting for changes...`);
431
435
  }
432
- async function bundleInner(options$1, cliOptions) {
436
+ async function bundleInner(config, cliOptions) {
433
437
  const startTime = node_perf_hooks.performance.now();
434
- const build = await require_src.rolldown({
435
- ...options$1,
436
- ...cliOptions.input
437
- });
438
- try {
439
- const bundleOutput = await build.write({
440
- ...options$1?.output,
441
- ...cliOptions.output
442
- });
443
- const endTime = node_perf_hooks.performance.now();
444
- printBundleOutputPretty(bundleOutput);
445
- logger.log(``);
446
- const duration = endTime - startTime;
447
- logger.success(`Finished in ${colors.bold(ms(duration))}`);
448
- } finally {
449
- await build.close();
438
+ const result = [];
439
+ const configList = require_src.arraify(config);
440
+ for (const config$1 of configList) {
441
+ const outputList = require_src.arraify(config$1.output || {});
442
+ for (const output of outputList) {
443
+ const build = await require_src.rolldown({
444
+ ...config$1,
445
+ ...cliOptions.input
446
+ });
447
+ try {
448
+ result.push(await build.write({
449
+ ...output,
450
+ ...cliOptions.output
451
+ }));
452
+ } finally {
453
+ await build.close();
454
+ }
455
+ }
450
456
  }
457
+ result.forEach(printBundleOutputPretty);
458
+ logger.log(``);
459
+ const endTime = node_perf_hooks.performance.now();
460
+ const duration = endTime - startTime;
461
+ logger.success(`Finished in ${colors.bold(ms(duration))}`);
451
462
  }
452
463
  function printBundleOutputPretty(output) {
453
464
  const outputEntries = collectOutputEntries(output.output);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-DcDu70oa.cjs');
3
+ const require_src = require('../shared/src-PS2X1Won.cjs');
4
4
  const node_url = require_chunk.__toESM(require("node:url"));
5
5
 
6
6
  //#region src/plugin/parallel-plugin.ts
@@ -1,4 +1,4 @@
1
- const require_src = require('../shared/src-DcDu70oa.cjs');
1
+ const require_src = require('../shared/src-PS2X1Won.cjs');
2
2
 
3
3
  exports.VERSION = require_src.VERSION
4
4
  exports.build = require_src.build
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-DcDu70oa.cjs');
3
+ const require_src = require('../shared/src-PS2X1Won.cjs');
4
4
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
5
5
 
6
6
  //#region src/parallel-plugin-worker.ts
package/dist/esm/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, arraify, description, rolldown, version, watch } from "../shared/src-CaCgK3ua.mjs";
1
+ import { LogLevelOptionSchema, LogLevelSchema, LogLevelWithErrorSchema, RollupLogSchema, RollupLogWithStringSchema, TreeshakingOptionsSchema, arraify, description, rolldown, version, watch } from "../shared/src-Bb3zZkPW.mjs";
2
2
  import { createConsola } from "../shared/consola_36c0034f-D9ce-831.mjs";
3
3
  import fs from "node:fs";
4
4
  import { ZodFirstPartyTypeKind, z } from "zod";
@@ -361,12 +361,11 @@ async function bundleWithConfig(configPath, cliOptions) {
361
361
  logger.error(`No configuration found at ${config}`);
362
362
  process.exit(1);
363
363
  }
364
- const configList = arraify(config);
365
- const operation = cliOptions.watch ? watchInner : bundleInner;
366
- for (const config$1 of configList) await operation(config$1, cliOptions);
364
+ if (cliOptions.watch) await watchInner(config, cliOptions);
365
+ else await bundleInner(config, cliOptions);
367
366
  }
368
367
  async function bundleWithCliOptions(cliOptions) {
369
- if (cliOptions.output.dir) {
368
+ if (cliOptions.output.dir || cliOptions.output.file) {
370
369
  const operation = cliOptions.watch ? watchInner : bundleInner;
371
370
  await operation({}, cliOptions);
372
371
  return;
@@ -390,15 +389,20 @@ async function bundleWithCliOptions(cliOptions) {
390
389
  await build.close();
391
390
  }
392
391
  }
393
- async function watchInner(options$1, cliOptions) {
394
- const watcher = await watch({
395
- ...options$1,
396
- ...cliOptions.input,
397
- output: {
398
- ...options$1?.output,
399
- ...cliOptions.output
400
- }
392
+ async function watchInner(config, cliOptions) {
393
+ let normalizedConfig = arraify(config).map((option) => {
394
+ return {
395
+ ...option,
396
+ ...cliOptions.input,
397
+ output: arraify(option.output || {}).map((output) => {
398
+ return {
399
+ ...output,
400
+ ...cliOptions.output
401
+ };
402
+ })
403
+ };
401
404
  });
405
+ const watcher = await watch(normalizedConfig);
402
406
  onExit((code) => {
403
407
  Promise.resolve(watcher.close()).finally(() => {
404
408
  process.exit(typeof code === "number" ? code : 0);
@@ -426,25 +430,32 @@ async function watchInner(options$1, cliOptions) {
426
430
  });
427
431
  logger.log(`Waiting for changes...`);
428
432
  }
429
- async function bundleInner(options$1, cliOptions) {
433
+ async function bundleInner(config, cliOptions) {
430
434
  const startTime = performance.now();
431
- const build = await rolldown({
432
- ...options$1,
433
- ...cliOptions.input
434
- });
435
- try {
436
- const bundleOutput = await build.write({
437
- ...options$1?.output,
438
- ...cliOptions.output
439
- });
440
- const endTime = performance.now();
441
- printBundleOutputPretty(bundleOutput);
442
- logger.log(``);
443
- const duration = endTime - startTime;
444
- logger.success(`Finished in ${colors.bold(ms(duration))}`);
445
- } finally {
446
- await build.close();
435
+ const result = [];
436
+ const configList = arraify(config);
437
+ for (const config$1 of configList) {
438
+ const outputList = arraify(config$1.output || {});
439
+ for (const output of outputList) {
440
+ const build = await rolldown({
441
+ ...config$1,
442
+ ...cliOptions.input
443
+ });
444
+ try {
445
+ result.push(await build.write({
446
+ ...output,
447
+ ...cliOptions.output
448
+ }));
449
+ } finally {
450
+ await build.close();
451
+ }
452
+ }
447
453
  }
454
+ result.forEach(printBundleOutputPretty);
455
+ logger.log(``);
456
+ const endTime = performance.now();
457
+ const duration = endTime - startTime;
458
+ logger.success(`Finished in ${colors.bold(ms(duration))}`);
448
459
  }
449
460
  function printBundleOutputPretty(output) {
450
461
  const outputEntries = collectOutputEntries(output.output);
@@ -1,4 +1,4 @@
1
- import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-CaCgK3ua.mjs";
1
+ import { BuiltinPlugin, __toESM, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, require_binding, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-Bb3zZkPW.mjs";
2
2
  import { pathToFileURL } from "node:url";
3
3
 
4
4
  //#region src/plugin/parallel-plugin.ts
@@ -1,3 +1,3 @@
1
- import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-CaCgK3ua.mjs";
1
+ import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-Bb3zZkPW.mjs";
2
2
 
3
3
  export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,4 +1,4 @@
1
- import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-CaCgK3ua.mjs";
1
+ import { PluginContextData, __toESM, bindingifyPlugin, require_binding } from "../shared/src-Bb3zZkPW.mjs";
2
2
  import { parentPort, workerData } from "node:worker_threads";
3
3
 
4
4
  //#region src/parallel-plugin-worker.ts
@@ -2815,8 +2815,8 @@ var Watcher = class {
2815
2815
  }
2816
2816
  };
2817
2817
  async function createWatcher(emitter, input) {
2818
- const options = Array.isArray(input) ? input : [input];
2819
- const bundlerOptions = await Promise.all(options.map((option) => createBundlerOptions(option, option.output || {})));
2818
+ const options = arraify(input);
2819
+ const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map((output) => createBundlerOptions(option, output))).flat());
2820
2820
  const notifyOptions = getValidNotifyOption(bundlerOptions);
2821
2821
  const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
2822
2822
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
@@ -2843,7 +2843,7 @@ const watch = (input) => {
2843
2843
 
2844
2844
  //#endregion
2845
2845
  //#region package.json
2846
- var version = "0.15.1-commit.f9fc700";
2846
+ var version = "1.0.0-beta.1";
2847
2847
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2848
2848
 
2849
2849
  //#endregion
@@ -2789,8 +2789,8 @@ var Watcher = class {
2789
2789
  }
2790
2790
  };
2791
2791
  async function createWatcher(emitter, input) {
2792
- const options = Array.isArray(input) ? input : [input];
2793
- const bundlerOptions = await Promise.all(options.map((option) => createBundlerOptions(option, option.output || {})));
2792
+ const options = arraify(input);
2793
+ const bundlerOptions = await Promise.all(options.map((option) => arraify(option.output || {}).map((output) => createBundlerOptions(option, output))).flat());
2794
2794
  const notifyOptions = getValidNotifyOption(bundlerOptions);
2795
2795
  const bindingWatcher = new import_binding.BindingWatcher(bundlerOptions.map((option) => option.bundlerOptions), notifyOptions);
2796
2796
  const watcher = new Watcher(emitter, bindingWatcher, bundlerOptions.map((option) => option.stopWorkers));
@@ -2817,7 +2817,7 @@ const watch = (input) => {
2817
2817
 
2818
2818
  //#endregion
2819
2819
  //#region package.json
2820
- var version = "0.15.1-commit.f9fc700";
2820
+ var version = "1.0.0-beta.1";
2821
2821
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2822
2822
 
2823
2823
  //#endregion