@rollipop/rolldown 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 (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-MvMgR80I.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-DhxvofsC.mjs} +127 -167
  24. package/dist/shared/{constructors-414MPkgB.mjs → constructors-BEqS3i54.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-DcChL8nQ.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-tB5qAWuR.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-Dq9aIZE5.mjs} +22 -17
  35. package/dist/shared/parse-Cn5AzDgI.mjs +74 -0
  36. package/dist/shared/{prompt-tlfjalEt.mjs → prompt-BYQIwEjg.mjs} +4 -6
  37. package/dist/shared/resolve-tsconfig-QSpuHPL1.mjs +113 -0
  38. package/dist/shared/{rolldown-BMzJcmQ7.mjs → rolldown-6yZY58Dc.mjs} +2 -4
  39. package/dist/shared/rolldown-build-C10b1v8L.mjs +3326 -0
  40. package/dist/shared/transform-DY2pi3Qm.d.mts +149 -0
  41. package/dist/shared/{watch-HmN4U4B9.mjs → watch-D9PzJrio.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
@@ -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,85 @@
1
+ import { t as require_binding } from "./binding-MvMgR80I.mjs";
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
+ require_binding();
17
+ function unwrapBindingResult(container) {
18
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) throw aggregateBindingErrorsIntoJsError(container.errors);
19
+ return container;
20
+ }
21
+ function normalizeBindingResult(container) {
22
+ if (typeof container === "object" && container !== null && "isBindingErrors" in container && container.isBindingErrors) return aggregateBindingErrorsIntoJsError(container.errors);
23
+ return container;
24
+ }
25
+ function normalizeBindingError(e) {
26
+ return e.type === "JsError" ? e.field0 : Object.assign(/* @__PURE__ */ new Error(), {
27
+ code: e.field0.kind,
28
+ kind: e.field0.kind,
29
+ message: e.field0.message,
30
+ id: e.field0.id,
31
+ exporter: e.field0.exporter,
32
+ loc: e.field0.loc,
33
+ pos: e.field0.pos,
34
+ stack: void 0
35
+ });
36
+ }
37
+ function aggregateBindingErrorsIntoJsError(rawErrors) {
38
+ const errors = rawErrors.map(normalizeBindingError);
39
+ let summary = `Build failed with ${errors.length} error${errors.length < 2 ? "" : "s"}:\n`;
40
+ for (let i = 0; i < errors.length; i++) {
41
+ summary += "\n";
42
+ if (i >= 5) {
43
+ summary += "...";
44
+ break;
45
+ }
46
+ summary += getErrorMessage(errors[i]);
47
+ }
48
+ const wrapper = new Error(summary);
49
+ Object.defineProperty(wrapper, "errors", {
50
+ configurable: true,
51
+ enumerable: true,
52
+ get: () => errors,
53
+ set: (value) => Object.defineProperty(wrapper, "errors", {
54
+ configurable: true,
55
+ enumerable: true,
56
+ value
57
+ })
58
+ });
59
+ return wrapper;
60
+ }
61
+ function getErrorMessage(e) {
62
+ if (Object.hasOwn(e, "kind")) return e.message;
63
+ let s = "";
64
+ if (e.plugin) s += `[plugin ${e.plugin}]`;
65
+ const id = e.id ?? e.loc?.file;
66
+ if (id) {
67
+ s += " " + id;
68
+ if (e.loc) s += `:${e.loc.line}:${e.loc.column}`;
69
+ }
70
+ if (s) s += "\n";
71
+ const message = `${e.name ?? "Error"}: ${e.message}`;
72
+ s += message;
73
+ if (e.frame) s = joinNewLine(s, e.frame);
74
+ if (e.stack) s = joinNewLine(s, e.stack.replace(message, ""));
75
+ if (e.cause) {
76
+ s = joinNewLine(s, "Caused by:");
77
+ s = joinNewLine(s, getErrorMessage(e.cause).split("\n").map((line) => " " + line).join("\n"));
78
+ }
79
+ return s;
80
+ }
81
+ function joinNewLine(s1, s2) {
82
+ return s1.replace(/\n+$/, "") + "\n" + s2.replace(/^\n+/, "");
83
+ }
84
+ //#endregion
85
+ 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-BMzJcmQ7.mjs";
1
+ import { t as rolldown } from "./rolldown-6yZY58Dc.mjs";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { readdir } from "node:fs/promises";
5
- import { pathToFileURL } from "node:url";
6
5
  import { cwd } from "node:process";
7
-
6
+ import { pathToFileURL } from "node:url";
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 };
@@ -17,6 +17,5 @@ function unsupported(info) {
17
17
  throw new Error(`UNSUPPORTED: ${info}`);
18
18
  }
19
19
  function noop(..._args) {}
20
-
21
20
  //#endregion
