@rspack/cli 2.0.0 → 2.0.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/exit-hook.js +35 -3
- package/dist/index.d.ts +301 -2
- package/dist/index.js +1209 -1
- package/dist/json-ext.js +203 -769
- package/package.json +8 -7
- package/dist/162.js +0 -1301
- package/dist/cli.d.ts +0 -49
- package/dist/commands/build.d.ts +0 -5
- package/dist/commands/preview.d.ts +0 -5
- package/dist/commands/serve.d.ts +0 -5
- package/dist/constants.d.ts +0 -3
- package/dist/types.d.ts +0 -21
- package/dist/utils/findConfig.d.ts +0 -6
- package/dist/utils/isTsFile.d.ts +0 -3
- package/dist/utils/loadConfig.d.ts +0 -28
- package/dist/utils/options.d.ts +0 -28
- package/dist/utils/profile.d.ts +0 -1
package/dist/cli.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Compiler, MultiCompiler, MultiRspackOptions, MultiStats, RspackOptions, RspackPluginFunction, RspackPluginInstance, Stats } from '@rspack/core';
|
|
2
|
-
import { type CAC } from 'cac';
|
|
3
|
-
import type { RspackCLIColors, RspackCLILogger } from './types';
|
|
4
|
-
import type { CommonOptions, CommonOptionsForBuildAndServe } from './utils/options';
|
|
5
|
-
type Command = 'serve' | 'build';
|
|
6
|
-
declare global {
|
|
7
|
-
const RSPACK_CLI_VERSION: string;
|
|
8
|
-
}
|
|
9
|
-
export declare class RspackCLI {
|
|
10
|
-
colors: RspackCLIColors;
|
|
11
|
-
program: CAC;
|
|
12
|
-
_actionPromise: Promise<void> | undefined;
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Wraps an async action handler so its promise is captured and can be
|
|
16
|
-
* awaited in `run()`. CAC's `parse()` does not await async actions,
|
|
17
|
-
* so without this wrapper, rejections become unhandled.
|
|
18
|
-
*/
|
|
19
|
-
wrapAction<T extends (...args: any[]) => Promise<void>>(fn: T): T;
|
|
20
|
-
buildCompilerConfig(options: CommonOptionsForBuildAndServe, rspackCommand: Command): Promise<RspackOptions | MultiRspackOptions>;
|
|
21
|
-
createCompiler(config: RspackOptions | MultiRspackOptions, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<MultiCompiler | Compiler | null>;
|
|
22
|
-
private createColors;
|
|
23
|
-
getLogger(): RspackCLILogger;
|
|
24
|
-
run(argv: string[]): Promise<void>;
|
|
25
|
-
private registerCommands;
|
|
26
|
-
private buildConfig;
|
|
27
|
-
loadConfig(options: CommonOptions): Promise<{
|
|
28
|
-
config: RspackOptions | MultiRspackOptions;
|
|
29
|
-
pathMap: WeakMap<RspackOptions, string[]>;
|
|
30
|
-
}>;
|
|
31
|
-
private filterConfig;
|
|
32
|
-
isMultipleCompiler(compiler: Compiler | MultiCompiler): compiler is MultiCompiler;
|
|
33
|
-
isWatch(compiler: Compiler | MultiCompiler): boolean;
|
|
34
|
-
}
|
|
35
|
-
export type RspackConfigFn = (env: Record<string, any>, argv: Record<string, any>) => RspackOptions | MultiRspackOptions;
|
|
36
|
-
export type RspackConfigAsyncFn = (env: Record<string, any>, argv: Record<string, any>) => Promise<RspackOptions | MultiRspackOptions>;
|
|
37
|
-
export type RspackConfigExport = RspackOptions | MultiRspackOptions | RspackConfigFn | RspackConfigAsyncFn;
|
|
38
|
-
/**
|
|
39
|
-
* This function helps you to autocomplete configuration types.
|
|
40
|
-
* It accepts a Rspack config object, or a function that returns a config.
|
|
41
|
-
*/
|
|
42
|
-
export declare function defineConfig(config: RspackOptions): RspackOptions;
|
|
43
|
-
export declare function defineConfig(config: MultiRspackOptions): MultiRspackOptions;
|
|
44
|
-
export declare function defineConfig(config: RspackConfigFn): RspackConfigFn;
|
|
45
|
-
export declare function defineConfig(config: RspackConfigAsyncFn): RspackConfigAsyncFn;
|
|
46
|
-
export declare function defineConfig(config: RspackConfigExport): RspackConfigExport;
|
|
47
|
-
export declare function definePlugin(plugin: RspackPluginFunction): RspackPluginFunction;
|
|
48
|
-
export declare function definePlugin(plugin: RspackPluginInstance): RspackPluginInstance;
|
|
49
|
-
export {};
|
package/dist/commands/build.d.ts
DELETED
package/dist/commands/serve.d.ts
DELETED
package/dist/constants.d.ts
DELETED
package/dist/types.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { RspackCLI } from './cli';
|
|
2
|
-
export type { Configuration } from '@rspack/core';
|
|
3
|
-
export type LogHandler = (value: any) => void;
|
|
4
|
-
export interface RspackCLIColors {
|
|
5
|
-
isColorSupported: boolean;
|
|
6
|
-
red(text: string): string;
|
|
7
|
-
yellow(text: string): string;
|
|
8
|
-
cyan(text: string): string;
|
|
9
|
-
green(text: string): string;
|
|
10
|
-
}
|
|
11
|
-
export interface RspackCLILogger {
|
|
12
|
-
error: LogHandler;
|
|
13
|
-
warn: LogHandler;
|
|
14
|
-
info: LogHandler;
|
|
15
|
-
success: LogHandler;
|
|
16
|
-
log: LogHandler;
|
|
17
|
-
raw: LogHandler;
|
|
18
|
-
}
|
|
19
|
-
export interface RspackCommand {
|
|
20
|
-
apply(cli: RspackCLI): Promise<void>;
|
|
21
|
-
}
|
package/dist/utils/isTsFile.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { MultiRspackOptions, RspackOptions } from '@rspack/core';
|
|
2
|
-
import type { CommonOptions } from './options';
|
|
3
|
-
export type LoadedRspackConfig = undefined | RspackOptions | MultiRspackOptions | ((env: Record<string, any>, argv?: Record<string, any>) => RspackOptions | MultiRspackOptions | Promise<RspackOptions | MultiRspackOptions>);
|
|
4
|
-
export declare const resolveRspackConfigExport: (configExport: LoadedRspackConfig, options: CommonOptions) => Promise<RspackOptions | MultiRspackOptions>;
|
|
5
|
-
/**
|
|
6
|
-
* Loads and merges configurations from the 'extends' property
|
|
7
|
-
* @param config The configuration object that may contain an 'extends' property
|
|
8
|
-
* @param configPath The path to the configuration file
|
|
9
|
-
* @param cwd The current working directory
|
|
10
|
-
* @param options CLI options
|
|
11
|
-
* @returns The merged configuration
|
|
12
|
-
*/
|
|
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>;
|
package/dist/utils/options.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Command } from 'cac';
|
|
2
|
-
export type ConfigLoader = 'auto' | 'jiti' | 'native';
|
|
3
|
-
/**
|
|
4
|
-
* Apply common options for all commands
|
|
5
|
-
*/
|
|
6
|
-
export declare const commonOptions: (command: Command) => Command;
|
|
7
|
-
export type CommonOptions = {
|
|
8
|
-
config?: string;
|
|
9
|
-
configName?: string[];
|
|
10
|
-
configLoader?: ConfigLoader;
|
|
11
|
-
env?: Record<string, unknown> | string[];
|
|
12
|
-
nodeEnv?: string;
|
|
13
|
-
};
|
|
14
|
-
export declare const normalizeCommonOptions: (options: CommonOptions | CommonOptionsForBuildAndServe, action: "serve" | "build" | "preview") => void;
|
|
15
|
-
/**
|
|
16
|
-
* Apply common options for `build` and `serve` commands
|
|
17
|
-
*/
|
|
18
|
-
export declare const commonOptionsForBuildAndServe: (command: Command) => Command;
|
|
19
|
-
export type CommonOptionsForBuildAndServe = CommonOptions & {
|
|
20
|
-
devtool?: string | boolean;
|
|
21
|
-
entry?: string[];
|
|
22
|
-
mode?: string;
|
|
23
|
-
outputPath?: string;
|
|
24
|
-
watch?: boolean;
|
|
25
|
-
};
|
|
26
|
-
export declare function setDefaultNodeEnv(options: {
|
|
27
|
-
nodeEnv?: unknown;
|
|
28
|
-
}, defaultEnv: string): void;
|
package/dist/utils/profile.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function applyProfile(filterValue: string, traceLayer?: string, traceOutput?: string): Promise<void>;
|