@rollipop/rolldown 1.0.24 → 1.0.26

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 (49) hide show
  1. package/THIRD-PARTY-LICENSE +33 -0
  2. package/dist/cli.mjs +9 -10
  3. package/dist/config.d.mts +16 -17
  4. package/dist/config.mjs +2 -2
  5. package/dist/experimental-default-runtime.mjs +116 -0
  6. package/dist/experimental-index.d.mts +220 -205
  7. package/dist/experimental-index.mjs +47 -22
  8. package/dist/experimental-runtime-base.mjs +95 -0
  9. package/dist/experimental-runtime-types.d.ts +111 -41
  10. package/dist/experimental-runtime.d.ts +177 -0
  11. package/dist/experimental-runtime.mjs +257 -0
  12. package/dist/filter-index.d.mts +6 -5
  13. package/dist/filter-index.mjs +1 -3
  14. package/dist/get-log-filter.d.mts +2 -2
  15. package/dist/index.d.mts +4 -4
  16. package/dist/index.mjs +4 -4
  17. package/dist/parallel-plugin-worker.mjs +2 -2
  18. package/dist/parallel-plugin.d.mts +3 -4
  19. package/dist/parse-ast-index.d.mts +19 -20
  20. package/dist/parse-ast-index.mjs +2 -2
  21. package/dist/plugins-index.d.mts +27 -28
  22. package/dist/plugins-index.mjs +2 -2
  23. package/dist/shared/{binding-DLP3kSP5.mjs → binding-D_XVvOPT.mjs} +124 -50
  24. package/dist/shared/{binding-FraDreAW.d.mts → binding-We_IfeZk.d.mts} +48 -25
  25. package/dist/shared/{bindingify-input-options-DQnooxIa.mjs → bindingify-input-options-BXQG8xz-.mjs} +213 -262
  26. package/dist/shared/{constructors-CXtPAgZN.d.mts → constructors-BIHQ8UmW.d.mts} +9 -10
  27. package/dist/shared/{constructors-DpCCe7z3.mjs → constructors-CNB5XL7Q.mjs} +10 -6
  28. package/dist/shared/{rolldown-build-Blclcr5k.mjs → create-bundler-option-Be4KJzGL.mjs} +39 -156
  29. package/dist/shared/define-config-thpMQ05a.d.mts +4096 -0
  30. package/dist/shared/{error-CIdnbKmG.mjs → error-bm-jLrD1.mjs} +1 -1
  31. package/dist/shared/get-log-filter-B6CU6b90.d.mts +34 -0
  32. package/dist/shared/{load-config-5r6l-9qr.mjs → load-config-Bu7-JwX4.mjs} +2 -2
  33. package/dist/shared/{logging-BSNejiLS.d.mts → logging-xuHO4mAy.d.mts} +6 -6
  34. package/dist/shared/{logs-ZGEh6uhb.mjs → logs-DmYCAKcW.mjs} +8 -1
  35. package/dist/shared/{misc-CoQm4NHO.mjs → misc-DOSKtd97.mjs} +9 -1
  36. package/dist/shared/{normalize-string-or-regex-oITfWWWc.mjs → normalize-string-or-regex-CiPu-0L6.mjs} +2 -2
  37. package/dist/shared/{parse-CI_bqXWS.mjs → parse-DFZrcERz.mjs} +2 -2
  38. package/dist/shared/{prompt--dNycKSZ.mjs → prompt-CH6TK0bC.mjs} +2 -6
  39. package/dist/shared/{resolve-tsconfig-9cpL_qUM.mjs → resolve-tsconfig-CsDgQmsO.mjs} +2 -2
  40. package/dist/shared/rolldown-CnVo3ESi.mjs +178 -0
  41. package/dist/shared/transform-CsZGbS4Q.d.mts +148 -0
  42. package/dist/shared/{watch-DElgNTzo.mjs → watch-WV6bq5kw.mjs} +16 -13
  43. package/dist/utils-index.d.mts +29 -30
  44. package/dist/utils-index.mjs +6 -8
  45. package/package.json +25 -16
  46. package/dist/shared/define-config-oNOGrLUX.d.mts +0 -4008
  47. package/dist/shared/get-log-filter-B4LpBryx.d.mts +0 -35
  48. package/dist/shared/rolldown-DBxQ1pTJ.mjs +0 -40
  49. package/dist/shared/transform-DmrnpNrQ.d.mts +0 -149
@@ -1,14 +1,16 @@
1
- import { n as __toESM, t as require_binding } from "./binding-DLP3kSP5.mjs";
2
- import { a as logInvalidLogPosition, c as logPluginError, n as error, r as logCycleLoading, t as augmentCodeLocation } from "./logs-ZGEh6uhb.mjs";
3
- import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-oITfWWWc.mjs";
4
- import { a as unreachable, o as unsupported, r as noop, t as arraify } from "./misc-CoQm4NHO.mjs";
5
- import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-CIdnbKmG.mjs";
1
+ import { n as __toESM, t as require_binding } from "./binding-D_XVvOPT.mjs";
2
+ import { i as logFailedValidation, l as logPluginError, n as error, o as logInvalidLogPosition, r as logCycleLoading, t as augmentCodeLocation } from "./logs-DmYCAKcW.mjs";
3
+ import { i as bindingifyManifestPlugin, n as BuiltinPlugin, r as bindingifyBuiltInPlugin, t as normalizedStringOrRegex } from "./normalize-string-or-regex-CiPu-0L6.mjs";
4
+ import { i as noop, n as isPathFragment, o as unreachable, s as unsupported, t as arraify } from "./misc-DOSKtd97.mjs";
5
+ import { a as bindingifySourcemap, i as unwrapBindingResult, t as aggregateBindingErrorsIntoJsError } from "./error-bm-jLrD1.mjs";
6
6
  import { parseAst } from "../parse-ast-index.mjs";
