rolldown 1.0.0-beta.7-commit.51b53fd → 1.0.0-beta.7-commit.25f3c61

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 (52) hide show
  1. package/bin/cli.js +1 -1
  2. package/dist/cjs/cli.cjs +457 -457
  3. package/dist/cjs/experimental-index.cjs +24 -24
  4. package/dist/cjs/index.cjs +2 -2
  5. package/dist/cjs/parallel-plugin-worker.cjs +2 -2
  6. package/dist/cjs/parse-ast-index.cjs +1 -1
  7. package/dist/esm/cli.mjs +457 -457
  8. package/dist/esm/experimental-index.mjs +24 -24
  9. package/dist/esm/index.mjs +2 -2
  10. package/dist/esm/parallel-plugin-worker.mjs +2 -2
  11. package/dist/esm/parse-ast-index.mjs +1 -1
  12. package/dist/shared/{parse-ast-index-DbQWN9pL.cjs → parse-ast-index-0ei4fTjl.cjs} +253 -252
  13. package/dist/shared/{parse-ast-index-B-UemHTj.mjs → parse-ast-index-DNOUVcBy.mjs} +253 -252
  14. package/dist/shared/{src-eC0JqPTa.cjs → src-BPcsb-4N.cjs} +464 -464
  15. package/dist/shared/{src-DJ0d0UY6.mjs → src-DllTyFDp.mjs} +464 -464
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/dist/types/binding.d.ts +5 -1
  18. package/dist/types/builtin-plugin/constructors.d.ts +1 -1
  19. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -1
  20. package/dist/types/cli/arguments/index.d.ts +1 -1
  21. package/dist/types/cli/arguments/normalize.d.ts +5 -1
  22. package/dist/types/experimental-index.d.ts +5 -5
  23. package/dist/types/index.d.ts +23 -23
  24. package/dist/types/log/logger.d.ts +2 -2
  25. package/dist/types/options/generated/checks-options.d.ts +11 -11
  26. package/dist/types/options/input-options.d.ts +4 -4
  27. package/dist/types/options/normalized-input-options.d.ts +2 -2
  28. package/dist/types/options/normalized-output-options.d.ts +1 -1
  29. package/dist/types/options/output-options.d.ts +2 -2
  30. package/dist/types/parallel-plugin.d.ts +1 -1
  31. package/dist/types/plugin/bindingify-build-hooks.d.ts +1 -1
  32. package/dist/types/plugin/bindingify-hook-filter.d.ts +2 -2
  33. package/dist/types/plugin/bindingify-output-hooks.d.ts +2 -2
  34. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +1 -1
  35. package/dist/types/plugin/bindingify-plugin.d.ts +3 -3
  36. package/dist/types/plugin/bindingify-watch-hooks.d.ts +1 -1
  37. package/dist/types/plugin/hook-filter.d.ts +1 -1
  38. package/dist/types/plugin/index.d.ts +15 -16
  39. package/dist/types/plugin/plugin-context-data.d.ts +2 -2
  40. package/dist/types/plugin/plugin-context.d.ts +7 -7
  41. package/dist/types/plugin/plugin-driver.d.ts +2 -2
  42. package/dist/types/plugin/transform-plugin-context.d.ts +4 -4
  43. package/dist/types/types/rolldown-output.d.ts +1 -1
  44. package/dist/types/utils/bindingify-input-options.d.ts +3 -3
  45. package/dist/types/utils/create-bundler-option.d.ts +1 -1
  46. package/dist/types/utils/define-config.d.ts +1 -1
  47. package/dist/types/utils/initialize-parallel-plugins.d.ts +1 -1
  48. package/dist/types/utils/normalize-hook.d.ts +1 -1
  49. package/dist/types/utils/normalize-plugin-option.d.ts +1 -1
  50. package/dist/types/utils/transform-module-info.d.ts +2 -2
  51. package/dist/types/utils/transform-to-rollup-output.d.ts +2 -2
  52. package/package.json +25 -26
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "module";
2
- import { env } from "node:process";
3
2
  import * as tty from "tty";
