@rolldown/browser 1.0.0-beta.49 → 1.0.0-beta.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/cli.mjs +12 -8
  2. package/dist/config.d.mts +3 -3
  3. package/dist/config.mjs +9 -5
  4. package/dist/constructors-DoUEJY6G.js +65 -0
  5. package/dist/experimental-index.browser.mjs +17 -11
  6. package/dist/experimental-index.d.mts +52 -15
  7. package/dist/experimental-index.mjs +21 -13
  8. package/dist/filter-index.d.mts +3 -3
  9. package/dist/filter-index.mjs +2 -1
  10. package/dist/index.browser.mjs +161 -2
  11. package/dist/index.d.mts +3 -3
  12. package/dist/index.mjs +36 -4
  13. package/dist/normalize-string-or-regex-BXFT9GiS.js +830 -0
  14. package/dist/parallel-plugin-worker.mjs +5 -4
  15. package/dist/parallel-plugin.d.mts +3 -3
  16. package/dist/parse-ast-index.d.mts +1 -1
  17. package/dist/parse-ast-index.mjs +1 -1
  18. package/dist/plugins-index.browser.mjs +2 -2
  19. package/dist/plugins-index.d.mts +3 -3
  20. package/dist/plugins-index.mjs +3 -2
  21. package/dist/rolldown-binding.wasi-browser.js +5 -2
  22. package/dist/rolldown-binding.wasi.cjs +5 -2
  23. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  24. package/dist/{src-CnMyHYgB.js → rolldown-build-C0UB1WZy.js} +32 -756
  25. package/dist/shared/{binding-B4uTNiw2.d.mts → binding-lSvYApx7.d.mts} +198 -89
  26. package/dist/shared/bindingify-input-options-CSdAtTcQ.mjs +1568 -0
  27. package/dist/shared/{composable-filters-CBpK2Fbc.mjs → composable-filters-DZ5ToxRJ.mjs} +1 -22
  28. package/dist/shared/constructors-DF6M1PTb.mjs +65 -0
  29. package/dist/shared/constructors-DgFF472b.d.mts +31 -0
  30. package/dist/shared/{define-config-BAQ9c-hh.d.mts → define-config-BKu-xa_0.d.mts} +10 -49
  31. package/dist/shared/define-config-DfeZGBEt.mjs +7 -0
  32. package/dist/shared/{load-config-DQI-2sfE.mjs → load-config-Beo_LOwd.mjs} +1 -1
  33. package/dist/shared/misc-5GYLGQ20.mjs +22 -0
  34. package/dist/shared/normalize-string-or-regex-DvECZN2V.mjs +629 -0
  35. package/dist/shared/{parse-ast-index-D9jH_38U.mjs → parse-ast-index-C_M-Y4oC.mjs} +3 -3
  36. package/dist/shared/{prompt-Ckjl2FdJ.mjs → prompt-pmGBC3ws.mjs} +1 -1
  37. package/dist/shared/rolldown-BhV7L6Kg.mjs +10 -0
  38. package/dist/shared/rolldown-build-DYR94CyF.mjs +2121 -0
  39. package/dist/shared/utils-BJWI2OzT.d.mts +62 -0
  40. package/dist/shared/watch-Cjxo-3u4.mjs +338 -0
  41. package/package.json +1 -1
  42. package/dist/constructors-EhfoQfqh.js +0 -68
  43. package/dist/normalize-string-or-regex-d47jXr3r.js +0 -231
  44. package/dist/shared/constructors-CaN9lKj2.d.mts +0 -32
  45. package/dist/shared/constructors-DcEzB0nc.mjs +0 -68
  46. package/dist/shared/normalize-string-or-regex-CbDij6KB.mjs +0 -46
  47. package/dist/shared/src-CZ_U2fML.mjs +0 -4597
  48. package/dist/shared/utils-CduIqa7h.d.mts +0 -18
