@rspack-canary/cli 1.6.0-canary-17d2172b-20251016033144 → 1.6.0-canary-2ccce257-20251016173648

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,10 +1,6 @@
1
- import type { DevServer } from "@rspack/core";
2
1
  import type { Colorette } from "colorette";
3
2
  import type { RspackCLI } from "./cli";
4
3
  export type { Configuration } from "@rspack/core";
5
- export interface IRspackCLI {
6
- runRspack(): Promise<void>;
7
- }
8
4
  export type LogHandler = (value: any) => void;
9
5
  export interface RspackCLIColors extends Colorette {
10
6
  isColorSupported: boolean;
@@ -17,32 +13,6 @@ export interface RspackCLILogger {
17
13
  log: LogHandler;
18
14
  raw: LogHandler;
19
15
  }
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
16
  export interface RspackCommand {
46
17
  apply(cli: RspackCLI): Promise<void>;
47
18
  }
48
- export type RspackDevServerOptions = DevServer;
@@ -1,5 +1,5 @@
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
3
  export declare function compile(sourcecode: string, filename: string): string;
4
4
  export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions | ((env: Record<string, any>, argv?: Record<string, any>) => RspackOptions | MultiRspackOptions);
5
5
  /**
@@ -10,19 +10,19 @@ export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions
10
10
  * @param options CLI options
11
11
  * @returns The merged configuration
12
12
  */
13
- export declare function loadExtendedConfig(config: RspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<{
13
+ export declare function loadExtendedConfig(config: RspackOptions, configPath: string, cwd: string, options: CommonOptions): Promise<{
14
14
  config: RspackOptions;
15
15
  pathMap: WeakMap<RspackOptions, string[]>;
16
16
  }>;
17
- export declare function loadExtendedConfig(config: MultiRspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<{
17
+ export declare function loadExtendedConfig(config: MultiRspackOptions, configPath: string, cwd: string, options: CommonOptions): Promise<{
18
18
  config: MultiRspackOptions;
19
19
  pathMap: WeakMap<RspackOptions, string[]>;
20
20
  }>;
21
- export declare function loadExtendedConfig(config: RspackOptions | MultiRspackOptions, configPath: string, cwd: string, options: RspackCLIOptions): Promise<{
21
+ export declare function loadExtendedConfig(config: RspackOptions | MultiRspackOptions, configPath: string, cwd: string, options: CommonOptions): Promise<{
22
22
  config: RspackOptions | MultiRspackOptions;
23
23
  pathMap: WeakMap<RspackOptions, string[]>;
24
24
  }>;
25
- export declare function loadRspackConfig(options: RspackCLIOptions, cwd?: string): Promise<{
25
+ export declare function loadRspackConfig(options: CommonOptions, cwd?: string): Promise<{
26
26
  loadedConfig: LoadedRspackConfig;
27
27
  configPath: string;
28
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-canary/cli",
3
- "version": "1.6.0-canary-17d2172b-20251016033144",
3
+ "version": "1.6.0-canary-2ccce257-20251016173648",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -30,23 +30,22 @@
30
30
  "dependencies": {
31
31
  "@discoveryjs/json-ext": "^0.5.7",
32
32
  "@rspack/dev-server": "~1.1.4",
33
- "colorette": "2.0.20",
34
33
  "exit-hook": "^4.0.0",
35
- "webpack-bundle-analyzer": "4.10.2",
36
- "yargs": "17.7.2",
37
- "pirates": "^4.0.7"
34
+ "webpack-bundle-analyzer": "4.10.2"
38
35
  },
39
36
  "devDependencies": {
40
37
  "@rslib/core": "0.15.1",
41
38
  "@types/webpack-bundle-analyzer": "^4.7.0",
42
- "@types/yargs": "17.0.33",
39
+ "cac": "^6.7.14",
40
+ "colorette": "2.0.20",
43
41
  "concat-stream": "^2.0.0",
44
42
  "cross-env": "^10.1.0",
45
43
  "execa": "^5.1.1",
44
+ "pirates": "^4.0.7",
46
45
  "ts-node": "^10.9.2",
47
46
  "typescript": "^5.9.3",
48
- "@rspack/core": "npm:@rspack-canary/core@1.6.0-canary-17d2172b-20251016033144",
49
- "@rspack/test-tools": "npm:@rspack-canary/test-tools@1.6.0-canary-17d2172b-20251016033144"
47
+ "@rspack/core": "npm:@rspack-canary/core@1.6.0-canary-2ccce257-20251016173648",
48
+ "@rspack/test-tools": "npm:@rspack-canary/test-tools@1.6.0-canary-2ccce257-20251016173648"
50
49
  },
51
50
  "peerDependencies": {
52
51
  "@rspack/core": "^1.0.0-alpha || ^1.x"