@rolldown/browser 1.0.0-rc.1 → 1.0.0-rc.11

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 (59) hide show
  1. package/dist/cli.mjs +705 -1101
  2. package/dist/config.d.mts +9 -4
  3. package/dist/config.mjs +4 -13
  4. package/dist/{shared/constructors-BTW-c3jX.mjs → constructors-LtcP0f-6.js} +14 -7
  5. package/dist/error-nyELQq9T.js +157 -0
  6. package/dist/experimental-index.browser.mjs +74 -15
  7. package/dist/experimental-index.d.mts +128 -56
  8. package/dist/experimental-index.mjs +76 -17
  9. package/dist/filter-index.d.mts +1 -1
  10. package/dist/filter-index.mjs +25 -6
  11. package/dist/get-log-filter.d.mts +3 -7
  12. package/dist/get-log-filter.mjs +23 -3
  13. package/dist/index.browser.mjs +70 -75
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.mjs +6 -12
  16. package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-Db8ibFkp.js} +25 -23
  17. package/dist/parallel-plugin-worker.mjs +3 -7
  18. package/dist/parallel-plugin.d.mts +4 -4
  19. package/dist/parallel-plugin.mjs +1 -2
  20. package/dist/parse-ast-index.d.mts +27 -3
  21. package/dist/parse-ast-index.mjs +60 -3
  22. package/dist/plugins-index.browser.mjs +8 -7
  23. package/dist/plugins-index.d.mts +7 -4
  24. package/dist/plugins-index.mjs +8 -7
  25. package/dist/resolve-tsconfig-CkWJwi9L.js +112 -0
  26. package/dist/rolldown-binding.wasi-browser.js +6 -1
  27. package/dist/rolldown-binding.wasi.cjs +6 -1
  28. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  29. package/dist/{rolldown-build-C4tDS_XC.js → rolldown-build-BPQtF2AA.js} +1063 -745
  30. package/dist/shared/{bindingify-input-options-Bp2kpiI8.mjs → bindingify-input-options-CSSx7s5e.mjs} +124 -165
  31. package/dist/shared/{composable-filters-CIxSuZSM.mjs → composable-filters-B2ByPP8y.mjs} +1 -4
  32. package/dist/{constructors-B8gqcrFr.js → shared/constructors-BGLoUvKR.mjs} +14 -7
  33. package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-BVnf_fH1.d.mts} +13 -4
  34. package/dist/shared/define-config-Cr6054d_.d.mts +3869 -0
  35. package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  36. package/dist/shared/error-CQ6njWsV.mjs +86 -0
  37. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  38. package/dist/shared/{load-config-BBZgIUGN.mjs → load-config-CXtSVabV.mjs} +11 -5
  39. package/dist/shared/{logging-Nvu645a7.d.mts → logging-C6h4g8dA.d.mts} +6 -6
  40. package/dist/shared/{logs-B2CASPcx.mjs → logs-D80CXhvg.mjs} +6 -9
  41. package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-D0o84ejN.mjs} +21 -16
  42. package/dist/shared/parse-B_jvq8dU.mjs +73 -0
  43. package/dist/shared/{prompt-B6NrDD1-.mjs → prompt-BYQIwEjg.mjs} +4 -6
  44. package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
  45. package/dist/shared/{rolldown-C0_W0QdY.mjs → rolldown-D-bh1N9N.mjs} +2 -4
  46. package/dist/shared/rolldown-build-Bysdmf-9.mjs +3320 -0
  47. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  48. package/dist/shared/{types-CIYK49jr.d.mts → types-K2r0mx6Y.d.mts} +11 -9
  49. package/dist/shared/{watch-eIop0yN6.mjs → watch-V9eI6ua1.mjs} +71 -76
  50. package/dist/utils-index.browser.mjs +2414 -0
  51. package/dist/utils-index.d.mts +1673 -0
  52. package/dist/utils-index.mjs +2414 -0
  53. package/package.json +1 -1
  54. package/dist/cli-setup.d.mts +0 -1
  55. package/dist/cli-setup.mjs +0 -16
  56. package/dist/shared/define-config-CDlEOpr1.d.mts +0 -3531
  57. package/dist/shared/parse-ast-index-2ahkCVK6.mjs +0 -98
  58. package/dist/shared/rolldown-build-DLuUhuNw.mjs +0 -2368
  59. /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-6wxe_LMG.d.mts} +0 -0