3
+ import { env } from "node:process";
4
4
 
5
5
  //#region rolldown:runtime
6
6
  var __create = Object.create;
@@ -28,256 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  }) : target, mod));
29
29
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
30
 
31
- //#endregion
32
- //#region src/utils/code-frame.ts
33
- function spaces(index) {
34
- let result = "";
35
- while (index--) result += " ";
36
- return result;
37
- }
38
- function tabsToSpaces(value) {
39
- return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
40
- }
41
- const LINE_TRUNCATE_LENGTH = 120;
42
- const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
43
- const ELLIPSIS = "...";
44
- function getCodeFrame(source, line, column) {
45
- let lines = source.split("\n");
46
- if (line > lines.length) return "";
47
- const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
48
- const frameStart = Math.max(0, line - 3);
49
- let frameEnd = Math.min(line + 2, lines.length);
50
- lines = lines.slice(frameStart, frameEnd);
51
- while (!/\S/.test(lines[lines.length - 1])) {
52
- lines.pop();
53
- frameEnd -= 1;
54
- }
55
- const digits = String(frameEnd).length;
56
- return lines.map((sourceLine, index) => {
57
- const isErrorLine = frameStart + index + 1 === line;
58
- let lineNumber = String(index + frameStart + 1);
59
- while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
60
- let displayedLine = tabsToSpaces(sourceLine);
61
- if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
62
- if (isErrorLine) {
63
- const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
64
- return `${lineNumber}: ${displayedLine}\n${indicator}`;
65
- }
66
- return `${lineNumber}: ${displayedLine}`;
67
- }).join("\n");
68
- }
69
-
70
- //#endregion
71
- //#region src/log/locate-character/index.js
72
- /** @typedef {import('./types').Location} Location */
73
- /**
74
- * @param {import('./types').Range} range
75
- * @param {number} index
76
- */
77
- function rangeContains(range, index) {
78
- return range.start <= index && index < range.end;
79
- }
80
- function getLocator(source, options = {}) {
81
- const { offsetLine = 0, offsetColumn = 0 } = options;
82
- let start = 0;
83
- const ranges = source.split("\n").map((line, i$1) => {
84
- const end = start + line.length + 1;
85
- /** @type {import('./types').Range} */
86
- const range = {
87
- start,
88
- end,
89
- line: i$1
90
- };
91
- start = end;
92
- return range;
93
- });
94
- let i = 0;
95
- /**
96
- * @param {string | number} search
97
- * @param {number} [index]
98
- * @returns {Location | undefined}
99
- */
100
- function locator(search, index) {
101
- if (typeof search === "string") search = source.indexOf(search, index ?? 0);
102
- if (search === -1) return void 0;
103
- let range = ranges[i];
104
- const d = search >= range.end ? 1 : -1;
105
- while (range) {
106
- if (rangeContains(range, search)) return {
107
- line: offsetLine + range.line,
108
- column: offsetColumn + search - range.start,
109
- character: search
110
- };
111
- i += d;
112
- range = ranges[i];
113
- }
114
- }
115
- return locator;
116
- }
117
- function locate(source, search, options) {
118
- return getLocator(source, options)(search, options && options.startIndex);
119
- }
120
-
121
- //#endregion
122
- //#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
123
- const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
124
- const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
125
- const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
126
- const isWindows = platform === "win32";
127
- const isDumbTerminal = env$1.TERM === "dumb";
128
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
129
- const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
130
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
131
- const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
132
- const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
133
- const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
134
- const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
135
- const colors$1 = {
136
- reset: init(0, 0),
137
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
138
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
139
- italic: init(3, 23),
140
- underline: init(4, 24),
141
- inverse: init(7, 27),
142
- hidden: init(8, 28),
143
- strikethrough: init(9, 29),
144
- black: init(30, 39),
145
- red: init(31, 39),
146
- green: init(32, 39),
147
- yellow: init(33, 39),
148
- blue: init(34, 39),
149
- magenta: init(35, 39),
150
- cyan: init(36, 39),
151
- white: init(37, 39),
152
- gray: init(90, 39),
153
- bgBlack: init(40, 49),
154
- bgRed: init(41, 49),
155
- bgGreen: init(42, 49),
156
- bgYellow: init(43, 49),
157
- bgBlue: init(44, 49),
158
- bgMagenta: init(45, 49),
159
- bgCyan: init(46, 49),
160
- bgWhite: init(47, 49),
161
- blackBright: init(90, 39),
162
- redBright: init(91, 39),
163
- greenBright: init(92, 39),
164
- yellowBright: init(93, 39),
165
- blueBright: init(94, 39),
166
- magentaBright: init(95, 39),
167
- cyanBright: init(96, 39),
168
- whiteBright: init(97, 39),
169
- bgBlackBright: init(100, 49),
170
- bgRedBright: init(101, 49),
171
- bgGreenBright: init(102, 49),
172
- bgYellowBright: init(103, 49),
173
- bgBlueBright: init(104, 49),
174
- bgMagentaBright: init(105, 49),
175
- bgCyanBright: init(106, 49),
176
- bgWhiteBright: init(107, 49)
177
- };
178
- const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
179
- ...colors$2,
180
- [key]: String
181
- }), {});
182
- const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
183
-
184
- //#endregion
185
- //#region src/cli/colors.ts
186
- const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: env.FORCE_COLOR !== "0" && !env.NO_COLOR });
187
- const colors = {
188
- bold,
189
- cyan,
190
- dim,
191
- gray,
192
- green,
193
- red,
194
- underline,
195
- yellow
196
- };
197
-
198
- //#endregion
199
- //#region src/log/logs.ts
200
- 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", MINIFY_WARNING = "MINIFY_WARNING", PARSE_ERROR = "PARSE_ERROR";
201
- function logParseError(message) {
202
- return {
203
- code: PARSE_ERROR,
204
- message
205
- };
206
- }
207
- function logMinifyWarning() {
208
- return {
209
- code: MINIFY_WARNING,
210
- message: colors.yellow("The built-in minifier is still under development. Setting \"minify: true\" is not recommended for production use.")
211
- };
212
- }
213
- function logInvalidLogPosition(pluginName) {
214
- return {
215
- code: INVALID_LOG_POSITION,
216
- message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
217
- };
218
- }
219
- function logInputHookInOutputPlugin(pluginName, hookName) {
220
- return {
221
- code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
222
- message: `The "${hookName}" hook used by the output plugin ${pluginName} 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.`
223
- };
224
- }
225
- function logCycleLoading(pluginName, moduleId) {
226
- return {
227
- code: CYCLE_LOADING,
228
- message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
229
- };
230
- }
231
- function logMultiplyNotifyOption() {
232
- return {
233
- code: MULTIPLY_NOTIFY_OPTION,
234
- message: `Found multiply notify option at watch options, using first one to start notify watcher.`
235
- };
236
- }
237
- function logPluginError(error$1, plugin, { hook, id } = {}) {
238
- const code = error$1.code;
239
- if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
240
- error$1.code = PLUGIN_ERROR;
241
- error$1.plugin = plugin;
242
- if (hook) error$1.hook = hook;
243
- if (id) error$1.id = id;
244
- return error$1;
245
- }
246
- function error(base) {
247
- if (!(base instanceof Error)) {
248
- base = Object.assign(new Error(base.message), base);
249
- Object.defineProperty(base, "name", {
250
- value: "RollupError",
251
- writable: true
252
- });
253
- }
254
- throw base;
255
- }
256
- function augmentCodeLocation(properties, pos, source, id) {
257
- if (typeof pos === "object") {
258
- const { line, column } = pos;
259
- properties.loc = {
260
- column,
261
- file: id,
262
- line
263
- };
264
- } else {
265
- properties.pos = pos;
266
- const location = locate(source, pos, { offsetLine: 1 });
267
- if (!location) return;
268
- const { line, column } = location;
269
- properties.loc = {
270
- column,
271
- file: id,
272
- line
273
- };
274
- }
275
- if (properties.frame === void 0) {
276
- const { line, column } = properties.loc;
277
- properties.frame = getCodeFrame(source, line, column);
278
- }
279
- }
280
-
281
31
  //#endregion