7
+ import fs from "node:fs";
7
8
  import path from "node:path";
8
9
  import * as filter from "@rolldown/pluginutils";
9
10
  import fsp from "node:fs/promises";
11
+ import { fileURLToPath } from "node:url";
10
12
  //#region package.json
11
- var version = "1.0.24";
13
+ var version = "1.0.26";
12
14
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
13
15
  //#endregion
14
16
  //#region src/constants/version.ts
@@ -65,6 +67,26 @@ function normalizeHook(hook) {
65
67
  unreachable("Invalid hook type");
66
68
  }
67
69
  //#endregion
70
+ //#region src/utils/parallel-plugin.ts
71
+ /**
72
+ * Returns the `_parallel` marker of a parallel plugin, or `undefined` if the
73
+ * given plugin is not one.
74
+ *
75
+ * Detection is descriptor-based instead of using the `in` operator: only an
76
+ * own data property named `_parallel` with the expected shape counts. This
77
+ * avoids false positives from inherited or accessor `_parallel` properties on
78
+ * regular plugins, and guarantees that callers can safely read `fileUrl` and
79
+ * `options` from the returned value.
80
+ */
81
+ function getParallelPluginInfo(plugin) {
82
+ if (plugin === null || typeof plugin !== "object") return;
83
+ const descriptor = Object.getOwnPropertyDescriptor(plugin, "_parallel");
84
+ if (!descriptor || !("value" in descriptor)) return;
85
+ const parallel = descriptor.value;
86
+ if (parallel === null || typeof parallel !== "object" || typeof parallel.fileUrl !== "string") return;
87
+ return parallel;
88
+ }
89
+ //#endregion
68
90
  //#region src/plugin/minimal-plugin-context.ts