@@ -2,6 +2,5 @@
2
2
  function defineConfig(config) {
3
3
  return config;
4
4
  }
5
-
6
5
  //#endregion
7
- export { defineConfig as t };
6
+ export { defineConfig as t };
@@ -0,0 +1,86 @@
1
+ import "../rolldown-binding.wasi.cjs";
2
+ //#region src/types/sourcemap.ts
3
+ function bindingifySourcemap(map) {
4
+ if (map == null) return;
5
+ return { inner: typeof map === "string" ? map : {
6
+ file: map.file ?? void 0,
7
+ mappings: map.mappings,
8
+ sourceRoot: "sourceRoot" in map ? map.sourceRoot ?? void 0 : void 0,
9
+ sources: map.sources?.map((s) => s ?? void 0),
10
+ sourcesContent: map.sourcesContent?.map((s) => s ?? void 0),
11
+ names: map.names,
12
+ x_google_ignoreList: map.x_google_ignoreList,
13
+ debugId: "debugId" in map ? map.debugId : void 0
14
+ } };
15
+ }
16
+ //#endregion
17
+ //#region src/utils/error.ts
18
+ function unwrapBindingResult(container) {
19
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
20
+ return container;
21
+ }
22
+ function normalizeBindingResult(container) {
23
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
24
+ return container;
25
+ }
26
+ function normalizeBindingError(e) {
27
+ return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
28
+ code: e.field0.kind,
29
+ kind: e.field0.kind,
30
+ message: e.field0.message,
31
+ id: e.field0.id,
32
+ exporter: e.field0.exporter,
33
+ loc: e.field0.loc,
34
+ pos: e.field0.pos,
35
+ stack: void 0
36
+ });
37
+ }
38
+ function aggregateBindingErrorsIntoJsError(rawErrors) {
39
+ const errors = rawErrors.map(normalizeBindingError);
40
+ let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
41
+ for (let i = 0; i < errors.length; i++) {
42
+ summary += "\n";
43
+ if (i >= 5) {
44
+ summary += "...";
45
+ break;
46
+ }
47
+ summary += getErrorMessage(errors[i]);
48
+ }
49
+ const wrapper = new Error(summary);
50
+ Object.defineProperty(wrapper, "errors", {
51
+ configurable: true,
52
+ enumerable: true,
53
+ get: () => errors,
54
+ set: (value) => Object.defineProperty(wrapper, "errors", {
55
+ configurable: true,
56
+ enumerable: true,
57
+ value
58
+ })
59
+ });
60
+ return wrapper;
61
+ }
62
+ function getErrorMessage(e) {
63
+ if (Object.hasOwn(e, "kind")) return e.message;
64
+ let s = "";
65
+ if (e.plugin) s += `[plugin ${e.plugin}]`;
66
+ const id = e.id ?? e.loc?.file;
67
+ if (id) {
68
+ s += " " + id;
69
+ if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
70
+ }
71
+ if (s) s += "\n";
72
+ const message = `${e.name ?? "Error"}: ${e.message}`;
73
+ s += message;
74
+ if (e.frame) s = joinNewLine(s, e.frame);
75
+ if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
76
+ if (e.cause) {
77
+ s = joinNewLine(s, "Caused by:");
78
+ s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
79
+ }
80
+ return s;
81
+ }
82
+ function joinNewLine(s1, s2) {
83
+ return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
84
+ }
85
+ //#endregion
86
+ export { bindingifySourcemap as a, unwrapBindingResult as i, normalizeBindingError as n, normalizeBindingResult as r, aggregateBindingErrorsIntoJsError as t };
@@ -0,0 +1,35 @@
1
+ import { a as RolldownLog } from "./logging-C6h4g8dA.mjs";
2
+
3
+ //#region src/get-log-filter.d.ts
4
+ /**
5
+ * @param filters A list of log filters to apply
6
+ * @returns A function that tests whether a log should be output
7
+ *
8
+ * @category Config
9
+ */
10
+ type GetLogFilter = (filters: string[]) => (log: RolldownLog) => boolean;
11
+ /**
12
+ * A helper function to generate log filters using the same syntax as the CLI.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { defineConfig } from 'rolldown';
17
+ * import { getLogFilter } from 'rolldown/getLogFilter';
18
+ *
19
+ * const logFilter = getLogFilter(['code:FOO', 'code:BAR']);
20
+ *
21
+ * export default defineConfig({
22
+ * input: 'main.js',
23
+ * onLog(level, log, handler) {
24
+ * if (logFilter(log)) {
25
+ * handler(level, log);
26
+ * }
27
+ * }
28
+ * });
29
+ * ```
30
+ *
31
+ * @category Config
32
+ */
33
+ declare const getLogFilter: GetLogFilter;
34
+ //#endregion
35
+ export { getLogFilter as n, GetLogFilter as t };
@@ -1,10 +1,9 @@
1
- import { t as rolldown } from "./rolldown-C0_W0QdY.mjs";
1
+ import { t as rolldown } from "./rolldown-D-bh1N9N.mjs";
2
2
  import path from "node:path";
