@rolldown/browser 1.0.0-beta.59 → 1.0.0-beta.60

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 (46) hide show
  1. package/dist/cli.mjs +32 -32
  2. package/dist/config.d.mts +1 -1
  3. package/dist/config.mjs +7 -7
  4. package/dist/{constructors-c0HHH7Qq.js → constructors-CPMzz58l.js} +2 -8
  5. package/dist/experimental-index.browser.mjs +4 -37
  6. package/dist/experimental-index.d.mts +5 -63
  7. package/dist/experimental-index.mjs +6 -39
  8. package/dist/filter-index.d.mts +1 -1
  9. package/dist/filter-index.mjs +1 -2
  10. package/dist/get-log-filter.d.mts +1 -1
  11. package/dist/index.browser.mjs +6 -6
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +11 -11
  14. package/dist/normalize-string-or-regex-DcX5TPjK.js +247 -0
  15. package/dist/parallel-plugin-worker.mjs +3 -3
  16. package/dist/parallel-plugin.d.mts +2 -2
  17. package/dist/parse-ast-index.d.mts +1 -1
  18. package/dist/parse-ast-index.mjs +1 -1
  19. package/dist/plugins-index.browser.mjs +2 -2
  20. package/dist/plugins-index.d.mts +3 -3
  21. package/dist/plugins-index.mjs +2 -2
  22. package/dist/rolldown-binding.wasi-browser.js +0 -1
  23. package/dist/rolldown-binding.wasi.cjs +0 -1
  24. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  25. package/dist/{rolldown-build-Bfw5c2c3.js → rolldown-build-Zb6e1FlF.js} +657 -78
  26. package/dist/shared/{binding-MAEzB4KA.d.mts → binding-CAB1xlCZ.d.mts} +58 -134
  27. package/dist/shared/{bindingify-input-options-BTd8uAdf.mjs → bindingify-input-options-C4xVxTKf.mjs} +600 -50
  28. package/dist/shared/{composable-filters-C5qA4jo-.mjs → composable-filters-DmVadxLf.mjs} +41 -20
  29. package/dist/shared/{constructors-CQP6o3cR.d.mts → constructors-D_KDVVwY.d.mts} +3 -5
  30. package/dist/shared/{constructors-C8tBnLHP.mjs → constructors-KqJrL3Ok.mjs} +2 -8
  31. package/dist/shared/{define-config-CpZLzJD0.d.mts → define-config-CUEbSpq4.d.mts} +954 -408
  32. package/dist/shared/{load-config-cKGxDu4K.mjs → load-config-DN8SQL2o.mjs} +1 -1
  33. package/dist/shared/{logging-B4x9qar8.d.mts → logging-DGAQcdLz.d.mts} +4 -0
  34. package/dist/shared/{logs-DEfpOy5A.mjs → logs-cXucB9vK.mjs} +8 -8
  35. package/dist/shared/normalize-string-or-regex-Bn5eoSii.mjs +60 -0
  36. package/dist/shared/{parse-ast-index-BLdgtc2B.mjs → parse-ast-index-B54CTqgh.mjs} +2 -2
  37. package/dist/shared/{prompt-CNt8OM9C.mjs → prompt-D80rO-gq.mjs} +220 -220
  38. package/dist/shared/{rolldown-8m9pjMU2.mjs → rolldown-BhEWsQWt.mjs} +1 -1
  39. package/dist/shared/{rolldown-build-DKF_S8hw.mjs → rolldown-build-PEQvqPGC.mjs} +46 -35
  40. package/dist/shared/{utils-BGxZdOXA.d.mts → utils-0UHbNgk4.d.mts} +2 -11
  41. package/dist/shared/{watch-BEzOq0zm.mjs → watch-avpeg13R.mjs} +11 -12
  42. package/package.json +1 -1
  43. package/dist/normalize-string-or-regex-BB1FWNyl.js +0 -872
  44. package/dist/shared/misc-BubmxcE3.mjs +0 -22
  45. package/dist/shared/normalize-string-or-regex-DJ5EwPtg.mjs +0 -669
  46. /package/dist/shared/{define-config-BF4P-Pum.mjs → define-config-DrUTwApf.mjs} +0 -0