69
91
  var MinimalPluginContextImpl = class {
70
92
  pluginName;
@@ -214,7 +236,7 @@ function bindingAssetSource(source) {
214
236
  return { inner: source };
215
237
  }
216
238
  //#endregion
217
- //#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorate.js
239
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
218
240
  function __decorate(decorators, target, key, desc) {
219
241
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
220
242
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -1087,6 +1109,20 @@ function containsImporterId(expr) {
1087
1109
  function assertNoImporterId(filterExprs, hookName) {
1088
1110
  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.`);
1089
1111
  }
1112
+ function containsStringId(expr) {
1113
+ switch (expr.kind) {
1114
+ case "and":
1115
+ case "or": return expr.args.some(containsStringId);
1116
+ case "not":
1117
+ case "include":
1118
+ case "exclude": return containsStringId(expr.expr);
1119
+ case "id": return typeof expr.pattern === "string";
1120
+ default: return false;
1121
+ }
1122
+ }
1123
+ function assertNoStringId(filterExprs, hookName) {
1124
+ 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.`);
1125
+ }
1090
1126
  function bindingifyFilterExprImpl(expr, list) {
1091
1127
  switch (expr.kind) {
1092
1128
  case "and": {
@@ -1160,8 +1196,11 @@ function bindingifyFilterExprImpl(expr, list) {
1160
1196
  }
1161
1197
  function bindingifyResolveIdFilter(filterOption) {
1162
1198
  if (!filterOption) return;
1163
- if (Array.isArray(filterOption)) return { value: filterOption.map(bindingifyFilterExpr) };
1164
- return filterOption.id ? bindingifyGeneralHookFilter("id", filterOption.id) : void 0;
1199
+ const filterExprs = Array.isArray(filterOption) ? filterOption : filterOption.id ? generalHookFilterMatcherToFilterExprs(filterOption.id, "id") : void 0;
1200
+ assertNoStringId(filterExprs, "resolveId");
1201
+ if (!filterExprs) return;
1202
+ const value = filterExprs.map(bindingifyFilterExpr);
1203
+ return value.length > 0 ? { value } : void 0;
1165
1204
  }
1166
1205
  function bindingifyLoadFilter(filterOption) {
1167
1206
  if (!filterOption) return;
@@ -1201,6 +1240,14 @@ function bindingPluginOrder(order) {
1201
1240
  default: throw new Error(`Unknown plugin order: ${order}`);
1202
1241
  }
1203
1242
  }
1243
+ function bindingifyHook(hook, build) {
1244
+ if (!hook) return {};
1245
+ const normalized = normalizeHook(hook);
1246
+ return {
1247
+ ...build(normalized),
1248
+ meta: bindingifyPluginHookMeta(normalized.meta)
1249
+ };
1250
+ }
1204
1251
  //#endregion
1205
1252
  //#region src/plugin/fs.ts
1206
1253
  const fsModule = {
@@ -1284,17 +1331,23 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1284
1331
  };
1285
1332
  }
1286
1333
  emitFile = (file) => {
1287
- if (file.type === "prebuilt-chunk") return this.context.emitPrebuiltChunk({
1288
- fileName: file.fileName,
1289
- name: file.name,
1290
- code: file.code,
1291
- exports: file.exports,
1292
- map: bindingifySourcemap(file.map),
1293
- sourcemapFileName: file.sourcemapFileName,
1294
- facadeModuleId: file.facadeModuleId,
1295
- isEntry: file.isEntry,
1296
- isDynamicEntry: file.isDynamicEntry
1297
- });
1334
+ if (file.type === "prebuilt-chunk") {
1335
+ if (typeof file.code !== "string") return error(logFailedValidation(`Emitted prebuilt chunks need to have a valid string code, received "${file.code}".`));
1336
+ 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}".`));
1337
+ return this.context.emitPrebuiltChunk({
1338
+ fileName: file.fileName,
1339
+ name: file.name,
1340
+ code: file.code,
1341
+ exports: file.exports,
1342
+ map: bindingifySourcemap(file.map),
1343
+ sourcemapFileName: file.sourcemapFileName,
1344
+ facadeModuleId: file.facadeModuleId,
1345
+ isEntry: file.isEntry,
1346
+ isDynamicEntry: file.isDynamicEntry
1347
+ });
1348
+ }
1349
+ const validatedName = file.fileName || file.name;
1350
+ 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}".`));
1298
1351
  if (file.type === "chunk") return this.context.emitChunk({
1299
1352
  preserveEntrySignatures: bindingifyPreserveEntrySignatures(file.preserveSignature),
1300
1353
  ...file
@@ -1330,6 +1383,9 @@ var PluginContextImpl = class extends MinimalPluginContextImpl {
1330
1383
  return parseAst(input, options);
1331
1384
  }
1332
1385
  };
1386
+ function createPluginContext(args, ctx) {
1387
+ return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
1388
+ }
1333
1389
  //#endregion
1334
1390
  //#region src/plugin/load-plugin-context.ts
1335
1391
  var LoadPluginContextImpl = class extends PluginContextImpl {
@@ -1383,36 +1439,19 @@ var TransformPluginContextImpl = class extends PluginContextImpl {
1383
1439
  };
1384
1440
  //#endregion
1385
1441
  //#region src/plugin/bindingify-build-hooks.ts
1386
- function createPluginContext(args, ctx) {
1387
- return new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
1388
- }
1389
1442
  function bindingifyBuildStart(args) {
1390
- const hook = args.plugin.buildStart;
1391
- if (!hook) return {};
1392
- const { handler, meta } = normalizeHook(hook);
1393
- return {
1394
- plugin: async (ctx, opts) => {
1395
- await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
1396
- },
1397
- meta: bindingifyPluginHookMeta(meta)
1398
- };
1443
+ return bindingifyHook(args.plugin.buildStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
1444
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getInputOptions(opts));
1445
+ } }));
1399
1446
  }
1400
1447
  function bindingifyBuildEnd(args) {
1401
- const hook = args.plugin.buildEnd;
1402
- if (!hook) return {};
1403
- const { handler, meta } = normalizeHook(hook);
1404
- return {
1405
- plugin: async (ctx, err) => {
1406
- await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1407
- },
1408
- meta: bindingifyPluginHookMeta(meta)
1409
- };
1448
+ return bindingifyHook(args.plugin.buildEnd, ({ handler }) => ({ plugin: async (ctx, err) => {
1449
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1450
+ } }));
1410
1451
  }
1411
1452
  function bindingifyResolveId(args) {
1412
1453
  const hook = args.plugin.resolveId;
1413
- if (!hook) return {};
1414
- const { handler, meta, options } = normalizeHook(hook);
1415
- return {
1454
+ return bindingifyHook(hook, ({ handler, options }) => ({
1416
1455
  plugin: async (ctx, specifier, importer, extraOptions) => {
1417
1456
  const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : void 0;
1418
1457
  const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0, {
@@ -1442,44 +1481,34 @@ function bindingifyResolveId(args) {
1442
1481
  packageJsonPath: ret.packageJsonPath
1443
1482
  };
1444
1483
  },
1445
- meta: bindingifyPluginHookMeta(meta),
1446
1484
  filter: bindingifyResolveIdFilter(options.filter)
1447
- };
1485
+ }));
1448
1486
  }
1449
1487
  function bindingifyResolveDynamicImport(args) {
1450
- const hook = args.plugin.resolveDynamicImport;
1451
- if (!hook) return {};
1452
- const { handler, meta } = normalizeHook(hook);
1453
- return {
1454
- plugin: async (ctx, specifier, importer) => {
1455
- const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
1456
- if (ret == null) return;
1457
- if (ret === false) return {
1458
- id: specifier,
1459
- external: true
1460
- };
1461
- if (typeof ret === "string") return { id: ret };
1462
- const result = {
1463
- id: ret.id,
1464
- external: ret.external,
1465
- packageJsonPath: ret.packageJsonPath
1466
- };
1467
- if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
1468
- args.pluginContextData.updateModuleOption(ret.id, {
1469
- meta: ret.meta || {},
1470
- moduleSideEffects: ret.moduleSideEffects || null,
1471
- invalidate: false
1472
- });
1473
- return result;
1474
- },
1475
- meta: bindingifyPluginHookMeta(meta)
1476
- };
1488
+ return bindingifyHook(args.plugin.resolveDynamicImport, ({ handler }) => ({ plugin: async (ctx, specifier, importer) => {
1489
+ const ret = await handler.call(createPluginContext(args, ctx), specifier, importer ?? void 0);
1490
+ if (ret == null) return;
1491
+ if (ret === false) return {
1492
+ id: specifier,
1493
+ external: true
1494
+ };
1495
+ if (typeof ret === "string") return { id: ret };
1496
+ const result = {
1497
+ id: ret.id,
1498
+ external: ret.external,
1499
+ packageJsonPath: ret.packageJsonPath
1500
+ };
1501
+ if (ret.moduleSideEffects !== null) result.moduleSideEffects = ret.moduleSideEffects;
1502
+ args.pluginContextData.updateModuleOption(ret.id, {
1503
+ meta: ret.meta || {},
1504
+ moduleSideEffects: ret.moduleSideEffects || null,
1505
+ invalidate: false
1506
+ });
1507
+ return result;
1508
+ } }));
1477
1509
  }
1478
1510
  function bindingifyTransform(args) {
1479
- const hook = args.plugin.transform;
1480
- if (!hook) return {};
1481
- const { handler, meta, options } = normalizeHook(hook);
1482
- return {
1511
+ return bindingifyHook(args.plugin.transform, ({ handler, options }) => ({
1483
1512
  plugin: async (ctx, code, id, meta) => {
1484
1513
  let magicStringInstance, astInstance;
1485
1514
  Object.defineProperties(meta, {
@@ -1495,10 +1524,7 @@ function bindingifyTransform(args) {
1495
1524
  case "js":
1496
1525
  case "jsx":
1497
1526
  case "ts":
1498
- case "tsx":
1499
- lang = meta.moduleType;
1500
- break;
1501
- default: break;
1527
+ case "tsx": lang = meta.moduleType;
1502
1528
  }
1503
1529
  astInstance = parseAst(code, {
1504
1530
  astType: meta.moduleType.includes("ts") ? "ts" : "js",
@@ -1534,15 +1560,11 @@ function bindingifyTransform(args) {
1534
1560
  moduleType: ret.moduleType
1535
1561
  };
1536
1562
  },
1537
- meta: bindingifyPluginHookMeta(meta),
1538
1563
  filter: bindingifyTransformFilter(options.filter)
1539
- };
1564
+ }));
1540
1565
  }
1541
1566
  function bindingifyLoad(args) {
1542
- const hook = args.plugin.load;
1543
- if (!hook) return {};
1544
- const { handler, meta, options } = normalizeHook(hook);
1545
- return {
1567
+ return bindingifyHook(args.plugin.load, ({ handler, options }) => ({
1546
1568
  plugin: async (ctx, id) => {
1547
1569
  const ret = await handler.call(new LoadPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, args.onLog, args.logLevel, args.watchMode), id);
1548
1570
  if (ret == null) return;
@@ -1560,9 +1582,8 @@ function bindingifyLoad(args) {
1560
1582
  moduleSideEffects: moduleOption.moduleSideEffects ?? void 0
1561
1583
  };
1562
1584
  },
1563
- meta: bindingifyPluginHookMeta(meta),
1564
1585
  filter: bindingifyLoadFilter(options.filter)
1565
- };
1586
+ }));
1566
1587
  }
1567
1588
  function preProcessSourceMap(ret, id) {
1568
1589
  if (!ret.map) return;
@@ -1575,45 +1596,24 @@ function preProcessSourceMap(ret, id) {
1575
1596
  return map;
1576
1597
  }
1577
1598
  function bindingifyModuleParsed(args) {
1578
- const hook = args.plugin.moduleParsed;
1579
- if (!hook) return {};
1580
- const { handler, meta } = normalizeHook(hook);
1581
- return {
1582
- plugin: async (ctx, moduleInfo) => {
1583
- await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1584
- },
1585
- meta: bindingifyPluginHookMeta(meta)
1586
- };
1599
+ return bindingifyHook(args.plugin.moduleParsed, ({ handler }) => ({ plugin: async (ctx, moduleInfo) => {
1600
+ await handler.call(createPluginContext(args, ctx), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1601
+ } }));
1587
1602
  }
1588
1603
  function bindingifyTransformCacheHit(args) {
1589
- const hook = args.plugin.transformCacheHit;
1590
- if (!hook) return {};
1591
- const { handler, meta } = normalizeHook(hook);
1592
- return {
1593
- plugin: async (ctx, id) => {
1594
- await handler.call(createPluginContext(args, ctx), id);
1595
- },
1596
- meta: bindingifyPluginHookMeta(meta)
1597
- };
1604
+ return bindingifyHook(args.plugin.transformCacheHit, ({ handler }) => ({ plugin: async (ctx, id) => {
1605
+ await handler.call(createPluginContext(args, ctx), id);
1606
+ } }));
1598
1607
  }
1599
1608
  //#endregion
1600
1609
  //#region src/plugin/bindingify-output-hooks.ts
1601
1610
  function bindingifyRenderStart(args) {
1602
- const hook = args.plugin.renderStart;
1603
- if (!hook) return {};
1604
- const { handler, meta } = normalizeHook(hook);
1605
- return {
1606
- plugin: async (ctx, opts) => {
1607
- 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));
1608
- },
1609
- meta: bindingifyPluginHookMeta(meta)
1610
- };
1611
+ return bindingifyHook(args.plugin.renderStart, ({ handler }) => ({ plugin: async (ctx, opts) => {
1612
+ await handler.call(createPluginContext(args, ctx), args.pluginContextData.getOutputOptions(opts), args.pluginContextData.getInputOptions(opts));
1613
+ } }));
1611
1614
  }
1612
1615
  function bindingifyRenderChunk(args) {
1613
- const hook = args.plugin.renderChunk;
1614
- if (!hook) return {};
1615
- const { handler, meta, options } = normalizeHook(hook);
1616
- return {
1616
+ return bindingifyHook(args.plugin.renderChunk, ({ handler, options }) => ({
1617
1617
  plugin: async (ctx, code, chunk, opts, meta) => {
1618
1618
  if (args.pluginContextData.getRenderChunkMeta() == null) args.pluginContextData.setRenderChunkMeta({ chunks: Object.fromEntries(Object.entries(meta.chunks).map(([key, value]) => [key, transformRenderedChunk(value)])) });
1619
1619
  const renderChunkMeta = args.pluginContextData.getRenderChunkMeta();
@@ -1626,7 +1626,7 @@ function bindingifyRenderChunk(args) {
1626
1626
  },
1627
1627
  configurable: true
1628
1628
  });
1629
- const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
1629
+ const ret = await handler.call(createPluginContext(args, ctx), code, transformRenderedChunk(chunk), args.pluginContextData.getOutputOptions(opts), renderChunkMeta);
1630
1630
  if (ret == null) return;
1631
1631
  if (ret instanceof RolldownMagicString) {
1632
1632
  const normalizedCode = ret.toString();
@@ -1677,150 +1677,81 @@ function bindingifyRenderChunk(args) {
1677
1677
  map: bindingifySourcemap(ret.map)
1678
1678
  };
1679
1679
  },
1680
- meta: bindingifyPluginHookMeta(meta),
1681
1680
  filter: bindingifyRenderChunkFilter(options.filter)
1682
- };
1681
+ }));
1683
1682
  }
1684
1683
  function bindingifyAugmentChunkHash(args) {
1685
- const hook = args.plugin.augmentChunkHash;
1686
- if (!hook) return {};
1687
- const { handler, meta } = normalizeHook(hook);
1688
- return {
1689
- plugin: async (ctx, chunk) => {
1690
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1691
- },
1692
- meta: bindingifyPluginHookMeta(meta)
1693
- };
1684
+ return bindingifyHook(args.plugin.augmentChunkHash, ({ handler }) => ({ plugin: async (ctx, chunk) => {
1685
+ return handler.call(createPluginContext(args, ctx), transformRenderedChunk(chunk));
1686
+ } }));
1687
+ }
1688
+ function bindingifyResolveFileUrl(args) {
1689
+ return bindingifyHook(args.plugin.resolveFileUrl, ({ handler }) => ({ plugin: async (ctx, resolveFileUrlArgs) => {
1690
+ return handler.call(createPluginContext(args, ctx), resolveFileUrlArgs);
1691
+ } }));
1694
1692
  }
1695
1693
  function bindingifyRenderError(args) {
1696
- const hook = args.plugin.renderError;
1697
- if (!hook) return {};
1698
- const { handler, meta } = normalizeHook(hook);
1694
+ return bindingifyHook(args.plugin.renderError, ({ handler }) => ({ plugin: async (ctx, err) => {
1695
+ await handler.call(createPluginContext(args, ctx), aggregateBindingErrorsIntoJsError(err));
1696
+ } }));
1697
+ }
1698
+ function createOutputBundle(args, ctx, bundle) {
1699
+ const changed = {
1700
+ updated: /* @__PURE__ */ new Set(),
1701
+ deleted: /* @__PURE__ */ new Set()
1702
+ };
1703
+ const context = createPluginContext(args, ctx);
1699
1704
  return {
1700
- plugin: async (ctx, err) => {
1701
- handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), aggregateBindingErrorsIntoJsError(err));
1702
- },
1703
- meta: bindingifyPluginHookMeta(meta)
1705
+ changed,
1706
+ context,
1707
+ output: transformToOutputBundle(context, unwrapBindingResult(bundle), changed)
1704
1708
  };
1705
1709
  }
1706
1710
  function bindingifyGenerateBundle(args) {
1707
- const hook = args.plugin.generateBundle;
1708
- if (!hook) return {};
1709
- const { handler, meta } = normalizeHook(hook);
1710
- return {
1711
- plugin: async (ctx, bundle, isWrite, opts) => {
1712
- const changed = {
1713
- updated: /* @__PURE__ */ new Set(),
1714
- deleted: /* @__PURE__ */ new Set()
1715
- };
1716
- const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
1717
- const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
1718
- await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
1719
- return collectChangedBundle(changed, output);
1720
- },
1721
- meta: bindingifyPluginHookMeta(meta)
1722
- };
1711
+ return bindingifyHook(args.plugin.generateBundle, ({ handler }) => ({ plugin: async (ctx, bundle, isWrite, opts) => {
1712
+ const { changed, context, output } = createOutputBundle(args, ctx, bundle);
1713
+ await handler.call(context, args.pluginContextData.getOutputOptions(opts), output, isWrite);
1714
+ return collectChangedBundle(changed, output);
1715
+ } }));
1723
1716
  }
1724
1717
  function bindingifyWriteBundle(args) {
1725
- const hook = args.plugin.writeBundle;
1726
- if (!hook) return {};
1727
- const { handler, meta } = normalizeHook(hook);
1728
- return {
1729
- plugin: async (ctx, bundle, opts) => {
1730
- const changed = {
1731
- updated: /* @__PURE__ */ new Set(),
1732
- deleted: /* @__PURE__ */ new Set()
1733
- };
1734
- const context = new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode);
1735
- const output = transformToOutputBundle(context, unwrapBindingResult(bundle), changed);
1736
- await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
1737
- return collectChangedBundle(changed, output);
1738
- },
1739
- meta: bindingifyPluginHookMeta(meta)
1740
- };
1718
+ return bindingifyHook(args.plugin.writeBundle, ({ handler }) => ({ plugin: async (ctx, bundle, opts) => {
1719
+ const { changed, context, output } = createOutputBundle(args, ctx, bundle);
1720
+ await handler.call(context, args.pluginContextData.getOutputOptions(opts), output);
1721
+ return collectChangedBundle(changed, output);
1722
+ } }));
1741
1723
  }
1742
1724
  function bindingifyCloseBundle(args) {
1743
- const hook = args.plugin.closeBundle;
1744
- if (!hook) return {};
1745
- const { handler, meta } = normalizeHook(hook);
1746
- return {
1747
- plugin: async (ctx, err) => {
1748
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1749
- },
1750
- meta: bindingifyPluginHookMeta(meta)
1751
- };
1725
+ return bindingifyHook(args.plugin.closeBundle, ({ handler }) => ({ plugin: async (ctx, err) => {
1726
+ await handler.call(createPluginContext(args, ctx), err ? aggregateBindingErrorsIntoJsError(err) : void 0);
1727
+ } }));
1752
1728
  }
1753
- function bindingifyBanner(args) {
1754
- const hook = args.plugin.banner;
1755
- if (!hook) return {};
1756
- const { handler, meta } = normalizeHook(hook);
1757
- return {
1758
- plugin: async (ctx, chunk) => {
1759
- if (typeof handler === "string") return handler;
1760
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1761
- },
1762
- meta: bindingifyPluginHookMeta(meta)
1763
- };
1764
- }
1765
- function bindingifyFooter(args) {
1766
- const hook = args.plugin.footer;
1767
- if (!hook) return {};
1768
- const { handler, meta } = normalizeHook(hook);
1769
- return {
1770
- plugin: async (ctx, chunk) => {
1771
- if (typeof handler === "string") return handler;
1772
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1773
- },
1774
- meta: bindingifyPluginHookMeta(meta)
1775
- };
1776
- }
1777
- function bindingifyIntro(args) {
1778
- const hook = args.plugin.intro;
1779
- if (!hook) return {};
1780
- const { handler, meta } = normalizeHook(hook);
1781
- return {
1782
- plugin: async (ctx, chunk) => {
1783
- if (typeof handler === "string") return handler;
1784
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1785
- },
1786
- meta: bindingifyPluginHookMeta(meta)
1787
- };
1788
- }
1789
- function bindingifyOutro(args) {
1790
- const hook = args.plugin.outro;
1791
- if (!hook) return {};
1792
- const { handler, meta } = normalizeHook(hook);
1793
- return {
1794
- plugin: async (ctx, chunk) => {
1795
- if (typeof handler === "string") return handler;
1796
- return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), transformRenderedChunk(chunk));
1797
- },
1798
- meta: bindingifyPluginHookMeta(meta)
1799
- };
1729
+ function bindingifyAddonHook(args, name) {
1730
+ return bindingifyHook(args.plugin[name], ({ handler }) => ({ plugin: async (ctx, chunk) => {
1731
+ if (typeof handler === "string") return handler;
1732
+ return handler.call(createPluginContext(args, ctx), transformRenderedChunk(chunk));
1733
+ } }));
1800
1734
  }