3
3
  import { readdir } from "node:fs/promises";
4
- import { pathToFileURL } from "node:url";
5
4
  import { cwd } from "node:process";
5
+ import { pathToFileURL } from "node:url";
6
6
  import fs from "node:fs";
7
-
8
7
  //#region src/utils/load-config.ts
9
8
  async function bundleTsConfig(configFile, isEsm) {
10
9
  const dirnameVarName = "injected_original_dirname";
@@ -99,6 +98,14 @@ function tryStatSync(file) {
99
98
  return fs.statSync(file, { throwIfNoEntry: false });
100
99
  } catch {}
101
100
  }
101
+ /**
102
+ * Load config from a file in a way that Rolldown does.
103
+ *
104
+ * @param configPath The path to the config file. If empty, it will look for `rolldown.config` with supported extensions in the current working directory.
105
+ * @returns The loaded config export
106
+ *
107
+ * @category Config
108
+ */
102
109
  async function loadConfig(configPath) {
103
110
  const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
104
111
  try {
@@ -109,6 +116,5 @@ async function loadConfig(configPath) {
109
116
  throw new Error("Error happened while loading config.", { cause: err });
110
117
  }
111
118
  }
112
-
113
119
  //#endregion
114
- export { loadConfig as t };
120
+ export { loadConfig as t };
@@ -9,9 +9,9 @@ interface RolldownLog {
9
9
  binding?: string;
10
10
  cause?: unknown;
11
11
  /**
12
- * The log code for this log object.
13
- * @example 'PLUGIN_ERROR'
14
- */
12
+ * The log code for this log object.
13
+ * @example 'PLUGIN_ERROR'
14
+ */
15
15
  code?: string;
16
16
  exporter?: string;
17
17
  frame?: string;
@@ -24,9 +24,9 @@ interface RolldownLog {
24
24
  line: number;
25
25
  };
26
26
  /**
27
- * The message for this log object.
28
- * @example 'The "transform" hook used by the output plugin "rolldown-plugin-foo" is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.'
29
- */
27
+ * The message for this log object.
28
+ * @example 'The "transform" hook used by the output plugin "rolldown-plugin-foo" is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.'
29
+ */
30
30
  message: string;
31
31
  meta?: any;
32
32
  names?: string[];
@@ -35,7 +35,6 @@ function getCodeFrame(source, line, column) {
35
35
  return `${lineNumber}: ${displayedLine}`;
36
36
  }).join("\n");
37
37
  }
38
-
39
38
  //#endregion
40
39
  //#region src/log/locate-character/index.js
41
40
  /** @typedef {import('./types').Location} Location */
