@rspack-canary/cli 1.6.0-canary-6cd722f4-20251022123039 → 1.6.0-canary-4ad8b49f-20251023175711

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
@@ -847,9 +847,13 @@ ${section.body}` : section.body).join("\n\n"));
847
847
  }
848
848
  if (stats?.hasErrors()) process.exitCode = 1;
849
849
  if (!compiler || !stats) return;
850
- const statsOptions = cli.isMultipleCompiler(compiler) ? {
851
- children: compiler.compilers.map((item)=>item.options ? item.options.stats : void 0)
852
- } : compiler.options?.stats;
850
+ const getStatsOptions = ()=>{
851
+ if (cli.isMultipleCompiler(compiler)) return {
852
+ children: compiler.compilers.map((item)=>item.options ? item.options.stats : void 0)
853
+ };
854
+ return compiler.options?.stats;
855
+ };
856
+ const statsOptions = getStatsOptions();
853
857
  if (options.json && createJsonStringifyStream) {
854
858
  const handleWriteError = (error)=>{
855
859
  logger.error(error);
@@ -1032,16 +1036,14 @@ ${section.body}` : section.body).join("\n\n"));
1032
1036
  }
1033
1037
  };
1034
1038
  const utils_readPackageUp = readPackageUp;
1035
- const isEsmFile = (filePath, cwd = process.cwd())=>{
1036
- const ext = external_node_path_default().extname(filePath);
1037
- if (/\.(mjs|mts)$/.test(ext)) return true;
1038
- if (/\.(cjs|cts)/.test(ext)) return false;
1039
+ const isEsmFile = (filePath)=>{
1040
+ if (/\.(mjs|mts)$/.test(filePath)) return true;
1041
+ if (/\.(cjs|cts)$/.test(filePath)) return false;
1039
1042
  const packageJson = utils_readPackageUp(external_node_path_default().dirname(filePath));
1040
1043
  return packageJson?.type === "module";
1041
1044
  };
1042
- const utils_isEsmFile = isEsmFile;
1043
- const crossImport = async (path, cwd = process.cwd())=>{
1044
- if (utils_isEsmFile(path, cwd)) {
1045
+ const crossImport = async (path)=>{
1046
+ if (isEsmFile(path)) {
1045
1047
  const url = (0, external_node_url_namespaceObject.pathToFileURL)(path).href;
1046
1048
  const { default: config } = await import(url);
1047
1049
  return config;
@@ -1102,7 +1104,7 @@ ${section.body}` : section.body).join("\n\n"));
1102
1104
  }
1103
1105
  const loadConfig_DEFAULT_CONFIG_NAME = "rspack.config";
1104
1106
  const registerLoader = (configPath)=>{
1105
- if (utils_isEsmFile(configPath) && isTsFile(configPath)) return;
1107
+ if (isEsmFile(configPath) && isTsFile(configPath)) return;
1106
1108
  if (!isTsFile(configPath)) throw new Error(`config file "${configPath}" is not supported.`);
1107
1109
  (0, lib.addHook)((code, filename)=>{
1108
1110
  try {
@@ -1167,7 +1169,7 @@ ${section.body}` : section.body).join("\n\n"));
1167
1169
  }
1168
1170
  if (!external_node_fs_default().existsSync(resolvedPath)) throw new Error(`Extended configuration file "${resolvedPath}" not found.`);
1169
1171
  if (isTsFile(resolvedPath) && "register" === options.configLoader) registerLoader(resolvedPath);
1170
- let loadedConfig = await crossImport(resolvedPath, cwd);
1172
+ let loadedConfig = await crossImport(resolvedPath);
1171
1173
  if ("function" == typeof loadedConfig) {
1172
1174
  loadedConfig = loadedConfig(options.env, options);
1173
1175
  if ("function" == typeof loadedConfig.then) loadedConfig = await loadedConfig;
@@ -1196,7 +1198,7 @@ ${section.body}` : section.body).join("\n\n"));
1196
1198
  configPath = defaultConfig;
1197
1199
  }
1198
1200
  if (isTsFile(configPath) && "register" === options.configLoader) registerLoader(configPath);
1199
- const loadedConfig = await crossImport(configPath, cwd);
1201
+ const loadedConfig = await crossImport(configPath);
1200
1202
  return {
1201
1203
  loadedConfig,
1202
1204
  configPath
@@ -1210,7 +1212,7 @@ ${section.body}` : section.body).join("\n\n"));
1210
1212
  this.colors = this.createColors();
1211
1213
  this.program = program;
1212
1214
  program.help();
1213
- program.version("1.6.0-canary-6cd722f4-20251022123039");
1215
+ program.version("1.6.0-canary-4ad8b49f-20251023175711");
1214
1216
  }
