@rspack/cli 2.1.8 → 2.1.10
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 +1 -11
- package/dist/index.js +8 -2
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -191,15 +191,7 @@ 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<const Config extends RspackOptions | MultiRspackOptions>(config: (...args: Parameters<RspackConfigFn>) =>
|
|
195
|
-
|
|
196
|
-
export declare function defineConfig<const Config extends RspackOptions | MultiRspackOptions>(config: (...args: Parameters<RspackConfigFn>) => Promise<Config>): RspackConfigAsyncFn;
|
|
197
|
-
|
|
198
|
-
export declare function defineConfig(config: RspackOptions): RspackOptions;
|
|
199
|
-
|
|
200
|
-
export declare function defineConfig(config: MultiRspackOptions): MultiRspackOptions;
|
|
201
|
-
|
|
202
|
-
export declare function defineConfig(config: RspackConfigExport): RspackConfigExport;
|
|
194
|
+
export declare function defineConfig<const Config extends RspackOptions | MultiRspackOptions, const Definition extends Config | ((...args: Parameters<RspackConfigFn>) => Config) | ((...args: Parameters<RspackConfigFn>) => Promise<Config>)>(config: Definition): Definition extends (...args: Parameters<RspackConfigFn>) => Promise<unknown> ? RspackConfigAsyncFn : Definition extends (...args: Parameters<RspackConfigFn>) => unknown ? RspackConfigFn : Definition extends readonly unknown[] ? MultiRspackOptions : RspackOptions;
|
|
203
195
|
|
|
204
196
|
export declare function definePlugin(plugin: RspackPluginFunction): RspackPluginFunction;
|
|
205
197
|
|
|
@@ -294,8 +286,6 @@ export declare interface RspackCommand {
|
|
|
294
286
|
|
|
295
287
|
declare type RspackConfigAsyncFn = (env: Record<string, any>, argv: Record<string, any>) => Promise<RspackOptions | MultiRspackOptions>;
|
|
296
288
|
|
|
297
|
-
declare type RspackConfigExport = RspackOptions | MultiRspackOptions | RspackConfigFn | RspackConfigAsyncFn;
|
|
298
|
-
|
|
299
289
|
declare type RspackConfigFn = (env: Record<string, any>, argv: Record<string, any>) => RspackOptions | MultiRspackOptions;
|
|
300
290
|
|
|
301
291
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -987,11 +987,17 @@ const loadConfigByPath = async (configPath, options)=>{
|
|
|
987
987
|
fresh: true
|
|
988
988
|
});
|
|
989
989
|
if (!isRspackConfig(content)) throw new Error(`[rspack-cli:loadConfig] The config at "${configPath}" must be an object or an array, got ${String(content)}`);
|
|
990
|
-
return content;
|
|
990
|
+
return 'native' === options.configLoader ? content : normalizeContext(content);
|
|
991
991
|
};
|
|
992
992
|
const isConfigObject = (value)=>Boolean(value) && 'object' == typeof value && !Array.isArray(value);
|
|
993
993
|
const isRspackConfig = (value)=>Array.isArray(value) || isConfigObject(value);
|
|
994
994
|
const checkIsMultiRspackOptions = (config)=>Array.isArray(config);
|
|
995
|
+
const normalizeContext = (config)=>{
|
|
996
|
+
for (const item of checkIsMultiRspackOptions(config) ? config : [
|
|
997
|
+
config
|
|
998
|
+
])if ('string' == typeof item.context) item.context = node_path.normalize(item.context);
|
|
999
|
+
return config;
|
|
1000
|
+
};
|
|
995
1001
|
async function loadExtendedConfig(config, configPath, cwd, options, visitedPaths) {
|
|
996
1002
|
const currentVisitedPaths = visitedPaths ?? new Set();
|
|
997
1003
|
if (checkIsMultiRspackOptions(config)) {
|
|
@@ -1115,7 +1121,7 @@ class RspackCLI {
|
|
|
1115
1121
|
this.colors = this.createColors();
|
|
1116
1122
|
this.program = program;
|
|
1117
1123
|
program.help();
|
|
1118
|
-
program.version("2.1.
|
|
1124
|
+
program.version("2.1.10");
|
|
1119
1125
|
}
|
|
1120
1126
|
wrapAction(fn) {
|
|
1121
1127
|
return (...args)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@discoveryjs/json-ext": "^1.1.0",
|
|
32
32
|
"@microsoft/api-extractor": "^7.58.12",
|
|
33
33
|
"@rstackjs/load-config": "^0.1.2",
|
|
34
|
-
"@rspack/dev-server": "^2.
|
|
34
|
+
"@rspack/dev-server": "^2.2.0",
|
|
35
35
|
"cac": "^7.0.0",
|
|
36
36
|
"concat-stream": "^2.0.0",
|
|
37
37
|
"cross-env": "^10.1.0",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"jiti": "^2.7.0",
|
|
41
41
|
"prebundle": "^1.6.5",
|
|
42
42
|
"rspack-merge": "1.0.1",
|
|
43
|
-
"rstack": "^0.
|
|
43
|
+
"rstack": "^0.5.1",
|
|
44
44
|
"typescript": "^6.0.3",
|
|
45
|
-
"@rspack/core": "2.1.
|
|
46
|
-
"@rspack/test-tools": "2.1.
|
|
45
|
+
"@rspack/core": "2.1.10",
|
|
46
|
+
"@rspack/test-tools": "2.1.10"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@rspack/core": "^2.0.0-0",
|