rolldown 1.0.0-beta.34 → 1.0.0-beta.36

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 +218 -229
  2. package/dist/config.d.mts +2 -2
  3. package/dist/config.mjs +3 -3
  4. package/dist/experimental-index.d.mts +16 -4
  5. package/dist/experimental-index.mjs +23 -7
  6. package/dist/filter-index.d.mts +2 -2
  7. package/dist/index.d.mts +2 -2
  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-wK0CRIMb.d.mts} +1 -0
  14. package/dist/shared/{define-config-DVSr6Unb.d.mts → define-config-wxvILtDx.d.mts} +30 -3
  15. package/dist/shared/{load-config-CXpGBNqp.mjs → load-config-Jqw6FAJp.mjs} +4 -6
  16. package/dist/shared/parse-ast-index-CkDFQ-07.mjs +10847 -0
  17. package/dist/shared/{prompt-C5jz26Zn.mjs → prompt-DuG2i9ud.mjs} +4 -7
  18. package/dist/shared/{src-Chn1S4O2.mjs → src-WjgJWoNk.mjs} +141 -70
  19. package/package.json +33 -48
  20. package/dist/cli.cjs +0 -1767
  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 -139
  25. package/dist/experimental-index.d.cts +0 -90
  26. package/dist/filter-index.cjs +0 -105
  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 -32
  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-D5AluabE.d.cts +0 -1394
  39. package/dist/shared/load-config-CefxSUnT.cjs +0 -125
  40. package/dist/shared/misc-DksvspN4.cjs +0 -58
  41. package/dist/shared/parse-ast-index-BCv3Y1TT.cjs +0 -859
  42. package/dist/shared/parse-ast-index-DjojK-Vf.mjs +0 -725
  43. package/dist/shared/prompt-QNI93ne7.cjs +0 -854
  44. package/dist/shared/src-djpzntWm.cjs +0 -4622
