@rspack-debug/cli 1.3.14

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.
@@ -0,0 +1,48 @@
1
+ import type { DevServer } from "@rspack/core";
2
+ import type { Colorette } from "colorette";
3
+ import type { RspackCLI } from "./cli";
4
+ export type { Configuration } from "@rspack/core";
5
+ export interface IRspackCLI {
6
+ runRspack(): Promise<void>;
7
+ }
8
+ export type LogHandler = (value: any) => void;
9
+ export interface RspackCLIColors extends Colorette {
10
+ isColorSupported: boolean;
11
+ }
12
+ export interface RspackCLILogger {
13
+ error: LogHandler;
14
+ warn: LogHandler;
15
+ info: LogHandler;
16
+ success: LogHandler;
17
+ log: LogHandler;
18
+ raw: LogHandler;
19
+ }
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?: 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
+ export interface RspackCommand {
46
+ apply(cli: RspackCLI): Promise<void>;
47
+ }
48
+ export type RspackDevServerOptions = DevServer;
@@ -0,0 +1 @@
1
+ export declare const crossImport: <T = any>(path: string, cwd?: string) => Promise<T>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Takes a basePath like `webpack.config`, return `webpack.config.{ext}` if
3
+ * exists. returns undefined if none of them exists
4
+ */
5
+ declare const findConfig: (basePath: string) => string | undefined;
6
+ export default findConfig;
@@ -0,0 +1,2 @@
1
+ declare const isEsmFile: (filePath: string, cwd?: string) => boolean;
2
+ export default isEsmFile;
@@ -0,0 +1,2 @@
1
+ declare const isTsFile: (configPath: string) => boolean;
2
+ export default isTsFile;
@@ -0,0 +1,13 @@
1
+ import { type MultiRspackOptions, type RspackOptions } from "@rspack/core";
2
+ import type { RspackCLIOptions } from "../types";
3
+ export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions | ((env: Record<string, any>, argv?: Record<string, any>) => RspackOptions | MultiRspackOptions);
4
+ /**
5
+ * Loads and merges configurations from the 'extends' property
6
+ * @param config The configuration object that may contain an 'extends' property
7
+ * @param configPath The path to the configuration file
8
+ * @param cwd The current working directory
9
+ * @param options CLI options
10
+ * @returns The merged configuration
11
+ */
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>;
@@ -0,0 +1,77 @@
1
+ import type yargs from "yargs";
2
+ /**
3
+ * Apply common options for all commands
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
+ }>>;
27
+ /**
28
+ * Apply common options for `build` and `serve` commands
29
+ */
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: "boolean";
59
+ default: boolean;
60
+ describe: string;
61
+ alias: string;
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;
@@ -0,0 +1 @@
1
+ export declare function applyProfile(filterValue: string, traceLayer?: string, traceOutput?: string): Promise<void>;
@@ -0,0 +1,4 @@
1
+ declare const readPackageUp: (cwd?: string) => {
2
+ type?: "module";
3
+ } | null;
4
+ export default readPackageUp;
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@rspack-debug/cli",
3
+ "version": "1.3.14",
4
+ "description": "CLI for rspack",
5
+ "homepage": "https://rspack.rs",
6
+ "bugs": "https://github.com/web-infra-dev/rspack/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/web-infra-dev/rspack",
10
+ "directory": "packages/rspack-cli"
11
+ },
12
+ "license": "MIT",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "bin": {
24
+ "rspack": "./bin/rspack.js"
25
+ },
26
+ "files": [
27
+ "bin",
28
+ "dist"
29
+ ],
30
+ "dependencies": {
31
+ "@discoveryjs/json-ext": "^0.5.7",
32
+ "@rspack/dev-server": "1.1.2",
33
+ "colorette": "2.0.20",
34
+ "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"
39
+ },
40
+ "devDependencies": {
41
+ "@rslib/core": "0.9.1",
42
+ "@types/interpret": "^1.1.3",
43
+ "@types/rechoir": "^0.6.4",
44
+ "@types/webpack-bundle-analyzer": "^4.7.0",
45
+ "@types/yargs": "17.0.33",
46
+ "concat-stream": "^2.0.0",
47
+ "cross-env": "^7.0.3",
48
+ "execa": "^5.1.1",
49
+ "ts-node": "^10.9.2",
50
+ "typescript": "^5.8.3",
51
+ "@rspack/core": "npm:@rspack-debug/core@1.3.14"
52
+ },
53
+ "peerDependencies": {
54
+ "@rspack/core": "^1.0.0-alpha || ^1.x"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "provenance": true
59
+ },
60
+ "scripts": {
61
+ "build": "rslib build",
62
+ "dev": "rslib build -w",
63
+ "test": "cross-env RUST_BACKTRACE=full jest --colors"
64
+ }
65
+ }