rolldown 1.0.0-beta.3-commit.7b0c517 → 1.0.0-beta.3-commit.e71f948

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/cli.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-1SOKv3Pa.cjs');
3
+ const require_src = require('../shared/src-C82jqmOo.cjs');
4
4
  const require_parse_ast_index = require('../shared/parse-ast-index-Dh_sWnMa.cjs');
5
5
  const node_process = require_chunk.__toESM(require("node:process"));
6
6
  const node_path = require_chunk.__toESM(require("node:path"));
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-1SOKv3Pa.cjs');
3
+ const require_src = require('../shared/src-C82jqmOo.cjs');
4
4
  const require_parse_ast_index = require('../shared/parse-ast-index-Dh_sWnMa.cjs');
5
5
  const node_url = require_chunk.__toESM(require("node:url"));
6
6
 
@@ -65,6 +65,12 @@ exports.loadFallbackPlugin = require_src.loadFallbackPlugin
65
65
  exports.manifestPlugin = require_src.manifestPlugin
66
66
  exports.moduleFederationPlugin = require_src.moduleFederationPlugin
67
67
  exports.modulePreloadPolyfillPlugin = require_src.modulePreloadPolyfillPlugin
68
+ Object.defineProperty(exports, 'moduleRunnerTransform', {
69
+ enumerable: true,
70
+ get: function () {
71
+ return import_binding.moduleRunnerTransform;
72
+ }
73
+ });
68
74
  exports.replacePlugin = replacePlugin
69
75
  exports.scan = experimental_scan
