rolldown 1.0.0-beta.35 → 1.0.0-beta.37

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.
Files changed (44) hide show
  1. package/dist/cli.mjs +95 -1068
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +3 -3
  4. package/dist/experimental-index.d.mts +43 -5
  5. package/dist/experimental-index.mjs +31 -8
  6. package/dist/filter-index.d.mts +2 -2
  7. package/dist/index.d.mts +3 -3
  8. package/dist/index.mjs +2 -2
  9. package/dist/parallel-plugin-worker.mjs +3 -4
  10. package/dist/parallel-plugin.d.mts +2 -2
  11. package/dist/parse-ast-index.d.mts +1 -1
  12. package/dist/parse-ast-index.mjs +1 -1
  13. package/dist/shared/{binding-9k0egz6L.d.mts → binding-Cjs27cfu.d.mts} +1 -0
  14. package/dist/shared/{define-config-DhrkZ_o7.d.cts → define-config-CV3aiNwN.d.mts} +9 -9
  15. package/dist/shared/{load-config-C93_L4MP.mjs → load-config-BOVuTpJm.mjs} +4 -6
  16. package/dist/{cli.cjs → shared/logger-CiCY7ucm.mjs} +44 -829
  17. package/dist/shared/parse-ast-index-B5HcAOhq.mjs +10847 -0
  18. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-D2FxOcB5.mjs} +4 -7
  19. package/dist/shared/{src-D954P1TH.mjs → src-BtNlw_84.mjs} +88 -69
  20. package/package.json +32 -46
  21. package/dist/cli.d.cts +0 -1
  22. package/dist/config.cjs +0 -12
  23. package/dist/config.d.cts +0 -10
  24. package/dist/experimental-index.cjs +0 -154
  25. package/dist/experimental-index.d.cts +0 -99
  26. package/dist/filter-index.cjs +0 -106
  27. package/dist/filter-index.d.cts +0 -4
  28. package/dist/index.cjs +0 -9
  29. package/dist/index.d.cts +0 -3
  30. package/dist/parallel-plugin-worker.cjs +0 -33
  31. package/dist/parallel-plugin-worker.d.cts +0 -1
  32. package/dist/parallel-plugin.cjs +0 -8
  33. package/dist/parallel-plugin.d.cts +0 -14
  34. package/dist/parse-ast-index.cjs +0 -4
  35. package/dist/parse-ast-index.d.cts +0 -8
  36. package/dist/shared/binding-D13M6Llu.d.cts +0 -1425
  37. package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
  38. package/dist/shared/define-config-3arq8OPE.d.mts +0 -1421
  39. package/dist/shared/load-config-S_ofSLrj.cjs +0 -130
  40. package/dist/shared/misc-DksvspN4.cjs +0 -58
  41. package/dist/shared/parse-ast-index-BadydpMA.mjs +0 -725
  42. package/dist/shared/parse-ast-index-cePJvlvW.cjs +0 -871
  43. package/dist/shared/prompt-Q05EYrFb.cjs +0 -858
  44. package/dist/shared/src-BBMxhaqf.cjs +0 -4673