@@ -1,12 +1,50 @@
1
- import { c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-DEfpOy5A.mjs";
2
- import { a as unreachable, o as unsupported, t as arraify } from "./misc-BubmxcE3.mjs";
3
- import { E as LOG_LEVEL_WARN, S as normalizeLog, _ as PlainObjectLike, a as bindingifyManifestPlugin, c as collectChangedBundle, d as bindingifySourcemap, f as transformRenderedChunk, g as lazyProp, i as bindingifyCSSPostPlugin, l as transformToOutputBundle, m as bindingAssetSource, n as BuiltinPlugin, o as bindingifyViteHtmlPlugin, p as __decorate, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex, v as MinimalPluginContextImpl } from "./normalize-string-or-regex-DJ5EwPtg.mjs";
4
- import { t as parseAst } from "./parse-ast-index-BLdgtc2B.mjs";
5
- import { a as id, f as or, n as code, r as exclude, s as include, t as and, u as moduleType } from "./composable-filters-C5qA4jo-.mjs";
1
+ import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-cXucB9vK.mjs";
2
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-Bn5eoSii.mjs";
3
+ import { _ as noop, a as id, b as unsupported, f as or, h as arraify, n as code, r as exclude, s as include, t as and, u as moduleType, y as unreachable } from "./composable-filters-DmVadxLf.mjs";
4
+ import { t as parseAst } from "./parse-ast-index-B54CTqgh.mjs";
6
5
  import { BindingAttachDebugInfo, BindingChunkModuleOrderBy, BindingLogLevel, BindingMagicString, BindingPluginOrder, BindingPropertyReadSideEffects, BindingPropertyWriteSideEffects } from "../rolldown-binding.wasi.cjs";
7
6
  import path from "node:path";
8
7
  import fsp from "node:fs/promises";
9
8
 
9
+ //#region package.json
10
+ var version = "1.0.0-beta.60";
11
+ var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
12
+
13
+ //#endregion
14
+ //#region src/version.ts
15
+ /** @category Plugin APIs */
16
+ const VERSION = version;
17
+
18
+ //#endregion
19
+ //#region src/log/logging.ts
20
+ const LOG_LEVEL_SILENT = "silent";
21
+ const LOG_LEVEL_ERROR = "error";
22
+ const LOG_LEVEL_WARN = "warn";
23
+ const LOG_LEVEL_INFO = "info";
24
+ const LOG_LEVEL_DEBUG = "debug";
25
+ const logLevelPriority = {
26
+ [LOG_LEVEL_DEBUG]: 0,
27
+ [LOG_LEVEL_INFO]: 1,
28
+ [LOG_LEVEL_WARN]: 2,
29
+ [LOG_LEVEL_SILENT]: 3
30
+ };
31
+
32
+ //#endregion
33
+ //#region src/log/log-handler.ts
34
+ const normalizeLog = (log) => typeof log === "string" ? { message: log } : typeof log === "function" ? normalizeLog(log()) : log;
35
+ function getLogHandler(level, code$1, logger, pluginName, logLevel) {
36
+ if (logLevelPriority[level] < logLevelPriority[logLevel]) return noop;
37
+ return (log, pos) => {
38
+ if (pos != null) logger(LOG_LEVEL_WARN, logInvalidLogPosition(pluginName));
39
+ log = normalizeLog(log);
40
+ if (log.code && !log.pluginCode) log.pluginCode = log.code;
41
+ log.code = code$1;
42
+ log.plugin = pluginName;
43
+ logger(level, log);
44
+ };
45
+ }
46
+
47
+ //#endregion
10
48
  //#region src/utils/normalize-hook.ts
11
49
  function normalizeHook(hook) {
12
50
  if (typeof hook === "function" || typeof hook === "string") return {
@@ -25,6 +63,521 @@ function normalizeHook(hook) {
25
63
  unreachable("Invalid hook type");
26
64
  }
27
65
 
66
+ //#endregion
67
+ //#region src/plugin/minimal-plugin-context.ts
68
+ var MinimalPluginContextImpl = class {
69
+ info;
70
+ warn;
71
+ debug;
72
+ meta;
73
+ constructor(onLog, logLevel, pluginName, watchMode, hookName) {
74
+ this.pluginName = pluginName;
75
+ this.hookName = hookName;
76
+ this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
77
+ this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
78
+ this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
79
+ this.meta = {
80
+ rollupVersion: "4.23.0",
81
+ rolldownVersion: VERSION,
82
+ watchMode
83
+ };
84
+ }
85
+ error(e$1) {
86
+ return error(logPluginError(normalizeLog(e$1), this.pluginName, { hook: this.hookName }));
87
+ }
88
+ };
89
+
90
+ //#endregion
91
+ //#region src/types/plain-object-like.ts
92
+ const LAZY_FIELDS_KEY = Symbol("__lazy_fields__");
93
+ /**
94
+ * Base class for classes that use `@lazyProp` decorated properties.
95
+ *
96
+ * **Design Pattern in Rolldown:**
97
+ * This is a common pattern in Rolldown due to its three-layer architecture:
98
+ * TypeScript API → NAPI Bindings → Rust Core
99
+ *
100
+ * **Why we use getters:**
101
+ * For performance - to lazily fetch data from Rust bindings only when needed,
102
+ * rather than eagerly fetching all data during object construction.
103
+ *
104
+ * **The problem:**
105
+ * Getters defined on class prototypes are non-enumerable by default, which breaks:
106
+ * - Object spread operators ({...obj})
107
+ * - Object.keys() and similar methods
108
+ * - Standard JavaScript object semantics
109
+ *
110
+ * **The solution:**
111
+ * This base class automatically converts `@lazyProp` decorated getters into
112
+ * own enumerable getters on each instance during construction.
113
+ *
114
+ * **Result:**
115
+ * Objects get both lazy-loading performance benefits AND plain JavaScript object behavior.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * class MyClass extends PlainObjectLike {
120
+ * @lazyProp
121
+ * get myProp() {
122
+ * return fetchFromRustBinding();
123
+ * }
124
+ * }
125
+ * ```
126
+ */
127
+ var PlainObjectLike = class {
128
+ constructor() {
129
+ setupLazyProperties(this);
130
+ }
131
+ };
132
+ /**
133
+ * Set up lazy properties as own getters on an instance.
134
+ * This is called automatically by the `PlainObjectLike` base class constructor.
135
+ *
136
+ * @param instance - The instance to set up lazy properties on
137
+ * @internal
138
+ */
139
+ function setupLazyProperties(instance) {
140
+ const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
141
+ if (!lazyFields) return;
142
+ for (const [propertyKey, originalGetter] of lazyFields.entries()) {
143
+ let cachedValue;
144
+ let hasValue = false;
145
+ Object.defineProperty(instance, propertyKey, {
146
+ get() {
147
+ if (!hasValue) {
148
+ cachedValue = originalGetter.call(this);
149
+ hasValue = true;
150
+ }
151
+ return cachedValue;
152
+ },
153
+ enumerable: true,
154
+ configurable: true
155
+ });
156
+ }
157
+ }
158
+ /**
159
+ * Get all lazy field names from a class instance.
160
+ *
161
+ * @param instance - Instance to inspect
162
+ * @returns Set of lazy property names
163
+ */
164
+ function getLazyFields(instance) {
165
+ const lazyFields = instance.constructor[LAZY_FIELDS_KEY];
166
+ return lazyFields ? new Set(lazyFields.keys()) : /* @__PURE__ */ new Set();
167
+ }
168
+
169
+ //#endregion
170
+ //#region src/decorators/lazy.ts
171
+ /**
172
+ * Decorator that marks a getter as lazy-evaluated and cached.
173
+ *
174
+ * **What "lazy" means here:**
175
+ * 1. Data is lazily fetched from Rust bindings only when the property is accessed (not eagerly on construction)
176
+ * 2. Once fetched, the data is cached for subsequent accesses (performance optimization)
177
+ * 3. Despite being a getter, it behaves like a plain object property (enumerable, appears in Object.keys())
178
+ *
179
+ * **Important**: Properties decorated with `@lazyProp` are defined as own enumerable
180
+ * properties on each instance (not on the prototype). This ensures they:
181
+ * - Appear in Object.keys() and Object.getOwnPropertyNames()
182
+ * - Are included in object spreads ({...obj})
183
+ * - Are enumerable in for...in loops
184
+ *
185
+ * Classes using this decorator must extend `PlainObjectLike` base class.
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * class MyClass extends PlainObjectLike {
190
+ * @lazyProp
191
+ * get expensiveValue() {
192
+ * return someExpensiveComputation();
193
+ * }
194
+ * }
195
+ * ```
196
+ */
197
+ function lazyProp(target, propertyKey, descriptor) {
198
+ if (!target.constructor[LAZY_FIELDS_KEY]) target.constructor[LAZY_FIELDS_KEY] = /* @__PURE__ */ new Map();
199
+ const originalGetter = descriptor.get;
200
+ target.constructor[LAZY_FIELDS_KEY].set(propertyKey, originalGetter);
201
+ return {
202
+ enumerable: false,
203
+ configurable: true
204
+ };
205
+ }
206
+
207
+ //#endregion
208
+ //#region src/utils/asset-source.ts
209
+ function transformAssetSource(bindingAssetSource) {
210
+ return bindingAssetSource.inner;
211
+ }
212
+ function bindingAssetSource(source) {
213
+ return { inner: source };
214
+ }
215
+
216
+ //#endregion
217
+ //#region \0@oxc-project+runtime@0.108.0/helpers/decorate.js
218
+ function __decorate(decorators, target, key, desc) {
219
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
220
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
221
+ 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;
222
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
223
+ }
224
+
225
+ //#endregion
226
+ //#region src/types/output-asset-impl.ts
227
+ var OutputAssetImpl = class extends PlainObjectLike {
228
+ type = "asset";
229
+ constructor(bindingAsset) {
230
+ super();
231
+ this.bindingAsset = bindingAsset;
232
+ }
233
+ get fileName() {
234
+ return this.bindingAsset.getFileName();
235
+ }
236
+ get originalFileName() {
237
+ return this.bindingAsset.getOriginalFileName() || null;
238
+ }
239
+ get originalFileNames() {
240
+ return this.bindingAsset.getOriginalFileNames();
241
+ }
242
+ get name() {
243
+ return this.bindingAsset.getName() ?? void 0;
244
+ }
245
+ get names() {
246
+ return this.bindingAsset.getNames();
247
+ }
248
+ get source() {
249
+ return transformAssetSource(this.bindingAsset.getSource());
250
+ }
251
+ __rolldown_external_memory_handle__(keepDataAlive) {
252
+ if (keepDataAlive) this.#evaluateAllLazyFields();
253
+ return this.bindingAsset.dropInner();
254
+ }
255
+ #evaluateAllLazyFields() {
256
+ for (const field of getLazyFields(this)) this[field];
257
+ }
258
+ };
259
+ __decorate([lazyProp], OutputAssetImpl.prototype, "fileName", null);
260
+ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileName", null);
261
+ __decorate([lazyProp], OutputAssetImpl.prototype, "originalFileNames", null);
262
+ __decorate([lazyProp], OutputAssetImpl.prototype, "name", null);
263
+ __decorate([lazyProp], OutputAssetImpl.prototype, "names", null);
264
+ __decorate([lazyProp], OutputAssetImpl.prototype, "source", null);
265
+
266
+ //#endregion
267
+ //#region src/utils/transform-rendered-module.ts
268
+ function transformToRenderedModule(bindingRenderedModule) {
269
+ return {
270
+ get code() {
271
+ return bindingRenderedModule.code;
272
+ },
273
+ get renderedLength() {
274
+ return bindingRenderedModule.code?.length || 0;
275
+ },
276
+ get renderedExports() {
277
+ return bindingRenderedModule.renderedExports;
278
+ }
279
+ };
280
+ }
281
+
282
+ //#endregion
283
+ //#region src/utils/transform-rendered-chunk.ts
284
+ function transformRenderedChunk(chunk) {
285
+ let modules = null;
286
+ return {
287
+ type: "chunk",
288
+ get name() {
289
+ return chunk.name;
290
+ },
291
+ get isEntry() {
292
+ return chunk.isEntry;
293
+ },
294
+ get isDynamicEntry() {
295
+ return chunk.isDynamicEntry;
296
+ },
297
+ get facadeModuleId() {
298
+ return chunk.facadeModuleId;
299
+ },
300
+ get moduleIds() {
301
+ return chunk.moduleIds;
302
+ },
303
+ get exports() {
304
+ return chunk.exports;
305
+ },
306
+ get fileName() {
307
+ return chunk.fileName;
308
+ },
309
+ get imports() {
310
+ return chunk.imports;
311
+ },
312
+ get dynamicImports() {
313
+ return chunk.dynamicImports;
314
+ },
315
+ get modules() {
316
+ if (!modules) modules = transformChunkModules(chunk.modules);
317
+ return modules;
318
+ }
319
+ };
320
+ }
321
+ function transformChunkModules(modules) {
322
+ const result = {};
323
+ for (let i = 0; i < modules.values.length; i++) {
324
+ let key = modules.keys[i];
325
+ const mod = modules.values[i];
326
+ result[key] = transformToRenderedModule(mod);
327
+ }
328
+ return result;
329
+ }
330
+
331
+ //#endregion
332
+ //#region src/types/output-chunk-impl.ts
333
+ var OutputChunkImpl = class extends PlainObjectLike {
334
+ type = "chunk";
335
+ constructor(bindingChunk) {
336
+ super();
337
+ this.bindingChunk = bindingChunk;
338
+ }
339
+ get fileName() {
340
+ return this.bindingChunk.getFileName();
341
+ }
342
+ get name() {
343
+ return this.bindingChunk.getName();
344
+ }
345
+ get exports() {
346
+ return this.bindingChunk.getExports();
347
+ }
348
+ get isEntry() {
349
+ return this.bindingChunk.getIsEntry();
350
+ }
351
+ get facadeModuleId() {
352
+ return this.bindingChunk.getFacadeModuleId() || null;
353
+ }
354
+ get isDynamicEntry() {
355
+ return this.bindingChunk.getIsDynamicEntry();
356
+ }
357
+ get sourcemapFileName() {
358
+ return this.bindingChunk.getSourcemapFileName() || null;
359
+ }
360
+ get preliminaryFileName() {
361
+ return this.bindingChunk.getPreliminaryFileName();
362
+ }
363
+ get code() {
364
+ return this.bindingChunk.getCode();
365
+ }
366
+ get modules() {
367
+ return transformChunkModules(this.bindingChunk.getModules());
368
+ }
369
+ get imports() {
370
+ return this.bindingChunk.getImports();
371
+ }
372
+ get dynamicImports() {
373
+ return this.bindingChunk.getDynamicImports();
374
+ }
375
+ get moduleIds() {
376
+ return this.bindingChunk.getModuleIds();
377
+ }
378
+ get map() {
379
+ const mapString = this.bindingChunk.getMap();
380
+ return mapString ? transformToRollupSourceMap(mapString) : null;
381
+ }
382
+ __rolldown_external_memory_handle__(keepDataAlive) {
383
+ if (keepDataAlive) this.#evaluateAllLazyFields();
384
+ return this.bindingChunk.dropInner();
385
+ }
386
+ #evaluateAllLazyFields() {
387
+ for (const field of getLazyFields(this)) this[field];
388
+ }
389
+ };
390
+ __decorate([lazyProp], OutputChunkImpl.prototype, "fileName", null);
391
+ __decorate([lazyProp], OutputChunkImpl.prototype, "name", null);
392
+ __decorate([lazyProp], OutputChunkImpl.prototype, "exports", null);
393
+ __decorate([lazyProp], OutputChunkImpl.prototype, "isEntry", null);
394
+ __decorate([lazyProp], OutputChunkImpl.prototype, "facadeModuleId", null);
395
+ __decorate([lazyProp], OutputChunkImpl.prototype, "isDynamicEntry", null);
396
+ __decorate([lazyProp], OutputChunkImpl.prototype, "sourcemapFileName", null);
397
+ __decorate([lazyProp], OutputChunkImpl.prototype, "preliminaryFileName", null);
398
+ __decorate([lazyProp], OutputChunkImpl.prototype, "code", null);
399
+ __decorate([lazyProp], OutputChunkImpl.prototype, "modules", null);
400
+ __decorate([lazyProp], OutputChunkImpl.prototype, "imports", null);
401
+ __decorate([lazyProp], OutputChunkImpl.prototype, "dynamicImports", null);
402
+ __decorate([lazyProp], OutputChunkImpl.prototype, "moduleIds", null);
403
+ __decorate([lazyProp], OutputChunkImpl.prototype, "map", null);
404
+
405
+ //#endregion
406
+ //#region src/types/sourcemap.ts
407
+ function bindingifySourcemap(map) {
408
+ if (map == null) return;
409
+ return { inner: typeof map === "string" ? map : {
410
+ file: map.file ?? void 0,
411
+ mappings: map.mappings,
412
+ sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
413
+ sources: map.sources?.map((s) => s ?? void 0),
414
+ sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
415
+ names: map.names,
416
+ x_google_ignoreList: map.x_google_ignoreList,
417
+ debugId: "debugId" in map ? map.debugId : void 0
418
+ } };
419
+ }
420
+
421
+ //#endregion
422
+ //#region src/utils/transform-to-rollup-output.ts
423
+ function transformToRollupSourceMap(map) {
424
+ const obj = {
425
+ ...JSON.parse(map),
426
+ toString() {
427
+ return JSON.stringify(obj);
428
+ },
429
+ toUrl() {
430
+ return `data:application/json;charset=utf-8;base64,${Buffer.from(obj.toString(), "utf-8").toString("base64")}`;
431
+ }
432
+ };
433
+ return obj;
434
+ }
435
+ function transformToRollupOutputChunk(bindingChunk) {
436
+ return new OutputChunkImpl(bindingChunk);
437
+ }
438
+ function transformToMutableRollupOutputChunk(bindingChunk, changed) {
439
+ const chunk = {
440
+ type: "chunk",
441
+ get code() {
442
+ return bindingChunk.getCode();
443
+ },
444
+ fileName: bindingChunk.getFileName(),
445
+ name: bindingChunk.getName(),
446
+ get modules() {
447
+ return transformChunkModules(bindingChunk.getModules());
448
+ },
449
+ get imports() {
450
+ return bindingChunk.getImports();
451
+ },
452
+ get dynamicImports() {
453
+ return bindingChunk.getDynamicImports();
454
+ },
455
+ exports: bindingChunk.getExports(),
456
+ isEntry: bindingChunk.getIsEntry(),
457
+ facadeModuleId: bindingChunk.getFacadeModuleId() || null,
458
+ isDynamicEntry: bindingChunk.getIsDynamicEntry(),
459
+ get moduleIds() {
460
+ return bindingChunk.getModuleIds();
461
+ },
462
+ get map() {
463
+ const map = bindingChunk.getMap();
464
+ return map ? transformToRollupSourceMap(map) : null;
465
+ },
466
+ sourcemapFileName: bindingChunk.getSourcemapFileName() || null,
467
+ preliminaryFileName: bindingChunk.getPreliminaryFileName()
468
+ };
469
+ const cache = {};
470
+ return new Proxy(chunk, {
471
+ get(target, p) {
472
+ if (p in cache) return cache[p];
473
+ const value = target[p];
474
+ cache[p] = value;
475
+ return value;
476
+ },
477
+ set(_target, p, newValue) {
478
+ cache[p] = newValue;
479
+ changed.updated.add(bindingChunk.getFileName());
480
+ return true;
481
+ },
482
+ has(target, p) {
483
+ if (p in cache) return true;
484
+ return p in target;
485
+ }
486
+ });
487
+ }
488
+ function transformToRollupOutputAsset(bindingAsset) {
489
+ return new OutputAssetImpl(bindingAsset);
490
+ }
491
+ function transformToMutableRollupOutputAsset(bindingAsset, changed) {
492
+ const asset = {
493
+ type: "asset",
494
+ fileName: bindingAsset.getFileName(),
495
+ originalFileName: bindingAsset.getOriginalFileName() || null,
496
+ originalFileNames: bindingAsset.getOriginalFileNames(),
497
+ get source() {
498
+ return transformAssetSource(bindingAsset.getSource());
499
+ },
500
+ name: bindingAsset.getName() ?? void 0,
501
+ names: bindingAsset.getNames()
502
+ };
503
+ const cache = {};
504
+ return new Proxy(asset, {
505
+ get(target, p) {
506
+ if (p in cache) return cache[p];
507
+ const value = target[p];
508
+ cache[p] = value;
509
+ return value;
510
+ },
511
+ set(_target, p, newValue) {
512
+ cache[p] = newValue;
513
+ changed.updated.add(bindingAsset.getFileName());
514
+ return true;
515
+ }
516
+ });
517
+ }
518
+ function transformToRollupOutput(output) {
519
+ const { chunks, assets } = output;
520
+ return { output: [...chunks.map((chunk) => transformToRollupOutputChunk(chunk)), ...assets.map((asset) => transformToRollupOutputAsset(asset))] };
521
+ }
522
+ function transformToMutableRollupOutput(output, changed) {
523
+ const { chunks, assets } = output;
524
+ return { output: [...chunks.map((chunk) => transformToMutableRollupOutputChunk(chunk, changed)), ...assets.map((asset) => transformToMutableRollupOutputAsset(asset, changed))] };
525
+ }
526
+ function transformToOutputBundle(context, output, changed) {
527
+ const bundle = Object.fromEntries(transformToMutableRollupOutput(output, changed).output.map((item) => [item.fileName, item]));
528
+ return new Proxy(bundle, {
529
+ set(_target, _p, _newValue, _receiver) {
530
+ const originalStackTraceLimit = Error.stackTraceLimit;
531
+ Error.stackTraceLimit = 2;
532
+ 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.";
533
+ const stack = new Error(message).stack ?? message;
534
+ Error.stackTraceLimit = originalStackTraceLimit;
535
+ context.warn({
536
+ message: stack,
537
+ code: "UNSUPPORTED_BUNDLE_ASSIGNMENT"
538
+ });
539
+ return true;
540
+ },
541
+ deleteProperty(target, property) {
542
+ if (typeof property === "string") changed.deleted.add(property);
543
+ return true;
544
+ }
545
+ });
546
+ }
547
+ function collectChangedBundle(changed, bundle) {
548
+ const changes = {};
549
+ for (const key in bundle) {
550
+ if (changed.deleted.has(key) || !changed.updated.has(key)) continue;
551
+ const item = bundle[key];
552
+ if (item.type === "asset") changes[key] = {
553
+ filename: item.fileName,
554
+ originalFileNames: item.originalFileNames,
555
+ source: bindingAssetSource(item.source),
556
+ names: item.names
557
+ };
558
+ else changes[key] = {
559
+ code: item.code,
560
+ filename: item.fileName,
561
+ name: item.name,
562
+ isEntry: item.isEntry,
563
+ exports: item.exports,
564
+ modules: {},
565
+ imports: item.imports,
566
+ dynamicImports: item.dynamicImports,
567
+ facadeModuleId: item.facadeModuleId || void 0,
568
+ isDynamicEntry: item.isDynamicEntry,
569
+ moduleIds: item.moduleIds,
570
+ map: bindingifySourcemap(item.map),
571
+ sourcemapFilename: item.sourcemapFileName || void 0,
572
+ preliminaryFilename: item.preliminaryFileName
573
+ };
574
+ }
575
+ return {
576
+ changes,
577
+ deleted: changed.deleted
578
+ };
579
+ }
580
+
28
581
  //#endregion
29
582
  //#region src/utils/error.ts
30
583
  function unwrapBindingResult(container) {
@@ -132,9 +685,9 @@ function normalizeTransformHookSourcemap(id$1, originalCode, rawMap) {
132
685
  }
133
686
 
134
687
  //#endregion
135
- //#region ../../node_modules/.pnpm/remeda@2.33.0/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
136
- function e(e$1, t$2, n$1) {
137
- let r = (n$2) => e$1(n$2, ...t$2);
688
+ //#region ../../node_modules/.pnpm/remeda@2.33.1/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
689
+ function e(e, t$2, n$1) {
690
+ let r = (n$2) => e(n$2, ...t$2);
138
691
  return n$1 === void 0 ? r : Object.assign(r, {
139
692
  lazy: n$1,
140
693
  lazyArgs: t$2
@@ -142,7 +695,7 @@ function e(e$1, t$2, n$1) {
142
695
  }
143
696
 
144
697
  //#endregion
145
- //#region ../../node_modules/.pnpm/remeda@2.33.0/node_modules/remeda/dist/purry-GjwKKIlp.js
698
+ //#region ../../node_modules/.pnpm/remeda@2.33.1/node_modules/remeda/dist/purry-GjwKKIlp.js
146
699
  function t$1(t$2, n$1, r) {
147
700
  let i = t$2.length - n$1.length;
148
701
  if (i === 0) return t$2(...n$1);
@@ -151,14 +704,14 @@ function t$1(t$2, n$1, r) {
151
704
  }
152
705
 
153
706
  //#endregion
154
- //#region ../../node_modules/.pnpm/remeda@2.33.0/node_modules/remeda/dist/partition.js
155
- function t(...t$2) {
156
- return t$1(n, t$2);
157
- }
158
- const n = (e$1, t$2) => {
159
- let n$1 = [[], []];
160
- for (let [r, i] of e$1.entries()) t$2(i, r, e$1) ? n$1[0].push(i) : n$1[1].push(i);
161
- return n$1;
707
+ //#region ../../node_modules/.pnpm/remeda@2.33.1/node_modules/remeda/dist/partition.js
708
+ function t(...t) {
709
+ return t$1(n, t);
710
+ }
711
+ const n = (e$1, t) => {
712
+ let n = [[], []];
713
+ for (let [r, i] of e$1.entries()) t(i, r, e$1) ? n[0].push(i) : n[1].push(i);
714
+ return n;
162
715
  };
163
716
 
164
717
  //#endregion
@@ -467,16 +1020,16 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
467
1020
  this.inner = inner;
468
1021
  this.moduleId = moduleId;
469
1022
  this.moduleSource = moduleSource;
470
- const getLogHandler = (handler) => (log, pos) => {
1023
+ const getLogHandler$1 = (handler) => (log, pos) => {
471
1024
  log = normalizeLog(log);
472
1025
  if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
473
1026
  log.id = moduleId;
474
1027
  log.hook = "transform";
475
1028
  handler(log);
476
1029
  };
477
- this.debug = getLogHandler(this.debug);
478
- this.warn = getLogHandler(this.warn);
479
- this.info = getLogHandler(this.info);
1030
+ this.debug = getLogHandler$1(this.debug);
1031
+ this.warn = getLogHandler$1(this.warn);
1032
+ this.info = getLogHandler$1(this.info);
480
1033
  }
481
1034
  error(e$1, pos) {
482
1035
  if (typeof e$1 === "string") e$1 = { message: e$1 };
@@ -792,8 +1345,8 @@ function bindingifyCloseBundle(args) {
792
1345
  if (!hook) return {};
793
1346
  const { handler, meta } = normalizeHook(hook);
794
1347
  return {
795
- plugin: async (ctx) => {
796
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
1348
+ plugin: async (ctx, err) => {
1349
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
797
1350
  },
798
1351
  meta: bindingifyPluginHookMeta(meta)
799
1352
  };
@@ -874,29 +1427,29 @@ function bindingifyCloseWatcher(args) {
874
1427
 
875
1428
  //#endregion
876
1429
  //#region src/plugin/generated/hook-usage.ts
877
- let HookUsageKind = /* @__PURE__ */ function(HookUsageKind$1) {
878
- HookUsageKind$1[HookUsageKind$1["buildStart"] = 1] = "buildStart";
879
- HookUsageKind$1[HookUsageKind$1["resolveId"] = 2] = "resolveId";
880
- HookUsageKind$1[HookUsageKind$1["resolveDynamicImport"] = 4] = "resolveDynamicImport";
881
- HookUsageKind$1[HookUsageKind$1["load"] = 8] = "load";
882
- HookUsageKind$1[HookUsageKind$1["transform"] = 16] = "transform";
883
- HookUsageKind$1[HookUsageKind$1["moduleParsed"] = 32] = "moduleParsed";
884
- HookUsageKind$1[HookUsageKind$1["buildEnd"] = 64] = "buildEnd";
885
- HookUsageKind$1[HookUsageKind$1["renderStart"] = 128] = "renderStart";
886
- HookUsageKind$1[HookUsageKind$1["renderError"] = 256] = "renderError";
887
- HookUsageKind$1[HookUsageKind$1["renderChunk"] = 512] = "renderChunk";
888
- HookUsageKind$1[HookUsageKind$1["augmentChunkHash"] = 1024] = "augmentChunkHash";
889
- HookUsageKind$1[HookUsageKind$1["generateBundle"] = 2048] = "generateBundle";
890
- HookUsageKind$1[HookUsageKind$1["writeBundle"] = 4096] = "writeBundle";
891
- HookUsageKind$1[HookUsageKind$1["closeBundle"] = 8192] = "closeBundle";
892
- HookUsageKind$1[HookUsageKind$1["watchChange"] = 16384] = "watchChange";
893
- HookUsageKind$1[HookUsageKind$1["closeWatcher"] = 32768] = "closeWatcher";
894
- HookUsageKind$1[HookUsageKind$1["transformAst"] = 65536] = "transformAst";
895
- HookUsageKind$1[HookUsageKind$1["banner"] = 131072] = "banner";
896
- HookUsageKind$1[HookUsageKind$1["footer"] = 262144] = "footer";
897
- HookUsageKind$1[HookUsageKind$1["intro"] = 524288] = "intro";
898
- HookUsageKind$1[HookUsageKind$1["outro"] = 1048576] = "outro";
899
- return HookUsageKind$1;
1430
+ let HookUsageKind = /* @__PURE__ */ function(HookUsageKind) {
1431
+ HookUsageKind[HookUsageKind["buildStart"] = 1] = "buildStart";
1432
+ HookUsageKind[HookUsageKind["resolveId"] = 2] = "resolveId";
1433
+ HookUsageKind[HookUsageKind["resolveDynamicImport"] = 4] = "resolveDynamicImport";
1434
+ HookUsageKind[HookUsageKind["load"] = 8] = "load";
1435
+ HookUsageKind[HookUsageKind["transform"] = 16] = "transform";
1436
+ HookUsageKind[HookUsageKind["moduleParsed"] = 32] = "moduleParsed";
1437
+ HookUsageKind[HookUsageKind["buildEnd"] = 64] = "buildEnd";
1438
+ HookUsageKind[HookUsageKind["renderStart"] = 128] = "renderStart";
1439
+ HookUsageKind[HookUsageKind["renderError"] = 256] = "renderError";
1440
+ HookUsageKind[HookUsageKind["renderChunk"] = 512] = "renderChunk";
1441
+ HookUsageKind[HookUsageKind["augmentChunkHash"] = 1024] = "augmentChunkHash";
1442
+ HookUsageKind[HookUsageKind["generateBundle"] = 2048] = "generateBundle";
1443
+ HookUsageKind[HookUsageKind["writeBundle"] = 4096] = "writeBundle";
1444
+ HookUsageKind[HookUsageKind["closeBundle"] = 8192] = "closeBundle";
1445
+ HookUsageKind[HookUsageKind["watchChange"] = 16384] = "watchChange";
1446
+ HookUsageKind[HookUsageKind["closeWatcher"] = 32768] = "closeWatcher";
1447
+ HookUsageKind[HookUsageKind["transformAst"] = 65536] = "transformAst";
1448
+ HookUsageKind[HookUsageKind["banner"] = 131072] = "banner";
1449
+ HookUsageKind[HookUsageKind["footer"] = 262144] = "footer";
1450
+ HookUsageKind[HookUsageKind["intro"] = 524288] = "intro";
1451
+ HookUsageKind[HookUsageKind["outro"] = 1048576] = "outro";
1452
+ return HookUsageKind;
900
1453
  }({});
901
1454
  var HookUsage = class {
902
1455
  bitflag = BigInt(0);
@@ -1394,8 +1947,6 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, normali
1394
1947
  const plugins = rawPlugins.map((plugin) => {
1395
1948
  if ("_parallel" in plugin) return;
1396
1949
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
1397
- case "builtin:vite-css-post": return bindingifyCSSPostPlugin(plugin, pluginContextData);
1398
- case "builtin:vite-html": return bindingifyViteHtmlPlugin(plugin, onLog, logLevel, watchMode, pluginContextData);
1399
1950
  case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
1400
1951
  default: return bindingifyBuiltInPlugin(plugin);
1401
1952
  }
@@ -1478,7 +2029,6 @@ function bindingifyExperimental(experimental) {
1478
2029
  }
1479
2030
  return {
1480
2031
  strictExecutionOrder: experimental?.strictExecutionOrder,
1481
- disableLiveBindings: experimental?.disableLiveBindings,
1482
2032
  viteMode: experimental?.viteMode,
1483
2033
  resolveNewUrlToAsset: experimental?.resolveNewUrlToAsset,
1484
2034
  devMode: bindingifyDevMode(experimental?.devMode),
@@ -1619,4 +2169,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
1619
2169
  }
1620
2170
 
1621
2171
  //#endregion
1622
- export { aggregateBindingErrorsIntoJsError as a, normalizeHook as c, transformModuleInfo as i, PluginContextData as n, normalizeBindingResult as o, bindingifyPlugin as r, unwrapBindingResult as s, bindingifyInputOptions as t };
2172
+ export { description as C, VERSION as S, LOG_LEVEL_DEBUG as _, aggregateBindingErrorsIntoJsError as a, LOG_LEVEL_WARN as b, transformToRollupOutput as c, transformAssetSource as d, lazyProp as f, normalizeLog as g, normalizeHook as h, transformModuleInfo as i, transformRenderedChunk as l, MinimalPluginContextImpl as m, PluginContextData as n, normalizeBindingResult as o, PlainObjectLike as p, bindingifyPlugin as r, unwrapBindingResult as s, bindingifyInputOptions as t, __decorate as u, LOG_LEVEL_ERROR as v, version as w, logLevelPriority as x, LOG_LEVEL_INFO as y };