70
76
  Object.defineProperty(exports, 'transform', {
@@ -1,4 +1,4 @@
1
- const require_src = require('../shared/src-1SOKv3Pa.cjs');
1
+ const require_src = require('../shared/src-C82jqmOo.cjs');
2
2
  require('../shared/parse-ast-index-Dh_sWnMa.cjs');
3
3
 
4
4
  exports.VERSION = require_src.VERSION
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
3
- const require_src = require('../shared/src-1SOKv3Pa.cjs');
3
+ const require_src = require('../shared/src-C82jqmOo.cjs');
4
4
  const require_parse_ast_index = require('../shared/parse-ast-index-Dh_sWnMa.cjs');
5
5
  const node_worker_threads = require_chunk.__toESM(require("node:worker_threads"));
6
6
 
package/dist/esm/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { colors } from "../shared/parse-ast-index-DIxeQDpE.mjs";
2
- import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-Cdwah9uk.mjs";
2
+ import { arraify, description, getInputCliKeys, getJsonSchema, getOutputCliKeys, rolldown, validateCliOptions, version, watch } from "../shared/src-DdLzruqH.mjs";
3
3
  import process$1, { cwd } from "node:process";
4
4
  import path, { sep } from "node:path";
5
5
  import fs from "node:fs";
@@ -1,5 +1,5 @@
1
1
  import { import_binding } from "../shared/parse-ast-index-DIxeQDpE.mjs";
2
- import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-Cdwah9uk.mjs";
2
+ import { BuiltinPlugin, buildImportAnalysisPlugin, composeJsPlugins, createBundler, dynamicImportVarsPlugin, handleOutputErrors, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, normalizedStringOrRegex, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin } from "../shared/src-DdLzruqH.mjs";
3
3
  import { pathToFileURL } from "node:url";
4
4
 
5
5
  //#region src/plugin/parallel-plugin.ts
@@ -52,5 +52,6 @@ function aliasPlugin(config) {
52
52
  }
53
53
 
54
54
  //#endregion
55
+ var moduleRunnerTransform = import_binding.moduleRunnerTransform;
55
56
  var transform = import_binding.transform;
56
- export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, replacePlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
57
+ export { aliasPlugin, buildImportAnalysisPlugin, composeJsPlugins as composePlugins, defineParallelPlugin, dynamicImportVarsPlugin, importGlobPlugin, jsonPlugin, loadFallbackPlugin, manifestPlugin, moduleFederationPlugin, modulePreloadPolyfillPlugin, moduleRunnerTransform, replacePlugin, experimental_scan as scan, transform, transformPlugin, viteResolvePlugin, wasmFallbackPlugin, wasmHelperPlugin };
@@ -1,4 +1,4 @@
1
1
  import "../shared/parse-ast-index-DIxeQDpE.mjs";
2
- import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-Cdwah9uk.mjs";
2
+ import { VERSION, build, defineConfig, rolldown, watch } from "../shared/src-DdLzruqH.mjs";
3
3
 
4
4
  export { VERSION, build, defineConfig, rolldown, watch };
@@ -1,5 +1,5 @@
1
1
  import { import_binding } from "../shared/parse-ast-index-DIxeQDpE.mjs";
2
- import { PluginContextData, bindingifyPlugin } from "../shared/src-Cdwah9uk.mjs";
2
+ import { PluginContextData, bindingifyPlugin } from "../shared/src-DdLzruqH.mjs";
3
3
  import { parentPort, workerData } from "node:worker_threads";
4
4
 
5
5
  //#region src/parallel-plugin-worker.ts
@@ -526,7 +526,8 @@ const ResolveOptionsSchema = valibot.strictObject({
526
526
  });
527
527
  const TreeshakingOptionsSchema = valibot.union([valibot.boolean(), valibot.looseObject({
528
528
  annotations: valibot.optional(valibot.boolean()),
529
- manualPureFunctions: valibot.optional(valibot.array(valibot.string()))
529
+ manualPureFunctions: valibot.optional(valibot.array(valibot.string())),
530
+ unknownGlobalSideEffects: valibot.optional(valibot.boolean())
530
531
  })]);
531
532
  const OnLogSchema = valibot.pipe(valibot.function(), valibot.args(valibot.tuple([
532
533
  LogLevelSchema,
@@ -1072,7 +1073,7 @@ function transformModuleInfo(info, option) {
1072
1073
 
1073
1074
  //#endregion
1074
1075
  //#region src/plugin/minimal-plugin-context.ts
1075
- var MinimalPluginContext = class {
1076
+ var MinimalPluginContextImpl = class {
1076
1077
  info;
1077
1078
  warn;
1078
1079
  debug;
@@ -1108,7 +1109,7 @@ function bindingifySideEffects(sideEffects) {
1108
1109
 
1109
1110
  //#endregion
1110
1111
  //#region src/plugin/plugin-context.ts
1111
- var PluginContext = class extends MinimalPluginContext {
1112
+ var PluginContextImpl = class extends MinimalPluginContextImpl {
1112
1113
  getModuleInfo;
1113
1114
  constructor(outputOptions, context, plugin, data, onLog, logLevel, currentLoadingModule) {
1114
1115
  super(onLog, logLevel, plugin.name);
@@ -1198,7 +1199,7 @@ var PluginContext = class extends MinimalPluginContext {
1198
1199
 
1199
1200
  //#endregion
1200
1201
  //#region src/plugin/transform-plugin-context.ts
1201
- var TransformPluginContext = class extends PluginContext {
1202
+ var TransformPluginContextImpl = class extends PluginContextImpl {
1202
1203
  constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
1203
1204
  super(outputOptions, context, plugin, data, onLog, LogLevelOption, moduleId);
1204
1205
  this.inner = inner;
@@ -1305,7 +1306,7 @@ function bindingifyBuildStart(args) {
1305
1306
  const { handler, meta } = normalizeHook(hook);
1306
1307
  return {
1307
1308
  plugin: async (ctx, opts) => {
1308
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
1309
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
1309
1310
  },
1310
1311
  meta: bindingifyPluginHookMeta(meta)
1311
1312
  };
@@ -1316,7 +1317,7 @@ function bindingifyBuildEnd(args) {
1316
1317
  const { handler, meta } = normalizeHook(hook);
1317
1318
  return {
1318
1319
  plugin: async (ctx, err) => {
1319
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : void 0);
1320
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : void 0);
1320
1321
  },
1321
1322
  meta: bindingifyPluginHookMeta(meta)
1322
1323
  };
@@ -1333,7 +1334,7 @@ function bindingifyResolveId(args) {
1333
1334
  custom: contextResolveOptions?.custom,
1334
1335
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1335
1336
  };
1336
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0, newExtraOptions);
1337
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0, newExtraOptions);
1337
1338
  if (ret == null) return;
1338
1339
  if (ret === false) return {
1339
1340
  id: specifier,
@@ -1361,7 +1362,7 @@ function bindingifyResolveDynamicImport(args) {
1361
1362
  const { handler, meta } = normalizeHook(hook);
1362
1363
  return {
1363
1364
  plugin: async (ctx, specifier, importer) => {
1364
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0);
1365
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0);
1365
1366
  if (ret == null) return;
1366
1367
  if (ret === false) return {
1367
1368
  id: specifier,
@@ -1389,7 +1390,7 @@ function bindingifyTransform(args) {
1389
1390
  const { handler, meta, options } = normalizeHook(hook);
1390
1391
  return {
1391
1392
  plugin: async (ctx, code, id, meta$1) => {
1392
- const ret = await handler.call(new TransformPluginContext(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
1393
+ const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
1393
1394
  if (ret == null) return void 0;
1394
1395
  if (typeof ret === "string") return { code: ret };
1395
1396
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1414,7 +1415,7 @@ function bindingifyLoad(args) {
1414
1415
  const { handler, meta, options } = normalizeHook(hook);
1415
1416
  return {
1416
1417
  plugin: async (ctx, id) => {
1417
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
1418
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
1418
1419
  if (ret == null) return;
1419
1420
  if (typeof ret === "string") return { code: ret };
1420
1421
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1450,7 +1451,7 @@ function bindingifyModuleParsed(args) {
1450
1451
  const { handler, meta } = normalizeHook(hook);
1451
1452
  return {
1452
1453
  plugin: async (ctx, moduleInfo) => {
1453
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1454
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1454
1455
  },
1455
1456
  meta: bindingifyPluginHookMeta(meta)
1456
1457
  };
@@ -1647,7 +1648,7 @@ function bindingifyRenderStart(args) {
1647
1648
  const { handler, meta } = normalizeHook(hook);
1648
1649
  return {
1649
1650
  plugin: async (ctx, opts) => {
1650
- handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1651
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1651
1652
  },
1652
1653
  meta: bindingifyPluginHookMeta(meta)
1653
1654
  };
@@ -1658,7 +1659,7 @@ function bindingifyRenderChunk(args) {
1658
1659
  const { handler, meta } = normalizeHook(hook);
1659
1660
  return {
1660
1661
  plugin: async (ctx, code, chunk, opts) => {
1661
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins));
1662
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins));
1662
1663
  if (ret == null) return;
1663
1664
  if (typeof ret === "string") return { code: ret };
1664
1665
  if (!ret.map) return { code: ret.code };
@@ -1676,7 +1677,7 @@ function bindingifyAugmentChunkHash(args) {
1676
1677
  const { handler, meta } = normalizeHook(hook);
1677
1678
  return {
1678
1679
  plugin: async (ctx, chunk) => {
1679
- return await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1680
+ return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1680
1681
  },
1681
1682
  meta: bindingifyPluginHookMeta(meta)
1682
1683
  };
@@ -1687,7 +1688,7 @@ function bindingifyRenderError(args) {
1687
1688
  const { handler, meta } = normalizeHook(hook);
1688
1689
  return {
1689
1690
  plugin: async (ctx, err) => {
1690
- handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
1691
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
1691
1692
  },
1692
1693
  meta: bindingifyPluginHookMeta(meta)
1693
1694
  };
@@ -1703,7 +1704,7 @@ function bindingifyGenerateBundle(args) {
1703
1704
  deleted: new Set()
1704
1705
  };
1705
1706
  const output = transformToOutputBundle(bundle, changed);
1706
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1707
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1707
1708
  return collectChangedBundle(changed, output);
1708
1709
  },
1709
1710
  meta: bindingifyPluginHookMeta(meta)
@@ -1720,7 +1721,7 @@ function bindingifyWriteBundle(args) {
1720
1721
  deleted: new Set()
1721
1722
  };
1722
1723
  const output = transformToOutputBundle(bundle, changed);
1723
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1724
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1724
1725
  return collectChangedBundle(changed, output);
1725
1726
  },
1726
1727
  meta: bindingifyPluginHookMeta(meta)
@@ -1732,7 +1733,7 @@ function bindingifyCloseBundle(args) {
1732
1733
  const { handler, meta } = normalizeHook(hook);
1733
1734
  return {
1734
1735
  plugin: async (ctx) => {
1735
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1736
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1736
1737
  },
1737
1738
  meta: bindingifyPluginHookMeta(meta)
1738
1739
  };
@@ -1744,7 +1745,7 @@ function bindingifyBanner(args) {
1744
1745
  return {
1745
1746
  plugin: async (ctx, chunk) => {
1746
1747
  if (typeof handler === "string") return handler;
1747
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1748
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1748
1749
  },
1749
1750
  meta: bindingifyPluginHookMeta(meta)
1750
1751
  };
@@ -1756,7 +1757,7 @@ function bindingifyFooter(args) {
1756
1757
  return {
1757
1758
  plugin: async (ctx, chunk) => {
1758
1759
  if (typeof handler === "string") return handler;
1759
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1760
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1760
1761
  },
1761
1762
  meta: bindingifyPluginHookMeta(meta)
1762
1763
  };
@@ -1768,7 +1769,7 @@ function bindingifyIntro(args) {
1768
1769
  return {
1769
1770
  plugin: async (ctx, chunk) => {
1770
1771
  if (typeof handler === "string") return handler;
1771
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1772
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1772
1773
  },
1773
1774
  meta: bindingifyPluginHookMeta(meta)
1774
1775
  };
@@ -1780,7 +1781,7 @@ function bindingifyOutro(args) {
1780
1781
  return {
1781
1782
  plugin: async (ctx, chunk) => {
1782
1783
  if (typeof handler === "string") return handler;
1783
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1784
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1784
1785
  },
1785
1786
  meta: bindingifyPluginHookMeta(meta)
1786
1787
  };
@@ -1794,7 +1795,7 @@ function bindingifyWatchChange(args) {
1794
1795
  const { handler, meta } = normalizeHook(hook);
1795
1796
  return {
1796
1797
  plugin: async (ctx, id, event) => {
1797
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
1798
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
1798
1799
  },
1799
1800
  meta: bindingifyPluginHookMeta(meta)
1800
1801
  };
@@ -1805,7 +1806,7 @@ function bindingifyCloseWatcher(args) {
1805
1806
  const { handler, meta } = normalizeHook(hook);
1806
1807
  return {
1807
1808
  plugin: async (ctx) => {
1808
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1809
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1809
1810
  },
1810
1811
  meta: bindingifyPluginHookMeta(meta)
1811
1812
  };
@@ -2163,14 +2164,12 @@ function bindingifyWatch(watch$1) {
2163
2164
  }
2164
2165
  function bindingifyTreeshakeOptions(config) {
2165
2166
  if (config === false) return void 0;
2166
- if (config === true || config === void 0) return {
2167
- moduleSideEffects: true,
2168
- annotations: true
2169
- };
2167
+ if (config === true || config === void 0) return { moduleSideEffects: true };
2170
2168
  let normalizedConfig = {
2171
2169
  moduleSideEffects: true,
2172
- annotations: config.annotations ?? true,
2173
- manualPureFunctions: config.manualPureFunctions
2170
+ annotations: config.annotations,
2171
+ manualPureFunctions: config.manualPureFunctions,
2172
+ unknownGlobalSideEffects: config.unknownGlobalSideEffects
2174
2173
  };
2175
2174
  if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
2176
2175
  else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
@@ -2661,6 +2660,9 @@ var RolldownBuild = class {
2661
2660
  async [Symbol.asyncDispose]() {
2662
2661
  await this.close();
2663
2662
  }
2663
+ async generateHmrPatch(changedFiles) {
2664
+ return this.#bundler?.bundler.generateHmrPatch(changedFiles);
2665
+ }
2664
2666
  };
2665
2667
 
2666
2668
  //#endregion
@@ -2795,7 +2797,7 @@ const watch = (input) => {
2795
2797
 
2796
2798
  //#endregion
2797
2799
  //#region package.json
2798
- var version = "1.0.0-beta.3-commit.7b0c517";
2800
+ var version = "1.0.0-beta.3-commit.e71f948";
2799
2801
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2800
2802
 
2801
2803
  //#endregion
@@ -524,7 +524,8 @@ const ResolveOptionsSchema = v.strictObject({
524
524
  });
525
525
  const TreeshakingOptionsSchema = v.union([v.boolean(), v.looseObject({
526
526
  annotations: v.optional(v.boolean()),
527
- manualPureFunctions: v.optional(v.array(v.string()))
527
+ manualPureFunctions: v.optional(v.array(v.string())),
528
+ unknownGlobalSideEffects: v.optional(v.boolean())
528
529
  })]);
529
530
  const OnLogSchema = v.pipe(v.function(), v.args(v.tuple([
530
531
  LogLevelSchema,
@@ -1070,7 +1071,7 @@ function transformModuleInfo(info, option) {
1070
1071
 
1071
1072
  //#endregion
1072
1073
  //#region src/plugin/minimal-plugin-context.ts
1073
- var MinimalPluginContext = class {
1074
+ var MinimalPluginContextImpl = class {
1074
1075
  info;
1075
1076
  warn;
1076
1077
  debug;
@@ -1106,7 +1107,7 @@ function bindingifySideEffects(sideEffects) {
1106
1107
 
1107
1108
  //#endregion
1108
1109
  //#region src/plugin/plugin-context.ts
1109
- var PluginContext = class extends MinimalPluginContext {
1110
+ var PluginContextImpl = class extends MinimalPluginContextImpl {
1110
1111
  getModuleInfo;
1111
1112
  constructor(outputOptions, context, plugin, data, onLog, logLevel, currentLoadingModule) {
1112
1113
  super(onLog, logLevel, plugin.name);
@@ -1196,7 +1197,7 @@ var PluginContext = class extends MinimalPluginContext {
1196
1197
 
1197
1198
  //#endregion
1198
1199
  //#region src/plugin/transform-plugin-context.ts
1199
- var TransformPluginContext = class extends PluginContext {
1200
+ var TransformPluginContextImpl = class extends PluginContextImpl {
1200
1201
  constructor(outputOptions, context, plugin, data, inner, moduleId, moduleSource, onLog, LogLevelOption) {
1201
1202
  super(outputOptions, context, plugin, data, onLog, LogLevelOption, moduleId);
1202
1203
  this.inner = inner;
@@ -1303,7 +1304,7 @@ function bindingifyBuildStart(args) {
1303
1304
  const { handler, meta } = normalizeHook(hook);
1304
1305
  return {
1305
1306
  plugin: async (ctx, opts) => {
1306
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
1307
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedInputOptionsImpl(opts, args.onLog));
1307
1308
  },
1308
1309
  meta: bindingifyPluginHookMeta(meta)
1309
1310
  };
@@ -1314,7 +1315,7 @@ function bindingifyBuildEnd(args) {
1314
1315
  const { handler, meta } = normalizeHook(hook);
1315
1316
  return {
1316
1317
  plugin: async (ctx, err) => {
1317
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : void 0);
1318
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), err ? normalizeErrors(err) : void 0);
1318
1319
  },
1319
1320
  meta: bindingifyPluginHookMeta(meta)
1320
1321
  };
@@ -1331,7 +1332,7 @@ function bindingifyResolveId(args) {
1331
1332
  custom: contextResolveOptions?.custom,
1332
1333
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]: contextResolveOptions?.[SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]
1333
1334
  };
1334
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0, newExtraOptions);
1335
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0, newExtraOptions);
1335
1336
  if (ret == null) return;
1336
1337
  if (ret === false) return {
1337
1338
  id: specifier,
@@ -1359,7 +1360,7 @@ function bindingifyResolveDynamicImport(args) {
1359
1360
  const { handler, meta } = normalizeHook(hook);
1360
1361
  return {
1361
1362
  plugin: async (ctx, specifier, importer) => {
1362
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0);
1363
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), specifier, importer ?? void 0);
1363
1364
  if (ret == null) return;
1364
1365
  if (ret === false) return {
1365
1366
  id: specifier,
@@ -1387,7 +1388,7 @@ function bindingifyTransform(args) {
1387
1388
  const { handler, meta, options } = normalizeHook(hook);
1388
1389
  return {
1389
1390
  plugin: async (ctx, code, id, meta$1) => {
1390
- const ret = await handler.call(new TransformPluginContext(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
1391
+ const ret = await handler.call(new TransformPluginContextImpl(args.outputOptions, ctx.inner(), args.plugin, args.pluginContextData, ctx, id, code, args.onLog, args.logLevel), code, id, meta$1);
1391
1392
  if (ret == null) return void 0;
1392
1393
  if (typeof ret === "string") return { code: ret };
1393
1394
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1412,7 +1413,7 @@ function bindingifyLoad(args) {
1412
1413
  const { handler, meta, options } = normalizeHook(hook);
1413
1414
  return {
1414
1415
  plugin: async (ctx, id) => {
1415
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
1416
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel, id), id);
1416
1417
  if (ret == null) return;
1417
1418
  if (typeof ret === "string") return { code: ret };
1418
1419
  let moduleOption = args.pluginContextData.updateModuleOption(id, {
@@ -1448,7 +1449,7 @@ function bindingifyModuleParsed(args) {
1448
1449
  const { handler, meta } = normalizeHook(hook);
1449
1450
  return {
1450
1451
  plugin: async (ctx, moduleInfo) => {
1451
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1452
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformModuleInfo(moduleInfo, args.pluginContextData.getModuleOption(moduleInfo.id)));
1452
1453
  },
1453
1454
  meta: bindingifyPluginHookMeta(meta)
1454
1455
  };
@@ -1645,7 +1646,7 @@ function bindingifyRenderStart(args) {
1645
1646
  const { handler, meta } = normalizeHook(hook);
1646
1647
  return {
1647
1648
  plugin: async (ctx, opts) => {
1648
- handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1649
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), new NormalizedInputOptionsImpl(opts, args.onLog));
1649
1650
  },
1650
1651
  meta: bindingifyPluginHookMeta(meta)
1651
1652
  };
@@ -1656,7 +1657,7 @@ function bindingifyRenderChunk(args) {
1656
1657
  const { handler, meta } = normalizeHook(hook);
1657
1658
  return {
1658
1659
  plugin: async (ctx, code, chunk, opts) => {
1659
- const ret = await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins));
1660
+ const ret = await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), code, transformRenderedChunk(chunk), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins));
1660
1661
  if (ret == null) return;
1661
1662
  if (typeof ret === "string") return { code: ret };
1662
1663
  if (!ret.map) return { code: ret.code };
@@ -1674,7 +1675,7 @@ function bindingifyAugmentChunkHash(args) {
1674
1675
  const { handler, meta } = normalizeHook(hook);
1675
1676
  return {
1676
1677
  plugin: async (ctx, chunk) => {
1677
- return await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1678
+ return await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1678
1679
  },
1679
1680
  meta: bindingifyPluginHookMeta(meta)
1680
1681
  };
@@ -1685,7 +1686,7 @@ function bindingifyRenderError(args) {
1685
1686
  const { handler, meta } = normalizeHook(hook);
1686
1687
  return {
1687
1688
  plugin: async (ctx, err) => {
1688
- handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
1689
+ handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), normalizeErrors(err));
1689
1690
  },
1690
1691
  meta: bindingifyPluginHookMeta(meta)
1691
1692
  };
@@ -1701,7 +1702,7 @@ function bindingifyGenerateBundle(args) {
1701
1702
  deleted: new Set()
1702
1703
  };
1703
1704
  const output = transformToOutputBundle(bundle, changed);
1704
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1705
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output, isWrite);
1705
1706
  return collectChangedBundle(changed, output);
1706
1707
  },
1707
1708
  meta: bindingifyPluginHookMeta(meta)
@@ -1718,7 +1719,7 @@ function bindingifyWriteBundle(args) {
1718
1719
  deleted: new Set()
1719
1720
  };
1720
1721
  const output = transformToOutputBundle(bundle, changed);
1721
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1722
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), new NormalizedOutputOptionsImpl(opts, args.outputOptions, args.normalizedOutputPlugins), output);
1722
1723
  return collectChangedBundle(changed, output);
1723
1724
  },
1724
1725
  meta: bindingifyPluginHookMeta(meta)
@@ -1730,7 +1731,7 @@ function bindingifyCloseBundle(args) {
1730
1731
  const { handler, meta } = normalizeHook(hook);
1731
1732
  return {
1732
1733
  plugin: async (ctx) => {
1733
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1734
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1734
1735
  },
1735
1736
  meta: bindingifyPluginHookMeta(meta)
1736
1737
  };
@@ -1742,7 +1743,7 @@ function bindingifyBanner(args) {
1742
1743
  return {
1743
1744
  plugin: async (ctx, chunk) => {
1744
1745
  if (typeof handler === "string") return handler;
1745
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1746
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1746
1747
  },
1747
1748
  meta: bindingifyPluginHookMeta(meta)
1748
1749
  };
@@ -1754,7 +1755,7 @@ function bindingifyFooter(args) {
1754
1755
  return {
1755
1756
  plugin: async (ctx, chunk) => {
1756
1757
  if (typeof handler === "string") return handler;
1757
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1758
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1758
1759
  },
1759
1760
  meta: bindingifyPluginHookMeta(meta)
1760
1761
  };
@@ -1766,7 +1767,7 @@ function bindingifyIntro(args) {
1766
1767
  return {
1767
1768
  plugin: async (ctx, chunk) => {
1768
1769
  if (typeof handler === "string") return handler;
1769
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1770
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1770
1771
  },
1771
1772
  meta: bindingifyPluginHookMeta(meta)
1772
1773
  };
@@ -1778,7 +1779,7 @@ function bindingifyOutro(args) {
1778
1779
  return {
1779
1780
  plugin: async (ctx, chunk) => {
1780
1781
  if (typeof handler === "string") return handler;
1781
- return handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1782
+ return handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), transformRenderedChunk(chunk));
1782
1783
  },
1783
1784
  meta: bindingifyPluginHookMeta(meta)
1784
1785
  };
@@ -1792,7 +1793,7 @@ function bindingifyWatchChange(args) {
1792
1793
  const { handler, meta } = normalizeHook(hook);
1793
1794
  return {
1794
1795
  plugin: async (ctx, id, event) => {
1795
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
1796
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel), id, { event });
1796
1797
  },
1797
1798
  meta: bindingifyPluginHookMeta(meta)
1798
1799
  };
@@ -1803,7 +1804,7 @@ function bindingifyCloseWatcher(args) {
1803
1804
  const { handler, meta } = normalizeHook(hook);
1804
1805
  return {
1805
1806
  plugin: async (ctx) => {
1806
- await handler.call(new PluginContext(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1807
+ await handler.call(new PluginContextImpl(args.outputOptions, ctx, args.plugin, args.pluginContextData, args.onLog, args.logLevel));
1807
1808
  },
1808
1809
  meta: bindingifyPluginHookMeta(meta)
1809
1810
  };
@@ -2161,14 +2162,12 @@ function bindingifyWatch(watch$1) {
2161
2162
  }
2162
2163
  function bindingifyTreeshakeOptions(config) {
2163
2164
  if (config === false) return void 0;
2164
- if (config === true || config === void 0) return {
2165
- moduleSideEffects: true,
2166
- annotations: true
2167
- };
2165
+ if (config === true || config === void 0) return { moduleSideEffects: true };
2168
2166
  let normalizedConfig = {
2169
2167
  moduleSideEffects: true,
2170
- annotations: config.annotations ?? true,
2171
- manualPureFunctions: config.manualPureFunctions
2168
+ annotations: config.annotations,
2169
+ manualPureFunctions: config.manualPureFunctions,
2170
+ unknownGlobalSideEffects: config.unknownGlobalSideEffects
2172
2171
  };
2173
2172
  if (config.moduleSideEffects === void 0) normalizedConfig.moduleSideEffects = true;
2174
2173
  else if (config.moduleSideEffects === "no-external") normalizedConfig.moduleSideEffects = [{
@@ -2659,6 +2658,9 @@ var RolldownBuild = class {
2659
2658
  async [Symbol.asyncDispose]() {
2660
2659
  await this.close();
2661
2660
  }
2661
+ async generateHmrPatch(changedFiles) {
2662
+ return this.#bundler?.bundler.generateHmrPatch(changedFiles);
2663
+ }
2662
2664
  };
2663
2665
 
2664
2666
  //#endregion
@@ -2793,7 +2795,7 @@ const watch = (input) => {
2793
2795
 
2794
2796
  //#endregion
2795
2797
  //#region package.json
2796
- var version = "1.0.0-beta.3-commit.7b0c517";
2798
+ var version = "1.0.0-beta.3-commit.e71f948";
2797
2799
  var description = "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.";
2798
2800
 
2799
2801
  //#endregion
@@ -9,4 +9,5 @@ export declare class RolldownBuild {
9
9
  write(outputOptions?: OutputOptions): Promise<RolldownOutput>;
10
10
  close(): Promise<void>;
11
11
  [Symbol.asyncDispose](): Promise<void>;
12
+ generateHmrPatch(changedFiles: string[]): Promise<string | void>;
12
13
  }
@@ -664,6 +664,7 @@ export interface BindingTreeshake {
664
664
  moduleSideEffects: boolean | BindingModuleSideEffectsRule[] | ((id: string, is_external: boolean) => boolean | undefined)
665
665
  annotations?: boolean
666
666
  manualPureFunctions?: Array<string>
667
+ unknownGlobalSideEffects?: boolean
667
668
  }
668
669
 
669
670
  export interface BindingViteResolvePluginConfig {
@@ -1,6 +1,6 @@
1
1
  export { defineParallelPlugin } from './plugin/parallel-plugin';
2
2
  export { experimental_scan as scan } from './api/experimental';
3
- export { transform } from './binding';
3
+ export { transform, moduleRunnerTransform } from './binding';
4
4
  export type { TransformOptions, TransformResult } from './binding';
5
5
  export { composeJsPlugins as composePlugins } from './utils/compose-js-plugins';
6
6
  export { modulePreloadPolyfillPlugin, dynamicImportVarsPlugin, wasmHelperPlugin, wasmFallbackPlugin, importGlobPlugin, manifestPlugin, loadFallbackPlugin, jsonPlugin, buildImportAnalysisPlugin, viteResolvePlugin, moduleFederationPlugin, } from './builtin-plugin/constructors';
@@ -4,7 +4,15 @@ export interface PluginContextMeta {
4
4
  rolldownVersion: string;
5
5
  watchMode: boolean;
6
6
  }
7
- export declare class MinimalPluginContext {
7
+ export interface MinimalPluginContext {
8
+ readonly pluginName: string;
9
+ error: (e: RollupError | string) => never;
10
+ info: LoggingFunction;
11
+ warn: LoggingFunction;
12
+ debug: LoggingFunction;
13
+ meta: PluginContextMeta;
14
+ }
15
+ export declare class MinimalPluginContextImpl implements MinimalPluginContext {
8
16
  readonly pluginName: string;
9
17
  info: LoggingFunction;
10
18
  warn: LoggingFunction;
@@ -1,6 +1,6 @@
1
1
  import type { BindingPluginContext, ParserOptions } from '../binding';
2
2
  import type { CustomPluginOptions, ModuleOptions, Plugin, ResolvedId } from './index';
3
- import { MinimalPluginContext } from '../plugin/minimal-plugin-context';
3
+ import { MinimalPluginContext, MinimalPluginContextImpl } from '../plugin/minimal-plugin-context';
4
4
  import { AssetSource } from '../utils/asset-source';
5
5
  import { ModuleInfo } from '../types/module-info';
6
6
  import { PluginContextData } from './plugin-context-data';
@@ -32,7 +32,20 @@ export interface PrivatePluginContextResolveOptions extends PluginContextResolve
32
32
  [SYMBOL_FOR_RESOLVE_CALLER_THAT_SKIP_SELF]?: symbol;
33
33
  }
34
34
  export type GetModuleInfo = (moduleId: string) => ModuleInfo | null;
35
- export declare class PluginContext extends MinimalPluginContext {
35
+ export interface PluginContext extends MinimalPluginContext {
36
+ emitFile(file: EmittedFile): string;
37
+ getFileName(referenceId: string): string;
38
+ getModuleIds(): IterableIterator<string>;
39
+ getModuleInfo: GetModuleInfo;
40
+ addWatchFile(id: string): void;
41
+ load(options: {
42
+ id: string;
43
+ resolveDependencies?: boolean;
44
+ } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
45
+ parse(input: string, options?: ParserOptions | undefined | null): Program;
46
+ resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
47
+ }
48
+ export declare class PluginContextImpl extends MinimalPluginContextImpl implements PluginContext {
36
49
  private outputOptions;
37
50
  private context;
38
51
  private data;
@@ -45,7 +58,7 @@ export declare class PluginContext extends MinimalPluginContext {
45
58
  resolveDependencies?: boolean;
46
59
  } & Partial<PartialNull<ModuleOptions>>): Promise<ModuleInfo>;
47
60
  resolve(source: string, importer?: string, options?: PluginContextResolveOptions): Promise<ResolvedId | null>;
48
- emitFile: (file: EmittedFile) => string;
61
+ emitFile: PluginContext['emitFile'];
49
62
  private getAssetFileNames;
50
63
  getFileName(referenceId: string): string;
51
64
  getModuleIds(): IterableIterator<string>;
@@ -1,11 +1,21 @@
1
1
  import type { BindingPluginContext, BindingTransformPluginContext } from '../binding';
2
- import type { LogHandler, LogLevelOption, RollupError } from '../types/misc';
3
- import { PluginContext } from './plugin-context';
2
+ import type { LoggingFunctionWithPosition, LogHandler, LogLevelOption, RollupError } from '../types/misc';
3
+ import { PluginContextImpl, type PluginContext } from './plugin-context';
4
4
  import { PluginContextData } from './plugin-context-data';
5
5
  import type { Plugin } from './index';
6
6
  import { SourceMap } from '../types/rolldown-output';
7
7
  import { OutputOptions } from '../options/output-options';
8
- export declare class TransformPluginContext extends PluginContext {
8
+ export interface TransformPluginContext extends PluginContext {
9
+ debug: LoggingFunctionWithPosition;
10
+ info: LoggingFunctionWithPosition;
11
+ warn: LoggingFunctionWithPosition;
12
+ error(e: RollupError | string, pos?: number | {
13
+ column: number;
14
+ line: number;
15
+ }): never;
16
+ getCombinedSourcemap(): SourceMap;
17
+ }
18
+ export declare class TransformPluginContextImpl extends PluginContextImpl implements TransformPluginContext {
9
19
  private inner;
10
20
  private moduleId;
11
21
  private moduleSource;
@@ -8,4 +8,5 @@ export type TreeshakingOptions = {
8
8
  moduleSideEffects?: ModuleSideEffectsOption;
9
9
  annotations?: boolean;
10
10
  manualPureFunctions?: string[];
11
+ unknownGlobalSideEffects?: boolean;
11
12
  } | boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rolldown",
3
- "version": "1.0.0-beta.3-commit.7b0c517",
3
+ "version": "1.0.0-beta.3-commit.e71f948",
4
4
  "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
5
5
  "homepage": "https://rolldown.rs/",
6
6
  "repository": {
@@ -122,21 +122,21 @@
122
122
  "unbuild": "^3.0.0",
123
123
  "why-is-node-running": "^3.0.0",
124
124
  "@rolldown/testing": "0.0.1",
125
- "rolldown": "1.0.0-beta.3-commit.7b0c517"
125
+ "rolldown": "1.0.0-beta.3-commit.e71f948"
126
126
  },
127
127
  "optionalDependencies": {
128
- "@rolldown/binding-darwin-arm64": "1.0.0-beta.3-commit.7b0c517",
129
- "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.3-commit.7b0c517",
130
- "@rolldown/binding-freebsd-x64": "1.0.0-beta.3-commit.7b0c517",
131
- "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.3-commit.7b0c517",
132
- "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.3-commit.7b0c517",
133
- "@rolldown/binding-darwin-x64": "1.0.0-beta.3-commit.7b0c517",
134
- "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.3-commit.7b0c517",
135
- "@rolldown/binding-linux-x64-musl": "1.0.0-beta.3-commit.7b0c517",
136
- "@rolldown/binding-wasm32-wasi": "1.0.0-beta.3-commit.7b0c517",
137
- "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.3-commit.7b0c517",
138
- "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.3-commit.7b0c517",
139
- "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3-commit.7b0c517"
128
+ "@rolldown/binding-darwin-arm64": "1.0.0-beta.3-commit.e71f948",
129
+ "@rolldown/binding-darwin-x64": "1.0.0-beta.3-commit.e71f948",
130
+ "@rolldown/binding-freebsd-x64": "1.0.0-beta.3-commit.e71f948",
131
+ "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.3-commit.e71f948",
132
+ "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.3-commit.e71f948",
133
+ "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.3-commit.e71f948",
134
+ "@rolldown/binding-linux-x64-musl": "1.0.0-beta.3-commit.e71f948",
135
+ "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.3-commit.e71f948",
136
+ "@rolldown/binding-wasm32-wasi": "1.0.0-beta.3-commit.e71f948",
137
+ "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.3-commit.e71f948",
138
+ "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.3-commit.e71f948",
139
+ "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.3-commit.e71f948"
140
140
  },
141
141
  "scripts": {
142
142
  "# Scrips for binding #": "_",