@rspack-debug/cli 1.4.6 → 1.4.8

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { RspackPluginFunction, RspackPluginInstance } from "@rspack/core";
2
+ import * as rspackCore from "@rspack/core";
2
3
  import { type Compiler, type MultiCompiler, type MultiRspackOptions, type MultiStats, type RspackOptions, type Stats } from "@rspack/core";
3
4
  import yargs from "yargs";
4
5
  import type { RspackBuildCLIOptions, RspackCLIColors, RspackCLILogger, RspackCLIOptions } from "./types";
@@ -7,7 +8,7 @@ export declare class RspackCLI {
7
8
  colors: RspackCLIColors;
8
9
  program: yargs.Argv;
9
10
  constructor();
10
- createCompiler(options: RspackBuildCLIOptions, rspackCommand: Command, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<MultiCompiler | Compiler | null>;
11
+ createCompiler(options: RspackBuildCLIOptions, rspackCommand: Command, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<rspackCore.MultiCompiler | rspackCore.Compiler | null>;
11
12
  createColors(useColor?: boolean): RspackCLIColors;
12
13
  getLogger(): RspackCLILogger;
13
14
  run(argv: string[]): Promise<void>;
package/dist/index.js CHANGED
@@ -174,10 +174,14 @@ var __webpack_exports__ = {};
174
174
  describe: "env passed to config function"
175
175
  },
176
176
  devtool: {
177
- type: "boolean",
178
- default: false,
179
- describe: "devtool",
180
- alias: "d"
177
+ type: "string",
178
+ describe: "Specify a developer tool for debugging. Defaults to `cheap-module-source-map` in development and `source-map` in production.",
179
+ alias: "d",
180
+ coerce: (arg)=>{
181
+ if ("true" === arg) return "source-map";
182
+ if ("false" === arg || "" === arg.trim()) return false;
183
+ return arg;
184
+ }
181
185
  }
182
186
  }).alias({
183
187
  v: "version",
@@ -498,7 +502,7 @@ var __webpack_exports__ = {};
498
502
  }
499
503
  try {
500
504
  return JSON.parse(external_node_fs_default().readFileSync(packageJsonPath, "utf8"));
501
- } catch (error) {
505
+ } catch {
502
506
  return null;
503
507
  }
504
508
  };
@@ -585,7 +589,7 @@ var __webpack_exports__ = {};
585
589
  cwd
586
590
  ]
587
591
  });
588
- } catch (error) {
592
+ } catch {
589
593
  throw new Error(`Cannot find module '${extendPath}' to extend from.`);
590
594
  }
591
595
  if (!external_node_fs_default().existsSync(resolvedPath)) throw new Error(`Extended configuration file "${resolvedPath}" not found.`);
@@ -716,6 +720,7 @@ var __webpack_exports__ = {};
716
720
  if (!item.mode) item.mode = isBuild ? "production" : "development";
717
721
  if (options.mode) item.mode = options.mode;
718
722
  if (void 0 === item.devtool) item.devtool = isBuild ? "source-map" : "cheap-module-source-map";
723
+ if (void 0 !== options.devtool) item.devtool = options.devtool;
719
724
  if (isServe) {
720
725
  const installed = (item.plugins ||= []).find((item)=>item instanceof core_.ProgressPlugin);
721
726
  if (!installed) (item.plugins ??= []).push(new core_.ProgressPlugin());
package/dist/index.mjs CHANGED
@@ -139,10 +139,14 @@ const commonOptionsForBuildAndServe = (yargs)=>yargs.options({
139
139
  describe: "env passed to config function"
140
140
  },
141
141
  devtool: {
142
- type: "boolean",
143
- default: false,
144
- describe: "devtool",
145
- alias: "d"
142
+ type: "string",
143
+ describe: "Specify a developer tool for debugging. Defaults to `cheap-module-source-map` in development and `source-map` in production.",
144
+ alias: "d",
145
+ coerce: (arg)=>{
146
+ if ("true" === arg) return "source-map";
147
+ if ("false" === arg || "" === arg.trim()) return false;
148
+ return arg;
149
+ }
146
150
  }
147
151
  }).alias({
148
152
  v: "version",
@@ -462,7 +466,7 @@ const readPackageUp = (cwd = process.cwd())=>{
462
466
  }
463
467
  try {
464
468
  return JSON.parse(external_node_fs_["default"].readFileSync(packageJsonPath, "utf8"));
465
- } catch (error) {
469
+ } catch {
466
470
  return null;
467
471
  }
468
472
  };
@@ -549,7 +553,7 @@ async function loadExtendedConfig(config, configPath, cwd, options) {
549
553
  cwd
550
554
  ]
551
555
  });
552
- } catch (error) {
556
+ } catch {
553
557
  throw new Error(`Cannot find module '${extendPath}' to extend from.`);
554
558
  }
555
559
  if (!external_node_fs_["default"].existsSync(resolvedPath)) throw new Error(`Extended configuration file "${resolvedPath}" not found.`);
@@ -680,6 +684,7 @@ class RspackCLI {
680
684
  if (!item.mode) item.mode = isBuild ? "production" : "development";
681
685
  if (options.mode) item.mode = options.mode;
682
686
  if (void 0 === item.devtool) item.devtool = isBuild ? "source-map" : "cheap-module-source-map";
687
+ if (void 0 !== options.devtool) item.devtool = options.devtool;
683
688
  if (isServe) {
684
689
  const installed = (item.plugins ||= []).find((item)=>item instanceof core_.ProgressPlugin);
685
690
  if (!installed) (item.plugins ??= []).push(new core_.ProgressPlugin());
package/dist/types.d.ts CHANGED
@@ -26,7 +26,7 @@ export interface RspackCLIOptions {
26
26
  }
27
27
  export interface RspackBuildCLIOptions extends RspackCLIOptions {
28
28
  entry?: string[];
29
- devtool?: boolean;
29
+ devtool?: string | boolean;
30
30
  mode?: string;
31
31
  watch?: boolean;
32
32
  analyze?: boolean;
@@ -55,10 +55,10 @@ export declare const commonOptionsForBuildAndServe: (yargs: yargs.Argv) => yargs
55
55
  describe: string;
56
56
  };
57
57
  devtool: {
58
- type: "boolean";
59
- default: boolean;
58
+ type: "string";
60
59
  describe: string;
61
60
  alias: string;
61
+ coerce: (arg: any) => string | boolean;
62
62
  };
63
63
  }>>;
64
64
  export declare function normalizeEnv(argv: yargs.Arguments): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/cli",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -38,7 +38,7 @@
38
38
  "yargs": "17.7.2"
39
39
  },
40
40
  "devDependencies": {
41
- "@rslib/core": "0.10.0",
41
+ "@rslib/core": "0.10.5",
42
42
  "@types/interpret": "^1.1.3",
43
43
  "@types/rechoir": "^0.6.4",
44
44
  "@types/webpack-bundle-analyzer": "^4.7.0",
@@ -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-debug/core@1.4.6"
51
+ "@rspack/core": "npm:@rspack-debug/core@1.4.8"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@rspack/core": "^1.0.0-alpha || ^1.x"