@rollipop/rolldown 1.0.0-rc.1 → 1.0.0-rc.10

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 (50) hide show
  1. package/bin/cli.mjs +0 -1
  2. package/dist/cli.mjs +705 -1102
  3. package/dist/config.d.mts +9 -5
  4. package/dist/config.mjs +4 -14
  5. package/dist/experimental-index.d.mts +189 -54
  6. package/dist/experimental-index.mjs +106 -22
  7. package/dist/experimental-runtime-types.d.ts +0 -5
  8. package/dist/filter-index.d.mts +1 -2
  9. package/dist/filter-index.mjs +25 -8
  10. package/dist/get-log-filter.d.mts +3 -7
  11. package/dist/get-log-filter.mjs +23 -3
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +6 -13
  14. package/dist/parallel-plugin-worker.mjs +4 -8
  15. package/dist/parallel-plugin.d.mts +3 -4
  16. package/dist/parallel-plugin.mjs +1 -2
  17. package/dist/parse-ast-index.d.mts +26 -2
  18. package/dist/parse-ast-index.mjs +60 -4
  19. package/dist/plugins-index.d.mts +8 -5
  20. package/dist/plugins-index.mjs +8 -8
  21. package/dist/shared/{binding-tNJoEqAa.mjs → binding-D_jQsHun.mjs} +41 -43
  22. package/dist/shared/binding-hSQGgsUz.d.mts +1877 -0
  23. package/dist/shared/{bindingify-input-options-CfhrNd_y.mjs → bindingify-input-options-DfXGy4QO.mjs} +127 -167
  24. package/dist/shared/{constructors-414MPkgB.mjs → constructors-B-HbV10G.mjs} +14 -7
  25. package/dist/shared/{constructors--k1uxZrh.d.mts → constructors-DMl58KN5.d.mts} +13 -4
  26. package/dist/shared/define-config-BSxBeCq6.d.mts +3810 -0
  27. package/dist/shared/{define-config-BVG4QvnP.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  28. package/dist/shared/error-D5tMcn3l.mjs +85 -0
  29. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  30. package/dist/shared/{load-config-Qtd9pHJ5.mjs → load-config-CNjYgiQv.mjs} +11 -5
  31. package/dist/shared/{logging-wIy4zY9I.d.mts → logging-C6h4g8dA.d.mts} +6 -6
  32. package/dist/shared/{logs-NH298mHo.mjs → logs-D80CXhvg.mjs} +6 -9
  33. package/dist/shared/{misc-CCZIsXVO.mjs → misc-DJYbNKZX.mjs} +1 -2
  34. package/dist/shared/{normalize-string-or-regex-DeB7vQ75.mjs → normalize-string-or-regex-B8PEhdn1.mjs} +22 -17
  35. package/dist/shared/parse-iQx2ihYn.mjs +74 -0
  36. package/dist/shared/{prompt-tlfjalEt.mjs → prompt-BYQIwEjg.mjs} +4 -6
  37. package/dist/shared/resolve-tsconfig-CxoM-bno.mjs +113 -0
  38. package/dist/shared/{rolldown-BMzJcmQ7.mjs → rolldown-C0o3hS3w.mjs} +2 -4
  39. package/dist/shared/rolldown-build-80GULIOI.mjs +3326 -0
  40. package/dist/shared/transform-DY2pi3Qm.d.mts +149 -0
  41. package/dist/shared/{watch-HmN4U4B9.mjs → watch-C2am0Ahc.mjs} +73 -78
  42. package/dist/utils-index.d.mts +376 -0
  43. package/dist/utils-index.mjs +2414 -0
  44. package/package.json +23 -21
  45. package/dist/cli-setup.d.mts +0 -1
  46. package/dist/cli-setup.mjs +0 -17
  47. package/dist/shared/binding-B92Lq__Q.d.mts +0 -1687
  48. package/dist/shared/define-config-D8xP5iyL.d.mts +0 -3463
  49. package/dist/shared/parse-ast-index-BcP4Ts_P.mjs +0 -99
  50. package/dist/shared/rolldown-build-DWeKtJOy.mjs +0 -2371
@@ -1,4 +1,26 @@
1
1
  //#region src/get-log-filter.ts
2
+ /**
3
+ * A helper function to generate log filters using the same syntax as the CLI.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import { defineConfig } from 'rolldown';
8
+ * import { getLogFilter } from 'rolldown/getLogFilter';
9
+ *
10
+ * const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
11
+ *
12
+ * export default defineConfig({
13
+ * input: 'main.js',
14
+ * onLog(level, log, handler) {
15
+ * if (logFilter(log)) {
16
+ * handler(level, log);
17
+ * }
18
+ * }
19
+ * });
20
+ * ```
21
+ *
22
+ * @category Config
23
+ */
2
24
  const getLogFilter = (filters) => {
3
25
  if (filters.length === 0) return () => true;
4
26
  const normalizedFilters = filters.map((filter) => filter.split("&").map((subFilter) => {
@@ -42,7 +64,5 @@ const testFilter = (log, key, parts) => {
42
64
  }
43
65
  return value.endsWith(parts[lastPartIndex]);
44
66
  };
45
- var get_log_filter_default = getLogFilter;
46
-
47
67
  //#endregion
48
- export { get_log_filter_default as default };
68
+ export { getLogFilter as default };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-wIy4zY9I.mjs";
2
- import { P as PreRenderedChunk, s as BindingMagicString } from "./shared/binding-B92Lq__Q.mjs";
3
- import { $ as BufferEncoding, A as TransformResult, At as MinifyOptions, B as EmittedChunk, Bt as RenderedModule, C as Plugin, Ct as ChunkingContext, D as RolldownPlugin, Dt as GeneratedCodeOptions, E as ResolvedId, Et as CodeSplittingOptions, F as SourceMapInput, Ft as PartialNull, G as PluginContextResolveOptions, Gt as SourcemapIgnoreListOption, H as EmittedPrebuiltChunk, Ht as SourceMap, I as OutputBundle, J as MinimalPluginContext, K as DefineParallelPluginResult, L as TreeshakingOptions, Lt as OutputAsset, Mt as OutputOptions, N as VERSION, Nt as PreRenderedAsset, O as RolldownPluginOption, Ot as GeneratedCodePreset, P as ExistingRawSourceMap, Q as ModuleTypeFilter, R as TransformPluginContext, Rt as OutputChunk, S as PartialResolvedId, St as ChunkFileNamesFunction, T as ResolveIdResult, Tt as CodeSplittingNameFunction, U as GetModuleInfo, V as EmittedFile, Vt as RolldownOutput, W as PluginContext, Wt as ModuleInfo, X as GeneralHookFilter, Y as PluginContextMeta, Z as HookFilter, _ as LoadResult, _t as BuildOptions, a as ExternalOption, at as NormalizedInputOptions, b as ObjectHook, bt as AdvancedChunksGroup, c as InputOptions, ct as LoggingFunction, d as WatcherOptions, dt as RolldownWatcher, et as RolldownDirectoryEntry, f as AsyncPluginHooks, ft as RolldownWatcherEvent, g as ImportKind, gt as RolldownBuild, h as HookFilterExtension, ht as rolldown, i as RolldownOptions, it as NormalizedOutputOptions, jt as ModuleFormat, k as SourceDescription, kt as GlobalsFunction, l as ModuleTypes, lt as WarningHandlerWithDefault, m as FunctionPluginHooks, mt as WatchOptions, n as RolldownOptionsFunction, nt as RolldownFsModule, o as ExternalOptionFunction, ot as TransformOptions, p as CustomPluginOptions, pt as RolldownWatcherWatcherEventMap, r as defineConfig, rt as InternalModuleFormat, s as InputOption, st as ChecksOptions, t as ConfigExport, tt as RolldownFileStats, u as OptimizationOptions, ut as watch, v as ModuleOptions, vt as build, w as ResolveIdExtraOptions, wt as CodeSplittingGroup, x as ParallelPluginHooks, xt as AdvancedChunksOptions, y as ModuleType, yt as AddonFunction, z as EmittedAsset, zt as RenderedChunk } from "./shared/define-config-D8xP5iyL.mjs";
4
- export { AddonFunction, AdvancedChunksGroup, AdvancedChunksOptions, AsyncPluginHooks, BindingMagicString, BufferEncoding, BuildOptions, ChecksOptions, ChunkFileNamesFunction, ChunkingContext, CodeSplittingGroup, CodeSplittingNameFunction, CodeSplittingOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedChunk, EmittedFile, EmittedPrebuiltChunk, ExistingRawSourceMap, ExternalOption, ExternalOptionFunction, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PluginContextResolveOptions, PreRenderedAsset, PreRenderedChunk, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownError, RolldownError as RollupError, RolldownFileStats, RolldownFsModule, RolldownLog, RolldownLog as RollupLog, RolldownLogWithString, RolldownLogWithString as RollupLogWithString, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RolldownWatcherWatcherEventMap, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformOptions, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherOptions, build, defineConfig, rolldown, watch };
1
+ import { a as RolldownLog, i as RolldownError, n as LogLevelOption, o as RolldownLogWithString, r as LogOrStringHandler, t as LogLevel } from "./shared/logging-C6h4g8dA.mjs";
2
+ import { V as PreRenderedChunk } from "./shared/binding-hSQGgsUz.mjs";
3
+ import { $ as GeneralHookFilter, A as SourceDescription, At as CodeSplittingOptions, B as TreeshakingOptions, Bt as PartialNull, C as PartialResolvedId, Ct as AddonFunction, D as ResolvedId, Dt as ChunkingContext, E as ResolveIdResult, Et as ChunkFileNamesFunction, F as VERSION, Ft as MinifyOptions, G as EmittedPrebuiltChunk, Gt as RenderedModule, H as EmittedAsset, Ht as OutputAsset, I as BundleError, It as ModuleFormat, J as PluginContextResolveOptions, K as GetModuleInfo, Kt as RolldownOutput, L as ExistingRawSourceMap, Lt as OutputOptions, Mt as GeneratedCodeOptions, Nt as GeneratedCodePreset, O as RolldownPlugin, Ot as CodeSplittingGroup, P as RUNTIME_MODULE_ID, Pt as GlobalsFunction, Q as PluginContextMeta, R as SourceMapInput, Rt as PreRenderedAsset, S as ParallelPluginHooks, St as build, T as ResolveIdExtraOptions, Tt as AdvancedChunksOptions, U as EmittedChunk, Ut as OutputChunk, V as TransformPluginContext, W as EmittedFile, Wt as RenderedChunk, Xt as SourcemapIgnoreListOption, Y as DefineParallelPluginResult, Yt as ModuleInfo, Z as MinimalPluginContext, _ as ImportKind, _t as RolldownWatcherWatcherEventMap, a as ExternalOption, at as RolldownFsModule, b as ModuleType, bt as RolldownBuild, c as InputOptions, ct as NormalizedInputOptions, d as WatcherFileWatcherOptions, dt as LoggingFunction, et as HookFilter, f as WatcherOptions, ft as WarningHandlerWithDefault, g as HookFilterExtension, gt as RolldownWatcherEvent, h as FunctionPluginHooks, ht as RolldownWatcher, i as RolldownOptions, it as RolldownFileStats, j as TransformResult, jt as CommentsOptions, k as RolldownPluginOption, kt as CodeSplittingNameFunction, l as ModuleTypes, lt as TransformOptions, m as CustomPluginOptions, mt as watch, n as RolldownOptionsFunction, nt as BufferEncoding, o as ExternalOptionFunction, ot as InternalModuleFormat, p as AsyncPluginHooks, pt as RolldownMagicString, q as PluginContext, qt as SourceMap, r as defineConfig, rt as RolldownDirectoryEntry, s as InputOption, st as NormalizedOutputOptions, t as ConfigExport, tt as ModuleTypeFilter, u as OptimizationOptions, ut as ChecksOptions, v as LoadResult, vt as WatchOptions, w as Plugin, wt as AdvancedChunksGroup, x as ObjectHook, xt as BuildOptions, y as ModuleOptions, yt as rolldown, z as OutputBundle } from "./shared/define-config-BSxBeCq6.mjs";
4
+ export { AddonFunction, AdvancedChunksGroup, AdvancedChunksOptions, AsyncPluginHooks, BufferEncoding, BuildOptions, BundleError, ChecksOptions, ChunkFileNamesFunction, ChunkingContext, CodeSplittingGroup, CodeSplittingNameFunction, CodeSplittingOptions, CommentsOptions, ConfigExport, CustomPluginOptions, DefineParallelPluginResult, EmittedAsset, EmittedChunk, EmittedFile, EmittedPrebuiltChunk, ExistingRawSourceMap, ExternalOption, ExternalOptionFunction, FunctionPluginHooks, GeneralHookFilter, GeneratedCodeOptions, GeneratedCodePreset, GetModuleInfo, GlobalsFunction, HookFilter, HookFilterExtension, ImportKind, InputOption, InputOptions, InternalModuleFormat, LoadResult, LogLevel, LogLevelOption, LogOrStringHandler, LoggingFunction, MinifyOptions, MinimalPluginContext, ModuleFormat, ModuleInfo, ModuleOptions, ModuleType, ModuleTypeFilter, ModuleTypes, NormalizedInputOptions, NormalizedOutputOptions, ObjectHook, OptimizationOptions, OutputAsset, OutputBundle, OutputChunk, OutputOptions, ParallelPluginHooks, PartialNull, PartialResolvedId, Plugin, PluginContext, PluginContextMeta, PluginContextResolveOptions, PreRenderedAsset, PreRenderedChunk, RUNTIME_MODULE_ID, RenderedChunk, RenderedModule, ResolveIdExtraOptions, ResolveIdResult, ResolvedId, RolldownBuild, RolldownDirectoryEntry, RolldownError, RolldownError as RollupError, RolldownFileStats, RolldownFsModule, RolldownLog, RolldownLog as RollupLog, RolldownLogWithString, RolldownLogWithString as RollupLogWithString, RolldownMagicString, RolldownOptions, RolldownOptionsFunction, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatcher, RolldownWatcherEvent, RolldownWatcherWatcherEventMap, SourceDescription, SourceMap, SourceMapInput, SourcemapIgnoreListOption, TransformOptions, TransformPluginContext, TransformResult, TreeshakingOptions, VERSION, WarningHandlerWithDefault, WatchOptions, WatcherFileWatcherOptions, WatcherOptions, build, defineConfig, rolldown, watch };
package/dist/index.mjs CHANGED
@@ -1,13 +1,9 @@
1
- import { n as __toESM, t as require_binding } from "./shared/binding-tNJoEqAa.mjs";
2
- import { n as onExit, t as watch } from "./shared/watch-HmN4U4B9.mjs";
3
- import "./shared/normalize-string-or-regex-DeB7vQ75.mjs";
4
- import { S as VERSION } from "./shared/bindingify-input-options-CfhrNd_y.mjs";
5
- import "./shared/rolldown-build-DWeKtJOy.mjs";
6
- import "./shared/parse-ast-index-BcP4Ts_P.mjs";
7
- import { t as rolldown } from "./shared/rolldown-BMzJcmQ7.mjs";
8
- import { t as defineConfig } from "./shared/define-config-BVG4QvnP.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-D_jQsHun.mjs";
2
+ import { n as onExit, t as watch } from "./shared/watch-C2am0Ahc.mjs";
3
+ import { a as RolldownMagicString, b as RUNTIME_MODULE_ID, x as VERSION } from "./shared/bindingify-input-options-DfXGy4QO.mjs";
4
+ import { t as rolldown } from "./shared/rolldown-C0o3hS3w.mjs";
5
+ import { t as defineConfig } from "./shared/define-config-DJOr6Iwt.mjs";
9
6
  import { isMainThread } from "node:worker_threads";
10
-
11
7
  //#region src/setup.ts
12
8
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
13
9
  if (isMainThread) {
@@ -16,7 +12,6 @@ if (isMainThread) {
16
12
  subscriberGuard?.close();
17
13
  });
18
14
  }
19
-
20
15
  //#endregion
21
16
  //#region src/api/build.ts
22
17
  /**
@@ -51,7 +46,5 @@ async function build(options) {
51
46
  }
52
47
  }
53
48
  }
54
-
55
49
  //#endregion
56
- var BindingMagicString = import_binding.BindingMagicString;
57
- export { BindingMagicString, VERSION, build, defineConfig, rolldown, watch };
50
+ export { RUNTIME_MODULE_ID, RolldownMagicString, VERSION, build, defineConfig, rolldown, watch };
@@ -1,9 +1,6 @@
1
- import { n as __toESM, t as require_binding } from "./shared/binding-tNJoEqAa.mjs";
2
- import "./shared/normalize-string-or-regex-DeB7vQ75.mjs";
3
- import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-CfhrNd_y.mjs";
4
- import "./shared/parse-ast-index-BcP4Ts_P.mjs";
1
+ import { n as __toESM, t as require_binding } from "./shared/binding-D_jQsHun.mjs";
2
+ import { n as PluginContextData, r as bindingifyPlugin } from "./shared/bindingify-input-options-DfXGy4QO.mjs";
5
3
  import { parentPort, workerData } from "node:worker_threads";
6
-
7
4
  //#region src/parallel-plugin-worker.ts
8
5
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
9
6
  const { registryId, pluginInfos, threadNumber } = workerData;
@@ -14,7 +11,7 @@ const { registryId, pluginInfos, threadNumber } = workerData;
14
11
  const plugin = await definePluginImpl(pluginInfo.options, { threadNumber });
15
12
  return {
16
13
  index: pluginInfo.index,
17
- plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, []), [], () => {}, "info", false)
14
+ plugin: bindingifyPlugin(plugin, {}, {}, new PluginContextData(() => {}, {}, [], []), [], () => {}, "info", false)
18
15
  };
19
16
  })));
20
17
  parentPort.postMessage({ type: "success" });
@@ -27,6 +24,5 @@ const { registryId, pluginInfos, threadNumber } = workerData;
27
24
  parentPort.unref();
28
25
  }
29
26
  })();
30
-
31
27
  //#endregion
32
- export { };
28
+ export {};
@@ -1,12 +1,11 @@
1
- import "./shared/binding-B92Lq__Q.mjs";
2
- import { C as Plugin, Pt as MaybePromise } from "./shared/define-config-D8xP5iyL.mjs";
1
+ import { w as Plugin, zt as MaybePromise } from "./shared/define-config-BSxBeCq6.mjs";
3
2
 
4
3
  //#region src/plugin/parallel-plugin-implementation.d.ts
5
4
  type ParallelPluginImplementation = Plugin;
6
5
  type Context = {
7
6
  /**
8
- * Thread number
9
- */
7
+ * Thread number
8
+ */
10
9
  threadNumber: number;
11
10
  };
12
11
  declare function defineParallelPluginImplementation<Options>(plugin: (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>): (Options: Options, context: Context) => MaybePromise<ParallelPluginImplementation>;
@@ -2,6 +2,5 @@
2
2
  function defineParallelPluginImplementation(plugin) {
3
3
  return plugin;
4
4
  }
5
-
6
5
  //#endregion
7
- export { defineParallelPluginImplementation };
6
+ export { defineParallelPluginImplementation };
@@ -1,8 +1,32 @@
1
- import { M as ParseResult, N as ParserOptions } from "./shared/binding-B92Lq__Q.mjs";
1
+ import { B as ParserOptions$1, z as ParseResult$1 } from "./shared/binding-hSQGgsUz.mjs";
2
2
  import { Program } from "@oxc-project/types";
3
3
 
4
4
  //#region src/parse-ast-index.d.ts
5
+ /**
6
+ * @hidden
7
+ */
8
+ type ParseResult = ParseResult$1;
9
+ /**
10
+ * @hidden
11
+ */
12
+ type ParserOptions = ParserOptions$1;
13
+ /**
14
+ * Parse code synchronously and return the AST.
15
+ *
16
+ * This function is similar to Rollup's `parseAst` function.
17
+ * Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
18
+ *
19
+ * @category Utilities
20
+ */
5
21
  declare function parseAst(sourceText: string, options?: ParserOptions | null, filename?: string): Program;
22
+ /**
23
+ * Parse code asynchronously and return the AST.
24
+ *
25
+ * This function is similar to Rollup's `parseAstAsync` function.
26
+ * Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
27
+ *
28
+ * @category Utilities
29
+ */
6
30
  declare function parseAstAsync(sourceText: string, options?: ParserOptions | null, filename?: string): Promise<Program>;
7
31
  //#endregion
8
- export { type ParseResult, type ParserOptions, parseAst, parseAstAsync };
32
+ export { ParseResult, ParserOptions, parseAst, parseAstAsync };
@@ -1,4 +1,60 @@
1
- import "./shared/binding-tNJoEqAa.mjs";
2
- import { n as parseAstAsync, t as parseAst } from "./shared/parse-ast-index-BcP4Ts_P.mjs";
3
-
4
- export { parseAst, parseAstAsync };
1
+ import { l as locate, n as error, s as logParseError, t as augmentCodeLocation, u as getCodeFrame } from "./shared/logs-D80CXhvg.mjs";
2
+ import { n as parseSync, t as parse } from "./shared/parse-iQx2ihYn.mjs";
3
+ //#region src/parse-ast-index.ts
4
+ function wrap(result, filename, sourceText) {
5
+ if (result.errors.length > 0) return normalizeParseError(filename, sourceText, result.errors);
6
+ return result.program;
7
+ }
8
+ function normalizeParseError(filename, sourceText, errors) {
9
+ let message = `Parse failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
10
+ const pos = errors[0]?.labels?.[0]?.start;
11
+ for (let i = 0; i < errors.length; i++) {
12
+ if (i >= 5) {
13
+ message += "\n...";
14
+ break;
15
+ }
16
+ const e = errors[i];
17
+ message += e.message + "\n" + e.labels.map((label) => {
18
+ const location = locate(sourceText, label.start, { offsetLine: 1 });
19
+ if (!location) return;
20
+ return getCodeFrame(sourceText, location.line, location.column);
21
+ }).filter(Boolean).join("\n");
22
+ }
23
+ const log = logParseError(message, filename, pos);
24
+ if (pos !== void 0 && filename) augmentCodeLocation(log, pos, sourceText, filename);
25
+ return error(log);
26
+ }
27
+ const defaultParserOptions = {
28
+ lang: "js",
29
+ preserveParens: false
30
+ };
31
+ /**
32
+ * Parse code synchronously and return the AST.
33
+ *
34
+ * This function is similar to Rollup's `parseAst` function.
35
+ * Prefer using {@linkcode parseSync} instead of this function as it has more information in the return value.
36
+ *
37
+ * @category Utilities
38
+ */
39
+ function parseAst(sourceText, options, filename) {
40
+ return wrap(parseSync(filename ?? "file.js", sourceText, {
41
+ ...defaultParserOptions,
42
+ ...options
43
+ }), filename, sourceText);
44
+ }
45
+ /**
46
+ * Parse code asynchronously and return the AST.
47
+ *
48
+ * This function is similar to Rollup's `parseAstAsync` function.
49
+ * Prefer using {@linkcode parseAsync} instead of this function as it has more information in the return value.
50
+ *
51
+ * @category Utilities
52
+ */
53
+ async function parseAstAsync(sourceText, options, filename) {
54
+ return wrap(await parse(filename ?? "file.js", sourceText, {
55
+ ...defaultParserOptions,
56
+ ...options
57
+ }), filename, sourceText);
58
+ }
59
+ //#endregion
60
+ export { parseAst, parseAstAsync };
@@ -1,13 +1,13 @@
1
- import { d as BindingReplacePluginConfig } from "./shared/binding-B92Lq__Q.mjs";
2
- import { M as BuiltinPlugin } from "./shared/define-config-D8xP5iyL.mjs";
3
- import { t as esmExternalRequirePlugin } from "./shared/constructors--k1uxZrh.mjs";
1
+ import { m as BindingReplacePluginConfig } from "./shared/binding-hSQGgsUz.mjs";
2
+ import { N as BuiltinPlugin } from "./shared/define-config-BSxBeCq6.mjs";
3
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-DMl58KN5.mjs";
4
4
 
5
5
  //#region src/builtin-plugin/replace-plugin.d.ts
6
6
  /**
7
7
  * Replaces targeted strings in files while bundling.
8
8
  *
9
9
  * @example
10
- * // Basic usage
10
+ * **Basic usage**
11
11
  * ```js
12
12
  * replacePlugin({
13
13
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -15,7 +15,7 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors--k1uxZrh.mj
15
15
  * })
16
16
  * ```
17
17
  * @example
18
- * // With options
18
+ * **With options**
19
19
  * ```js
20
20
  * replacePlugin({
21
21
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -24,6 +24,9 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors--k1uxZrh.mj
24
24
  * preventAssignment: false,
25
25
  * })
26
26
  * ```
27
+ *
28
+ * @see https://rolldown.rs/builtin-plugins/replace
29
+ * @category Builtin Plugins
27
30
  */
28
31
  declare function replacePlugin(values?: BindingReplacePluginConfig["values"], options?: Omit<BindingReplacePluginConfig, "values">): BuiltinPlugin;
29
32
  //#endregion
@@ -1,13 +1,11 @@
1
- import "./shared/binding-tNJoEqAa.mjs";
2
- import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-DeB7vQ75.mjs";
3
- import { t as esmExternalRequirePlugin } from "./shared/constructors-414MPkgB.mjs";
4
-
1
+ import { a as makeBuiltinPluginCallable, n as BuiltinPlugin } from "./shared/normalize-string-or-regex-B8PEhdn1.mjs";
2
+ import { t as esmExternalRequirePlugin } from "./shared/constructors-B-HbV10G.mjs";
5
3
  //#region src/builtin-plugin/replace-plugin.ts
6
4
  /**
7
5
  * Replaces targeted strings in files while bundling.
8
6
  *
9
7
  * @example
10
- * // Basic usage
8
+ * **Basic usage**
11
9
  * ```js
12
10
  * replacePlugin({
13
11
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -15,7 +13,7 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors-414MPkgB.mj
15
13
  * })
16
14
  * ```
17
15
  * @example
18
- * // With options
16
+ * **With options**
19
17
  * ```js
20
18
  * replacePlugin({
21
19
  * 'process.env.NODE_ENV': JSON.stringify('production'),
@@ -24,6 +22,9 @@ import { t as esmExternalRequirePlugin } from "./shared/constructors-414MPkgB.mj
24
22
  * preventAssignment: false,
25
23
  * })
26
24
  * ```
25
+ *
26
+ * @see https://rolldown.rs/builtin-plugins/replace
27
+ * @category Builtin Plugins
27
28
  */
28
29
  function replacePlugin(values = {}, options = {}) {
29
30
  Object.keys(values).forEach((key) => {
@@ -35,6 +36,5 @@ function replacePlugin(values = {}, options = {}) {
35
36
  values
36
37
  }));
37
38
  }
38
-
39
39
  //#endregion
40
- export { esmExternalRequirePlugin, replacePlugin };
40
+ export { esmExternalRequirePlugin, replacePlugin };