@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/dist/1~274.mjs CHANGED
@@ -1,40 +1,28 @@
1
- export const __rspack_esm_id = "274";
2
- export const __rspack_esm_ids = [
3
- "274"
4
- ];
5
- export const __webpack_modules__ = {
6
- "./src/utils/profile.ts" (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
7
- __webpack_require__.d(__webpack_exports__, {
8
- applyProfile: ()=>applyProfile
9
- });
10
- var node_fs__rspack_import_0 = __webpack_require__("node:fs");
11
- var node_path__rspack_import_1 = __webpack_require__("node:path");
12
- var _rspackCore__rspack_import_2 = __webpack_require__("./src/utils/rspackCore.ts");
13
- const DEFAULT_RUST_TRACE_LAYER = "perfetto";
14
- async function applyProfile(filterValue, traceLayer = DEFAULT_RUST_TRACE_LAYER, traceOutput) {
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 "@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";
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
- createCompiler(options: CommonOptionsForBuildAndServe, rspackCommand: Command, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<MultiCompiler | Compiler | null>;
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>;
@@ -1,5 +1,5 @@
1
- import type { RspackCLI } from "../cli";
2
- import type { RspackCommand } from "../types";
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 "../cli";
2
- import type { RspackCommand } from "../types";
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
  }
@@ -1,5 +1,5 @@
1
- import type { RspackCLI } from "../cli";
2
- import type { RspackCommand } from "../types";
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 "./cli";
2
- export * from "./types";
1
+ export { defineConfig, definePlugin, RspackCLI } from './cli';
2
+ export * from './types';