@@ -0,0 +1,629 @@
1
+ import { a as logInvalidLogPosition, c as logPluginError, n as error } from "./logs-CPsamAuj.mjs";
2
+ import { r as noop } from "./misc-5GYLGQ20.mjs";
3
+ import { BindingCallableBuiltinPlugin } from "../rolldown-binding.wasi.cjs";
4
+
5
+ //#region src/log/logging.ts
6
+ const LOG_LEVEL_SILENT = "silent";
7
+ const LOG_LEVEL_ERROR = "error";
8
+ const LOG_LEVEL_WARN = "warn";
9
+ const LOG_LEVEL_INFO = "info";
10
+ const LOG_LEVEL_DEBUG = "debug";
11
+ const logLevelPriority = {
12
+ [LOG_LEVEL_DEBUG]: 0,
13
+ [LOG_LEVEL_INFO]: 1,
14
+ [LOG_LEVEL_WARN]: 2,
15
+ [LOG_LEVEL_SILENT]: 3
16
+ };
17
+
18
+ //#endregion
19
+ //#region src/log/log-handler.ts
20
+ const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
21
+ function getLogHandler(level, code, logger, pluginName, logLevel) {
22
+ if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
23
+ return (log, pos) => {
24
+ if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
25
+ log = normalizeLog(log);
26
+ if (log.code && !log.pluginCode) log.pluginCode = log.code;
27
+ log.code = code;
28
+ log.plugin = pluginName;
29
+ logger(level, log);
30
+ };
31
+ }
32
+
33
+ //#endregion
34
+ //#region package.json
35
+ var version = "1.0.0-beta.51";
36
+ var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
37
+
38
+ //#endregion
39
+ //#region src/version.ts
40
+ const VERSION = version;
41
+
42
+ //#endregion
43
+ //#region src/plugin/minimal-plugin-context.ts
44
+ var MinimalPluginContextImpl = class {
45
+ info;
46
+ warn;
47
+ debug;
48
+ meta;
49
+ constructor(onLog, logLevel, pluginName, watchMode, hookName) {
50
+ this.pluginName = pluginName;
51
+ this.hookName = hookName;
52
+ this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
53
+ this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
54
+ this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
55
+ this.meta = {
56
+ rollupVersion: "4.23.0",
57
+ rolldownVersion: VERSION,
58
+ watchMode
59
+ };
60
+ }
61
+ error(e) {
62
+ return error(logPluginError(normalizeLog(e), this.pluginName, { hook: this.hookName }));
63
+ }
64
+ };
65
+
66
+ //#endregion
67
+ //#region src/types/plain-object-like.ts
68
+ const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
69
+ /**
70
+ * Base class for classes that use `@lazyProp` decorated properties.
71
+ *
72
+ * **Design Pattern in Rolldown:**
73
+ * This is a common pattern in Rolldown due to its three-layer architecture:
74
+ * TypeScript API → NAPI Bindings → Rust Core
75
+ *
76
+ * **Why we use getters:**
77
+ * For performance - to lazily fetch data from Rust bindings only when needed,
78
+ * rather than eagerly fetching all data during object construction.
79
+ *
80
+ * **The problem:**
81
+ * Getters defined on class prototypes are non-enumerable by default, which breaks:
82
+ * - Object spread operators ({...obj})
83
+ * - Object.keys() and similar methods
84
+ * - Standard JavaScript object semantics
85
+ *
86
+ * **The solution:**
87
+ * This base class automatically converts `@lazyProp` decorated getters into
88
+ * own enumerable getters on each instance during construction.
89
+ *
90
+ * **Result:**
91
+ * Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
92
+ *
93
+ * @example
94
+ * ```typescript
95
+ * class MyClass extends PlainObjectLike {
96
+ * @lazyProp
97
+ * get myProp() {
98
+ * return fetchFromRustBinding();
99
+ * }
100
+ * }
101
+ * ```
102
+ */
103
+ var PlainObjectLike = class {
104
+ constructor() {
105
+ setupLazyProperties(this);
106
+ }
107
+ };
108
+ /**
109
+ * Set up lazy properties as own getters on an instance.
110
+ * This is called automatically by the `PlainObjectLike` base class constructor.
111
+ *
112
+ * @param instance - The instance to set up lazy properties on
113
+ * @internal
114
+ */
115
+ function setupLazyProperties(instance) {
116
+ const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
117
+ if (!lazyFields) return;
118
+ for (const [propertyKey, originalGetter] of lazyFields.entries()) {
119
+ let cachedValue;
120
+ let hasValue = false;
121
+ Object.defineProperty(instance, propertyKey, {
122
+ get() {
123
+ if (!hasValue) {
124
+ cachedValue = originalGetter.call(this);
125
+ hasValue = true;
126
+ }
127
+ return cachedValue;
128
+ },
129
+ enumerable: true,
130
+ configurable: true
131
+ });
132
+ }
133
+ }
134
+ /**
135
+ * Get all lazy field names from a class instance.
136
+ *
137
+ * @param instance - Instance to inspect
138
+ * @returns Set of lazy property names
139
+ */
140
+ function getLazyFields(instance) {
141
+ const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
142
+ return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
143
+ }
144
+
145
+ //#endregion
146
+ //#region src/decorators/lazy.ts
147
+ /**
148
+ * Decorator that marks a getter as lazy-evaluated and cached.
149
+ *
150
+ * **What "lazy" means here:**
151
+ * 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
152
+ * 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
153
+ * 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
154
+ *
155
+ * **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
156
+ * properties on each instance (not on the prototype). This ensures they:
157
+ * - Appear in Object.keys() and Object.getOwnPropertyNames()
158
+ * - Are included in object spreads ({...obj})
159
+ * - Are enumerable in for...in loops
160
+ *
161
+ * Classes using this decorator must extend `PlainObjectLike` base class.
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * class MyClass extends PlainObjectLike {
166
+ * @lazyProp
167
+ * get expensiveValue() {
168
+ * return someExpensiveComputation();
169
+ * }
170
+ * }
171
+ * ```
172
+ */
173
+ function lazyProp(target, propertyKey, descriptor) {
174
+ if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
175
+ const originalGetter = descriptor.get;
176
+ target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
177
+ return {
178
+ enumerable: false,
179
+ configurable: true
180
+ };
181
+ }
182
+
183
+ //#endregion
184
+ //#region src/utils/asset-source.ts
185
+ function transformAssetSource(bindingAssetSource$1) {
186
+ return bindingAssetSource$1.inner;
187
+ }
188
+ function bindingAssetSource(source) {
189
+ return { inner: source };
190
+ }
191
+
192
+ //#endregion
193
+ //#region \0@oxc-project+runtime@0.98.0/helpers/decorate.js
194
+ function __decorate(decorators, target, key, desc) {
195
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
196
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
197
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
198
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
199
+ }
200
+
201
+ //#endregion
202
+ //#region src/types/output-asset-impl.ts
203
+ var OutputAssetImpl = class extends PlainObjectLike {
204
+ type = "asset";
205
+ constructor(bindingAsset) {
206
+ super();
207
+ this.bindingAsset = bindingAsset;
208
+ }
209
+ get fileName() {
210
+ return this.bindingAsset.getFileName();
211
+ }
212
+ get originalFileName() {
213
+ return this.bindingAsset.getOriginalFileName() || null;
214
+ }
215
+ get originalFileNames() {
216
+ return this.bindingAsset.getOriginalFileNames();
217
+ }
218
+ get name() {
219
+ return this.bindingAsset.getName() ?? void 0;
220
+ }
221
+ get names() {
222
+ return this.bindingAsset.getNames();
223
+ }
224
+ get source() {
225
+ return transformAssetSource(this.bindingAsset.getSource());
226
+ }
227
+ __rolldown_external_memory_handle__(keepDataAlive) {
228
+ if (keepDataAlive) this.#evaluateAllLazyFields();
229
+ return this.bindingAsset.dropInner();
230
+ }
231
+ #evaluateAllLazyFields() {
232
+ for (const field of getLazyFields(this)) this[field];
233
+ }
234
+ };
235
+ __decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
236
+ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
237
+ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
238
+ __decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
239
+ __decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
240
+ __decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
241
+
242
+ //#endregion
243
+ //#region src/utils/transform-rendered-module.ts
244
+ function transformToRenderedModule(bindingRenderedModule) {
245
+ return {
246
+ get code() {
247
+ return bindingRenderedModule.code;
248
+ },
249
+ get renderedLength() {
250
+ return bindingRenderedModule.code?.length || 0;
251
+ },
252
+ get renderedExports() {
253
+ return bindingRenderedModule.renderedExports;
254
+ }
255
+ };
256
+ }
257
+
258
+ //#endregion
259
+ //#region src/utils/transform-rendered-chunk.ts
260
+ function transformRenderedChunk(chunk) {
261
+ let modules = null;
262
+ return {
263
+ type: "chunk",
264
+ get name() {
265
+ return chunk.name;
266
+ },
267
+ get isEntry() {
268
+ return chunk.isEntry;
269
+ },
270
+ get isDynamicEntry() {
271
+ return chunk.isDynamicEntry;
272
+ },
273
+ get facadeModuleId() {
274
+ return chunk.facadeModuleId;
275
+ },
276
+ get moduleIds() {
277
+ return chunk.moduleIds;
278
+ },
279
+ get exports() {
280
+ return chunk.exports;
281
+ },
282
+ get fileName() {
283
+ return chunk.fileName;
284
+ },
285
+ get imports() {
286
+ return chunk.imports;
287
+ },
288
+ get dynamicImports() {
289
+ return chunk.dynamicImports;
290
+ },
291
+ get modules() {
292
+ if (!modules) modules = transformChunkModules(chunk.modules);
293
+ return modules;
294
+ }
295
+ };
296
+ }
297
+ function transformChunkModules(modules) {
298
+ const result = {};
299
+ for (let i = 0; i < modules.values.length; i++) {
300
+ let key = modules.keys[i];
301
+ const mod = modules.values[i];
302
+ result[key] = transformToRenderedModule(mod);
303
+ }
304
+ return result;
305
+ }
306
+
307
+ //#endregion
308
+ //#region src/types/output-chunk-impl.ts
309
+ var OutputChunkImpl = class extends PlainObjectLike {
310
+ type = "chunk";
311
+ constructor(bindingChunk) {
312
+ super();
313
+ this.bindingChunk = bindingChunk;
314
+ }
315
+ get fileName() {
316
+ return this.bindingChunk.getFileName();
317
+ }
318
+ get name() {
319
+ return this.bindingChunk.getName();
320
+ }
321
+ get exports() {
322
+ return this.bindingChunk.getExports();
323
+ }
324
+ get isEntry() {
325
+ return this.bindingChunk.getIsEntry();
326
+ }
327
+ get facadeModuleId() {
328
+ return this.bindingChunk.getFacadeModuleId() || null;
329
+ }
330
+ get isDynamicEntry() {
331
+ return this.bindingChunk.getIsDynamicEntry();
332
+ }
333
+ get sourcemapFileName() {
334
+ return this.bindingChunk.getSourcemapFileName() || null;
335
+ }
336
+ get preliminaryFileName() {
337
+ return this.bindingChunk.getPreliminaryFileName();
338
+ }
339
+ get code() {
340
+ return this.bindingChunk.getCode();
341
+ }
342
+ get modules() {
343
+ return transformChunkModules(this.bindingChunk.getModules());
344
+ }
345
+ get imports() {
346
+ return this.bindingChunk.getImports();
347
+ }
348
+ get dynamicImports() {
349
+ return this.bindingChunk.getDynamicImports();
350
+ }
351
+ get moduleIds() {
352
+ return this.bindingChunk.getModuleIds();
353
+ }
354
+ get map() {
355
+ const mapString = this.bindingChunk.getMap();
356
+ return mapString ? transformToRollupSourceMap(mapString) : null;
357
+ }
358
+ __rolldown_external_memory_handle__(keepDataAlive) {
359
+ if (keepDataAlive) this.#evaluateAllLazyFields();
360
+ return this.bindingChunk.dropInner();
361
+ }
362
+ #evaluateAllLazyFields() {
363
+ for (const field of getLazyFields(this)) this[field];
364
+ }
365
+ };
366
+ __decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
367
+ __decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
368
+ __decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
369
+ __decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
370
+ __decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
371
+ __decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
372
+ __decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
373
+ __decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
374
+ __decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
375
+ __decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
376
+ __decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
377
+ __decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
378
+ __decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
379
+ __decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
380
+
381
+ //#endregion
382
+ //#region src/types/sourcemap.ts
383
+ function bindingifySourcemap(map) {
384
+ if (map == null) return;
385
+ return { inner: typeof map === "string" ? map : {
386
+ file: map.file ?? void 0,
387
+ mappings: map.mappings,
388
+ sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
389
+ sources: map.sources?.map((s) => s ?? void 0),
390
+ sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
391
+ names: map.names,
392
+ x_google_ignoreList: map.x_google_ignoreList,
393
+ debugId: "debugId" in map ? map.debugId : void 0
394
+ } };
395
+ }
396
+
397
+ //#endregion
398
+ //#region src/utils/transform-to-rollup-output.ts
399
+ function transformToRollupSourceMap(map) {
400
+ const obj = {
401
+ ...JSON.parse(map),
402
+ toString() {
403
+ return JSON.stringify(obj);
404
+ },
405
+ toUrl() {
406
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
407
+ }
408
+ };
409
+ return obj;
410
+ }
411
+ function transformToRollupOutputChunk(bindingChunk) {
412
+ return new OutputChunkImpl(bindingChunk);
413
+ }
414
+ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
415
+ const chunk = {
416
+ type: "chunk",
417
+ get code() {
418
+ return bindingChunk.getCode();
419
+ },
420
+ fileName: bindingChunk.getFileName(),
421
+ name: bindingChunk.getName(),
422
+ get modules() {
423
+ return transformChunkModules(bindingChunk.getModules());
424
+ },
425
+ get imports() {
426
+ return bindingChunk.getImports();
427
+ },
428
+ get dynamicImports() {
429
+ return bindingChunk.getDynamicImports();
430
+ },
431
+ exports: bindingChunk.getExports(),
432
+ isEntry: bindingChunk.getIsEntry(),
433
+ facadeModuleId: bindingChunk.getFacadeModuleId() || null,
434
+ isDynamicEntry: bindingChunk.getIsDynamicEntry(),
435
+ get moduleIds() {
436
+ return bindingChunk.getModuleIds();
437
+ },
438
+ get map() {
439
+ const map = bindingChunk.getMap();
440
+ return map ? transformToRollupSourceMap(map) : null;
441
+ },
442
+ sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
443
+ preliminaryFileName: bindingChunk.getPreliminaryFileName()
444
+ };
445
+ const cache = {};
446
+ return new Proxy(chunk, {
447
+ get(target, p) {
448
+ if (p in cache) return cache[p];
449
+ const value = target[p];
450
+ cache[p] = value;
451
+ return value;
452
+ },
453
+ set(_target, p, newValue) {
454
+ cache[p] = newValue;
455
+ changed.updated.add(bindingChunk.getFileName());
456
+ return true;
457
+ },
458
+ has(target, p) {
459
+ if (p in cache) return true;
460
+ return p in target;
461
+ }
462
+ });
463
+ }
464
+ function transformToRollupOutputAsset(bindingAsset) {
465
+ return new OutputAssetImpl(bindingAsset);
466
+ }
467
+ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
468
+ const asset = {
469
+ type: "asset",
470
+ fileName: bindingAsset.getFileName(),
471
+ originalFileName: bindingAsset.getOriginalFileName() || null,
472
+ originalFileNames: bindingAsset.getOriginalFileNames(),
473
+ get source() {
474
+ return transformAssetSource(bindingAsset.getSource());
475
+ },
476
+ name: bindingAsset.getName() ?? void 0,
477
+ names: bindingAsset.getNames()
478
+ };
479
+ const cache = {};
480
+ return new Proxy(asset, {
481
+ get(target, p) {
482
+ if (p in cache) return cache[p];
483
+ const value = target[p];
484
+ cache[p] = value;
485
+ return value;
486
+ },
487
+ set(_target, p, newValue) {
488
+ cache[p] = newValue;
489
+ changed.updated.add(bindingAsset.getFileName());
490
+ return true;
491
+ }
492
+ });
493
+ }
494
+ function transformToRollupOutput(output) {
495
+ const { chunks, assets } = output;
496
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
497
+ }
498
+ function transformToMutableRollupOutput(output, changed) {
499
+ const { chunks, assets } = output;
500
+ return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
501
+ }
502
+ function transformToOutputBundle(context, output, changed) {
503
+ const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
504
+ return new Proxy(bundle, {
505
+ set(_target, _p, _newValue, _receiver) {
506
+ const originalStackTraceLimit = Error.stackTraceLimit;
507
+ Error.stackTraceLimit = 2;
508
+ const message = "This plugin assigns to bundle variable. This is discouraged by Rollup and is not supported by Rolldown. This will be ignored. https://rollupjs.org/plugin-development/#generatebundle:~:text=DANGER,this.emitFile.";
509
+ const stack = new Error(message).stack ?? message;
510
+ Error.stackTraceLimit = originalStackTraceLimit;
511
+ context.warn({
512
+ message: stack,
513
+ code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
514
+ });
515
+ return true;
516
+ },
517
+ deleteProperty(target, property) {
518
+ if (typeof property === "string") changed.deleted.add(property);
519
+ return true;
520
+ }
521
+ });
522
+ }
523
+ function collectChangedBundle(changed, bundle) {
524
+ const changes = {};
525
+ for (const key in bundle) {
526
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
527
+ const item = bundle[key];
528
+ if (item.type === "asset") changes[key] = {
529
+ filename: item.fileName,
530
+ originalFileNames: item.originalFileNames,
531
+ source: bindingAssetSource(item.source),
532
+ names: item.names
533
+ };
534
+ else changes[key] = {
535
+ code: item.code,
536
+ filename: item.fileName,
537
+ name: item.name,
538
+ isEntry: item.isEntry,
539
+ exports: item.exports,
540
+ modules: {},
541
+ imports: item.imports,
542
+ dynamicImports: item.dynamicImports,
543
+ facadeModuleId: item.facadeModuleId || void 0,
544
+ isDynamicEntry: item.isDynamicEntry,
545
+ moduleIds: item.moduleIds,
546
+ map: bindingifySourcemap(item.map),
547
+ sourcemapFilename: item.sourcemapFileName || void 0,
548
+ preliminaryFilename: item.preliminaryFileName
549
+ };
550
+ }
551
+ return {
552
+ changes,
553
+ deleted: changed.deleted
554
+ };
555
+ }
556
+
557
+ //#endregion
558
+ //#region src/builtin-plugin/utils.ts
559
+ var BuiltinPlugin = class {
560
+ constructor(name, _options) {
561
+ this.name = name;
562
+ this._options = _options;
563
+ }
564
+ };
565
+ function makeBuiltinPluginCallable(plugin) {
566
+ let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
567
+ const wrappedPlugin = plugin;
568
+ for (const key in callablePlugin) wrappedPlugin[key] = async function(...args) {
569
+ try {
570
+ return await callablePlugin[key](...args);
571
+ } catch (e) {
572
+ if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
573
+ return error(logPluginError(e, plugin.name, {
574
+ hook: key,
575
+ id: key === "transform" ? args[2] : void 0
576
+ }));
577
+ }
578
+ };
579
+ return wrappedPlugin;
580
+ }
581
+ function bindingifyBuiltInPlugin(plugin) {
582
+ return {
583
+ __name: plugin.name,
584
+ options: plugin._options
585
+ };
586
+ }
587
+ function bindingifyViteHtmlPlugin(plugin, onLog, logLevel, watchMode) {
588
+ const { preHooks, normalHooks, postHooks, applyHtmlTransforms, ...options } = plugin._options;
589
+ if (preHooks.length + normalHooks.length + postHooks.length > 0) return {
590
+ __name: plugin.name,
591
+ options: {
592
+ ...options,
593
+ transformIndexHtml: async (html, path, filename, hook, output, chunk) => {
594
+ const pluginContext = new MinimalPluginContextImpl(onLog, logLevel, plugin.name, watchMode, "transformIndexHtml");
595
+ const context = {
596
+ path,
597
+ filename,
598
+ bundle: output ? transformToOutputBundle(pluginContext, output, {
599
+ updated: /* @__PURE__ */ new Set(),
600
+ deleted: /* @__PURE__ */ new Set()
601
+ }) : void 0,
602
+ chunk: chunk ? transformToRollupOutputChunk(chunk) : void 0
603
+ };
604
+ switch (hook) {
605
+ case "transform": return await applyHtmlTransforms(html, preHooks, pluginContext, context);
606
+ case "generateBundle": return await applyHtmlTransforms(html, [...normalHooks, ...postHooks], pluginContext, context);
607
+ }
608
+ }
609
+ }
610
+ };
611
+ return {
612
+ __name: plugin.name,
613
+ options: plugin._options
614
+ };
615
+ }
616
+
617
+ //#endregion
618
+ //#region src/utils/normalize-string-or-regex.ts
619
+ function normalizedStringOrRegex(pattern) {
620
+ if (!pattern) return;
621
+ if (!isReadonlyArray(pattern)) return [pattern];
622
+ return pattern;
623
+ }
624
+ function isReadonlyArray(input) {
625
+ return Array.isArray(input);
626
+ }
627
+
628
+ //#endregion
629
+ export { LOG_LEVEL_INFO as C, LOG_LEVEL_ERROR as S, logLevelPriority as T, VERSION as _, makeBuiltinPluginCallable as a, normalizeLog as b, transformToRollupOutput as c, __decorate as d, bindingAssetSource as f, MinimalPluginContextImpl as g, PlainObjectLike as h, bindingifyViteHtmlPlugin as i, bindingifySourcemap as l, lazyProp as m, BuiltinPlugin as n, collectChangedBundle as o, transformAssetSource as p, bindingifyBuiltInPlugin as r, transformToOutputBundle as s, normalizedStringOrRegex as t, transformRenderedChunk as u, description as v, LOG_LEVEL_WARN as w, LOG_LEVEL_DEBUG as x, version as y };
@@ -1,7 +1,7 @@
1
1
  import { l as locate, n as error, s as logParseError, u as getCodeFrame } from "./logs-CPsamAuj.mjs";
