@rsbuild/core 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.
@@ -0,0 +1,19 @@
1
+ import { createRequire } from "node:module";
2
+ import _createJiti from "../dist/jiti.cjs";
3
+ import _babelTransform from "../dist/babel.cjs";
4
+ function onError(err) {
5
+ throw err;
6
+ }
7
+ const nativeImport = (id)=>import(id);
8
+ export function createJiti(id, opts = {}) {
9
+ if (!opts.transform) opts = {
10
+ ...opts,
11
+ transform: _babelTransform
12
+ };
13
+ return _createJiti(id, opts, {
14
+ onError,
15
+ nativeImport,
16
+ createRequire
17
+ });
18
+ }
19
+ export default createJiti;
@@ -236,6 +236,27 @@ export 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 @@ export 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,6 +1,6 @@
1
1
  {
2
2
  "name": "jiti",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "Runtime typescript and ESM support for Node.js",
5
5
  "repository": "unjs/jiti",
6
6
  "license": "MIT",
@@ -24,6 +24,10 @@
24
24
  "types": "./lib/jiti.d.mts",
25
25
  "import": "./lib/jiti-native.mjs"
26
26
  },
27
+ "./static": {
28
+ "types": "./lib/jiti.d.mts",
29
+ "import": "./lib/jiti-static.mjs"
30
+ },
27
31
  "./package.json": "./package.json"
28
32
  },
29
33
  "main": "./lib/jiti.cjs",
@@ -36,6 +40,9 @@
36
40
  ],
37
41
  "native": [
38
42
  "./lib/jiti.d.mts"
43
+ ],
44
+ "static": [
45
+ "./lib/jiti.d.mts"
39
46
  ]
40
47
  }
41
48
  },
@@ -50,13 +57,14 @@
50
57
  "scripts": {
51
58
  "bench": "node test/bench.mjs && deno -A test/bench.mjs && bun --bun test/bench.mjs",
52
59
  "build": "pnpm clean && pnpm rspack",
60
+ "build:rolldown": "pnpm clean && pnpm rolldown -c rolldown.config.mjs",
53
61
  "clean": "rm -rf dist",
54
62
  "dev": "pnpm clean && pnpm rspack --watch",
55
63
  "jiti": "JITI_DEBUG=1 JITI_JSX=1 lib/jiti-cli.mjs",
56
64
  "lint": "eslint . && prettier -c src lib test stubs",
57
65
  "lint:fix": "eslint --fix . && prettier -w src lib test stubs",
58
66
  "prepack": "pnpm build",
59
- "release": "pnpm build && pnpm test && changelogen --release --push --publish",
67
+ "release": "pnpm build && pnpm test && changelogen --release --push && npm publish",
60
68
  "test": "pnpm lint && pnpm test:types && vitest run --coverage && pnpm test:node-register && pnpm test:bun && pnpm test:native",
61
69
  "test:bun": "bun --bun test test/bun",
62
70
  "test:native": "pnpm test:native:bun && pnpm test:native:node && pnpm test:native:deno",
@@ -64,70 +72,75 @@
64
72
  "test:native:deno": "deno test -A --no-check test/native/deno.test.ts",
65
73
  "test:native:node": "node --test --experimental-strip-types test/native/node.test.ts",
66
74
  "test:node-register": "JITI_JSX=1 node --test test/node-register.test.mjs",
67
- "test:types": "tsc --noEmit"
75
+ "test:types": "tsgo --noEmit"
68
76
  },