1801
1735
  //#endregion
1802
1736
  //#region src/plugin/bindingify-watch-hooks.ts
1737
+ function bindingifyHotUpdate(args) {
1738
+ return bindingifyHook(args.plugin.hotUpdate, ({ handler }) => ({ plugin: async (ctx, hookArgs) => {
1739
+ return await handler.call(createPluginContext(args, ctx), {
1740
+ type: hookArgs.kind,
1741
+ file: hookArgs.file,
1742
+ modules: hookArgs.modules
1743
+ }) ?? void 0;
1744
+ } }));
1745
+ }
1803
1746
  function bindingifyWatchChange(args) {
1804
- const hook = args.plugin.watchChange;
1805
- if (!hook) return {};
1806
- const { handler, meta } = normalizeHook(hook);
1807
- return {
1808
- plugin: async (ctx, id, event) => {
1809
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode), id, { event });
1810
- },
1811
- meta: bindingifyPluginHookMeta(meta)
1812
- };
1747
+ return bindingifyHook(args.plugin.watchChange, ({ handler }) => ({ plugin: async (ctx, id, event) => {
1748
+ await handler.call(createPluginContext(args, ctx), id, { event });
1749
+ } }));
1813
1750
  }
1814
1751
  function bindingifyCloseWatcher(args) {
1815
- const hook = args.plugin.closeWatcher;
1816
- if (!hook) return {};
1817
- const { handler, meta } = normalizeHook(hook);
1818
- return {
1819
- plugin: async (ctx) => {
1820
- await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, args.watchMode));
1821
- },
1822
- meta: bindingifyPluginHookMeta(meta)
1823
- };
1752
+ return bindingifyHook(args.plugin.closeWatcher, ({ handler }) => ({ plugin: async (ctx) => {
1753
+ await handler.call(createPluginContext(args, ctx));
1754
+ } }));
1824
1755
  }
