@rspack-debug/cli 2.0.3 → 2.0.5
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 +0 -3
- package/compiled/jiti/dist/babel.cjs +38 -27
- package/compiled/jiti/dist/jiti.cjs +1 -1
- package/compiled/jiti/index.d.ts +57 -0
- package/compiled/jiti/package.json +1 -1
- package/dist/index.js +11 -5
- package/dist/profile.js +10 -6
- package/package.json +5 -5
package/compiled/jiti/index.d.ts
CHANGED
|
@@ -236,6 +236,27 @@ interface JitiOptions {
|
|
|
236
236
|
*/
|
|
237
237
|
tryNative?: boolean;
|
|
238
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Always use a temp file (instead of a `data:` URL) for the ESM
|
|
241
|
+
* evaluation fallback path.
|
|
242
|
+
*
|
|
243
|
+
* jiti automatically falls back to a temp file when the `data:` URL
|
|
244
|
+
* import fails with `ENAMETOOLONG` — which happens on filesystems with
|
|
245
|
+
* a strict `NAME_MAX` limit (e.g. ecryptfs-encrypted home directories
|
|
246
|
+
* on Linux, some macOS configurations) once the base64-encoded source
|
|
247
|
+
* exceeds the limit. Setting this to `true` forces the temp-file path
|
|
248
|
+
* up front, skipping the `data:` URL attempt.
|
|
249
|
+
*
|
|
250
|
+
* The temp file is written to `{TMP_DIR}/jiti-esm/` and cleaned up
|
|
251
|
+
* after import.
|
|
252
|
+
*
|
|
253
|
+
* Can also be enabled using the `JITI_ESM_EVAL_TEMP_FILE=true`
|
|
254
|
+
* environment variable.
|
|
255
|
+
*
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
esmEvalTempFile?: boolean;
|
|
259
|
+
|
|
239
260
|
/**
|
|
240
261
|
* Enable JSX support Enable JSX support using
|
|
241
262
|
* {@link https://babeljs.io/docs/babel-plugin-transform-react-jsx | `@babel/plugin-transform-react-jsx`}.
|
|
@@ -245,6 +266,42 @@ interface JitiOptions {
|
|
|
245
266
|
* @default false
|
|
246
267
|
*/
|
|
247
268
|
jsx?: boolean | JSXOptions;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Virtual modules - pre-loaded module objects that bypass filesystem resolution.
|
|
272
|
+
* Useful for bundled modules in compiled binaries (e.g., Bun).
|
|
273
|
+
*
|
|
274
|
+
* When a module ID matches a key in this map, the corresponding value is
|
|
275
|
+
* returned directly without any filesystem resolution or transformation.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* import * as typebox from "@sinclair/typebox";
|
|
280
|
+
*
|
|
281
|
+
* const jiti = createJiti(import.meta.url, {
|
|
282
|
+
* virtualModules: {
|
|
283
|
+
* "@sinclair/typebox": typebox,
|
|
284
|
+
* },
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
virtualModules?: Record<string, unknown>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Enable tsconfig paths resolution.
|
|
292
|
+
*
|
|
293
|
+
* - `true`: auto-discover `tsconfig.json` by walking up from the
|
|
294
|
+
* jiti instance's parent path
|
|
295
|
+
* - `string`: explicit path to a `tsconfig.json` file
|
|
296
|
+
* - `false` (default): disabled
|
|
297
|
+
*
|
|
298
|
+
* When enabled, jiti uses
|
|
299
|
+
* {@link https://github.com/privatenumber/get-tsconfig | get-tsconfig}
|
|
300
|
+
* to resolve TypeScript path aliases defined in `compilerOptions.paths`.
|
|
301
|
+
*
|
|
302
|
+
* @default false
|
|
303
|
+
*/
|
|
304
|
+
tsconfigPaths?: boolean | string;
|
|
248
305
|
}
|
|
249
306
|
|
|
250
307
|
interface NodeRequire {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"jiti","version":"2.
|
|
1
|
+
{"name":"jiti","version":"2.7.0","license":"MIT","types":"index.d.ts","type":"commonjs"}
|
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>', '
|
|
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
|
],
|
|
@@ -601,12 +600,18 @@ const commonOptionsForBuildAndServe = (command)=>command.option('-d, --devtool <
|
|
|
601
600
|
}).option('-m, --mode <mode>', 'mode').option('-o, --output-path <dir>', 'output path dir').option('-w, --watch', 'watch');
|
|
602
601
|
function setBuiltinEnvArg(env, envNameSuffix, value) {
|
|
603
602
|
const envName = `RSPACK_${envNameSuffix}`;
|
|
604
|
-
if (!(envName
|
|
603
|
+
if (!Object.prototype.hasOwnProperty.call(env, envName)) env[envName] = value;
|
|
605
604
|
}
|
|
605
|
+
const DANGEROUS_ENV_KEYS = new Set([
|
|
606
|
+
'__proto__',
|
|
607
|
+
'constructor',
|
|
608
|
+
'prototype'
|
|
609
|
+
]);
|
|
606
610
|
function normalizeEnvToObject(options) {
|
|
607
611
|
function parseValue(previous, value) {
|
|
608
612
|
const [allKeys, val] = value.split(/=(.+)/, 2);
|
|
609
613
|
const splitKeys = allKeys.split(/\.(?!$)/);
|
|
614
|
+
if (splitKeys.some((k)=>DANGEROUS_ENV_KEYS.has(k.replace(/=$/, '')))) return previous;
|
|
610
615
|
let prevRef = previous;
|
|
611
616
|
splitKeys.forEach((key, index)=>{
|
|
612
617
|
let someKey = key;
|
|
@@ -633,8 +638,9 @@ async function runBuild(cli, options) {
|
|
|
633
638
|
const logger = cli.getLogger();
|
|
634
639
|
let createJsonStringifyStream;
|
|
635
640
|
if (options.json) {
|
|
641
|
+
const stream = await import("node:stream");
|
|
636
642
|
const jsonExt = await import("./json-ext.js");
|
|
637
|
-
createJsonStringifyStream = (value)=>Readable.from(jsonExt.stringifyChunked(value));
|
|
643
|
+
createJsonStringifyStream = (value)=>stream.Readable.from(jsonExt.stringifyChunked(value));
|
|
638
644
|
}
|
|
639
645
|
const errorHandler = (error, stats)=>{
|
|
640
646
|
if (error) {
|
|
@@ -1143,7 +1149,7 @@ class RspackCLI {
|
|
|
1143
1149
|
this.colors = this.createColors();
|
|
1144
1150
|
this.program = program;
|
|
1145
1151
|
program.help();
|
|
1146
|
-
program.version("2.0.
|
|
1152
|
+
program.version("2.0.5");
|
|
1147
1153
|
}
|
|
1148
1154
|
wrapAction(fn) {
|
|
1149
1155
|
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 (
|
|
17
|
+
if (!isTerminalTraceOutput(traceOutput)) traceOutput = node_path.resolve(defaultOutputDir, traceOutput);
|
|
12
18
|
} else {
|
|
13
|
-
const
|
|
14
|
-
|
|
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-debug/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@discoveryjs/json-ext": "^1.1.0",
|
|
32
32
|
"@microsoft/api-extractor": "^7.58.7",
|
|
33
|
-
"@rslib/core": "^0.21.
|
|
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",
|
|
37
37
|
"cross-env": "^10.1.0",
|
|
38
38
|
"execa": "^5.1.1",
|
|
39
39
|
"exit-hook": "^5.1.0",
|
|
40
|
-
"jiti": "^2.
|
|
40
|
+
"jiti": "^2.7.0",
|
|
41
41
|
"prebundle": "^1.6.4",
|
|
42
42
|
"rspack-merge": "0.1.1",
|
|
43
43
|
"typescript": "^6.0.3",
|
|
44
|
-
"@rspack/core": "npm:@rspack-debug/core@2.0.
|
|
45
|
-
"@rspack/test-tools": "npm:@rspack-debug/test-tools@2.0.
|
|
44
|
+
"@rspack/core": "npm:@rspack-debug/core@2.0.5",
|
|
45
|
+
"@rspack/test-tools": "npm:@rspack-debug/test-tools@2.0.5"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"@rspack/core": "^2.0.0-0",
|