@rspack/cli 2.0.3 → 2.0.4

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 CHANGED
@@ -12,9 +12,6 @@ if (enableCompileCache) {
12
12
  }
13
13
  }
14
14
 
15
- // make it easier to identify the process via activity monitor or other tools
16
- process.title = 'rspack-node';
17
-
18
15
  import { RspackCLI } from '../dist/index.js';
19
16
 
20
17
  async function runCLI() {
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ import node_path from "node:path";
2
2
  import node_util from "node:util";
3
3
  import { rspack } from "@rspack/core";
4
4
  import node_fs from "node:fs";
5
- import { Readable } from "node:stream";
6
5
  import { createRequire } from "node:module";
7
6
  import { fileURLToPath, pathToFileURL } from "node:url";
8
7
  function toArr(any) {
@@ -593,7 +592,7 @@ const normalizeCommonOptions = (options, action)=>{
593
592
  }
594
593
  if ('devtool' in options) options.devtool = normalizeDevtoolOption(options.devtool);
595
594
  };
596
- const commonOptionsForBuildAndServe = (command)=>command.option('-d, --devtool <value>', 'specify a developer tool for debugging. Defaults to `cheap-module-source-map` in development and `source-map` in production.').option('--entry <entry>', 'entry file', {
595
+ const commonOptionsForBuildAndServe = (command)=>command.option('-d, --devtool <value>', 'set source map style for debugging. Use `false` to disable source maps.').option('--entry <entry>', 'entry file', {
597
596
  type: [
598
597
  String
599
598
  ],
@@ -633,8 +632,9 @@ async function runBuild(cli, options) {
633
632
  const logger = cli.getLogger();
634
633
  let createJsonStringifyStream;
635
634
  if (options.json) {
635
+ const stream = await import("node:stream");
636
636
  const jsonExt = await import("./json-ext.js");
637
- createJsonStringifyStream = (value)=>Readable.from(jsonExt.stringifyChunked(value));
637
+ createJsonStringifyStream = (value)=>stream.Readable.from(jsonExt.stringifyChunked(value));
638
638
  }
639
639
  const errorHandler = (error, stats)=>{
640
640
  if (error) {
@@ -1143,7 +1143,7 @@ class RspackCLI {
1143
1143
  this.colors = this.createColors();
1144
1144
  this.program = program;
1145
1145
  program.help();
1146
- program.version("2.0.3");
1146
+ program.version("2.0.4");
1147
1147
  }
1148
1148
  wrapAction(fn) {
1149
1149
  return (...args)=>{
package/dist/profile.js CHANGED
@@ -2,20 +2,24 @@ import node_fs from "node:fs";
2
2
  import node_path from "node:path";
3
3
  import { rspack } from "@rspack/core";
4
4
  const DEFAULT_RUST_TRACE_LAYER = 'logger';
5
+ const DEFAULT_RUST_TRACE_LOGGER_OUTPUT = 'rspack.log';
6
+ const DEFAULT_RUST_TRACE_PERFETTO_OUTPUT = 'rspack.pftrace';
7
+ function isTerminalTraceOutput(output) {
8
+ return 'stdout' === output || 'stderr' === output;
9
+ }
5
10
  async function applyProfile(filterValue, traceLayer = DEFAULT_RUST_TRACE_LAYER, traceOutput) {
6
11
  const { asyncExitHook } = await import("./exit-hook.js");
7
12
  if ('logger' !== traceLayer && 'perfetto' !== traceLayer) throw new Error(`unsupported trace layer: ${traceLayer}`);
13
+ if (traceOutput && 'perfetto' === traceLayer && isTerminalTraceOutput(traceOutput)) throw new Error('RSPACK_TRACE_OUTPUT=stdout|stderr is only supported for the logger trace layer. The perfetto trace layer requires a file path.');
8
14
  const timestamp = Date.now();
9
15
  const defaultOutputDir = node_path.resolve(`.rspack-profile-${timestamp}-${process.pid}`);
10
16
  if (traceOutput) {
11
- if ('stdout' !== traceOutput && 'stderr' !== traceOutput) traceOutput = node_path.resolve(defaultOutputDir, traceOutput);
17
+ if (!isTerminalTraceOutput(traceOutput)) traceOutput = node_path.resolve(defaultOutputDir, traceOutput);
12
18
  } else {
13
- const defaultRustTracePerfettoOutput = node_path.resolve(defaultOutputDir, 'rspack.pftrace');
14
- const defaultRustTraceLoggerOutput = 'stdout';
15
- const defaultTraceOutput = 'perfetto' === traceLayer ? defaultRustTracePerfettoOutput : defaultRustTraceLoggerOutput;
16
- traceOutput = defaultTraceOutput;
19
+ const defaultRustTraceOutput = 'perfetto' === traceLayer ? DEFAULT_RUST_TRACE_PERFETTO_OUTPUT : DEFAULT_RUST_TRACE_LOGGER_OUTPUT;
20
+ traceOutput = node_path.resolve(defaultOutputDir, defaultRustTraceOutput);
17
21
  }
18
- await ensureFileDir(traceOutput);
22
+ if (!isTerminalTraceOutput(traceOutput)) await ensureFileDir(traceOutput);
19
23
  await rspack.experiments.globalTrace.register(filterValue, traceLayer, traceOutput);
20
24
  asyncExitHook(rspack.experiments.globalTrace.cleanup, {
21
25
  wait: 500
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/cli",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "CLI for rspack",
5
5
  "homepage": "https://rspack.rs",
6
6
  "bugs": "https://github.com/web-infra-dev/rspack/issues",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@discoveryjs/json-ext": "^1.1.0",
32
32
  "@microsoft/api-extractor": "^7.58.7",
33
- "@rslib/core": "^0.21.4",
33
+ "@rslib/core": "^0.21.5",
34
34
  "@rspack/dev-server": "^2.0.1",
35
35
  "cac": "^7.0.0",
36
36
  "concat-stream": "^2.0.0",
@@ -41,8 +41,8 @@
41
41
  "prebundle": "^1.6.4",
42
42
  "rspack-merge": "0.1.1",
43
43
  "typescript": "^6.0.3",
44
- "@rspack/core": "2.0.3",
45
- "@rspack/test-tools": "2.0.3"
44
+ "@rspack/core": "2.0.4",
45
+ "@rspack/test-tools": "2.0.4"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@rspack/core": "^2.0.0-0",