1825
1756
  //#endregion
1826
1757
  //#region src/plugin/generated/hook-usage.ts
@@ -1856,7 +1787,9 @@ function extractHookUsage(plugin) {
1856
1787
  if (plugin.footer) hookUsage.union(262144);
1857
1788
  if (plugin.intro) hookUsage.union(524288);
1858
1789
  if (plugin.outro) hookUsage.union(1048576);
1859
- if (plugin.transformCacheHit) hookUsage.union(2097152);
1790
+ if (plugin.resolveFileUrl) hookUsage.union(2097152);
1791
+ if (plugin.hotUpdate) hookUsage.union(4194304);
1792
+ if (plugin.transformCacheHit) hookUsage.union(8388608);
1860
1793
  return hookUsage;
1861
1794
  }
1862
1795
  //#endregion
@@ -1881,16 +1814,18 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1881
1814
  const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
1882
1815
  const { plugin: renderChunk, meta: renderChunkMeta, filter: renderChunkFilter } = bindingifyRenderChunk(args);
1883
1816
  const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
1817
+ const { plugin: resolveFileUrl, meta: resolveFileUrlMeta } = bindingifyResolveFileUrl(args);
1884
1818
  const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
1885
1819
  const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
1886
1820
  const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
1887
1821
  const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
1888
1822
  const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
