@rspack-canary/cli 1.4.12-canary-becf0a0e-20250808091433 → 1.4.12-canary-1a94ade3-20250814141828

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/index.js CHANGED
@@ -266,7 +266,7 @@ var __webpack_exports__ = {};
266
266
  logger.error(error);
267
267
  process.exit(2);
268
268
  }
269
- if (null == stats ? void 0 : stats.hasErrors()) process.exitCode = 1;
269
+ if (stats?.hasErrors()) process.exitCode = 1;
270
270
  if (!compiler || !stats) return;
271
271
  const statsOptions = cli.isMultipleCompiler(compiler) ? {
272
272
  children: compiler.compilers.map((compiler)=>compiler.options ? compiler.options.stats : void 0)
@@ -370,18 +370,17 @@ var __webpack_exports__ = {};
370
370
  }
371
371
  async function getPreviewConfig(item, options) {
372
372
  const internalPreviewConfig = async (item)=>{
373
- var _item_output, _item_devServer, _item_devServer1, _item_devServer2, _item_devServer3, _item_devServer4;
374
373
  item.devServer = {
375
374
  static: {
376
- directory: options.dir ? external_node_path_default().join(item.context ?? process.cwd(), options.dir) : (null == (_item_output = item.output) ? void 0 : _item_output.path) ?? external_node_path_default().join(item.context ?? process.cwd(), defaultRoot),
375
+ directory: options.dir ? external_node_path_default().join(item.context ?? process.cwd(), options.dir) : item.output?.path ?? external_node_path_default().join(item.context ?? process.cwd(), defaultRoot),
377
376
  publicPath: options.publicPath ?? "/"
378
377
  },
379
378
  port: options.port ?? 8080,
380
- proxy: null == (_item_devServer = item.devServer) ? void 0 : _item_devServer.proxy,
381
- host: options.host ?? (null == (_item_devServer1 = item.devServer) ? void 0 : _item_devServer1.host),
382
- open: options.open ?? (null == (_item_devServer2 = item.devServer) ? void 0 : _item_devServer2.open),
383
- server: options.server ?? (null == (_item_devServer3 = item.devServer) ? void 0 : _item_devServer3.server),
384
- historyApiFallback: null == (_item_devServer4 = item.devServer) ? void 0 : _item_devServer4.historyApiFallback
379
+ proxy: item.devServer?.proxy,
380
+ host: options.host ?? item.devServer?.host,
381
+ open: options.open ?? item.devServer?.open,
382
+ server: options.server ?? item.devServer?.server,
383
+ historyApiFallback: item.devServer?.historyApiFallback
385
384
  };
386
385
  return item;
387
386
  };
@@ -512,7 +511,7 @@ var __webpack_exports__ = {};
512
511
  if (/\.(mjs|mts)$/.test(ext)) return true;
513
512
  if (/\.(cjs|cts)/.test(ext)) return false;
514
513
  const packageJson = utils_readPackageUp(external_node_path_default().dirname(filePath));
515
- return (null == packageJson ? void 0 : packageJson.type) === "module";
514
+ return packageJson?.type === "module";
516
515
  };
517
516
  const utils_isEsmFile = isEsmFile;
518
517
  const crossImport = async (path, cwd = process.cwd())=>{
@@ -551,7 +550,7 @@ var __webpack_exports__ = {};
551
550
  const { default: rechoir } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "rechoir"));
552
551
  rechoir.prepare(extensions, configPath);
