rolldown 0.14.0-snapshot-bd95eb1-20241124003631 → 0.14.0-snapshot-87f7277-20241125003644

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.
@@ -594,6 +594,7 @@ var require_binding = __commonJSMin((exports, module) => {
594
594
  module.exports.BindingCallableBuiltinPlugin = nativeBinding.BindingCallableBuiltinPlugin;
595
595
  module.exports.BindingLog = nativeBinding.BindingLog;
596
596
  module.exports.BindingModuleInfo = nativeBinding.BindingModuleInfo;
597
+ module.exports.BindingNormalizedOptions = nativeBinding.BindingNormalizedOptions;
597
598
  module.exports.BindingOutputAsset = nativeBinding.BindingOutputAsset;
598
599
  module.exports.BindingOutputChunk = nativeBinding.BindingOutputChunk;
599
600
  module.exports.BindingOutputs = nativeBinding.BindingOutputs;
@@ -850,29 +851,6 @@ function normalizeHook(hook) {
850
851
 
851
852
  //#endregion
852
853
  //#region src/log/logger.ts
853
- class MinimalPluginContext {
854
- info;
855
- warn;
856
- debug;
857
- meta;
858
- error;
859
- constructor(options, plugin) {
860
- const onLog = options.onLog;
861
- const pluginName = plugin.name || "unknown";
862
- const logLevel = options.logLevel || LOG_LEVEL_INFO;
863
- this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
864
- this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
865
- this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
866
- this.error = (e) => {
867
- return error(logPluginError(normalizeLog(e), pluginName));
868
- };
869
- this.meta = {
870
- rollupVersion: "4.23.0",
871
- rolldownVersion: VERSION,
872
- watchMode: false
873
- };
874
- }
875
- }
876
854
  function getLogger(plugins, onLog, logLevel) {
877
855
  const minimalPriority = logLevelPriority[logLevel];
878
856
  const logger = (level, log, skipped = new Set()) => {
@@ -1142,6 +1120,30 @@ function transformModuleInfo(info, option) {
1142
1120
  };
1143
1121
  }
1144
1122
 
1123
+ //#endregion
1124
+ //#region src/plugin/minimal-plugin-context.ts
1125
+ class MinimalPluginContext {
1126
+ info;
1127
+ warn;
1128
+ debug;
1129
+ meta;
1130
+ error;
1131
+ constructor(onLog, logLevel, plugin) {
1132
+ const pluginName = plugin.name || "unknown";
1133
+ this.debug = getLogHandler(LOG_LEVEL_DEBUG, "PLUGIN_LOG", onLog, pluginName, logLevel);
1134
+ this.info = getLogHandler(LOG_LEVEL_INFO, "PLUGIN_LOG", onLog, pluginName, logLevel);
1135
+ this.warn = getLogHandler(LOG_LEVEL_WARN, "PLUGIN_WARNING", onLog, pluginName, logLevel);
1136
+ this.error = (e) => {
1137
+ return error(logPluginError(normalizeLog(e), pluginName));
1138
+ };
1139
+ this.meta = {
1140
+ rollupVersion: "4.23.0",
1141
+ rolldownVersion: VERSION,
1142
+ watchMode: false
1143
+ };
1144
+ }
1145
+ }
1146
+
1145
1147
  //#endregion
1146
1148
  //#region src/utils/transform-side-effects.ts
1147
1149
  var import_binding$5 = __toESM(require_binding());
@@ -1167,16 +1169,16 @@ class PluginContext extends MinimalPluginContext {
1167
1169
  getModuleIds;
1168
1170
  addWatchFile;
1169
1171
  parse;
1170
- constructor(options, context, plugin, data) {
1171
- super(options, plugin);
1172
- this.load = async ({ id: id,...options$1 }) => {
1172
+ constructor(context, plugin, data, onLog, logLevel) {
1173
+ super(onLog, logLevel, plugin);
1174
+ this.load = async ({ id: id,...options }) => {
1173
1175
  const moduleInfo = data.getModuleInfo(id, context);
1174
1176
  if (moduleInfo && moduleInfo.code !== null) {
1175
1177
  return moduleInfo;
1176
1178
  }
1177
1179
  const rawOptions = {
1178
- meta: options$1.meta || {},
1179
- moduleSideEffects: options$1.moduleSideEffects || null
1180
+ meta: options.meta || {},
1181
+ moduleSideEffects: options.moduleSideEffects || null
1180
1182
  };
1181
1183
  data.updateModuleOption(id, rawOptions);
1182
1184
  async function createLoadModulePromise() {
@@ -1190,7 +1192,7 @@ class PluginContext extends MinimalPluginContext {
1190
1192
  });
1191
1193
  data.loadModulePromiseMap.set(id, promise);
1192
1194
  try {
1193
- await context.load(id, bindingifySideEffects(options$1.moduleSideEffects), resolveFn);
1195
+ await context.load(id, bindingifySideEffects(options.moduleSideEffects), resolveFn);
1194
1196
  } finally {
1195
1197
  data.loadModulePromiseMap.delete(id);
1196
1198
  }
@@ -1199,14 +1201,14 @@ class PluginContext extends MinimalPluginContext {
1199
1201
  await createLoadModulePromise();
1200
1202
  return data.getModuleInfo(id, context);
1201
1203
  };
1202
- this.resolve = async (source, importer, options$1) => {
1204
+ this.resolve = async (source, importer, options) => {
1203
1205
  let receipt = undefined;
1204
- if (options$1 != null) {
1205
- receipt = data.saveResolveOptions(options$1);
1206
+ if (options != null) {
1207
+ receipt = data.saveResolveOptions(options);
1206
1208
  }
1207
1209
  const res = await context.resolve(source, importer, {
1208
1210
  custom: receipt,
1209
- skipSelf: options$1?.skipSelf
1211
+ skipSelf: options?.skipSelf
1210
1212
  });
1211
1213
  if (receipt != null) {
1212
1214
  data.removeSavedResolveOptions(receipt);
@@ -1240,8 +1242,8 @@ class PluginContext extends MinimalPluginContext {
1240
1242
  //#region src/plugin/transform-plugin-context.ts
1241
1243
  class TransformPluginContext extends PluginContext {
1242
1244
  error;
1243
- constructor(options, context, plugin, data, inner, moduleId, moduleSource) {
1244
- super(options, context, plugin, data);
1245
+ constructor(context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
1246
+ super(context, plugin, data, onLog, LogLevelOption);
1245
1247
  const getLogHandler$1 = (handler) => (log, pos) => {
1246
1248
  log = normalizeLog(log);
1247
1249
  if (pos) augmentCodeLocation(log, pos, moduleSource, moduleId);
@@ -1322,49 +1324,65 @@ function bindingifyTransformFilter(filterOption) {
1322
1324
  };
1323
1325
  }
1324
1326
 
1327
+ //#endregion
1328
+ //#region src/options/normalized-input-options.ts
1329
+ class NormalizedInputOptions {
1330
+ inner;
1331
+ constructor(inner, onLog) {
1332
+ this.inner = inner;
1333
+ this.onLog = onLog;
1334
+ }
1335
+ get shimMissingExports() {
1336
+ return this.inner.shimMissingExports;
1337
+ }
1338
+ get input() {
1339
+ return this.inner.input;
1340
+ }
1341
+ }
1342
+
1325
1343
  //#endregion
1326
1344
  //#region src/plugin/bindingify-build-hooks.ts
1327
- function bindingifyBuildStart(plugin, options, pluginContextData) {
1328
- const hook = plugin.buildStart;
1345
+ function bindingifyBuildStart(args) {
1346
+ const hook = args.plugin.buildStart;
1329
1347
  if (!hook) {
1330
1348
  return {};
1331
1349
  }
1332
1350
  const { handler: handler, meta: meta } = normalizeHook(hook);
1333
1351
  return {
1334
- plugin: async (ctx) => {
1335
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), options);
1352
+ plugin: async (ctx, opts) => {
1353
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptions(opts, args.onLog));
1336
1354
  },
1337
1355
  meta: bindingifyPluginHookMeta(meta)
1338
1356
  };
1339
1357
  }
1340
- function bindingifyBuildEnd(plugin, options, pluginContextData) {
1341
- const hook = plugin.buildEnd;
1358
+ function bindingifyBuildEnd(args) {
1359
+ const hook = args.plugin.buildEnd;
1342
1360
  if (!hook) {
1343
1361
  return {};
1344
1362
  }
1345
1363
  const { handler: handler, meta: meta } = normalizeHook(hook);
1346
1364
  return {
1347
1365
  plugin: async (ctx, err) => {
1348
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), err ? new Error(err) : undefined);
1366
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? new Error(err) : undefined);
1349
1367
  },
1350
1368
  meta: bindingifyPluginHookMeta(meta)
1351
1369
  };
1352
1370
  }
1353
- function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
1354
- const hook = plugin.resolveId;
1371
+ function bindingifyResolveId(args) {
1372
+ const hook = args.plugin.resolveId;
1355
1373
  if (!hook) {
1356
1374
  return {};
1357
1375
  }
1358
1376
  const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
1359
1377
  return {
1360
1378
  plugin: async (ctx, specifier, importer, extraOptions) => {
1361
- const contextResolveOptions = extraOptions.custom != null ? pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
1379
+ const contextResolveOptions = extraOptions.custom != null ? args.pluginContextData.getSavedResolveOptions(extraOptions.custom) : undefined;
1362
1380
  const newExtraOptions = {
1363
1381
  ...extraOptions,
1364
1382
  custom: contextResolveOptions?.custom,
1365
1383
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1366
1384
  };
1367
- const ret = await handler.call(new PluginContext(normalizedOptions, ctx, plugin, pluginContextData), specifier, importer ?? undefined, newExtraOptions);
1385
+ const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined, newExtraOptions);
1368
1386
  if (ret == null) {
1369
1387
  return;
1370
1388
  }
@@ -1384,7 +1402,7 @@ function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
1384
1402
  if (ret.moduleSideEffects !== null) {
1385
1403
  result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1386
1404
  }
1387
- pluginContextData.updateModuleOption(ret.id, {
1405
+ args.pluginContextData.updateModuleOption(ret.id, {
1388
1406
  meta: ret.meta || {},
1389
1407
  moduleSideEffects: ret.moduleSideEffects || null
1390
1408
  });
@@ -1394,15 +1412,15 @@ function bindingifyResolveId(plugin, normalizedOptions, pluginContextData) {
1394
1412
  filter: bindingifyResolveIdFilter(options.filter)
1395
1413
  };
1396
1414
  }
1397
- function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
1398
- const hook = plugin.resolveDynamicImport;
1415
+ function bindingifyResolveDynamicImport(args) {
1416
+ const hook = args.plugin.resolveDynamicImport;
1399
1417
  if (!hook) {
1400
1418
  return {};
1401
1419
  }
1402
1420
  const { handler: handler, meta: meta } = normalizeHook(hook);
1403
1421
  return {
1404
1422
  plugin: async (ctx, specifier, importer) => {
1405
- const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), specifier, importer ?? undefined);
1423
+ const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? undefined);
1406
1424
  if (ret == null) {
1407
1425
  return;
1408
1426
  }
@@ -1422,7 +1440,7 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
1422
1440
  if (ret.moduleSideEffects !== null) {
1423
1441
  result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1424
1442
  }
1425
- pluginContextData.updateModuleOption(ret.id, {
1443
+ args.pluginContextData.updateModuleOption(ret.id, {
1426
1444
  meta: ret.meta || {},
1427
1445
  moduleSideEffects: ret.moduleSideEffects || null
1428
1446
  });
@@ -1431,22 +1449,22 @@ function bindingifyResolveDynamicImport(plugin, options, pluginContextData) {
1431
1449
  meta: bindingifyPluginHookMeta(meta)
1432
1450
  };
1433
1451
  }
1434
- function bindingifyTransform(plugin, normalizedOptions, pluginContextData) {
1435
- const hook = plugin.transform;
1452
+ function bindingifyTransform(args) {
1453
+ const hook = args.plugin.transform;
1436
1454
  if (!hook) {
1437
1455
  return {};
1438
1456
  }
1439
1457
  const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
1440
1458
  return {
1441
1459
  plugin: async (ctx, code, id, meta$1) => {
1442
- const ret = await handler.call(new TransformPluginContext(normalizedOptions, ctx.inner(), plugin, pluginContextData, ctx, id, code), code, id, meta$1);
1460
+ const ret = await handler.call(new TransformPluginContext(ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
1443
1461
  if (ret == null) {
1444
1462
  return undefined;
1445
1463
  }
1446
1464
  if (typeof ret === "string") {
1447
1465
  return {code: ret};
1448
1466
  }
1449
- pluginContextData.updateModuleOption(id, {
1467
+ args.pluginContextData.updateModuleOption(id, {
1450
1468
  meta: ret.meta || {},
1451
1469
  moduleSideEffects: ret.moduleSideEffects || null
1452
1470
  });
@@ -1461,15 +1479,15 @@ function bindingifyTransform(plugin, normalizedOptions, pluginContextData) {
1461
1479
  filter: bindingifyTransformFilter(options.filter)
1462
1480
  };
1463
1481
  }
1464
- function bindingifyLoad(plugin, normalized_options, pluginContextData) {
1465
- const hook = plugin.load;
1482
+ function bindingifyLoad(args) {
1483
+ const hook = args.plugin.load;
1466
1484
  if (!hook) {
1467
1485
  return {};
1468
1486
  }
1469
1487
  const { handler: handler, meta: meta, options: options } = normalizeHook(hook);
1470
1488
  return {
1471
1489
  plugin: async (ctx, id) => {
1472
- const ret = await handler.call(new PluginContext(normalized_options, ctx, plugin, pluginContextData), id);
1490
+ const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id);
1473
1491
  if (ret == null) {
1474
1492
  return;
1475
1493
  }
@@ -1485,7 +1503,7 @@ function bindingifyLoad(plugin, normalized_options, pluginContextData) {
1485
1503
  if (ret.moduleSideEffects !== null) {
1486
1504
  result.sideEffects = bindingifySideEffects(ret.moduleSideEffects);
1487
1505
  }
1488
- pluginContextData.updateModuleOption(id, {
1506
+ args.pluginContextData.updateModuleOption(id, {
1489
1507
  meta: ret.meta || {},
1490
1508
  moduleSideEffects: ret.moduleSideEffects || null
1491
1509
  });
@@ -1507,37 +1525,52 @@ function preProcessSourceMap(ret, id) {
1507
1525
  }
1508
1526
  return map;
1509
1527
  }
1510
- function bindingifyModuleParsed(plugin, options, pluginContextData) {
1511
- const hook = plugin.moduleParsed;
1528
+ function bindingifyModuleParsed(args) {
1529
+ const hook = args.plugin.moduleParsed;
1512
1530
  if (!hook) {
1513
1531
  return {};
1514
1532
  }
1515
1533
  const { handler: handler, meta: meta } = normalizeHook(hook);
1516
1534
  return {
1517
1535
  plugin: async (ctx, moduleInfo) => {
1518
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), transformModuleInfo(moduleInfo, pluginContextData.moduleOptionMap.get(moduleInfo.id)));
1536
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.moduleOptionMap.get(moduleInfo.id)));
1519
1537
  },
1520
1538
  meta: bindingifyPluginHookMeta(meta)
1521
1539
  };
1522
1540
  }
1523
1541
 
1542
+ //#endregion
1543
+ //#region src/options/normalized-output-options.ts
1544
+ class NormalizedOutputOptionsImpl {
1545
+ inner;
1546
+ constructor(inner) {
1547
+ this.inner = inner;
1548
+ }
1549
+ get entryFileNames() {
1550
+ return this.inner.entryFilenames || unsupported("You should not take `NormalizedOutputOptions#entryFileNames` and call it directly");
1551
+ }
1552
+ get format() {
1553
+ return this.inner.format;
1554
+ }
1555
+ }
1556
+
1524
1557
  //#endregion
1525
1558
  //#region src/plugin/bindingify-output-hooks.ts
1526
- function bindingifyRenderStart(plugin, options, outputOptions, pluginContextData) {
1527
- const hook = plugin.renderStart;
1559
+ function bindingifyRenderStart(args) {
1560
+ const hook = args.plugin.renderStart;
1528
1561
  if (!hook) {
1529
1562
  return {};
1530
1563
  }
1531
1564
  const { handler: handler, meta: meta } = normalizeHook(hook);
1532
1565
  return {
1533
- plugin: async (ctx) => {
1534
- handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, options);
1566
+ plugin: async (ctx, opts) => {
1567
+ handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), new NormalizedInputOptions(opts, args.onLog));
1535
1568
  },
1536
1569
  meta: bindingifyPluginHookMeta(meta)
1537
1570
  };
1538
1571
  }
1539
- function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData) {
1540
- const hook = plugin.renderChunk;
1572
+ function bindingifyRenderChunk(args) {
1573
+ const hook = args.plugin.renderChunk;
1541
1574
  if (!hook) {
1542
1575
  return {};
1543
1576
  }
@@ -1547,7 +1580,7 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
1547
1580
  (Object.entries(chunk.modules)).forEach(([key, module$1]) => {
1548
1581
  chunk.modules[key] = transformToRenderedModule(module$1);
1549
1582
  });
1550
- const ret = await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), code, chunk, outputOptions);
1583
+ const ret = await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, chunk, {});
1551
1584
  if (ret == null) {
1552
1585
  return;
1553
1586
  }
@@ -1565,8 +1598,8 @@ function bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData
1565
1598
  meta: bindingifyPluginHookMeta(meta)
1566
1599
  };
1567
1600
  }
1568
- function bindingifyAugmentChunkHash(plugin, options, pluginContextData) {
1569
- const hook = plugin.augmentChunkHash;
1601
+ function bindingifyAugmentChunkHash(args) {
1602
+ const hook = args.plugin.augmentChunkHash;
1570
1603
  if (!hook) {
1571
1604
  return {};
1572
1605
  }
@@ -1576,45 +1609,45 @@ function bindingifyAugmentChunkHash(plugin, options, pluginContextData) {
1576
1609
  (Object.entries(chunk.modules)).forEach(([key, module$1]) => {
1577
1610
  chunk.modules[key] = transformToRenderedModule(module$1);
1578
1611
  });
1579
- return await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
1612
+ return await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
1580
1613
  },
1581
1614
  meta: bindingifyPluginHookMeta(meta)
1582
1615
  };
1583
1616
  }
1584
- function bindingifyRenderError(plugin, options, pluginContextData) {
1585
- const hook = plugin.renderError;
1617
+ function bindingifyRenderError(args) {
1618
+ const hook = args.plugin.renderError;
1586
1619
  if (!hook) {
1587
1620
  return {};
1588
1621
  }
1589
1622
  const { handler: handler, meta: meta } = normalizeHook(hook);
1590
1623
  return {
1591
1624
  plugin: async (ctx, err) => {
1592
- handler.call(new PluginContext(options, ctx, plugin, pluginContextData), new Error(err));
1625
+ handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new Error(err));
1593
1626
  },
1594
1627
  meta: bindingifyPluginHookMeta(meta)
1595
1628
  };
1596
1629
  }
1597
- function bindingifyGenerateBundle(plugin, options, outputOptions, pluginContextData) {
1598
- const hook = plugin.generateBundle;
1630
+ function bindingifyGenerateBundle(args) {
1631
+ const hook = args.plugin.generateBundle;
1599
1632
  if (!hook) {
1600
1633
  return {};
1601
1634
  }
1602
1635
  const { handler: handler, meta: meta } = normalizeHook(hook);
1603
1636
  return {
1604
- plugin: async (ctx, bundle, isWrite) => {
1637
+ plugin: async (ctx, bundle, isWrite, opts) => {
1605
1638
  const changed = {
1606
1639
  updated: new Set(),
1607
1640
  deleted: new Set()
1608
1641
  };
1609
1642
  const output = transformToOutputBundle(bundle, changed);
1610
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, output, isWrite);
1643
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts), output, isWrite);
1611
1644
  return collectChangedBundle(changed, output);
1612
1645
  },
1613
1646
  meta: bindingifyPluginHookMeta(meta)
1614
1647
  };
1615
1648
  }
1616
- function bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData) {
1617
- const hook = plugin.writeBundle;
1649
+ function bindingifyWriteBundle(args) {
1650
+ const hook = args.plugin.writeBundle;
1618
1651
  if (!hook) {
1619
1652
  return {};
1620
1653
  }
@@ -1626,27 +1659,27 @@ function bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData
1626
1659
  deleted: new Set()
1627
1660
  };
1628
1661
  const output = transformToOutputBundle(bundle, changed);
1629
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), outputOptions, output);
1662
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), {}, output);
1630
1663
  return collectChangedBundle(changed, output);
1631
1664
  },
1632
1665
  meta: bindingifyPluginHookMeta(meta)
1633
1666
  };
1634
1667
  }
1635
- function bindingifyCloseBundle(plugin, options, pluginContextData) {
1636
- const hook = plugin.closeBundle;
1668
+ function bindingifyCloseBundle(args) {
1669
+ const hook = args.plugin.closeBundle;
1637
1670
  if (!hook) {
1638
1671
  return {};
1639
1672
  }
1640
1673
  const { handler: handler, meta: meta } = normalizeHook(hook);
1641
1674
  return {
1642
1675
  plugin: async (ctx) => {
1643
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData));
1676
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1644
1677
  },
1645
1678
  meta: bindingifyPluginHookMeta(meta)
1646
1679
  };
1647
1680
  }
1648
- function bindingifyBanner(plugin, options, pluginContextData) {
1649
- const hook = plugin.banner;
1681
+ function bindingifyBanner(args) {
1682
+ const hook = args.plugin.banner;
1650
1683
  if (!hook) {
1651
1684
  return {};
1652
1685
  }
@@ -1656,13 +1689,13 @@ function bindingifyBanner(plugin, options, pluginContextData) {
1656
1689
  if (typeof handler === "string") {
1657
1690
  return handler;
1658
1691
  }
1659
- return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
1692
+ return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
1660
1693
  },
1661
1694
  meta: bindingifyPluginHookMeta(meta)
1662
1695
  };
1663
1696
  }
1664
- function bindingifyFooter(plugin, options, pluginContextData) {
1665
- const hook = plugin.footer;
1697
+ function bindingifyFooter(args) {
1698
+ const hook = args.plugin.footer;
1666
1699
  if (!hook) {
1667
1700
  return {};
1668
1701
  }
@@ -1672,13 +1705,13 @@ function bindingifyFooter(plugin, options, pluginContextData) {
1672
1705
  if (typeof handler === "string") {
1673
1706
  return handler;
1674
1707
  }
1675
- return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
1708
+ return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
1676
1709
  },
1677
1710
  meta: bindingifyPluginHookMeta(meta)
1678
1711
  };
1679
1712
  }
1680
- function bindingifyIntro(plugin, options, pluginContextData) {
1681
- const hook = plugin.intro;
1713
+ function bindingifyIntro(args) {
1714
+ const hook = args.plugin.intro;
1682
1715
  if (!hook) {
1683
1716
  return {};
1684
1717
  }
@@ -1688,13 +1721,13 @@ function bindingifyIntro(plugin, options, pluginContextData) {
1688
1721
  if (typeof handler === "string") {
1689
1722
  return handler;
1690
1723
  }
1691
- return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
1724
+ return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
1692
1725
  },
1693
1726
  meta: bindingifyPluginHookMeta(meta)
1694
1727
  };
1695
1728
  }
1696
- function bindingifyOutro(plugin, options, pluginContextData) {
1697
- const hook = plugin.outro;
1729
+ function bindingifyOutro(args) {
1730
+ const hook = args.plugin.outro;
1698
1731
  if (!hook) {
1699
1732
  return {};
1700
1733
  }
@@ -1704,7 +1737,7 @@ function bindingifyOutro(plugin, options, pluginContextData) {
1704
1737
  if (typeof handler === "string") {
1705
1738
  return handler;
1706
1739
  }
1707
- return handler.call(new PluginContext(options, ctx, plugin, pluginContextData), chunk);
1740
+ return handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), chunk);
1708
1741
  },
1709
1742
  meta: bindingifyPluginHookMeta(meta)
1710
1743
  };
@@ -1712,28 +1745,28 @@ function bindingifyOutro(plugin, options, pluginContextData) {
1712
1745
 
1713
1746
  //#endregion
1714
1747
  //#region src/plugin/bindingify-watch-hooks.ts
1715
- function bindingifyWatchChange(plugin, options, pluginContextData) {
1716
- const hook = plugin.watchChange;
1748
+ function bindingifyWatchChange(args) {
1749
+ const hook = args.plugin.watchChange;
1717
1750
  if (!hook) {
1718
1751
  return {};
1719
1752
  }
1720
1753
  const { handler: handler, meta: meta } = normalizeHook(hook);
1721
1754
  return {
1722
1755
  plugin: async (ctx, id, event) => {
1723
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData), id, {event: event});
1756
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, {event: event});
1724
1757
  },
1725
1758
  meta: bindingifyPluginHookMeta(meta)
1726
1759
  };
1727
1760
  }
1728
- function bindingifyCloseWatcher(plugin, options, pluginContextData) {
1729
- const hook = plugin.closeWatcher;
1761
+ function bindingifyCloseWatcher(args) {
1762
+ const hook = args.plugin.closeWatcher;
1730
1763
  if (!hook) {
1731
1764
  return {};
1732
1765
  }
1733
1766
  const { handler: handler, meta: meta } = normalizeHook(hook);
1734
1767
  return {
1735
1768
  plugin: async (ctx) => {
1736
- await handler.call(new PluginContext(options, ctx, plugin, pluginContextData));
1769
+ await handler.call(new PluginContext(ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1737
1770
  },
1738
1771
  meta: bindingifyPluginHookMeta(meta)
1739
1772
  };
@@ -1741,27 +1774,35 @@ function bindingifyCloseWatcher(plugin, options, pluginContextData) {
1741
1774
 
1742
1775
  //#endregion
1743
1776
  //#region src/plugin/bindingify-plugin.ts
1744
- function bindingifyPlugin(plugin, options, outputOptions, pluginContextData) {
1745
- const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(plugin, options, pluginContextData);
1746
- const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(plugin, options, pluginContextData);
1747
- const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(plugin, options, pluginContextData);
1748
- const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(plugin, options, pluginContextData);
1749
- const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(plugin, options, pluginContextData);
1750
- const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(plugin, options, pluginContextData);
1751
- const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(plugin, options, pluginContextData);
1752
- const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(plugin, options, outputOptions, pluginContextData);
1753
- const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(plugin, options, pluginContextData);
1754
- const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(plugin, options, outputOptions, pluginContextData);
1755
- const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(plugin, options, pluginContextData);
1756
- const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(plugin, options, outputOptions, pluginContextData);
1757
- const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(plugin, options, outputOptions, pluginContextData);
1758
- const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(plugin, options, pluginContextData);
1759
- const { plugin: banner, meta: bannerMeta } = bindingifyBanner(plugin, options, pluginContextData);
1760
- const { plugin: footer, meta: footerMeta } = bindingifyFooter(plugin, options, pluginContextData);
1761
- const { plugin: intro, meta: introMeta } = bindingifyIntro(plugin, options, pluginContextData);
1762
- const { plugin: outro, meta: outroMeta } = bindingifyOutro(plugin, options, pluginContextData);
1763
- const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(plugin, options, pluginContextData);
1764
- const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(plugin, options, pluginContextData);
1777
+ function bindingifyPlugin(plugin, options, outputOptions, pluginContextData, onLog, logLevel) {
1778
+ const args = {
1779
+ plugin,
1780
+ options,
1781
+ outputOptions,
1782
+ pluginContextData,
1783
+ onLog,
1784
+ logLevel
1785
+ };
1786
+ const { plugin: buildStart, meta: buildStartMeta } = bindingifyBuildStart(args);
1787
+ const { plugin: resolveId, meta: resolveIdMeta, filter: resolveIdFilter } = bindingifyResolveId(args);
1788
+ const { plugin: resolveDynamicImport, meta: resolveDynamicImportMeta } = bindingifyResolveDynamicImport(args);
1789
+ const { plugin: buildEnd, meta: buildEndMeta } = bindingifyBuildEnd(args);
1790
+ const { plugin: transform, meta: transformMeta, filter: transformFilter } = bindingifyTransform(args);
1791
+ const { plugin: moduleParsed, meta: moduleParsedMeta } = bindingifyModuleParsed(args);
1792
+ const { plugin: load, meta: loadMeta, filter: loadFilter } = bindingifyLoad(args);
1793
+ const { plugin: renderChunk, meta: renderChunkMeta } = bindingifyRenderChunk(args);
1794
+ const { plugin: augmentChunkHash, meta: augmentChunkHashMeta } = bindingifyAugmentChunkHash(args);
1795
+ const { plugin: renderStart, meta: renderStartMeta } = bindingifyRenderStart(args);
1796
+ const { plugin: renderError, meta: renderErrorMeta } = bindingifyRenderError(args);
1797
+ const { plugin: generateBundle, meta: generateBundleMeta } = bindingifyGenerateBundle(args);
1798
+ const { plugin: writeBundle, meta: writeBundleMeta } = bindingifyWriteBundle(args);
1799
+ const { plugin: closeBundle, meta: closeBundleMeta } = bindingifyCloseBundle(args);
1800
+ const { plugin: banner, meta: bannerMeta } = bindingifyBanner(args);
1801
+ const { plugin: footer, meta: footerMeta } = bindingifyFooter(args);
1802
+ const { plugin: intro, meta: introMeta } = bindingifyIntro(args);
1803
+ const { plugin: outro, meta: outroMeta } = bindingifyOutro(args);
1804
+ const { plugin: watchChange, meta: watchChangeMeta } = bindingifyWatchChange(args);
1805
+ const { plugin: closeWatcher, meta: closeWatcherMeta } = bindingifyCloseWatcher(args);
1765
1806
  const result = {
1766
1807
  name: plugin.name ?? "unknown",
1767
1808
  buildStart,
@@ -1930,7 +1971,7 @@ function bindingifyInputOptions(rawPlugins, inputOptions, outputOptions) {
1930
1971
  if (plugin instanceof BuiltinPlugin) {
1931
1972
  return bindingifyBuiltInPlugin(plugin);
1932
1973
  }
1933
- return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData);
1974
+ return bindingifyPlugin(plugin, inputOptions, outputOptions, pluginContextData, onLog, logLevel);
1934
1975
  });
1935
1976
  return {
1936
1977
  input: bindingifyInput(inputOptions.input),