1889
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
1890
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
1891
- const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
1892
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
1823
+ const { plugin: banner, meta: bannerMeta } = bindingifyAddonHook(args, "banner");
1824
+ const { plugin: footer, meta: footerMeta } = bindingifyAddonHook(args, "footer");
1825
+ const { plugin: intro, meta: introMeta } = bindingifyAddonHook(args, "intro");
1826
+ const { plugin: outro, meta: outroMeta } = bindingifyAddonHook(args, "outro");
1893
1827
  const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
1828
+ const { plugin: hotUpdate, meta: hotUpdateMeta } = bindingifyHotUpdate(args);
1894
1829
  const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
1895
1830
  const { plugin: transformCacheHit, meta: transformCacheHitMeta } = bindingifyTransformCacheHit(args);
1896
1831
  let hookUsage = extractHookUsage(plugin).inner();
@@ -1918,6 +1853,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1918
1853
  renderChunkFilter,
1919
1854
  augmentChunkHash,
1920
1855
  augmentChunkHashMeta,
1856
+ resolveFileUrl,
1857
+ resolveFileUrlMeta,
1921
1858
  renderStart,
1922
1859
  renderStartMeta,
1923
1860
  renderError,
@@ -1938,6 +1875,8 @@ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, nor
1938
1875
  outroMeta,
