@coderline/alphatab-vite 1.9.0-alpha.1861 → 1.9.0-alpha.1962
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/dist/AlphaTabVitePluginOptions.cjs +1 -1
- package/dist/AlphaTabVitePluginOptions.mjs +1 -1
- package/dist/alphaTab.vite.cjs +1 -1
- package/dist/alphaTab.vite.mjs +1 -1
- package/dist/alphaTabVitePlugin.cjs +1 -1
- package/dist/alphaTabVitePlugin.mjs +1 -1
- package/dist/bridge/asset.cjs +3 -2
- package/dist/bridge/asset.mjs +3 -2
- package/dist/bridge/build.cjs +2 -4
- package/dist/bridge/build.mjs +2 -4
- package/dist/bridge/bundler.cjs +1 -1
- package/dist/bridge/bundler.mjs +1 -1
- package/dist/bridge/config.cjs +1 -1
- package/dist/bridge/config.mjs +1 -1
- package/dist/bridge/constants.cjs +1 -1
- package/dist/bridge/constants.mjs +1 -1
- package/dist/bridge/fsUtils.cjs +1 -1
- package/dist/bridge/fsUtils.mjs +1 -1
- package/dist/bridge/index.cjs +1 -1
- package/dist/bridge/index.mjs +1 -1
- package/dist/bridge/optimizer.cjs +5 -2
- package/dist/bridge/optimizer.mjs +5 -2
- package/dist/bridge/plugins.cjs +1 -1
- package/dist/bridge/plugins.mjs +1 -1
- package/dist/bridge/resolve.cjs +1 -1
- package/dist/bridge/resolve.mjs +1 -1
- package/dist/bridge/typeUtils.cjs +1 -1
- package/dist/bridge/typeUtils.mjs +1 -1
- package/dist/bridge/utils.cjs +1 -1
- package/dist/bridge/utils.mjs +1 -1
- package/dist/bridge/worker.cjs +3 -2
- package/dist/bridge/worker.mjs +3 -2
- package/dist/copyAssetsPlugin.cjs +1 -1
- package/dist/copyAssetsPlugin.mjs +1 -1
- package/dist/detectionGlobalPlugin.cjs +1 -1
- package/dist/detectionGlobalPlugin.mjs +1 -1
- package/dist/dist.cjs +1264 -868
- package/dist/dist.mjs +1263 -868
- package/dist/importMetaPlugin.cjs +2 -4
- package/dist/importMetaPlugin.mjs +2 -4
- package/dist/{prompt-B1Yc1NPt.cjs → prompt-CH6TK0bC.cjs} +63 -25
- package/dist/{prompt-B1Yc1NPt.mjs → prompt-CH6TK0bC.mjs} +63 -25
- package/dist/rolldown-runtime.cjs +2 -2
- package/dist/workerPlugin.cjs +6 -6
- package/dist/workerPlugin.mjs +6 -6
- package/package.json +10 -10
package/dist/dist.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* alphaTab Vite Plugin v1.9.0-alpha.
|
|
2
|
+
* alphaTab Vite Plugin v1.9.0-alpha.1962 (develop, build 1962)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
* @preserve
|
|
34
34
|
* @license
|
|
35
35
|
*/
|
|
36
|
+
import fs from "node:fs";
|
|
36
37
|
import path, { sep } from "node:path";
|
|
38
|
+
import { fileURLToPath } from "node:url";
|
|
37
39
|
import { createRequire } from "node:module";
|
|
38
40
|
import fsp from "node:fs/promises";
|
|
39
41
|
import { Worker, isMainThread } from "node:worker_threads";
|
|
@@ -41,7 +43,7 @@ import { formatWithOptions, styleText } from "node:util";
|
|
|
41
43
|
import g$1 from "node:process";
|
|
42
44
|
import * as tty from "node:tty";
|
|
43
45
|
import os from "node:os";
|
|
44
|
-
//#region ../../node_modules/rolldown/dist/shared/binding-
|
|
46
|
+
//#region ../../node_modules/rolldown/dist/shared/binding-DH95uVkp.mjs
|
|
45
47
|
var __create = Object.create;
|
|
46
48
|
var __defProp = Object.defineProperty;
|
|
47
49
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -59,7 +61,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
59
61
|
}
|
|
60
62
|
return to;
|
|
61
63
|
};
|
|
62
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
64
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
63
65
|
value: mod,
|
|
64
66
|
enumerable: true
|
|
65
67
|
}) : target, mod));
|
|
@@ -132,94 +134,97 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
132
134
|
} catch (err) {
|
|
133
135
|
loadErrors.push(err);
|
|
134
136
|
}
|
|
135
|
-
else if (process.platform === "android")
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
137
|
+
else if (process.platform === "android") {
|
|
138
|
+
if (process.arch === "arm64") {
|
|
139
|
+
try {
|
|
140
|
+
return __require("./rolldown-binding.android-arm64.node");
|
|
141
|
+
} catch (e) {
|
|
142
|
+
loadErrors.push(e);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const binding = __require("@rolldown/binding-android-arm64");
|
|
146
|
+
const bindingPackageVersion = __require("@rolldown/binding-android-arm64/package.json").version;
|
|
147
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
148
|
+
return binding;
|
|
149
|
+
} catch (e) {
|
|
150
|
+
loadErrors.push(e);
|
|
151
|
+
}
|
|
152
|
+
} else if (process.arch === "arm") {
|
|
153
|
+
try {
|
|
154
|
+
return __require("./rolldown-binding.android-arm-eabi.node");
|
|
155
|
+
} catch (e) {
|
|
156
|
+
loadErrors.push(e);
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const binding = __require("@rolldown/binding-android-arm-eabi");
|
|
160
|
+
const bindingPackageVersion = __require("@rolldown/binding-android-arm-eabi/package.json").version;
|
|
161
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
162
|
+
return binding;
|
|
163
|
+
} catch (e) {
|
|
164
|
+
loadErrors.push(e);
|
|
165
|
+
}
|
|
166
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Android ${process.arch}`));
|
|
167
|
+
} else if (process.platform === "win32") {
|
|
168
|
+
if (process.arch === "x64") {
|
|
169
|
+
if (process.config && process.config.variables && process.config.variables.shlib_suffix === "dll.a" || process.config && process.config.variables && process.config.variables.node_target_type === "shared_library") {
|
|
170
|
+
try {
|
|
171
|
+
return __require("./rolldown-binding.win32-x64-gnu.node");
|
|
172
|
+
} catch (e) {
|
|
173
|
+
loadErrors.push(e);
|
|
174
|
+
}
|
|
175
|
+
try {
|
|
176
|
+
const binding = __require("@rolldown/binding-win32-x64-gnu");
|
|
177
|
+
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-gnu/package.json").version;
|
|
178
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
179
|
+
return binding;
|
|
180
|
+
} catch (e) {
|
|
181
|
+
loadErrors.push(e);
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
try {
|
|
185
|
+
return __require("./rolldown-binding.win32-x64-msvc.node");
|
|
186
|
+
} catch (e) {
|
|
187
|
+
loadErrors.push(e);
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
const binding = __require("@rolldown/binding-win32-x64-msvc");
|
|
191
|
+
const bindingPackageVersion = __require("@rolldown/binding-win32-x64-msvc/package.json").version;
|
|
192
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
193
|
+
return binding;
|
|
194
|
+
} catch (e) {
|
|
195
|
+
loadErrors.push(e);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} else if (process.arch === "ia32") {
|
|
199
|
+
try {
|
|
200
|
+
return __require("./rolldown-binding.win32-ia32-msvc.node");
|
|
201
|
+
} catch (e) {
|
|
202
|
+
loadErrors.push(e);
|
|
203
|
+
}
|
|
204
|
+
try {
|
|
205
|
+
const binding = __require("@rolldown/binding-win32-ia32-msvc");
|
|
206
|
+
const bindingPackageVersion = __require("@rolldown/binding-win32-ia32-msvc/package.json").version;
|
|
207
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
208
|
+
return binding;
|
|
209
|
+
} catch (e) {
|
|
210
|
+
loadErrors.push(e);
|
|
211
|
+
}
|
|
212
|
+
} else if (process.arch === "arm64") {
|
|
213
|
+
try {
|
|
214
|
+
return __require("./rolldown-binding.win32-arm64-msvc.node");
|
|
215
|
+
} catch (e) {
|
|
216
|
+
loadErrors.push(e);
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
const binding = __require("@rolldown/binding-win32-arm64-msvc");
|
|
220
|
+
const bindingPackageVersion = __require("@rolldown/binding-win32-arm64-msvc/package.json").version;
|
|
221
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
222
|
+
return binding;
|
|
223
|
+
} catch (e) {
|
|
224
|
+
loadErrors.push(e);
|
|
225
|
+
}
|
|
226
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Windows: ${process.arch}`));
|
|
227
|
+
} else if (process.platform === "darwin") {
|
|
223
228
|
try {
|
|
224
229
|
return __require("./rolldown-binding.darwin-universal.node");
|
|
225
230
|
} catch (e) {
|
|
@@ -228,7 +233,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
228
233
|
try {
|
|
229
234
|
const binding = __require("@rolldown/binding-darwin-universal");
|
|
230
235
|
const bindingPackageVersion = __require("@rolldown/binding-darwin-universal/package.json").version;
|
|
231
|
-
if (bindingPackageVersion !== "1.
|
|
236
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
232
237
|
return binding;
|
|
233
238
|
} catch (e) {
|
|
234
239
|
loadErrors.push(e);
|
|
@@ -242,7 +247,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
242
247
|
try {
|
|
243
248
|
const binding = __require("@rolldown/binding-darwin-x64");
|
|
244
249
|
const bindingPackageVersion = __require("@rolldown/binding-darwin-x64/package.json").version;
|
|
245
|
-
if (bindingPackageVersion !== "1.
|
|
250
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
246
251
|
return binding;
|
|
247
252
|
} catch (e) {
|
|
248
253
|
loadErrors.push(e);
|
|
@@ -256,284 +261,369 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
256
261
|
try {
|
|
257
262
|
const binding = __require("@rolldown/binding-darwin-arm64");
|
|
258
263
|
const bindingPackageVersion = __require("@rolldown/binding-darwin-arm64/package.json").version;
|
|
259
|
-
if (bindingPackageVersion !== "1.
|
|
264
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
260
265
|
return binding;
|
|
261
266
|
} catch (e) {
|
|
262
267
|
loadErrors.push(e);
|
|
263
268
|
}
|
|
264
269
|
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on macOS: ${process.arch}`));
|
|
265
|
-
} else if (process.platform === "freebsd")
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
270
|
+
} else if (process.platform === "freebsd") {
|
|
271
|
+
if (process.arch === "x64") {
|
|
272
|
+
try {
|
|
273
|
+
return __require("./rolldown-binding.freebsd-x64.node");
|
|
274
|
+
} catch (e) {
|
|
275
|
+
loadErrors.push(e);
|
|
276
|
+
}
|
|
277
|
+
try {
|
|
278
|
+
const binding = __require("@rolldown/binding-freebsd-x64");
|
|
279
|
+
const bindingPackageVersion = __require("@rolldown/binding-freebsd-x64/package.json").version;
|
|
280
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
281
|
+
return binding;
|
|
282
|
+
} catch (e) {
|
|
283
|
+
loadErrors.push(e);
|
|
284
|
+
}
|
|
285
|
+
} else if (process.arch === "arm64") {
|
|
286
|
+
try {
|
|
287
|
+
return __require("./rolldown-binding.freebsd-arm64.node");
|
|
288
|
+
} catch (e) {
|
|
289
|
+
loadErrors.push(e);
|
|
290
|
+
}
|
|
291
|
+
try {
|
|
292
|
+
const binding = __require("@rolldown/binding-freebsd-arm64");
|
|
293
|
+
const bindingPackageVersion = __require("@rolldown/binding-freebsd-arm64/package.json").version;
|
|
294
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
295
|
+
return binding;
|
|
296
|
+
} catch (e) {
|
|
297
|
+
loadErrors.push(e);
|
|
298
|
+
}
|
|
299
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
|
|
300
|
+
} else if (process.platform === "linux") {
|
|
301
|
+
if (process.arch === "x64") {
|
|
302
|
+
if (isMusl()) {
|
|
303
|
+
try {
|
|
304
|
+
return __require("./rolldown-binding.linux-x64-musl.node");
|
|
305
|
+
} catch (e) {
|
|
306
|
+
loadErrors.push(e);
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
const binding = __require("@rolldown/binding-linux-x64-musl");
|
|
310
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-musl/package.json").version;
|
|
311
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
312
|
+
return binding;
|
|
313
|
+
} catch (e) {
|
|
314
|
+
loadErrors.push(e);
|
|
315
|
+
}
|
|
316
|
+
} else {
|
|
317
|
+
try {
|
|
318
|
+
return __require("../rolldown-binding.linux-x64-gnu.node");
|
|
319
|
+
} catch (e) {
|
|
320
|
+
loadErrors.push(e);
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
const binding = __require("@rolldown/binding-linux-x64-gnu");
|
|
324
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-x64-gnu/package.json").version;
|
|
325
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
326
|
+
return binding;
|
|
327
|
+
} catch (e) {
|
|
328
|
+
loadErrors.push(e);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
} else if (process.arch === "arm64") {
|
|
332
|
+
if (isMusl()) {
|
|
333
|
+
try {
|
|
334
|
+
return __require("./rolldown-binding.linux-arm64-musl.node");
|
|
335
|
+
} catch (e) {
|
|
336
|
+
loadErrors.push(e);
|
|
337
|
+
}
|
|
338
|
+
try {
|
|
339
|
+
const binding = __require("@rolldown/binding-linux-arm64-musl");
|
|
340
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-musl/package.json").version;
|
|
341
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
342
|
+
return binding;
|
|
343
|
+
} catch (e) {
|
|
344
|
+
loadErrors.push(e);
|
|
345
|
+
}
|
|
346
|
+
} else {
|
|
347
|
+
try {
|
|
348
|
+
return __require("./rolldown-binding.linux-arm64-gnu.node");
|
|
349
|
+
} catch (e) {
|
|
350
|
+
loadErrors.push(e);
|
|
351
|
+
}
|
|
352
|
+
try {
|
|
353
|
+
const binding = __require("@rolldown/binding-linux-arm64-gnu");
|
|
354
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm64-gnu/package.json").version;
|
|
355
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
356
|
+
return binding;
|
|
357
|
+
} catch (e) {
|
|
358
|
+
loadErrors.push(e);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
} else if (process.arch === "arm") {
|
|
362
|
+
if (isMusl()) {
|
|
363
|
+
try {
|
|
364
|
+
return __require("./rolldown-binding.linux-arm-musleabihf.node");
|
|
365
|
+
} catch (e) {
|
|
366
|
+
loadErrors.push(e);
|
|
367
|
+
}
|
|
368
|
+
try {
|
|
369
|
+
const binding = __require("@rolldown/binding-linux-arm-musleabihf");
|
|
370
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-musleabihf/package.json").version;
|
|
371
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
372
|
+
return binding;
|
|
373
|
+
} catch (e) {
|
|
374
|
+
loadErrors.push(e);
|
|
375
|
+
}
|
|
376
|
+
} else {
|
|
377
|
+
try {
|
|
378
|
+
return __require("./rolldown-binding.linux-arm-gnueabihf.node");
|
|
379
|
+
} catch (e) {
|
|
380
|
+
loadErrors.push(e);
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
const binding = __require("@rolldown/binding-linux-arm-gnueabihf");
|
|
384
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-arm-gnueabihf/package.json").version;
|
|
385
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
386
|
+
return binding;
|
|
387
|
+
} catch (e) {
|
|
388
|
+
loadErrors.push(e);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
} else if (process.arch === "loong64") {
|
|
392
|
+
if (isMusl()) {
|
|
393
|
+
try {
|
|
394
|
+
return __require("./rolldown-binding.linux-loong64-musl.node");
|
|
395
|
+
} catch (e) {
|
|
396
|
+
loadErrors.push(e);
|
|
397
|
+
}
|
|
398
|
+
try {
|
|
399
|
+
const binding = __require("@rolldown/binding-linux-loong64-musl");
|
|
400
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-musl/package.json").version;
|
|
401
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
402
|
+
return binding;
|
|
403
|
+
} catch (e) {
|
|
404
|
+
loadErrors.push(e);
|
|
405
|
+
}
|
|
406
|
+
} else {
|
|
407
|
+
try {
|
|
408
|
+
return __require("./rolldown-binding.linux-loong64-gnu.node");
|
|
409
|
+
} catch (e) {
|
|
410
|
+
loadErrors.push(e);
|
|
411
|
+
}
|
|
412
|
+
try {
|
|
413
|
+
const binding = __require("@rolldown/binding-linux-loong64-gnu");
|
|
414
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-loong64-gnu/package.json").version;
|
|
415
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
416
|
+
return binding;
|
|
417
|
+
} catch (e) {
|
|
418
|
+
loadErrors.push(e);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
} else if (process.arch === "riscv64") {
|
|
422
|
+
if (isMusl()) {
|
|
423
|
+
try {
|
|
424
|
+
return __require("./rolldown-binding.linux-riscv64-musl.node");
|
|
425
|
+
} catch (e) {
|
|
426
|
+
loadErrors.push(e);
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
const binding = __require("@rolldown/binding-linux-riscv64-musl");
|
|
430
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-musl/package.json").version;
|
|
431
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
432
|
+
return binding;
|
|
433
|
+
} catch (e) {
|
|
434
|
+
loadErrors.push(e);
|
|
435
|
+
}
|
|
436
|
+
} else {
|
|
437
|
+
try {
|
|
438
|
+
return __require("./rolldown-binding.linux-riscv64-gnu.node");
|
|
439
|
+
} catch (e) {
|
|
440
|
+
loadErrors.push(e);
|
|
441
|
+
}
|
|
442
|
+
try {
|
|
443
|
+
const binding = __require("@rolldown/binding-linux-riscv64-gnu");
|
|
444
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-riscv64-gnu/package.json").version;
|
|
445
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
446
|
+
return binding;
|
|
447
|
+
} catch (e) {
|
|
448
|
+
loadErrors.push(e);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
} else if (process.arch === "ppc64") {
|
|
452
|
+
try {
|
|
453
|
+
return __require("./rolldown-binding.linux-ppc64-gnu.node");
|
|
454
|
+
} catch (e) {
|
|
455
|
+
loadErrors.push(e);
|
|
456
|
+
}
|
|
457
|
+
try {
|
|
458
|
+
const binding = __require("@rolldown/binding-linux-ppc64-gnu");
|
|
459
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-ppc64-gnu/package.json").version;
|
|
460
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
461
|
+
return binding;
|
|
462
|
+
} catch (e) {
|
|
463
|
+
loadErrors.push(e);
|
|
464
|
+
}
|
|
465
|
+
} else if (process.arch === "s390x") {
|
|
466
|
+
try {
|
|
467
|
+
return __require("./rolldown-binding.linux-s390x-gnu.node");
|
|
468
|
+
} catch (e) {
|
|
469
|
+
loadErrors.push(e);
|
|
470
|
+
}
|
|
471
|
+
try {
|
|
472
|
+
const binding = __require("@rolldown/binding-linux-s390x-gnu");
|
|
473
|
+
const bindingPackageVersion = __require("@rolldown/binding-linux-s390x-gnu/package.json").version;
|
|
474
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
475
|
+
return binding;
|
|
476
|
+
} catch (e) {
|
|
477
|
+
loadErrors.push(e);
|
|
478
|
+
}
|
|
479
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on Linux: ${process.arch}`));
|
|
480
|
+
} else if (process.platform === "openharmony") {
|
|
481
|
+
if (process.arch === "arm64") {
|
|
482
|
+
try {
|
|
483
|
+
return __require("./rolldown-binding.openharmony-arm64.node");
|
|
484
|
+
} catch (e) {
|
|
485
|
+
loadErrors.push(e);
|
|
486
|
+
}
|
|
487
|
+
try {
|
|
488
|
+
const binding = __require("@rolldown/binding-openharmony-arm64");
|
|
489
|
+
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm64/package.json").version;
|
|
490
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
491
|
+
return binding;
|
|
492
|
+
} catch (e) {
|
|
493
|
+
loadErrors.push(e);
|
|
494
|
+
}
|
|
495
|
+
} else if (process.arch === "x64") {
|
|
496
|
+
try {
|
|
497
|
+
return __require("./rolldown-binding.openharmony-x64.node");
|
|
498
|
+
} catch (e) {
|
|
499
|
+
loadErrors.push(e);
|
|
500
|
+
}
|
|
501
|
+
try {
|
|
502
|
+
const binding = __require("@rolldown/binding-openharmony-x64");
|
|
503
|
+
const bindingPackageVersion = __require("@rolldown/binding-openharmony-x64/package.json").version;
|
|
504
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
505
|
+
return binding;
|
|
506
|
+
} catch (e) {
|
|
507
|
+
loadErrors.push(e);
|
|
508
|
+
}
|
|
509
|
+
} else if (process.arch === "arm") {
|
|
510
|
+
try {
|
|
511
|
+
return __require("./rolldown-binding.openharmony-arm.node");
|
|
512
|
+
} catch (e) {
|
|
513
|
+
loadErrors.push(e);
|
|
514
|
+
}
|
|
515
|
+
try {
|
|
516
|
+
const binding = __require("@rolldown/binding-openharmony-arm");
|
|
517
|
+
const bindingPackageVersion = __require("@rolldown/binding-openharmony-arm/package.json").version;
|
|
518
|
+
if (bindingPackageVersion !== "1.2.8" && 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.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
519
|
+
return binding;
|
|
520
|
+
} catch (e) {
|
|
521
|
+
loadErrors.push(e);
|
|
522
|
+
}
|
|
523
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
524
|
+
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
525
|
+
}
|
|
526
|
+
function createLoadErrorChain(errors) {
|
|
527
|
+
return errors.reduce((previous, current) => {
|
|
528
|
+
let message;
|
|
483
529
|
try {
|
|
484
|
-
|
|
485
|
-
} catch
|
|
486
|
-
|
|
530
|
+
message = current && typeof current.message === "string" ? current.message : String(current);
|
|
531
|
+
} catch {
|
|
532
|
+
message = "Unknown error";
|
|
487
533
|
}
|
|
534
|
+
const error = new Error(message);
|
|
535
|
+
error.cause = previous;
|
|
536
|
+
return error;
|
|
537
|
+
}, null);
|
|
538
|
+
}
|
|
539
|
+
const __napiWasiFlavors = ["wasm32-wasi"];
|
|
540
|
+
const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR;
|
|
541
|
+
const __napiWasiFlavorRequested = typeof __napiWasiFlavor === "string" && __napiWasiFlavor.length > 0;
|
|
542
|
+
if (__napiWasiFlavorRequested && __napiWasiFlavors.indexOf(__napiWasiFlavor) === -1) throw new Error("Unsupported WASI flavor \"" + __napiWasiFlavor + "\". Available flavors: " + __napiWasiFlavors.join(", "));
|
|
543
|
+
const forceWasiError = process.env.NAPI_RS_FORCE_WASI === "error";
|
|
544
|
+
const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || forceWasiError || __napiWasiFlavorRequested;
|
|
545
|
+
if (!forceWasi) nativeBinding = requireNative();
|
|
546
|
+
if (!nativeBinding || forceWasi) {
|
|
547
|
+
let wasiBinding = null;
|
|
548
|
+
let wasiBindingLoaded = false;
|
|
549
|
+
const wasiBindingErrors = [];
|
|
550
|
+
const __napiWasiResolveCandidate = (specifier, isPackage, localArtifacts) => {
|
|
488
551
|
try {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if (
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
552
|
+
__require.resolve(specifier);
|
|
553
|
+
} catch (resolveError) {
|
|
554
|
+
if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
|
|
555
|
+
if (isPackage) {
|
|
556
|
+
try {
|
|
557
|
+
__require.resolve(specifier + "/package.json");
|
|
558
|
+
} catch (packageError) {
|
|
559
|
+
if (packageError && packageError.code === "MODULE_NOT_FOUND") return resolveError;
|
|
560
|
+
throw resolveError;
|
|
561
|
+
}
|
|
562
|
+
throw resolveError;
|
|
563
|
+
}
|
|
564
|
+
return resolveError;
|
|
495
565
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
566
|
+
if (localArtifacts) {
|
|
567
|
+
let artifactError = null;
|
|
568
|
+
for (let i = 0; i < localArtifacts.length; i++) try {
|
|
569
|
+
__require.resolve(localArtifacts[i]);
|
|
570
|
+
return null;
|
|
571
|
+
} catch (resolveError) {
|
|
572
|
+
if (!resolveError || resolveError.code !== "MODULE_NOT_FOUND") throw resolveError;
|
|
573
|
+
artifactError = resolveError;
|
|
574
|
+
}
|
|
575
|
+
return artifactError;
|
|
501
576
|
}
|
|
577
|
+
return null;
|
|
578
|
+
};
|
|
579
|
+
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
|
|
580
|
+
let candidateError = null;
|
|
581
|
+
let candidateFailed = false;
|
|
502
582
|
try {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
if (
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
583
|
+
candidateError = __napiWasiResolveCandidate("./rolldown-binding.wasi.cjs", false, ["./rolldown-binding.wasm32-wasi.debug.wasm", "./rolldown-binding.wasm32-wasi.wasm"]);
|
|
584
|
+
candidateFailed = candidateError !== null;
|
|
585
|
+
if (!candidateFailed) {
|
|
586
|
+
wasiBinding = __require("../rolldown-binding.wasi.cjs");
|
|
587
|
+
nativeBinding = wasiBinding;
|
|
588
|
+
wasiBindingLoaded = true;
|
|
589
|
+
}
|
|
590
|
+
} catch (err) {
|
|
591
|
+
candidateError = err;
|
|
592
|
+
candidateFailed = true;
|
|
593
|
+
}
|
|
594
|
+
if (candidateFailed) {
|
|
595
|
+
wasiBindingErrors.push(candidateError);
|
|
596
|
+
loadErrors.push(candidateError);
|
|
509
597
|
}
|
|
510
|
-
} else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
|
|
511
|
-
else loadErrors.push(/* @__PURE__ */ new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`));
|
|
512
|
-
}
|
|
513
|
-
nativeBinding = requireNative();
|
|
514
|
-
const forceWasi = process.env.NAPI_RS_FORCE_WASI === "true" || process.env.NAPI_RS_FORCE_WASI === "error";
|
|
515
|
-
if (!nativeBinding || forceWasi) {
|
|
516
|
-
let wasiBinding = null;
|
|
517
|
-
let wasiBindingError = null;
|
|
518
|
-
try {
|
|
519
|
-
wasiBinding = __require("../rolldown-binding.wasi.cjs");
|
|
520
|
-
nativeBinding = wasiBinding;
|
|
521
|
-
} catch (err) {
|
|
522
|
-
if (forceWasi) wasiBindingError = err;
|
|
523
598
|
}
|
|
524
|
-
if (!
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
599
|
+
if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
|
|
600
|
+
let candidateError = null;
|
|
601
|
+
let candidateFailed = false;
|
|
602
|
+
try {
|
|
603
|
+
candidateError = __napiWasiResolveCandidate("@rolldown/binding-wasm32-wasi", true, void 0);
|
|
604
|
+
candidateFailed = candidateError !== null;
|
|
605
|
+
if (!candidateFailed) {
|
|
606
|
+
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0") {
|
|
607
|
+
const bindingPackageVersion = __require("@rolldown/binding-wasm32-wasi/package.json").version;
|
|
608
|
+
if (bindingPackageVersion !== "1.2.8") throw new Error(`WASI binding package version mismatch, expected 1.2.8 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
609
|
+
}
|
|
610
|
+
wasiBinding = __require("@rolldown/binding-wasm32-wasi");
|
|
611
|
+
nativeBinding = wasiBinding;
|
|
612
|
+
wasiBindingLoaded = true;
|
|
613
|
+
}
|
|
614
|
+
} catch (err) {
|
|
615
|
+
candidateError = err;
|
|
616
|
+
candidateFailed = true;
|
|
617
|
+
}
|
|
618
|
+
if (candidateFailed) {
|
|
619
|
+
wasiBindingErrors.push(candidateError);
|
|
620
|
+
loadErrors.push(candidateError);
|
|
532
621
|
}
|
|
533
622
|
}
|
|
534
|
-
if (
|
|
535
|
-
|
|
536
|
-
error
|
|
623
|
+
if (!wasiBindingLoaded && forceWasi && !forceWasiError && !__napiWasiFlavorRequested) nativeBinding = requireNative();
|
|
624
|
+
if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
|
|
625
|
+
const error = /* @__PURE__ */ new Error(__napiWasiFlavorRequested ? "WASI binding for flavor \"" + __napiWasiFlavor + "\" not found" : "WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
|
|
626
|
+
error.cause = createLoadErrorChain(wasiBindingErrors);
|
|
537
627
|
throw error;
|
|
538
628
|
}
|
|
539
629
|
}
|
|
@@ -545,10 +635,7 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
545
635
|
if (!nativeBinding) {
|
|
546
636
|
if (loadErrors.length > 0) {
|
|
547
637
|
const error = /* @__PURE__ */ 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.");
|
|
548
|
-
error.cause = loadErrors
|
|
549
|
-
cur.cause = err;
|
|
550
|
-
return cur;
|
|
551
|
-
});
|
|
638
|
+
error.cause = createLoadErrorChain(loadErrors);
|
|
552
639
|
throw error;
|
|
553
640
|
}
|
|
554
641
|
throw new Error(`Failed to load native binding`);
|
|
@@ -601,7 +688,6 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
601
688
|
module.exports.BindingWatcherChangeData = nativeBinding.BindingWatcherChangeData;
|
|
602
689
|
module.exports.BindingWatcherEvent = nativeBinding.BindingWatcherEvent;
|
|
603
690
|
module.exports.ParallelJsPluginRegistry = nativeBinding.ParallelJsPluginRegistry;
|
|
604
|
-
module.exports.ScheduledBuild = nativeBinding.ScheduledBuild;
|
|
605
691
|
module.exports.TraceSubscriberGuard = nativeBinding.TraceSubscriberGuard;
|
|
606
692
|
module.exports.TsconfigCache = nativeBinding.TsconfigCache;
|
|
607
693
|
module.exports.BindingAttachDebugInfo = nativeBinding.BindingAttachDebugInfo;
|
|
@@ -617,14 +703,16 @@ var require_binding = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
617
703
|
module.exports.enhancedTransform = nativeBinding.enhancedTransform;
|
|
618
704
|
module.exports.enhancedTransformSync = nativeBinding.enhancedTransformSync;
|
|
619
705
|
module.exports.FilterTokenKind = nativeBinding.FilterTokenKind;
|
|
706
|
+
module.exports.getNativeMemoryStats = nativeBinding.getNativeMemoryStats;
|
|
620
707
|
module.exports.initTraceSubscriber = nativeBinding.initTraceSubscriber;
|
|
621
708
|
module.exports.registerPlugins = nativeBinding.registerPlugins;
|
|
709
|
+
module.exports.resetNativeMemoryStats = nativeBinding.resetNativeMemoryStats;
|
|
622
710
|
module.exports.resolveTsconfig = nativeBinding.resolveTsconfig;
|
|
623
711
|
module.exports.shutdownAsyncRuntime = nativeBinding.shutdownAsyncRuntime;
|
|
624
712
|
module.exports.startAsyncRuntime = nativeBinding.startAsyncRuntime;
|
|
625
713
|
}));
|
|
626
714
|
//#endregion
|
|
627
|
-
//#region ../../node_modules/rolldown/dist/shared/logs-
|
|
715
|
+
//#region ../../node_modules/rolldown/dist/shared/logs-DmYCAKcW.mjs
|
|
628
716
|
function spaces(index) {
|
|
629
717
|
let result = "";
|
|
630
718
|
while (index--) result += " ";
|
|
@@ -719,7 +807,12 @@ function getLocator(source, options = {}) {
|
|
|
719
807
|
function locate(source, search, options) {
|
|
720
808
|
return getLocator(source, options)(search, options && options.startIndex);
|
|
721
809
|
}
|
|
722
|
-
var INVALID_LOG_POSITION = "INVALID_LOG_POSITION"
|
|
810
|
+
var INVALID_LOG_POSITION = "INVALID_LOG_POSITION";
|
|
811
|
+
var PLUGIN_ERROR = "PLUGIN_ERROR";
|
|
812
|
+
var INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN";
|
|
813
|
+
var CYCLE_LOADING = "CYCLE_LOADING";
|
|
814
|
+
var PARSE_ERROR = "PARSE_ERROR";
|
|
815
|
+
var VALIDATION_ERROR = "VALIDATION_ERROR";
|
|
723
816
|
function logParseError(message, id, pos) {
|
|
724
817
|
return {
|
|
725
818
|
code: PARSE_ERROR,
|
|
@@ -728,6 +821,12 @@ function logParseError(message, id, pos) {
|
|
|
728
821
|
pos
|
|
729
822
|
};
|
|
730
823
|
}
|
|
824
|
+
function logFailedValidation(message) {
|
|
825
|
+
return {
|
|
826
|
+
code: VALIDATION_ERROR,
|
|
827
|
+
message
|
|
828
|
+
};
|
|
829
|
+
}
|
|
731
830
|
function logInvalidLogPosition(pluginName) {
|
|
732
831
|
return {
|
|
733
832
|
code: INVALID_LOG_POSITION,
|
|
@@ -830,7 +929,7 @@ function isReadonlyArray(input) {
|
|
|
830
929
|
return Array.isArray(input);
|
|
831
930
|
}
|
|
832
931
|
//#endregion
|
|
833
|
-
//#region ../../node_modules/rolldown/dist/shared/misc-
|
|
932
|
+
//#region ../../node_modules/rolldown/dist/shared/misc-DOSKtd97.mjs
|
|
834
933
|
function arraify(value) {
|
|
835
934
|
return Array.isArray(value) ? value : [value];
|
|
836
935
|
}
|
|
@@ -846,8 +945,16 @@ function unsupported(info) {
|
|
|
846
945
|
throw new Error(`UNSUPPORTED: ${info}`);
|
|
847
946
|
}
|
|
848
947
|
function noop(..._args) {}
|
|
948
|
+
var ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
|
|
949
|
+
/**
|
|
950
|
+
* Whether `name` is a path fragment — an absolute or relative path. Emitted file
|
|
951
|
+
* names, `[name]` substitutions and file-name patterns can be neither.
|
|
952
|
+
*/
|
|
953
|
+
function isPathFragment(name) {
|
|
954
|
+
return name[0] === "/" || name[0] === "." && (name[1] === "/" || name[1] === ".") || ABSOLUTE_PATH_REGEX.test(name);
|
|
955
|
+
}
|
|
849
956
|
//#endregion
|
|
850
|
-
//#region ../../node_modules/rolldown/dist/shared/error-
|
|
957
|
+
//#region ../../node_modules/rolldown/dist/shared/error-CRNyaqoL.mjs
|
|
851
958
|
function bindingifySourcemap$1(map) {
|
|
852
959
|
if (map == null) return;
|
|
853
960
|
return { inner: typeof map === "string" ? map : {
|
|
@@ -926,8 +1033,8 @@ function joinNewLine(s1, s2) {
|
|
|
926
1033
|
return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
|
|
927
1034
|
}
|
|
928
1035
|
//#endregion
|
|
929
|
-
//#region ../../node_modules/rolldown/dist/shared/parse-
|
|
930
|
-
var import_binding$
|
|
1036
|
+
//#region ../../node_modules/rolldown/dist/shared/parse-BtiCBYra.mjs
|
|
1037
|
+
var import_binding$5 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
931
1038
|
function wrap$1(result) {
|
|
932
1039
|
let program, module, comments, errors;
|
|
933
1040
|
return {
|
|
@@ -975,7 +1082,7 @@ function applyFix(program, fixPath) {
|
|
|
975
1082
|
* @category Utilities
|
|
976
1083
|
*/
|
|
977
1084
|
function parseSync(filename, sourceText, options) {
|
|
978
|
-
return wrap$1((0, import_binding$
|
|
1085
|
+
return wrap$1((0, import_binding$5.parseSync)(filename, sourceText, options));
|
|
979
1086
|
}
|
|
980
1087
|
//#endregion
|
|
981
1088
|
//#region ../../node_modules/rolldown/dist/parse-ast-index.mjs
|
|
@@ -1109,7 +1216,7 @@ function exclude(expr) {
|
|
|
1109
1216
|
*
|
|
1110
1217
|
* @category Plugin APIs
|
|
1111
1218
|
*/
|
|
1112
|
-
var VERSION = "1.
|
|
1219
|
+
var VERSION = "1.2.8";
|
|
1113
1220
|
var LOG_LEVEL_SILENT = "silent";
|
|
1114
1221
|
var LOG_LEVEL_WARN = "warn";
|
|
1115
1222
|
var LOG_LEVEL_INFO = "info";
|
|
@@ -1148,6 +1255,24 @@ function normalizeHook(hook) {
|
|
|
1148
1255
|
}
|
|
1149
1256
|
unreachable("Invalid hook type");
|
|
1150
1257
|
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Returns the `_parallel` marker of a parallel plugin, or `undefined` if the
|
|
1260
|
+
* given plugin is not one.
|
|
1261
|
+
*
|
|
1262
|
+
* Detection is descriptor-based instead of using the `in` operator: only an
|
|
1263
|
+
* own data property named `_parallel` with the expected shape counts. This
|
|
1264
|
+
* avoids false positives from inherited or accessor `_parallel` properties on
|
|
1265
|
+
* regular plugins, and guarantees that callers can safely read `fileUrl` and
|
|
1266
|
+
* `options` from the returned value.
|
|
1267
|
+
*/
|
|
1268
|
+
function getParallelPluginInfo(plugin) {
|
|
1269
|
+
if (plugin === null || typeof plugin !== "object") return;
|
|
1270
|
+
const descriptor = Object.getOwnPropertyDescriptor(plugin, "_parallel");
|
|
1271
|
+
if (!descriptor || !("value" in descriptor)) return;
|
|
1272
|
+
const parallel = descriptor.value;
|
|
1273
|
+
if (parallel === null || typeof parallel !== "object" || typeof parallel.fileUrl !== "string") return;
|
|
1274
|
+
return parallel;
|
|
1275
|
+
}
|
|
1151
1276
|
var MinimalPluginContextImpl = class {
|
|
1152
1277
|
pluginName;
|
|
1153
1278
|
hookName;
|
|
@@ -1171,7 +1296,7 @@ var MinimalPluginContextImpl = class {
|
|
|
1171
1296
|
return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
|
|
1172
1297
|
}
|
|
1173
1298
|
};
|
|
1174
|
-
var import_binding$
|
|
1299
|
+
var import_binding$4 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
1175
1300
|
var LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
|
|
1176
1301
|
/**
|
|
1177
1302
|
* Base class for classes that use `@lazyProp` decorated properties.
|
|
@@ -1562,7 +1687,9 @@ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
|
|
|
1562
1687
|
}
|
|
1563
1688
|
function transformToRollupOutput(output) {
|
|
1564
1689
|
const { chunks, assets } = output;
|
|
1565
|
-
|
|
1690
|
+
const transformed = { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
|
|
1691
|
+
if (output.mangleCache !== void 0) transformed.mangleCache = output.mangleCache;
|
|
1692
|
+
return transformed;
|
|
1566
1693
|
}
|
|
1567
1694
|
function transformToMutableRollupOutput(output, changed) {
|
|
1568
1695
|
const { chunks, assets } = output;
|
|
@@ -1687,6 +1814,9 @@ var NormalizedOutputOptionsImpl = class extends PlainObjectLike {
|
|
|
1687
1814
|
get sourcemap() {
|
|
1688
1815
|
return this.inner.sourcemap;
|
|
1689
1816
|
}
|
|
1817
|
+
get sourcemapFileNames() {
|
|
1818
|
+
return this.inner.sourcemapFilenames || this.outputOptions.sourcemapFileNames;
|
|
1819
|
+
}
|
|
1690
1820
|
get sourcemapBaseUrl() {
|
|
1691
1821
|
return this.inner.sourcemapBaseUrl ?? void 0;
|
|
1692
1822
|
}
|
|
@@ -1808,6 +1938,7 @@ __decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "assetFileNames",
|
|
|
1808
1938
|
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "format", null);
|
|
1809
1939
|
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "exports", null);
|
|
1810
1940
|
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemap", null);
|
|
1941
|
+
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapFileNames", null);
|
|
1811
1942
|
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "sourcemapBaseUrl", null);
|
|
1812
1943
|
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "shimMissingExports", null);
|
|
1813
1944
|
__decorate([lazyProp], NormalizedOutputOptionsImpl.prototype, "name", null);
|
|
@@ -1963,7 +2094,7 @@ var PluginContextData = class {
|
|
|
1963
2094
|
this.loadModulePromiseMap.clear();
|
|
1964
2095
|
}
|
|
1965
2096
|
};
|
|
1966
|
-
Object.defineProperty(import_binding$
|
|
2097
|
+
Object.defineProperty(import_binding$4.BindingMagicString.prototype, "isRolldownMagicString", {
|
|
1967
2098
|
value: true,
|
|
1968
2099
|
writable: false,
|
|
1969
2100
|
configurable: false
|
|
@@ -1971,49 +2102,49 @@ Object.defineProperty(import_binding$3.BindingMagicString.prototype, "isRolldown
|
|
|
1971
2102
|
function assertString(content, msg) {
|
|
1972
2103
|
if (typeof content !== "string") throw new TypeError(msg);
|
|
1973
2104
|
}
|
|
1974
|
-
var nativeAppend = import_binding$
|
|
1975
|
-
var nativePrepend = import_binding$
|
|
1976
|
-
var nativeAppendLeft = import_binding$
|
|
1977
|
-
var nativeAppendRight = import_binding$
|
|
1978
|
-
var nativePrependLeft = import_binding$
|
|
1979
|
-
var nativePrependRight = import_binding$
|
|
1980
|
-
var nativeOverwrite = import_binding$
|
|
1981
|
-
var nativeUpdate = import_binding$
|
|
1982
|
-
import_binding$
|
|
2105
|
+
var nativeAppend = import_binding$4.BindingMagicString.prototype.append;
|
|
2106
|
+
var nativePrepend = import_binding$4.BindingMagicString.prototype.prepend;
|
|
2107
|
+
var nativeAppendLeft = import_binding$4.BindingMagicString.prototype.appendLeft;
|
|
2108
|
+
var nativeAppendRight = import_binding$4.BindingMagicString.prototype.appendRight;
|
|
2109
|
+
var nativePrependLeft = import_binding$4.BindingMagicString.prototype.prependLeft;
|
|
2110
|
+
var nativePrependRight = import_binding$4.BindingMagicString.prototype.prependRight;
|
|
2111
|
+
var nativeOverwrite = import_binding$4.BindingMagicString.prototype.overwrite;
|
|
2112
|
+
var nativeUpdate = import_binding$4.BindingMagicString.prototype.update;
|
|
2113
|
+
import_binding$4.BindingMagicString.prototype.append = function(content) {
|
|
1983
2114
|
assertString(content, "outro content must be a string");
|
|
1984
2115
|
return nativeAppend.call(this, content);
|
|
1985
2116
|
};
|
|
1986
|
-
import_binding$
|
|
2117
|
+
import_binding$4.BindingMagicString.prototype.prepend = function(content) {
|
|
1987
2118
|
assertString(content, "outro content must be a string");
|
|
1988
2119
|
return nativePrepend.call(this, content);
|
|
1989
2120
|
};
|
|
1990
|
-
import_binding$
|
|
2121
|
+
import_binding$4.BindingMagicString.prototype.appendLeft = function(index, content) {
|
|
1991
2122
|
assertString(content, "inserted content must be a string");
|
|
1992
2123
|
return nativeAppendLeft.call(this, index, content);
|
|
1993
2124
|
};
|
|
1994
|
-
import_binding$
|
|
2125
|
+
import_binding$4.BindingMagicString.prototype.appendRight = function(index, content) {
|
|
1995
2126
|
assertString(content, "inserted content must be a string");
|
|
1996
2127
|
return nativeAppendRight.call(this, index, content);
|
|
1997
2128
|
};
|
|
1998
|
-
import_binding$
|
|
2129
|
+
import_binding$4.BindingMagicString.prototype.prependLeft = function(index, content) {
|
|
1999
2130
|
assertString(content, "inserted content must be a string");
|
|
2000
2131
|
return nativePrependLeft.call(this, index, content);
|
|
2001
2132
|
};
|
|
2002
|
-
import_binding$
|
|
2133
|
+
import_binding$4.BindingMagicString.prototype.prependRight = function(index, content) {
|
|
2003
2134
|
assertString(content, "inserted content must be a string");
|
|
2004
2135
|
return nativePrependRight.call(this, index, content);
|
|
2005
2136
|
};
|
|
2006
|
-
import_binding$
|
|
2137
|
+
import_binding$4.BindingMagicString.prototype.overwrite = function(start, end, content, options) {
|
|
2007
2138
|
assertString(content, "replacement content must be a string");
|
|
2008
2139
|
return nativeOverwrite.call(this, start, end, content, options);
|
|
2009
2140
|
};
|
|
2010
|
-
import_binding$
|
|
2141
|
+
import_binding$4.BindingMagicString.prototype.update = function(start, end, content, options) {
|
|
2011
2142
|
assertString(content, "replacement content must be a string");
|
|
2012
2143
|
return nativeUpdate.call(this, start, end, content, options);
|
|
2013
2144
|
};
|
|
2014
|
-
var nativeReplace = import_binding$
|
|
2015
|
-
var nativeReplaceAll = import_binding$
|
|
2016
|
-
import_binding$
|
|
2145
|
+
var nativeReplace = import_binding$4.BindingMagicString.prototype.replace;
|
|
2146
|
+
var nativeReplaceAll = import_binding$4.BindingMagicString.prototype.replaceAll;
|
|
2147
|
+
import_binding$4.BindingMagicString.prototype.replace = function(searchValue, replacement) {
|
|
2017
2148
|
if (typeof searchValue === "string") return nativeReplace.call(this, searchValue, replacement);
|
|
2018
2149
|
if (searchValue.global) searchValue.lastIndex = 0;
|
|
2019
2150
|
const lastMatchEnd = this.replaceRegex(searchValue, replacement);
|
|
@@ -2021,7 +2152,7 @@ import_binding$3.BindingMagicString.prototype.replace = function(searchValue, re
|
|
|
2021
2152
|
else if (searchValue.sticky) searchValue.lastIndex = lastMatchEnd === -1 ? 0 : lastMatchEnd;
|
|
2022
2153
|
return this;
|
|
2023
2154
|
};
|
|
2024
|
-
import_binding$
|
|
2155
|
+
import_binding$4.BindingMagicString.prototype.replaceAll = function(searchValue, replacement) {
|
|
2025
2156
|
if (typeof searchValue === "string") return nativeReplaceAll.call(this, searchValue, replacement);
|
|
2026
2157
|
if (!searchValue.global) throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");
|
|
2027
2158
|
searchValue.lastIndex = 0;
|
|
@@ -2034,7 +2165,7 @@ import_binding$3.BindingMagicString.prototype.replaceAll = function(searchValue,
|
|
|
2034
2165
|
*
|
|
2035
2166
|
* @experimental
|
|
2036
2167
|
*/
|
|
2037
|
-
var RolldownMagicString = import_binding$
|
|
2168
|
+
var RolldownMagicString = import_binding$4.BindingMagicString;
|
|
2038
2169
|
function isEmptySourcemapFiled(array) {
|
|
2039
2170
|
if (!array) return true;
|
|
2040
2171
|
if (array.length === 0 || !array[0]) return true;
|
|
@@ -2127,6 +2258,20 @@ function containsImporterId(expr) {
|
|
|
2127
2258
|
function assertNoImporterId(filterExprs, hookName) {
|
|
2128
2259
|
if (filterExprs?.some(containsImporterId)) throw new Error(`The \`importerId\` filter can only be used with the \`resolveId\` hook, but it was used with the \`${hookName}\` hook.`);
|
|
2129
2260
|
}
|
|
2261
|
+
function containsStringId(expr) {
|
|
2262
|
+
switch (expr.kind) {
|
|
2263
|
+
case "and":
|
|
2264
|
+
case "or": return expr.args.some(containsStringId);
|
|
2265
|
+
case "not":
|
|
2266
|
+
case "include":
|
|
2267
|
+
case "exclude": return containsStringId(expr.expr);
|
|
2268
|
+
case "id": return typeof expr.pattern === "string";
|
|
2269
|
+
default: return false;
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
function assertNoStringId(filterExprs, hookName) {
|
|
2273
|
+
if (filterExprs?.some(containsStringId)) throw new Error(`A string \`id\` filter is not supported for the \`${hookName}\` hook, because its \`id\` is the import specifier rather than a resolved path. Use a RegExp instead.`);
|
|
2274
|
+
}
|
|
2130
2275
|
function bindingifyFilterExprImpl(expr, list) {
|
|
2131
2276
|
switch (expr.kind) {
|
|
2132
2277
|
case "and": {
|
|
@@ -2200,8 +2345,11 @@ function bindingifyFilterExprImpl(expr, list) {
|
|
|
2200
2345
|
}
|
|
2201
2346
|
function bindingifyResolveIdFilter(filterOption) {
|
|
2202
2347
|
if (!filterOption) return;
|
|
2203
|
-
|
|
2204
|
-
|
|
2348
|
+
const filterExprs = Array.isArray(filterOption) ? filterOption : filterOption.id ? generalHookFilterMatcherToFilterExprs(filterOption.id, "id") : void 0;
|
|
2349
|
+
assertNoStringId(filterExprs, "resolveId");
|
|
2350
|
+
if (!filterExprs) return;
|
|
2351
|
+
const value = filterExprs.map(bindingifyFilterExpr);
|
|
2352
|
+
return value.length > 0 ? { value } : void 0;
|
|
2205
2353
|
}
|
|
2206
2354
|
function bindingifyLoadFilter(filterOption) {
|
|
2207
2355
|
if (!filterOption) return;
|
|
@@ -2232,13 +2380,21 @@ function bindingifyPluginHookMeta(options) {
|
|
|
2232
2380
|
}
|
|
2233
2381
|
function bindingPluginOrder(order) {
|
|
2234
2382
|
switch (order) {
|
|
2235
|
-
case "post": return import_binding$
|
|
2236
|
-
case "pre": return import_binding$
|
|
2383
|
+
case "post": return import_binding$4.BindingPluginOrder.Post;
|
|
2384
|
+
case "pre": return import_binding$4.BindingPluginOrder.Pre;
|
|
2237
2385
|
case null:
|
|
2238
2386
|
case void 0: return;
|
|
2239
2387
|
default: throw new Error(`Unknown plugin order: ${order}`);
|
|
2240
2388
|
}
|
|
2241
2389
|
}
|
|
2390
|
+
function bindingifyHook(hook, build) {
|
|
2391
|
+
if (!hook) return {};
|
|
2392
|
+
const normalized = normalizeHook(hook);
|
|
2393
|
+
return {
|
|
2394
|
+
...build(normalized),
|
|
2395
|
+
meta: bindingifyPluginHookMeta(normalized.meta)
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2242
2398
|
var fsModule = {
|
|
2243
2399
|
appendFile: fsp.appendFile,
|
|
2244
2400
|
copyFile: fsp.copyFile,
|
|
@@ -2318,17 +2474,23 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2318
2474
|
};
|
|
2319
2475
|
}
|
|
2320
2476
|
emitFile = (file) => {
|
|
2321
|
-
if (file.type === "prebuilt-chunk")
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2477
|
+
if (file.type === "prebuilt-chunk") {
|
|
2478
|
+
if (typeof file.code !== "string") return error(logFailedValidation(`Emitted prebuilt chunks need to have a valid string code, received "${file.code}".`));
|
|
2479
|
+
if (typeof file.fileName !== "string" || isPathFragment(file.fileName)) return error(logFailedValidation(`The "fileName" property of emitted prebuilt chunks must be strings that are neither absolute nor relative paths, received "${file.fileName}".`));
|
|
2480
|
+
return this.context.emitPrebuiltChunk({
|
|
2481
|
+
fileName: file.fileName,
|
|
2482
|
+
name: file.name,
|
|
2483
|
+
code: file.code,
|
|
2484
|
+
exports: file.exports,
|
|
2485
|
+
map: bindingifySourcemap$1(file.map),
|
|
2486
|
+
sourcemapFileName: file.sourcemapFileName,
|
|
2487
|
+
facadeModuleId: file.facadeModuleId,
|
|
2488
|
+
isEntry: file.isEntry,
|
|
2489
|
+
isDynamicEntry: file.isDynamicEntry
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
const validatedName = file.fileName || file.name;
|
|
2493
|
+
if (typeof validatedName === "string" && isPathFragment(validatedName)) return error(logFailedValidation(`The "fileName" or "name" properties of emitted chunks and assets must be strings that are neither absolute nor relative paths, received "${validatedName}".`));
|
|
2332
2494
|
if (file.type === "chunk") return this.context.emitChunk({
|
|
2333
2495
|
preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
|
|
2334
2496
|
...file
|
|
@@ -2364,6 +2526,9 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
|
|
|
2364
2526
|
return parseAst(input, options);
|
|
2365
2527
|
}
|
|
2366
2528
|
};
|
|
2529
|
+
function createPluginContext(args, ctx) {
|
|
2530
|
+
return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
|
2531
|
+
}
|
|
2367
2532
|
var LoadPluginContextImpl = class extends PluginContextImpl {
|
|
2368
2533
|
inner;
|
|
2369
2534
|
constructor(outputOptions, context, plugin, data, inner, moduleId, onLog, logLevelOption, watchMode) {
|
|
@@ -2411,36 +2576,19 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
|
|
|
2411
2576
|
this.inner.sendMagicString(s);
|
|
2412
2577
|
}
|
|
2413
2578
|
};
|
|
2414
|
-
function createPluginContext(args, ctx) {
|
|
2415
|
-
return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
|
2416
|
-
}
|
|
2417
2579
|
function bindingifyBuildStart(args) {
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
return {
|
|
2422
|
-
plugin: async (ctx, opts) => {
|
|
2423
|
-
await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
|
|
2424
|
-
},
|
|
2425
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2426
|
-
};
|
|
2580
|
+
return bindingifyHook(args.plugin.buildStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
|
|
2581
|
+
await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
|
|
2582
|
+
} }));
|
|
2427
2583
|
}
|
|
2428
2584
|
function bindingifyBuildEnd(args) {
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
return {
|
|
2433
|
-
plugin: async (ctx, err) => {
|
|
2434
|
-
await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
|
2435
|
-
},
|
|
2436
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2437
|
-
};
|
|
2585
|
+
return bindingifyHook(args.plugin.buildEnd, ({ handler }) => ({ plugin: async (ctx, err) => {
|
|
2586
|
+
await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
|
2587
|
+
} }));
|
|
2438
2588
|
}
|
|
2439
2589
|
function bindingifyResolveId(args) {
|
|
2440
2590
|
const hook = args.plugin.resolveId;
|
|
2441
|
-
|
|
2442
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
2443
|
-
return {
|
|
2591
|
+
return bindingifyHook(hook, ({ handler, options }) => ({
|
|
2444
2592
|
plugin: async (ctx, specifier, importer, extraOptions) => {
|
|
2445
2593
|
const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
|
|
2446
2594
|
const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
|
|
@@ -2470,44 +2618,34 @@ function bindingifyResolveId(args) {
|
|
|
2470
2618
|
packageJsonPath: ret.packageJsonPath
|
|
2471
2619
|
};
|
|
2472
2620
|
},
|
|
2473
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
2474
2621
|
filter: bindingifyResolveIdFilter(options.filter)
|
|
2475
|
-
};
|
|
2622
|
+
}));
|
|
2476
2623
|
}
|
|
2477
2624
|
function bindingifyResolveDynamicImport(args) {
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
invalidate: false
|
|
2500
|
-
});
|
|
2501
|
-
return result;
|
|
2502
|
-
},
|
|
2503
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2504
|
-
};
|
|
2625
|
+
return bindingifyHook(args.plugin.resolveDynamicImport, ({ handler }) => ({ plugin: async (ctx, specifier, importer) => {
|
|
2626
|
+
const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
|
|
2627
|
+
if (ret == null) return;
|
|
2628
|
+
if (ret === false) return {
|
|
2629
|
+
id: specifier,
|
|
2630
|
+
external: true
|
|
2631
|
+
};
|
|
2632
|
+
if (typeof ret === "string") return { id: ret };
|
|
2633
|
+
const result = {
|
|
2634
|
+
id: ret.id,
|
|
2635
|
+
external: ret.external,
|
|
2636
|
+
packageJsonPath: ret.packageJsonPath
|
|
2637
|
+
};
|
|
2638
|
+
if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
|
|
2639
|
+
args.pluginContextData.updateModuleOption(ret.id, {
|
|
2640
|
+
meta: ret.meta || {},
|
|
2641
|
+
moduleSideEffects: ret.moduleSideEffects || null,
|
|
2642
|
+
invalidate: false
|
|
2643
|
+
});
|
|
2644
|
+
return result;
|
|
2645
|
+
} }));
|
|
2505
2646
|
}
|
|
2506
2647
|
function bindingifyTransform(args) {
|
|
2507
|
-
|
|
2508
|
-
if (!hook) return {};
|
|
2509
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
2510
|
-
return {
|
|
2648
|
+
return bindingifyHook(args.plugin.transform, ({ handler, options }) => ({
|
|
2511
2649
|
plugin: async (ctx, code, id, meta) => {
|
|
2512
2650
|
let magicStringInstance, astInstance;
|
|
2513
2651
|
Object.defineProperties(meta, {
|
|
@@ -2523,10 +2661,7 @@ function bindingifyTransform(args) {
|
|
|
2523
2661
|
case "js":
|
|
2524
2662
|
case "jsx":
|
|
2525
2663
|
case "ts":
|
|
2526
|
-
case "tsx":
|
|
2527
|
-
lang = meta.moduleType;
|
|
2528
|
-
break;
|
|
2529
|
-
default: break;
|
|
2664
|
+
case "tsx": lang = meta.moduleType;
|
|
2530
2665
|
}
|
|
2531
2666
|
astInstance = parseAst(code, {
|
|
2532
2667
|
astType: meta.moduleType.includes("ts") ? "ts" : "js",
|
|
@@ -2562,15 +2697,11 @@ function bindingifyTransform(args) {
|
|
|
2562
2697
|
moduleType: ret.moduleType
|
|
2563
2698
|
};
|
|
2564
2699
|
},
|
|
2565
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
2566
2700
|
filter: bindingifyTransformFilter(options.filter)
|
|
2567
|
-
};
|
|
2701
|
+
}));
|
|
2568
2702
|
}
|
|
2569
2703
|
function bindingifyLoad(args) {
|
|
2570
|
-
|
|
2571
|
-
if (!hook) return {};
|
|
2572
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
2573
|
-
return {
|
|
2704
|
+
return bindingifyHook(args.plugin.load, ({ handler, options }) => ({
|
|
2574
2705
|
plugin: async (ctx, id) => {
|
|
2575
2706
|
const ret = await handler.call(new LoadPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, args.onLog, args.logLevel, args.watchMode), id);
|
|
2576
2707
|
if (ret == null) return;
|
|
@@ -2588,9 +2719,8 @@ function bindingifyLoad(args) {
|
|
|
2588
2719
|
moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
|
|
2589
2720
|
};
|
|
2590
2721
|
},
|
|
2591
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
2592
2722
|
filter: bindingifyLoadFilter(options.filter)
|
|
2593
|
-
};
|
|
2723
|
+
}));
|
|
2594
2724
|
}
|
|
2595
2725
|
function preProcessSourceMap(ret, id) {
|
|
2596
2726
|
if (!ret.map) return;
|
|
@@ -2603,32 +2733,17 @@ function preProcessSourceMap(ret, id) {
|
|
|
2603
2733
|
return map;
|
|
2604
2734
|
}
|
|
2605
2735
|
function bindingifyModuleParsed(args) {
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
return {
|
|
2610
|
-
plugin: async (ctx, moduleInfo) => {
|
|
2611
|
-
await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
2612
|
-
},
|
|
2613
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2614
|
-
};
|
|
2736
|
+
return bindingifyHook(args.plugin.moduleParsed, ({ handler }) => ({ plugin: async (ctx, moduleInfo) => {
|
|
2737
|
+
await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
|
|
2738
|
+
} }));
|
|
2615
2739
|
}
|
|
2616
2740
|
function bindingifyRenderStart(args) {
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
return {
|
|
2621
|
-
plugin: async (ctx, opts) => {
|
|
2622
|
-
handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getInputOptions(opts));
|
|
2623
|
-
},
|
|
2624
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2625
|
-
};
|
|
2741
|
+
return bindingifyHook(args.plugin.renderStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
|
|
2742
|
+
await handler.call(createPluginContext(args, ctx), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getInputOptions(opts));
|
|
2743
|
+
} }));
|
|
2626
2744
|
}
|
|
2627
2745
|
function bindingifyRenderChunk(args) {
|
|
2628
|
-
|
|
2629
|
-
if (!hook) return {};
|
|
2630
|
-
const { handler, meta, options } = normalizeHook(hook);
|
|
2631
|
-
return {
|
|
2746
|
+
return bindingifyHook(args.plugin.renderChunk, ({ handler, options }) => ({
|
|
2632
2747
|
plugin: async (ctx, code, chunk, opts, meta) => {
|
|
2633
2748
|
if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
|
|
2634
2749
|
const renderChunkMeta = args.pluginContextData.getRenderChunkMeta();
|
|
@@ -2641,7 +2756,7 @@ function bindingifyRenderChunk(args) {
|
|
|
2641
2756
|
},
|
|
2642
2757
|
configurable: true
|
|
2643
2758
|
});
|
|
2644
|
-
const ret = await handler.call(
|
|
2759
|
+
const ret = await handler.call(createPluginContext(args, ctx), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
|
|
2645
2760
|
if (ret == null) return;
|
|
2646
2761
|
if (ret instanceof RolldownMagicString) {
|
|
2647
2762
|
const normalizedCode = ret.toString();
|
|
@@ -2692,148 +2807,79 @@ function bindingifyRenderChunk(args) {
|
|
|
2692
2807
|
map: bindingifySourcemap$1(ret.map)
|
|
2693
2808
|
};
|
|
2694
2809
|
},
|
|
2695
|
-
meta: bindingifyPluginHookMeta(meta),
|
|
2696
2810
|
filter: bindingifyRenderChunkFilter(options.filter)
|
|
2697
|
-
};
|
|
2811
|
+
}));
|
|
2698
2812
|
}
|
|
2699
2813
|
function bindingifyAugmentChunkHash(args) {
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
};
|
|
2814
|
+
return bindingifyHook(args.plugin.augmentChunkHash, ({ handler }) => ({ plugin: async (ctx, chunk) => {
|
|
2815
|
+
return handler.call(createPluginContext(args, ctx), transformRenderedChunk(chunk));
|
|
2816
|
+
} }));
|
|
2817
|
+
}
|
|
2818
|
+
function bindingifyResolveFileUrl(args) {
|
|
2819
|
+
return bindingifyHook(args.plugin.resolveFileUrl, ({ handler }) => ({ plugin: async (ctx, resolveFileUrlArgs) => {
|
|
2820
|
+
return handler.call(createPluginContext(args, ctx), resolveFileUrlArgs);
|
|
2821
|
+
} }));
|
|
2709
2822
|
}
|
|
2710
2823
|
function bindingifyRenderError(args) {
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2824
|
+
return bindingifyHook(args.plugin.renderError, ({ handler }) => ({ plugin: async (ctx, err) => {
|
|
2825
|
+
await handler.call(createPluginContext(args, ctx), aggregateBindingErrorsIntoJsError(err));
|
|
2826
|
+
} }));
|
|
2827
|
+
}
|
|
2828
|
+
function createOutputBundle(args, ctx, bundle) {
|
|
2829
|
+
const changed = {
|
|
2830
|
+
updated: /* @__PURE__ */ new Set(),
|
|
2831
|
+
deleted: /* @__PURE__ */ new Set()
|
|
2832
|
+
};
|
|
2833
|
+
const context = createPluginContext(args, ctx);
|
|
2714
2834
|
return {
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2835
|
+
changed,
|
|
2836
|
+
context,
|
|
2837
|
+
output: transformToOutputBundle(context, unwrapBindingResult(bundle), changed)
|
|
2719
2838
|
};
|
|
2720
2839
|
}
|
|
2721
2840
|
function bindingifyGenerateBundle(args) {
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
const changed = {
|
|
2728
|
-
updated: /* @__PURE__ */ new Set(),
|
|
2729
|
-
deleted: /* @__PURE__ */ new Set()
|
|
2730
|
-
};
|
|
2731
|
-
const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
|
2732
|
-
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
2733
|
-
await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
2734
|
-
return collectChangedBundle(changed, output);
|
|
2735
|
-
},
|
|
2736
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2737
|
-
};
|
|
2841
|
+
return bindingifyHook(args.plugin.generateBundle, ({ handler }) => ({ plugin: async (ctx, bundle, isWrite, opts) => {
|
|
2842
|
+
const { changed, context, output } = createOutputBundle(args, ctx, bundle);
|
|
2843
|
+
await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
|
|
2844
|
+
return collectChangedBundle(changed, output);
|
|
2845
|
+
} }));
|
|
2738
2846
|
}
|
|
2739
2847
|
function bindingifyWriteBundle(args) {
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
const changed = {
|
|
2746
|
-
updated: /* @__PURE__ */ new Set(),
|
|
2747
|
-
deleted: /* @__PURE__ */ new Set()
|
|
2748
|
-
};
|
|
2749
|
-
const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
|
|
2750
|
-
const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
|
|
2751
|
-
await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
|
|
2752
|
-
return collectChangedBundle(changed, output);
|
|
2753
|
-
},
|
|
2754
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2755
|
-
};
|
|
2848
|
+
return bindingifyHook(args.plugin.writeBundle, ({ handler }) => ({ plugin: async (ctx, bundle, opts) => {
|
|
2849
|
+
const { changed, context, output } = createOutputBundle(args, ctx, bundle);
|
|
2850
|
+
await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
|
|
2851
|
+
return collectChangedBundle(changed, output);
|
|
2852
|
+
} }));
|
|
2756
2853
|
}
|
|
2757
2854
|
function bindingifyCloseBundle(args) {
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
};
|
|
2767
|
-
}
|
|
2768
|
-
function
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
},
|
|
2777
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2778
|
-
};
|
|
2779
|
-
}
|
|
2780
|
-
function bindingifyFooter(args) {
|
|
2781
|
-
const hook = args.plugin.footer;
|
|
2782
|
-
if (!hook) return {};
|
|
2783
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2784
|
-
return {
|
|
2785
|
-
plugin: async (ctx, chunk) => {
|
|
2786
|
-
if (typeof handler === "string") return handler;
|
|
2787
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
2788
|
-
},
|
|
2789
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2790
|
-
};
|
|
2791
|
-
}
|
|
2792
|
-
function bindingifyIntro(args) {
|
|
2793
|
-
const hook = args.plugin.intro;
|
|
2794
|
-
if (!hook) return {};
|
|
2795
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2796
|
-
return {
|
|
2797
|
-
plugin: async (ctx, chunk) => {
|
|
2798
|
-
if (typeof handler === "string") return handler;
|
|
2799
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
2800
|
-
},
|
|
2801
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2802
|
-
};
|
|
2803
|
-
}
|
|
2804
|
-
function bindingifyOutro(args) {
|
|
2805
|
-
const hook = args.plugin.outro;
|
|
2806
|
-
if (!hook) return {};
|
|
2807
|
-
const { handler, meta } = normalizeHook(hook);
|
|
2808
|
-
return {
|
|
2809
|
-
plugin: async (ctx, chunk) => {
|
|
2810
|
-
if (typeof handler === "string") return handler;
|
|
2811
|
-
return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
|
|
2812
|
-
},
|
|
2813
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2814
|
-
};
|
|
2855
|
+
return bindingifyHook(args.plugin.closeBundle, ({ handler }) => ({ plugin: async (ctx, err) => {
|
|
2856
|
+
await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
|
|
2857
|
+
} }));
|
|
2858
|
+
}
|
|
2859
|
+
function bindingifyAddonHook(args, name) {
|
|
2860
|
+
return bindingifyHook(args.plugin[name], ({ handler }) => ({ plugin: async (ctx, chunk) => {
|
|
2861
|
+
if (typeof handler === "string") return handler;
|
|
2862
|
+
return handler.call(createPluginContext(args, ctx), transformRenderedChunk(chunk));
|
|
2863
|
+
} }));
|
|
2864
|
+
}
|
|
2865
|
+
function bindingifyHotUpdate(args) {
|
|
2866
|
+
return bindingifyHook(args.plugin.hotUpdate, ({ handler }) => ({ plugin: async (ctx, hookArgs) => {
|
|
2867
|
+
return await handler.call(createPluginContext(args, ctx), {
|
|
2868
|
+
type: hookArgs.kind,
|
|
2869
|
+
file: hookArgs.file,
|
|
2870
|
+
modules: hookArgs.modules
|
|
2871
|
+
}) ?? void 0;
|
|
2872
|
+
} }));
|
|
2815
2873
|
}
|
|
2816
2874
|
function bindingifyWatchChange(args) {
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
return {
|
|
2821
|
-
plugin: async (ctx, id, event) => {
|
|
2822
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
|
|
2823
|
-
},
|
|
2824
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2825
|
-
};
|
|
2875
|
+
return bindingifyHook(args.plugin.watchChange, ({ handler }) => ({ plugin: async (ctx, id, event) => {
|
|
2876
|
+
await handler.call(createPluginContext(args, ctx), id, { event });
|
|
2877
|
+
} }));
|
|
2826
2878
|
}
|
|
2827
2879
|
function bindingifyCloseWatcher(args) {
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
return {
|
|
2832
|
-
plugin: async (ctx) => {
|
|
2833
|
-
await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
|
|
2834
|
-
},
|
|
2835
|
-
meta: bindingifyPluginHookMeta(meta)
|
|
2836
|
-
};
|
|
2880
|
+
return bindingifyHook(args.plugin.closeWatcher, ({ handler }) => ({ plugin: async (ctx) => {
|
|
2881
|
+
await handler.call(createPluginContext(args, ctx));
|
|
2882
|
+
} }));
|
|
2837
2883
|
}
|
|
2838
2884
|
var HookUsage = class {
|
|
2839
2885
|
bitflag = BigInt(0);
|
|
@@ -2867,9 +2913,222 @@ function extractHookUsage(plugin) {
|
|
|
2867
2913
|
if (plugin.footer) hookUsage.union(262144);
|
|
2868
2914
|
if (plugin.intro) hookUsage.union(524288);
|
|
2869
2915
|
if (plugin.outro) hookUsage.union(1048576);
|
|
2916
|
+
if (plugin.resolveFileUrl) hookUsage.union(2097152);
|
|
2917
|
+
if (plugin.hotUpdate) hookUsage.union(4194304);
|
|
2870
2918
|
return hookUsage;
|
|
2871
2919
|
}
|
|
2872
|
-
|
|
2920
|
+
/**
|
|
2921
|
+
* Measure what plugin hooks cost, from inside the JavaScript callback.
|
|
2922
|
+
*
|
|
2923
|
+
* Internal to Rolldown. Nothing here is on a public entry point, and the measurement is not
|
|
2924
|
+
* offered as an API — the only consumer is the core, which pulls it while the build closes.
|
|
2925
|
+
*
|
|
2926
|
+
* The bundler core can only bracket *dispatch* and *completion*. For a hook it invokes
|
|
2927
|
+
* concurrently those two points are separated mostly by the queue the call waited in on
|
|
2928
|
+
* JavaScript's single thread, and the queue is deepest behind whichever callback is doing
|
|
2929
|
+
* the most work — so the hook blocking the thread dilutes its own credit while cheap hooks
|
|
2930
|
+
* collect credit for waiting. Ranking from those numbers reliably puts the *cheapest* hook
|
|
2931
|
+
* first.
|
|
2932
|
+
*
|
|
2933
|
+
* The missing quantity is when the callback began running, and that is known here. Starting
|
|
2934
|
+
* the clock inside the callback removes the dispatch queue by construction.
|
|
2935
|
+
*
|
|
2936
|
+
* ## `maxInFlight` decides whether a total means anything
|
|
2937
|
+
*
|
|
2938
|
+
* Entry-to-exit spans may be summed only if they never overlap. A synchronous callback
|
|
2939
|
+
* cannot overlap: it holds the thread until it returns. An `async` one can — it may suspend
|
|
2940
|
+
* at an `await` and let another call of the same hook begin, and then both spans cover the
|
|
2941
|
+
* same wall clock and the sum counts it twice.
|
|
2942
|
+
*
|
|
2943
|
+
* Overlap also changes what the span is measuring. A hook that awaits the bundler (say
|
|
2944
|
+
* `this.resolve`) spends most of its span waiting for Rust, so the number describes the
|
|
2945
|
+
* bundler rather than the plugin. Observed on a real build: one `resolveId` accumulated
|
|
2946
|
+
* ~47,000s of span inside a 44s module-loading window.
|
|
2947
|
+
*
|
|
2948
|
+
* So overlap is measured rather than assumed, per hook: `overlapMs` is the wall time
|
|
2949
|
+
* double counted in `ms` because two or more calls were in flight together. A hook is
|
|
2950
|
+
* reported with a number when that is a negligible share of its span, and named without one
|
|
2951
|
+
* when it is not.
|
|
2952
|
+
*
|
|
2953
|
+
* The test is deliberately a tolerance rather than "did this ever happen". A peak in-flight
|
|
2954
|
+
* count of 2 can mean one incidental overlap in twenty thousand calls, and discarding a
|
|
2955
|
+
* twelve-second measurement over that both throws away good data and makes the report
|
|
2956
|
+
* depend on scheduling luck — the same hook would appear in one run and vanish in the next.
|
|
2957
|
+
*
|
|
2958
|
+
* This keeps the rule the core followed — never present a number that cannot be defended —
|
|
2959
|
+
* while narrowing "cannot measure" from a property of the *call site* to a property of the
|
|
2960
|
+
* *callback*, which is where it actually lives. A hook dispatched concurrently but whose
|
|
2961
|
+
* body barely overlaps is measured to within the tolerance.
|
|
2962
|
+
*
|
|
2963
|
+
* A measured row is still wall time for that callback rather than CPU: a hook that awaits
|
|
2964
|
+
* I/O without overlapping another call of itself is charged for the wait. Excluding the
|
|
2965
|
+
* dispatch queue is what this buys; it does not distinguish running from awaiting.
|
|
2966
|
+
*/
|
|
2967
|
+
/**
|
|
2968
|
+
* How much of a hook's span may be double counted before its total stops being reportable,
|
|
2969
|
+
* as a fraction of that span.
|
|
2970
|
+
*/
|
|
2971
|
+
var OVERLAP_TOLERANCE = .01;
|
|
2972
|
+
/**
|
|
2973
|
+
* One recorder per build, keyed on the object that identifies it.
|
|
2974
|
+
*
|
|
2975
|
+
* Counters cannot be module-global. A plugin is free to run a nested `rolldown()` build of
|
|
2976
|
+
* its own, which finishes first; shared counters would let it flush the outer build's
|
|
2977
|
+
* half-accumulated totals and report a window belonging to neither.
|
|
2978
|
+
*/
|
|
2979
|
+
var recorders = /* @__PURE__ */ new WeakMap();
|
|
2980
|
+
/** The recorder for one build, created on first use. */
|
|
2981
|
+
function pluginTimingsRecorderFor(key) {
|
|
2982
|
+
let recorder = recorders.get(key);
|
|
2983
|
+
if (recorder === void 0) {
|
|
2984
|
+
recorder = {
|
|
2985
|
+
costs: /* @__PURE__ */ new Map(),
|
|
2986
|
+
busyMs: 0,
|
|
2987
|
+
inFlight: 0,
|
|
2988
|
+
busyStart: 0
|
|
2989
|
+
};
|
|
2990
|
+
recorders.set(key, recorder);
|
|
2991
|
+
}
|
|
2992
|
+
return recorder;
|
|
2993
|
+
}
|
|
2994
|
+
function costFor(recorder, owner, hookName) {
|
|
2995
|
+
let byHook = recorder.costs.get(owner.key);
|
|
2996
|
+
if (byHook === void 0) {
|
|
2997
|
+
byHook = /* @__PURE__ */ new Map();
|
|
2998
|
+
recorder.costs.set(owner.key, byHook);
|
|
2999
|
+
}
|
|
3000
|
+
let cost = byHook.get(hookName);
|
|
3001
|
+
if (cost === void 0) {
|
|
3002
|
+
cost = {
|
|
3003
|
+
owner: owner.name,
|
|
3004
|
+
kind: owner.kind,
|
|
3005
|
+
hookName,
|
|
3006
|
+
calls: 0,
|
|
3007
|
+
ms: 0,
|
|
3008
|
+
inFlight: 0,
|
|
3009
|
+
maxInFlight: 0,
|
|
3010
|
+
overlapMs: 0,
|
|
3011
|
+
lastChange: 0
|
|
3012
|
+
};
|
|
3013
|
+
byHook.set(hookName, cost);
|
|
3014
|
+
}
|
|
3015
|
+
return cost;
|
|
3016
|
+
}
|
|
3017
|
+
/**
|
|
3018
|
+
* Fold the interval since the last in-flight change into `overlapMs`, then move the mark.
|
|
3019
|
+
* Call immediately before every increment and decrement of `cost.inFlight`.
|
|
3020
|
+
*/
|
|
3021
|
+
function markInFlightChange(cost, at) {
|
|
3022
|
+
if (cost.inFlight > 1) cost.overlapMs += (cost.inFlight - 1) * (at - cost.lastChange);
|
|
3023
|
+
cost.lastChange = at;
|
|
3024
|
+
}
|
|
3025
|
+
/**
|
|
3026
|
+
* Close out one call. A module-level function rather than a closure per invocation: hooks
|
|
3027
|
+
* run hundreds of thousands of times in a large build, and the synchronous path would
|
|
3028
|
+
* otherwise allocate one closure per call only to invoke it immediately.
|
|
3029
|
+
*/
|
|
3030
|
+
function settle(recorder, cost, started) {
|
|
3031
|
+
const ended = performance.now();
|
|
3032
|
+
markInFlightChange(cost, ended);
|
|
3033
|
+
cost.inFlight -= 1;
|
|
3034
|
+
cost.ms += ended - started;
|
|
3035
|
+
recorder.inFlight -= 1;
|
|
3036
|
+
if (recorder.inFlight === 0) recorder.busyMs += ended - recorder.busyStart;
|
|
3037
|
+
}
|
|
3038
|
+
/**
|
|
3039
|
+
* Wrap one callback so its execution time is recorded.
|
|
3040
|
+
*
|
|
3041
|
+
* Returns the callback untouched when there is no recorder, so a build that is not
|
|
3042
|
+
* measuring pays nothing beyond one branch at setup.
|
|
3043
|
+
*/
|
|
3044
|
+
function measureHookCost(recorder, owner, hookName, handler) {
|
|
3045
|
+
if (recorder === void 0) return handler;
|
|
3046
|
+
const cost = costFor(recorder, owner, hookName);
|
|
3047
|
+
return function(...args) {
|
|
3048
|
+
const started = performance.now();
|
|
3049
|
+
markInFlightChange(cost, started);
|
|
3050
|
+
cost.calls += 1;
|
|
3051
|
+
cost.inFlight += 1;
|
|
3052
|
+
if (cost.inFlight > cost.maxInFlight) cost.maxInFlight = cost.inFlight;
|
|
3053
|
+
if (recorder.inFlight === 0) recorder.busyStart = started;
|
|
3054
|
+
recorder.inFlight += 1;
|
|
3055
|
+
let result;
|
|
3056
|
+
try {
|
|
3057
|
+
result = handler.apply(this, args);
|
|
3058
|
+
} catch (error) {
|
|
3059
|
+
settle(recorder, cost, started);
|
|
3060
|
+
throw error;
|
|
3061
|
+
}
|
|
3062
|
+
if (typeof result?.then === "function") return result.then((value) => {
|
|
3063
|
+
settle(recorder, cost, started);
|
|
3064
|
+
return value;
|
|
3065
|
+
}, (error) => {
|
|
3066
|
+
settle(recorder, cost, started);
|
|
3067
|
+
throw error;
|
|
3068
|
+
});
|
|
3069
|
+
settle(recorder, cost, started);
|
|
3070
|
+
return result;
|
|
3071
|
+
};
|
|
3072
|
+
}
|
|
3073
|
+
/**
|
|
3074
|
+
* The owner shown for user callbacks the core invokes directly rather than through a
|
|
3075
|
+
* plugin. One shared identity: they are all configured on the same options object.
|
|
3076
|
+
*/
|
|
3077
|
+
var OUTPUT_OPTIONS_OWNER = {
|
|
3078
|
+
key: Symbol("output options"),
|
|
3079
|
+
name: "output options",
|
|
3080
|
+
kind: "outputOption"
|
|
3081
|
+
};
|
|
3082
|
+
/** As {@link OUTPUT_OPTIONS_OWNER}, for callbacks configured on the input options. */
|
|
3083
|
+
var INPUT_OPTIONS_OWNER = {
|
|
3084
|
+
key: Symbol("input options"),
|
|
3085
|
+
name: "input options",
|
|
3086
|
+
kind: "inputOption"
|
|
3087
|
+
};
|
|
3088
|
+
/**
|
|
3089
|
+
* Wrap `value` when the user supplied a function, and leave every other form alone.
|
|
3090
|
+
*
|
|
3091
|
+
* Most option callbacks are declared as `string | RegExp | Function | ...`, so this keeps
|
|
3092
|
+
* the one cast the wrapping needs in a single place.
|
|
3093
|
+
*/
|
|
3094
|
+
function measureIfFunction(recorder, owner, hookName, value) {
|
|
3095
|
+
if (typeof value !== "function") return value;
|
|
3096
|
+
return measureHookCost(recorder, owner, hookName, value);
|
|
3097
|
+
}
|
|
3098
|
+
/**
|
|
3099
|
+
* What the build's callbacks have cost so far, leaving the recorder in place.
|
|
3100
|
+
*
|
|
3101
|
+
* Ungated on purpose: whether a build is worth reporting on is decided from the clocks Rust
|
|
3102
|
+
* holds, so the question is not this side's to ask.
|
|
3103
|
+
*
|
|
3104
|
+
* Rust calls this while the build is closing, so what it gets includes `closeBundle`.
|
|
3105
|
+
*/
|
|
3106
|
+
function summarizePluginTimings(key) {
|
|
3107
|
+
const recorder = recorders.get(key);
|
|
3108
|
+
if (recorder === void 0) return {
|
|
3109
|
+
busyMs: 0,
|
|
3110
|
+
rows: []
|
|
3111
|
+
};
|
|
3112
|
+
const rows = [];
|
|
3113
|
+
for (const byHook of recorder.costs.values()) for (const cost of byHook.values()) {
|
|
3114
|
+
if (cost.calls === 0) continue;
|
|
3115
|
+
rows.push({
|
|
3116
|
+
owner: cost.owner,
|
|
3117
|
+
kind: cost.kind,
|
|
3118
|
+
hook: cost.hookName,
|
|
3119
|
+
calls: cost.calls,
|
|
3120
|
+
ms: cost.ms,
|
|
3121
|
+
maxInFlight: cost.maxInFlight,
|
|
3122
|
+
overlapMs: cost.overlapMs,
|
|
3123
|
+
rankable: cost.overlapMs <= cost.ms * OVERLAP_TOLERANCE
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
return {
|
|
3127
|
+
busyMs: recorder.busyMs,
|
|
3128
|
+
rows
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3131
|
+
function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
|
|
2873
3132
|
const args = {
|
|
2874
3133
|
plugin,
|
|
2875
3134
|
options,
|
|
@@ -2889,19 +3148,21 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2889
3148
|
const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
|
|
2890
3149
|
const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
|
|
2891
3150
|
const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
|
|
3151
|
+
const { plugin: resolveFileUrl, meta: resolveFileUrlMeta } = bindingifyResolveFileUrl(args);
|
|
2892
3152
|
const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
|
|
2893
3153
|
const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
|
|
2894
3154
|
const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
|
|
2895
3155
|
const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
|
|
2896
3156
|
const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
|
|
2897
|
-
const { plugin: banner, meta: bannerMeta } =
|
|
2898
|
-
const { plugin: footer, meta: footerMeta } =
|
|
2899
|
-
const { plugin: intro, meta: introMeta } =
|
|
2900
|
-
const { plugin: outro, meta: outroMeta } =
|
|
3157
|
+
const { plugin: banner, meta: bannerMeta } = bindingifyAddonHook(args, "banner");
|
|
3158
|
+
const { plugin: footer, meta: footerMeta } = bindingifyAddonHook(args, "footer");
|
|
3159
|
+
const { plugin: intro, meta: introMeta } = bindingifyAddonHook(args, "intro");
|
|
3160
|
+
const { plugin: outro, meta: outroMeta } = bindingifyAddonHook(args, "outro");
|
|
2901
3161
|
const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
|
|
3162
|
+
const { plugin: hotUpdate, meta: hotUpdateMeta } = bindingifyHotUpdate(args);
|
|
2902
3163
|
const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
|
|
2903
3164
|
let hookUsage = extractHookUsage(plugin).inner();
|
|
2904
|
-
|
|
3165
|
+
const result = {
|
|
2905
3166
|
name: plugin.name,
|
|
2906
3167
|
buildStart,
|
|
2907
3168
|
buildStartMeta,
|
|
@@ -2925,6 +3186,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2925
3186
|
renderChunkFilter,
|
|
2926
3187
|
augmentChunkHash,
|
|
2927
3188
|
augmentChunkHashMeta,
|
|
3189
|
+
resolveFileUrl,
|
|
3190
|
+
resolveFileUrlMeta,
|
|
2928
3191
|
renderStart,
|
|
2929
3192
|
renderStartMeta,
|
|
2930
3193
|
renderError,
|
|
@@ -2945,12 +3208,19 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
|
|
|
2945
3208
|
outroMeta,
|
|
2946
3209
|
watchChange,
|
|
2947
3210
|
watchChangeMeta,
|
|
3211
|
+
hotUpdate,
|
|
3212
|
+
hotUpdateMeta,
|
|
2948
3213
|
closeWatcher,
|
|
2949
3214
|
closeWatcherMeta,
|
|
2950
3215
|
hookUsage
|
|
2951
|
-
}
|
|
3216
|
+
};
|
|
3217
|
+
return wrapHandlers(result, {
|
|
3218
|
+
key: plugin,
|
|
3219
|
+
name: result.name,
|
|
3220
|
+
kind: "plugin"
|
|
3221
|
+
}, timings);
|
|
2952
3222
|
}
|
|
2953
|
-
function wrapHandlers(plugin) {
|
|
3223
|
+
function wrapHandlers(plugin, owner, timings) {
|
|
2954
3224
|
for (const hookName of [
|
|
2955
3225
|
"buildStart",
|
|
2956
3226
|
"resolveId",
|
|
@@ -2961,6 +3231,7 @@ function wrapHandlers(plugin) {
|
|
|
2961
3231
|
"load",
|
|
2962
3232
|
"renderChunk",
|
|
2963
3233
|
"augmentChunkHash",
|
|
3234
|
+
"resolveFileUrl",
|
|
2964
3235
|
"renderStart",
|
|
2965
3236
|
"renderError",
|
|
2966
3237
|
"generateBundle",
|
|
@@ -2971,9 +3242,11 @@ function wrapHandlers(plugin) {
|
|
|
2971
3242
|
"intro",
|
|
2972
3243
|
"outro",
|
|
2973
3244
|
"watchChange",
|
|
3245
|
+
"hotUpdate",
|
|
2974
3246
|
"closeWatcher"
|
|
2975
3247
|
]) {
|
|
2976
|
-
const
|
|
3248
|
+
const raw = plugin[hookName];
|
|
3249
|
+
const handler = raw && measureHookCost(timings, owner, hookName, raw);
|
|
2977
3250
|
if (handler) plugin[hookName] = async (...args) => {
|
|
2978
3251
|
try {
|
|
2979
3252
|
return await handler(...args);
|
|
@@ -3012,27 +3285,33 @@ function normalizeTransformOptions(inputOptions) {
|
|
|
3012
3285
|
oxcTransformOptions
|
|
3013
3286
|
};
|
|
3014
3287
|
}
|
|
3015
|
-
function
|
|
3288
|
+
function getDefaultDevRuntime(host = "localhost", port = 3e3) {
|
|
3289
|
+
const runtimeEntry = fs.readFileSync(fileURLToPath(import.meta.resolve("#runtime")), "utf8");
|
|
3290
|
+
const runtimeHelperImportEnd = runtimeEntry.indexOf("\n");
|
|
3291
|
+
if (!runtimeEntry.startsWith("import ") || runtimeHelperImportEnd === -1) throw new Error("Expected the standalone runtime to start with a helper import");
|
|
3292
|
+
return `${runtimeEntry.slice(runtimeHelperImportEnd + 1)}\n${fs.readFileSync(fileURLToPath(import.meta.resolve("#default-runtime")), "utf8").replaceAll("$ADDR", `${host}:${port}`)}`;
|
|
3293
|
+
}
|
|
3294
|
+
function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings) {
|
|
3016
3295
|
const plugins = rawPlugins.map((plugin) => {
|
|
3017
|
-
if (
|
|
3296
|
+
if (getParallelPluginInfo(plugin)) return;
|
|
3018
3297
|
if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
|
|
3019
3298
|
case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
|
|
3020
3299
|
default: return bindingifyBuiltInPlugin(plugin);
|
|
3021
3300
|
}
|
|
3022
|
-
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode);
|
|
3301
|
+
return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings);
|
|
3023
3302
|
});
|
|
3024
3303
|
const normalizedTransform = normalizeTransformOptions(inputOptions);
|
|
3025
3304
|
return {
|
|
3026
3305
|
input: bindingifyInput(inputOptions.input),
|
|
3027
3306
|
plugins,
|
|
3028
3307
|
cwd: inputOptions.cwd ?? process.cwd(),
|
|
3029
|
-
external: bindingifyExternal(inputOptions.external),
|
|
3308
|
+
external: bindingifyExternal(inputOptions.external, timings),
|
|
3030
3309
|
resolve: bindingifyResolve(inputOptions.resolve),
|
|
3031
3310
|
platform: inputOptions.platform,
|
|
3032
3311
|
shimMissingExports: inputOptions.shimMissingExports,
|
|
3033
3312
|
logLevel: bindingifyLogLevel(logLevel),
|
|
3034
3313
|
onLog,
|
|
3035
|
-
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake),
|
|
3314
|
+
treeshake: bindingifyTreeshakeOptions(inputOptions.treeshake, timings),
|
|
3036
3315
|
moduleTypes: inputOptions.moduleTypes,
|
|
3037
3316
|
define: normalizedTransform.define,
|
|
3038
3317
|
inject: bindingifyInject(normalizedTransform.inject),
|
|
@@ -3043,6 +3322,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
|
|
|
3043
3322
|
dropLabels: normalizedTransform.dropLabels,
|
|
3044
3323
|
keepNames: outputOptions.keepNames,
|
|
3045
3324
|
checks: inputOptions.checks,
|
|
3325
|
+
pluginTimings: timings ? () => summarizePluginTimings(inputOptions) : void 0,
|
|
3046
3326
|
deferSyncScanData: () => {
|
|
3047
3327
|
let ret = [];
|
|
3048
3328
|
pluginContextData.moduleOptionMap.forEach((value, key) => {
|
|
@@ -3064,35 +3344,46 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
|
|
|
3064
3344
|
}
|
|
3065
3345
|
function bindingifyDevMode(devMode) {
|
|
3066
3346
|
if (devMode) {
|
|
3067
|
-
if (typeof devMode === "boolean") return devMode ? {
|
|
3068
|
-
|
|
3347
|
+
if (typeof devMode === "boolean") return devMode ? {
|
|
3348
|
+
implement: getDefaultDevRuntime(),
|
|
3349
|
+
skipCommonRuntimeInjection: true
|
|
3350
|
+
} : void 0;
|
|
3351
|
+
const usesDefaultRuntime = devMode.implement == null;
|
|
3352
|
+
return {
|
|
3353
|
+
...devMode,
|
|
3354
|
+
implement: devMode.implement ?? getDefaultDevRuntime(devMode.host, devMode.port),
|
|
3355
|
+
skipCommonRuntimeInjection: usesDefaultRuntime ? true : devMode.skipCommonRuntimeInjection
|
|
3356
|
+
};
|
|
3069
3357
|
}
|
|
3070
3358
|
}
|
|
3071
3359
|
function bindingifyAttachDebugInfo(attachDebugInfo) {
|
|
3072
3360
|
switch (attachDebugInfo) {
|
|
3073
3361
|
case void 0: return;
|
|
3074
|
-
case "full": return import_binding$
|
|
3075
|
-
case "simple": return import_binding$
|
|
3076
|
-
case "none": return import_binding$
|
|
3362
|
+
case "full": return import_binding$4.BindingAttachDebugInfo.Full;
|
|
3363
|
+
case "simple": return import_binding$4.BindingAttachDebugInfo.Simple;
|
|
3364
|
+
case "none": return import_binding$4.BindingAttachDebugInfo.None;
|
|
3077
3365
|
}
|
|
3078
3366
|
}
|
|
3079
|
-
function bindingifyExternal(external) {
|
|
3367
|
+
function bindingifyExternal(external, timings) {
|
|
3080
3368
|
if (external) {
|
|
3081
|
-
if (typeof external === "function")
|
|
3082
|
-
|
|
3083
|
-
return
|
|
3084
|
-
|
|
3369
|
+
if (typeof external === "function") {
|
|
3370
|
+
const measured = measureHookCost(timings, INPUT_OPTIONS_OWNER, "external", external);
|
|
3371
|
+
return (id, importer, isResolved) => {
|
|
3372
|
+
if (id.startsWith("\0")) return false;
|
|
3373
|
+
return measured(id, importer, isResolved) ?? false;
|
|
3374
|
+
};
|
|
3375
|
+
}
|
|
3085
3376
|
return arraify(external);
|
|
3086
3377
|
}
|
|
3087
3378
|
}
|
|
3088
3379
|
function bindingifyExperimental(experimental) {
|
|
3089
|
-
let chunkModulesOrder = import_binding$
|
|
3380
|
+
let chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
|
|
3090
3381
|
if (experimental?.chunkModulesOrder) switch (experimental.chunkModulesOrder) {
|
|
3091
3382
|
case "exec-order":
|
|
3092
|
-
chunkModulesOrder = import_binding$
|
|
3383
|
+
chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ExecOrder;
|
|
3093
3384
|
break;
|
|
3094
3385
|
case "module-id":
|
|
3095
|
-
chunkModulesOrder = import_binding$
|
|
3386
|
+
chunkModulesOrder = import_binding$4.BindingChunkModuleOrderBy.ModuleId;
|
|
3096
3387
|
break;
|
|
3097
3388
|
default: throw new Error(`Unexpected chunkModulesOrder: ${experimental.chunkModulesOrder}`);
|
|
3098
3389
|
}
|
|
@@ -3152,10 +3443,10 @@ function bindingifyInject(inject) {
|
|
|
3152
3443
|
}
|
|
3153
3444
|
function bindingifyLogLevel(logLevel) {
|
|
3154
3445
|
switch (logLevel) {
|
|
3155
|
-
case "silent": return import_binding$
|
|
3156
|
-
case "debug": return import_binding$
|
|
3157
|
-
case "warn": return import_binding$
|
|
3158
|
-
case "info": return import_binding$
|
|
3446
|
+
case "silent": return import_binding$4.BindingLogLevel.Silent;
|
|
3447
|
+
case "debug": return import_binding$4.BindingLogLevel.Debug;
|
|
3448
|
+
case "warn": return import_binding$4.BindingLogLevel.Warn;
|
|
3449
|
+
case "info": return import_binding$4.BindingLogLevel.Info;
|
|
3159
3450
|
default: throw new Error(`Unexpected log level: ${logLevel}`);
|
|
3160
3451
|
}
|
|
3161
3452
|
}
|
|
@@ -3172,11 +3463,7 @@ function bindingifyInput(input) {
|
|
|
3172
3463
|
}
|
|
3173
3464
|
function bindingifyWatch(watch) {
|
|
3174
3465
|
if (watch) {
|
|
3175
|
-
|
|
3176
|
-
const watcher = {
|
|
3177
|
-
...watch.notify,
|
|
3178
|
-
...watch.watcher
|
|
3179
|
-
};
|
|
3466
|
+
const watcher = watch.watcher ?? {};
|
|
3180
3467
|
return {
|
|
3181
3468
|
buildDelay: watch.buildDelay,
|
|
3182
3469
|
skipWrite: watch.skipWrite,
|
|
@@ -3192,7 +3479,7 @@ function bindingifyWatch(watch) {
|
|
|
3192
3479
|
};
|
|
3193
3480
|
}
|
|
3194
3481
|
}
|
|
3195
|
-
function bindingifyTreeshakeOptions(config) {
|
|
3482
|
+
function bindingifyTreeshakeOptions(config, timings) {
|
|
3196
3483
|
if (config === false) return;
|
|
3197
3484
|
if (config === true || config === void 0) return { moduleSideEffects: true };
|
|
3198
3485
|
let normalizedConfig = {
|
|
@@ -3205,21 +3492,15 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
3205
3492
|
};
|
|
3206
3493
|
switch (config.propertyReadSideEffects) {
|
|
3207
3494
|
case "always":
|
|
3208
|
-
normalizedConfig.propertyReadSideEffects = import_binding$
|
|
3495
|
+
normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.Always;
|
|
3209
3496
|
break;
|
|
3210
|
-
case false:
|
|
3211
|
-
normalizedConfig.propertyReadSideEffects = import_binding$3.BindingPropertyReadSideEffects.False;
|
|
3212
|
-
break;
|
|
3213
|
-
default:
|
|
3497
|
+
case false: normalizedConfig.propertyReadSideEffects = import_binding$4.BindingPropertyReadSideEffects.False;
|
|
3214
3498
|
}
|
|
3215
3499
|
switch (config.propertyWriteSideEffects) {
|
|
3216
3500
|
case "always":
|
|
3217
|
-
normalizedConfig.propertyWriteSideEffects = import_binding$
|
|
3218
|
-
break;
|
|
3219
|
-
case false:
|
|
3220
|
-
normalizedConfig.propertyWriteSideEffects = import_binding$3.BindingPropertyWriteSideEffects.False;
|
|
3501
|
+
normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.Always;
|
|
3221
3502
|
break;
|
|
3222
|
-
|
|
3503
|
+
case false: normalizedConfig.propertyWriteSideEffects = import_binding$4.BindingPropertyWriteSideEffects.False;
|
|
3223
3504
|
}
|
|
3224
3505
|
if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
|
|
3225
3506
|
else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
|
|
@@ -3229,7 +3510,7 @@ function bindingifyTreeshakeOptions(config) {
|
|
|
3229
3510
|
external: false,
|
|
3230
3511
|
sideEffects: true
|
|
3231
3512
|
}];
|
|
3232
|
-
else normalizedConfig.moduleSideEffects = config.moduleSideEffects;
|
|
3513
|
+
else normalizedConfig.moduleSideEffects = measureIfFunction(timings, INPUT_OPTIONS_OWNER, "treeshake.moduleSideEffects", config.moduleSideEffects);
|
|
3233
3514
|
return normalizedConfig;
|
|
3234
3515
|
}
|
|
3235
3516
|
function bindingifyMakeAbsoluteExternalsRelative(makeAbsoluteExternalsRelative) {
|
|
@@ -3251,8 +3532,7 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
|
|
|
3251
3532
|
};
|
|
3252
3533
|
}
|
|
3253
3534
|
//#endregion
|
|
3254
|
-
//#region ../../node_modules/rolldown/dist/shared/
|
|
3255
|
-
var import_binding$2 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
3535
|
+
//#region ../../node_modules/rolldown/dist/shared/create-bundler-option-kXHnIt4b.mjs
|
|
3256
3536
|
function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
3257
3537
|
const minimalPriority = logLevelPriority[logLevel];
|
|
3258
3538
|
const logger = (level, log, skipped = /* @__PURE__ */ new Set()) => {
|
|
@@ -3271,7 +3551,7 @@ function getLogger(plugins, onLog, logLevel, watchMode) {
|
|
|
3271
3551
|
info: getLogHandler("info"),
|
|
3272
3552
|
meta: {
|
|
3273
3553
|
rollupVersion: "4.23.0",
|
|
3274
|
-
rolldownVersion: "1.
|
|
3554
|
+
rolldownVersion: "1.2.8",
|
|
3275
3555
|
watchMode
|
|
3276
3556
|
},
|
|
3277
3557
|
warn: getLogHandler("warn"),
|
|
@@ -3345,7 +3625,8 @@ var ENUMERATED_OUTPUT_PLUGIN_HOOK_NAMES = [
|
|
|
3345
3625
|
"renderStart",
|
|
3346
3626
|
"renderError",
|
|
3347
3627
|
"writeBundle",
|
|
3348
|
-
"generateBundle"
|
|
3628
|
+
"generateBundle",
|
|
3629
|
+
"resolveFileUrl"
|
|
3349
3630
|
];
|
|
3350
3631
|
var ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
3351
3632
|
...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES,
|
|
@@ -3355,7 +3636,13 @@ var ENUMERATED_PLUGIN_HOOK_NAMES = [
|
|
|
3355
3636
|
"intro",
|
|
3356
3637
|
"outro"
|
|
3357
3638
|
];
|
|
3358
|
-
ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22];
|
|
3639
|
+
ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[0], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[1], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[2], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[3], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[4], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[5], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[6], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[7], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[8], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[9], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[10], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[11], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[12], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[13], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[14], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[15], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[16], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[17], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[18], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[19], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[20], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[21], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[22], ENUMERATED_PLUGIN_HOOK_NAMES[23], ENUMERATED_PLUGIN_HOOK_NAMES[23];
|
|
3640
|
+
/**
|
|
3641
|
+
* Names of the hidden hooks, alongside {@linkcode InternalFunctionPluginHooks}.
|
|
3642
|
+
* Kept separate from `ENUMERATED_INPUT_PLUGIN_HOOK_NAMES` so the names stay out
|
|
3643
|
+
* of the published `.d.ts` (that list's type is reachable from public types).
|
|
3644
|
+
*/
|
|
3645
|
+
var INTERNAL_PLUGIN_HOOK_NAMES = ["hotUpdate"];
|
|
3359
3646
|
async function asyncFlatten(array) {
|
|
3360
3647
|
do
|
|
3361
3648
|
array = (await Promise.all(array)).flat(Infinity);
|
|
@@ -3364,7 +3651,7 @@ async function asyncFlatten(array) {
|
|
|
3364
3651
|
}
|
|
3365
3652
|
var normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
3366
3653
|
function checkOutputPluginOption(plugins, onLog) {
|
|
3367
|
-
for (const plugin of plugins) for (const hook of ENUMERATED_INPUT_PLUGIN_HOOK_NAMES) if (hook in plugin) {
|
|
3654
|
+
for (const plugin of plugins) for (const hook of [...ENUMERATED_INPUT_PLUGIN_HOOK_NAMES, ...INTERNAL_PLUGIN_HOOK_NAMES]) if (hook in plugin) {
|
|
3368
3655
|
delete plugin[hook];
|
|
3369
3656
|
onLog(LOG_LEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
|
|
3370
3657
|
}
|
|
@@ -3372,9 +3659,10 @@ function checkOutputPluginOption(plugins, onLog) {
|
|
|
3372
3659
|
}
|
|
3373
3660
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
3374
3661
|
for (const [index, plugin] of plugins.entries()) {
|
|
3375
|
-
if (
|
|
3662
|
+
if (getParallelPluginInfo(plugin)) continue;
|
|
3376
3663
|
if (plugin instanceof BuiltinPlugin) continue;
|
|
3377
|
-
|
|
3664
|
+
const objectPlugin = plugin;
|
|
3665
|
+
if (!objectPlugin.name) objectPlugin.name = `${anonymousPrefix}${index + 1}`;
|
|
3378
3666
|
}
|
|
3379
3667
|
return plugins;
|
|
3380
3668
|
}
|
|
@@ -3413,7 +3701,7 @@ var PluginDriver = class {
|
|
|
3413
3701
|
function getObjectPlugins(plugins) {
|
|
3414
3702
|
return plugins.filter((plugin) => {
|
|
3415
3703
|
if (!plugin) return;
|
|
3416
|
-
if (
|
|
3704
|
+
if (getParallelPluginInfo(plugin)) return;
|
|
3417
3705
|
if (plugin instanceof BuiltinPlugin) return;
|
|
3418
3706
|
return plugin;
|
|
3419
3707
|
});
|
|
@@ -4655,7 +4943,8 @@ var ChecksOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
4655
4943
|
unsupportedTsconfigOption: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a tsconfig option or combination of options is not supported")),
|
|
4656
4944
|
ineffectiveDynamicImport: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a module is dynamically imported but also statically imported, making the dynamic import ineffective for code splitting")),
|
|
4657
4945
|
largeBarrelModules: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit info logs when a barrel module has a very large number of re-exports (more than 5000)")),
|
|
4658
|
-
sourcemapBroken: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin transforms code without generating a sourcemap"))
|
|
4946
|
+
sourcemapBroken: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when a plugin transforms code without generating a sourcemap")),
|
|
4947
|
+
namespaceConflict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Whether to emit warnings when multiple star re-exports provide the same name from different modules"))
|
|
4659
4948
|
});
|
|
4660
4949
|
var MinifyOptionsSchema = /* @__PURE__ */ strictObject({
|
|
4661
4950
|
compress: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
@@ -4686,8 +4975,17 @@ var MinifyOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
4686
4975
|
function: /* @__PURE__ */ boolean(),
|
|
4687
4976
|
class: /* @__PURE__ */ boolean()
|
|
4688
4977
|
})])),
|
|
4978
|
+
reserved: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
4689
4979
|
debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
4690
4980
|
})])),
|
|
4981
|
+
mangleProps: /* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
|
|
4982
|
+
include: /* @__PURE__ */ instance(RegExp),
|
|
4983
|
+
exclude: /* @__PURE__ */ optional(/* @__PURE__ */ instance(RegExp)),
|
|
4984
|
+
reserved: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ string())),
|
|
4985
|
+
quoted: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
4986
|
+
debug: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
4987
|
+
cache: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ literal(false)])))
|
|
4988
|
+
})),
|
|
4691
4989
|
codegen: /* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
4692
4990
|
removeWhitespace: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
4693
4991
|
legalComments: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
@@ -4744,6 +5042,7 @@ var DevModeSchema = /* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE
|
|
|
4744
5042
|
port: /* @__PURE__ */ optional(/* @__PURE__ */ number()),
|
|
4745
5043
|
host: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
4746
5044
|
implement: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
|
|
5045
|
+
skipCommonRuntimeInjection: /* @__PURE__ */ optional(/* @__PURE__ */ boolean()),
|
|
4747
5046
|
lazy: /* @__PURE__ */ optional(/* @__PURE__ */ boolean())
|
|
4748
5047
|
})]);
|
|
4749
5048
|
var InputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
@@ -4893,6 +5192,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
4893
5192
|
/* @__PURE__ */ literal("hidden")
|
|
4894
5193
|
])), /* @__PURE__ */ description(`Generate sourcemap (\`-s inline\` for inline, or \`-s\` for \`.map\` file)`)),
|
|
4895
5194
|
sourcemapBaseUrl: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ description("Base URL used to prefix sourcemap paths")),
|
|
5195
|
+
sourcemapFileNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(ChunkFileNamesSchema), /* @__PURE__ */ description("Name pattern for emitted sourcemaps")),
|
|
4896
5196
|
sourcemapDebugIds: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Inject sourcemap debug IDs")),
|
|
4897
5197
|
sourcemapExcludeSources: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Exclude source content from sourcemaps")),
|
|
4898
5198
|
sourcemapIgnoreList: /* @__PURE__ */ optional(/* @__PURE__ */ union([
|
|
@@ -4944,7 +5244,7 @@ var OutputOptionsSchema = /* @__PURE__ */ strictObject({
|
|
|
4944
5244
|
topLevelVar: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Rewrite top-level declarations to use `var`.")),
|
|
4945
5245
|
cleanDir: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Clean output directory before emitting output")),
|
|
4946
5246
|
keepNames: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Keep function and class names after bundling")),
|
|
4947
|
-
strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("
|
|
5247
|
+
strictExecutionOrder: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ boolean()), /* @__PURE__ */ description("Preserve source module execution order across generated chunks.")),
|
|
4948
5248
|
strict: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ literal("auto")])), /* @__PURE__ */ description("Whether to always output `\"use strict\"` directive in non-ES module outputs."))
|
|
4949
5249
|
});
|
|
4950
5250
|
var getAddonDescription = (placement, wrapper) => {
|
|
@@ -4966,7 +5266,7 @@ var OutputCliOverrideSchema = /* @__PURE__ */ strictObject({
|
|
|
4966
5266
|
codeSplitting: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ union([/* @__PURE__ */ boolean(), /* @__PURE__ */ strictObject({
|
|
4967
5267
|
minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
|
|
4968
5268
|
minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
|
|
4969
|
-
})])), /* @__PURE__ */ description("Code splitting options
|
|
5269
|
+
})])), /* @__PURE__ */ description("Code splitting options. Enabled by default; use `--no-codeSplitting` to disable, or `--codeSplitting.minSize` / `--codeSplitting.minShareCount` to configure")),
|
|
4970
5270
|
advancedChunks: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ strictObject({
|
|
4971
5271
|
minSize: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum size of the chunk")),
|
|
4972
5272
|
minShareCount: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ number()), /* @__PURE__ */ description("Minimum share count of the chunk"))
|
|
@@ -5000,52 +5300,48 @@ function validateOption(key, options) {
|
|
|
5000
5300
|
let issueMsg = issue.message;
|
|
5001
5301
|
const issuePaths = issue.path.map((path) => path.key);
|
|
5002
5302
|
if (issue.type === "union") {
|
|
5003
|
-
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
5004
|
-
if (subIssue) {
|
|
5005
|
-
if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
|
|
5006
|
-
issueMsg = subIssue.message;
|
|
5007
|
-
}
|
|
5008
|
-
}
|
|
5009
|
-
const stringPath = issuePaths.join(".");
|
|
5010
|
-
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
5011
|
-
if (helper && helper.ignored) return "";
|
|
5012
|
-
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
5013
|
-
}).filter(Boolean);
|
|
5014
|
-
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
5015
|
-
}
|
|
5016
|
-
}
|
|
5017
|
-
var RolldownOutputImpl = class extends PlainObjectLike {
|
|
5018
|
-
bindingOutputs;
|
|
5019
|
-
constructor(bindingOutputs) {
|
|
5020
|
-
super();
|
|
5021
|
-
this.bindingOutputs = bindingOutputs;
|
|
5022
|
-
}
|
|
5023
|
-
get output() {
|
|
5024
|
-
return transformToRollupOutput(this.bindingOutputs).output;
|
|
5025
|
-
}
|
|
5026
|
-
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
5027
|
-
const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
|
|
5028
|
-
if (!results.every((r) => r.freed)) {
|
|
5029
|
-
const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
|
|
5030
|
-
return {
|
|
5031
|
-
freed: false,
|
|
5032
|
-
reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
|
|
5033
|
-
};
|
|
5034
|
-
}
|
|
5035
|
-
return { freed: true };
|
|
5303
|
+
const subIssue = issue.issues?.find((i) => !(i.type !== issue.received && i.input === issue.input));
|
|
5304
|
+
if (subIssue) {
|
|
5305
|
+
if (subIssue.path) issuePaths.push(subIssue.path.map((path) => path.key));
|
|
5306
|
+
issueMsg = subIssue.message;
|
|
5307
|
+
}
|
|
5308
|
+
}
|
|
5309
|
+
const stringPath = issuePaths.join(".");
|
|
5310
|
+
const helper = key === "input" ? inputHelperMsgRecord[stringPath] : outputHelperMsgRecord[stringPath];
|
|
5311
|
+
if (helper && helper.ignored) return "";
|
|
5312
|
+
return `- For the "${stringPath}". ${helper?.issueMsg || issueMsg + "."} ${helper?.help ? `\n Help: ${helper.help}` : ""}`;
|
|
5313
|
+
}).filter(Boolean);
|
|
5314
|
+
if (errors.length) console.warn(`\x1b[33mWarning: Invalid ${key} options (${errors.length} issue${errors.length === 1 ? "" : "s"} found)\n${errors.join("\n")}\x1b[0m`);
|
|
5036
5315
|
}
|
|
5037
|
-
}
|
|
5038
|
-
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
|
|
5316
|
+
}
|
|
5039
5317
|
var ChunkingContextImpl = class {
|
|
5040
5318
|
context;
|
|
5041
5319
|
pluginContextData;
|
|
5320
|
+
moduleInfoCache = /* @__PURE__ */ new Map();
|
|
5042
5321
|
constructor(context, pluginContextData) {
|
|
5043
5322
|
this.context = context;
|
|
5044
5323
|
this.pluginContextData = pluginContextData;
|
|
5045
5324
|
}
|
|
5325
|
+
clearModuleInfoCache() {
|
|
5326
|
+
this.moduleInfoCache = void 0;
|
|
5327
|
+
}
|
|
5046
5328
|
getModuleInfo(moduleId) {
|
|
5329
|
+
const cached = this.moduleInfoCache?.get(moduleId);
|
|
5330
|
+
if (cached) return cached;
|
|
5047
5331
|
const bindingInfo = this.context.getModuleInfo(moduleId);
|
|
5048
|
-
if (bindingInfo)
|
|
5332
|
+
if (bindingInfo) {
|
|
5333
|
+
const option = this.pluginContextData.getModuleOption(moduleId);
|
|
5334
|
+
const info = transformModuleInfo(bindingInfo, option);
|
|
5335
|
+
Object.defineProperty(info, "moduleSideEffects", {
|
|
5336
|
+
get: () => option.moduleSideEffects,
|
|
5337
|
+
set: (moduleSideEffects) => {
|
|
5338
|
+
option.moduleSideEffects = moduleSideEffects;
|
|
5339
|
+
option.invalidate = true;
|
|
5340
|
+
}
|
|
5341
|
+
});
|
|
5342
|
+
this.moduleInfoCache?.set(moduleId, info);
|
|
5343
|
+
return info;
|
|
5344
|
+
}
|
|
5049
5345
|
return null;
|
|
5050
5346
|
}
|
|
5051
5347
|
};
|
|
@@ -5458,10 +5754,11 @@ ${indent}`);
|
|
|
5458
5754
|
return causedPrefix + message + "\n" + stack + causedError;
|
|
5459
5755
|
}
|
|
5460
5756
|
formatArgs(args, opts) {
|
|
5461
|
-
|
|
5757
|
+
const _args = args.map((arg) => {
|
|
5462
5758
|
if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
|
|
5463
5759
|
return arg;
|
|
5464
|
-
})
|
|
5760
|
+
});
|
|
5761
|
+
return formatWithOptions(opts, ..._args);
|
|
5465
5762
|
}
|
|
5466
5763
|
formatDate(date, opts) {
|
|
5467
5764
|
return opts.date ? date.toLocaleTimeString() : "";
|
|
@@ -5675,13 +5972,15 @@ function box(text, _opts = {}) {
|
|
|
5675
5972
|
if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
|
|
5676
5973
|
return boxLines.join("\n");
|
|
5677
5974
|
}
|
|
5678
|
-
var r = Object.create(null)
|
|
5975
|
+
var r = Object.create(null);
|
|
5976
|
+
var i = (e) => globalThis.process?.env || {
|
|
5679
5977
|
"BASE_URL": "/",
|
|
5680
5978
|
"DEV": false,
|
|
5681
5979
|
"MODE": "production",
|
|
5682
5980
|
"PROD": true,
|
|
5683
5981
|
"SSR": false
|
|
5684
|
-
}
|
|
5982
|
+
};
|
|
5983
|
+
var o = new Proxy(r, {
|
|
5685
5984
|
get(e, s) {
|
|
5686
5985
|
return i()[s] ?? r[s];
|
|
5687
5986
|
},
|
|
@@ -5701,7 +6000,9 @@ var r = Object.create(null), i = (e) => globalThis.process?.env || {
|
|
|
5701
6000
|
const e = i(true);
|
|
5702
6001
|
return Object.keys(e);
|
|
5703
6002
|
}
|
|
5704
|
-
})
|
|
6003
|
+
});
|
|
6004
|
+
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
6005
|
+
var f = [
|
|
5705
6006
|
["APPVEYOR"],
|
|
5706
6007
|
[
|
|
5707
6008
|
"AWS_AMPLIFY",
|
|
@@ -5813,19 +6114,31 @@ l.name;
|
|
|
5813
6114
|
function n(e) {
|
|
5814
6115
|
return e ? e !== "false" : false;
|
|
5815
6116
|
}
|
|
5816
|
-
var I = globalThis.process?.platform || ""
|
|
6117
|
+
var I = globalThis.process?.platform || "";
|
|
6118
|
+
var T = n(o.CI) || l.ci !== false;
|
|
6119
|
+
var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
6120
|
+
var g = n(o.DEBUG);
|
|
6121
|
+
var R = t === "test" || n(o.TEST);
|
|
5817
6122
|
o.MINIMAL;
|
|
5818
6123
|
var A = /^win/i.test(I);
|
|
5819
6124
|
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
|
|
5820
6125
|
var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
5821
6126
|
Number(C?.split(".")[0]);
|
|
5822
|
-
var y = globalThis.process || Object.create(null)
|
|
6127
|
+
var y = globalThis.process || Object.create(null);
|
|
6128
|
+
var _ = { versions: {} };
|
|
5823
6129
|
new Proxy(y, { get(e, s) {
|
|
5824
6130
|
if (s === "env") return o;
|
|
5825
6131
|
if (s in e) return e[s];
|
|
5826
6132
|
if (s in _) return _[s];
|
|
5827
6133
|
} });
|
|
5828
|
-
var c = globalThis.process?.release?.name === "node"
|
|
6134
|
+
var c = globalThis.process?.release?.name === "node";
|
|
6135
|
+
var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
|
|
6136
|
+
var D = !!globalThis.Deno;
|
|
6137
|
+
var L = !!globalThis.fastly;
|
|
6138
|
+
var S = !!globalThis.Netlify;
|
|
6139
|
+
var u = !!globalThis.EdgeRuntime;
|
|
6140
|
+
var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
|
|
6141
|
+
var F = [
|
|
5829
6142
|
[S, "netlify"],
|
|
5830
6143
|
[u, "edge-light"],
|
|
5831
6144
|
[N, "workerd"],
|
|
@@ -5983,7 +6296,7 @@ function createConsola(options = {}) {
|
|
|
5983
6296
|
defaults: { level },
|
|
5984
6297
|
stdout: process.stdout,
|
|
5985
6298
|
stderr: process.stderr,
|
|
5986
|
-
prompt: (...args) => import("./prompt-
|
|
6299
|
+
prompt: (...args) => import("./prompt-CH6TK0bC.mjs").then((m) => m.prompt(...args)),
|
|
5987
6300
|
reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
5988
6301
|
...options
|
|
5989
6302
|
});
|
|
@@ -6019,10 +6332,10 @@ function createTestingLogger() {
|
|
|
6019
6332
|
for (const type of types) ret[type] = (...args) => console.log(...args);
|
|
6020
6333
|
return ret;
|
|
6021
6334
|
}
|
|
6022
|
-
function bindingifyOutputOptions(outputOptions, pluginContextData) {
|
|
6023
|
-
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
|
|
6335
|
+
function bindingifyOutputOptions(outputOptions, pluginContextData, timings) {
|
|
6336
|
+
const { dir, format, exports, hashCharacters, sourcemap, sourcemapBaseUrl, sourcemapDebugIds, sourcemapFileNames, sourcemapExcludeSources, sourcemapIgnoreList, sourcemapPathTransform, name, assetFileNames, entryFileNames, chunkFileNames, banner, footer, postBanner, postFooter, intro, outro, esModule, globals, paths, generatedCode, file, sanitizeFileName, preserveModules, virtualDirname, legalComments, comments, preserveModulesRoot, manualChunks, topLevelVar, cleanDir, strictExecutionOrder } = outputOptions;
|
|
6024
6337
|
if (legalComments != null) logger.warn("`legalComments` option is deprecated, please use `comments.legal` instead.");
|
|
6025
|
-
const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData);
|
|
6338
|
+
const { inlineDynamicImports, advancedChunks } = bindingifyCodeSplitting(outputOptions.codeSplitting, outputOptions.inlineDynamicImports, outputOptions.advancedChunks, manualChunks, pluginContextData, timings);
|
|
6026
6339
|
return {
|
|
6027
6340
|
dir,
|
|
6028
6341
|
file: file == null ? void 0 : file,
|
|
@@ -6032,24 +6345,25 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
|
|
|
6032
6345
|
sourcemap: bindingifySourcemap(sourcemap),
|
|
6033
6346
|
sourcemapBaseUrl,
|
|
6034
6347
|
sourcemapDebugIds,
|
|
6348
|
+
sourcemapFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapFileNames", sourcemapFileNames),
|
|
6035
6349
|
sourcemapExcludeSources,
|
|
6036
|
-
sourcemapIgnoreList: sourcemapIgnoreList ?? /node_modules
|
|
6037
|
-
sourcemapPathTransform,
|
|
6038
|
-
banner: bindingifyAddon(banner),
|
|
6039
|
-
footer: bindingifyAddon(footer),
|
|
6040
|
-
postBanner: bindingifyAddon(postBanner),
|
|
6041
|
-
postFooter: bindingifyAddon(postFooter),
|
|
6042
|
-
intro: bindingifyAddon(intro),
|
|
6043
|
-
outro: bindingifyAddon(outro),
|
|
6350
|
+
sourcemapIgnoreList: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapIgnoreList", sourcemapIgnoreList ?? /node_modules/),
|
|
6351
|
+
sourcemapPathTransform: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sourcemapPathTransform", sourcemapPathTransform),
|
|
6352
|
+
banner: bindingifyAddon(banner, "banner", timings),
|
|
6353
|
+
footer: bindingifyAddon(footer, "footer", timings),
|
|
6354
|
+
postBanner: bindingifyAddon(postBanner, "postBanner", timings),
|
|
6355
|
+
postFooter: bindingifyAddon(postFooter, "postFooter", timings),
|
|
6356
|
+
intro: bindingifyAddon(intro, "intro", timings),
|
|
6357
|
+
outro: bindingifyAddon(outro, "outro", timings),
|
|
6044
6358
|
extend: outputOptions.extend,
|
|
6045
|
-
globals,
|
|
6046
|
-
paths,
|
|
6359
|
+
globals: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "globals", globals),
|
|
6360
|
+
paths: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "paths", paths),
|
|
6047
6361
|
generatedCode,
|
|
6048
6362
|
esModule,
|
|
6049
6363
|
name,
|
|
6050
6364
|
assetFileNames: bindingifyAssetFilenames(assetFileNames),
|
|
6051
|
-
entryFileNames,
|
|
6052
|
-
chunkFileNames,
|
|
6365
|
+
entryFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "entryFileNames", entryFileNames),
|
|
6366
|
+
chunkFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "chunkFileNames", chunkFileNames),
|
|
6053
6367
|
plugins: [],
|
|
6054
6368
|
minify: outputOptions.minify,
|
|
6055
6369
|
externalLiveBindings: outputOptions.externalLiveBindings,
|
|
@@ -6070,9 +6384,12 @@ function bindingifyOutputOptions(outputOptions, pluginContextData) {
|
|
|
6070
6384
|
strict: outputOptions.strict
|
|
6071
6385
|
};
|
|
6072
6386
|
}
|
|
6073
|
-
function bindingifyAddon(configAddon) {
|
|
6387
|
+
function bindingifyAddon(configAddon, name, timings) {
|
|
6074
6388
|
if (configAddon == null || configAddon === "") return;
|
|
6075
|
-
if (typeof configAddon === "function")
|
|
6389
|
+
if (typeof configAddon === "function") {
|
|
6390
|
+
const measured = measureHookCost(timings, OUTPUT_OPTIONS_OWNER, name, configAddon);
|
|
6391
|
+
return async (chunk) => measured(transformRenderedChunk(chunk));
|
|
6392
|
+
}
|
|
6076
6393
|
return configAddon;
|
|
6077
6394
|
}
|
|
6078
6395
|
function bindingifyFormat(format) {
|
|
@@ -6116,7 +6433,7 @@ function bindingifyComments(comments) {
|
|
|
6116
6433
|
if (typeof comments === "boolean") return comments;
|
|
6117
6434
|
return comments;
|
|
6118
6435
|
}
|
|
6119
|
-
function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData) {
|
|
6436
|
+
function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, advancedChunks, manualChunks, pluginContextData, timings) {
|
|
6120
6437
|
let inlineDynamicImports;
|
|
6121
6438
|
let effectiveChunksOption;
|
|
6122
6439
|
if (codeSplitting === false) {
|
|
@@ -6156,13 +6473,20 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
|
|
|
6156
6473
|
let advancedChunksResult;
|
|
6157
6474
|
if (effectiveChunksOption != null) {
|
|
6158
6475
|
const { groups, ...restOptions } = effectiveChunksOption;
|
|
6476
|
+
let chunkingContext;
|
|
6477
|
+
const getChunkingContext = (bindingContext) => chunkingContext ??= new ChunkingContextImpl(bindingContext, pluginContextData);
|
|
6159
6478
|
advancedChunksResult = {
|
|
6160
6479
|
...restOptions,
|
|
6480
|
+
internalInvalidateModuleInfoCache: () => {
|
|
6481
|
+
chunkingContext?.clearModuleInfoCache();
|
|
6482
|
+
chunkingContext = void 0;
|
|
6483
|
+
},
|
|
6161
6484
|
groups: groups?.map((group) => {
|
|
6162
|
-
const { name, ...restGroup } = group;
|
|
6485
|
+
const { name, test, ...restGroup } = group;
|
|
6163
6486
|
return {
|
|
6164
6487
|
...restGroup,
|
|
6165
|
-
|
|
6488
|
+
test: typeof test === "function" ? batchTest(measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].test", test)) : test,
|
|
6489
|
+
name: typeof name === "function" ? batchName(measureHookCost(timings, OUTPUT_OPTIONS_OWNER, "codeSplitting groups[].name", name), getChunkingContext) : name
|
|
6166
6490
|
};
|
|
6167
6491
|
})
|
|
6168
6492
|
};
|
|
@@ -6172,19 +6496,57 @@ function bindingifyCodeSplitting(codeSplitting, inlineDynamicImportsOption, adva
|
|
|
6172
6496
|
advancedChunks: advancedChunksResult
|
|
6173
6497
|
};
|
|
6174
6498
|
}
|
|
6499
|
+
/**
|
|
6500
|
+
* Wraps a per-id `test` in the batched shim that the binding expects.
|
|
6501
|
+
*
|
|
6502
|
+
* The loop runs in JS so that a group makes one napi crossing, not one per module.
|
|
6503
|
+
*
|
|
6504
|
+
* The result is a `Uint8Array`, which crosses as a buffer instead of one tagged value per id.
|
|
6505
|
+
*/
|
|
6506
|
+
function batchTest(test) {
|
|
6507
|
+
return (ids) => {
|
|
6508
|
+
const results = new Uint8Array(ids.length);
|
|
6509
|
+
for (let index = 0; index < ids.length; index++) {
|
|
6510
|
+
const result = test(ids[index]);
|
|
6511
|
+
if (result != null && typeof result !== "boolean") throw new TypeError(`\`output.codeSplitting.groups[].test\` returned ${typeof result} for module "${ids[index]}", but expected a boolean, null or undefined.`);
|
|
6512
|
+
results[index] = result === true ? 1 : 0;
|
|
6513
|
+
}
|
|
6514
|
+
return results;
|
|
6515
|
+
};
|
|
6516
|
+
}
|
|
6517
|
+
/**
|
|
6518
|
+
* This is the `name` equivalent of {@linkcode batchTest}. All groups in a chunking pass share
|
|
6519
|
+
* a context so repeated module queries reuse their JavaScript values.
|
|
6520
|
+
*/
|
|
6521
|
+
function batchName(name, getChunkingContext) {
|
|
6522
|
+
return (ids, bindingContext) => {
|
|
6523
|
+
const context = getChunkingContext(bindingContext);
|
|
6524
|
+
const results = [];
|
|
6525
|
+
for (let index = 0; index < ids.length; index++) {
|
|
6526
|
+
const result = name(ids[index], context);
|
|
6527
|
+
if (result != null && typeof result !== "string") throw new TypeError(`\`output.codeSplitting.groups[].name\` returned ${typeof result} for module "${ids[index]}", but expected a string, null or undefined.`);
|
|
6528
|
+
results.push(result);
|
|
6529
|
+
}
|
|
6530
|
+
return results;
|
|
6531
|
+
};
|
|
6532
|
+
}
|
|
6533
|
+
var import_binding$3 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
6175
6534
|
async function initializeParallelPlugins(plugins) {
|
|
6176
6535
|
const pluginInfos = [];
|
|
6177
|
-
for (const [index, plugin] of plugins.entries())
|
|
6178
|
-
const
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6536
|
+
for (const [index, plugin] of plugins.entries()) {
|
|
6537
|
+
const parallel = getParallelPluginInfo(plugin);
|
|
6538
|
+
if (parallel) {
|
|
6539
|
+
const { fileUrl, options } = parallel;
|
|
6540
|
+
pluginInfos.push({
|
|
6541
|
+
index,
|
|
6542
|
+
fileUrl,
|
|
6543
|
+
options
|
|
6544
|
+
});
|
|
6545
|
+
}
|
|
6184
6546
|
}
|
|
6185
6547
|
if (pluginInfos.length <= 0) return;
|
|
6186
6548
|
const count = availableParallelism();
|
|
6187
|
-
const parallelJsPluginRegistry = new import_binding$
|
|
6549
|
+
const parallelJsPluginRegistry = new import_binding$3.ParallelJsPluginRegistry(count);
|
|
6188
6550
|
const registryId = parallelJsPluginRegistry.id;
|
|
6189
6551
|
const workers = await initializeWorkers(registryId, count, pluginInfos);
|
|
6190
6552
|
const stopWorkers = async () => {
|
|
@@ -6231,7 +6593,7 @@ var availableParallelism = () => {
|
|
|
6231
6593
|
}
|
|
6232
6594
|
return Math.min(availableParallelism, 8);
|
|
6233
6595
|
};
|
|
6234
|
-
async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
6596
|
+
async function createBundlerOptions(inputOptions, outputOptions, watchMode, measureTimings = false) {
|
|
6235
6597
|
const inputPlugins = await normalizePluginOption(inputOptions.plugins);
|
|
6236
6598
|
const outputPlugins = await normalizePluginOption(outputOptions.plugins);
|
|
6237
6599
|
const logLevel = inputOptions.logLevel || "info";
|
|
@@ -6241,14 +6603,20 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
6241
6603
|
const normalizedInputPlugins = normalizePlugins(inputPlugins, ANONYMOUS_PLUGIN_PREFIX);
|
|
6242
6604
|
const normalizedOutputPlugins = normalizePlugins(hookOutputPlugins, ANONYMOUS_OUTPUT_PLUGIN_PREFIX);
|
|
6243
6605
|
let plugins = [...normalizedInputPlugins, ...checkOutputPluginOption(normalizedOutputPlugins, onLog)];
|
|
6606
|
+
const timings = measureTimings && inputOptions.checks?.pluginTimings !== false ? pluginTimingsRecorderFor(inputOptions) : void 0;
|
|
6607
|
+
if (timings) outputOptions = {
|
|
6608
|
+
...outputOptions,
|
|
6609
|
+
assetFileNames: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "assetFileNames", outputOptions.assetFileNames),
|
|
6610
|
+
sanitizeFileName: measureIfFunction(timings, OUTPUT_OPTIONS_OWNER, "sanitizeFileName", outputOptions.sanitizeFileName)
|
|
6611
|
+
};
|
|
6244
6612
|
const parallelPluginInitResult = await initializeParallelPlugins(plugins);
|
|
6245
6613
|
if (inputOptions.experimental?.strictExecutionOrder !== void 0) console.warn("`experimental.strictExecutionOrder` has been stabilized and moved to `output.strictExecutionOrder`. Please update your configuration.");
|
|
6246
6614
|
try {
|
|
6247
6615
|
const pluginContextData = new PluginContextData(onLog, outputOptions, normalizedInputPlugins, normalizedOutputPlugins);
|
|
6248
6616
|
return {
|
|
6249
6617
|
bundlerOptions: {
|
|
6250
|
-
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode),
|
|
6251
|
-
outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData),
|
|
6618
|
+
inputOptions: bindingifyInputOptions(plugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode, timings),
|
|
6619
|
+
outputOptions: bindingifyOutputOptions(outputOptions, pluginContextData, timings),
|
|
6252
6620
|
parallelPluginsRegistry: parallelPluginInitResult?.registry
|
|
6253
6621
|
},
|
|
6254
6622
|
inputOptions,
|
|
@@ -6260,113 +6628,8 @@ async function createBundlerOptions(inputOptions, outputOptions, watchMode) {
|
|
|
6260
6628
|
throw e;
|
|
6261
6629
|
}
|
|
6262
6630
|
}
|
|
6263
|
-
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
6264
|
-
/**
|
|
6265
|
-
* The bundle object returned by {@linkcode rolldown} function.
|
|
6266
|
-
*
|
|
6267
|
-
* @category Programmatic APIs
|
|
6268
|
-
*/
|
|
6269
|
-
var RolldownBuild = class RolldownBuild {
|
|
6270
|
-
#inputOptions;
|
|
6271
|
-
#bundler;
|
|
6272
|
-
#stopWorkers;
|
|
6273
|
-
/** @internal */
|
|
6274
|
-
static asyncRuntimeShutdown = false;
|
|
6275
|
-
/** @hidden should not be used directly */
|
|
6276
|
-
constructor(inputOptions) {
|
|
6277
|
-
this.#inputOptions = inputOptions;
|
|
6278
|
-
this.#bundler = new import_binding$2.BindingBundler();
|
|
6279
|
-
}
|
|
6280
|
-
/**
|
|
6281
|
-
* Whether the bundle has been closed.
|
|
6282
|
-
*
|
|
6283
|
-
* If the bundle is closed, calling other methods will throw an error.
|
|
6284
|
-
*/
|
|
6285
|
-
get closed() {
|
|
6286
|
-
return this.#bundler.closed;
|
|
6287
|
-
}
|
|
6288
|
-
/**
|
|
6289
|
-
* Generate bundles in-memory.
|
|
6290
|
-
*
|
|
6291
|
-
* If you directly want to write bundles to disk, use the {@linkcode write} method instead.
|
|
6292
|
-
*
|
|
6293
|
-
* @param outputOptions The output options.
|
|
6294
|
-
* @returns The generated bundle.
|
|
6295
|
-
* @throws {@linkcode BundleError} When an error occurs during the build.
|
|
6296
|
-
*/
|
|
6297
|
-
async generate(outputOptions = {}) {
|
|
6298
|
-
return this.#build(false, outputOptions);
|
|
6299
|
-
}
|
|
6300
|
-
/**
|
|
6301
|
-
* Generate and write bundles to disk.
|
|
6302
|
-
*
|
|
6303
|
-
* If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
|
|
6304
|
-
*
|
|
6305
|
-
* @param outputOptions The output options.
|
|
6306
|
-
* @returns The generated bundle.
|
|
6307
|
-
* @throws {@linkcode BundleError} When an error occurs during the build.
|
|
6308
|
-
*/
|
|
6309
|
-
async write(outputOptions = {}) {
|
|
6310
|
-
return this.#build(true, outputOptions);
|
|
6311
|
-
}
|
|
6312
|
-
/**
|
|
6313
|
-
* Close the bundle and free resources.
|
|
6314
|
-
*
|
|
6315
|
-
* This method should be called even if the {@linkcode generate} method
|
|
6316
|
-
* or the {@linkcode write} method threw an error. It should be called
|
|
6317
|
-
* even if neither of the methods are called.
|
|
6318
|
-
*
|
|
6319
|
-
* This method is called automatically when using `using` syntax.
|
|
6320
|
-
*
|
|
6321
|
-
* @example
|
|
6322
|
-
* ```js
|
|
6323
|
-
* import { rolldown } from 'rolldown';
|
|
6324
|
-
*
|
|
6325
|
-
* {
|
|
6326
|
-
* using bundle = await rolldown({ input: 'src/main.js' });
|
|
6327
|
-
* const output = await bundle.generate({ format: 'esm' });
|
|
6328
|
-
* console.log(output);
|
|
6329
|
-
* // bundle.close() is called automatically here
|
|
6330
|
-
* }
|
|
6331
|
-
* ```
|
|
6332
|
-
*/
|
|
6333
|
-
async close() {
|
|
6334
|
-
await this.#stopWorkers?.();
|
|
6335
|
-
await this.#bundler.close();
|
|
6336
|
-
(0, import_binding$2.shutdownAsyncRuntime)();
|
|
6337
|
-
RolldownBuild.asyncRuntimeShutdown = true;
|
|
6338
|
-
this.#stopWorkers = void 0;
|
|
6339
|
-
}
|
|
6340
|
-
/** @hidden documented in close method */
|
|
6341
|
-
async [Symbol.asyncDispose]() {
|
|
6342
|
-
await this.close();
|
|
6343
|
-
}
|
|
6344
|
-
/**
|
|
6345
|
-
* @experimental
|
|
6346
|
-
* @hidden not ready for public usage yet
|
|
6347
|
-
*/
|
|
6348
|
-
get watchFiles() {
|
|
6349
|
-
return Promise.resolve(this.#bundler.getWatchFiles());
|
|
6350
|
-
}
|
|
6351
|
-
async #build(isWrite, outputOptions) {
|
|
6352
|
-
validateOption("output", outputOptions);
|
|
6353
|
-
await this.#stopWorkers?.();
|
|
6354
|
-
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false);
|
|
6355
|
-
if (RolldownBuild.asyncRuntimeShutdown) (0, import_binding$2.startAsyncRuntime)();
|
|
6356
|
-
try {
|
|
6357
|
-
this.#stopWorkers = option.stopWorkers;
|
|
6358
|
-
let output;
|
|
6359
|
-
if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
|
|
6360
|
-
else output = await this.#bundler.generate(option.bundlerOptions);
|
|
6361
|
-
return new RolldownOutputImpl(unwrapBindingResult(output));
|
|
6362
|
-
} catch (e) {
|
|
6363
|
-
await option.stopWorkers?.();
|
|
6364
|
-
throw e;
|
|
6365
|
-
}
|
|
6366
|
-
}
|
|
6367
|
-
};
|
|
6368
6631
|
//#endregion
|
|
6369
|
-
//#region ../../node_modules/rolldown/dist/shared/watch-
|
|
6632
|
+
//#region ../../node_modules/rolldown/dist/shared/watch-dKH5b9eq.mjs
|
|
6370
6633
|
/**
|
|
6371
6634
|
* This is not the set of all possible signals.
|
|
6372
6635
|
*
|
|
@@ -6573,7 +6836,139 @@ function onExit(...args) {
|
|
|
6573
6836
|
}
|
|
6574
6837
|
require_binding();
|
|
6575
6838
|
//#endregion
|
|
6576
|
-
//#region ../../node_modules/rolldown/dist/shared/rolldown-
|
|
6839
|
+
//#region ../../node_modules/rolldown/dist/shared/rolldown-B-jRyK4b.mjs
|
|
6840
|
+
var import_binding$1 = /* @__PURE__ */ __toESM(require_binding(), 1);
|
|
6841
|
+
var RolldownOutputImpl = class extends PlainObjectLike {
|
|
6842
|
+
bindingOutputs;
|
|
6843
|
+
constructor(bindingOutputs) {
|
|
6844
|
+
super();
|
|
6845
|
+
this.bindingOutputs = bindingOutputs;
|
|
6846
|
+
if (bindingOutputs.mangleCache !== void 0) this.mangleCache = bindingOutputs.mangleCache;
|
|
6847
|
+
}
|
|
6848
|
+
get output() {
|
|
6849
|
+
return transformToRollupOutput(this.bindingOutputs).output;
|
|
6850
|
+
}
|
|
6851
|
+
__rolldown_external_memory_handle__(keepDataAlive) {
|
|
6852
|
+
const results = this.output.map((item) => item.__rolldown_external_memory_handle__(keepDataAlive));
|
|
6853
|
+
if (!results.every((r) => r.freed)) {
|
|
6854
|
+
const reasons = results.filter((r) => !r.freed).map((r) => r.reason).filter(Boolean);
|
|
6855
|
+
return {
|
|
6856
|
+
freed: false,
|
|
6857
|
+
reason: `Failed to free ${reasons.length} item(s): ${reasons.join("; ")}`
|
|
6858
|
+
};
|
|
6859
|
+
}
|
|
6860
|
+
return { freed: true };
|
|
6861
|
+
}
|
|
6862
|
+
};
|
|
6863
|
+
__decorate([lazyProp], RolldownOutputImpl.prototype, "output", null);
|
|
6864
|
+
Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
|
|
6865
|
+
/**
|
|
6866
|
+
* The bundle object returned by {@linkcode rolldown} function.
|
|
6867
|
+
*
|
|
6868
|
+
* @category Programmatic APIs
|
|
6869
|
+
*/
|
|
6870
|
+
var RolldownBuild = class {
|
|
6871
|
+
#inputOptions;
|
|
6872
|
+
#bundler;
|
|
6873
|
+
#stopWorkers;
|
|
6874
|
+
#asyncRuntimeReleased = false;
|
|
6875
|
+
/** @hidden should not be used directly */
|
|
6876
|
+
constructor(inputOptions) {
|
|
6877
|
+
this.#inputOptions = inputOptions;
|
|
6878
|
+
this.#bundler = new import_binding$1.BindingBundler();
|
|
6879
|
+
(0, import_binding$1.startAsyncRuntime)();
|
|
6880
|
+
}
|
|
6881
|
+
/**
|
|
6882
|
+
* Whether the bundle has been closed.
|
|
6883
|
+
*
|
|
6884
|
+
* If the bundle is closed, calling other methods will throw an error.
|
|
6885
|
+
*/
|
|
6886
|
+
get closed() {
|
|
6887
|
+
return this.#bundler.closed;
|
|
6888
|
+
}
|
|
6889
|
+
/**
|
|
6890
|
+
* Generate bundles in-memory.
|
|
6891
|
+
*
|
|
6892
|
+
* If you directly want to write bundles to disk, use the {@linkcode write} method instead.
|
|
6893
|
+
*
|
|
6894
|
+
* @param outputOptions The output options.
|
|
6895
|
+
* @returns The generated bundle.
|
|
6896
|
+
* @throws {@linkcode BundleError} When an error occurs during the build.
|
|
6897
|
+
*/
|
|
6898
|
+
async generate(outputOptions = {}) {
|
|
6899
|
+
return this.#build(false, outputOptions);
|
|
6900
|
+
}
|
|
6901
|
+
/**
|
|
6902
|
+
* Generate and write bundles to disk.
|
|
6903
|
+
*
|
|
6904
|
+
* If you want to generate bundles in-memory, use the {@linkcode generate} method instead.
|
|
6905
|
+
*
|
|
6906
|
+
* @param outputOptions The output options.
|
|
6907
|
+
* @returns The generated bundle.
|
|
6908
|
+
* @throws {@linkcode BundleError} When an error occurs during the build.
|
|
6909
|
+
*/
|
|
6910
|
+
async write(outputOptions = {}) {
|
|
6911
|
+
return this.#build(true, outputOptions);
|
|
6912
|
+
}
|
|
6913
|
+
/**
|
|
6914
|
+
* Close the bundle and free resources.
|
|
6915
|
+
*
|
|
6916
|
+
* This method should be called even if the {@linkcode generate} method
|
|
6917
|
+
* or the {@linkcode write} method threw an error. It should be called
|
|
6918
|
+
* even if neither of the methods are called.
|
|
6919
|
+
*
|
|
6920
|
+
* This method is called automatically when using `using` syntax.
|
|
6921
|
+
*
|
|
6922
|
+
* @example
|
|
6923
|
+
* ```js
|
|
6924
|
+
* import { rolldown } from 'rolldown';
|
|
6925
|
+
*
|
|
6926
|
+
* {
|
|
6927
|
+
* using bundle = await rolldown({ input: 'src/main.js' });
|
|
6928
|
+
* const output = await bundle.generate({ format: 'esm' });
|
|
6929
|
+
* console.log(output);
|
|
6930
|
+
* // bundle.close() is called automatically here
|
|
6931
|
+
* }
|
|
6932
|
+
* ```
|
|
6933
|
+
*/
|
|
6934
|
+
async close() {
|
|
6935
|
+
const shouldRelease = !this.#asyncRuntimeReleased;
|
|
6936
|
+
this.#asyncRuntimeReleased = true;
|
|
6937
|
+
try {
|
|
6938
|
+
await this.#stopWorkers?.();
|
|
6939
|
+
await this.#bundler.close();
|
|
6940
|
+
this.#stopWorkers = void 0;
|
|
6941
|
+
} finally {
|
|
6942
|
+
if (shouldRelease) (0, import_binding$1.shutdownAsyncRuntime)();
|
|
6943
|
+
}
|
|
6944
|
+
}
|
|
6945
|
+
/** @hidden documented in close method */
|
|
6946
|
+
async [Symbol.asyncDispose]() {
|
|
6947
|
+
await this.close();
|
|
6948
|
+
}
|
|
6949
|
+
/**
|
|
6950
|
+
* @experimental
|
|
6951
|
+
* @hidden not ready for public usage yet
|
|
6952
|
+
*/
|
|
6953
|
+
get watchFiles() {
|
|
6954
|
+
return Promise.resolve(this.#bundler.getWatchFiles());
|
|
6955
|
+
}
|
|
6956
|
+
async #build(isWrite, outputOptions) {
|
|
6957
|
+
validateOption("output", outputOptions);
|
|
6958
|
+
await this.#stopWorkers?.();
|
|
6959
|
+
const option = await createBundlerOptions(this.#inputOptions, outputOptions, false, true);
|
|
6960
|
+
try {
|
|
6961
|
+
this.#stopWorkers = option.stopWorkers;
|
|
6962
|
+
let output;
|
|
6963
|
+
if (isWrite) output = await this.#bundler.write(option.bundlerOptions);
|
|
6964
|
+
else output = await this.#bundler.generate(option.bundlerOptions);
|
|
6965
|
+
return new RolldownOutputImpl(unwrapBindingResult(output));
|
|
6966
|
+
} catch (e) {
|
|
6967
|
+
await option.stopWorkers?.();
|
|
6968
|
+
throw e;
|
|
6969
|
+
}
|
|
6970
|
+
}
|
|
6971
|
+
};
|
|
6577
6972
|
/**
|
|
6578
6973
|
* The API compatible with Rollup's `rollup` function.
|
|
6579
6974
|
*
|