@rspack-canary/cli 1.4.12-canary-40c41ca5-20250806090917 → 1.4.12-canary-becf0a0e-20250808091433
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/cli.d.ts +6 -2
- package/dist/index.js +72 -30
- package/dist/index.mjs +72 -30
- package/dist/utils/loadConfig.d.ts +16 -2
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -13,8 +13,12 @@ export declare class RspackCLI {
|
|
|
13
13
|
getLogger(): RspackCLILogger;
|
|
14
14
|
run(argv: string[]): Promise<void>;
|
|
15
15
|
registerCommands(): Promise<void>;
|
|
16
|
-
buildConfig(item: RspackOptions | MultiRspackOptions, options: RspackBuildCLIOptions, command: Command): Promise<RspackOptions | MultiRspackOptions>;
|
|
17
|
-
loadConfig(options: RspackCLIOptions): Promise<
|
|
16
|
+
buildConfig(item: RspackOptions | MultiRspackOptions, pathMap: WeakMap<RspackOptions, string[]>, options: RspackBuildCLIOptions, command: Command): Promise<RspackOptions | MultiRspackOptions>;
|
|
17
|
+
loadConfig(options: RspackCLIOptions): Promise<{
|
|
18
|
+
config: RspackOptions | MultiRspackOptions;
|
|
19
|
+
pathMap: WeakMap<RspackOptions, string[]>;
|
|
20
|
+
}>;
|
|
21
|
+
private filterConfig;
|
|
18
22
|
isMultipleCompiler(compiler: Compiler | MultiCompiler): compiler is MultiCompiler;
|
|
19
23
|
isWatch(compiler: Compiler | MultiCompiler): boolean;
|
|
20
24
|
}
|
package/dist/index.js
CHANGED
|
@@ -346,7 +346,7 @@ var __webpack_exports__ = {};
|
|
|
346
346
|
}
|
|
347
347
|
};
|
|
348
348
|
const { RspackDevServer } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "@rspack/dev-server"));
|
|
349
|
-
let config = await cli.loadConfig(rspackOptions);
|
|
349
|
+
let { config } = await cli.loadConfig(rspackOptions);
|
|
350
350
|
config = await getPreviewConfig(config, options);
|
|
351
351
|
if (!Array.isArray(config)) config = [
|
|
352
352
|
config
|
|
@@ -562,17 +562,35 @@ var __webpack_exports__ = {};
|
|
|
562
562
|
const checkIsMultiRspackOptions = (config)=>Array.isArray(config);
|
|
563
563
|
async function loadExtendedConfig(config, configPath, cwd, options) {
|
|
564
564
|
if (checkIsMultiRspackOptions(config)) {
|
|
565
|
-
const
|
|
565
|
+
const resultPathMap = new WeakMap();
|
|
566
|
+
const extendedConfigs = await Promise.all(config.map(async (item)=>{
|
|
567
|
+
const { config, pathMap } = await loadExtendedConfig(item, configPath, cwd, options);
|
|
568
|
+
resultPathMap.set(config, pathMap.get(config));
|
|
569
|
+
return config;
|
|
570
|
+
}));
|
|
566
571
|
extendedConfigs.parallelism = config.parallelism;
|
|
567
|
-
return
|
|
572
|
+
return {
|
|
573
|
+
config: extendedConfigs,
|
|
574
|
+
pathMap: resultPathMap
|
|
575
|
+
};
|
|
568
576
|
}
|
|
569
|
-
|
|
577
|
+
const pathMap = new WeakMap();
|
|
578
|
+
pathMap.set(config, [
|
|
579
|
+
configPath
|
|
580
|
+
]);
|
|
581
|
+
if (!("extends" in config) || !config.extends) return {
|
|
582
|
+
config,
|
|
583
|
+
pathMap
|
|
584
|
+
};
|
|
570
585
|
const extendsList = Array.isArray(config.extends) ? config.extends : [
|
|
571
586
|
config.extends
|
|
572
587
|
];
|
|
573
588
|
const { extends: _, ...configWithoutExtends } = config;
|
|
574
589
|
const baseDir = external_node_path_default().dirname(configPath);
|
|
575
590
|
let resultConfig = configWithoutExtends;
|
|
591
|
+
pathMap.set(resultConfig, [
|
|
592
|
+
configPath
|
|
593
|
+
]);
|
|
576
594
|
for (const extendPath of extendsList){
|
|
577
595
|
let resolvedPath;
|
|
578
596
|
if (extendPath.startsWith(".") || extendPath.startsWith("/") || extendPath.includes(":\\")) {
|
|
@@ -594,34 +612,41 @@ var __webpack_exports__ = {};
|
|
|
594
612
|
}
|
|
595
613
|
if (!external_node_fs_default().existsSync(resolvedPath)) throw new Error(`Extended configuration file "${resolvedPath}" not found.`);
|
|
596
614
|
if (isTsFile(resolvedPath) && "register" === options.configLoader) await registerLoader(resolvedPath);
|
|
597
|
-
let
|
|
598
|
-
if ("function" == typeof
|
|
615
|
+
let loadedConfig = await crossImport(resolvedPath, cwd);
|
|
616
|
+
if ("function" == typeof loadedConfig) {
|
|
599
617
|
var _options_argv;
|
|
600
|
-
|
|
601
|
-
if ("function" == typeof
|
|
618
|
+
loadedConfig = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
|
|
619
|
+
if ("function" == typeof loadedConfig.then) loadedConfig = await loadedConfig;
|
|
602
620
|
}
|
|
603
|
-
extendedConfig = await loadExtendedConfig(
|
|
621
|
+
const { config: extendedConfig, pathMap: extendedPathMap } = await loadExtendedConfig(loadedConfig, resolvedPath, cwd, options);
|
|
622
|
+
const configPaths = [
|
|
623
|
+
...pathMap.get(resultConfig) || [],
|
|
624
|
+
...extendedPathMap.get(extendedConfig) || []
|
|
625
|
+
];
|
|
604
626
|
resultConfig = core_.util.cleverMerge(extendedConfig, resultConfig);
|
|
627
|
+
pathMap.set(resultConfig, configPaths);
|
|
605
628
|
}
|
|
606
|
-
return
|
|
629
|
+
return {
|
|
630
|
+
config: resultConfig,
|
|
631
|
+
pathMap
|
|
632
|
+
};
|
|
607
633
|
}
|
|
608
634
|
async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
609
|
-
let configPath;
|
|
610
|
-
let loadedConfig;
|
|
635
|
+
let configPath = "";
|
|
611
636
|
if (options.config) {
|
|
612
637
|
configPath = external_node_path_default().resolve(cwd, options.config);
|
|
613
638
|
if (!external_node_fs_default().existsSync(configPath)) throw new Error(`config file "${configPath}" not found.`);
|
|
614
|
-
if (isTsFile(configPath) && "register" === options.configLoader) await registerLoader(configPath);
|
|
615
|
-
loadedConfig = await crossImport(configPath, cwd);
|
|
616
639
|
} else {
|
|
617
640
|
const defaultConfig = utils_findConfig(external_node_path_default().resolve(cwd, loadConfig_DEFAULT_CONFIG_NAME));
|
|
618
|
-
if (!defaultConfig) return
|
|
641
|
+
if (!defaultConfig) return null;
|
|
619
642
|
configPath = defaultConfig;
|
|
620
|
-
if (isTsFile(defaultConfig) && "register" === options.configLoader) await registerLoader(defaultConfig);
|
|
621
|
-
loadedConfig = await crossImport(defaultConfig, cwd);
|
|
622
643
|
}
|
|
623
|
-
if ("
|
|
624
|
-
|
|
644
|
+
if (isTsFile(configPath) && "register" === options.configLoader) await registerLoader(configPath);
|
|
645
|
+
const loadedConfig = await crossImport(configPath, cwd);
|
|
646
|
+
return {
|
|
647
|
+
loadedConfig,
|
|
648
|
+
configPath
|
|
649
|
+
};
|
|
625
650
|
}
|
|
626
651
|
function _define_property(obj, key, value) {
|
|
627
652
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -636,8 +661,8 @@ var __webpack_exports__ = {};
|
|
|
636
661
|
class RspackCLI {
|
|
637
662
|
async createCompiler(options, rspackCommand, callback) {
|
|
638
663
|
process.env.RSPACK_CONFIG_VALIDATE ??= "loose";
|
|
639
|
-
let config = await this.loadConfig(options);
|
|
640
|
-
config = await this.buildConfig(config, options, rspackCommand);
|
|
664
|
+
let { config, pathMap } = await this.loadConfig(options);
|
|
665
|
+
config = await this.buildConfig(config, pathMap, options, rspackCommand);
|
|
641
666
|
const isWatch = Array.isArray(config) ? config.some((i)=>i.watch) : config.watch;
|
|
642
667
|
let compiler;
|
|
643
668
|
try {
|
|
@@ -691,10 +716,11 @@ var __webpack_exports__ = {};
|
|
|
691
716
|
];
|
|
692
717
|
for (const command of builtinCommands)command.apply(this);
|
|
693
718
|
}
|
|
694
|
-
async buildConfig(item, options, command) {
|
|
719
|
+
async buildConfig(item, pathMap, options, command) {
|
|
695
720
|
const isBuild = "build" === command;
|
|
696
721
|
const isServe = "serve" === command;
|
|
697
722
|
const internalBuildConfig = async (item)=>{
|
|
723
|
+
var _item_experiments;
|
|
698
724
|
if (options.entry) item.entry = {
|
|
699
725
|
main: options.entry.map((x)=>external_node_path_default().resolve(process.cwd(), x))[0]
|
|
700
726
|
};
|
|
@@ -725,6 +751,14 @@ var __webpack_exports__ = {};
|
|
|
725
751
|
const installed = (item.plugins ||= []).find((item)=>item instanceof core_.ProgressPlugin);
|
|
726
752
|
if (!installed) (item.plugins ??= []).push(new core_.ProgressPlugin());
|
|
727
753
|
}
|
|
754
|
+
const cacheOptions = null == (_item_experiments = item.experiments) ? void 0 : _item_experiments.cache;
|
|
755
|
+
if ("object" == typeof cacheOptions && "persistent" === cacheOptions.type) {
|
|
756
|
+
const configPaths = pathMap.get(item);
|
|
757
|
+
if (configPaths) cacheOptions.buildDependencies = [
|
|
758
|
+
...configPaths,
|
|
759
|
+
...cacheOptions.buildDependencies || []
|
|
760
|
+
];
|
|
761
|
+
}
|
|
728
762
|
if (void 0 === item.stats) item.stats = {
|
|
729
763
|
preset: "errors-warnings",
|
|
730
764
|
timings: true
|
|
@@ -744,22 +778,30 @@ var __webpack_exports__ = {};
|
|
|
744
778
|
return internalBuildConfig(item);
|
|
745
779
|
}
|
|
746
780
|
async loadConfig(options) {
|
|
747
|
-
|
|
781
|
+
const config = await loadRspackConfig(options);
|
|
782
|
+
if (!config) return {
|
|
783
|
+
config: this.filterConfig(options, {}),
|
|
784
|
+
pathMap: new WeakMap()
|
|
785
|
+
};
|
|
786
|
+
let { loadedConfig, configPath } = config;
|
|
748
787
|
if ("function" == typeof loadedConfig) {
|
|
749
788
|
var _options_argv;
|
|
750
789
|
let functionResult = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
|
|
751
790
|
if ("function" == typeof functionResult.then) functionResult = await functionResult;
|
|
752
791
|
loadedConfig = functionResult;
|
|
753
|
-
if ("extends" in loadedConfig && loadedConfig.extends) {
|
|
754
|
-
const tempConfigPath = external_node_path_default().resolve(process.cwd(), "rspack.config.js");
|
|
755
|
-
loadedConfig = await loadExtendedConfig(loadedConfig, tempConfigPath, process.cwd(), options);
|
|
756
|
-
}
|
|
757
792
|
}
|
|
793
|
+
const { config: extendedConfig, pathMap } = await loadExtendedConfig(loadedConfig, configPath, process.cwd(), options);
|
|
794
|
+
return {
|
|
795
|
+
config: this.filterConfig(options, extendedConfig),
|
|
796
|
+
pathMap
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
filterConfig(options, config) {
|
|
758
800
|
if (options.configName) {
|
|
759
801
|
const notFoundConfigNames = [];
|
|
760
|
-
|
|
802
|
+
config = options.configName.map((configName)=>{
|
|
761
803
|
let found;
|
|
762
|
-
found = Array.isArray(
|
|
804
|
+
found = Array.isArray(config) ? config.find((options)=>options.name === configName) : config.name === configName ? config : void 0;
|
|
763
805
|
if (!found) notFoundConfigNames.push(configName);
|
|
764
806
|
return found;
|
|
765
807
|
});
|
|
@@ -768,7 +810,7 @@ var __webpack_exports__ = {};
|
|
|
768
810
|
process.exit(2);
|
|
769
811
|
}
|
|
770
812
|
}
|
|
771
|
-
return
|
|
813
|
+
return config;
|
|
772
814
|
}
|
|
773
815
|
isMultipleCompiler(compiler) {
|
|
774
816
|
return Boolean(compiler.compilers);
|
package/dist/index.mjs
CHANGED
|
@@ -311,7 +311,7 @@ class PreviewCommand {
|
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
313
|
const { RspackDevServer } = await import("@rspack/dev-server");
|
|
314
|
-
let config = await cli.loadConfig(rspackOptions);
|
|
314
|
+
let { config } = await cli.loadConfig(rspackOptions);
|
|
315
315
|
config = await getPreviewConfig(config, options);
|
|
316
316
|
if (!Array.isArray(config)) config = [
|
|
317
317
|
config
|
|
@@ -526,17 +526,35 @@ const registerLoader = async (configPath)=>{
|
|
|
526
526
|
const checkIsMultiRspackOptions = (config)=>Array.isArray(config);
|
|
527
527
|
async function loadExtendedConfig(config, configPath, cwd, options) {
|
|
528
528
|
if (checkIsMultiRspackOptions(config)) {
|
|
529
|
-
const
|
|
529
|
+
const resultPathMap = new WeakMap();
|
|
530
|
+
const extendedConfigs = await Promise.all(config.map(async (item)=>{
|
|
531
|
+
const { config, pathMap } = await loadExtendedConfig(item, configPath, cwd, options);
|
|
532
|
+
resultPathMap.set(config, pathMap.get(config));
|
|
533
|
+
return config;
|
|
534
|
+
}));
|
|
530
535
|
extendedConfigs.parallelism = config.parallelism;
|
|
531
|
-
return
|
|
536
|
+
return {
|
|
537
|
+
config: extendedConfigs,
|
|
538
|
+
pathMap: resultPathMap
|
|
539
|
+
};
|
|
532
540
|
}
|
|
533
|
-
|
|
541
|
+
const pathMap = new WeakMap();
|
|
542
|
+
pathMap.set(config, [
|
|
543
|
+
configPath
|
|
544
|
+
]);
|
|
545
|
+
if (!("extends" in config) || !config.extends) return {
|
|
546
|
+
config,
|
|
547
|
+
pathMap
|
|
548
|
+
};
|
|
534
549
|
const extendsList = Array.isArray(config.extends) ? config.extends : [
|
|
535
550
|
config.extends
|
|
536
551
|
];
|
|
537
552
|
const { extends: _, ...configWithoutExtends } = config;
|
|
538
553
|
const baseDir = external_node_path_["default"].dirname(configPath);
|
|
539
554
|
let resultConfig = configWithoutExtends;
|
|
555
|
+
pathMap.set(resultConfig, [
|
|
556
|
+
configPath
|
|
557
|
+
]);
|
|
540
558
|
for (const extendPath of extendsList){
|
|
541
559
|
let resolvedPath;
|
|
542
560
|
if (extendPath.startsWith(".") || extendPath.startsWith("/") || extendPath.includes(":\\")) {
|
|
@@ -558,34 +576,41 @@ async function loadExtendedConfig(config, configPath, cwd, options) {
|
|
|
558
576
|
}
|
|
559
577
|
if (!external_node_fs_["default"].existsSync(resolvedPath)) throw new Error(`Extended configuration file "${resolvedPath}" not found.`);
|
|
560
578
|
if (isTsFile(resolvedPath) && "register" === options.configLoader) await registerLoader(resolvedPath);
|
|
561
|
-
let
|
|
562
|
-
if ("function" == typeof
|
|
579
|
+
let loadedConfig = await crossImport(resolvedPath, cwd);
|
|
580
|
+
if ("function" == typeof loadedConfig) {
|
|
563
581
|
var _options_argv;
|
|
564
|
-
|
|
565
|
-
if ("function" == typeof
|
|
582
|
+
loadedConfig = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
|
|
583
|
+
if ("function" == typeof loadedConfig.then) loadedConfig = await loadedConfig;
|
|
566
584
|
}
|
|
567
|
-
extendedConfig = await loadExtendedConfig(
|
|
585
|
+
const { config: extendedConfig, pathMap: extendedPathMap } = await loadExtendedConfig(loadedConfig, resolvedPath, cwd, options);
|
|
586
|
+
const configPaths = [
|
|
587
|
+
...pathMap.get(resultConfig) || [],
|
|
588
|
+
...extendedPathMap.get(extendedConfig) || []
|
|
589
|
+
];
|
|
568
590
|
resultConfig = core_.util.cleverMerge(extendedConfig, resultConfig);
|
|
591
|
+
pathMap.set(resultConfig, configPaths);
|
|
569
592
|
}
|
|
570
|
-
return
|
|
593
|
+
return {
|
|
594
|
+
config: resultConfig,
|
|
595
|
+
pathMap
|
|
596
|
+
};
|
|
571
597
|
}
|
|
572
598
|
async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
573
|
-
let configPath;
|
|
574
|
-
let loadedConfig;
|
|
599
|
+
let configPath = "";
|
|
575
600
|
if (options.config) {
|
|
576
601
|
configPath = external_node_path_["default"].resolve(cwd, options.config);
|
|
577
602
|
if (!external_node_fs_["default"].existsSync(configPath)) throw new Error(`config file "${configPath}" not found.`);
|
|
578
|
-
if (isTsFile(configPath) && "register" === options.configLoader) await registerLoader(configPath);
|
|
579
|
-
loadedConfig = await crossImport(configPath, cwd);
|
|
580
603
|
} else {
|
|
581
604
|
const defaultConfig = utils_findConfig(external_node_path_["default"].resolve(cwd, loadConfig_DEFAULT_CONFIG_NAME));
|
|
582
|
-
if (!defaultConfig) return
|
|
605
|
+
if (!defaultConfig) return null;
|
|
583
606
|
configPath = defaultConfig;
|
|
584
|
-
if (isTsFile(defaultConfig) && "register" === options.configLoader) await registerLoader(defaultConfig);
|
|
585
|
-
loadedConfig = await crossImport(defaultConfig, cwd);
|
|
586
607
|
}
|
|
587
|
-
if ("
|
|
588
|
-
|
|
608
|
+
if (isTsFile(configPath) && "register" === options.configLoader) await registerLoader(configPath);
|
|
609
|
+
const loadedConfig = await crossImport(configPath, cwd);
|
|
610
|
+
return {
|
|
611
|
+
loadedConfig,
|
|
612
|
+
configPath
|
|
613
|
+
};
|
|
589
614
|
}
|
|
590
615
|
function _define_property(obj, key, value) {
|
|
591
616
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
@@ -600,8 +625,8 @@ function _define_property(obj, key, value) {
|
|
|
600
625
|
class RspackCLI {
|
|
601
626
|
async createCompiler(options, rspackCommand, callback) {
|
|
602
627
|
process.env.RSPACK_CONFIG_VALIDATE ??= "loose";
|
|
603
|
-
let config = await this.loadConfig(options);
|
|
604
|
-
config = await this.buildConfig(config, options, rspackCommand);
|
|
628
|
+
let { config, pathMap } = await this.loadConfig(options);
|
|
629
|
+
config = await this.buildConfig(config, pathMap, options, rspackCommand);
|
|
605
630
|
const isWatch = Array.isArray(config) ? config.some((i)=>i.watch) : config.watch;
|
|
606
631
|
let compiler;
|
|
607
632
|
try {
|
|
@@ -655,10 +680,11 @@ class RspackCLI {
|
|
|
655
680
|
];
|
|
656
681
|
for (const command of builtinCommands)command.apply(this);
|
|
657
682
|
}
|
|
658
|
-
async buildConfig(item, options, command) {
|
|
683
|
+
async buildConfig(item, pathMap, options, command) {
|
|
659
684
|
const isBuild = "build" === command;
|
|
660
685
|
const isServe = "serve" === command;
|
|
661
686
|
const internalBuildConfig = async (item)=>{
|
|
687
|
+
var _item_experiments;
|
|
662
688
|
if (options.entry) item.entry = {
|
|
663
689
|
main: options.entry.map((x)=>external_node_path_["default"].resolve(process.cwd(), x))[0]
|
|
664
690
|
};
|
|
@@ -689,6 +715,14 @@ class RspackCLI {
|
|
|
689
715
|
const installed = (item.plugins ||= []).find((item)=>item instanceof core_.ProgressPlugin);
|
|
690
716
|
if (!installed) (item.plugins ??= []).push(new core_.ProgressPlugin());
|
|
691
717
|
}
|
|
718
|
+
const cacheOptions = null == (_item_experiments = item.experiments) ? void 0 : _item_experiments.cache;
|
|
719
|
+
if ("object" == typeof cacheOptions && "persistent" === cacheOptions.type) {
|
|
720
|
+
const configPaths = pathMap.get(item);
|
|
721
|
+
if (configPaths) cacheOptions.buildDependencies = [
|
|
722
|
+
...configPaths,
|
|
723
|
+
...cacheOptions.buildDependencies || []
|
|
724
|
+
];
|
|
725
|
+
}
|
|
692
726
|
if (void 0 === item.stats) item.stats = {
|
|
693
727
|
preset: "errors-warnings",
|
|
694
728
|
timings: true
|
|
@@ -708,22 +742,30 @@ class RspackCLI {
|
|
|
708
742
|
return internalBuildConfig(item);
|
|
709
743
|
}
|
|
710
744
|
async loadConfig(options) {
|
|
711
|
-
|
|
745
|
+
const config = await loadRspackConfig(options);
|
|
746
|
+
if (!config) return {
|
|
747
|
+
config: this.filterConfig(options, {}),
|
|
748
|
+
pathMap: new WeakMap()
|
|
749
|
+
};
|
|
750
|
+
let { loadedConfig, configPath } = config;
|
|
712
751
|
if ("function" == typeof loadedConfig) {
|
|
713
752
|
var _options_argv;
|
|
714
753
|
let functionResult = loadedConfig(null == (_options_argv = options.argv) ? void 0 : _options_argv.env, options.argv);
|
|
715
754
|
if ("function" == typeof functionResult.then) functionResult = await functionResult;
|
|
716
755
|
loadedConfig = functionResult;
|
|
717
|
-
if ("extends" in loadedConfig && loadedConfig.extends) {
|
|
718
|
-
const tempConfigPath = external_node_path_["default"].resolve(process.cwd(), "rspack.config.js");
|
|
719
|
-
loadedConfig = await loadExtendedConfig(loadedConfig, tempConfigPath, process.cwd(), options);
|
|
720
|
-
}
|
|
721
756
|
}
|
|
757
|
+
const { config: extendedConfig, pathMap } = await loadExtendedConfig(loadedConfig, configPath, process.cwd(), options);
|
|
758
|
+
return {
|
|
759
|
+
config: this.filterConfig(options, extendedConfig),
|
|
760
|
+
pathMap
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
filterConfig(options, config) {
|
|
722
764
|
if (options.configName) {
|
|
723
765
|
const notFoundConfigNames = [];
|
|
724
|
-
|
|
766
|
+
config = options.configName.map((configName)=>{
|
|
725
767
|
let found;
|
|
726
|
-
found = Array.isArray(
|
|
768
|
+
found = Array.isArray(config) ? config.find((options)=>options.name === configName) : config.name === configName ? config : void 0;
|
|
727
769
|
if (!found) notFoundConfigNames.push(configName);
|
|
728
770
|
return found;
|
|
729
771
|
});
|
|
@@ -732,7 +774,7 @@ class RspackCLI {
|
|
|
732
774
|
process.exit(2);
|
|
733
775
|
}
|
|
734
776
|
}
|
|
735
|
-
return
|
|
777
|
+
return config;
|
|
736
778
|
}
|
|
737
779
|
isMultipleCompiler(compiler) {
|
|
738
780
|
return Boolean(compiler.compilers);
|
|
@@ -9,5 +9,19 @@ export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions
|
|
|
9
9
|
* @param options CLI options
|
|
10
10
|
* @returns The merged configuration
|
|
11
11
|
*/
|
|
12
|
-
export declare function loadExtendedConfig(config: RspackOptions
|
|
13
|
-
|
|
12
|
+
export declare function loadExtendedConfig(config: RspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<{
|
|
13
|
+
config: RspackOptions;
|
|
14
|
+
pathMap: WeakMap<RspackOptions, string[]>;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function loadExtendedConfig(config: MultiRspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<{
|
|
17
|
+
config: MultiRspackOptions;
|
|
18
|
+
pathMap: WeakMap<RspackOptions, string[]>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function loadExtendedConfig(config: RspackOptions | MultiRspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<{
|
|
21
|
+
config: RspackOptions | MultiRspackOptions;
|
|
22
|
+
pathMap: WeakMap<RspackOptions, string[]>;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function loadRspackConfig(options: RspackCLIOptions, cwd?: string): Promise<{
|
|
25
|
+
loadedConfig: LoadedRspackConfig;
|
|
26
|
+
configPath: string;
|
|
27
|
+
} | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/cli",
|
|
3
|
-
"version": "1.4.12-canary-
|
|
3
|
+
"version": "1.4.12-canary-becf0a0e-20250808091433",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"execa": "^5.1.1",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
|
-
"@rspack/core": "npm:@rspack-canary/core@1.4.12-canary-
|
|
51
|
+
"@rspack/core": "npm:@rspack-canary/core@1.4.12-canary-becf0a0e-20250808091433"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@rspack/core": "^1.0.0-alpha || ^1.x"
|