1939
1876
  watchChange,
1940
1877
  watchChangeMeta,
1878
+ hotUpdate,
1879
+ hotUpdateMeta,
1941
1880
  closeWatcher,
1942
1881
  closeWatcherMeta,
1943
1882
  transformCacheHit,
@@ -1956,6 +1895,7 @@ function wrapHandlers(plugin) {
1956
1895
  "load",
1957
1896
  "renderChunk",
1958
1897
  "augmentChunkHash",
1898
+ "resolveFileUrl",
1959
1899
  "renderStart",
1960
1900
  "renderError",
1961
1901
  "generateBundle",
@@ -1966,6 +1906,7 @@ function wrapHandlers(plugin) {
1966
1906
  "intro",
1967
1907
  "outro",
1968
1908
  "watchChange",
1909
+ "hotUpdate",
1969
1910
  "closeWatcher",
1970
1911
  "transformCacheHit"
1971
1912
  ]) {
@@ -2030,10 +1971,18 @@ function normalizeJsxOptions(jsx) {
2030
1971
  };
2031
1972
  }
2032
1973
  //#endregion
1974
+ //#region src/utils/default-dev-runtime.ts
1975
+ function getDefaultDevRuntime(host = "localhost", port = 3e3) {
1976
+ const runtimeEntry = fs.readFileSync(fileURLToPath(import.meta.resolve("@rollipop/rolldown/experimental/runtime")), "utf8");
1977
+ const runtimeHelperImportEnd = runtimeEntry.indexOf("\n");
1978
+ if (!runtimeEntry.startsWith("import ") || runtimeHelperImportEnd === -1) throw new Error("Expected the standalone runtime to start with a helper import");
1979
+ return `${runtimeEntry.slice(runtimeHelperImportEnd + 1)}\n${fs.readFileSync(fileURLToPath(import.meta.resolve("#default-runtime")), "utf8").replaceAll("$ADDR", `${host}:${port}`)}`;
1980
+ }
1981
+ //#endregion
2033
1982
  //#region src/utils/bindingify-input-options.ts
