@rspack/cli 1.7.0-beta.0 → 1.7.0
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/bin/rspack.js +10 -10
- package/dist/0~274.js +7 -7
- package/dist/131.mjs +1262 -0
- package/dist/1~274.mjs +27 -39
- package/dist/cli.d.ts +7 -6
- package/dist/commands/build.d.ts +2 -2
- package/dist/commands/preview.d.ts +2 -2
- package/dist/commands/serve.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +106 -91
- package/dist/index.mjs +1 -1336
- package/dist/rslib-runtime.mjs +28 -0
- package/dist/types.d.ts +3 -3
- package/dist/utils/loadConfig.d.ts +2 -2
- package/dist/utils/options.d.ts +1 -1
- package/dist/utils/rspackCore.d.ts +1 -1
- package/package.json +4 -4
package/dist/1~274.mjs
CHANGED
|
@@ -1,40 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
const { asyncExitHook } = await import("exit-hook");
|
|
16
|
-
if ("logger" !== traceLayer && "perfetto" !== traceLayer) throw new Error(`unsupported trace layer: ${traceLayer}`);
|
|
17
|
-
const timestamp = Date.now();
|
|
18
|
-
const defaultOutputDir = node_path__rspack_import_1["default"].resolve(`.rspack-profile-${timestamp}-${process.pid}`);
|
|
19
|
-
if (traceOutput) {
|
|
20
|
-
if ("stdout" !== traceOutput && "stderr" !== traceOutput) traceOutput = node_path__rspack_import_1["default"].resolve(defaultOutputDir, traceOutput);
|
|
21
|
-
} else {
|
|
22
|
-
const defaultRustTracePerfettoOutput = node_path__rspack_import_1["default"].resolve(defaultOutputDir, "rspack.pftrace");
|
|
23
|
-
const defaultRustTraceLoggerOutput = "stdout";
|
|
24
|
-
const defaultTraceOutput = "perfetto" === traceLayer ? defaultRustTracePerfettoOutput : defaultRustTraceLoggerOutput;
|
|
25
|
-
traceOutput = defaultTraceOutput;
|
|
26
|
-
}
|
|
27
|
-
await ensureFileDir(traceOutput);
|
|
28
|
-
await _rspackCore__rspack_import_2.Z.experiments.globalTrace.register(filterValue, traceLayer, traceOutput);
|
|
29
|
-
asyncExitHook(_rspackCore__rspack_import_2.Z.experiments.globalTrace.cleanup, {
|
|
30
|
-
wait: 500
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
async function ensureFileDir(outputFilePath) {
|
|
34
|
-
const dir = node_path__rspack_import_1["default"].dirname(outputFilePath);
|
|
35
|
-
await node_fs__rspack_import_0["default"].promises.mkdir(dir, {
|
|
36
|
-
recursive: true
|
|
37
|
-
});
|
|
38
|
-
}
|
|
1
|
+
import { node_fs, node_path, rspack } from "./131.mjs";
|
|
2
|
+
const DEFAULT_RUST_TRACE_LAYER = 'perfetto';
|
|
3
|
+
async function applyProfile(filterValue, traceLayer = DEFAULT_RUST_TRACE_LAYER, traceOutput) {
|
|
4
|
+
const { asyncExitHook } = await import("exit-hook");
|
|
5
|
+
if ('logger' !== traceLayer && 'perfetto' !== traceLayer) throw new Error(`unsupported trace layer: ${traceLayer}`);
|
|
6
|
+
const timestamp = Date.now();
|
|
7
|
+
const defaultOutputDir = node_path.resolve(`.rspack-profile-${timestamp}-${process.pid}`);
|
|
8
|
+
if (traceOutput) {
|
|
9
|
+
if ('stdout' !== traceOutput && 'stderr' !== traceOutput) traceOutput = node_path.resolve(defaultOutputDir, traceOutput);
|
|
10
|
+
} else {
|
|
11
|
+
const defaultRustTracePerfettoOutput = node_path.resolve(defaultOutputDir, 'rspack.pftrace');
|
|
12
|
+
const defaultRustTraceLoggerOutput = 'stdout';
|
|
13
|
+
const defaultTraceOutput = 'perfetto' === traceLayer ? defaultRustTracePerfettoOutput : defaultRustTraceLoggerOutput;
|
|
14
|
+
traceOutput = defaultTraceOutput;
|
|
39
15
|
}
|
|
40
|
-
|
|
16
|
+
await ensureFileDir(traceOutput);
|
|
17
|
+
await rspack.experiments.globalTrace.register(filterValue, traceLayer, traceOutput);
|
|
18
|
+
asyncExitHook(rspack.experiments.globalTrace.cleanup, {
|
|
19
|
+
wait: 500
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async function ensureFileDir(outputFilePath) {
|
|
23
|
+
const dir = node_path.dirname(outputFilePath);
|
|
24
|
+
await node_fs.promises.mkdir(dir, {
|
|
25
|
+
recursive: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export { applyProfile };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Compiler, MultiCompiler, MultiRspackOptions, MultiStats, RspackOptions, RspackPluginFunction, RspackPluginInstance, Stats } from
|
|
2
|
-
import { type CAC } from
|
|
3
|
-
import type { RspackCLIColors, RspackCLILogger } from
|
|
4
|
-
import type { CommonOptions, CommonOptionsForBuildAndServe } from
|
|
5
|
-
type Command =
|
|
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
6
|
declare global {
|
|
7
7
|
const RSPACK_CLI_VERSION: string;
|
|
8
8
|
}
|
|
@@ -10,7 +10,8 @@ export declare class RspackCLI {
|
|
|
10
10
|
colors: RspackCLIColors;
|
|
11
11
|
program: CAC;
|
|
12
12
|
constructor();
|
|
13
|
-
|
|
13
|
+
buildCompilerConfig(options: CommonOptionsForBuildAndServe, rspackCommand: Command): Promise<RspackOptions | MultiRspackOptions>;
|
|
14
|
+
createCompiler(config: RspackOptions | MultiRspackOptions, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<MultiCompiler | Compiler | null>;
|
|
14
15
|
createColors(useColor?: boolean): RspackCLIColors;
|
|
15
16
|
getLogger(): RspackCLILogger;
|
|
16
17
|
run(argv: string[]): Promise<void>;
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RspackCLI } from
|
|
2
|
-
import type { RspackCommand } from
|
|
1
|
+
import type { RspackCLI } from '../cli';
|
|
2
|
+
import type { RspackCommand } from '../types';
|
|
3
3
|
export declare class BuildCommand implements RspackCommand {
|
|
4
4
|
apply(cli: RspackCLI): Promise<void>;
|
|
5
5
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RspackCLI } from
|
|
2
|
-
import type { RspackCommand } from
|
|
1
|
+
import type { RspackCLI } from '../cli';
|
|
2
|
+
import type { RspackCommand } from '../types';
|
|
3
3
|
export declare class PreviewCommand implements RspackCommand {
|
|
4
4
|
apply(cli: RspackCLI): Promise<void>;
|
|
5
5
|
}
|
package/dist/commands/serve.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RspackCLI } from
|
|
2
|
-
import type { RspackCommand } from
|
|
1
|
+
import type { RspackCLI } from '../cli';
|
|
2
|
+
import type { RspackCommand } from '../types';
|
|
3
3
|
export declare class ServeCommand implements RspackCommand {
|
|
4
4
|
apply(cli: RspackCLI): Promise<void>;
|
|
5
5
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { defineConfig, definePlugin, RspackCLI } from
|
|
2
|
-
export * from
|
|
1
|
+
export { defineConfig, definePlugin, RspackCLI } from './cli';
|
|
2
|
+
export * from './types';
|