69
77
  "devDependencies": {
70
- "@babel/core": "^7.28.4",
71
- "@babel/helper-module-imports": "^7.27.1",
72
- "@babel/helper-module-transforms": "^7.28.3",
73
- "@babel/helper-plugin-utils": "^7.27.1",
78
+ "@babel/core": "^7.29.0",
79
+ "@babel/helper-module-imports": "^7.28.6",
80
+ "@babel/helper-module-transforms": "^7.28.6",
81
+ "@babel/helper-plugin-utils": "^7.28.6",
74
82
  "@babel/helper-simple-access": "^7.27.1",
75
- "@babel/plugin-proposal-decorators": "^7.28.0",
83
+ "@babel/plugin-proposal-decorators": "^7.29.0",
76
84
  "@babel/plugin-syntax-class-properties": "^7.12.13",
77
- "@babel/plugin-syntax-import-assertions": "^7.27.1",
78
- "@babel/plugin-syntax-jsx": "^7.27.1",
85
+ "@babel/plugin-syntax-import-assertions": "^7.28.6",
86
+ "@babel/plugin-syntax-jsx": "^7.28.6",
87
+ "@babel/plugin-transform-explicit-resource-management": "^7.28.6",
79
88
  "@babel/plugin-transform-export-namespace-from": "^7.27.1",
80
- "@babel/plugin-transform-react-jsx": "^7.27.1",
81
- "@babel/plugin-transform-typescript": "^7.28.0",
82
- "@babel/preset-typescript": "^7.27.1",
83
- "@babel/template": "^7.27.2",
84
- "@babel/traverse": "^7.28.4",
85
- "@babel/types": "^7.28.4",
86
- "@rspack/cli": "^1.5.8",
87
- "@rspack/core": "^1.5.8",
89
+ "@babel/plugin-transform-react-jsx": "^7.28.6",
90
+ "@babel/plugin-transform-typescript": "^7.28.6",
91
+ "@babel/preset-typescript": "^7.28.5",
92
+ "@babel/template": "^7.28.6",
93
+ "@babel/traverse": "^7.29.0",
94
+ "@babel/types": "^7.29.0",
95
+ "@rspack/cli": "^2.0.1",
96
+ "@rspack/core": "^2.0.1",
88
97
  "@types/babel__core": "^7.20.5",
89
98
  "@types/babel__helper-module-imports": "^7.18.3",
90
99
  "@types/babel__helper-plugin-utils": "^7.10.3",
91
100
  "@types/babel__template": "^7.4.4",
92
101
  "@types/babel__traverse": "^7.28.0",
93
- "@types/node": "^24.6.1",
94
- "@vitest/coverage-v8": "^3.2.4",
95
- "acorn": "^8.15.0",
102
+ "@types/node": "^25.6.0",
103
+ "@typescript/native-preview": "7.0.0-dev.20260505.1",
104
+ "@vitest/coverage-v8": "^4.1.5",
105
+ "acorn": "^8.16.0",
96
106
  "babel-plugin-parameter-decorator": "^1.0.16",
97
107
  "changelogen": "^0.6.2",
98
- "config": "^4.1.1",
108
+ "config": "^4.4.1",
99
109
  "consola": "^3.4.2",
100
- "defu": "^6.1.4",
110
+ "defu": "^6.1.7",
101
111
  "destr": "^2.0.5",
102
112
  "escape-string-regexp": "^5.0.0",
103
- "eslint": "^9.36.0",
104
- "eslint-config-unjs": "^0.5.0",
113
+ "eslint": "^10.3.0",
114
+ "eslint-config-unjs": "^0.6.2",
105
115
  "estree-walker": "^3.0.3",
106
116
  "etag": "^1.8.1",
107
117
  "fast-glob": "^3.3.3",
118
+ "get-tsconfig": "^4.14.0",
108
119
  "is-installed-globally": "^1.0.0",
109
120
  "mime": "^4.1.0",
110
- "mlly": "^1.8.0",
111
- "moment-timezone": "^0.6.0",
112
- "nano-jsx": "^0.2.0",
121
+ "mitata": "^1.0.34",
122
+ "mlly": "^1.8.2",
123
+ "moment-timezone": "^0.6.2",
124
+ "nano-jsx": "^0.2.1",
113
125
  "pathe": "^2.0.3",
114
- "pkg-types": "^2.3.0",
115
- "preact": "^10.27.2",
116
- "preact-render-to-string": "^6.6.2",
117
- "prettier": "^3.6.2",
118
- "react": "^19.1.1",
119
- "react-dom": "^19.1.1",
126
+ "pkg-types": "^2.3.1",
127
+ "preact": "^10.29.1",
128
+ "preact-render-to-string": "^6.6.7",
129
+ "prettier": "^3.8.3",
130
+ "react": "^19.2.5",
131
+ "react-dom": "^19.2.5",
120
132
  "reflect-metadata": "^0.2.2",
121
- "solid-js": "^1.9.9",
122
- "std-env": "^3.9.0",
123
- "terser-webpack-plugin": "^5.3.14",
124
- "tinyexec": "^1.0.1",
125
- "ts-loader": "^9.5.4",
133
+ "rolldown": "1.0.0-rc.18",
134
+ "solid-js": "^1.9.12",
135
+ "std-env": "^4.1.0",
136
+ "terser-webpack-plugin": "^5.5.0",
137
+ "tinyexec": "^1.1.2",
138
+ "ts-loader": "^9.5.7",
126
139
  "typescript": "^5.9.3",
127
- "vitest": "^3.2.4",
128
- "vue": "^3.5.22",
140
+ "vitest": "^4.1.5",
141
+ "vue": "^3.5.33",
129
142
  "yoctocolors": "^2.1.2",
130
- "zod": "^4.1.11"
143
+ "zod": "^4.4.3"
131
144
  },
132
- "packageManager": "pnpm@10.17.1"
145
+ "packageManager": "pnpm@10.30.3"
133
146
  }