@@ -96,10 +95,9 @@ function getLocator(source, options = {}) {
96
95
  function locate(source, search, options) {
97
96
  return getLocator(source, options)(search, options && options.startIndex);
98
97
  }
99
-
100
98
  //#endregion
101
99
  //#region src/log/logs.ts
102
- const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLY_NOTIFY_OPTION = "MULTIPLY_NOTIFY_OPTION", PARSE_ERROR = "PARSE_ERROR", NO_FS_IN_BROWSER = "NO_FS_IN_BROWSER";
100
+ const INVALID_LOG_POSITION = "INVALID_LOG_POSITION", PLUGIN_ERROR = "PLUGIN_ERROR", INPUT_HOOK_IN_OUTPUT_PLUGIN = "INPUT_HOOK_IN_OUTPUT_PLUGIN", CYCLE_LOADING = "CYCLE_LOADING", MULTIPLE_WATCHER_OPTION = "MULTIPLE_WATCHER_OPTION", PARSE_ERROR = "PARSE_ERROR";
103
101
  function logParseError(message, id, pos) {
104
102
  return {
105
103
  code: PARSE_ERROR,
@@ -126,10 +124,10 @@ function logCycleLoading(pluginName, moduleId) {
126
124
  message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
127
125
  };
128
126
  }
129
- function logMultiplyNotifyOption() {
127
+ function logMultipleWatcherOption() {
130
128
  return {
131
- code: MULTIPLY_NOTIFY_OPTION,
132
- message: `Found multiply notify option at watch options, using first one to start notify watcher.`
129
+ code: MULTIPLE_WATCHER_OPTION,
130
+ message: `Found multiple watcher options at watch options, using first one to start watcher.`
133
131
  };
134
132
  }
135
133
  function logPluginError(error, plugin, { hook, id } = {}) {
@@ -148,7 +146,7 @@ function error(base) {
148
146
  if (!(base instanceof Error)) {
149
147
  base = Object.assign(new Error(base.message), base);
150
148
  Object.defineProperty(base, "name", {
151
- value: "RollupError",
149
+ value: "RolldownError",
152
150
  writable: true
153
151
  });
154
152
  }
@@ -178,6 +176,5 @@ function augmentCodeLocation(properties, pos, source, id) {
178
176
  properties.frame = getCodeFrame(source, line, column);
179
177
  }
180
178
  }
181
-
182
179
  //#endregion
183
- export { logInvalidLogPosition as a, logPluginError as c, logInputHookInOutputPlugin as i, locate as l, error as n, logMultiplyNotifyOption as o, logCycleLoading as r, logParseError as s, augmentCodeLocation as t, getCodeFrame as u };
180
+ export { logInvalidLogPosition as a, logPluginError as c, logInputHookInOutputPlugin as i, locate as l, error as n, logMultipleWatcherOption as o, logCycleLoading as r, logParseError as s, augmentCodeLocation as t, getCodeFrame as u };
@@ -1,6 +1,5 @@
1
- import { c as logPluginError, n as error } from "./logs-B2CASPcx.mjs";
1
+ import { c as logPluginError, n as error } from "./logs-D80CXhvg.mjs";
2
2
  import { BindingCallableBuiltinPlugin } from "../rolldown-binding.wasi.cjs";
3
-
4
3
  //#region src/builtin-plugin/utils.ts
5
4
  var BuiltinPlugin = class {
6
5
  /** Vite-specific option to control plugin ordering */
@@ -13,17 +12,25 @@ var BuiltinPlugin = class {
13
12
  function makeBuiltinPluginCallable(plugin) {
14
13
  let callablePlugin = new BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
15
14
  const wrappedPlugin = plugin;
16
- for (const key in callablePlugin) wrappedPlugin[key] = async function(...args) {
17
- try {
18
- return await callablePlugin[key](...args);
19
- } catch (e) {
20
- if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
21
- return error(logPluginError(e, plugin.name, {
22
- hook: key,
23
- id: key === "transform" ? args[2] : void 0
24
- }));
25
- }
26
- };
15
+ for (const key in callablePlugin) {
16
+ const wrappedHook = async function(...args) {
17
+ try {
18
+ return await callablePlugin[key](...args);
19
+ } catch (e) {
20
+ if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
21
+ return error(logPluginError(e, plugin.name, {
22
+ hook: key,
23
+ id: key === "transform" ? args[2] : void 0
24
+ }));
25
+ }
26
+ };
27
+ const order = callablePlugin.getOrder(key);
28
+ if (order == void 0) wrappedPlugin[key] = wrappedHook;
29
+ else wrappedPlugin[key] = {
30
+ handler: wrappedHook,
31
+ order
32
+ };
33
+ }
27
34
  return wrappedPlugin;
28
35
  }
29
36
  function bindingifyBuiltInPlugin(plugin) {
@@ -44,7 +51,6 @@ function bindingifyManifestPlugin(plugin, pluginContextData) {
44
51
  }
45
52
  };
46
53
  }
47
-
48
54
  //#endregion
49
55
  //#region src/utils/normalize-string-or-regex.ts
50
56
  function normalizedStringOrRegex(pattern) {
@@ -55,6 +61,5 @@ function normalizedStringOrRegex(pattern) {
55
61
  function isReadonlyArray(input) {
56
62
  return Array.isArray(input);
57
63
  }
58
-
59
64
  //#endregion
60
- export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
65
+ export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
@@ -0,0 +1,73 @@
1
+ import { parse, parseSync } from "../rolldown-binding.wasi.cjs";
2
+ //#region ../../node_modules/.pnpm/oxc-parser@0.121.0/node_modules/oxc-parser/src-js/wrap.js
3
+ function wrap(result) {
4
+ let program, module, comments, errors;
5
+ return {
6
+ get program() {
7
+ if (!program) program = jsonParseAst(result.program);
8
+ return program;
9
+ },
10
+ get module() {
11
+ if (!module) module = result.module;
12
+ return module;
13
+ },
14
+ get comments() {
15
+ if (!comments) comments = result.comments;
16
+ return comments;
17
+ },
18
+ get errors() {
19
+ if (!errors) errors = result.errors;
20
+ return errors;
21
+ }
22
+ };
23
+ }
24
+ function jsonParseAst(programJson) {
25
+ const { node: program, fixes } = JSON.parse(programJson);
26
+ for (const fixPath of fixes) applyFix(program, fixPath);
27
+ return program;
28
+ }
29
+ function applyFix(program, fixPath) {
30
+ let node = program;
31
+ for (const key of fixPath) node = node[key];
32
+ if (node.bigint) node.value = BigInt(node.bigint);
33
+ else try {
34
+ node.value = RegExp(node.regex.pattern, node.regex.flags);
35
+ } catch {}
36
+ }
37
+ //#endregion
38
+ //#region src/utils/parse.ts
39
+ /**
40
+ * Parse JS/TS source asynchronously on a separate thread.
41
+ *
42
+ * Note that not all of the workload can happen on a separate thread.
43
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
44
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
45
+ * the asynchronous parsing by a factor of between 3 and 20.
46
+ *
47
+ * i.e. the majority of the workload cannot be parallelized by using this method.
48
+ *
49
+ * Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
50
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
51
+ *
52
+ * @category Utilities
53
+ */
54
+ async function parse$1(filename, sourceText, options) {
55
+ return wrap(await parse(filename, sourceText, options));
56
+ }
57
+ /**
58
+ * Parse JS/TS source synchronously on current thread.
59
+ *
60
+ * This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
61
+ * of spawning a thread, and the majority of the workload cannot be parallelized anyway
62
+ * (see {@linkcode parse} documentation for details).
63
+ *
64
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads
65
+ * with {@linkcode parseSync} rather than using {@linkcode parse}.
66
+ *
67
+ * @category Utilities
68
+ */
69
+ function parseSync$1(filename, sourceText, options) {
70
+ return wrap(parseSync(filename, sourceText, options));
71
+ }
72
+ //#endregion
73
+ export { parseSync$1 as n, parse$1 as t };
@@ -1,7 +1,6 @@
1
1
  import process$1, { stdin, stdout } from "node:process";
2
2
  import { WriteStream } from "node:tty";
3
- import f$1 from "node:readline";
4
-
3
+ import f from "node:readline";
5
4
  //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/chunks/prompt.mjs
6
5
  function getDefaultExportFromCjs(x) {
7
6
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -481,13 +480,13 @@ var x = class {
481
480
  const e = new WriteStream(0);
482
481
  e._write = (s, i, D) => {
483
482
  this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
484
- }, this.input.pipe(e), this.rl = f$1.createInterface({
483
+ }, this.input.pipe(e), this.rl = f.createInterface({
485
484
  input: this.input,
486
485
  output: e,
487
486
  tabSize: 2,
488
487
  prompt: "",
489
488
  escapeCodeTimeout: 50
490
- }), f$1.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
489
+ }), f.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== void 0 && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), d$1(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
491
490
  this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(this.value);
492
491
  }), this.once("cancel", () => {
493
492
  this.output.write(srcExports.cursor.show), this.output.off("resize", this.render), d$1(this.input, false), u(S);
@@ -842,6 +841,5 @@ async function prompt(message, opts = {}) {
842
841
  }).then(handleCancel);
843
842
  throw new Error(`Unknown prompt type: ${opts.type}`);
844
843
  }
845
-
846
844
  //#endregion
847
- export { prompt };
845
+ export { prompt };
@@ -0,0 +1,112 @@
1
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-CQ6njWsV.mjs";
2
+ import { TsconfigCache, collapseSourcemaps, enhancedTransform, enhancedTransformSync, minify, minifySync, resolveTsconfig } from "../rolldown-binding.wasi.cjs";
3
+ //#region src/utils/minify.ts
4
+ /**
5
+ * Minify asynchronously.
6
+ *
7
+ * Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
8
+ *
9
+ * @category Utilities
10
+ * @experimental
11
+ */
12
+ async function minify$1(filename, sourceText, options) {
13
+ const inputMap = bindingifySourcemap(options?.inputMap);
14
+ const result = await minify(filename, sourceText, options);
15
+ if (result.map && inputMap) result.map = {
16
+ version: 3,
17
+ ...collapseSourcemaps([inputMap, bindingifySourcemap(result.map)])
18
+ };
19
+ return result;
20
+ }
21
+ /**
22
+ * Minify synchronously.
23
+ *
24
+ * @category Utilities
25
+ * @experimental
26
+ */
27
+ function minifySync$1(filename, sourceText, options) {
28
+ const inputMap = bindingifySourcemap(options?.inputMap);
29
+ const result = minifySync(filename, sourceText, options);
30
+ if (result.map && inputMap) result.map = {
31
+ version: 3,
32
+ ...collapseSourcemaps([inputMap, bindingifySourcemap(result.map)])
33
+ };
34
+ return result;
35
+ }
36
+ //#endregion
37
+ //#region src/utils/transform.ts
38
+ const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
39
+ /**
40
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
41
+ *
42
+ * Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
43
+ *
44
+ * @param filename The name of the file being transformed. If this is a
45
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
46
+ * @param sourceText The source code to transform.
47
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
48
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
49
+ * Only used when `options.tsconfig` is `true`.
50
+ *
51
+ * @returns a promise that resolves to an object containing the transformed code,
52
+ * source maps, and any errors that occurred during parsing or transformation.
53
+ *
54
+ * @category Utilities
55
+ * @experimental
56
+ */
57
+ async function transform(filename, sourceText, options, cache) {
58
+ const result = await enhancedTransform(filename, sourceText, options, cache, yarnPnp$1);
59
+ return {
60
+ ...result,
61
+ errors: result.errors.map(normalizeBindingError),
62
+ warnings: result.warnings.map((w) => w.field0)
63
+ };
64
+ }
65
+ /**
66
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
67
+ *
68
+ * @param filename The name of the file being transformed. If this is a
69
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
70
+ * @param sourceText The source code to transform.
71
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
72
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
73
+ * Only used when `options.tsconfig` is `true`.
74
+ *
75
+ * @returns an object containing the transformed code, source maps, and any errors
76
+ * that occurred during parsing or transformation.
77
+ *
78
+ * @category Utilities
79
+ * @experimental
80
+ */
81
+ function transformSync(filename, sourceText, options, cache) {
82
+ const result = enhancedTransformSync(filename, sourceText, options, cache, yarnPnp$1);
83
+ return {
84
+ ...result,
85
+ errors: result.errors.map(normalizeBindingError),
86
+ warnings: result.warnings.map((w) => w.field0)
87
+ };
88
+ }
89
+ //#endregion
90
+ //#region src/utils/resolve-tsconfig.ts
91
+ const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
92
+ /**
93
+ * Cache for tsconfig resolution to avoid redundant file system operations.
94
+ *
95
+ * The cache stores resolved tsconfig configurations keyed by their file paths.
96
+ * When transforming multiple files in the same project, tsconfig lookups are
97
+ * deduplicated, improving performance.
98
+ *
99
+ * @category Utilities
100
+ * @experimental
101
+ */
102
+ var TsconfigCache$1 = class extends TsconfigCache {
103
+ constructor() {
104
+ super(yarnPnp);
105
+ }
106
+ };
107
+ /** @hidden This is only expected to be used by Vite */
108
+ function resolveTsconfig$1(filename, cache) {
109
+ return resolveTsconfig(filename, cache, yarnPnp);
110
+ }
111
+ //#endregion
112
+ export { minify$1 as a, transformSync as i, resolveTsconfig$1 as n, minifySync$1 as o, transform as r, TsconfigCache$1 as t };
@@ -1,5 +1,4 @@
1
- import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-DLuUhuNw.mjs";
2
-
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-Bysdmf-9.mjs";
3
2
  //#region src/api/rolldown/index.ts
4
3
  /**
5
4
  * The API compatible with Rollup's `rollup` function.
@@ -37,6 +36,5 @@ const rolldown = async (input) => {
37
36
  validateOption("input", input);
38
37
  return new RolldownBuild(await PluginDriver.callOptionsHook(input));
39
38
  };
40
-
41
39
  //#endregion
42
- export { rolldown as t };
40
+ export { rolldown as t };