1215
1217
  async createCompiler(options, rspackCommand, callback) {
1216
1218
  let { config, pathMap } = await this.loadConfig(options);
package/dist/index.mjs CHANGED
@@ -811,9 +811,13 @@ async function runBuild(cli, options) {
811
811
  }
812
812
  if (stats?.hasErrors()) process.exitCode = 1;
813
813
  if (!compiler || !stats) return;
814
- const statsOptions = cli.isMultipleCompiler(compiler) ? {
815
- children: compiler.compilers.map((item)=>item.options ? item.options.stats : void 0)
816
- } : compiler.options?.stats;
814
+ const getStatsOptions = ()=>{
815
+ if (cli.isMultipleCompiler(compiler)) return {
816
+ children: compiler.compilers.map((item)=>item.options ? item.options.stats : void 0)
817
+ };
818
+ return compiler.options?.stats;
819
+ };
820
+ const statsOptions = getStatsOptions();
817
821
  if (options.json && createJsonStringifyStream) {
818
822
  const handleWriteError = (error)=>{
819
823
  logger.error(error);
@@ -995,16 +999,14 @@ const readPackageUp = (cwd = process.cwd())=>{
995
999
  }
996
1000
  };
997
1001
  const utils_readPackageUp = readPackageUp;
998
- const isEsmFile = (filePath, cwd = process.cwd())=>{
999
- const ext = external_node_path_["default"].extname(filePath);
1000
- if (/\.(mjs|mts)$/.test(ext)) return true;
1001
- if (/\.(cjs|cts)/.test(ext)) return false;
1002
+ const isEsmFile = (filePath)=>{
1003
+ if (/\.(mjs|mts)$/.test(filePath)) return true;
1004
+ if (/\.(cjs|cts)$/.test(filePath)) return false;
1002
1005
  const packageJson = utils_readPackageUp(external_node_path_["default"].dirname(filePath));
1003
1006
  return packageJson?.type === "module";
1004
1007
  };
1005
- const utils_isEsmFile = isEsmFile;
1006
- const crossImport = async (path, cwd = process.cwd())=>{
1007
- if (utils_isEsmFile(path, cwd)) {
1008
+ const crossImport = async (path)=>{
1009
+ if (isEsmFile(path)) {
1008
1010
  const url = (0, __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__.pathToFileURL)(path).href;
1009
1011
  const { default: config } = await import(url);
1010
1012
  return config;
@@ -1065,7 +1067,7 @@ function compile(sourcecode, filename) {
1065
1067
  }
1066
1068
  const loadConfig_DEFAULT_CONFIG_NAME = "rspack.config";
1067
1069
  const registerLoader = (configPath)=>{
1068
- if (utils_isEsmFile(configPath) && isTsFile(configPath)) return;
1070
+ if (isEsmFile(configPath) && isTsFile(configPath)) return;
1069
1071
  if (!isTsFile(configPath)) throw new Error(`config file "${configPath}" is not supported.`);
1070
1072
  (0, lib.addHook)((code, filename)=>{
1071
1073
  try {
@@ -1130,7 +1132,7 @@ async function loadExtendedConfig(config, configPath, cwd, options) {
1130
1132
  }
1131
1133
  if (!external_node_fs_["default"].existsSync(resolvedPath)) throw new Error(`Extended configuration file "${resolvedPath}" not found.`);
1132
1134
  if (isTsFile(resolvedPath) && "register" === options.configLoader) registerLoader(resolvedPath);
1133
- let loadedConfig = await crossImport(resolvedPath, cwd);
1135
+ let loadedConfig = await crossImport(resolvedPath);
1134
1136
  if ("function" == typeof loadedConfig) {
1135
1137
  loadedConfig = loadedConfig(options.env, options);
1136
1138
  if ("function" == typeof loadedConfig.then) loadedConfig = await loadedConfig;
@@ -1159,7 +1161,7 @@ async function loadRspackConfig(options, cwd = process.cwd()) {
1159
1161
  configPath = defaultConfig;
1160
1162
  }
1161
1163
  if (isTsFile(configPath) && "register" === options.configLoader) registerLoader(configPath);
1162
- const loadedConfig = await crossImport(configPath, cwd);
1164
+ const loadedConfig = await crossImport(configPath);
1163
1165
  return {
1164
1166
  loadedConfig,
1165
1167
  configPath
@@ -1173,7 +1175,7 @@ class RspackCLI {
1173
1175
  this.colors = this.createColors();
1174
1176
  this.program = program;
1175
1177
  program.help();
1176
- program.version("1.6.0-canary-6cd722f4-20251022123039");
1178
+ program.version("1.6.0-canary-4ad8b49f-20251023175711");
1177
1179
  }
1178
1180
  async createCompiler(options, rspackCommand, callback) {
1179
1181
  let { config, pathMap } = await this.loadConfig(options);
@@ -1 +1 @@
1
- export declare const crossImport: <T = any>(path: string, cwd?: string) => Promise<T>;
1
+ export declare const crossImport: <T = any>(path: string) => Promise<T>;
@@ -1,2 +1 @@
1
- declare const isEsmFile: (filePath: string, cwd?: string) => boolean;
2
- export default isEsmFile;
1
+ export declare const isEsmFile: (filePath: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-canary/cli",
3
- "version": "1.6.0-canary-6cd722f4-20251022123039",
3
+ "version": "1.6.0-canary-4ad8b49f-20251023175711",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -34,7 +34,7 @@
34
34
  "webpack-bundle-analyzer": "4.10.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@rslib/core": "0.15.1",
37
+ "@rslib/core": "0.16.1",
38
38
  "@types/webpack-bundle-analyzer": "^4.7.0",
39
39
  "cac": "^6.7.14",
40
40
  "concat-stream": "^2.0.0",
@@ -44,8 +44,8 @@
44
44
  "pirates": "^4.0.7",
45
45
  "ts-node": "^10.9.2",
46
46
  "typescript": "^5.9.3",
47
- "@rspack/core": "npm:@rspack-canary/core@1.6.0-canary-6cd722f4-20251022123039",
48
- "@rspack/test-tools": "npm:@rspack-canary/test-tools@1.6.0-canary-6cd722f4-20251022123039"
47
+ "@rspack/core": "npm:@rspack-canary/core@1.6.0-canary-4ad8b49f-20251023175711",
48
+ "@rspack/test-tools": "npm:@rspack-canary/test-tools@1.6.0-canary-4ad8b49f-20251023175711"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@rspack/core": "^1.0.0-alpha || ^1.x"