@rspack-debug/cli 1.4.9 → 1.6.2

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/types.d.ts CHANGED
@@ -1,14 +1,9 @@
1
- import type { DevServer } from "@rspack/core";
2
- import type { Colorette } from "colorette";
3
1
  import type { RspackCLI } from "./cli";
4
2
  export type { Configuration } from "@rspack/core";
5
- export interface IRspackCLI {
6
- runRspack(): Promise<void>;
7
- }
8
3
  export type LogHandler = (value: any) => void;
9
- export interface RspackCLIColors extends Colorette {
4
+ export type RspackCLIColors = {
10
5
  isColorSupported: boolean;
11
- }
6
+ } & Omit<typeof import("picocolors"), "createColors">;
12
7
  export interface RspackCLILogger {
13
8
  error: LogHandler;
14
9
  warn: LogHandler;
@@ -17,32 +12,6 @@ export interface RspackCLILogger {
17
12
  log: LogHandler;
18
13
  raw: LogHandler;
19
14
  }
20
- export interface RspackCLIOptions {
21
- config?: string;
22
- argv?: Record<string, any>;
23
- configName?: string[];
24
- configLoader?: string;
25
- nodeEnv?: string;
26
- }
27
- export interface RspackBuildCLIOptions extends RspackCLIOptions {
28
- entry?: string[];
29
- devtool?: string | boolean;
30
- mode?: string;
31
- watch?: boolean;
32
- analyze?: boolean;
33
- profile?: boolean;
34
- env?: Record<string, any>;
35
- outputPath?: string;
36
- }
37
- export interface RspackPreviewCLIOptions extends RspackCLIOptions {
38
- dir?: string;
39
- port?: number;
40
- host?: string;
41
- open?: boolean;
42
- server?: string;
43
- publicPath?: string;
44
- }
45
15
  export interface RspackCommand {
46
16
  apply(cli: RspackCLI): Promise<void>;
47
17
  }
48
- export type RspackDevServerOptions = DevServer;
@@ -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;
@@ -1,2 +1,3 @@
1
+ export declare const TS_EXTENSION: string[];
1
2
  declare const isTsFile: (configPath: string) => boolean;
2
3
  export default isTsFile;
@@ -1,5 +1,6 @@
1
- import { type MultiRspackOptions, type RspackOptions } from "@rspack/core";
2
- import type { RspackCLIOptions } from "../types";
1
+ import type { MultiRspackOptions, RspackOptions } from "@rspack/core";
2
+ import type { CommonOptions } from "./options";
3
+ export declare function compile(sourcecode: string, filename: string): string;
3
4
  export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions | ((env: Record<string, any>, argv?: Record<string, any>) => RspackOptions | MultiRspackOptions);
4
5
  /**
5
6
  * Loads and merges configurations from the 'extends' property
@@ -9,5 +10,19 @@ export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions
9
10
  * @param options CLI options
10
11
  * @returns The merged configuration
11
12
  */
12
- export declare function loadExtendedConfig(config: RspackOptions | MultiRspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<RspackOptions | MultiRspackOptions>;
13
- export declare function loadRspackConfig(options: RspackCLIOptions, cwd?: string): Promise<LoadedRspackConfig>;
13
+ export declare function loadExtendedConfig(config: RspackOptions, configPath: string, cwd: string, options: CommonOptions): Promise<{
14
+ config: RspackOptions;
15
+ pathMap: WeakMap<RspackOptions, string[]>;
16
+ }>;
17
+ export declare function loadExtendedConfig(config: MultiRspackOptions, configPath: string, cwd: string, options: CommonOptions): Promise<{
18
+ config: MultiRspackOptions;
19
+ pathMap: WeakMap<RspackOptions, string[]>;
20
+ }>;
21
+ export declare function loadExtendedConfig(config: RspackOptions | MultiRspackOptions, configPath: string, cwd: string, options: CommonOptions): Promise<{
22
+ config: RspackOptions | MultiRspackOptions;
23
+ pathMap: WeakMap<RspackOptions, string[]>;
24
+ }>;
25
+ export declare function loadRspackConfig(options: CommonOptions, cwd?: string): Promise<{
26
+ loadedConfig: LoadedRspackConfig;
27
+ configPath: string;
28
+ } | null>;
@@ -1,77 +1,29 @@
1
- import type yargs from "yargs";
1
+ import type { Command } from "cac";
2
2
  /**
3
3
  * Apply common options for all commands
4
4
  */
5
- export declare const commonOptions: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit<{}, "nodeEnv" | "config" | "configName" | "configLoader"> & yargs.InferredOptionTypes<{
6
- config: {
7
- g: boolean;
8
- type: "string";
9
- describe: string;
10
- alias: string;
11
- };
12
- configName: {
13
- type: "array";
14
- string: true;
15
- describe: string;
16
- };
17
- configLoader: {
18
- type: "string";
19
- default: string;
20
- describe: string;
21
- };
22
- nodeEnv: {
23
- string: true;
24
- describe: string;
25
- };
26
- }>>;
5
+ export declare const commonOptions: (command: Command) => Command;
6
+ export type CommonOptions = {
7
+ config?: string;
8
+ configName?: string[];
9
+ configLoader?: string;
10
+ env?: Record<string, unknown> | string[];
11
+ nodeEnv?: string;
12
+ };
13
+ export declare const normalizeCommonOptions: (options: CommonOptions | CommonOptionsForBuildAndServe, action: "serve" | "build" | "preview") => void;
27
14
  /**
28
15
  * Apply common options for `build` and `serve` commands
29
16
  */
30
- export declare const commonOptionsForBuildAndServe: (yargs: yargs.Argv) => yargs.Argv<yargs.Omit<{}, "entry" | "devtool" | "mode" | "watch" | "env" | "outputPath"> & yargs.InferredOptionTypes<{
31
- entry: {
32
- type: "array";
33
- string: true;
34
- describe: string;
35
- };
36
- outputPath: {
37
- type: "string";
38
- describe: string;
39
- alias: string;
40
- };
41
- mode: {
42
- type: "string";
43
- describe: string;
44
- alias: string;
45
- };
46
- watch: {
47
- type: "boolean";
48
- default: boolean;
49
- describe: string;
50
- alias: string;
51
- };
52
- env: {
53
- type: "array";
54
- string: true;
55
- describe: string;
56
- };
57
- devtool: {
58
- type: "string";
59
- describe: string;
60
- alias: string;
61
- coerce: (arg: any) => string | boolean;
62
- };
63
- }>>;
64
- export declare function normalizeEnv(argv: yargs.Arguments): void;
65
- /**
66
- * set builtin env from cli - like `WEBPACK_BUNDLE=true`. also for `RSPACK_` prefixed.
67
- * @param env the `argv.env` object
68
- * @param envNameSuffix the added env will be `WEBPACK_${envNameSuffix}` and `RSPACK_${envNameSuffix}`
69
- * @param value
70
- */
71
- export declare function setBuiltinEnvArg(env: Record<string, any>, envNameSuffix: string, value: any): void;
72
- /**
73
- * infer `argv.env` as an object for it was transformed from array to object after `normalizeEnv` middleware
74
- * @returns the reference of `argv.env` object
75
- */
76
- export declare function ensureEnvObject<T extends Record<string, unknown>>(options: yargs.Arguments): T;
77
- export declare function setDefaultNodeEnv(options: yargs.Arguments, defaultEnv: string): void;
17
+ export declare const commonOptionsForBuildAndServe: (command: Command) => Command;
18
+ export type CommonOptionsForBuildAndServe = CommonOptions & {
19
+ analyze?: boolean;
20
+ devtool?: string | boolean;
21
+ entry?: string[];
22
+ mode?: string;
23
+ outputPath?: string;
24
+ profile?: boolean;
25
+ watch?: boolean;
26
+ };
27
+ export declare function setDefaultNodeEnv(options: {
28
+ nodeEnv?: unknown;
29
+ }, defaultEnv: string): void;
@@ -0,0 +1,2 @@
1
+ declare const rspack: (typeof import("@rspack/core"))["rspack"];
2
+ export { rspack };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack-debug/cli",
3
- "version": "1.4.9",
3
+ "version": "1.6.2",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -29,26 +29,23 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@discoveryjs/json-ext": "^0.5.7",
32
- "@rspack/dev-server": "~1.1.3",
33
- "colorette": "2.0.20",
32
+ "@rspack/dev-server": "~1.1.4",
34
33
  "exit-hook": "^4.0.0",
35
- "interpret": "^3.1.1",
36
- "rechoir": "^0.8.0",
37
- "webpack-bundle-analyzer": "4.10.2",
38
- "yargs": "17.7.2"
34
+ "webpack-bundle-analyzer": "4.10.2"
39
35
  },
40
36
  "devDependencies": {
41
- "@rslib/core": "0.10.5",
42
- "@types/interpret": "^1.1.3",
43
- "@types/rechoir": "^0.6.4",
37
+ "@rslib/core": "0.17.1",
44
38
  "@types/webpack-bundle-analyzer": "^4.7.0",
45
- "@types/yargs": "17.0.33",
39
+ "cac": "^6.7.14",
46
40
  "concat-stream": "^2.0.0",
47
- "cross-env": "^7.0.3",
41
+ "cross-env": "^10.1.0",
48
42
  "execa": "^5.1.1",
43
+ "picocolors": "^1.1.1",
44
+ "pirates": "^4.0.7",
49
45
  "ts-node": "^10.9.2",
50
- "typescript": "^5.8.3",
51
- "@rspack/core": "npm:@rspack-debug/core@1.4.9"
46
+ "typescript": "^5.9.3",
47
+ "@rspack/core": "npm:@rspack-debug/core@1.6.2",
48
+ "@rspack/test-tools": "npm:@rspack-debug/test-tools@1.6.2"
52
49
  },
53
50
  "peerDependencies": {
54
51
  "@rspack/core": "^1.0.0-alpha || ^1.x"
@@ -60,6 +57,6 @@
60
57
  "scripts": {
61
58
  "build": "rslib build",
62
59
  "dev": "rslib build -w",
63
- "test": "cross-env RUST_BACKTRACE=full jest --colors"
60
+ "test": "rstest"
64
61
  }
65
62
  }