553
552
  } catch (error) {
554
- const failures = null == error ? void 0 : error.failures;
553
+ const failures = error?.failures;
555
554
  if (failures) {
556
555
  const messages = failures.map((failure)=>failure.error.message);
557
556
  throw new Error(`${messages.join("\n")}`);
@@ -614,8 +613,7 @@ var __webpack_exports__ = {};
614
613
  if (isTsFile(resolvedPath) && "register" === options.configLoader) await registerLoader(resolvedPath);
615
614
  let loadedConfig = await crossImport(resolvedPath, cwd);
616
615
  if ("function" == typeof loadedConfig) {
617
- var _options_argv;
618
- loadedConfig = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
616
+ loadedConfig = loadedConfig(options.argv?.env, options.argv);
619
617
  if ("function" == typeof loadedConfig.then) loadedConfig = await loadedConfig;
620
618
  }
621
619
  const { config: extendedConfig, pathMap: extendedPathMap } = await loadExtendedConfig(loadedConfig, resolvedPath, cwd, options);
@@ -648,17 +646,13 @@ var __webpack_exports__ = {};
648
646
  configPath
649
647
  };
650
648
  }
651
- function _define_property(obj, key, value) {
652
- if (key in obj) Object.defineProperty(obj, key, {
653
- value: value,
654
- enumerable: true,
655
- configurable: true,
656
- writable: true
657
- });
658
- else obj[key] = value;
659
- return obj;
660
- }
661
649
  class RspackCLI {
650
+ colors;
651
+ program;
652
+ constructor(){
653
+ this.colors = this.createColors();
654
+ this.program = external_yargs_default()();
655
+ }
662
656
  async createCompiler(options, rspackCommand, callback) {
663
657
  process.env.RSPACK_CONFIG_VALIDATE ??= "loose";
664
658
  let { config, pathMap } = await this.loadConfig(options);
@@ -720,7 +714,6 @@ var __webpack_exports__ = {};
720
714
  const isBuild = "build" === command;
721
715
  const isServe = "serve" === command;
722
716
  const internalBuildConfig = async (item)=>{
723
- var _item_experiments;
724
717
  if (options.entry) item.entry = {
725
718
  main: options.entry.map((x)=>external_node_path_default().resolve(process.cwd(), x))[0]
726
719
  };
@@ -751,7 +744,7 @@ var __webpack_exports__ = {};
751
744
  const installed = (item.plugins ||= []).find((item)=>item instanceof core_.ProgressPlugin);
752
745
  if (!installed) (item.plugins ??= []).push(new core_.ProgressPlugin());
753
746
  }
754
- const cacheOptions = null == (_item_experiments = item.experiments) ? void 0 : _item_experiments.cache;
747
+ const cacheOptions = item.experiments?.cache;
755
748
  if ("object" == typeof cacheOptions && "persistent" === cacheOptions.type) {
756
749
  const configPaths = pathMap.get(item);
757
750
  if (configPaths) cacheOptions.buildDependencies = [
@@ -785,8 +778,7 @@ var __webpack_exports__ = {};
785
778
  };
786
779
  let { loadedConfig, configPath } = config;
787
780
  if ("function" == typeof loadedConfig) {
788
- var _options_argv;
789
- let functionResult = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
781
+ let functionResult = loadedConfig(options.argv?.env, options.argv);
790
782
  if ("function" == typeof functionResult.then) functionResult = await functionResult;
791
783
  loadedConfig = functionResult;
792
784
  }
@@ -818,12 +810,6 @@ var __webpack_exports__ = {};
818
810
  isWatch(compiler) {
819
811
  return Boolean(this.isMultipleCompiler(compiler) ? compiler.compilers.some((compiler)=>compiler.options.watch) : compiler.options.watch);
820
812
  }
821
- constructor(){
822
- _define_property(this, "colors", void 0);
823
- _define_property(this, "program", void 0);
824
- this.colors = this.createColors();
825
- this.program = external_yargs_default()();
826
- }
827
813
  }
828
814
  function defineConfig(config) {
829
815
  return config;
package/dist/index.mjs CHANGED
@@ -231,7 +231,7 @@ class BuildCommand {
231
231
  logger.error(error);
232
232
  process.exit(2);
233
233
  }
234
- if (null == stats ? void 0 : stats.hasErrors()) process.exitCode = 1;
234
+ if (stats?.hasErrors()) process.exitCode = 1;
235
235
  if (!compiler || !stats) return;
236
236
  const statsOptions = cli.isMultipleCompiler(compiler) ? {
237
237
  children: compiler.compilers.map((compiler)=>compiler.options ? compiler.options.stats : void 0)
@@ -335,18 +335,17 @@ class PreviewCommand {
335
335
  }
336
336
  async function getPreviewConfig(item, options) {
337
337
  const internalPreviewConfig = async (item)=>{
338
- var _item_output, _item_devServer, _item_devServer1, _item_devServer2, _item_devServer3, _item_devServer4;
339
338
  item.devServer = {
340
339
  static: {
341
- directory: options.dir ? external_node_path_["default"].join(item.context ?? process.cwd(), options.dir) : (null == (_item_output = item.output) ? void 0 : _item_output.path) ?? external_node_path_["default"].join(item.context ?? process.cwd(), defaultRoot),
340
+ directory: options.dir ? external_node_path_["default"].join(item.context ?? process.cwd(), options.dir) : item.output?.path ?? external_node_path_["default"].join(item.context ?? process.cwd(), defaultRoot),
342
341
  publicPath: options.publicPath ?? "/"
343
342
  },
344
343
  port: options.port ?? 8080,
345
- proxy: null == (_item_devServer = item.devServer) ? void 0 : _item_devServer.proxy,
346
- host: options.host ?? (null == (_item_devServer1 = item.devServer) ? void 0 : _item_devServer1.host),
347
- open: options.open ?? (null == (_item_devServer2 = item.devServer) ? void 0 : _item_devServer2.open),
348
- server: options.server ?? (null == (_item_devServer3 = item.devServer) ? void 0 : _item_devServer3.server),
349
- historyApiFallback: null == (_item_devServer4 = item.devServer) ? void 0 : _item_devServer4.historyApiFallback
344
+ proxy: item.devServer?.proxy,
345
+ host: options.host ?? item.devServer?.host,
346
+ open: options.open ?? item.devServer?.open,
347
+ server: options.server ?? item.devServer?.server,
348
+ historyApiFallback: item.devServer?.historyApiFallback
350
349
  };
351
350
  return item;
352
351
  };
@@ -476,7 +475,7 @@ const isEsmFile = (filePath, cwd = process.cwd())=>{
476
475
  if (/\.(mjs|mts)$/.test(ext)) return true;
477
476
  if (/\.(cjs|cts)/.test(ext)) return false;
478
477
  const packageJson = utils_readPackageUp(external_node_path_["default"].dirname(filePath));
479
- return (null == packageJson ? void 0 : packageJson.type) === "module";
478
+ return packageJson?.type === "module";
480
479
  };
481
480
  const utils_isEsmFile = isEsmFile;
482
481
  const crossImport = async (path, cwd = process.cwd())=>{
@@ -515,7 +514,7 @@ const registerLoader = async (configPath)=>{
515
514
  const { default: rechoir } = await import("rechoir");
516
515
  rechoir.prepare(extensions, configPath);
517
516
  } catch (error) {
518
- const failures = null == error ? void 0 : error.failures;
517
+ const failures = error?.failures;
519
518
  if (failures) {
520
519
  const messages = failures.map((failure)=>failure.error.message);
521
520
  throw new Error(`${messages.join("\n")}`);
@@ -578,8 +577,7 @@ async function loadExtendedConfig(config, configPath, cwd, options) {
578
577
  if (isTsFile(resolvedPath) && "register" === options.configLoader) await registerLoader(resolvedPath);
579
578
  let loadedConfig = await crossImport(resolvedPath, cwd);
580
579
  if ("function" == typeof loadedConfig) {
581
- var _options_argv;
582
- loadedConfig = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
580
+ loadedConfig = loadedConfig(options.argv?.env, options.argv);
583
581
  if ("function" == typeof loadedConfig.then) loadedConfig = await loadedConfig;
584
582
  }
585
583
  const { config: extendedConfig, pathMap: extendedPathMap } = await loadExtendedConfig(loadedConfig, resolvedPath, cwd, options);
@@ -612,17 +610,13 @@ async function loadRspackConfig(options, cwd = process.cwd()) {
612
610
  configPath
613
611
  };
614
612
  }
615
- function _define_property(obj, key, value) {
616
- if (key in obj) Object.defineProperty(obj, key, {
617
- value: value,
618
- enumerable: true,
619
- configurable: true,
620
- writable: true
621
- });
622
- else obj[key] = value;
623
- return obj;
624
- }
625
613
  class RspackCLI {
614
+ colors;
615
+ program;
616
+ constructor(){
617
+ this.colors = this.createColors();
618
+ this.program = yargs_0();
619
+ }
626
620
  async createCompiler(options, rspackCommand, callback) {
627
621
  process.env.RSPACK_CONFIG_VALIDATE ??= "loose";
628
622
  let { config, pathMap } = await this.loadConfig(options);
@@ -684,7 +678,6 @@ class RspackCLI {
684
678
  const isBuild = "build" === command;
685
679
  const isServe = "serve" === command;
686
680
  const internalBuildConfig = async (item)=>{
687
- var _item_experiments;
688
681
  if (options.entry) item.entry = {
689
682
  main: options.entry.map((x)=>external_node_path_["default"].resolve(process.cwd(), x))[0]
690
683
  };
@@ -715,7 +708,7 @@ class RspackCLI {
715
708
  const installed = (item.plugins ||= []).find((item)=>item instanceof core_.ProgressPlugin);
716
709
  if (!installed) (item.plugins ??= []).push(new core_.ProgressPlugin());
717
710
  }
718
- const cacheOptions = null == (_item_experiments = item.experiments) ? void 0 : _item_experiments.cache;
711
+ const cacheOptions = item.experiments?.cache;
719
712
  if ("object" == typeof cacheOptions && "persistent" === cacheOptions.type) {
720
713
  const configPaths = pathMap.get(item);
721
714
  if (configPaths) cacheOptions.buildDependencies = [
@@ -749,8 +742,7 @@ class RspackCLI {
749
742
  };
750
743
  let { loadedConfig, configPath } = config;
751
744
  if ("function" == typeof loadedConfig) {
752
- var _options_argv;
753
- let functionResult = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
745
+ let functionResult = loadedConfig(options.argv?.env, options.argv);
754
746
  if ("function" == typeof functionResult.then) functionResult = await functionResult;
755
747
  loadedConfig = functionResult;
756
748
  }
@@ -782,12 +774,6 @@ class RspackCLI {
782
774
  isWatch(compiler) {
783
775
  return Boolean(this.isMultipleCompiler(compiler) ? compiler.compilers.some((compiler)=>compiler.options.watch) : compiler.options.watch);
784
776
  }
785
- constructor(){
786
- _define_property(this, "colors", void 0);
787
- _define_property(this, "program", void 0);
788
- this.colors = this.createColors();
789
- this.program = yargs_0();
790
- }
791
777
  }
792
778
  function defineConfig(config) {
793
779
  return config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/cli",
3
- "version": "1.4.12-canary-becf0a0e-20250808091433",
3
+ "version": "1.4.12-canary-1a94ade3-20250814141828",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -47,8 +47,8 @@
47
47
  "cross-env": "^7.0.3",
48
48
  "execa": "^5.1.1",
49
49
  "ts-node": "^10.9.2",
50
- "typescript": "^5.8.3",
51
- "@rspack/core": "npm:@rspack-canary/core@1.4.12-canary-becf0a0e-20250808091433"
50
+ "typescript": "^5.9.2",
51
+ "@rspack/core": "npm:@rspack-canary/core@1.4.12-canary-1a94ade3-20250814141828"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@rspack/core": "^1.0.0-alpha || ^1.x"