22
- export { unreachable as a, unimplemented as i, isPromiseLike as n, unsupported as o, noop as r, arraify as t };
21
+ export { unreachable as a, unimplemented as i, isPromiseLike as n, unsupported as o, noop as r, arraify as t };
@@ -1,6 +1,5 @@
1
- import { n as __toESM, t as require_binding } from "./binding-tNJoEqAa.mjs";
2
- import { c as logPluginError, n as error } from "./logs-NH298mHo.mjs";
3
-
1
+ import { n as __toESM, t as require_binding } from "./binding-MvMgR80I.mjs";
2
+ import { c as logPluginError, n as error } from "./logs-D80CXhvg.mjs";
4
3
  //#region src/builtin-plugin/utils.ts
5
4
  var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
6
5
  var BuiltinPlugin = class {
@@ -14,17 +13,25 @@ var BuiltinPlugin = class {
14
13
  function makeBuiltinPluginCallable(plugin) {
15
14
  let callablePlugin = new import_binding.BindingCallableBuiltinPlugin(bindingifyBuiltInPlugin(plugin));
16
15
  const wrappedPlugin = plugin;
17
- for (const key in callablePlugin) wrappedPlugin[key] = async function(...args) {
18
- try {
19
- return await callablePlugin[key](...args);
20
- } catch (e) {
21
- if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
22
- return error(logPluginError(e, plugin.name, {
23
- hook: key,
24
- id: key === "transform" ? args[2] : void 0
25
- }));
26
- }
27
- };
16
+ for (const key in callablePlugin) {
17
+ const wrappedHook = async function(...args) {
18
+ try {
19
+ return await callablePlugin[key](...args);
20
+ } catch (e) {
21
+ if (e instanceof Error && !e.stack?.includes("at ")) Error.captureStackTrace(e, wrappedPlugin[key]);
22
+ return error(logPluginError(e, plugin.name, {
23
+ hook: key,
24
+ id: key === "transform" ? args[2] : void 0
25
+ }));
26
+ }
27
+ };
28
+ const order = callablePlugin.getOrder(key);
29
+ if (order == void 0) wrappedPlugin[key] = wrappedHook;
30
+ else wrappedPlugin[key] = {
31
+ handler: wrappedHook,
32
+ order
33
+ };
34
+ }
28
35
  return wrappedPlugin;
29
36
  }
30
37
  function bindingifyBuiltInPlugin(plugin) {
@@ -45,7 +52,6 @@ function bindingifyManifestPlugin(plugin, pluginContextData) {
45
52
  }
46
53
  };
47
54
  }
48
-
49
55
  //#endregion
50
56
  //#region src/utils/normalize-string-or-regex.ts
51
57
  function normalizedStringOrRegex(pattern) {
@@ -56,6 +62,5 @@ function normalizedStringOrRegex(pattern) {
56
62
  function isReadonlyArray(input) {
57
63
  return Array.isArray(input);
58
64
  }
59
-
60
65
  //#endregion
61
- export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
66
+ export { makeBuiltinPluginCallable as a, bindingifyManifestPlugin as i, BuiltinPlugin as n, bindingifyBuiltInPlugin as r, normalizedStringOrRegex as t };
@@ -0,0 +1,74 @@
1
+ import { n as __toESM, t as require_binding } from "./binding-MvMgR80I.mjs";
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
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
40
+ /**
41
+ * Parse JS/TS source asynchronously on a separate thread.
42
+ *
43
+ * Note that not all of the workload can happen on a separate thread.
44
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
45
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
46
+ * the asynchronous parsing by a factor of between 3 and 20.
47
+ *
48
+ * i.e. the majority of the workload cannot be parallelized by using this method.
49
+ *
50
+ * Generally {@linkcode parseSync} is preferable to use as it does not have the overhead of spawning a thread.
51
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
52
+ *
53
+ * @category Utilities
54
+ */
55
+ async function parse(filename, sourceText, options) {
56
+ return wrap(await (0, import_binding.parse)(filename, sourceText, options));
57
+ }
58
+ /**
59
+ * Parse JS/TS source synchronously on current thread.
60
+ *
61
+ * This is generally preferable over {@linkcode parse} (async) as it does not have the overhead
62
+ * of spawning a thread, and the majority of the workload cannot be parallelized anyway
63
+ * (see {@linkcode parse} documentation for details).
64
+ *
65
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads
66
+ * with {@linkcode parseSync} rather than using {@linkcode parse}.
67
+ *
68
+ * @category Utilities
69
+ */
70
+ function parseSync(filename, sourceText, options) {
71
+ return wrap((0, import_binding.parseSync)(filename, sourceText, options));
72
+ }
73
+ //#endregion
74
+ export { parseSync as n, parse 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,113 @@
1
+ import { n as __toESM, t as require_binding } from "./binding-MvMgR80I.mjs";
2
+ import { a as bindingifySourcemap, n as normalizeBindingError } from "./error-DcChL8nQ.mjs";
3
+ //#region src/utils/minify.ts
4
+ var import_binding = /* @__PURE__ */ __toESM(require_binding(), 1);
5
+ /**
6
+ * Minify asynchronously.
7
+ *
8
+ * Note: This function can be slower than {@linkcode minifySync} due to the overhead of spawning a thread.
9
+ *
10
+ * @category Utilities
11
+ * @experimental
12
+ */
13
+ async function minify(filename, sourceText, options) {
14
+ const inputMap = bindingifySourcemap(options?.inputMap);
15
+ const result = await (0, import_binding.minify)(filename, sourceText, options);
16
+ if (result.map && inputMap) result.map = {
17
+ version: 3,
18
+ ...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
19
+ };
20
+ return result;
21
+ }
22
+ /**
23
+ * Minify synchronously.
24
+ *
25
+ * @category Utilities
26
+ * @experimental
27
+ */
28
+ function minifySync(filename, sourceText, options) {
29
+ const inputMap = bindingifySourcemap(options?.inputMap);
30
+ const result = (0, import_binding.minifySync)(filename, sourceText, options);
31
+ if (result.map && inputMap) result.map = {
32
+ version: 3,
33
+ ...(0, import_binding.collapseSourcemaps)([inputMap, bindingifySourcemap(result.map)])
34
+ };
35
+ return result;
36
+ }
37
+ //#endregion
38
+ //#region src/utils/transform.ts
39
+ const yarnPnp$1 = typeof process === "object" && !!process.versions?.pnp;
40
+ /**
41
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version, asynchronously.
42
+ *
43
+ * Note: This function can be slower than `transformSync` due to the overhead of spawning a thread.
44
+ *
45
+ * @param filename The name of the file being transformed. If this is a
46
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
47
+ * @param sourceText The source code to transform.
48
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
49
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
50
+ * Only used when `options.tsconfig` is `true`.
51
+ *
52
+ * @returns a promise that resolves to an object containing the transformed code,
53
+ * source maps, and any errors that occurred during parsing or transformation.
54
+ *
55
+ * @category Utilities
56
+ * @experimental
57
+ */
58
+ async function transform(filename, sourceText, options, cache) {
59
+ const result = await (0, import_binding.enhancedTransform)(filename, sourceText, options, cache, yarnPnp$1);
60
+ return {
61
+ ...result,
62
+ errors: result.errors.map(normalizeBindingError),
63
+ warnings: result.warnings.map((w) => w.field0)
64
+ };
65
+ }
66
+ /**
67
+ * Transpile a JavaScript or TypeScript into a target ECMAScript version.
68
+ *
69
+ * @param filename The name of the file being transformed. If this is a
70
+ * relative path, consider setting the {@linkcode TransformOptions#cwd} option.
71
+ * @param sourceText The source code to transform.
72
+ * @param options The transform options including tsconfig and inputMap. See {@linkcode TransformOptions} for more information.
73
+ * @param cache Optional tsconfig cache for reusing resolved tsconfig across multiple transforms.
74
+ * Only used when `options.tsconfig` is `true`.
75
+ *
76
+ * @returns an object containing the transformed code, source maps, and any errors
77
+ * that occurred during parsing or transformation.
78
+ *
79
+ * @category Utilities
80
+ * @experimental
81
+ */
82
+ function transformSync(filename, sourceText, options, cache) {
83
+ const result = (0, import_binding.enhancedTransformSync)(filename, sourceText, options, cache, yarnPnp$1);
84
+ return {
85
+ ...result,
86
+ errors: result.errors.map(normalizeBindingError),
87
+ warnings: result.warnings.map((w) => w.field0)
88
+ };
89
+ }
90
+ //#endregion
91
+ //#region src/utils/resolve-tsconfig.ts
92
+ const yarnPnp = typeof process === "object" && !!process.versions?.pnp;
93
+ /**
94
+ * Cache for tsconfig resolution to avoid redundant file system operations.
95
+ *
96
+ * The cache stores resolved tsconfig configurations keyed by their file paths.
97
+ * When transforming multiple files in the same project, tsconfig lookups are
98
+ * deduplicated, improving performance.
99
+ *
100
+ * @category Utilities
101
+ * @experimental
102
+ */
103
+ var TsconfigCache = class extends import_binding.TsconfigCache {
104
+ constructor() {
105
+ super(yarnPnp);
106
+ }
107
+ };
108
+ /** @hidden This is only expected to be used by Vite */
109
+ function resolveTsconfig(filename, cache) {
110
+ return (0, import_binding.resolveTsconfig)(filename, cache, yarnPnp);
111
+ }
112
+ //#endregion
113
+ export { minify as a, transformSync as i, resolveTsconfig as n, minifySync as o, transform as r, TsconfigCache as t };
@@ -1,5 +1,4 @@
1
- import { l as PluginDriver, s as validateOption, t as RolldownBuild } from "./rolldown-build-DWeKtJOy.mjs";
2
-
1
+ import { c as validateOption, t as RolldownBuild, u as PluginDriver } from "./rolldown-build-C10b1v8L.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 };