2
- import { parseAsync, parseSync } from "../rolldown-binding.wasi.cjs";
2
+ import { parse, parseSync } from "../rolldown-binding.wasi.cjs";
3
3
 
4
- //#region ../../node_modules/.pnpm/oxc-parser@0.96.0/node_modules/oxc-parser/src-js/wrap.js
4
+ //#region ../../node_modules/.pnpm/oxc-parser@0.98.0/node_modules/oxc-parser/src-js/wrap.js
5
5
  function wrap$1(result) {
6
6
  let program, module, comments, errors;
7
7
  return {
@@ -71,7 +71,7 @@ function parseAst(sourceText, options, filename) {
71
71
  }), sourceText);
72
72
  }
73
73
  async function parseAstAsync(sourceText, options, filename) {
74
- return wrap(await parseAsync(filename ?? "file.js", sourceText, {
74
+ return wrap(await parse(filename ?? "file.js", sourceText, {
75
75
  ...defaultParserOptions,
76
76
  ...options
77
77
  }), sourceText);
@@ -446,7 +446,7 @@ var AD = Object.defineProperty, pD = (t, u$1, F$1) => u$1 in t ? AD(t, u$1, {
446
446
  var x = class {
447
447
  constructor(u$1, F$1 = true) {
448
448
  h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
449
- const { input: e$1 = stdin, output: s = stdout, render: i, signal: D,...C$1 } = u$1;
449
+ const { input: e$1 = stdin, output: s = stdout, render: i, signal: D, ...C$1 } = u$1;
450
450
  this.opts = C$1, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F$1, this._abortSignal = D, this.input = e$1, this.output = s;
451
451
  }
452
452
  unsubscribe() {
@@ -0,0 +1,10 @@
1
+ import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-DYR94CyF.mjs";
2
+
3
+ //#region src/api/rolldown/index.ts
4
+ const rolldown = async (input) => {
5
+ validateOption("input", input);
6
+ return new RolldownBuild(await PluginDriver.callOptionsHook(input));
7
+ };
8
+
9
+ //#endregion
10
+ export { rolldown as t };