2034
1983
  function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginContextData, normalizedOutputPlugins, onLog, logLevel, watchMode) {
2035
1984
  const plugins = rawPlugins.map((plugin) => {
2036
- if ("_parallel" in plugin) return;
1985
+ if (getParallelPluginInfo(plugin)) return;
2037
1986
  if (plugin instanceof BuiltinPlugin) switch (plugin.name) {
2038
1987
  case "builtin:vite-manifest": return bindingifyManifestPlugin(plugin, pluginContextData);
2039
1988
  default: return bindingifyBuiltInPlugin(plugin);
@@ -2084,8 +2033,16 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions, pluginC
2084
2033
  }
2085
2034
  function bindingifyDevMode(devMode) {
2086
2035
  if (devMode) {
2087
- if (typeof devMode === "boolean") return devMode ? {} : void 0;
2088
- return devMode;
2036
+ if (typeof devMode === "boolean") return devMode ? {
2037
+ implement: getDefaultDevRuntime(),
2038
+ skipCommonRuntimeInjection: true
2039
+ } : void 0;
2040
+ const usesDefaultRuntime = devMode.implement == null;
2041
+ return {
2042
+ ...devMode,
2043
+ implement: devMode.implement ?? getDefaultDevRuntime(devMode.host, devMode.port),
2044
+ skipCommonRuntimeInjection: usesDefaultRuntime ? true : devMode.skipCommonRuntimeInjection
2045
+ };
2089
2046
  }
2090
2047
  }
2091
2048
  function bindingifyAttachDebugInfo(attachDebugInfo) {
@@ -2227,19 +2184,13 @@ function bindingifyTreeshakeOptions(config) {
2227
2184
  case "always":
2228
2185
  normalizedConfig.propertyReadSideEffects = import_binding.BindingPropertyReadSideEffects.Always;
2229
2186
  break;
2230
- case false:
2231
- normalizedConfig.propertyReadSideEffects = import_binding.BindingPropertyReadSideEffects.False;
2232
- break;
2233
- default:
2187
+ case false: normalizedConfig.propertyReadSideEffects = import_binding.BindingPropertyReadSideEffects.False;
2234
2188
  }
2235
2189
  switch (config.propertyWriteSideEffects) {
2236
2190
  case "always":
2237
2191
  normalizedConfig.propertyWriteSideEffects = import_binding.BindingPropertyWriteSideEffects.Always;
2238
2192
  break;
2239
- case false:
2240
- normalizedConfig.propertyWriteSideEffects = import_binding.BindingPropertyWriteSideEffects.False;
2241
- break;
2242
- default:
2193
+ case false: normalizedConfig.propertyWriteSideEffects = import_binding.BindingPropertyWriteSideEffects.False;
2243
2194
  }
2244
2195
  if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
2245
2196
  else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
@@ -2271,4 +2222,4 @@ function bindingifyPreserveEntrySignatures(preserveEntrySignatures) {
2271
2222
  };
2272
2223
  }
2273
2224
  //#endregion
2274
- export { version as S, LOG_LEVEL_INFO as _, transformModuleInfo as a, VERSION as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_ERROR as g, LOG_LEVEL_DEBUG as h, PluginContextData as i, transformAssetSource as l, normalizeLog as m, bindingifyPlugin as n, transformToRollupOutput as o, normalizeHook as p, RolldownMagicString as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_WARN as v, description as x, logLevelPriority as y };
2225
+ export { version as C, description as S, LOG_LEVEL_ERROR as _, transformModuleInfo as a, logLevelPriority as b, __decorate as c, PlainObjectLike as d, MinimalPluginContextImpl as f, LOG_LEVEL_DEBUG as g, normalizeLog as h, PluginContextData as i, transformAssetSource as l, normalizeHook as m, bindingifyPlugin as n, transformToRollupOutput as o, getParallelPluginInfo as p, RolldownMagicString as r, transformRenderedChunk as s, bindingifyInputOptions as t, lazyProp as u, LOG_LEVEL_INFO as v, VERSION as x, LOG_LEVEL_WARN as y };