@rspack/cli 2.1.4 → 2.1.6

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.d.ts CHANGED
@@ -191,13 +191,13 @@ export { Configuration }
191
191
  * This function helps you to autocomplete configuration types.
192
192
  * It accepts a Rspack config object, or a function that returns a config.
193
193
  */
194
- export declare function defineConfig(config: RspackOptions): RspackOptions;
194
+ export declare function defineConfig<const Config extends RspackOptions | MultiRspackOptions>(config: (...args: Parameters<RspackConfigFn>) => Config): RspackConfigFn;
195
195
 
196
- export declare function defineConfig(config: MultiRspackOptions): MultiRspackOptions;
196
+ export declare function defineConfig<const Config extends RspackOptions | MultiRspackOptions>(config: (...args: Parameters<RspackConfigFn>) => Promise<Config>): RspackConfigAsyncFn;
197
197
 
198
- export declare function defineConfig(config: RspackConfigFn): RspackConfigFn;
198
+ export declare function defineConfig(config: RspackOptions): RspackOptions;
199
199
 
200
- export declare function defineConfig(config: RspackConfigAsyncFn): RspackConfigAsyncFn;
200
+ export declare function defineConfig(config: MultiRspackOptions): MultiRspackOptions;
201
201
 
202
202
  export declare function defineConfig(config: RspackConfigExport): RspackConfigExport;
203
203
 
package/dist/index.js CHANGED
@@ -891,12 +891,6 @@ const loadWithJiti = async (configPath, exportName, fresh)=>{
891
891
  };
892
892
  };
893
893
  const JS_CONFIG_REGEXP = /\.(?:js|mjs|cjs)$/;
894
- const tryFreshImport = async (configFileURL)=>{
895
- try {
896
- const { freshImport } = await import("./freshImport.js");
897
- return await freshImport(configFileURL);
898
- } catch {}
899
- };
900
894
  const loadWithNative = async (configPath, fresh)=>{
901
895
  const configFileURL = pathToFileURL(configPath).href;
902
896
  if (!fresh) {
@@ -906,7 +900,8 @@ const loadWithNative = async (configPath, fresh)=>{
906
900
  dependencies: []
907
901
  };
908
902
  }
909
- const freshImportResult = await tryFreshImport(configFileURL);
903
+ const { freshImport } = await import("./freshImport.js");
904
+ const freshImportResult = await freshImport(configFileURL);
910
905
  if (freshImportResult) return {
911
906
  configModule: freshImportResult.result,
912
907
  dependencies: freshImportResult.dependencies.sort()
@@ -930,6 +925,7 @@ const resolveConfigPath = (root, customConfig, configFileNames = [])=>{
930
925
  return null;
931
926
  };
932
927
  async function loadConfig({ cwd = process.cwd(), path, configFileNames = [], loader = 'auto', exportName = 'default', configParams = [], fresh = false } = {}) {
928
+ if (!path && 0 === configFileNames.length) throw new Error('Either `path` or at least one `configFileNames` entry must be provided.');
933
929
  const configPath = resolveConfigPath(cwd, path, configFileNames);
934
930
  if (!configPath) return {
935
931
  content: {},
@@ -1119,7 +1115,7 @@ class RspackCLI {
1119
1115
  this.colors = this.createColors();
1120
1116
  this.program = program;
1121
1117
  program.help();
1122
- program.version("2.1.4");
1118
+ program.version("2.1.6");
1123
1119
  }
1124
1120
  wrapAction(fn) {
1125
1121
  return (...args)=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/cli",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -29,9 +29,9 @@
29
29
  ],
30
30
  "devDependencies": {
31
31
  "@discoveryjs/json-ext": "^1.1.0",
32
- "@microsoft/api-extractor": "^7.58.9",
33
- "@rstackjs/load-config": "^0.1.1",
34
- "@rslib/core": "^0.23.2",
32
+ "@microsoft/api-extractor": "^7.58.12",
33
+ "@rstackjs/load-config": "^0.1.2",
34
+ "@rslib/core": "1.0.0-beta.1",
35
35
  "@rspack/dev-server": "^2.1.0",
36
36
  "cac": "^7.0.0",
37
37
  "concat-stream": "^2.0.0",
@@ -42,8 +42,8 @@
42
42
  "prebundle": "^1.6.5",
43
43
  "rspack-merge": "1.0.1",
44
44
  "typescript": "^6.0.3",
45
- "@rspack/core": "2.1.4",
46
- "@rspack/test-tools": "2.1.4"
45
+ "@rspack/core": "2.1.6",
46
+ "@rspack/test-tools": "2.1.6"
47
47
  },
48
48
  "peerDependencies": {
49
49
  "@rspack/core": "^2.0.0-0",