@@ -1,859 +0,0 @@
1
- const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
-
3
- //#region src/webcontainer-fallback.cjs
4
- var require_webcontainer_fallback = /* @__PURE__ */ require_chunk.__commonJS({ "src/webcontainer-fallback.cjs": ((exports, module) => {
5
- const fs = require("node:fs");
6
- const childProcess = require("node:child_process");
7
- const rolldownPkg = JSON.parse(fs.readFileSync(require.resolve("rolldown/package.json"), "utf-8"));
8
- const version = rolldownPkg.version;
9
- const baseDir = `/tmp/rolldown-${version}`;
10
- const bindingEntry = `${baseDir}/node_modules/@rolldown/binding-wasm32-wasi/rolldown-binding.wasi.cjs`;
11
- if (!fs.existsSync(bindingEntry)) {
12
- const bindingPkg = `@rolldown/binding-wasm32-wasi@${version}`;
13
- fs.rmSync(baseDir, {
14
- recursive: true,
15
- force: true
16
- });
17
- fs.mkdirSync(baseDir, { recursive: true });
18
- console.log(`[rolldown] Downloading ${bindingPkg} on WebContainer...`);
19
- childProcess.execFileSync("pnpm", ["i", bindingPkg], {
20
- cwd: baseDir,
21
- stdio: "inherit"
22
- });
23
- }
24
- module.exports = require(bindingEntry);
25
- }) });
26
-
27
- //#endregion
28
- //#region src/binding.js
29
- new URL(".", require("url").pathToFileURL(__filename).href).pathname;
30
- const { readFileSync } = require("node:fs");
31
- let nativeBinding = null;
32
- const loadErrors = [];
33
- const isMusl = () => {
34
- let musl = false;
35
- if (process.platform === "linux") {
36
- musl = isMuslFromFilesystem();
37
- if (musl === null) musl = isMuslFromReport();
38
- if (musl === null) musl = isMuslFromChildProcess();
39
- }
40
- return musl;
41
- };
42
- const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
43
- const isMuslFromFilesystem = () => {
44
- try {
45
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
46
- } catch {
47
- return null;
48
- }
49
- };
50
- const isMuslFromReport = () => {
51
- let report = null;
52
- if (typeof process.report?.getReport === "function") {
53
- process.report.excludeNetwork = true;
54
- report = process.report.getReport();
55
- }
56
- if (!report) return null;
57
- if (report.header && report.header.glibcVersionRuntime) return false;
58
- if (Array.isArray(report.sharedObjects)) {
59
- if (report.sharedObjects.some(isFileMusl)) return true;
60
- }
61
- return false;
62
- };
63
- const isMuslFromChildProcess = () => {
64
- try {
65
- return require("child_process").execSync("ldd --version", { encoding: "utf8" }).includes("musl");
66
- } catch (e) {
67
- return false;
68
- }
69
- };
70
- function requireNative() {
71
- if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) try {
72
- nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
73
- } catch (err) {
74
- loadErrors.push(err);
75
- }
76
- else if (process.platform === "android") if (process.arch === "arm64") {
77
- try {
78
- return require("../rolldown-binding.android-arm64.node");
79
- } catch (e) {
80
- loadErrors.push(e);
81
- }
82
- try {
83
- const binding = require("@rolldown/binding-android-arm64");
84
- const bindingPackageVersion = require("@rolldown/binding-android-arm64/package.json").version;
85
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
86
- return binding;
87
- } catch (e) {
88
- loadErrors.push(e);
89
- }
90
- } else if (process.arch === "arm") {
91
- try {
92
- return require("../rolldown-binding.android-arm-eabi.node");
93
- } catch (e) {
94
- loadErrors.push(e);
95
- }
96
- try {
97
- const binding = require("@rolldown/binding-android-arm-eabi");
98
- const bindingPackageVersion = require("@rolldown/binding-android-arm-eabi/package.json").version;
99
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
100
- return binding;
101
- } catch (e) {
102
- loadErrors.push(e);
103
- }
104
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
105
- else if (process.platform === "win32") if (process.arch === "x64") {
106
- try {
107
- return require("../rolldown-binding.win32-x64-msvc.node");
108
- } catch (e) {
109
- loadErrors.push(e);
110
- }
111
- try {
112
- const binding = require("@rolldown/binding-win32-x64-msvc");
113
- const bindingPackageVersion = require("@rolldown/binding-win32-x64-msvc/package.json").version;
114
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
115
- return binding;
116
- } catch (e) {
117
- loadErrors.push(e);
118
- }
119
- } else if (process.arch === "ia32") {
120
- try {
121
- return require("../rolldown-binding.win32-ia32-msvc.node");
122
- } catch (e) {
123
- loadErrors.push(e);
124
- }
125
- try {
126
- const binding = require("@rolldown/binding-win32-ia32-msvc");
127
- const bindingPackageVersion = require("@rolldown/binding-win32-ia32-msvc/package.json").version;
128
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
129
- return binding;
130
- } catch (e) {
131
- loadErrors.push(e);
132
- }
133
- } else if (process.arch === "arm64") {
134
- try {
135
- return require("../rolldown-binding.win32-arm64-msvc.node");
136
- } catch (e) {
137
- loadErrors.push(e);
138
- }
139
- try {
140
- const binding = require("@rolldown/binding-win32-arm64-msvc");
141
- const bindingPackageVersion = require("@rolldown/binding-win32-arm64-msvc/package.json").version;
142
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
143
- return binding;
144
- } catch (e) {
145
- loadErrors.push(e);
146
- }
147
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
148
- else if (process.platform === "darwin") {
149
- try {
150
- return require("../rolldown-binding.darwin-universal.node");
151
- } catch (e) {
152
- loadErrors.push(e);
153
- }
154
- try {
155
- const binding = require("@rolldown/binding-darwin-universal");
156
- const bindingPackageVersion = require("@rolldown/binding-darwin-universal/package.json").version;
157
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
158
- return binding;
159
- } catch (e) {
160
- loadErrors.push(e);
161
- }
162
- if (process.arch === "x64") {
163
- try {
164
- return require("../rolldown-binding.darwin-x64.node");
165
- } catch (e) {
166
- loadErrors.push(e);
167
- }
168
- try {
169
- const binding = require("@rolldown/binding-darwin-x64");
170
- const bindingPackageVersion = require("@rolldown/binding-darwin-x64/package.json").version;
171
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
172
- return binding;
173
- } catch (e) {
174
- loadErrors.push(e);
175
- }
176
- } else if (process.arch === "arm64") {
177
- try {
178
- return require("../rolldown-binding.darwin-arm64.node");
179
- } catch (e) {
180
- loadErrors.push(e);
181
- }
182
- try {
183
- const binding = require("@rolldown/binding-darwin-arm64");
184
- const bindingPackageVersion = require("@rolldown/binding-darwin-arm64/package.json").version;
185
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
186
- return binding;
187
- } catch (e) {
188
- loadErrors.push(e);
189
- }
190
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
191
- } else if (process.platform === "freebsd") if (process.arch === "x64") {
192
- try {
193
- return require("../rolldown-binding.freebsd-x64.node");
194
- } catch (e) {
195
- loadErrors.push(e);
196
- }
197
- try {
198
- const binding = require("@rolldown/binding-freebsd-x64");
199
- const bindingPackageVersion = require("@rolldown/binding-freebsd-x64/package.json").version;
200
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
201
- return binding;
202
- } catch (e) {
203
- loadErrors.push(e);
204
- }
205
- } else if (process.arch === "arm64") {
206
- try {
207
- return require("../rolldown-binding.freebsd-arm64.node");
208
- } catch (e) {
209
- loadErrors.push(e);
210
- }
211
- try {
212
- const binding = require("@rolldown/binding-freebsd-arm64");
213
- const bindingPackageVersion = require("@rolldown/binding-freebsd-arm64/package.json").version;
214
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
215
- return binding;
216
- } catch (e) {
217
- loadErrors.push(e);
218
- }
219
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
220
- else if (process.platform === "linux") if (process.arch === "x64") if (isMusl()) {
221
- try {
222
- return require("../rolldown-binding.linux-x64-musl.node");
223
- } catch (e) {
224
- loadErrors.push(e);
225
- }
226
- try {
227
- const binding = require("@rolldown/binding-linux-x64-musl");
228
- const bindingPackageVersion = require("@rolldown/binding-linux-x64-musl/package.json").version;
229
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
230
- return binding;
231
- } catch (e) {
232
- loadErrors.push(e);
233
- }
234
- } else {
235
- try {
236
- return require("../rolldown-binding.linux-x64-gnu.node");
237
- } catch (e) {
238
- loadErrors.push(e);
239
- }
240
- try {
241
- const binding = require("@rolldown/binding-linux-x64-gnu");
242
- const bindingPackageVersion = require("@rolldown/binding-linux-x64-gnu/package.json").version;
243
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
244
- return binding;
245
- } catch (e) {
246
- loadErrors.push(e);
247
- }
248
- }
249
- else if (process.arch === "arm64") if (isMusl()) {
250
- try {
251
- return require("../rolldown-binding.linux-arm64-musl.node");
252
- } catch (e) {
253
- loadErrors.push(e);
254
- }
255
- try {
256
- const binding = require("@rolldown/binding-linux-arm64-musl");
257
- const bindingPackageVersion = require("@rolldown/binding-linux-arm64-musl/package.json").version;
258
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
259
- return binding;
260
- } catch (e) {
261
- loadErrors.push(e);
262
- }
263
- } else {
264
- try {
265
- return require("../rolldown-binding.linux-arm64-gnu.node");
266
- } catch (e) {
267
- loadErrors.push(e);
268
- }
269
- try {
270
- const binding = require("@rolldown/binding-linux-arm64-gnu");
271
- const bindingPackageVersion = require("@rolldown/binding-linux-arm64-gnu/package.json").version;
272
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
273
- return binding;
274
- } catch (e) {
275
- loadErrors.push(e);
276
- }
277
- }
278
- else if (process.arch === "arm") if (isMusl()) {
279
- try {
280
- return require("../rolldown-binding.linux-arm-musleabihf.node");
281
- } catch (e) {
282
- loadErrors.push(e);
283
- }
284
- try {
285
- const binding = require("@rolldown/binding-linux-arm-musleabihf");
286
- const bindingPackageVersion = require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
287
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
288
- return binding;
289
- } catch (e) {
290
- loadErrors.push(e);
291
- }
292
- } else {
293
- try {
294
- return require("../rolldown-binding.linux-arm-gnueabihf.node");
295
- } catch (e) {
296
- loadErrors.push(e);
297
- }
298
- try {
299
- const binding = require("@rolldown/binding-linux-arm-gnueabihf");
300
- const bindingPackageVersion = require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
301
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
302
- return binding;
303
- } catch (e) {
304
- loadErrors.push(e);
305
- }
306
- }
307
- else if (process.arch === "riscv64") if (isMusl()) {
308
- try {
309
- return require("../rolldown-binding.linux-riscv64-musl.node");
310
- } catch (e) {
311
- loadErrors.push(e);
312
- }
313
- try {
314
- const binding = require("@rolldown/binding-linux-riscv64-musl");
315
- const bindingPackageVersion = require("@rolldown/binding-linux-riscv64-musl/package.json").version;
316
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
317
- return binding;
318
- } catch (e) {
319
- loadErrors.push(e);
320
- }
321
- } else {
322
- try {
323
- return require("../rolldown-binding.linux-riscv64-gnu.node");
324
- } catch (e) {
325
- loadErrors.push(e);
326
- }
327
- try {
328
- const binding = require("@rolldown/binding-linux-riscv64-gnu");
329
- const bindingPackageVersion = require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
330
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
331
- return binding;
332
- } catch (e) {
333
- loadErrors.push(e);
334
- }
335
- }
336
- else if (process.arch === "ppc64") {
337
- try {
338
- return require("../rolldown-binding.linux-ppc64-gnu.node");
339
- } catch (e) {
340
- loadErrors.push(e);
341
- }
342
- try {
343
- const binding = require("@rolldown/binding-linux-ppc64-gnu");
344
- const bindingPackageVersion = require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
345
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
346
- return binding;
347
- } catch (e) {
348
- loadErrors.push(e);
349
- }
350
- } else if (process.arch === "s390x") {
351
- try {
352
- return require("../rolldown-binding.linux-s390x-gnu.node");
353
- } catch (e) {
354
- loadErrors.push(e);
355
- }
356
- try {
357
- const binding = require("@rolldown/binding-linux-s390x-gnu");
358
- const bindingPackageVersion = require("@rolldown/binding-linux-s390x-gnu/package.json").version;
359
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
360
- return binding;
361
- } catch (e) {
362
- loadErrors.push(e);
363
- }
364
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
365
- else if (process.platform === "openharmony") if (process.arch === "arm64") {
366
- try {
367
- return require("../rolldown-binding.openharmony-arm64.node");
368
- } catch (e) {
369
- loadErrors.push(e);
370
- }
371
- try {
372
- const binding = require("@rolldown/binding-openharmony-arm64");
373
- const bindingPackageVersion = require("@rolldown/binding-openharmony-arm64/package.json").version;
374
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
375
- return binding;
376
- } catch (e) {
377
- loadErrors.push(e);
378
- }
379
- } else if (process.arch === "x64") {
380
- try {
381
- return require("../rolldown-binding.openharmony-x64.node");
382
- } catch (e) {
383
- loadErrors.push(e);
384
- }
385
- try {
386
- const binding = require("@rolldown/binding-openharmony-x64");
387
- const bindingPackageVersion = require("@rolldown/binding-openharmony-x64/package.json").version;
388
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
389
- return binding;
390
- } catch (e) {
391
- loadErrors.push(e);
392
- }
393
- } else if (process.arch === "arm") {
394
- try {
395
- return require("../rolldown-binding.openharmony-arm.node");
396
- } catch (e) {
397
- loadErrors.push(e);
398
- }
399
- try {
400
- const binding = require("@rolldown/binding-openharmony-arm");
401
- const bindingPackageVersion = require("@rolldown/binding-openharmony-arm/package.json").version;
402
- if (bindingPackageVersion !== "1.0.0-beta.34" && 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.34 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
403
- return binding;
404
- } catch (e) {
405
- loadErrors.push(e);
406
- }
407
- } else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
408
- else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
409
- }
410
- nativeBinding = requireNative();
411
- if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
412
- try {
413
- nativeBinding = require("../rolldown-binding.wasi.cjs");
414
- } catch (err) {
415
- if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
416
- }
417
- if (!nativeBinding) try {
418
- nativeBinding = require("@rolldown/binding-wasm32-wasi");
419
- } catch (err) {
420
- if (process.env.NAPI_RS_FORCE_WASI) loadErrors.push(err);
421
- }
422
- }
423
- if (!nativeBinding && globalThis.process?.versions?.["webcontainer"]) try {
424
- nativeBinding = require_webcontainer_fallback();
425
- } catch (err) {
426
- loadErrors.push(err);
427
- }
428
- if (!nativeBinding) {
429
- 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 });
430
- throw new Error(`Failed to load native binding`);
431
- }
432
- 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, BindingAttachDebugInfo, BindingBuiltinPluginName, BindingChunkModuleOrderBy, BindingJsx, BindingLogLevel, BindingPluginOrder, FilterTokenKind, registerPlugins, shutdownAsyncRuntime, startAsyncRuntime, JsWatcher } = nativeBinding;
433
-
434
- //#endregion
435
- //#region src/utils/code-frame.ts
436
- function spaces(index) {
437
- let result = "";
438
- while (index--) result += " ";
439
- return result;
440
- }
441
- function tabsToSpaces(value) {
442
- return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
443
- }
444
- const LINE_TRUNCATE_LENGTH = 120;
445
- const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
446
- const ELLIPSIS = "...";
447
- function getCodeFrame(source, line, column) {
448
- let lines = source.split("\n");
449
- if (line > lines.length) return "";
450
- const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + 3, LINE_TRUNCATE_LENGTH);
451
- const frameStart = Math.max(0, line - 3);
452
- let frameEnd = Math.min(line + 2, lines.length);
453
- lines = lines.slice(frameStart, frameEnd);
454
- while (!/\S/.test(lines[lines.length - 1])) {
455
- lines.pop();
456
- frameEnd -= 1;
457
- }
458
- const digits = String(frameEnd).length;
459
- return lines.map((sourceLine, index) => {
460
- const isErrorLine = frameStart + index + 1 === line;
461
- let lineNumber = String(index + frameStart + 1);
462
- while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
463
- let displayedLine = tabsToSpaces(sourceLine);
464
- if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - 3)}${ELLIPSIS}`;
465
- if (isErrorLine) {
466
- const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
467
- return `${lineNumber}: ${displayedLine}\n${indicator}`;
468
- }
469
- return `${lineNumber}: ${displayedLine}`;
470
- }).join("\n");
471
- }
472
-
473
- //#endregion
474
- //#region src/log/locate-character/index.js
475
- /** @typedef {import('./types').Location} Location */
476
- /**
477
- * @param {import('./types').Range} range
478
- * @param {number} index
479
- */
480
- function rangeContains(range, index) {
481
- return range.start <= index && index < range.end;
482
- }
483
- /**
484
- * @param {string} source
485
- * @param {import('./types').Options} [options]
486
- */
487
- function getLocator(source, options = {}) {
488
- const { offsetLine = 0, offsetColumn = 0 } = options;
489
- let start = 0;
490
- const ranges = source.split("\n").map((line, i$1) => {
491
- const end = start + line.length + 1;
492
- /** @type {import('./types').Range} */
493
- const range = {
494
- start,
495
- end,
496
- line: i$1
497
- };
498
- start = end;
499
- return range;
500
- });
501
- let i = 0;
502
- /**
503
- * @param {string | number} search
504
- * @param {number} [index]
505
- * @returns {Location | undefined}
506
- */
507
- function locator(search, index) {
508
- if (typeof search === "string") search = source.indexOf(search, index ?? 0);
509
- if (search === -1) return void 0;
510
- let range = ranges[i];
511
- const d = search >= range.end ? 1 : -1;
512
- while (range) {
513
- if (rangeContains(range, search)) return {
514
- line: offsetLine + range.line,
515
- column: offsetColumn + search - range.start,
516
- character: search
517
- };
518
- i += d;
519
- range = ranges[i];
520
- }
521
- }
522
- return locator;
523
- }
524
- /**
525
- * @param {string} source
526
- * @param {string | number} search
527
- * @param {import('./types').Options} [options]
528
- * @returns {Location | undefined}
529
- */
530
- function locate(source, search, options) {
531
- return getLocator(source, options)(search, options && options.startIndex);
532
- }
533
-
534
- //#endregion
535
- //#region src/log/logs.ts
536
- 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";
537
- function logParseError(message) {
538
- return {
539
- code: PARSE_ERROR,
540
- message
541
- };
542
- }
543
- function logInvalidLogPosition(pluginName) {
544
- return {
545
- code: INVALID_LOG_POSITION,
546
- 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.`
547
- };
548
- }
549
- function logInputHookInOutputPlugin(pluginName, hookName) {
550
- return {
551
- code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
552
- 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.`
553
- };
554
- }
555
- function logCycleLoading(pluginName, moduleId) {
556
- return {
557
- code: CYCLE_LOADING,
558
- message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
559
- };
560
- }
561
- function logMultiplyNotifyOption() {
562
- return {
563
- code: MULTIPLY_NOTIFY_OPTION,
564
- message: `Found multiply notify option at watch options, using first one to start notify watcher.`
565
- };
566
- }
567
- function logDuplicateJsxConfig() {
568
- return {
569
- code: DUPLICATE_JSX_CONFIG,
570
- message: "Both `options.jsx` and `options.transform.jsx` are set so `options.jsx` is ignored"
571
- };
572
- }
573
- function logPluginError(error$1, plugin, { hook, id } = {}) {
574
- try {
575
- const code = error$1.code;
576
- if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
577
- error$1.code = PLUGIN_ERROR;
578
- error$1.plugin = plugin;
579
- if (hook) error$1.hook = hook;
580
- if (id) error$1.id = id;
581
- } catch (_) {} finally {
582
- return error$1;
583
- }
584
- }
585
- function error(base) {
586
- if (!(base instanceof Error)) {
587
- base = Object.assign(new Error(base.message), base);
588
- Object.defineProperty(base, "name", {
589
- value: "RollupError",
590
- writable: true
591
- });
592
- }
593
- throw base;
594
- }
595
- function augmentCodeLocation(properties, pos, source, id) {
596
- if (typeof pos === "object") {
597
- const { line, column } = pos;
598
- properties.loc = {
599
- column,
600
- file: id,
601
- line
602
- };
603
- } else {
604
- properties.pos = pos;
605
- const location = locate(source, pos, { offsetLine: 1 });
606
- if (!location) return;
607
- const { line, column } = location;
608
- properties.loc = {
609
- column,
610
- file: id,
611
- line
612
- };
613
- }
614
- if (properties.frame === void 0) {
615
- const { line, column } = properties.loc;
616
- properties.frame = getCodeFrame(source, line, column);
617
- }
618
- }
619
-
620
- //#endregion
621
- //#region ../../node_modules/.pnpm/oxc-parser@0.82.3/node_modules/oxc-parser/wrap.mjs
622
- function wrap$1(result) {
623
- let program, module$1, comments, errors;
624
- return {
625
- get program() {
626
- if (!program) program = jsonParseAst(result.program);
627
- return program;
628
- },
629
- get module() {
630
- if (!module$1) module$1 = result.module;
631
- return module$1;
632
- },
633
- get comments() {
634
- if (!comments) comments = result.comments;
635
- return comments;
636
- },
637
- get errors() {
638
- if (!errors) errors = result.errors;
639
- return errors;
640
- }
641
- };
642
- }
643
- function jsonParseAst(programJson) {
644
- const { node: program, fixes } = JSON.parse(programJson);
645
- for (const fixPath of fixes) applyFix(program, fixPath);
646
- return program;
647
- }
648
- function applyFix(program, fixPath) {
649
- let node = program;
650
- for (const key of fixPath) node = node[key];
651
- if (node.bigint) node.value = BigInt(node.bigint);
652
- else try {
653
- node.value = RegExp(node.regex.pattern, node.regex.flags);
654
- } catch (_err) {}
655
- }
656
-
657
- //#endregion
658
- //#region src/parse-ast-index.ts
659
- function wrap(result, sourceText) {
660
- result = wrap$1(result);
661
- if (result.errors.length > 0) return normalizeParseError(sourceText, result.errors);
662
- return result.program;
663
- }
664
- function normalizeParseError(sourceText, errors) {
665
- let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
666
- for (let i = 0; i < errors.length; i++) {
667
- if (i >= 5) {
668
- message += "\n...";
669
- break;
670
- }
671
- const e = errors[i];
672
- message += e.message + "\n" + e.labels.map((label) => {
673
- const location = locate(sourceText, label.start, { offsetLine: 1 });
674
- if (!location) return;
675
- return getCodeFrame(sourceText, location.line, location.column);
676
- }).filter(Boolean).join("\n");
677
- }
678
- return error(logParseError(message));
679
- }
680
- const defaultParserOptions = {
681
- lang: "js",
682
- preserveParens: false
683
- };
684
- function parseAst(sourceText, options, filename) {
685
- return wrap(parseSync(filename ?? "file.js", sourceText, {
686
- ...defaultParserOptions,
687
- ...options
688
- }), sourceText);
689
- }
690
- async function parseAstAsync(sourceText, options, filename) {
691
- return wrap(await parseAsync(filename ?? "file.js", sourceText, {
692
- ...defaultParserOptions,
693
- ...options
694
- }), sourceText);
695
- }
696
-
697
- //#endregion
698
- Object.defineProperty(exports, 'BindingAttachDebugInfo', {
699
- enumerable: true,
700
- get: function () {
701
- return BindingAttachDebugInfo;
702
- }
703
- });
704
- Object.defineProperty(exports, 'BindingBundler', {
705
- enumerable: true,
706
- get: function () {
707
- return BindingBundler;
708
- }
709
- });
710
- Object.defineProperty(exports, 'BindingCallableBuiltinPlugin', {
711
- enumerable: true,
712
- get: function () {
713
- return BindingCallableBuiltinPlugin;
714
- }
715
- });
716
- Object.defineProperty(exports, 'BindingChunkModuleOrderBy', {
717
- enumerable: true,
718
- get: function () {
719
- return BindingChunkModuleOrderBy;
720
- }
721
- });
722
- Object.defineProperty(exports, 'BindingDevEngine', {
723
- enumerable: true,
724
- get: function () {
725
- return BindingDevEngine;
726
- }
727
- });
728
- Object.defineProperty(exports, 'BindingJsx', {
729
- enumerable: true,
730
- get: function () {
731
- return BindingJsx;
732
- }
733
- });
734
- Object.defineProperty(exports, 'BindingLogLevel', {
735
- enumerable: true,
736
- get: function () {
737
- return BindingLogLevel;
738
- }
739
- });
740
- Object.defineProperty(exports, 'BindingPluginOrder', {
741
- enumerable: true,
742
- get: function () {
743
- return BindingPluginOrder;
744
- }
745
- });
746
- Object.defineProperty(exports, 'BindingWatcher', {
747
- enumerable: true,
748
- get: function () {
749
- return BindingWatcher;
750
- }
751
- });
752
- Object.defineProperty(exports, 'ParallelJsPluginRegistry', {
753
- enumerable: true,
754
- get: function () {
755
- return ParallelJsPluginRegistry;
756
- }
757
- });
758
- Object.defineProperty(exports, 'ResolverFactory', {
759
- enumerable: true,
760
- get: function () {
761
- return ResolverFactory;
762
- }
763
- });
764
- Object.defineProperty(exports, 'augmentCodeLocation', {
765
- enumerable: true,
766
- get: function () {
767
- return augmentCodeLocation;
768
- }
769
- });
770
- Object.defineProperty(exports, 'error', {
771
- enumerable: true,
772
- get: function () {
773
- return error;
774
- }
775
- });
776
- Object.defineProperty(exports, 'isolatedDeclaration', {
777
- enumerable: true,
778
- get: function () {
779
- return isolatedDeclaration;
780
- }
781
- });
782
- Object.defineProperty(exports, 'logCycleLoading', {
783
- enumerable: true,
784
- get: function () {
785
- return logCycleLoading;
786
- }
787
- });
788
- Object.defineProperty(exports, 'logDuplicateJsxConfig', {
789
- enumerable: true,
790
- get: function () {
791
- return logDuplicateJsxConfig;
792
- }
793
- });
794
- Object.defineProperty(exports, 'logInputHookInOutputPlugin', {
795
- enumerable: true,
796
- get: function () {
797
- return logInputHookInOutputPlugin;
798
- }
799
- });
800
- Object.defineProperty(exports, 'logInvalidLogPosition', {
801
- enumerable: true,
802
- get: function () {
803
- return logInvalidLogPosition;
804
- }
805
- });
806
- Object.defineProperty(exports, 'logMultiplyNotifyOption', {
807
- enumerable: true,
808
- get: function () {
809
- return logMultiplyNotifyOption;
810
- }
811
- });
812
- Object.defineProperty(exports, 'logPluginError', {
813
- enumerable: true,
814
- get: function () {
815
- return logPluginError;
816
- }
817
- });
818
- Object.defineProperty(exports, 'moduleRunnerTransform', {
819
- enumerable: true,
820
- get: function () {
821
- return moduleRunnerTransform;
822
- }
823
- });
824
- Object.defineProperty(exports, 'parseAst', {
825
- enumerable: true,
826
- get: function () {
827
- return parseAst;
828
- }
829
- });
830
- Object.defineProperty(exports, 'parseAstAsync', {
831
- enumerable: true,
832
- get: function () {
833
- return parseAstAsync;
834
- }
835
- });
836
- Object.defineProperty(exports, 'registerPlugins', {
837
- enumerable: true,
838
- get: function () {
839
- return registerPlugins;
840
- }
841
- });
842
- Object.defineProperty(exports, 'shutdownAsyncRuntime', {
843
- enumerable: true,
844
- get: function () {
845
- return shutdownAsyncRuntime;
846
- }
847
- });
848
- Object.defineProperty(exports, 'startAsyncRuntime', {
849
- enumerable: true,
850
- get: function () {
851
- return startAsyncRuntime;
852
- }
853
- });
854
- Object.defineProperty(exports, 'transform', {
855
- enumerable: true,
856
- get: function () {
857
- return transform;
858
- }
859
- });