@rspack/cli 0.7.0 → 0.7.1-canary-06990bb-20240531053011

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.
@@ -112,9 +112,11 @@ class RspackCLI {
112
112
  }
113
113
  }
114
114
  async buildConfig(item, options, command) {
115
- let commandDefaultEnv = command === "build" ? "production" : "development";
116
- let isBuild = command === "build";
117
- let isServe = command === "serve";
115
+ const isBuild = command === "build";
116
+ const isServe = command === "serve";
117
+ const commandDefaultEnv = isBuild
118
+ ? "production"
119
+ : "development";
118
120
  const internalBuildConfig = async (item) => {
119
121
  if (options.entry) {
120
122
  item.entry = {
@@ -106,10 +106,7 @@ function normalizeEnv(argv) {
106
106
  prevRef[someKey] = undefined;
107
107
  return;
108
108
  }
109
- if (!prevRef[someKey]) {
110
- prevRef[someKey] = {};
111
- }
112
- if (typeof prevRef[someKey] === "string") {
109
+ if (!prevRef[someKey] || typeof prevRef[someKey] === "string") {
113
110
  prevRef[someKey] = {};
114
111
  }
115
112
  if (index === splitKeys.length - 1) {
@@ -3,16 +3,16 @@
3
3
  The full syntax, remember update this when you change something in this file.
4
4
 
5
5
  `RSPACK_PROFILE='TRACE=filter=trace&output=./rspack.trace&layer=chrome|JSCPU=output=./rspack.jscpuprofile|LOGGING=output=./rspack.logging' rspack build`
6
- ^----------------------------------------------: querystring syntax trace options
7
- ^: | is a delimiter for different profile options
8
- ^---------------------------------: querystring syntax js cpuprofile options
9
- ^: | is a delimiter for different profile options
10
- ^------------------------------: querystring syntax stats.logging options
11
- ^-----------: trace filter, default to `trace`, more syntax: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#example-syntax
12
- ^--------------------: trace output, `stderr`, `stdout`, or a file path, default to `./.rspack-profile-${timestamp}/trace.json` for layer `chrome` and default to `stdout` for layer `logger`
13
- ^-----------: trace layer, `chrome` or `logger`, default to `chrome`
14
- ^---------------------------: js cpuprofile output, `stderr`, `stdout`, or a file path, default to `./.rspack-profile-${timestamp}/jscpuprofile.json`
15
- ^----------------------: stats.logging output, default to `./.rspack-profile-${timestamp}/logging.json`
6
+ ^----------------------------------------------: querystring syntax trace options
7
+ ^: | is a delimiter for different profile options
8
+ ^---------------------------------: querystring syntax js cpuprofile options
9
+ ^: | is a delimiter for different profile options
10
+ ^------------------------------: querystring syntax stats.logging options
11
+ ^-----------: trace filter, default to `trace`, more syntax: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#example-syntax
12
+ ^--------------------: trace output, `stderr`, `stdout`, or a file path, default to `./.rspack-profile-${timestamp}/trace.json` for layer `chrome` and default to `stdout` for layer `logger`
13
+ ^-----------: trace layer, `chrome` or `logger`, default to `chrome`
14
+ ^---------------------------: js cpuprofile output, `stderr`, `stdout`, or a file path, default to `./.rspack-profile-${timestamp}/jscpuprofile.json`
15
+ ^----------------------: stats.logging output, default to `./.rspack-profile-${timestamp}/logging.json`
16
16
 
17
17
  `RSPACK_PROFILE='TRACE=filter=trace&output=./rspack.trace&layer=chrome' rspack build`: only enable trace
18
18
 
@@ -69,13 +69,14 @@ function resolveProfile(value) {
69
69
  };
70
70
  }
71
71
  return value.split("|").reduce((acc, cur) => {
72
- if (cur.toUpperCase().startsWith("TRACE")) {
72
+ const upperCur = cur.toUpperCase();
73
+ if (upperCur.startsWith("TRACE")) {
73
74
  acc.TRACE = resolveRustTraceOptions(cur.slice(6));
74
75
  }
75
- if (cur.toUpperCase().startsWith("JSCPU")) {
76
+ else if (upperCur.startsWith("JSCPU")) {
76
77
  acc.JSCPU = resolveJSCPUProfileOptions(cur.slice(6));
77
78
  }
78
- if (cur.toUpperCase().startsWith("LOGGING")) {
79
+ else if (upperCur.startsWith("LOGGING")) {
79
80
  acc.LOGGING = resolveLoggingOptions(cur.slice(8));
80
81
  }
81
82
  return acc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.1-canary-06990bb-20240531053011",
4
4
  "license": "MIT",
5
5
  "description": "CLI for rspack",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "cross-env": "^7.0.3",
31
31
  "execa": "^5.0.0",
32
32
  "internal-ip": "6.2.0",
33
- "@rspack/core": "0.7.0"
33
+ "@rspack/core": "0.7.1-canary-06990bb-20240531053011"
34
34
  },
35
35
  "dependencies": {
36
36
  "@discoveryjs/json-ext": "^0.5.7",
@@ -41,7 +41,7 @@
41
41
  "semver": "6.3.1",
42
42
  "webpack-bundle-analyzer": "4.6.1",
43
43
  "yargs": "17.6.2",
44
- "@rspack/dev-server": "0.7.0"
44
+ "@rspack/dev-server": "0.7.1-canary-06990bb-20240531053011"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsc -b ./tsconfig.build.json",