@@ -1,725 +0,0 @@
1
- import { createRequire } from "node:module";
2
-
3
- //#region rolldown:runtime
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __commonJS = (cb, mod) => function() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
- key = keys[i];
16
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
- get: ((k) => from[k]).bind(null, key),
18
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
- });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
28
-
29
- //#endregion
30
- //#region src/webcontainer-fallback.cjs
31
- var require_webcontainer_fallback = /* @__PURE__ */ __commonJS({ "src/webcontainer-fallback.cjs": ((exports, module) => {
32
- const fs = __require("node:fs");
33
- const childProcess = __require("node:child_process");
34
- const rolldownPkg = JSON.parse(fs.readFileSync(__require.resolve("rolldown/package.json"), "utf-8"));
35
- const version = rolldownPkg.version;
36
- const baseDir = `/tmp/rolldown-${version}`;
37
- const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
38
- if (!fs.existsSync(bindingEntry)) {
39
- const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
40
- fs.rmSync(baseDir, {
41
- recursive: true,
42
- force: true
43
- });
44
- fs.mkdirSync(baseDir, { recursive: true });
45
- console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
46
- childProcess.execFileSync("pnpm", ["i", bindingPkg], {
47
- cwd: baseDir,
48
- stdio: "inherit"
49
- });
50
- }
51
- module.exports = __require(bindingEntry);
52
- }) });
53
-
54
- //#endregion
55
- //#region src/binding.js
56
- new URL(".", import.meta.url).pathname;
57
- const { readFileSync } = __require("node:fs");
58
- let nativeBinding = null;
59
- const loadErrors = [];
60
- const isMusl = () => {
61
- let musl = false;
62
- if (process.platform === "linux") {
63
- musl = isMuslFromFilesystem();
64
- if (musl === null) musl = isMuslFromReport();
65
- if (musl === null) musl = isMuslFromChildProcess();
66
- }
67
- return musl;
68
- };
69
- const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
70
- const isMuslFromFilesystem = () => {
71
- try {
72
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
73
- } catch {
74
- return null;
75
- }
76
- };
77
- const isMuslFromReport = () => {
78
- let report = null;
79
- if (typeof process.report?.getReport === "function") {
80
- process.report.excludeNetwork = true;
81
- report = process.report.getReport();
82
- }
83
- if (!report) return null;
84
- if (report.header && report.header.glibcVersionRuntime) return false;
85
- if (Array.isArray(report.sharedObjects)) {
86
- if (report.sharedObjects.some(isFileMusl)) return true;
87
- }
88
- return false;
89
- };
90
- const isMuslFromChildProcess = () => {
91
- try {
92
- return __require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
93
- } catch (e) {
94
- return false;
95
- }
96
- };
97
- function requireNative() {
98
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
99
- nativeBinding = __require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
100
- } catch (err) {
101
- loadErrors.push(err);
102
- }
103
- else if (process.platform === "android") if (process.arch === "arm64") {
104
- try {
105
- return __require("../rolldown-binding.android-arm64.node");
106
- } catch (e) {
107
- loadErrors.push(e);
108
- }
109
- try {
110
- const binding = __require("@rolldown/binding-android-arm64");
111
- const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
112
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
113
- return binding;
114
- } catch (e) {
115
- loadErrors.push(e);
116
- }
117
- } else if (process.arch === "arm") {
118
- try {
119
- return __require("../rolldown-binding.android-arm-eabi.node");
120
- } catch (e) {
121
- loadErrors.push(e);
122
- }
123
- try {
124
- const binding = __require("@rolldown/binding-android-arm-eabi");
125
- const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
126
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
127
- return binding;
128
- } catch (e) {
129
- loadErrors.push(e);
130
- }
131
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
132
- else if (process.platform === "win32") if (process.arch === "x64") {
133
- try {
134
- return __require("../rolldown-binding.win32-x64-msvc.node");
135
- } catch (e) {
136
- loadErrors.push(e);
137
- }
138
- try {
139
- const binding = __require("@rolldown/binding-win32-x64-msvc");
140
- const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
141
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
142
- return binding;
143
- } catch (e) {
144
- loadErrors.push(e);
145
- }
146
- } else if (process.arch === "ia32") {
147
- try {
148
- return __require("../rolldown-binding.win32-ia32-msvc.node");
149
- } catch (e) {
150
- loadErrors.push(e);
151
- }
152
- try {
153
- const binding = __require("@rolldown/binding-win32-ia32-msvc");
154
- const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
155
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
156
- return binding;
157
- } catch (e) {
158
- loadErrors.push(e);
159
- }
160
- } else if (process.arch === "arm64") {
161
- try {
162
- return __require("../rolldown-binding.win32-arm64-msvc.node");
163
- } catch (e) {
164
- loadErrors.push(e);
165
- }
166
- try {
167
- const binding = __require("@rolldown/binding-win32-arm64-msvc");
168
- const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
169
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
170
- return binding;
171
- } catch (e) {
172
- loadErrors.push(e);
173
- }
174
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
175
- else if (process.platform === "darwin") {
176
- try {
177
- return __require("../rolldown-binding.darwin-universal.node");
178
- } catch (e) {
179
- loadErrors.push(e);
180
- }
181
- try {
182
- const binding = __require("@rolldown/binding-darwin-universal");
183
- const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
184
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
185
- return binding;
186
- } catch (e) {
187
- loadErrors.push(e);
188
- }
189
- if (process.arch === "x64") {
190
- try {
191
- return __require("../rolldown-binding.darwin-x64.node");
192
- } catch (e) {
193
- loadErrors.push(e);
194
- }
195
- try {
196
- const binding = __require("@rolldown/binding-darwin-x64");
197
- const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
198
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
199
- return binding;
200
- } catch (e) {
201
- loadErrors.push(e);
202
- }
203
- } else if (process.arch === "arm64") {
204
- try {
205
- return __require("../rolldown-binding.darwin-arm64.node");
206
- } catch (e) {
207
- loadErrors.push(e);
208
- }
209
- try {
210
- const binding = __require("@rolldown/binding-darwin-arm64");
211
- const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
212
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
213
- return binding;
214
- } catch (e) {
215
- loadErrors.push(e);
216
- }
217
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
218
- } else if (process.platform === "freebsd") if (process.arch === "x64") {
219
- try {
220
- return __require("../rolldown-binding.freebsd-x64.node");
221
- } catch (e) {
222
- loadErrors.push(e);
223
- }
224
- try {
225
- const binding = __require("@rolldown/binding-freebsd-x64");
226
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
227
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
228
- return binding;
229
- } catch (e) {
230
- loadErrors.push(e);
231
- }
232
- } else if (process.arch === "arm64") {
233
- try {
234
- return __require("../rolldown-binding.freebsd-arm64.node");
235
- } catch (e) {
236
- loadErrors.push(e);
237
- }
238
- try {
239
- const binding = __require("@rolldown/binding-freebsd-arm64");
240
- const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
241
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
242
- return binding;
243
- } catch (e) {
244
- loadErrors.push(e);
245
- }
246
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
247
- else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
248
- try {
249
- return __require("../rolldown-binding.linux-x64-musl.node");
250
- } catch (e) {
251
- loadErrors.push(e);
252
- }
253
- try {
254
- const binding = __require("@rolldown/binding-linux-x64-musl");
255
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
256
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
257
- return binding;
258
- } catch (e) {
259
- loadErrors.push(e);
260
- }
261
- } else {
262
- try {
263
- return __require("../rolldown-binding.linux-x64-gnu.node");
264
- } catch (e) {
265
- loadErrors.push(e);
266
- }
267
- try {
268
- const binding = __require("@rolldown/binding-linux-x64-gnu");
269
- const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
270
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
271
- return binding;
272
- } catch (e) {
273
- loadErrors.push(e);
274
- }
275
- }
276
- else if (process.arch === "arm64") if (isMusl()) {
277
- try {
278
- return __require("../rolldown-binding.linux-arm64-musl.node");
279
- } catch (e) {
280
- loadErrors.push(e);
281
- }
282
- try {
283
- const binding = __require("@rolldown/binding-linux-arm64-musl");
284
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
285
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
286
- return binding;
287
- } catch (e) {
288
- loadErrors.push(e);
289
- }
290
- } else {
291
- try {
292
- return __require("../rolldown-binding.linux-arm64-gnu.node");
293
- } catch (e) {
294
- loadErrors.push(e);
295
- }
296
- try {
297
- const binding = __require("@rolldown/binding-linux-arm64-gnu");
298
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
299
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
300
- return binding;
301
- } catch (e) {
302
- loadErrors.push(e);
303
- }
304
- }
305
- else if (process.arch === "arm") if (isMusl()) {
306
- try {
307
- return __require("../rolldown-binding.linux-arm-musleabihf.node");
308
- } catch (e) {
309
- loadErrors.push(e);
310
- }
311
- try {
312
- const binding = __require("@rolldown/binding-linux-arm-musleabihf");
313
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
314
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
315
- return binding;
316
- } catch (e) {
317
- loadErrors.push(e);
318
- }
319
- } else {
320
- try {
321
- return __require("../rolldown-binding.linux-arm-gnueabihf.node");
322
- } catch (e) {
323
- loadErrors.push(e);
324
- }
325
- try {
326
- const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
327
- const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
328
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
329
- return binding;
330
- } catch (e) {
331
- loadErrors.push(e);
332
- }
333
- }
334
- else if (process.arch === "riscv64") if (isMusl()) {
335
- try {
336
- return __require("../rolldown-binding.linux-riscv64-musl.node");
337
- } catch (e) {
338
- loadErrors.push(e);
339
- }
340
- try {
341
- const binding = __require("@rolldown/binding-linux-riscv64-musl");
342
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
343
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
344
- return binding;
345
- } catch (e) {
346
- loadErrors.push(e);
347
- }
348
- } else {
349
- try {
350
- return __require("../rolldown-binding.linux-riscv64-gnu.node");
351
- } catch (e) {
352
- loadErrors.push(e);
353
- }
354
- try {
355
- const binding = __require("@rolldown/binding-linux-riscv64-gnu");
356
- const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
357
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
358
- return binding;
359
- } catch (e) {
360
- loadErrors.push(e);
361
- }
362
- }
363
- else if (process.arch === "ppc64") {
364
- try {
365
- return __require("../rolldown-binding.linux-ppc64-gnu.node");
366
- } catch (e) {
367
- loadErrors.push(e);
368
- }
369
- try {
370
- const binding = __require("@rolldown/binding-linux-ppc64-gnu");
371
- const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
372
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
373
- return binding;
374
- } catch (e) {
375
- loadErrors.push(e);
376
- }
377
- } else if (process.arch === "s390x") {
378
- try {
379
- return __require("../rolldown-binding.linux-s390x-gnu.node");
380
- } catch (e) {
381
- loadErrors.push(e);
382
- }
383
- try {
384
- const binding = __require("@rolldown/binding-linux-s390x-gnu");
385
- const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
386
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
387
- return binding;
388
- } catch (e) {
389
- loadErrors.push(e);
390
- }
391
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
392
- else if (process.platform === "openharmony") if (process.arch === "arm64") {
393
- try {
394
- return __require("../rolldown-binding.openharmony-arm64.node");
395
- } catch (e) {
396
- loadErrors.push(e);
397
- }
398
- try {
399
- const binding = __require("@rolldown/binding-openharmony-arm64");
400
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
401
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
402
- return binding;
403
- } catch (e) {
404
- loadErrors.push(e);
405
- }
406
- } else if (process.arch === "x64") {
407
- try {
408
- return __require("../rolldown-binding.openharmony-x64.node");
409
- } catch (e) {
410
- loadErrors.push(e);
411
- }
412
- try {
413
- const binding = __require("@rolldown/binding-openharmony-x64");
414
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
415
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
416
- return binding;
417
- } catch (e) {
418
- loadErrors.push(e);
419
- }
420
- } else if (process.arch === "arm") {
421
- try {
422
- return __require("../rolldown-binding.openharmony-arm.node");
423
- } catch (e) {
424
- loadErrors.push(e);
425
- }
426
- try {
427
- const binding = __require("@rolldown/binding-openharmony-arm");
428
- const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
429
- if (bindingPackageVersion !== "1.0.0-beta.35" && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") throw new Error(`Native binding package version mismatch, expected 1.0.0-beta.35 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
430
- return binding;
431
- } catch (e) {
432
- loadErrors.push(e);
433
- }
434
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
435
- else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
436
- }
437
- nativeBinding = requireNative();
438
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
439
- try {
440
- nativeBinding = __require("../rolldown-binding.wasi.cjs");
441
- } catch (err) {
442
- if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
443
- }
444
- if (!nativeBinding) try {
445
- nativeBinding = __require("@rolldown/binding-wasm32-wasi");
446
- } catch (err) {
447
- if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
448
- }
449
- }
450
- if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
451
- nativeBinding = require_webcontainer_fallback();
452
- } catch (err) {
453
- loadErrors.push(err);
454
- }
455
- if (!nativeBinding) {
456
- if (loadErrors.length > 0) throw new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.", { cause: loadErrors });
457
- throw new Error(`Failed to load native binding`);
458
- }
459
- const { minify, Severity, ParseResult, ExportExportNameKind, ExportImportNameKind, ExportLocalNameKind, ImportNameKind, parseAsync, parseSync, rawTransferSupported, ResolverFactory, EnforceExtension, ModuleType, sync, HelperMode, isolatedDeclaration, moduleRunnerTransform, transform, BindingBundleEndEventData, BindingBundleErrorEventData, BindingBundler, BindingBundlerImpl, BindingCallableBuiltinPlugin, BindingChunkingContext, BindingDevEngine, BindingHmrOutput, BindingModuleInfo, BindingNormalizedOptions, BindingOutputAsset, BindingOutputChunk, BindingOutputs, BindingPluginContext, BindingRenderedChunk, BindingRenderedChunkMeta, BindingRenderedModule, BindingTransformPluginContext, BindingWatcher, BindingWatcherChangeData, BindingWatcherEvent, ParallelJsPluginRegistry, TraceSubscriberGuard, BindingAttachDebugInfo, BindingBuiltinPluginName, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, FilterTokenKind, initTraceSubscriber, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime, JsWatcher } = nativeBinding;
460
-
461
- //#endregion
462
- //#region src/utils/code-frame.ts
463
- function spaces(index) {
464
- let result = "";
465
- while (index--) result += " ";
466
- return result;
467
- }
468
- function tabsToSpaces(value) {
469
- return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
470
- }
471
- const LINE_TRUNCATE_LENGTH = 120;
472
- const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
473
- const ELLIPSIS = "...";
474
- function getCodeFrame(source, line, column) {
475
- let lines = source.split("\n");
476
- if (line > lines.length) return "";
477
- const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + 3, LINE_TRUNCATE_LENGTH);
478
- const frameStart = Math.max(0, line - 3);
479
- let frameEnd = Math.min(line + 2, lines.length);
480
- lines = lines.slice(frameStart, frameEnd);
481
- while (!/\S/.test(lines[lines.length - 1])) {
482
- lines.pop();
483
- frameEnd -= 1;
484
- }
485
- const digits = String(frameEnd).length;
486
- return lines.map((sourceLine, index) => {
487
- const isErrorLine = frameStart + index + 1 === line;
488
- let lineNumber = String(index + frameStart + 1);
489
- while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
490
- let displayedLine = tabsToSpaces(sourceLine);
491
- if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - 3)}${ELLIPSIS}`;
492
- if (isErrorLine) {
493
- const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
494
- return `${lineNumber}: ${displayedLine}\n${indicator}`;
495
- }
496
- return `${lineNumber}: ${displayedLine}`;
497
- }).join("\n");
498
- }
499
-
500
- //#endregion
501
- //#region src/log/locate-character/index.js
502
- /** @typedef {import('./types').Location} Location */
503
- /**
504
- * @param {import('./types').Range} range
505
- * @param {number} index
506
- */
507
- function rangeContains(range, index) {
508
- return range.start <= index && index < range.end;
509
- }
510
- /**
511
- * @param {string} source
512
- * @param {import('./types').Options} [options]
513
- */
514
- function getLocator(source, options = {}) {
515
- const { offsetLine = 0, offsetColumn = 0 } = options;
516
- let start = 0;
517
- const ranges = source.split("\n").map((line, i$1) => {
518
- const end = start + line.length + 1;
519
- /** @type {import('./types').Range} */
520
- const range = {
521
- start,
522
- end,
523
- line: i$1
524
- };
525
- start = end;
526
- return range;
527
- });
528
- let i = 0;
529
- /**
530
- * @param {string | number} search
531
- * @param {number} [index]
532
- * @returns {Location | undefined}
533
- */
534
- function locator(search, index) {
535
- if (typeof search === "string") search = source.indexOf(search, index ?? 0);
536
- if (search === -1) return void 0;
537
- let range = ranges[i];
538
- const d = search >= range.end ? 1 : -1;
539
- while (range) {
540
- if (rangeContains(range, search)) return {
541
- line: offsetLine + range.line,
542
- column: offsetColumn + search - range.start,
543
- character: search
544
- };
545
- i += d;
546
- range = ranges[i];
547
- }
548
- }
549
- return locator;
550
- }
551
- /**
552
- * @param {string} source
553
- * @param {string | number} search
554
- * @param {import('./types').Options} [options]
555
- * @returns {Location | undefined}
556
- */
557
- function locate(source, search, options) {
558
- return getLocator(source, options)(search, options && options.startIndex);
559
- }
560
-
561
- //#endregion
562
- //#region src/log/logs.ts
563
- const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", DUPLICATE_JSX_CONFIG = "DUPLICATE_JSX_CONFIG", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
564
- function logParseError(message) {
565
- return {
566
- code: PARSE_ERROR,
567
- message
568
- };
569
- }
570
- function logInvalidLogPosition(pluginName) {
571
- return {
572
- code: INVALID_LOG_POSITION,
573
- message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
574
- };
575
- }
576
- function logInputHookInOutputPlugin(pluginName, hookName) {
577
- return {
578
- code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
579
- message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
580
- };
581
- }
582
- function logCycleLoading(pluginName, moduleId) {
583
- return {
584
- code: CYCLE_LOADING,
585
- message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
586
- };
587
- }
588
- function logMultiplyNotifyOption() {
589
- return {
590
- code: MULTIPLY_NOTIFY_OPTION,
591
- message: `Found multiply notify option at watch options, using first one to start notify watcher.`
592
- };
593
- }
594
- function logDuplicateJsxConfig() {
595
- return {
596
- code: DUPLICATE_JSX_CONFIG,
597
- message: "Both `options.jsx` and `options.transform.jsx` are set so `options.jsx` is ignored"
598
- };
599
- }
600
- function logPluginError(error$1, plugin, { hook, id } = {}) {
601
- try {
602
- const code = error$1.code;
603
- if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
604
- error$1.code = PLUGIN_ERROR;
605
- error$1.plugin = plugin;
606
- if (hook) error$1.hook = hook;
607
- if (id) error$1.id = id;
608
- } catch (_) {} finally {
609
- return error$1;
610
- }
611
- }
612
- function error(base) {
613
- if (!(base instanceof Error)) {
614
- base = Object.assign(new Error(base.message), base);
615
- Object.defineProperty(base, "name", {
616
- value: "RollupError",
617
- writable: true
618
- });
619
- }
620
- throw base;
621
- }
622
- function augmentCodeLocation(properties, pos, source, id) {
623
- if (typeof pos === "object") {
624
- const { line, column } = pos;
625
- properties.loc = {
626
- column,
627
- file: id,
628
- line
629
- };
630
- } else {
631
- properties.pos = pos;
632
- const location = locate(source, pos, { offsetLine: 1 });
633
- if (!location) return;
634
- const { line, column } = location;
635
- properties.loc = {
636
- column,
637
- file: id,
638
- line
639
- };
640
- }
641
- if (properties.frame === void 0) {
642
- const { line, column } = properties.loc;
643
- properties.frame = getCodeFrame(source, line, column);
644
- }
645
- }
646
-
647
- //#endregion
648
- //#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
649
- function wrap$1(result) {
650
- let program, module$1, comments, errors;
651
- return {
652
- get program() {
653
- if (!program) program = jsonParseAst(result.program);
654
- return program;
655
- },
656
- get module() {
657
- if (!module$1) module$1 = result.module;
658
- return module$1;
659
- },
660
- get comments() {
661
- if (!comments) comments = result.comments;
662
- return comments;
663
- },
664
- get errors() {
665
- if (!errors) errors = result.errors;
666
- return errors;
667
- }
668
- };
669
- }
670
- function jsonParseAst(programJson) {
671
- const { node: program, fixes } = JSON.parse(programJson);
672
- for (const fixPath of fixes) applyFix(program, fixPath);
673
- return program;
674
- }
675
- function applyFix(program, fixPath) {
676
- let node = program;
677
- for (const key of fixPath) node = node[key];
678
- if (node.bigint) node.value = BigInt(node.bigint);
679
- else try {
680
- node.value = RegExp(node.regex.pattern, node.regex.flags);
681
- } catch (_err) {}
682
- }
683
-
684
- //#endregion
685
- //#region src/parse-ast-index.ts
686
- function wrap(result, sourceText) {
687
- result = wrap$1(result);
688
- if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
689
- return result.program;
690
- }
691
- function normalizeParseError(sourceText, errors) {
692
- let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
693
- for (let i = 0; i < errors.length; i++) {
694
- if (i >= 5) {
695
- message += "\n...";
696
- break;
697
- }
698
- const e = errors[i];
699
- message += e.message + "\n" + e.labels.map((label) => {
700
- const location = locate(sourceText, label.start, { offsetLine: 1 });
701
- if (!location) return;
702
- return getCodeFrame(sourceText, location.line, location.column);
703
- }).filter(Boolean).join("\n");
704
- }
705
- return error(logParseError(message));
706
- }
707
- const defaultParserOptions = {
708
- lang: "js",
709
- preserveParens: false
710
- };
711
- function parseAst(sourceText, options, filename) {
712
- return wrap(parseSync(filename ?? "file.js", sourceText, {
713
- ...defaultParserOptions,
714
- ...options
715
- }), sourceText);
716
- }
717
- async function parseAstAsync(sourceText, options, filename) {
718
- return wrap(await parseAsync(filename ?? "file.js", sourceText, {
719
- ...defaultParserOptions,
720
- ...options
721
- }), sourceText);
722
- }
723
-
724
- //#endregion
725
- export { BindingAttachDebugInfo, BindingBundler, BindingCallableBuiltinPlugin, BindingChunkModuleOrderBy, BindingDevEngine, BindingJsx, BindingLogLevel, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects, BindingWatcher, ParallelJsPluginRegistry, ResolverFactory, __commonJS, __toESM, augmentCodeLocation, error, isolatedDeclaration, logCycleLoading, logDuplicateJsxConfig, logInputHookInOutputPlugin, logInvalidLogPosition, logMultiplyNotifyOption, logPluginError, moduleRunnerTransform, parseAst, parseAstAsync, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime, transform };