282
32
  //#region src/webcontainer-fallback.js
283
33
  var require_webcontainer_fallback = __commonJS({ "src/webcontainer-fallback.js"(exports, module) {
@@ -612,6 +362,7 @@ var require_binding = __commonJS({ "src/binding.js"(exports, module) {
612
362
  module.exports.BindingOutputs = nativeBinding.BindingOutputs;
613
363
  module.exports.BindingPluginContext = nativeBinding.BindingPluginContext;
614
364
  module.exports.BindingRenderedChunk = nativeBinding.BindingRenderedChunk;
365
+ module.exports.BindingRenderedChunkMeta = nativeBinding.BindingRenderedChunkMeta;
615
366
  module.exports.BindingRenderedModule = nativeBinding.BindingRenderedModule;
616
367
  module.exports.BindingTransformPluginContext = nativeBinding.BindingTransformPluginContext;
617
368
  module.exports.BindingWatcher = nativeBinding.BindingWatcher;
@@ -645,7 +396,257 @@ var require_binding = __commonJS({ "src/binding.js"(exports, module) {
645
396
  var import_binding = __toESM(require_binding());
646
397
 
647
398
  //#endregion
648
- //#region ../../node_modules/.pnpm/oxc-parser@0.61.2/node_modules/oxc-parser/wrap.mjs
399
+ //#region ../../node_modules/.pnpm/colorette@2.0.20/node_modules/colorette/index.js
400
+ const { env: env$1 = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
401
+ const isDisabled = "NO_COLOR" in env$1 || argv.includes("--no-color");
402
+ const isForced = "FORCE_COLOR" in env$1 || argv.includes("--color");
403
+ const isWindows = platform === "win32";
404
+ const isDumbTerminal = env$1.TERM === "dumb";
405
+ const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env$1.TERM && !isDumbTerminal;
406
+ const isCI = "CI" in env$1 && ("GITHUB_ACTIONS" in env$1 || "GITLAB_CI" in env$1 || "CIRCLECI" in env$1);
407
+ const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
408
+ const replaceClose = (index, string, close, replace, head = string.substring(0, index) + replace, tail = string.substring(index + close.length), next = tail.indexOf(close)) => head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
409
+ const clearBleed = (index, string, open, close, replace) => index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
410
+ const filterEmpty = (open, close, replace = open, at = open.length + 1) => (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
411
+ const init = (open, close, replace) => filterEmpty(`\x1b[${open}m`, `\x1b[${close}m`, replace);
412
+ const colors$1 = {
413
+ reset: init(0, 0),
414
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
415
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
416
+ italic: init(3, 23),
417
+ underline: init(4, 24),
418
+ inverse: init(7, 27),
419
+ hidden: init(8, 28),
420
+ strikethrough: init(9, 29),
421
+ black: init(30, 39),
422
+ red: init(31, 39),
423
+ green: init(32, 39),
424
+ yellow: init(33, 39),
425
+ blue: init(34, 39),
426
+ magenta: init(35, 39),
427
+ cyan: init(36, 39),
428
+ white: init(37, 39),
429
+ gray: init(90, 39),
430
+ bgBlack: init(40, 49),
431
+ bgRed: init(41, 49),
432
+ bgGreen: init(42, 49),
433
+ bgYellow: init(43, 49),
434
+ bgBlue: init(44, 49),
435
+ bgMagenta: init(45, 49),
436
+ bgCyan: init(46, 49),
437
+ bgWhite: init(47, 49),
438
+ blackBright: init(90, 39),
439
+ redBright: init(91, 39),
440
+ greenBright: init(92, 39),
441
+ yellowBright: init(93, 39),
442
+ blueBright: init(94, 39),
443
+ magentaBright: init(95, 39),
444
+ cyanBright: init(96, 39),
445
+ whiteBright: init(97, 39),
446
+ bgBlackBright: init(100, 49),
447
+ bgRedBright: init(101, 49),
448
+ bgGreenBright: init(102, 49),
449
+ bgYellowBright: init(103, 49),
450
+ bgBlueBright: init(104, 49),
451
+ bgMagentaBright: init(105, 49),
452
+ bgCyanBright: init(106, 49),
453
+ bgWhiteBright: init(107, 49)
454
+ };
455
+ const createColors = ({ useColor = isColorSupported } = {}) => useColor ? colors$1 : Object.keys(colors$1).reduce((colors$2, key) => ({
456
+ ...colors$2,
457
+ [key]: String
458
+ }), {});
459
+ const { reset, bold: bold$1, dim: dim$1, italic, underline: underline$1, inverse, hidden, strikethrough, black, red: red$1, green: green$1, yellow: yellow$1, blue, magenta, cyan: cyan$1, white, gray: gray$1, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, blackBright, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlackBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = createColors();
460
+
461
+ //#endregion
462
+ //#region src/cli/colors.ts
463
+ const { bold, cyan, dim, gray, green, red, underline, yellow } = createColors({ useColor: env.FORCE_COLOR !== "0" && !env.NO_COLOR });
464
+ const colors = {
465
+ bold,
466
+ cyan,
467
+ dim,
468
+ gray,
469
+ green,
470
+ red,
471
+ underline,
472
+ yellow
473
+ };
474
+
475
+ //#endregion
476
+ //#region src/utils/code-frame.ts
477
+ function spaces(index) {
478
+ let result = "";
479
+ while (index--) result += " ";
480
+ return result;
481
+ }
482
+ function tabsToSpaces(value) {
483
+ return value.replace(/^\t+/, (match) => match.split(" ").join(" "));
484
+ }
485
+ const LINE_TRUNCATE_LENGTH = 120;
486
+ const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
487
+ const ELLIPSIS = "...";
488
+ function getCodeFrame(source, line, column) {
489
+ let lines = source.split("\n");
490
+ if (line > lines.length) return "";
491
+ const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length + MIN_CHARACTERS_SHOWN_AFTER_LOCATION + ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
492
+ const frameStart = Math.max(0, line - 3);
493
+ let frameEnd = Math.min(line + 2, lines.length);
494
+ lines = lines.slice(frameStart, frameEnd);
495
+ while (!/\S/.test(lines[lines.length - 1])) {
496
+ lines.pop();
497
+ frameEnd -= 1;
498
+ }
499
+ const digits = String(frameEnd).length;
500
+ return lines.map((sourceLine, index) => {
501
+ const isErrorLine = frameStart + index + 1 === line;
502
+ let lineNumber = String(index + frameStart + 1);
503
+ while (lineNumber.length < digits) lineNumber = ` ${lineNumber}`;
504
+ let displayedLine = tabsToSpaces(sourceLine);
505
+ if (displayedLine.length > maxLineLength) displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
506
+ if (isErrorLine) {
507
+ const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + "^";
508
+ return `${lineNumber}: ${displayedLine}\n${indicator}`;
509
+ }
510
+ return `${lineNumber}: ${displayedLine}`;
511
+ }).join("\n");
512
+ }
513
+
514
+ //#endregion
515
+ //#region src/log/locate-character/index.js
516
+ /** @typedef {import('./types').Location} Location */
517
+ /**
518
+ * @param {import('./types').Range} range
519
+ * @param {number} index
520
+ */
521
+ function rangeContains(range, index) {
522
+ return range.start <= index && index < range.end;
523
+ }
524
+ function getLocator(source, options = {}) {
525
+ const { offsetLine = 0, offsetColumn = 0 } = options;
526
+ let start = 0;
527
+ const ranges = source.split("\n").map((line, i$1) => {
528
+ const end = start + line.length + 1;
529
+ /** @type {import('./types').Range} */
530
+ const range = {
531
+ start,
532
+ end,
533
+ line: i$1
534
+ };
535
+ start = end;
536
+ return range;
537
+ });
538
+ let i = 0;
539
+ /**
540
+ * @param {string | number} search
541
+ * @param {number} [index]
542
+ * @returns {Location | undefined}
543
+ */
544
+ function locator(search, index) {
545
+ if (typeof search === "string") search = source.indexOf(search, index ?? 0);
546
+ if (search === -1) return void 0;
547
+ let range = ranges[i];
548
+ const d = search >= range.end ? 1 : -1;
549
+ while (range) {
550
+ if (rangeContains(range, search)) return {
551
+ line: offsetLine + range.line,
552
+ column: offsetColumn + search - range.start,
553
+ character: search
554
+ };
555
+ i += d;
556
+ range = ranges[i];
557
+ }
558
+ }
559
+ return locator;
560
+ }
561
+ function locate(source, search, options) {
562
+ return getLocator(source, options)(search, options && options.startIndex);
563
+ }
564
+
565
+ //#endregion
566
+ //#region src/log/logs.ts
567
+ 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", MINIFY_WARNING = "MINIFY_WARNING", PARSE_ERROR = "PARSE_ERROR";
568
+ function logParseError(message) {
569
+ return {
570
+ code: PARSE_ERROR,
571
+ message
572
+ };
573
+ }
574
+ function logMinifyWarning() {
575
+ return {
576
+ code: MINIFY_WARNING,
577
+ message: colors.yellow("The built-in minifier is still under development. Setting \"minify: true\" is not recommended for production use.")
578
+ };
579
+ }
580
+ function logInvalidLogPosition(pluginName) {
581
+ return {
582
+ code: INVALID_LOG_POSITION,
583
+ message: `Plugin "${pluginName}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
584
+ };
585
+ }
586
+ function logInputHookInOutputPlugin(pluginName, hookName) {
587
+ return {
588
+ code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
589
+ message: `The "${hookName}" hook used by the output plugin ${pluginName} 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.`
590
+ };
591
+ }
592
+ function logCycleLoading(pluginName, moduleId) {
593
+ return {
594
+ code: CYCLE_LOADING,
595
+ message: `Found the module "${moduleId}" cycle loading at ${pluginName} plugin, it maybe blocking fetching modules.`
596
+ };
597
+ }
598
+ function logMultiplyNotifyOption() {
599
+ return {
600
+ code: MULTIPLY_NOTIFY_OPTION,
601
+ message: `Found multiply notify option at watch options, using first one to start notify watcher.`
602
+ };
603
+ }
604
+ function logPluginError(error$1, plugin, { hook, id } = {}) {
605
+ const code = error$1.code;
606
+ if (!error$1.pluginCode && code != null && (typeof code !== "string" || !code.startsWith("PLUGIN_"))) error$1.pluginCode = code;
607
+ error$1.code = PLUGIN_ERROR;
608
+ error$1.plugin = plugin;
609
+ if (hook) error$1.hook = hook;
610
+ if (id) error$1.id = id;
611
+ return error$1;
612
+ }
613
+ function error(base) {
614
+ if (!(base instanceof Error)) {
615
+ base = Object.assign(new Error(base.message), base);
616
+ Object.defineProperty(base, "name", {
617
+ value: "RollupError",
618
+ writable: true
619
+ });
620
+ }
621
+ throw base;
622
+ }
623
+ function augmentCodeLocation(properties, pos, source, id) {
624
+ if (typeof pos === "object") {
625
+ const { line, column } = pos;
626
+ properties.loc = {
627
+ column,
628
+ file: id,
629
+ line
630
+ };
631
+ } else {
632
+ properties.pos = pos;
633
+ const location = locate(source, pos, { offsetLine: 1 });
634
+ if (!location) return;
635
+ const { line, column } = location;
636
+ properties.loc = {
637
+ column,
638
+ file: id,
639
+ line
640
+ };
641
+ }
642
+ if (properties.frame === void 0) {
643
+ const { line, column } = properties.loc;
644
+ properties.frame = getCodeFrame(source, line, column);
645
+ }
646
+ }
647
+
648
+ //#endregion
649
+ //#region ../../node_modules/.pnpm/oxc-parser@0.62.0/node_modules/oxc-parser/wrap.mjs
649
650
  function wrap$1(result) {
650
651
  let program, module$1, comments, errors;
651
652
  return {