better-review 0.3.0 → 0.4.0

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 (88) hide show
  1. package/README.md +27 -12
  2. package/dist/cli.js +709 -1315
  3. package/dist/web/assets/highlight.worker-BOqhB448.js +153 -0
  4. package/dist/web/assets/{html-Bv1KyTF7.js → html-B3xvRgDO.js} +1 -1
  5. package/dist/web/assets/html-BHZv6uqE.js +1 -0
  6. package/dist/web/assets/{index-DuH6feCh.js → index--X0HmlXh.js} +4 -3
  7. package/dist/web/assets/{index-rNKORPVq.css → index-CZyRc3NX.css} +1 -1
  8. package/dist/web/assets/{json-B88Oqtu5.js → json-qhed-kSA.js} +1 -1
  9. package/dist/web/assets/{jsx-D3KKoC5L.js → jsx-Bz0zcwM4.js} +1 -1
  10. package/dist/web/assets/{markdown-CboqBxpY.js → markdown-BYOwaDjH.js} +1 -1
  11. package/dist/web/assets/scss-8bKmll0B.js +1 -0
  12. package/dist/web/assets/{tsx-BOvsFOI6.js → tsx-udAQXfEw.js} +1 -1
  13. package/dist/web/assets/{typescript-j_1H8WHN.js → typescript-bsJCZSQ-.js} +1 -1
  14. package/dist/web/index.html +2 -2
  15. package/package.json +1 -1
  16. package/dist/web/assets/astro-BGCLva2-.js +0 -1
  17. package/dist/web/assets/bat-qdxAdBWQ.js +0 -1
  18. package/dist/web/assets/c-Cz4nF6n_.js +0 -1
  19. package/dist/web/assets/c-SSSlmE39.js +0 -1
  20. package/dist/web/assets/clojure-DqKBuwfJ.js +0 -1
  21. package/dist/web/assets/cmake-Bj61d0ZC.js +0 -1
  22. package/dist/web/assets/cpp-DK5F0KO4.js +0 -1
  23. package/dist/web/assets/cpp-pF_afpy8.js +0 -1
  24. package/dist/web/assets/csharp-dmMxLVLW.js +0 -1
  25. package/dist/web/assets/dart-CHZY9Xhz.js +0 -1
  26. package/dist/web/assets/diff-woXpYk--.js +0 -1
  27. package/dist/web/assets/dockerfile-IyjqRm3v.js +0 -1
  28. package/dist/web/assets/dotenv-CuH5my32.js +0 -1
  29. package/dist/web/assets/elixir-DcSoMxCm.js +0 -1
  30. package/dist/web/assets/erlang-59ohNboI.js +0 -1
  31. package/dist/web/assets/fsharp-D2W_zG4w.js +0 -1
  32. package/dist/web/assets/gleam-CSRkHgEL.js +0 -1
  33. package/dist/web/assets/go-rLFTqkRN.js +0 -1
  34. package/dist/web/assets/graphql-BoW1g5X9.js +0 -1
  35. package/dist/web/assets/graphql-C2HCcBds.js +0 -1
  36. package/dist/web/assets/groovy-CacY0gHj.js +0 -1
  37. package/dist/web/assets/haskell-D8IpX4py.js +0 -1
  38. package/dist/web/assets/hcl-Dh228itO.js +0 -1
  39. package/dist/web/assets/highlight.worker-D2jBd466.js +0 -153
  40. package/dist/web/assets/html-DZNlqGBh.js +0 -1
  41. package/dist/web/assets/ini-0B7NLFlx.js +0 -1
  42. package/dist/web/assets/ini-DiZ1IqbV.js +0 -1
  43. package/dist/web/assets/java-BtIQNnN0.js +0 -1
  44. package/dist/web/assets/java-_ATy9zCa.js +0 -1
  45. package/dist/web/assets/json-C3WlssX3.js +0 -1
  46. package/dist/web/assets/json5-BR5RXkoi.js +0 -1
  47. package/dist/web/assets/jsx-C4yDKi0A.js +0 -1
  48. package/dist/web/assets/julia-CBcsyk3j.js +0 -1
  49. package/dist/web/assets/kotlin-DhhofPvG.js +0 -1
  50. package/dist/web/assets/lua-B0e3uOiv.js +0 -1
  51. package/dist/web/assets/lua-pjIdZuk8.js +0 -1
  52. package/dist/web/assets/makefile-Dixweg8N.js +0 -1
  53. package/dist/web/assets/markdown-CjQmuOi1.js +0 -1
  54. package/dist/web/assets/mdx-DQZ5AkYe.js +0 -1
  55. package/dist/web/assets/nginx-DbUAZ-J7.js +0 -1
  56. package/dist/web/assets/nix-Cl_7024t.js +0 -1
  57. package/dist/web/assets/objective-c-D1A_Heim.js +0 -1
  58. package/dist/web/assets/ocaml-O90oeIOV.js +0 -1
  59. package/dist/web/assets/perl-CCy4CjC0.js +0 -1
  60. package/dist/web/assets/php-3goRFXPs.js +0 -1
  61. package/dist/web/assets/postcss-D_Wz94rJ.js +0 -1
  62. package/dist/web/assets/powershell-QtSnmXcu.js +0 -1
  63. package/dist/web/assets/prisma-DMgNhnYS.js +0 -1
  64. package/dist/web/assets/properties-DiZ1IqbV.js +0 -1
  65. package/dist/web/assets/proto-DB4EqR-F.js +0 -1
  66. package/dist/web/assets/python-C5TF47hQ.js +0 -1
  67. package/dist/web/assets/python-CzFU0dpx.js +0 -1
  68. package/dist/web/assets/r-BXEss897.js +0 -1
  69. package/dist/web/assets/r-DWzjseEo.js +0 -1
  70. package/dist/web/assets/ruby-ChLscevq.js +0 -1
  71. package/dist/web/assets/rust-DpiIf5JO.js +0 -1
  72. package/dist/web/assets/scala-BiFt_7mu.js +0 -1
  73. package/dist/web/assets/shellscript-CVTB3cr6.js +0 -1
  74. package/dist/web/assets/shellscript-CqHdAlCp.js +0 -1
  75. package/dist/web/assets/sql-CNu3Or2W.js +0 -1
  76. package/dist/web/assets/sql-CfM2IJm3.js +0 -1
  77. package/dist/web/assets/svelte-Bte6OA2r.js +0 -1
  78. package/dist/web/assets/swift-CyEgAFGc.js +0 -1
  79. package/dist/web/assets/terraform-DswuEJGm.js +0 -1
  80. package/dist/web/assets/toml-CcmNWLt0.js +0 -1
  81. package/dist/web/assets/tsx-CGosfAUg.js +0 -1
  82. package/dist/web/assets/typescript-Bb1J8qyy.js +0 -1
  83. package/dist/web/assets/vue-CcmjViMa.js +0 -1
  84. package/dist/web/assets/xml-Bvlx11yh.js +0 -1
  85. package/dist/web/assets/xml-Byfru430.js +0 -1
  86. package/dist/web/assets/yaml-DDA_XMNu.js +0 -1
  87. package/dist/web/assets/yaml-DijMHRDA.js +0 -1
  88. package/dist/web/assets/zig-CMLA9XwU.js +0 -1
package/dist/cli.js CHANGED
@@ -1782,8 +1782,8 @@ function getStatusCodeFromKey(code) {
1782
1782
  var _JSONRPC2_TO_HTTP_COD;
1783
1783
  return (_JSONRPC2_TO_HTTP_COD = JSONRPC2_TO_HTTP_CODE[code]) !== null && _JSONRPC2_TO_HTTP_COD !== void 0 ? _JSONRPC2_TO_HTTP_COD : 500;
1784
1784
  }
1785
- function getHTTPStatusCode(json3) {
1786
- const httpStatuses = new Set((Array.isArray(json3) ? json3 : [json3]).map((res) => {
1785
+ function getHTTPStatusCode(json4) {
1786
+ const httpStatuses = new Set((Array.isArray(json4) ? json4 : [json4]).map((res) => {
1787
1787
  if ("error" in res && isObject(res.error.data)) {
1788
1788
  var _res$error$data;
1789
1789
  if (typeof ((_res$error$data = res.error.data) === null || _res$error$data === void 0 ? void 0 : _res$error$data["httpStatus"]) === "number") return res.error.data["httpStatus"];
@@ -4226,7 +4226,7 @@ var HonoRequest = class {
4226
4226
  * ```
4227
4227
  */
4228
4228
  json() {
4229
- return this.#cachedBody("text").then((text) => JSON.parse(text));
4229
+ return this.#cachedBody("text").then((text2) => JSON.parse(text2));
4230
4230
  }
4231
4231
  /**
4232
4232
  * `.text()` can parse Request body of type `text/plain`
@@ -4744,8 +4744,8 @@ var Context = class {
4744
4744
  * })
4745
4745
  * ```
4746
4746
  */
4747
- text = (text, arg, headers) => {
4748
- return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text) : this.#newResponse(text, arg, setDefaultContentType(TEXT_PLAIN, headers));
4747
+ text = (text2, arg, headers) => {
4748
+ return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text2) : this.#newResponse(text2, arg, setDefaultContentType(TEXT_PLAIN, headers));
4749
4749
  };
4750
4750
  /**
4751
4751
  * `.json()` can render JSON as `Content-Type:application/json`.
@@ -4762,9 +4762,9 @@ var Context = class {
4762
4762
  json = (object2, arg, headers) => {
4763
4763
  return this.#newResponse(JSON.stringify(object2), arg, setDefaultContentType("application/json", headers));
4764
4764
  };
4765
- html = (html, arg, headers) => {
4766
- const res = (html2) => this.#newResponse(html2, arg, setDefaultContentType("text/html; charset=UTF-8", headers));
4767
- return typeof html === "object" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);
4765
+ html = (html2, arg, headers) => {
4766
+ const res = (html3) => this.#newResponse(html3, arg, setDefaultContentType("text/html; charset=UTF-8", headers));
4767
+ return typeof html2 === "object" ? resolveCallback(html2, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html2);
4768
4768
  };
4769
4769
  /**
4770
4770
  * `.redirect()` can Redirect, default status code is 302.
@@ -5519,12 +5519,12 @@ var Node3 = class Node4 {
5519
5519
  const pattern = getPattern(p, nextP) || (nextP === void 0 && p && p.indexOf("*") === p.length - 1 ? p : null);
5520
5520
  const isParam = Array.isArray(pattern);
5521
5521
  const key = isParam ? pattern[0] : pattern || p;
5522
- const child2 = curNode.#children[key] ||= new Node4();
5523
- if (pattern && !child2.#pattern) {
5524
- child2.#pattern = pattern;
5525
- curNode.#patterns.push(child2);
5522
+ const child = curNode.#children[key] ||= new Node4();
5523
+ if (pattern && !child.#pattern) {
5524
+ child.#pattern = pattern;
5525
+ curNode.#patterns.push(child);
5526
5526
  }
5527
- curNode = child2;
5527
+ curNode = child;
5528
5528
  if (isParam) possibleKeys.add(pattern[1]);
5529
5529
  }
5530
5530
  curNode.#methods.push({ [method]: {
@@ -5569,15 +5569,15 @@ var Node3 = class Node4 {
5569
5569
  this.#pushHandlerSets(handlerSets, nextNode, method, node2.#params);
5570
5570
  } else tempNodes.push(nextNode);
5571
5571
  }
5572
- for (const child2 of node2.#patterns) {
5573
- const pattern = child2.#pattern;
5572
+ for (const child of node2.#patterns) {
5573
+ const pattern = child.#pattern;
5574
5574
  const params = node2.#params === emptyParams ? {} : { ...node2.#params };
5575
5575
  if (typeof pattern === "string") {
5576
5576
  if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
5577
- this.#pushHandlerSets(handlerSets, child2, method, node2.#params);
5577
+ this.#pushHandlerSets(handlerSets, child, method, node2.#params);
5578
5578
  if (pattern === "*") {
5579
- child2.#params = params;
5580
- tempNodes.push(child2);
5579
+ child.#params = params;
5580
+ tempNodes.push(child);
5581
5581
  }
5582
5582
  }
5583
5583
  continue;
@@ -5597,12 +5597,12 @@ var Node3 = class Node4 {
5597
5597
  const m = matcher.exec(restPathString);
5598
5598
  if (m) {
5599
5599
  params[name] = m[0];
5600
- this.#pushHandlerSets(handlerSets, child2, method, node2.#params, params);
5601
- if (m[0].length === restPathString.length && child2.#children["*"]) this.#pushHandlerSets(handlerSets, child2.#children["*"], method, node2.#params, params);
5602
- for (const _ in child2.#children) {
5603
- child2.#params = params;
5600
+ this.#pushHandlerSets(handlerSets, child, method, node2.#params, params);
5601
+ if (m[0].length === restPathString.length && child.#children["*"]) this.#pushHandlerSets(handlerSets, child.#children["*"], method, node2.#params, params);
5602
+ for (const _ in child.#children) {
5603
+ child.#params = params;
5604
5604
  const componentCount = m[0].match(/\//g)?.length ?? 0;
5605
- (curNodesQueue[componentCount] ||= []).push(child2);
5605
+ (curNodesQueue[componentCount] ||= []).push(child);
5606
5606
  break;
5607
5607
  }
5608
5608
  continue;
@@ -5611,11 +5611,11 @@ var Node3 = class Node4 {
5611
5611
  if (matcher === true || matcher.test(part)) {
5612
5612
  params[name] = part;
5613
5613
  if (isLast) {
5614
- this.#pushHandlerSets(handlerSets, child2, method, params, node2.#params);
5615
- if (child2.#children["*"]) this.#pushHandlerSets(handlerSets, child2.#children["*"], method, params, node2.#params);
5614
+ this.#pushHandlerSets(handlerSets, child, method, params, node2.#params);
5615
+ if (child.#children["*"]) this.#pushHandlerSets(handlerSets, child.#children["*"], method, params, node2.#params);
5616
5616
  } else {
5617
- child2.#params = params;
5618
- tempNodes.push(child2);
5617
+ child.#params = params;
5618
+ tempNodes.push(child);
5619
5619
  }
5620
5620
  }
5621
5621
  }
@@ -5742,9 +5742,9 @@ function hashString(input2, seed = 0) {
5742
5742
  }
5743
5743
  var LINE_PREFIX = { context: " ", add: "+", del: "-" };
5744
5744
  function hunkHash(path, lines) {
5745
- let text = path + "\n";
5746
- for (const line of lines) text += LINE_PREFIX[line.type] + line.content + "\n";
5747
- return hashString(text);
5745
+ let text2 = path + "\n";
5746
+ for (const line of lines) text2 += LINE_PREFIX[line.type] + line.content + "\n";
5747
+ return hashString(text2);
5748
5748
  }
5749
5749
  var HUNK_HEADER = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/;
5750
5750
  function unquote(path) {
@@ -5786,9 +5786,9 @@ function pathsFromGitHeader(rest) {
5786
5786
  const idx = rest.indexOf(" b/");
5787
5787
  return idx === -1 ? [rest, rest] : [stripPrefix(rest.slice(0, idx)), stripPrefix(rest.slice(idx + 1))];
5788
5788
  }
5789
- function parseUnifiedDiff(text) {
5789
+ function parseUnifiedDiff(text2) {
5790
5790
  const files = [];
5791
- const lines = text.split("\n");
5791
+ const lines = text2.split("\n");
5792
5792
  let file2 = null;
5793
5793
  let hunk = null;
5794
5794
  let oldNo = 0;
@@ -10982,9 +10982,9 @@ function isRecursive(inst, stack, resolve) {
10982
10982
  return PROVEN;
10983
10983
  stack.add(inst);
10984
10984
  let result = NONE;
10985
- const check2 = (child2) => {
10986
- if (result !== PROVEN && child2?._zod) {
10987
- const answer = isRecursive(child2, stack, resolve);
10985
+ const check2 = (child) => {
10986
+ if (result !== PROVEN && child?._zod) {
10987
+ const answer = isRecursive(child, stack, resolve);
10988
10988
  if (answer > result)
10989
10989
  result = answer;
10990
10990
  }
@@ -10995,9 +10995,9 @@ function isRecursive(inst, stack, resolve) {
10995
10995
  const desc = Object.getOwnPropertyDescriptor(sh, key);
10996
10996
  if (spread && !desc.enumerable)
10997
10997
  continue;
10998
- const child2 = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
10999
- if (child2 > answer)
11000
- answer = child2;
10998
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
10999
+ if (child > answer)
11000
+ answer = child;
11001
11001
  }
11002
11002
  return answer;
11003
11003
  };
@@ -15257,8 +15257,8 @@ function ko_default() {
15257
15257
  }
15258
15258
 
15259
15259
  // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.js
15260
- var capitalizeFirstCharacter = (text) => {
15261
- return text.charAt(0).toUpperCase() + text.slice(1);
15260
+ var capitalizeFirstCharacter = (text2) => {
15261
+ return text2.charAt(0).toUpperCase() + text2.slice(1);
15262
15262
  };
15263
15263
  function getUnitTypeFromNumber(number4) {
15264
15264
  const abs = Math.abs(number4);
@@ -21554,13 +21554,13 @@ function initializeContext(params) {
21554
21554
  external: params?.external ?? void 0
21555
21555
  };
21556
21556
  }
21557
- function handleUnrepresentable(schema, ctx, json3, params, message) {
21557
+ function handleUnrepresentable(schema, ctx, json4, params, message) {
21558
21558
  const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable;
21559
21559
  if (result === "any")
21560
21560
  return false;
21561
21561
  if (result === void 0 || result === "throw")
21562
21562
  throw new Error(message);
21563
- Object.assign(json3, result);
21563
+ Object.assign(json4, result);
21564
21564
  return true;
21565
21565
  }
21566
21566
  function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
@@ -21796,12 +21796,12 @@ function foldObjects(members2) {
21796
21796
  }
21797
21797
  return folded;
21798
21798
  }
21799
- function foldIntersection(json3) {
21800
- const allOf = json3.allOf;
21799
+ function foldIntersection(json4) {
21800
+ const allOf = json4.allOf;
21801
21801
  if (!Array.isArray(allOf) || allOf.length < 2)
21802
21802
  return;
21803
21803
  for (const key of FOLDABLE_KEYS)
21804
- if (key in json3)
21804
+ if (key in json4)
21805
21805
  return;
21806
21806
  const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
21807
21807
  let folded = null;
@@ -21820,8 +21820,8 @@ function foldIntersection(json3) {
21820
21820
  }
21821
21821
  if (!folded)
21822
21822
  return;
21823
- delete json3.allOf;
21824
- assignProps(json3, folded);
21823
+ delete json4.allOf;
21824
+ assignProps(json4, folded);
21825
21825
  }
21826
21826
  function finalize(ctx, schema) {
21827
21827
  const root = ctx.seen.get(schema);
@@ -21903,20 +21903,20 @@ function finalize(ctx, schema) {
21903
21903
  if (ctx.intersections.length) {
21904
21904
  const carriers = /* @__PURE__ */ new Map();
21905
21905
  for (const seen of ctx.seen.values()) {
21906
- for (const json3 of [seen.schema, seen.def]) {
21907
- const allOf = json3?.allOf;
21906
+ for (const json4 of [seen.schema, seen.def]) {
21907
+ const allOf = json4?.allOf;
21908
21908
  if (!Array.isArray(allOf))
21909
21909
  continue;
21910
21910
  const existing = carriers.get(allOf);
21911
21911
  if (existing)
21912
- existing.push(json3);
21912
+ existing.push(json4);
21913
21913
  else
21914
- carriers.set(allOf, [json3]);
21914
+ carriers.set(allOf, [json4]);
21915
21915
  }
21916
21916
  }
21917
21917
  for (const allOf of ctx.intersections) {
21918
- for (const json3 of carriers.get(allOf) ?? [])
21919
- foldIntersection(json3);
21918
+ for (const json4 of carriers.get(allOf) ?? [])
21919
+ foldIntersection(json4);
21920
21920
  }
21921
21921
  }
21922
21922
  }
@@ -22151,29 +22151,29 @@ var exactPatterns = /* @__PURE__ */ new Map([
22151
22151
  ]);
22152
22152
  var exactPattern = (p) => exactPatterns.get(p) ?? p;
22153
22153
  var stringProcessor = (schema, ctx, _json, _params) => {
22154
- const json3 = _json;
22155
- json3.type = "string";
22154
+ const json4 = _json;
22155
+ json4.type = "string";
22156
22156
  const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
22157
22157
  if (typeof minimum === "number")
22158
- json3.minLength = minimum;
22158
+ json4.minLength = minimum;
22159
22159
  if (typeof maximum === "number")
22160
- json3.maxLength = maximum;
22160
+ json4.maxLength = maximum;
22161
22161
  if (format) {
22162
- json3.format = formatMap[format] ?? format;
22163
- if (json3.format === "")
22164
- delete json3.format;
22162
+ json4.format = formatMap[format] ?? format;
22163
+ if (json4.format === "")
22164
+ delete json4.format;
22165
22165
  if (format === "time" || laxFormat) {
22166
- delete json3.format;
22166
+ delete json4.format;
22167
22167
  }
22168
22168
  }
22169
22169
  if (contentEncoding)
22170
- json3.contentEncoding = contentEncoding;
22170
+ json4.contentEncoding = contentEncoding;
22171
22171
  if (patterns && patterns.size > 0) {
22172
22172
  const patternList = [...patterns].map(exactPattern);
22173
22173
  if (patternList.length === 1)
22174
- json3.pattern = patternList[0].source;
22174
+ json4.pattern = patternList[0].source;
22175
22175
  else if (patternList.length > 1) {
22176
- json3.allOf = [
22176
+ json4.allOf = [
22177
22177
  ...patternList.map((regex) => ({
22178
22178
  ...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
22179
22179
  pattern: regex.source
@@ -22183,31 +22183,31 @@ var stringProcessor = (schema, ctx, _json, _params) => {
22183
22183
  }
22184
22184
  };
22185
22185
  var numberProcessor = (schema, ctx, _json, params) => {
22186
- const json3 = _json;
22186
+ const json4 = _json;
22187
22187
  const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
22188
- json3.type = isInt ? "integer" : "number";
22188
+ json4.type = isInt ? "integer" : "number";
22189
22189
  const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
22190
22190
  const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
22191
22191
  const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
22192
22192
  if (exMin) {
22193
22193
  if (legacy) {
22194
- json3.minimum = exclusiveMinimum;
22195
- json3.exclusiveMinimum = true;
22194
+ json4.minimum = exclusiveMinimum;
22195
+ json4.exclusiveMinimum = true;
22196
22196
  } else {
22197
- json3.exclusiveMinimum = exclusiveMinimum;
22197
+ json4.exclusiveMinimum = exclusiveMinimum;
22198
22198
  }
22199
22199
  } else if (typeof minimum === "number") {
22200
- json3.minimum = minimum;
22200
+ json4.minimum = minimum;
22201
22201
  }
22202
22202
  if (exMax) {
22203
22203
  if (legacy) {
22204
- json3.maximum = exclusiveMaximum;
22205
- json3.exclusiveMaximum = true;
22204
+ json4.maximum = exclusiveMaximum;
22205
+ json4.exclusiveMaximum = true;
22206
22206
  } else {
22207
- json3.exclusiveMaximum = exclusiveMaximum;
22207
+ json4.exclusiveMaximum = exclusiveMaximum;
22208
22208
  }
22209
22209
  } else if (typeof maximum === "number") {
22210
- json3.maximum = maximum;
22210
+ json4.maximum = maximum;
22211
22211
  }
22212
22212
  if (multipleOf) {
22213
22213
  const divisors = /* @__PURE__ */ new Set();
@@ -22215,75 +22215,75 @@ var numberProcessor = (schema, ctx, _json, params) => {
22215
22215
  if (Number.isFinite(divisor) && divisor !== 0)
22216
22216
  divisors.add(Math.abs(divisor));
22217
22217
  else
22218
- handleUnrepresentable(schema, ctx, json3, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
22218
+ handleUnrepresentable(schema, ctx, json4, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
22219
22219
  }
22220
22220
  const [first, ...rest] = divisors;
22221
22221
  if (first !== void 0)
22222
- json3.multipleOf = first;
22222
+ json4.multipleOf = first;
22223
22223
  if (rest.length)
22224
- json3.allOf = [...json3.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
22224
+ json4.allOf = [...json4.allOf ?? [], ...rest.map((m) => ({ multipleOf: m }))];
22225
22225
  }
22226
22226
  };
22227
- var booleanProcessor = (_schema, _ctx, json3, _params) => {
22228
- json3.type = "boolean";
22227
+ var booleanProcessor = (_schema, _ctx, json4, _params) => {
22228
+ json4.type = "boolean";
22229
22229
  };
22230
- var bigintProcessor = (schema, ctx, json3, params) => {
22231
- handleUnrepresentable(schema, ctx, json3, params, "BigInt cannot be represented in JSON Schema");
22230
+ var bigintProcessor = (schema, ctx, json4, params) => {
22231
+ handleUnrepresentable(schema, ctx, json4, params, "BigInt cannot be represented in JSON Schema");
22232
22232
  };
22233
- var symbolProcessor = (schema, ctx, json3, params) => {
22234
- handleUnrepresentable(schema, ctx, json3, params, "Symbols cannot be represented in JSON Schema");
22233
+ var symbolProcessor = (schema, ctx, json4, params) => {
22234
+ handleUnrepresentable(schema, ctx, json4, params, "Symbols cannot be represented in JSON Schema");
22235
22235
  };
22236
- var nullProcessor = (_schema, ctx, json3, _params) => {
22236
+ var nullProcessor = (_schema, ctx, json4, _params) => {
22237
22237
  if (ctx.target === "openapi-3.0") {
22238
- json3.type = "string";
22239
- json3.nullable = true;
22240
- json3.enum = [null];
22238
+ json4.type = "string";
22239
+ json4.nullable = true;
22240
+ json4.enum = [null];
22241
22241
  } else {
22242
- json3.type = "null";
22242
+ json4.type = "null";
22243
22243
  }
22244
22244
  };
22245
- var undefinedProcessor = (schema, ctx, json3, params) => {
22246
- handleUnrepresentable(schema, ctx, json3, params, "Undefined cannot be represented in JSON Schema");
22245
+ var undefinedProcessor = (schema, ctx, json4, params) => {
22246
+ handleUnrepresentable(schema, ctx, json4, params, "Undefined cannot be represented in JSON Schema");
22247
22247
  };
22248
- var voidProcessor = (schema, ctx, json3, params) => {
22249
- handleUnrepresentable(schema, ctx, json3, params, "Void cannot be represented in JSON Schema");
22248
+ var voidProcessor = (schema, ctx, json4, params) => {
22249
+ handleUnrepresentable(schema, ctx, json4, params, "Void cannot be represented in JSON Schema");
22250
22250
  };
22251
- var neverProcessor = (_schema, _ctx, json3, _params) => {
22252
- json3.not = {};
22251
+ var neverProcessor = (_schema, _ctx, json4, _params) => {
22252
+ json4.not = {};
22253
22253
  };
22254
22254
  var anyProcessor = (_schema, _ctx, _json, _params) => {
22255
22255
  };
22256
22256
  var unknownProcessor = (_schema, _ctx, _json, _params) => {
22257
22257
  };
22258
- var dateProcessor = (schema, ctx, json3, params) => {
22259
- handleUnrepresentable(schema, ctx, json3, params, "Date cannot be represented in JSON Schema");
22258
+ var dateProcessor = (schema, ctx, json4, params) => {
22259
+ handleUnrepresentable(schema, ctx, json4, params, "Date cannot be represented in JSON Schema");
22260
22260
  };
22261
- var enumProcessor = (schema, _ctx, json3, _params) => {
22261
+ var enumProcessor = (schema, _ctx, json4, _params) => {
22262
22262
  const def = schema._zod.def;
22263
22263
  const values = getEnumValues(def.entries);
22264
22264
  if (values.length === 0) {
22265
- json3.not = {};
22265
+ json4.not = {};
22266
22266
  return;
22267
22267
  }
22268
22268
  if (values.every((v) => typeof v === "number"))
22269
- json3.type = "number";
22269
+ json4.type = "number";
22270
22270
  if (values.every((v) => typeof v === "string"))
22271
- json3.type = "string";
22272
- json3.enum = values;
22271
+ json4.type = "string";
22272
+ json4.enum = values;
22273
22273
  };
22274
- var literalProcessor = (schema, ctx, json3, params) => {
22274
+ var literalProcessor = (schema, ctx, json4, params) => {
22275
22275
  const def = schema._zod.def;
22276
22276
  if (def.values.length === 0) {
22277
- json3.not = {};
22277
+ json4.not = {};
22278
22278
  return;
22279
22279
  }
22280
22280
  const vals = [];
22281
22281
  for (const val of def.values) {
22282
22282
  if (val === void 0) {
22283
- if (handleUnrepresentable(schema, ctx, json3, params, "Literal `undefined` cannot be represented in JSON Schema"))
22283
+ if (handleUnrepresentable(schema, ctx, json4, params, "Literal `undefined` cannot be represented in JSON Schema"))
22284
22284
  return;
22285
22285
  } else if (typeof val === "bigint") {
22286
- if (handleUnrepresentable(schema, ctx, json3, params, "BigInt literals cannot be represented in JSON Schema"))
22286
+ if (handleUnrepresentable(schema, ctx, json4, params, "BigInt literals cannot be represented in JSON Schema"))
22287
22287
  return;
22288
22288
  vals.push(Number(val));
22289
22289
  } else {
@@ -22293,37 +22293,37 @@ var literalProcessor = (schema, ctx, json3, params) => {
22293
22293
  if (vals.length === 0) {
22294
22294
  } else if (vals.length === 1) {
22295
22295
  const val = vals[0];
22296
- json3.type = val === null ? "null" : typeof val;
22296
+ json4.type = val === null ? "null" : typeof val;
22297
22297
  if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
22298
- json3.enum = [val];
22298
+ json4.enum = [val];
22299
22299
  } else {
22300
- json3.const = val;
22300
+ json4.const = val;
22301
22301
  }
22302
22302
  } else {
22303
22303
  if (vals.every((v) => typeof v === "number"))
22304
- json3.type = "number";
22304
+ json4.type = "number";
22305
22305
  if (vals.every((v) => typeof v === "string"))
22306
- json3.type = "string";
22306
+ json4.type = "string";
22307
22307
  if (vals.every((v) => typeof v === "boolean"))
22308
- json3.type = "boolean";
22308
+ json4.type = "boolean";
22309
22309
  if (vals.every((v) => v === null))
22310
- json3.type = "null";
22311
- json3.enum = vals;
22310
+ json4.type = "null";
22311
+ json4.enum = vals;
22312
22312
  }
22313
22313
  };
22314
- var nanProcessor = (schema, ctx, json3, params) => {
22315
- handleUnrepresentable(schema, ctx, json3, params, "NaN cannot be represented in JSON Schema");
22314
+ var nanProcessor = (schema, ctx, json4, params) => {
22315
+ handleUnrepresentable(schema, ctx, json4, params, "NaN cannot be represented in JSON Schema");
22316
22316
  };
22317
- var templateLiteralProcessor = (schema, _ctx, json3, _params) => {
22318
- const _json = json3;
22317
+ var templateLiteralProcessor = (schema, _ctx, json4, _params) => {
22318
+ const _json = json4;
22319
22319
  const pattern = schema._zod.pattern;
22320
22320
  if (!pattern)
22321
22321
  throw new Error("Pattern not found in template literal");
22322
22322
  _json.type = "string";
22323
22323
  _json.pattern = pattern.source;
22324
22324
  };
22325
- var fileProcessor = (schema, _ctx, json3, _params) => {
22326
- const _json = json3;
22325
+ var fileProcessor = (schema, _ctx, json4, _params) => {
22326
+ const _json = json4;
22327
22327
  _json.type = "string";
22328
22328
  _json.format = "binary";
22329
22329
  _json.contentEncoding = "binary";
@@ -22341,34 +22341,34 @@ var fileProcessor = (schema, _ctx, json3, _params) => {
22341
22341
  else
22342
22342
  _json.anyOf = mime.map((m) => ({ contentMediaType: m }));
22343
22343
  };
22344
- var successProcessor = (_schema, _ctx, json3, _params) => {
22345
- json3.type = "boolean";
22344
+ var successProcessor = (_schema, _ctx, json4, _params) => {
22345
+ json4.type = "boolean";
22346
22346
  };
22347
- var customProcessor = (schema, ctx, json3, params) => {
22348
- handleUnrepresentable(schema, ctx, json3, params, "Custom types cannot be represented in JSON Schema");
22347
+ var customProcessor = (schema, ctx, json4, params) => {
22348
+ handleUnrepresentable(schema, ctx, json4, params, "Custom types cannot be represented in JSON Schema");
22349
22349
  };
22350
- var functionProcessor = (schema, ctx, json3, params) => {
22351
- handleUnrepresentable(schema, ctx, json3, params, "Function types cannot be represented in JSON Schema");
22350
+ var functionProcessor = (schema, ctx, json4, params) => {
22351
+ handleUnrepresentable(schema, ctx, json4, params, "Function types cannot be represented in JSON Schema");
22352
22352
  };
22353
- var transformProcessor = (schema, ctx, json3, params) => {
22354
- handleUnrepresentable(schema, ctx, json3, params, "Transforms cannot be represented in JSON Schema");
22353
+ var transformProcessor = (schema, ctx, json4, params) => {
22354
+ handleUnrepresentable(schema, ctx, json4, params, "Transforms cannot be represented in JSON Schema");
22355
22355
  };
22356
- var mapProcessor = (schema, ctx, json3, params) => {
22357
- handleUnrepresentable(schema, ctx, json3, params, "Map cannot be represented in JSON Schema");
22356
+ var mapProcessor = (schema, ctx, json4, params) => {
22357
+ handleUnrepresentable(schema, ctx, json4, params, "Map cannot be represented in JSON Schema");
22358
22358
  };
22359
- var setProcessor = (schema, ctx, json3, params) => {
22360
- handleUnrepresentable(schema, ctx, json3, params, "Set cannot be represented in JSON Schema");
22359
+ var setProcessor = (schema, ctx, json4, params) => {
22360
+ handleUnrepresentable(schema, ctx, json4, params, "Set cannot be represented in JSON Schema");
22361
22361
  };
22362
22362
  var arrayProcessor = (schema, ctx, _json, params) => {
22363
- const json3 = _json;
22363
+ const json4 = _json;
22364
22364
  const def = schema._zod.def;
22365
22365
  const { minimum, maximum } = aggregateChecks(schema);
22366
22366
  if (typeof minimum === "number")
22367
- json3.minItems = minimum;
22367
+ json4.minItems = minimum;
22368
22368
  if (typeof maximum === "number")
22369
- json3.maxItems = maximum;
22370
- json3.type = "array";
22371
- json3.items = processSchema(def.element, ctx, {
22369
+ json4.maxItems = maximum;
22370
+ json4.type = "array";
22371
+ json4.items = processSchema(def.element, ctx, {
22372
22372
  ...params,
22373
22373
  path: [...params.path, "items"]
22374
22374
  });
@@ -22384,17 +22384,17 @@ function inputOptin(schema) {
22384
22384
  return schema._zod.optin;
22385
22385
  }
22386
22386
  var objectProcessor = (schema, ctx, _json, params) => {
22387
- const json3 = _json;
22387
+ const json4 = _json;
22388
22388
  const def = schema._zod.def;
22389
22389
  const shape = def.shape;
22390
22390
  const symbolKeys = Object.getOwnPropertySymbols(shape);
22391
- if (symbolKeys.length && handleUnrepresentable(schema, ctx, json3, params, "Symbol keys cannot be represented in JSON Schema")) {
22391
+ if (symbolKeys.length && handleUnrepresentable(schema, ctx, json4, params, "Symbol keys cannot be represented in JSON Schema")) {
22392
22392
  return;
22393
22393
  }
22394
- json3.type = "object";
22395
- json3.properties = {};
22394
+ json4.type = "object";
22395
+ json4.properties = {};
22396
22396
  for (const key in shape) {
22397
- assignProp(json3.properties, key, processSchema(shape[key], ctx, {
22397
+ assignProp(json4.properties, key, processSchema(shape[key], ctx, {
22398
22398
  ...params,
22399
22399
  path: [...params.path, "properties", key]
22400
22400
  }));
@@ -22407,21 +22407,21 @@ var objectProcessor = (schema, ctx, _json, params) => {
22407
22407
  }
22408
22408
  }
22409
22409
  if (requiredKeys.length > 0) {
22410
- json3.required = requiredKeys;
22410
+ json4.required = requiredKeys;
22411
22411
  }
22412
22412
  if (def.catchall?._zod.def.type === "never") {
22413
- json3.additionalProperties = false;
22413
+ json4.additionalProperties = false;
22414
22414
  } else if (!def.catchall) {
22415
22415
  if (ctx.io === "output")
22416
- json3.additionalProperties = false;
22416
+ json4.additionalProperties = false;
22417
22417
  } else if (def.catchall) {
22418
- json3.additionalProperties = processSchema(def.catchall, ctx, {
22418
+ json4.additionalProperties = processSchema(def.catchall, ctx, {
22419
22419
  ...params,
22420
22420
  path: [...params.path, "additionalProperties"]
22421
22421
  });
22422
22422
  }
22423
22423
  };
22424
- var unionProcessor = (schema, ctx, json3, params) => {
22424
+ var unionProcessor = (schema, ctx, json4, params) => {
22425
22425
  const def = schema._zod.def;
22426
22426
  const isExclusive = def.inclusive === false;
22427
22427
  const options = def.options.map((x, i) => processSchema(x, ctx, {
@@ -22429,12 +22429,12 @@ var unionProcessor = (schema, ctx, json3, params) => {
22429
22429
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
22430
22430
  }));
22431
22431
  if (isExclusive) {
22432
- json3.oneOf = options;
22432
+ json4.oneOf = options;
22433
22433
  } else {
22434
- json3.anyOf = options;
22434
+ json4.anyOf = options;
22435
22435
  }
22436
22436
  };
22437
- var intersectionProcessor = (schema, ctx, json3, params) => {
22437
+ var intersectionProcessor = (schema, ctx, json4, params) => {
22438
22438
  const def = schema._zod.def;
22439
22439
  const a = processSchema(def.left, ctx, {
22440
22440
  ...params,
@@ -22449,13 +22449,13 @@ var intersectionProcessor = (schema, ctx, json3, params) => {
22449
22449
  ...isSimpleIntersection(a) ? a.allOf : [a],
22450
22450
  ...isSimpleIntersection(b) ? b.allOf : [b]
22451
22451
  ];
22452
- json3.allOf = allOf;
22452
+ json4.allOf = allOf;
22453
22453
  ctx.intersections.push(allOf);
22454
22454
  };
22455
22455
  var tupleProcessor = (schema, ctx, _json, params) => {
22456
- const json3 = _json;
22456
+ const json4 = _json;
22457
22457
  const def = schema._zod.def;
22458
- json3.type = "array";
22458
+ json4.type = "array";
22459
22459
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
22460
22460
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
22461
22461
  const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
@@ -22477,70 +22477,70 @@ var tupleProcessor = (schema, ctx, _json, params) => {
22477
22477
  const maxItems = def.items.length;
22478
22478
  const isClosed = !def.rest;
22479
22479
  if (ctx.target === "draft-2020-12") {
22480
- json3.prefixItems = prefixItems;
22480
+ json4.prefixItems = prefixItems;
22481
22481
  if (isClosed) {
22482
- json3.items = false;
22482
+ json4.items = false;
22483
22483
  } else if (rest) {
22484
- json3.items = rest;
22484
+ json4.items = rest;
22485
22485
  }
22486
22486
  if (minItems > 0)
22487
- json3.minItems = minItems;
22487
+ json4.minItems = minItems;
22488
22488
  if (isClosed)
22489
- json3.maxItems = maxItems;
22489
+ json4.maxItems = maxItems;
22490
22490
  } else if (ctx.target === "openapi-3.0") {
22491
- json3.items = {
22491
+ json4.items = {
22492
22492
  anyOf: prefixItems
22493
22493
  };
22494
22494
  if (rest) {
22495
- json3.items.anyOf.push(rest);
22495
+ json4.items.anyOf.push(rest);
22496
22496
  }
22497
22497
  if (minItems > 0)
22498
- json3.minItems = minItems;
22498
+ json4.minItems = minItems;
22499
22499
  if (isClosed)
22500
- json3.maxItems = maxItems;
22500
+ json4.maxItems = maxItems;
22501
22501
  } else {
22502
- json3.items = prefixItems;
22502
+ json4.items = prefixItems;
22503
22503
  if (isClosed) {
22504
- json3.additionalItems = false;
22504
+ json4.additionalItems = false;
22505
22505
  } else if (rest) {
22506
- json3.additionalItems = rest;
22506
+ json4.additionalItems = rest;
22507
22507
  }
22508
22508
  if (minItems > 0)
22509
- json3.minItems = minItems;
22509
+ json4.minItems = minItems;
22510
22510
  if (isClosed)
22511
- json3.maxItems = maxItems;
22511
+ json4.maxItems = maxItems;
22512
22512
  }
22513
22513
  const { minimum, maximum } = aggregateChecks(schema);
22514
22514
  if (typeof minimum === "number")
22515
- json3.minItems = minimum;
22515
+ json4.minItems = minimum;
22516
22516
  if (typeof maximum === "number")
22517
- json3.maxItems = maximum;
22518
- };
22519
- function stringifyKeyNames(bySchema, json3, visited) {
22520
- if (json3.$ref) {
22521
- if (visited.has(json3))
22522
- return json3;
22523
- visited.add(json3);
22524
- const def = bySchema.get(json3)?.def;
22517
+ json4.maxItems = maximum;
22518
+ };
22519
+ function stringifyKeyNames(bySchema, json4, visited) {
22520
+ if (json4.$ref) {
22521
+ if (visited.has(json4))
22522
+ return json4;
22523
+ visited.add(json4);
22524
+ const def = bySchema.get(json4)?.def;
22525
22525
  if (!def)
22526
- return json3;
22526
+ return json4;
22527
22527
  const inlined = stringifyKeyNames(bySchema, def, visited);
22528
- return inlined === def ? json3 : inlined;
22528
+ return inlined === def ? json4 : inlined;
22529
22529
  }
22530
22530
  for (const keyword of ["anyOf", "oneOf"]) {
22531
- const branches = json3[keyword];
22531
+ const branches = json4[keyword];
22532
22532
  if (!Array.isArray(branches))
22533
22533
  continue;
22534
22534
  const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
22535
22535
  if (mapped.some((branch, i) => branch !== branches[i]))
22536
- json3 = { ...json3, [keyword]: mapped };
22536
+ json4 = { ...json4, [keyword]: mapped };
22537
22537
  }
22538
- const types = Array.isArray(json3.type) ? json3.type : [json3.type];
22538
+ const types = Array.isArray(json4.type) ? json4.type : [json4.type];
22539
22539
  const numericType = !types.includes("string") && types.some((t2) => t2 === "number" || t2 === "integer");
22540
- const values = json3.enum ?? (json3.const !== void 0 ? [json3.const] : void 0);
22540
+ const values = json4.enum ?? (json4.const !== void 0 ? [json4.const] : void 0);
22541
22541
  if (!numericType && !values?.some((v) => typeof v === "number"))
22542
- return json3;
22543
- const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json3;
22542
+ return json4;
22543
+ const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json4;
22544
22544
  if (rest.enum)
22545
22545
  rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
22546
22546
  else if (typeof rest.const === "number")
@@ -22580,9 +22580,9 @@ function rewriteKeyNames(ctx) {
22580
22580
  }
22581
22581
  }
22582
22582
  var recordProcessor = (schema, ctx, _json, params) => {
22583
- const json3 = _json;
22583
+ const json4 = _json;
22584
22584
  const def = schema._zod.def;
22585
- json3.type = "object";
22585
+ json4.type = "object";
22586
22586
  const keyType = def.keyType;
22587
22587
  const patterns = aggregateChecks(keyType).patterns;
22588
22588
  if (def.mode === "loose" && patterns && patterns.size > 0) {
@@ -22590,13 +22590,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
22590
22590
  ...params,
22591
22591
  path: [...params.path, "patternProperties", "*"]
22592
22592
  });
22593
- json3.patternProperties = {};
22593
+ json4.patternProperties = {};
22594
22594
  for (const pattern of patterns) {
22595
- assignProp(json3.patternProperties, exactPattern(pattern).source, valueSchema);
22595
+ assignProp(json4.patternProperties, exactPattern(pattern).source, valueSchema);
22596
22596
  }
22597
22597
  } else {
22598
22598
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
22599
- json3.propertyNames = processSchema(def.keyType, ctx, {
22599
+ json4.propertyNames = processSchema(def.keyType, ctx, {
22600
22600
  ...params,
22601
22601
  path: [...params.path, "propertyNames"]
22602
22602
  });
@@ -22608,7 +22608,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
22608
22608
  }
22609
22609
  pending.push(schema);
22610
22610
  }
22611
- json3.additionalProperties = processSchema(def.valueType, ctx, {
22611
+ json4.additionalProperties = processSchema(def.valueType, ctx, {
22612
22612
  ...params,
22613
22613
  path: [...params.path, "additionalProperties"]
22614
22614
  });
@@ -22618,19 +22618,19 @@ var recordProcessor = (schema, ctx, _json, params) => {
22618
22618
  if (keyValues && !def.partial && !omittableOnInput) {
22619
22619
  const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
22620
22620
  if (validKeyValues.length > 0) {
22621
- json3.required = validKeyValues.map(String);
22621
+ json4.required = validKeyValues.map(String);
22622
22622
  }
22623
22623
  }
22624
22624
  };
22625
- var nullableProcessor = (schema, ctx, json3, params) => {
22625
+ var nullableProcessor = (schema, ctx, json4, params) => {
22626
22626
  const def = schema._zod.def;
22627
22627
  const inner = processSchema(def.innerType, ctx, params);
22628
22628
  const seen = ctx.seen.get(schema);
22629
22629
  if (ctx.target === "openapi-3.0") {
22630
22630
  seen.ref = def.innerType;
22631
- json3.nullable = true;
22631
+ json4.nullable = true;
22632
22632
  } else {
22633
- json3.anyOf = [inner, { type: "null" }];
22633
+ json4.anyOf = [inner, { type: "null" }];
22634
22634
  }
22635
22635
  };
22636
22636
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
@@ -22640,7 +22640,7 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
22640
22640
  seen.ref = def.innerType;
22641
22641
  };
22642
22642
  var UNREPRESENTABLE_DEFAULT = /* @__PURE__ */ Symbol();
22643
- function serializeDefaultValue(value, schema, ctx, json3, params) {
22643
+ function serializeDefaultValue(value, schema, ctx, json4, params) {
22644
22644
  let unrepresentable = false;
22645
22645
  const serialized = JSON.stringify(value, (_, val) => {
22646
22646
  if (typeof val !== "bigint")
@@ -22650,30 +22650,30 @@ function serializeDefaultValue(value, schema, ctx, json3, params) {
22650
22650
  });
22651
22651
  if (!unrepresentable)
22652
22652
  return JSON.parse(serialized);
22653
- handleUnrepresentable(schema, ctx, json3, params, "BigInt defaults cannot be represented in JSON Schema");
22653
+ handleUnrepresentable(schema, ctx, json4, params, "BigInt defaults cannot be represented in JSON Schema");
22654
22654
  return UNREPRESENTABLE_DEFAULT;
22655
22655
  }
22656
- var defaultProcessor = (schema, ctx, json3, params) => {
22656
+ var defaultProcessor = (schema, ctx, json4, params) => {
22657
22657
  const def = schema._zod.def;
22658
22658
  processSchema(def.innerType, ctx, params);
22659
22659
  const seen = ctx.seen.get(schema);
22660
22660
  seen.ref = def.innerType;
22661
- const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
22661
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json4, params);
22662
22662
  if (value !== UNREPRESENTABLE_DEFAULT)
22663
- json3.default = value;
22663
+ json4.default = value;
22664
22664
  };
22665
- var prefaultProcessor = (schema, ctx, json3, params) => {
22665
+ var prefaultProcessor = (schema, ctx, json4, params) => {
22666
22666
  const def = schema._zod.def;
22667
22667
  processSchema(def.innerType, ctx, params);
22668
22668
  const seen = ctx.seen.get(schema);
22669
22669
  seen.ref = def.innerType;
22670
22670
  if (ctx.io !== "input")
22671
22671
  return;
22672
- const value = serializeDefaultValue(def.defaultValue, schema, ctx, json3, params);
22672
+ const value = serializeDefaultValue(def.defaultValue, schema, ctx, json4, params);
22673
22673
  if (value !== UNREPRESENTABLE_DEFAULT)
22674
- json3._prefault = value;
22674
+ json4._prefault = value;
22675
22675
  };
22676
- var catchProcessor = (schema, ctx, json3, params) => {
22676
+ var catchProcessor = (schema, ctx, json4, params) => {
22677
22677
  const def = schema._zod.def;
22678
22678
  processSchema(def.innerType, ctx, params);
22679
22679
  const seen = ctx.seen.get(schema);
@@ -22682,10 +22682,10 @@ var catchProcessor = (schema, ctx, json3, params) => {
22682
22682
  try {
22683
22683
  catchValue = def.catchValue(void 0);
22684
22684
  } catch {
22685
- handleUnrepresentable(schema, ctx, json3, params, "Dynamic catch values are not supported in JSON Schema");
22685
+ handleUnrepresentable(schema, ctx, json4, params, "Dynamic catch values are not supported in JSON Schema");
22686
22686
  return;
22687
22687
  }
22688
- json3.default = catchValue;
22688
+ json4.default = catchValue;
22689
22689
  };
22690
22690
  var pipeProcessor = (schema, ctx, _json, params) => {
22691
22691
  const def = schema._zod.def;
@@ -22695,12 +22695,12 @@ var pipeProcessor = (schema, ctx, _json, params) => {
22695
22695
  const seen = ctx.seen.get(schema);
22696
22696
  seen.ref = innerType;
22697
22697
  };
22698
- var readonlyProcessor = (schema, ctx, json3, params) => {
22698
+ var readonlyProcessor = (schema, ctx, json4, params) => {
22699
22699
  const def = schema._zod.def;
22700
22700
  processSchema(def.innerType, ctx, params);
22701
22701
  const seen = ctx.seen.get(schema);
22702
22702
  seen.ref = def.innerType;
22703
- json3.readOnly = true;
22703
+ json4.readOnly = true;
22704
22704
  };
22705
22705
  var promiseProcessor = (schema, ctx, _json, params) => {
22706
22706
  const def = schema._zod.def;
@@ -23342,7 +23342,7 @@ var _ZodString = /* @__PURE__ */ $constructor(
23342
23342
  (inst, def) => {
23343
23343
  $ZodString.init(inst, def);
23344
23344
  ZodType.init(inst, def);
23345
- inst._zod.processJSONSchema = (ctx, json3, params) => stringProcessor(inst, ctx, json3, params);
23345
+ inst._zod.processJSONSchema = (ctx, json4, params) => stringProcessor(inst, ctx, json4, params);
23346
23346
  },
23347
23347
  /* @__PURE__ */ util_exports.derived({
23348
23348
  format: (inst) => aggregateChecks(inst).format ?? null,
@@ -23701,7 +23701,7 @@ var ZodNumber = /* @__PURE__ */ $constructor(
23701
23701
  (inst, def) => {
23702
23702
  $ZodNumber.init(inst, def);
23703
23703
  ZodType.init(inst, def);
23704
- inst._zod.processJSONSchema = (ctx, json3, params) => numberProcessor(inst, ctx, json3, params);
23704
+ inst._zod.processJSONSchema = (ctx, json4, params) => numberProcessor(inst, ctx, json4, params);
23705
23705
  inst.isFinite = true;
23706
23706
  },
23707
23707
  /* @__PURE__ */ util_exports.derived({
@@ -23791,7 +23791,7 @@ function uint32(params) {
23791
23791
  var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
23792
23792
  $ZodBoolean.init(inst, def);
23793
23793
  ZodType.init(inst, def);
23794
- inst._zod.processJSONSchema = (ctx, json3, params) => booleanProcessor(inst, ctx, json3, params);
23794
+ inst._zod.processJSONSchema = (ctx, json4, params) => booleanProcessor(inst, ctx, json4, params);
23795
23795
  });
23796
23796
  function boolean2(params) {
23797
23797
  return _boolean(ZodBoolean, params);
@@ -23801,7 +23801,7 @@ var ZodBigInt = /* @__PURE__ */ $constructor(
23801
23801
  (inst, def) => {
23802
23802
  $ZodBigInt.init(inst, def);
23803
23803
  ZodType.init(inst, def);
23804
- inst._zod.processJSONSchema = (ctx, json3, params) => bigintProcessor(inst, ctx, json3, params);
23804
+ inst._zod.processJSONSchema = (ctx, json4, params) => bigintProcessor(inst, ctx, json4, params);
23805
23805
  },
23806
23806
  /* @__PURE__ */ util_exports.derived({
23807
23807
  minValue: (inst) => aggregateChecks(inst).minimum ?? null,
@@ -23859,7 +23859,7 @@ function uint64(params) {
23859
23859
  var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
23860
23860
  $ZodSymbol.init(inst, def);
23861
23861
  ZodType.init(inst, def);
23862
- inst._zod.processJSONSchema = (ctx, json3, params) => symbolProcessor(inst, ctx, json3, params);
23862
+ inst._zod.processJSONSchema = (ctx, json4, params) => symbolProcessor(inst, ctx, json4, params);
23863
23863
  });
23864
23864
  function symbol(params) {
23865
23865
  return _symbol(ZodSymbol, params);
@@ -23867,7 +23867,7 @@ function symbol(params) {
23867
23867
  var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
23868
23868
  $ZodUndefined.init(inst, def);
23869
23869
  ZodType.init(inst, def);
23870
- inst._zod.processJSONSchema = (ctx, json3, params) => undefinedProcessor(inst, ctx, json3, params);
23870
+ inst._zod.processJSONSchema = (ctx, json4, params) => undefinedProcessor(inst, ctx, json4, params);
23871
23871
  });
23872
23872
  function _undefined3(params) {
23873
23873
  return _undefined2(ZodUndefined, params);
@@ -23875,7 +23875,7 @@ function _undefined3(params) {
23875
23875
  var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
23876
23876
  $ZodNull.init(inst, def);
23877
23877
  ZodType.init(inst, def);
23878
- inst._zod.processJSONSchema = (ctx, json3, params) => nullProcessor(inst, ctx, json3, params);
23878
+ inst._zod.processJSONSchema = (ctx, json4, params) => nullProcessor(inst, ctx, json4, params);
23879
23879
  });
23880
23880
  function _null3(params) {
23881
23881
  return _null2(ZodNull, params);
@@ -23883,7 +23883,7 @@ function _null3(params) {
23883
23883
  var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
23884
23884
  $ZodAny.init(inst, def);
23885
23885
  ZodType.init(inst, def);
23886
- inst._zod.processJSONSchema = (ctx, json3, params) => anyProcessor(inst, ctx, json3, params);
23886
+ inst._zod.processJSONSchema = (ctx, json4, params) => anyProcessor(inst, ctx, json4, params);
23887
23887
  });
23888
23888
  function any() {
23889
23889
  return _any(ZodAny);
@@ -23891,7 +23891,7 @@ function any() {
23891
23891
  var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
23892
23892
  $ZodUnknown.init(inst, def);
23893
23893
  ZodType.init(inst, def);
23894
- inst._zod.processJSONSchema = (ctx, json3, params) => unknownProcessor(inst, ctx, json3, params);
23894
+ inst._zod.processJSONSchema = (ctx, json4, params) => unknownProcessor(inst, ctx, json4, params);
23895
23895
  });
23896
23896
  function unknown() {
23897
23897
  return _unknown(ZodUnknown);
@@ -23899,7 +23899,7 @@ function unknown() {
23899
23899
  var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
23900
23900
  $ZodNever.init(inst, def);
23901
23901
  ZodType.init(inst, def);
23902
- inst._zod.processJSONSchema = (ctx, json3, params) => neverProcessor(inst, ctx, json3, params);
23902
+ inst._zod.processJSONSchema = (ctx, json4, params) => neverProcessor(inst, ctx, json4, params);
23903
23903
  });
23904
23904
  function never(params) {
23905
23905
  return _never(ZodNever, params);
@@ -23907,7 +23907,7 @@ function never(params) {
23907
23907
  var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
23908
23908
  $ZodVoid.init(inst, def);
23909
23909
  ZodType.init(inst, def);
23910
- inst._zod.processJSONSchema = (ctx, json3, params) => voidProcessor(inst, ctx, json3, params);
23910
+ inst._zod.processJSONSchema = (ctx, json4, params) => voidProcessor(inst, ctx, json4, params);
23911
23911
  });
23912
23912
  function _void2(params) {
23913
23913
  return _void(ZodVoid, params);
@@ -23917,7 +23917,7 @@ var ZodDate = /* @__PURE__ */ $constructor(
23917
23917
  (inst, def) => {
23918
23918
  $ZodDate.init(inst, def);
23919
23919
  ZodType.init(inst, def);
23920
- inst._zod.processJSONSchema = (ctx, json3, params) => dateProcessor(inst, ctx, json3, params);
23920
+ inst._zod.processJSONSchema = (ctx, json4, params) => dateProcessor(inst, ctx, json4, params);
23921
23921
  inst.min = (value, params) => inst.check(_gte(value, params));
23922
23922
  inst.max = (value, params) => inst.check(_lte(value, params));
23923
23923
  },
@@ -23939,7 +23939,7 @@ var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
23939
23939
  _ensureDefaultMemoizer();
23940
23940
  $ZodArray.init(inst, def);
23941
23941
  ZodType.init(inst, def);
23942
- inst._zod.processJSONSchema = (ctx, json3, params) => arrayProcessor(inst, ctx, json3, params);
23942
+ inst._zod.processJSONSchema = (ctx, json4, params) => arrayProcessor(inst, ctx, json4, params);
23943
23943
  inst.element = def.element;
23944
23944
  }, {
23945
23945
  min(n, params) {
@@ -23969,7 +23969,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
23969
23969
  _ensureDefaultMemoizer();
23970
23970
  $ZodObjectJIT.init(inst, def);
23971
23971
  ZodType.init(inst, def);
23972
- inst._zod.processJSONSchema = (ctx, json3, params) => objectProcessor(inst, ctx, json3, params);
23972
+ inst._zod.processJSONSchema = (ctx, json4, params) => objectProcessor(inst, ctx, json4, params);
23973
23973
  util_exports.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
23974
23974
  }, {
23975
23975
  keyof() {
@@ -24042,7 +24042,7 @@ function looseObject(shape, params) {
24042
24042
  var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
24043
24043
  $ZodUnion.init(inst, def);
24044
24044
  ZodType.init(inst, def);
24045
- inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
24045
+ inst._zod.processJSONSchema = (ctx, json4, params) => unionProcessor(inst, ctx, json4, params);
24046
24046
  inst.options = def.options;
24047
24047
  });
24048
24048
  function union(options, params) {
@@ -24055,7 +24055,7 @@ function union(options, params) {
24055
24055
  var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
24056
24056
  ZodUnion.init(inst, def);
24057
24057
  $ZodXor.init(inst, def);
24058
- inst._zod.processJSONSchema = (ctx, json3, params) => unionProcessor(inst, ctx, json3, params);
24058
+ inst._zod.processJSONSchema = (ctx, json4, params) => unionProcessor(inst, ctx, json4, params);
24059
24059
  inst.options = def.options;
24060
24060
  });
24061
24061
  function xor(options, params) {
@@ -24081,7 +24081,7 @@ function discriminatedUnion(discriminator, options, params) {
24081
24081
  var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
24082
24082
  $ZodIntersection.init(inst, def);
24083
24083
  ZodType.init(inst, def);
24084
- inst._zod.processJSONSchema = (ctx, json3, params) => intersectionProcessor(inst, ctx, json3, params);
24084
+ inst._zod.processJSONSchema = (ctx, json4, params) => intersectionProcessor(inst, ctx, json4, params);
24085
24085
  });
24086
24086
  function intersection(left, right) {
24087
24087
  return new ZodIntersection({
@@ -24094,7 +24094,7 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
24094
24094
  _ensureDefaultMemoizer();
24095
24095
  $ZodTuple.init(inst, def);
24096
24096
  ZodType.init(inst, def);
24097
- inst._zod.processJSONSchema = (ctx, json3, params) => tupleProcessor(inst, ctx, json3, params);
24097
+ inst._zod.processJSONSchema = (ctx, json4, params) => tupleProcessor(inst, ctx, json4, params);
24098
24098
  }, {
24099
24099
  rest(rest) {
24100
24100
  return this.clone({
@@ -24127,7 +24127,7 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
24127
24127
  _ensureDefaultMemoizer();
24128
24128
  $ZodRecord.init(inst, def);
24129
24129
  ZodType.init(inst, def);
24130
- inst._zod.processJSONSchema = (ctx, json3, params) => recordProcessor(inst, ctx, json3, params);
24130
+ inst._zod.processJSONSchema = (ctx, json4, params) => recordProcessor(inst, ctx, json4, params);
24131
24131
  inst.keyType = def.keyType;
24132
24132
  inst.valueType = def.valueType;
24133
24133
  });
@@ -24169,7 +24169,7 @@ var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
24169
24169
  _ensureDefaultMemoizer();
24170
24170
  $ZodMap.init(inst, def);
24171
24171
  ZodType.init(inst, def);
24172
- inst._zod.processJSONSchema = (ctx, json3, params) => mapProcessor(inst, ctx, json3, params);
24172
+ inst._zod.processJSONSchema = (ctx, json4, params) => mapProcessor(inst, ctx, json4, params);
24173
24173
  inst.keyType = def.keyType;
24174
24174
  inst.valueType = def.valueType;
24175
24175
  inst.min = (...args) => inst.check(_minSize(...args));
@@ -24189,7 +24189,7 @@ var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
24189
24189
  _ensureDefaultMemoizer();
24190
24190
  $ZodSet.init(inst, def);
24191
24191
  ZodType.init(inst, def);
24192
- inst._zod.processJSONSchema = (ctx, json3, params) => setProcessor(inst, ctx, json3, params);
24192
+ inst._zod.processJSONSchema = (ctx, json4, params) => setProcessor(inst, ctx, json4, params);
24193
24193
  inst.min = (...args) => inst.check(_minSize(...args));
24194
24194
  inst.nonempty = (params) => inst.check(_minSize(1, params));
24195
24195
  inst.max = (...args) => inst.check(_maxSize(...args));
@@ -24205,7 +24205,7 @@ function set(valueType, params) {
24205
24205
  var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
24206
24206
  $ZodEnum.init(inst, def);
24207
24207
  ZodType.init(inst, def);
24208
- inst._zod.processJSONSchema = (ctx, json3, params) => enumProcessor(inst, ctx, json3, params);
24208
+ inst._zod.processJSONSchema = (ctx, json4, params) => enumProcessor(inst, ctx, json4, params);
24209
24209
  inst.enum = def.entries;
24210
24210
  inst.options = [...inst._zod.values];
24211
24211
  const keys = new Set(Object.keys(def.entries));
@@ -24258,7 +24258,7 @@ function nativeEnum(entries, params) {
24258
24258
  var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
24259
24259
  $ZodLiteral.init(inst, def);
24260
24260
  ZodType.init(inst, def);
24261
- inst._zod.processJSONSchema = (ctx, json3, params) => literalProcessor(inst, ctx, json3, params);
24261
+ inst._zod.processJSONSchema = (ctx, json4, params) => literalProcessor(inst, ctx, json4, params);
24262
24262
  inst.values = new Set(def.values);
24263
24263
  Object.defineProperty(inst, "value", {
24264
24264
  get() {
@@ -24279,7 +24279,7 @@ function literal(value, params) {
24279
24279
  var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
24280
24280
  $ZodFile.init(inst, def);
24281
24281
  ZodType.init(inst, def);
24282
- inst._zod.processJSONSchema = (ctx, json3, params) => fileProcessor(inst, ctx, json3, params);
24282
+ inst._zod.processJSONSchema = (ctx, json4, params) => fileProcessor(inst, ctx, json4, params);
24283
24283
  inst.min = (size, params) => inst.check(_minSize(size, params));
24284
24284
  inst.max = (size, params) => inst.check(_maxSize(size, params));
24285
24285
  inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
@@ -24291,7 +24291,7 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
24291
24291
  _ensureDefaultMemoizer();
24292
24292
  $ZodTransform.init(inst, def);
24293
24293
  ZodType.init(inst, def);
24294
- inst._zod.processJSONSchema = (ctx, json3, params) => transformProcessor(inst, ctx, json3, params);
24294
+ inst._zod.processJSONSchema = (ctx, json4, params) => transformProcessor(inst, ctx, json4, params);
24295
24295
  inst._zod.parse = (payload, _ctx) => {
24296
24296
  if (_ctx.direction === "backward") {
24297
24297
  throw new $ZodEncodeError(inst.constructor.name);
@@ -24330,7 +24330,7 @@ function transform(fn) {
24330
24330
  var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
24331
24331
  $ZodOptional.init(inst, def);
24332
24332
  ZodType.init(inst, def);
24333
- inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
24333
+ inst._zod.processJSONSchema = (ctx, json4, params) => optionalProcessor(inst, ctx, json4, params);
24334
24334
  inst.unwrap = () => inst._zod.def.innerType;
24335
24335
  });
24336
24336
  function optional(innerType) {
@@ -24342,7 +24342,7 @@ function optional(innerType) {
24342
24342
  var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
24343
24343
  $ZodExactOptional.init(inst, def);
24344
24344
  ZodType.init(inst, def);
24345
- inst._zod.processJSONSchema = (ctx, json3, params) => optionalProcessor(inst, ctx, json3, params);
24345
+ inst._zod.processJSONSchema = (ctx, json4, params) => optionalProcessor(inst, ctx, json4, params);
24346
24346
  inst.unwrap = () => inst._zod.def.innerType;
24347
24347
  });
24348
24348
  function exactOptional(innerType) {
@@ -24354,7 +24354,7 @@ function exactOptional(innerType) {
24354
24354
  var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
24355
24355
  $ZodNullable.init(inst, def);
24356
24356
  ZodType.init(inst, def);
24357
- inst._zod.processJSONSchema = (ctx, json3, params) => nullableProcessor(inst, ctx, json3, params);
24357
+ inst._zod.processJSONSchema = (ctx, json4, params) => nullableProcessor(inst, ctx, json4, params);
24358
24358
  inst.unwrap = () => inst._zod.def.innerType;
24359
24359
  });
24360
24360
  function nullable(innerType) {
@@ -24369,7 +24369,7 @@ function nullish2(innerType) {
24369
24369
  var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
24370
24370
  $ZodDefault.init(inst, def);
24371
24371
  ZodType.init(inst, def);
24372
- inst._zod.processJSONSchema = (ctx, json3, params) => defaultProcessor(inst, ctx, json3, params);
24372
+ inst._zod.processJSONSchema = (ctx, json4, params) => defaultProcessor(inst, ctx, json4, params);
24373
24373
  inst.unwrap = () => inst._zod.def.innerType;
24374
24374
  inst.removeDefault = inst.unwrap;
24375
24375
  });
@@ -24385,7 +24385,7 @@ function _default2(innerType, defaultValue) {
24385
24385
  var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
24386
24386
  $ZodPrefault.init(inst, def);
24387
24387
  ZodType.init(inst, def);
24388
- inst._zod.processJSONSchema = (ctx, json3, params) => prefaultProcessor(inst, ctx, json3, params);
24388
+ inst._zod.processJSONSchema = (ctx, json4, params) => prefaultProcessor(inst, ctx, json4, params);
24389
24389
  inst.unwrap = () => inst._zod.def.innerType;
24390
24390
  });
24391
24391
  function prefault(innerType, defaultValue) {
@@ -24400,7 +24400,7 @@ function prefault(innerType, defaultValue) {
24400
24400
  var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
24401
24401
  $ZodNonOptional.init(inst, def);
24402
24402
  ZodType.init(inst, def);
24403
- inst._zod.processJSONSchema = (ctx, json3, params) => nonoptionalProcessor(inst, ctx, json3, params);
24403
+ inst._zod.processJSONSchema = (ctx, json4, params) => nonoptionalProcessor(inst, ctx, json4, params);
24404
24404
  inst.unwrap = () => inst._zod.def.innerType;
24405
24405
  });
24406
24406
  function nonoptional(innerType, params) {
@@ -24413,7 +24413,7 @@ function nonoptional(innerType, params) {
24413
24413
  var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
24414
24414
  $ZodSuccess.init(inst, def);
24415
24415
  ZodType.init(inst, def);
24416
- inst._zod.processJSONSchema = (ctx, json3, params) => successProcessor(inst, ctx, json3, params);
24416
+ inst._zod.processJSONSchema = (ctx, json4, params) => successProcessor(inst, ctx, json4, params);
24417
24417
  inst.unwrap = () => inst._zod.def.innerType;
24418
24418
  });
24419
24419
  function success(innerType) {
@@ -24425,7 +24425,7 @@ function success(innerType) {
24425
24425
  var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
24426
24426
  $ZodCatch.init(inst, def);
24427
24427
  ZodType.init(inst, def);
24428
- inst._zod.processJSONSchema = (ctx, json3, params) => catchProcessor(inst, ctx, json3, params);
24428
+ inst._zod.processJSONSchema = (ctx, json4, params) => catchProcessor(inst, ctx, json4, params);
24429
24429
  inst.unwrap = () => inst._zod.def.innerType;
24430
24430
  inst.removeCatch = inst.unwrap;
24431
24431
  });
@@ -24439,7 +24439,7 @@ function _catch2(innerType, catchValue) {
24439
24439
  var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
24440
24440
  $ZodNaN.init(inst, def);
24441
24441
  ZodType.init(inst, def);
24442
- inst._zod.processJSONSchema = (ctx, json3, params) => nanProcessor(inst, ctx, json3, params);
24442
+ inst._zod.processJSONSchema = (ctx, json4, params) => nanProcessor(inst, ctx, json4, params);
24443
24443
  });
24444
24444
  function nan(params) {
24445
24445
  return _nan(ZodNaN, params);
@@ -24447,7 +24447,7 @@ function nan(params) {
24447
24447
  var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
24448
24448
  $ZodPipe.init(inst, def);
24449
24449
  ZodType.init(inst, def);
24450
- inst._zod.processJSONSchema = (ctx, json3, params) => pipeProcessor(inst, ctx, json3, params);
24450
+ inst._zod.processJSONSchema = (ctx, json4, params) => pipeProcessor(inst, ctx, json4, params);
24451
24451
  inst.in = def.in;
24452
24452
  inst.out = def.out;
24453
24453
  });
@@ -24489,7 +24489,7 @@ var ZodPreprocess = /* @__PURE__ */ $constructor("ZodPreprocess", (inst, def) =>
24489
24489
  var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
24490
24490
  $ZodReadonly.init(inst, def);
24491
24491
  ZodType.init(inst, def);
24492
- inst._zod.processJSONSchema = (ctx, json3, params) => readonlyProcessor(inst, ctx, json3, params);
24492
+ inst._zod.processJSONSchema = (ctx, json4, params) => readonlyProcessor(inst, ctx, json4, params);
24493
24493
  inst.unwrap = () => inst._zod.def.innerType;
24494
24494
  });
24495
24495
  function readonly(innerType) {
@@ -24501,7 +24501,7 @@ function readonly(innerType) {
24501
24501
  var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
24502
24502
  $ZodTemplateLiteral.init(inst, def);
24503
24503
  ZodType.init(inst, def);
24504
- inst._zod.processJSONSchema = (ctx, json3, params) => templateLiteralProcessor(inst, ctx, json3, params);
24504
+ inst._zod.processJSONSchema = (ctx, json4, params) => templateLiteralProcessor(inst, ctx, json4, params);
24505
24505
  });
24506
24506
  function templateLiteral(parts, params) {
24507
24507
  return new ZodTemplateLiteral({
@@ -24513,7 +24513,7 @@ function templateLiteral(parts, params) {
24513
24513
  var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
24514
24514
  $ZodLazy.init(inst, def);
24515
24515
  ZodType.init(inst, def);
24516
- inst._zod.processJSONSchema = (ctx, json3, params) => lazyProcessor(inst, ctx, json3, params);
24516
+ inst._zod.processJSONSchema = (ctx, json4, params) => lazyProcessor(inst, ctx, json4, params);
24517
24517
  inst.unwrap = () => inst._zod.def.getter();
24518
24518
  });
24519
24519
  function lazy(getter) {
@@ -24525,7 +24525,7 @@ function lazy(getter) {
24525
24525
  var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
24526
24526
  $ZodPromise.init(inst, def);
24527
24527
  ZodType.init(inst, def);
24528
- inst._zod.processJSONSchema = (ctx, json3, params) => promiseProcessor(inst, ctx, json3, params);
24528
+ inst._zod.processJSONSchema = (ctx, json4, params) => promiseProcessor(inst, ctx, json4, params);
24529
24529
  inst.unwrap = () => inst._zod.def.innerType;
24530
24530
  });
24531
24531
  function promise(innerType) {
@@ -24537,7 +24537,7 @@ function promise(innerType) {
24537
24537
  var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
24538
24538
  $ZodFunction.init(inst, def);
24539
24539
  ZodType.init(inst, def);
24540
- inst._zod.processJSONSchema = (ctx, json3, params) => functionProcessor(inst, ctx, json3, params);
24540
+ inst._zod.processJSONSchema = (ctx, json4, params) => functionProcessor(inst, ctx, json4, params);
24541
24541
  });
24542
24542
  function _function(params) {
24543
24543
  return new ZodFunction({
@@ -24549,7 +24549,7 @@ function _function(params) {
24549
24549
  var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
24550
24550
  $ZodCustom.init(inst, def);
24551
24551
  ZodType.init(inst, def);
24552
- inst._zod.processJSONSchema = (ctx, json3, params) => customProcessor(inst, ctx, json3, params);
24552
+ inst._zod.processJSONSchema = (ctx, json4, params) => customProcessor(inst, ctx, json4, params);
24553
24553
  });
24554
24554
  function check(fn) {
24555
24555
  const ch = new $ZodCheck({
@@ -26669,9 +26669,9 @@ async function loadDiff(gh, store, ref, base, head, isFullPr) {
26669
26669
  const res = await gh.request(`/repos/${ref.owner}/${ref.repo}/compare/${base}...${head}`, {
26670
26670
  accept: "application/vnd.github.diff"
26671
26671
  });
26672
- const text = await res.text();
26673
- store.putDiff(cacheKey2, text);
26674
- return { base, head, files: parseUnifiedDiff(text), missingFiles: 0 };
26672
+ const text2 = await res.text();
26673
+ store.putDiff(cacheKey2, text2);
26674
+ return { base, head, files: parseUnifiedDiff(text2), missingFiles: 0 };
26675
26675
  } catch (error62) {
26676
26676
  if (!(error62 instanceof GitHubError) || error62.status === 404) throw error62;
26677
26677
  }
@@ -26704,9 +26704,9 @@ async function loadBlobs(gh, store, ref, oids) {
26704
26704
  if (missing.length > 0) {
26705
26705
  const texts = await fetchTexts(gh, ref, missing);
26706
26706
  for (const oid of missing) {
26707
- const text = texts.get(oid) ?? null;
26708
- store.putDiff(key(oid), JSON.stringify(text));
26709
- out[oid] = text;
26707
+ const text2 = texts.get(oid) ?? null;
26708
+ store.putDiff(key(oid), JSON.stringify(text2));
26709
+ out[oid] = text2;
26710
26710
  }
26711
26711
  }
26712
26712
  return out;
@@ -26846,9 +26846,9 @@ async function applySuggestion(gh, ref, input2) {
26846
26846
  const file2 = await gh.rest(
26847
26847
  `/repos/${ref.owner}/${ref.repo}/contents/${encodedPath}?ref=${input2.expectedHeadOid}`
26848
26848
  );
26849
- const text = Buffer.from(file2.content, "base64").toString("utf8");
26850
- const eol = text.includes("\r\n") ? "\r\n" : "\n";
26851
- const lines = text.split(eol);
26849
+ const text2 = Buffer.from(file2.content, "base64").toString("utf8");
26850
+ const eol = text2.includes("\r\n") ? "\r\n" : "\n";
26851
+ const lines = text2.split(eol);
26852
26852
  if (input2.endLine > lines.length || input2.startLine < 1 || input2.startLine > input2.endLine) {
26853
26853
  throw new GitHubError("Lignes de la suggestion hors du fichier.", 422);
26854
26854
  }
@@ -26873,10 +26873,7 @@ async function applySuggestion(gh, ref, input2) {
26873
26873
  return res.commit.sha;
26874
26874
  }
26875
26875
 
26876
- // ../server/src/links/extract.ts
26877
- import ts from "typescript";
26878
-
26879
- // ../server/src/links/paths.ts
26876
+ // ../../packages/language/src/paths.ts
26880
26877
  function normalizePath(path) {
26881
26878
  const segments = [];
26882
26879
  for (const segment of path.split("/")) {
@@ -26915,7 +26912,168 @@ function sharedPrefixLength(a, b) {
26915
26912
  return count;
26916
26913
  }
26917
26914
 
26918
- // ../server/src/links/extract.ts
26915
+ // ../../packages/language/src/registry.ts
26916
+ var LanguageRegistry = class {
26917
+ #byId = /* @__PURE__ */ new Map();
26918
+ #byFilename = /* @__PURE__ */ new Map();
26919
+ /** Longest extension first. */
26920
+ #byExtension = [];
26921
+ constructor(languages2) {
26922
+ const extensions = /* @__PURE__ */ new Map();
26923
+ for (const language of languages2) {
26924
+ const { id, extensions: exts, filenames = [] } = language.info;
26925
+ if (this.#byId.has(id)) throw new Error(`Langage d\xE9clar\xE9 deux fois : ${id}`);
26926
+ this.#byId.set(id, language);
26927
+ for (const name of filenames) claim2(this.#byFilename, name.toLowerCase(), language);
26928
+ for (const ext of exts) claim2(extensions, ext.toLowerCase(), language);
26929
+ }
26930
+ this.#byExtension = [...extensions].sort(([a], [b]) => b.length - a.length);
26931
+ }
26932
+ /** Every language, in declaration order. */
26933
+ all() {
26934
+ return [...this.#byId.values()];
26935
+ }
26936
+ byId(id) {
26937
+ return this.#byId.get(id);
26938
+ }
26939
+ /** Language of a repository path, or null when no registered language handles it. */
26940
+ detect(path) {
26941
+ const name = basename(path).toLowerCase();
26942
+ const exact = this.#byFilename.get(name);
26943
+ if (exact !== void 0) return exact;
26944
+ for (const [extension, language] of this.#byExtension) {
26945
+ if (name.length > extension.length && name.endsWith(extension)) return language;
26946
+ }
26947
+ return null;
26948
+ }
26949
+ };
26950
+ function claim2(map2, key, language) {
26951
+ const owner = map2.get(key);
26952
+ if (owner !== void 0 && owner !== language) {
26953
+ throw new Error(`\xAB ${key} \xBB revendiqu\xE9 par ${owner.info.id} et ${language.info.id}`);
26954
+ }
26955
+ map2.set(key, language);
26956
+ }
26957
+
26958
+ // ../../packages/lang-css/src/info.ts
26959
+ var cssInfo = { id: "css", label: "CSS", extensions: [".css"] };
26960
+ var scssInfo = { id: "scss", label: "SCSS", extensions: [".scss"] };
26961
+ var sassInfo = { id: "sass", label: "Sass", extensions: [".sass"] };
26962
+ var lessInfo = { id: "less", label: "Less", extensions: [".less"] };
26963
+
26964
+ // ../../packages/lang-css/src/analysis.ts
26965
+ function extractImports(text2) {
26966
+ const refs = [];
26967
+ const source = text2.replace(/\/\*[\s\S]*?\*\//g, "");
26968
+ for (const match2 of source.matchAll(/@(import|use|forward)\s+([^;\n]+)/g)) {
26969
+ const urls = [...(match2[2] ?? "").matchAll(/url\(\s*["']?([^"')\s]+)["']?\s*\)|["']([^"'\n]+)["']/g)];
26970
+ for (const url2 of match2[1] === "import" ? urls : urls.slice(0, 1)) {
26971
+ const specifier = url2[1] ?? url2[2];
26972
+ if (specifier !== void 0) refs.push({ specifier, names: [] });
26973
+ }
26974
+ }
26975
+ return refs;
26976
+ }
26977
+ var STYLE_EXTENSIONS = [".scss", ".sass", ".css", ".less"];
26978
+ function candidates(base) {
26979
+ const dir = dirname(base);
26980
+ const partial2 = `${dir === "" ? "" : `${dir}/`}_${basename(base)}`;
26981
+ if (STYLE_EXTENSIONS.includes(extname(base))) return [base, partial2];
26982
+ return [
26983
+ base,
26984
+ ...STYLE_EXTENSIONS.flatMap((ext) => [base + ext, partial2 + ext]),
26985
+ ...STYLE_EXTENSIONS.flatMap((ext) => [`${base}/_index${ext}`, `${base}/index${ext}`])
26986
+ ];
26987
+ }
26988
+ function resolveImport(ref, from, index) {
26989
+ const specifier = ref.specifier.replace(/^~/, "");
26990
+ if (/^(?:[a-z]+:|\/\/)/i.test(specifier)) return [];
26991
+ const paths = candidates(specifier);
26992
+ const relative2 = index.firstRelative(dirname(from), paths);
26993
+ if (relative2 !== null) return [{ path: relative2, names: ref.names }];
26994
+ if (specifier.startsWith(".")) return [];
26995
+ return index.closestWithSuffix(from, paths).map((path) => ({ path, names: ref.names }));
26996
+ }
26997
+ var stylesheet = (info) => ({ info, extractImports, resolveImport });
26998
+ var css = stylesheet(cssInfo);
26999
+ var scss = stylesheet(scssInfo);
27000
+ var sass = stylesheet(sassInfo);
27001
+ var less = stylesheet(lessInfo);
27002
+
27003
+ // ../../packages/lang-html/src/info.ts
27004
+ var htmlInfo = { id: "html", label: "HTML", extensions: [".html", ".htm"] };
27005
+
27006
+ // ../../packages/lang-html/src/analysis.ts
27007
+ function extractImports2(text2) {
27008
+ const source = text2.replace(/<!--[\s\S]*?-->/g, "");
27009
+ const refs = [];
27010
+ for (const tag of source.matchAll(/<(script|link)\b[^>]*>/gi)) {
27011
+ const attribute = tag[1].toLowerCase() === "script" ? "src" : "href";
27012
+ const value = new RegExp(`\\s${attribute}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i").exec(tag[0]);
27013
+ const url2 = value?.[1] ?? value?.[2] ?? value?.[3];
27014
+ if (url2) refs.push({ specifier: url2, names: [] });
27015
+ }
27016
+ return refs;
27017
+ }
27018
+ function resolveImport2(ref, from, index) {
27019
+ const url2 = ref.specifier.replace(/[?#].*$/, "");
27020
+ if (url2 === "" || /^(?:[a-z]+:|\/\/)/i.test(url2)) return [];
27021
+ const rooted = url2.startsWith("/");
27022
+ const relative2 = index.firstRelative(dirname(from), [rooted ? url2.slice(1) : url2]);
27023
+ if (relative2 !== null) return [{ path: relative2, names: ref.names }];
27024
+ if (!rooted) return [];
27025
+ return index.closestWithSuffix(from, [url2.slice(1)]).map((path) => ({ path, names: ref.names }));
27026
+ }
27027
+ var html = { info: htmlInfo, extractImports: extractImports2, resolveImport: resolveImport2 };
27028
+
27029
+ // ../../packages/lang-json/src/info.ts
27030
+ var jsonInfo = {
27031
+ id: "json",
27032
+ label: "JSON",
27033
+ extensions: [".json", ".jsonc"],
27034
+ // JSON configuration files without the extension.
27035
+ filenames: [".babelrc", ".eslintrc", ".prettierrc", ".swcrc"]
27036
+ };
27037
+
27038
+ // ../../packages/lang-json/src/analysis.ts
27039
+ var json3 = { info: jsonInfo };
27040
+
27041
+ // ../../packages/lang-markdown/src/info.ts
27042
+ var markdownInfo = {
27043
+ id: "markdown",
27044
+ label: "MD",
27045
+ extensions: [".md", ".markdown"]
27046
+ };
27047
+
27048
+ // ../../packages/lang-markdown/src/analysis.ts
27049
+ var markdown = { info: markdownInfo };
27050
+
27051
+ // ../../packages/lang-text/src/info.ts
27052
+ var textInfo = {
27053
+ id: "text",
27054
+ label: "TXT",
27055
+ extensions: [".txt"]
27056
+ };
27057
+
27058
+ // ../../packages/lang-text/src/analysis.ts
27059
+ var text = { info: textInfo };
27060
+
27061
+ // ../../packages/lang-typescript/src/analysis.ts
27062
+ import ts from "typescript";
27063
+
27064
+ // ../../packages/lang-typescript/src/info.ts
27065
+ var typescriptInfo = {
27066
+ id: "typescript",
27067
+ label: "TS",
27068
+ extensions: [".ts", ".tsx", ".mts", ".cts"]
27069
+ };
27070
+ var javascriptInfo = {
27071
+ id: "javascript",
27072
+ label: "JS",
27073
+ extensions: [".js", ".jsx", ".mjs", ".cjs"]
27074
+ };
27075
+
27076
+ // ../../packages/lang-typescript/src/analysis.ts
26919
27077
  var SCRIPT_KIND_BY_EXTENSION = {
26920
27078
  ".ts": ts.ScriptKind.TS,
26921
27079
  ".mts": ts.ScriptKind.TS,
@@ -26926,44 +27084,9 @@ var SCRIPT_KIND_BY_EXTENSION = {
26926
27084
  ".cjs": ts.ScriptKind.JS,
26927
27085
  ".jsx": ts.ScriptKind.JSX
26928
27086
  };
26929
- var SCRIPT_KIND_BY_LANG = {
26930
- ts: ts.ScriptKind.TS,
26931
- typescript: ts.ScriptKind.TS,
26932
- tsx: ts.ScriptKind.TSX,
26933
- jsx: ts.ScriptKind.JSX
26934
- };
26935
- var EXTRACTORS = {
26936
- typescript: extractScriptFile,
26937
- javascript: extractScriptFile,
26938
- vue: extractComponentScripts,
26939
- svelte: extractComponentScripts,
26940
- python: extractPython,
26941
- css: extractStyle,
26942
- go: extractGo,
26943
- java: extractJvm,
26944
- kotlin: extractJvm,
26945
- c: extractInclude,
26946
- cpp: extractInclude,
26947
- rust: extractRust,
26948
- ruby: extractRuby,
26949
- markdown: () => []
26950
- };
26951
- function extractImports(text, path, language) {
26952
- return language === null ? [] : EXTRACTORS[language](text, path);
26953
- }
26954
- function extractScriptFile(text, path) {
26955
- return parseScript(text, path, SCRIPT_KIND_BY_EXTENSION[extname(path).toLowerCase()] ?? ts.ScriptKind.TS);
26956
- }
26957
- function extractComponentScripts(text, path) {
26958
- const refs = [];
26959
- for (const match2 of text.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)) {
26960
- const lang = /\blang\s*=\s*["']?(tsx?|jsx|typescript)\b/i.exec(match2[1] ?? "")?.[1]?.toLowerCase() ?? "";
26961
- refs.push(...parseScript(match2[2] ?? "", path, SCRIPT_KIND_BY_LANG[lang] ?? ts.ScriptKind.JS));
26962
- }
26963
- return refs;
26964
- }
26965
- function parseScript(text, path, kind) {
26966
- const source = ts.createSourceFile(path, text, ts.ScriptTarget.Latest, true, kind);
27087
+ function extractImports3(text2, path) {
27088
+ const kind = SCRIPT_KIND_BY_EXTENSION[extname(path).toLowerCase()] ?? ts.ScriptKind.TS;
27089
+ const source = ts.createSourceFile(path, text2, ts.ScriptTarget.Latest, true, kind);
26967
27090
  const refs = [];
26968
27091
  const visit2 = (node2) => {
26969
27092
  const ref = scriptImport(node2);
@@ -27034,162 +27157,228 @@ function boundNames(call) {
27034
27157
  return ts.isIdentifier(key) ? [key.text] : [];
27035
27158
  });
27036
27159
  }
27037
- function extractPython(text) {
27038
- const source = text.replace(/\\\r?\n/g, " ");
27039
- const refs = [];
27040
- for (const match2 of source.matchAll(
27041
- /^[ \t]*from[ \t]+(\.+[\w.]*|[\w.]+)[ \t]+import[ \t]+(\([^)]{0,10000}\)|[^\n#;]*)/gm
27042
- )) {
27043
- const names = splitNames(match2[2]?.replace(/[()]/g, "") ?? "").filter(
27044
- (name) => /^(?:\w+|\*)$/.test(name)
27045
- );
27046
- if (match2[1] !== void 0 && names.length > 0) refs.push({ specifier: match2[1], names });
27160
+ var SCRIPT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".d.ts", ".js", ".jsx", ".mjs", ".cjs"];
27161
+ var TS_COUNTERPARTS = {
27162
+ ".js": [".ts", ".tsx"],
27163
+ ".jsx": [".tsx"],
27164
+ ".mjs": [".mts"],
27165
+ ".cjs": [".cts"]
27166
+ };
27167
+ var ALIAS_PREFIX = /^(?:@\/|~\/|#\/?)/;
27168
+ function scriptCandidates(base) {
27169
+ const extension = extname(base);
27170
+ const counterparts = (TS_COUNTERPARTS[extension] ?? []).map((ts2) => base.slice(0, -extension.length) + ts2);
27171
+ return [
27172
+ base,
27173
+ ...counterparts,
27174
+ ...SCRIPT_EXTENSIONS.map((ext) => base + ext),
27175
+ ...SCRIPT_EXTENSIONS.map((ext) => `${base}/index${ext}`)
27176
+ ];
27177
+ }
27178
+ function resolveImport3(ref, from, index) {
27179
+ const { specifier, names } = ref;
27180
+ if (specifier.startsWith("./") || specifier.startsWith("../") || specifier === "." || specifier === "..") {
27181
+ const path = index.firstRelative(dirname(from), scriptCandidates(specifier));
27182
+ return path === null ? [] : [{ path, names }];
27047
27183
  }
27048
- for (const match2 of source.matchAll(/^[ \t]*import[ \t]+([^\n#;]+)/gm)) {
27049
- for (const module of splitNames(match2[1] ?? "")) {
27050
- if (/^\w+(?:\.\w+)*$/.test(module)) refs.push({ specifier: module, names: [] });
27051
- }
27184
+ const workspace = index.packageFor(specifier);
27185
+ if (workspace !== null) {
27186
+ const path = resolveWorkspaceImport(workspace.pkg, workspace.subpath, index);
27187
+ return path === null ? [] : [{ path, names }];
27052
27188
  }
27053
- return refs;
27189
+ if (!ALIAS_PREFIX.test(specifier) && !specifier.startsWith("/")) return [];
27190
+ const remainder = specifier.replace(ALIAS_PREFIX, "").replace(/^\/+/, "");
27191
+ if (remainder === "") return [];
27192
+ return index.closestWithSuffix(from, scriptCandidates(remainder)).map((path) => ({ path, names }));
27054
27193
  }
27055
- function splitNames(list) {
27056
- return list.replace(/#[^\n]*/g, "").split(",").map(
27057
- (part) => part.trim().split(/\s+as\s+/)[0]?.trim() ?? ""
27058
- ).filter((name) => name !== "");
27194
+ function resolveWorkspaceImport(pkg, subpath, index) {
27195
+ if (subpath === "") return index.entryOf(pkg);
27196
+ return index.firstRelative(pkg.root, scriptCandidates(subpath)) ?? index.firstRelative(pkg.root, scriptCandidates(`src/${subpath}`));
27059
27197
  }
27060
- function extractStyle(text) {
27061
- const refs = [];
27062
- const source = text.replace(/\/\*[\s\S]*?\*\//g, "");
27063
- for (const match2 of source.matchAll(/@(import|use|forward)\s+([^;\n]+)/g)) {
27064
- const urls = [...(match2[2] ?? "").matchAll(/url\(\s*["']?([^"')\s]+)["']?\s*\)|["']([^"'\n]+)["']/g)];
27065
- for (const url2 of match2[1] === "import" ? urls : urls.slice(0, 1)) {
27066
- const specifier = url2[1] ?? url2[2];
27067
- if (specifier !== void 0) refs.push({ specifier, names: [] });
27198
+ function importedPackageRoot(ref, index) {
27199
+ return ref.specifier.startsWith(".") ? null : index.packageFor(ref.specifier)?.pkg.root ?? null;
27200
+ }
27201
+ var typescript = {
27202
+ info: typescriptInfo,
27203
+ extractImports: extractImports3,
27204
+ resolveImport: resolveImport3,
27205
+ importedPackageRoot
27206
+ };
27207
+ var javascript = {
27208
+ info: javascriptInfo,
27209
+ extractImports: extractImports3,
27210
+ resolveImport: resolveImport3,
27211
+ importedPackageRoot
27212
+ };
27213
+ var DeclaredName = external_exports.string().optional().catch(void 0);
27214
+ var DependencyMap = external_exports.record(external_exports.string(), external_exports.unknown()).optional().catch(void 0);
27215
+ var PackageJson = external_exports.object({
27216
+ name: DeclaredName,
27217
+ dependencies: DependencyMap,
27218
+ devDependencies: DependencyMap,
27219
+ peerDependencies: DependencyMap,
27220
+ optionalDependencies: DependencyMap
27221
+ });
27222
+ var NPM_LOCAL_SPEC = /^(?:file|link|portal):(.+)$/;
27223
+ function readPackageJson(text2) {
27224
+ const data = PackageJson.parse(JSON.parse(text2));
27225
+ const deps = [];
27226
+ const paths = [];
27227
+ for (const entries of [
27228
+ data.dependencies,
27229
+ data.devDependencies,
27230
+ data.peerDependencies,
27231
+ data.optionalDependencies
27232
+ ]) {
27233
+ for (const [dep, spec] of Object.entries(entries ?? {})) {
27234
+ deps.push(dep);
27235
+ const local = typeof spec === "string" ? NPM_LOCAL_SPEC.exec(spec)?.[1] : void 0;
27236
+ if (local !== void 0) paths.push(local);
27068
27237
  }
27069
27238
  }
27070
- return refs;
27239
+ const name = data.name?.trim();
27240
+ return { name: name === void 0 || name === "" ? null : name, deps, paths };
27071
27241
  }
27072
- function extractGo(text) {
27073
- const refs = [];
27074
- const addSpec = (alias, path) => {
27075
- if (path === void 0) return;
27076
- const name = alias !== void 0 && alias !== "_" && alias !== "." ? alias : path.slice(path.lastIndexOf("/") + 1);
27077
- refs.push({ specifier: path, names: [name] });
27242
+ var SRC_EXTENSIONS = [".ts", ".tsx", ".mts", ".js", ".jsx"];
27243
+ function exportTargets(value) {
27244
+ if (typeof value === "string") return [value];
27245
+ if (!value || typeof value !== "object") return [];
27246
+ const entries = Object.entries(value);
27247
+ const root = entries.find(([k]) => k === ".");
27248
+ const ordered = root ? [root] : entries.filter(([k]) => !k.startsWith("./"));
27249
+ return ordered.flatMap(([, v]) => exportTargets(v));
27250
+ }
27251
+ function entryCandidates(root, manifestText) {
27252
+ if (!manifestText) return [];
27253
+ const join5 = (rel) => {
27254
+ const clean = rel.replace(/^\.\//, "");
27255
+ return root ? `${root}/${clean}` : clean;
27078
27256
  };
27079
- for (const match2 of text.matchAll(/^[ \t]*import[ \t]+(?:([\w.]+)[ \t]+)?"([^"\n]+)"/gm))
27080
- addSpec(match2[1], match2[2]);
27081
- for (const group of text.matchAll(/^[ \t]*import[ \t]*\(([^)]{0,10000})\)/gm)) {
27082
- for (const match2 of (group[1] ?? "").matchAll(/^[ \t]*(?:([\w.]+)[ \t]+)?"([^"\n]+)"/gm))
27083
- addSpec(match2[1], match2[2]);
27257
+ const out = [];
27258
+ let manifest = null;
27259
+ try {
27260
+ manifest = JSON.parse(manifestText);
27261
+ } catch {
27084
27262
  }
27085
- return refs;
27086
- }
27087
- function extractJvm(text) {
27088
- return [...text.matchAll(/^[ \t]*import[ \t]+(?:static[ \t]+)?(\w+(?:\.\w+)*(?:\.\*)?)/gm)].flatMap(
27089
- (match2) => {
27090
- const specifier = match2[1];
27091
- return specifier === void 0 ? [] : [{ specifier, names: [specifier.slice(specifier.lastIndexOf(".") + 1)] }];
27263
+ if (manifest && typeof manifest === "object") {
27264
+ const fields = ["exports", "module", "main", "types", "typings"];
27265
+ for (const field of fields) {
27266
+ if (!(field in manifest)) continue;
27267
+ const value = Reflect.get(manifest, field);
27268
+ for (const target of exportTargets(value)) {
27269
+ out.push(join5(target));
27270
+ const source = target.replace(/^\.?\/?(dist|build|lib|out)\//, "src/").replace(/(\.d)?\.(m|c)?[jt]sx?$/, "");
27271
+ if (source !== target) for (const ext of SRC_EXTENSIONS) out.push(join5(source + ext));
27272
+ }
27092
27273
  }
27093
- );
27094
- }
27095
- function extractInclude(text) {
27096
- return [...text.matchAll(/^[ \t]*#[ \t]*include[ \t]*"([^"\n]+)"/gm)].flatMap(
27097
- (match2) => match2[1] === void 0 ? [] : [{ specifier: match2[1], names: [] }]
27098
- );
27274
+ }
27275
+ for (const base of ["src/index", "index", "src/main"]) {
27276
+ for (const ext of SRC_EXTENSIONS) out.push(join5(base + ext));
27277
+ }
27278
+ return [...new Set(out)];
27099
27279
  }
27100
- function extractRust(text) {
27101
- const source = text.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "");
27102
- const refs = [];
27103
- const visibility = String.raw`(?:pub(?:\([^)\n]*\))?[ \t]+)?`;
27104
- const modPattern = new RegExp(
27105
- String.raw`^[ \t]*(?:#\[[^\]\n]*\][ \t]*)*${visibility}mod[ \t]+(?:r#)?(\w+)[ \t]*;`,
27106
- "gm"
27107
- );
27108
- for (const match2 of source.matchAll(modPattern)) {
27109
- if (match2[1] !== void 0) refs.push({ specifier: `self::${match2[1]}`, names: [match2[1]] });
27280
+ var npm = {
27281
+ id: "npm",
27282
+ manifests: ["package.json"],
27283
+ readManifest: readPackageJson,
27284
+ entryCandidates
27285
+ };
27286
+
27287
+ // ../server/src/languages.ts
27288
+ var languages = new LanguageRegistry([
27289
+ typescript,
27290
+ javascript,
27291
+ html,
27292
+ css,
27293
+ scss,
27294
+ sass,
27295
+ less,
27296
+ markdown,
27297
+ json3,
27298
+ text
27299
+ ]);
27300
+ var ecosystems = [npm];
27301
+
27302
+ // ../../packages/language/src/analysis.ts
27303
+ var FileIndex = class {
27304
+ #paths = /* @__PURE__ */ new Set();
27305
+ #byBasename = /* @__PURE__ */ new Map();
27306
+ #byDir = /* @__PURE__ */ new Map();
27307
+ /** Longest name first, so that `@acme/ui/forms` prefers a package named `@acme/ui/forms` over `@acme/ui`. */
27308
+ #packages = [];
27309
+ constructor(paths, packages = []) {
27310
+ for (const path of paths) {
27311
+ if (this.#paths.has(path)) continue;
27312
+ this.#paths.add(path);
27313
+ pushTo(this.#byBasename, basename(path), path);
27314
+ pushTo(this.#byDir, dirname(path), path);
27315
+ }
27316
+ for (const ref of packages) {
27317
+ const root = ref.root === "" ? "" : normalizePath(ref.root);
27318
+ if (ref.name === "" || root === null) continue;
27319
+ const entries = ref.entries.flatMap((entry) => normalizePath(entry) ?? []);
27320
+ this.#packages.push({ name: ref.name, root, entries });
27321
+ }
27322
+ this.#packages.sort((a, b) => b.name.length - a.name.length);
27110
27323
  }
27111
- for (const match2 of source.matchAll(/^[ \t]*(?:#\[[^\]\n]*\][ \t]*)*extern[ \t]+crate[ \t]+(\w+)/gm)) {
27112
- if (match2[1] !== void 0 && match2[1] !== "self") refs.push({ specifier: match2[1], names: [match2[1]] });
27324
+ /** Package named by a bare specifier (`name` or `name/sub/path`), with the remaining subpath. */
27325
+ packageFor(specifier) {
27326
+ for (const pkg of this.#packages) {
27327
+ if (specifier === pkg.name) return { pkg, subpath: "" };
27328
+ if (specifier.startsWith(`${pkg.name}/`)) return { pkg, subpath: specifier.slice(pkg.name.length + 1) };
27329
+ }
27330
+ return null;
27113
27331
  }
27114
- for (const match2 of source.matchAll(
27115
- new RegExp(String.raw`^[ \t]*${visibility}use[ \t]+([^;]{1,10000});`, "gm")
27116
- )) {
27117
- const tree = (match2[1] ?? "").replace(/\s+as\s+\w+/g, "").replace(/\s+/g, "");
27118
- for (const path of expandUseTree(tree)) {
27119
- const segments = path.replace(/^::/, "").split("::");
27120
- const last = segments.at(-1);
27121
- if (last === "*") segments.pop();
27122
- refs.push({ specifier: segments.join("::"), names: last === void 0 ? [] : [last] });
27332
+ /** First entry candidate of a package that is a changed file. */
27333
+ entryOf(pkg) {
27334
+ return pkg.entries.find((entry) => this.#paths.has(entry)) ?? null;
27335
+ }
27336
+ /** Root of the package containing `path`: the root that is its longest segment prefix; null when none. */
27337
+ ownPackageRoot(path) {
27338
+ let best = null;
27339
+ for (const { root } of this.#packages) {
27340
+ const contains = root === "" || path === root || path.startsWith(`${root}/`);
27341
+ if (contains && (best === null || root.length > best.length)) best = root;
27123
27342
  }
27343
+ return best;
27124
27344
  }
27125
- return refs;
27126
- }
27127
- function expandUseTree(tree) {
27128
- const open2 = tree.indexOf("{");
27129
- const close = tree.lastIndexOf("}");
27130
- if (open2 === -1 || close < open2) return [tree];
27131
- const head = tree.slice(0, open2);
27132
- return splitTopLevel(tree.slice(open2 + 1, close)).flatMap(
27133
- (part) => part === "self" ? [head.replace(/::$/, "")] : expandUseTree(head + part)
27134
- );
27135
- }
27136
- function splitTopLevel(list) {
27137
- const parts = [];
27138
- let depth = 0;
27139
- let start = 0;
27140
- for (let i = 0; i < list.length; i++) {
27141
- const char = list[i];
27142
- if (char === "{") depth++;
27143
- else if (char === "}") depth--;
27144
- else if (char === "," && depth === 0) {
27145
- parts.push(list.slice(start, i));
27146
- start = i + 1;
27345
+ has(path) {
27346
+ return path !== null && this.#paths.has(path);
27347
+ }
27348
+ /** Paths equal to `suffix` or ending with `/suffix`. */
27349
+ withSuffix(suffix) {
27350
+ const candidates2 = this.#byBasename.get(basename(suffix)) ?? [];
27351
+ return candidates2.filter((path) => path === suffix || path.endsWith(`/${suffix}`));
27352
+ }
27353
+ /** First candidate path present in the index, relative to `dir`. */
27354
+ firstRelative(dir, candidates2) {
27355
+ for (const candidate of candidates2) {
27356
+ const path = joinPath(dir, candidate);
27357
+ if (this.has(path)) return path;
27147
27358
  }
27359
+ return null;
27148
27360
  }
27149
- parts.push(list.slice(start));
27150
- return parts.filter((part) => part !== "");
27151
- }
27152
- function extractRuby(text) {
27153
- return [...text.matchAll(/^[ \t]*require_relative[ \t(]+["']([^"'\n]+)["']/gm)].flatMap(
27154
- (match2) => match2[1] === void 0 ? [] : [{ specifier: match2[1], names: [] }]
27155
- );
27156
- }
27157
-
27158
- // ../server/src/links/language.ts
27159
- var LANGUAGE_BY_EXTENSION = {
27160
- ".ts": "typescript",
27161
- ".tsx": "typescript",
27162
- ".mts": "typescript",
27163
- ".cts": "typescript",
27164
- ".js": "javascript",
27165
- ".jsx": "javascript",
27166
- ".mjs": "javascript",
27167
- ".cjs": "javascript",
27168
- ".py": "python",
27169
- ".css": "css",
27170
- ".scss": "css",
27171
- ".sass": "css",
27172
- ".less": "css",
27173
- ".go": "go",
27174
- ".java": "java",
27175
- ".kt": "kotlin",
27176
- ".kts": "kotlin",
27177
- ".c": "c",
27178
- ".h": "c",
27179
- ".cpp": "cpp",
27180
- ".cc": "cpp",
27181
- ".cxx": "cpp",
27182
- ".hpp": "cpp",
27183
- ".hh": "cpp",
27184
- ".rs": "rust",
27185
- ".rb": "ruby",
27186
- ".vue": "vue",
27187
- ".svelte": "svelte",
27188
- ".md": "markdown",
27189
- ".mdx": "markdown"
27190
- };
27191
- function detectLanguage(path) {
27192
- return LANGUAGE_BY_EXTENSION[extname(path).toLowerCase()] ?? null;
27361
+ /**
27362
+ * Suffix match of the first candidate that matches anything. Among several matches, keeps those sharing
27363
+ * the most leading directories with the importing file (the closest source root / package wins).
27364
+ */
27365
+ closestWithSuffix(from, candidates2) {
27366
+ for (const candidate of candidates2) {
27367
+ const suffix = normalizePath(candidate);
27368
+ const matches = suffix === null ? [] : this.withSuffix(suffix);
27369
+ if (matches.length === 0) continue;
27370
+ const fromDir = dirname(from);
27371
+ const scores = matches.map((path) => sharedPrefixLength(fromDir, dirname(path)));
27372
+ const best = Math.max(...scores);
27373
+ return matches.filter((_, i) => scores[i] === best);
27374
+ }
27375
+ return [];
27376
+ }
27377
+ };
27378
+ function pushTo(map2, key, value) {
27379
+ const list = map2.get(key);
27380
+ if (list === void 0) map2.set(key, [value]);
27381
+ else list.push(value);
27193
27382
  }
27194
27383
 
27195
27384
  // ../server/src/links/mentions.ts
@@ -27289,10 +27478,10 @@ function findMentions(files, skip) {
27289
27478
  }
27290
27479
  return mentions;
27291
27480
  }
27292
- function mentionedPaths(from, text, paths) {
27481
+ function mentionedPaths(from, text2, paths) {
27293
27482
  const found = /* @__PURE__ */ new Set();
27294
27483
  const seen = /* @__PURE__ */ new Set();
27295
- for (const [raw2] of text.matchAll(/[\w.\-/@$+~[\]]+/g)) {
27484
+ for (const [raw2] of text2.matchAll(/[\w.\-/@$+~[\]]+/g)) {
27296
27485
  const token = raw2.replace(/^\[+/, "").replace(/[.\]]+$/, "");
27297
27486
  if (seen.has(token) || !token.includes(".") && !token.includes("/")) continue;
27298
27487
  seen.add(token);
@@ -27315,12 +27504,12 @@ function mentionedPaths(from, text, paths) {
27315
27504
  }
27316
27505
  return found;
27317
27506
  }
27318
- function wordSet(text) {
27507
+ function wordSet(text2) {
27319
27508
  const words = /* @__PURE__ */ new Set();
27320
- for (const match2 of text.matchAll(/[\w$]+(?:[.-][\w$]+)*/g)) {
27509
+ for (const match2 of text2.matchAll(/[\w$]+(?:[.-][\w$]+)*/g)) {
27321
27510
  const word = match2[0];
27322
- const before = text[match2.index - 1];
27323
- const after = text[match2.index + word.length];
27511
+ const before = text2[match2.index - 1];
27512
+ const after = text2[match2.index + word.length];
27324
27513
  if (before === "/" || before === "\\" || after === "/" || after === "\\") continue;
27325
27514
  words.add(word);
27326
27515
  const parts = word.split(/([.-])/);
@@ -27336,307 +27525,23 @@ function wordSet(text) {
27336
27525
  return words;
27337
27526
  }
27338
27527
 
27339
- // ../server/src/links/resolve.ts
27340
- var FileIndex = class {
27341
- #paths = /* @__PURE__ */ new Set();
27342
- #byBasename = /* @__PURE__ */ new Map();
27343
- #byDir = /* @__PURE__ */ new Map();
27344
- /** Longest name first, so that `@acme/ui/forms` prefers a package named `@acme/ui/forms` over `@acme/ui`. */
27345
- #packages = [];
27346
- /** By crate name (`-` → `_`). */
27347
- #crates = /* @__PURE__ */ new Map();
27348
- constructor(paths, packages = []) {
27349
- for (const path of paths) {
27350
- if (this.#paths.has(path)) continue;
27351
- this.#paths.add(path);
27352
- pushTo(this.#byBasename, basename(path), path);
27353
- pushTo(this.#byDir, dirname(path), path);
27354
- }
27355
- for (const ref of packages) {
27356
- const root = ref.root === "" ? "" : normalizePath(ref.root);
27357
- if (ref.name === "" || root === null) continue;
27358
- const entries = ref.entries.flatMap((entry) => normalizePath(entry) ?? []);
27359
- const pkg = { name: ref.name, root, entries };
27360
- this.#packages.push(pkg);
27361
- const crate = ref.name.replaceAll("-", "_");
27362
- if (!this.#crates.has(crate)) this.#crates.set(crate, pkg);
27363
- }
27364
- this.#packages.sort((a, b) => b.name.length - a.name.length);
27365
- }
27366
- /** Package named by a bare specifier (`name` or `name/sub/path`), with the remaining subpath. */
27367
- packageFor(specifier) {
27368
- for (const pkg of this.#packages) {
27369
- if (specifier === pkg.name) return { pkg, subpath: "" };
27370
- if (specifier.startsWith(`${pkg.name}/`)) return { pkg, subpath: specifier.slice(pkg.name.length + 1) };
27371
- }
27372
- return null;
27373
- }
27374
- crate(name) {
27375
- return this.#crates.get(name);
27376
- }
27377
- /** First entry candidate of a package that is a changed file. */
27378
- entryOf(pkg) {
27379
- return pkg.entries.find((entry) => this.#paths.has(entry)) ?? null;
27380
- }
27381
- /** Root of the package containing `path`: the root that is its longest segment prefix; null when none. */
27382
- ownPackageRoot(path) {
27383
- let best = null;
27384
- for (const { root } of this.#packages) {
27385
- const contains = root === "" || path === root || path.startsWith(`${root}/`);
27386
- if (contains && (best === null || root.length > best.length)) best = root;
27387
- }
27388
- return best;
27389
- }
27390
- has(path) {
27391
- return path !== null && this.#paths.has(path);
27392
- }
27393
- /** Paths equal to `suffix` or ending with `/suffix`. */
27394
- withSuffix(suffix) {
27395
- const candidates = this.#byBasename.get(basename(suffix)) ?? [];
27396
- return candidates.filter((path) => path === suffix || path.endsWith(`/${suffix}`));
27397
- }
27398
- /** Paths whose directory equals `dirSuffix` or ends with `/dirSuffix`. */
27399
- inDirWithSuffix(dirSuffix) {
27400
- return [...this.#byDir].flatMap(
27401
- ([dir, paths]) => dir === dirSuffix || dir.endsWith(`/${dirSuffix}`) ? paths : []
27402
- );
27403
- }
27404
- directories() {
27405
- return this.#byDir.entries();
27406
- }
27407
- };
27408
- function pushTo(map2, key, value) {
27409
- const list = map2.get(key);
27410
- if (list === void 0) map2.set(key, [value]);
27411
- else list.push(value);
27412
- }
27413
- var RESOLVERS = {
27414
- typescript: resolveScript,
27415
- javascript: resolveScript,
27416
- vue: resolveScript,
27417
- svelte: resolveScript,
27418
- python: resolvePython,
27419
- css: resolveStyle,
27420
- go: resolveGo,
27421
- java: resolveJvm,
27422
- kotlin: resolveJvm,
27423
- c: resolveInclude,
27424
- cpp: resolveInclude,
27425
- rust: resolveRust,
27426
- ruby: resolveRuby,
27427
- markdown: () => []
27428
- };
27429
- function resolveImport(ref, from, language, index) {
27430
- return language === null ? [] : RESOLVERS[language](ref, from, index);
27431
- }
27432
- function importedPackageRoot(ref, language, index) {
27433
- if (language === "rust") {
27434
- const crate = ref.specifier.split("::")[0];
27435
- return (crate === void 0 ? void 0 : index.crate(crate))?.root ?? null;
27436
- }
27437
- const scriptLike = language === "typescript" || language === "javascript" || language === "vue" || language === "svelte";
27438
- return scriptLike && !ref.specifier.startsWith(".") ? index.packageFor(ref.specifier)?.pkg.root ?? null : null;
27439
- }
27440
- function firstRelative(dir, candidates, index) {
27441
- for (const candidate of candidates) {
27442
- const path = joinPath(dir, candidate);
27443
- if (index.has(path)) return path;
27444
- }
27445
- return null;
27446
- }
27447
- function closestWithSuffix(from, candidates, index) {
27448
- for (const candidate of candidates) {
27449
- const suffix = normalizePath(candidate);
27450
- const matches = suffix === null ? [] : index.withSuffix(suffix);
27451
- if (matches.length === 0) continue;
27452
- const fromDir = dirname(from);
27453
- const scores = matches.map((path) => sharedPrefixLength(fromDir, dirname(path)));
27454
- const best = Math.max(...scores);
27455
- return matches.filter((_, i) => scores[i] === best);
27456
- }
27457
- return [];
27458
- }
27459
- var SCRIPT_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".d.ts", ".js", ".jsx", ".mjs", ".cjs"];
27460
- var TS_COUNTERPARTS = {
27461
- ".js": [".ts", ".tsx"],
27462
- ".jsx": [".tsx"],
27463
- ".mjs": [".mts"],
27464
- ".cjs": [".cts"]
27465
- };
27466
- var ALIAS_PREFIX = /^(?:@\/|~\/|#\/?)/;
27467
- function scriptCandidates(base) {
27468
- const extension = extname(base);
27469
- const counterparts = (TS_COUNTERPARTS[extension] ?? []).map((ts2) => base.slice(0, -extension.length) + ts2);
27470
- return [
27471
- base,
27472
- ...counterparts,
27473
- ...SCRIPT_EXTENSIONS.map((ext) => base + ext),
27474
- ...SCRIPT_EXTENSIONS.map((ext) => `${base}/index${ext}`)
27475
- ];
27476
- }
27477
- function resolveScript(ref, from, index) {
27478
- const { specifier, names } = ref;
27479
- if (specifier.startsWith("./") || specifier.startsWith("../") || specifier === "." || specifier === "..") {
27480
- const path = firstRelative(dirname(from), scriptCandidates(specifier), index);
27481
- return path === null ? [] : [{ path, names }];
27482
- }
27483
- const workspace = index.packageFor(specifier);
27484
- if (workspace !== null) {
27485
- const path = resolveWorkspaceImport(workspace.pkg, workspace.subpath, index);
27486
- return path === null ? [] : [{ path, names }];
27487
- }
27488
- if (!ALIAS_PREFIX.test(specifier) && !specifier.startsWith("/")) return [];
27489
- const remainder = specifier.replace(ALIAS_PREFIX, "").replace(/^\/+/, "");
27490
- if (remainder === "") return [];
27491
- return closestWithSuffix(from, scriptCandidates(remainder), index).map((path) => ({ path, names }));
27492
- }
27493
- function resolveWorkspaceImport(pkg, subpath, index) {
27494
- if (subpath === "") return index.entryOf(pkg);
27495
- return firstRelative(pkg.root, scriptCandidates(subpath), index) ?? firstRelative(pkg.root, scriptCandidates(`src/${subpath}`), index);
27496
- }
27497
- function resolvePython(ref, from, index) {
27498
- const targets = [];
27499
- const memberNames = [];
27500
- for (const name of ref.names) {
27501
- const submoduleName = ref.specifier.endsWith(".") ? ref.specifier + name : `${ref.specifier}.${name}`;
27502
- const submodule = name === "*" ? [] : findPythonModule(submoduleName, from, index);
27503
- if (submodule.length === 0) memberNames.push(name);
27504
- for (const path of submodule) targets.push({ path, names: [name] });
27505
- }
27506
- if (ref.names.length === 0 || memberNames.length > 0) {
27507
- const names = ref.names.length === 0 ? [ref.specifier] : memberNames;
27508
- for (const path of findPythonModule(ref.specifier, from, index)) targets.push({ path, names });
27509
- }
27510
- return targets;
27511
- }
27512
- function findPythonModule(module, from, index) {
27513
- const dots = /^\.*/.exec(module)?.[0].length ?? 0;
27514
- const modulePath = module.slice(dots).split(".").filter(Boolean).join("/");
27515
- const candidates = modulePath === "" ? ["__init__.py"] : [`${modulePath}.py`, `${modulePath}/__init__.py`];
27516
- if (dots === 0) return closestWithSuffix(from, candidates, index);
27517
- let base = dirname(from);
27518
- for (let level = 1; level < dots && base !== null; level++) base = base === "" ? null : dirname(base);
27519
- const path = base === null ? null : firstRelative(base, candidates, index);
27520
- return path === null ? [] : [path];
27521
- }
27522
- var STYLE_EXTENSIONS = [".scss", ".sass", ".css", ".less"];
27523
- function styleCandidates(base) {
27524
- const dir = dirname(base);
27525
- const partial2 = `${dir === "" ? "" : `${dir}/`}_${basename(base)}`;
27526
- if (STYLE_EXTENSIONS.includes(extname(base))) return [base, partial2];
27527
- return [
27528
- base,
27529
- ...STYLE_EXTENSIONS.flatMap((ext) => [base + ext, partial2 + ext]),
27530
- ...STYLE_EXTENSIONS.flatMap((ext) => [`${base}/_index${ext}`, `${base}/index${ext}`])
27531
- ];
27532
- }
27533
- function resolveStyle(ref, from, index) {
27534
- const specifier = ref.specifier.replace(/^~/, "");
27535
- if (/^(?:[a-z]+:|\/\/)/i.test(specifier)) return [];
27536
- const candidates = styleCandidates(specifier);
27537
- const relative2 = firstRelative(dirname(from), candidates, index);
27538
- if (relative2 !== null) return [{ path: relative2, names: ref.names }];
27539
- if (specifier.startsWith(".")) return [];
27540
- return closestWithSuffix(from, candidates, index).map((path) => ({ path, names: ref.names }));
27541
- }
27542
- function resolveGo(ref, from, index) {
27543
- const importSegments = ref.specifier.split("/");
27544
- const ownDir = dirname(from);
27545
- let best = 0;
27546
- let packages = [];
27547
- for (const [dir, paths] of index.directories()) {
27548
- const sources = paths.filter((path) => path.endsWith(".go") && !path.endsWith("_test.go"));
27549
- if (dir === ownDir || sources.length === 0) continue;
27550
- const score = trailingMatch(dir === "" ? [] : dir.split("/"), importSegments);
27551
- if (score === 0 || score < best) continue;
27552
- if (score > best) packages = [];
27553
- best = score;
27554
- packages.push(sources);
27555
- }
27556
- return packages.flat().map((path) => ({ path, names: ref.names }));
27557
- }
27558
- function trailingMatch(a, b) {
27559
- let count = 0;
27560
- while (count < a.length && count < b.length && a[a.length - 1 - count] === b[b.length - 1 - count]) count++;
27561
- return count;
27562
- }
27563
- var JVM_EXTENSIONS = [".java", ".kt"];
27564
- function resolveJvm(ref, from, index) {
27565
- const segments = ref.specifier.split(".");
27566
- if (segments.at(-1) === "*") {
27567
- return index.inDirWithSuffix(segments.slice(0, -1).join("/")).filter((path) => path !== from && JVM_EXTENSIONS.includes(extname(path))).map((path) => ({ path, names: ref.names }));
27568
- }
27569
- for (let length = segments.length; length >= Math.min(2, segments.length); length--) {
27570
- const base = segments.slice(0, length).join("/");
27571
- const matches = closestWithSuffix(
27572
- from,
27573
- JVM_EXTENSIONS.map((ext) => base + ext),
27574
- index
27575
- );
27576
- if (matches.length > 0) return matches.map((path) => ({ path, names: ref.names }));
27577
- }
27578
- return [];
27579
- }
27580
- function resolveInclude(ref, from, index) {
27581
- const relative2 = firstRelative(dirname(from), [ref.specifier], index);
27582
- const paths = relative2 === null ? closestWithSuffix(from, [ref.specifier], index) : [relative2];
27583
- return paths.map((path) => ({ path, names: ref.names }));
27584
- }
27585
- var RUST_ROOT_STEMS = { mod: true, lib: true, main: true };
27586
- function rustModuleDir(file2) {
27587
- const stem = fileStem(file2);
27588
- const dir = dirname(file2);
27589
- if (Object.hasOwn(RUST_ROOT_STEMS, stem)) return dir;
27590
- return dir === "" ? stem : `${dir}/${stem}`;
27591
- }
27592
- function resolveRust(ref, from, index) {
27593
- const [root, ...rest] = ref.specifier.split("::");
27594
- let base = null;
27595
- if (root === "self" || root === "super") {
27596
- base = rustModuleDir(from);
27597
- if (root === "super") base = base === "" ? null : dirname(base);
27598
- while (rest[0] === "super" && base !== null) {
27599
- rest.shift();
27600
- base = base === "" ? null : dirname(base);
27601
- }
27602
- if (base === null) return [];
27603
- } else if (root !== "crate") {
27604
- const crate = root === void 0 ? void 0 : index.crate(root);
27605
- const entry = crate === void 0 ? null : index.entryOf(crate);
27606
- return entry === null ? [] : [{ path: entry, names: ref.names }];
27607
- }
27608
- for (let length = rest.length; length >= 1; length--) {
27609
- const modulePath = rest.slice(0, length).join("/");
27610
- const candidates = [`${modulePath}.rs`, `${modulePath}/mod.rs`];
27611
- const relative2 = base === null ? null : firstRelative(base, candidates, index);
27612
- const paths = base === null ? closestWithSuffix(from, candidates, index) : relative2 === null ? [] : [relative2];
27613
- if (paths.length > 0) return paths.map((path) => ({ path, names: ref.names }));
27614
- }
27615
- return [];
27616
- }
27617
- function resolveRuby(ref, from, index) {
27618
- const candidate = ref.specifier.endsWith(".rb") ? ref.specifier : `${ref.specifier}.rb`;
27619
- const path = firstRelative(dirname(from), [candidate], index);
27620
- return path === null ? [] : [{ path, names: ref.names }];
27621
- }
27622
-
27623
27528
  // ../server/src/links/index.ts
27624
27529
  var MAX_PARSED_TEXT = 1e6;
27625
27530
  var MAX_DETAIL = 8;
27626
- function buildLinkGraph(files, options = {}) {
27627
- const languages = {};
27531
+ function buildLinkGraph(files, languages2, options = {}) {
27532
+ const languageIds = {};
27628
27533
  const externalImports = {};
27629
27534
  const packageImports = {};
27630
27535
  const indexed = /* @__PURE__ */ new Map();
27631
27536
  for (const file2 of files) {
27632
- const language = detectLanguage(file2.path);
27633
- languages[file2.path] = language;
27537
+ const language = languages2.detect(file2.path);
27538
+ languageIds[file2.path] = language?.info.id ?? null;
27634
27539
  externalImports[file2.path] = 0;
27635
27540
  packageImports[file2.path] = [];
27636
27541
  const key = normalizePath(file2.path);
27637
27542
  if (key === null || indexed.has(key)) continue;
27638
- const text = file2.text !== null && file2.text.length <= MAX_PARSED_TEXT ? file2.text : null;
27639
- indexed.set(key, { path: file2.path, key, language, text });
27543
+ const readable = language !== null && file2.text !== null && file2.text.length <= MAX_PARSED_TEXT;
27544
+ indexed.set(key, { path: file2.path, key, language, text: readable ? file2.text : null });
27640
27545
  }
27641
27546
  const edges = /* @__PURE__ */ new Map();
27642
27547
  const addEdge = (from, toKey, kind, detail) => {
@@ -27658,7 +27563,7 @@ function buildLinkGraph(files, options = {}) {
27658
27563
  for (const target of targets.resolved) addEdge(file2, target.path, "import", target.names);
27659
27564
  }
27660
27565
  const mentions = findMentions(
27661
- [...indexed.values()].map(({ key, text }) => ({ path: key, text })),
27566
+ [...indexed.values()].map(({ key, text: text2 }) => ({ path: key, text: text2 })),
27662
27567
  (from, to) => edges.has(`import\0${from}\0${to}`)
27663
27568
  );
27664
27569
  for (const mention of mentions) {
@@ -27672,7 +27577,7 @@ function buildLinkGraph(files, options = {}) {
27672
27577
  ...edge,
27673
27578
  detail: [...detail].slice(0, MAX_DETAIL)
27674
27579
  })),
27675
- languages,
27580
+ languages: languageIds,
27676
27581
  externalImports,
27677
27582
  packageImports
27678
27583
  };
@@ -27681,14 +27586,16 @@ function importTargets(file2, index) {
27681
27586
  const resolved = [];
27682
27587
  const packageRoots = /* @__PURE__ */ new Set();
27683
27588
  let unresolved = 0;
27684
- if (file2.text === null) return { resolved, unresolved, packageRoots: [] };
27589
+ const { language, text: text2 } = file2;
27590
+ if (language?.extractImports === void 0 || text2 === null)
27591
+ return { resolved, unresolved, packageRoots: [] };
27685
27592
  const ownRoot = index.ownPackageRoot(file2.key);
27686
27593
  try {
27687
- for (const ref of extractImports(file2.text, file2.key, file2.language)) {
27688
- const targets = resolveImport(ref, file2.key, file2.language, index);
27594
+ for (const ref of language.extractImports(text2, file2.key)) {
27595
+ const targets = language.resolveImport?.(ref, file2.key, index) ?? [];
27689
27596
  if (targets.length === 0) unresolved++;
27690
27597
  resolved.push(...targets);
27691
- const root = importedPackageRoot(ref, file2.language, index);
27598
+ const root = language.importedPackageRoot?.(ref, index) ?? null;
27692
27599
  if (root !== null && root !== ownRoot) packageRoots.add(root);
27693
27600
  }
27694
27601
  } catch {
@@ -27697,459 +27604,6 @@ function importTargets(file2, index) {
27697
27604
  return { resolved, unresolved, packageRoots: [...packageRoots].sort() };
27698
27605
  }
27699
27606
 
27700
- // ../server/src/packages/toml.ts
27701
- var TomlSyntaxError = class extends Error {
27702
- };
27703
- var ESCAPES = {
27704
- b: "\b",
27705
- t: " ",
27706
- n: "\n",
27707
- f: "\f",
27708
- r: "\r",
27709
- e: "\x1B",
27710
- '"': '"',
27711
- "\\": "\\"
27712
- };
27713
- var BARE_KEY = /[A-Za-z0-9_-]+/y;
27714
- var BARE_VALUE = /[^,\]}\r\n#]+/y;
27715
- var BASIC_STRING = /"((?:\\.|[^"\\\r\n])*)"/y;
27716
- function parseToml(text) {
27717
- return new TomlReader(text).document();
27718
- }
27719
- var TomlReader = class {
27720
- text;
27721
- pos = 0;
27722
- constructor(text) {
27723
- this.text = text;
27724
- }
27725
- document() {
27726
- const root = /* @__PURE__ */ new Map();
27727
- let current = root;
27728
- while (this.pos < this.text.length) {
27729
- this.skipBlank();
27730
- const ch = this.text[this.pos];
27731
- if (ch === void 0) break;
27732
- if (ch === "\n" || ch === "\r" || ch === "#") {
27733
- this.skipLine();
27734
- continue;
27735
- }
27736
- try {
27737
- if (ch === "[") current = this.header(root);
27738
- else this.keyValue(current);
27739
- this.endOfLine();
27740
- } catch (error62) {
27741
- if (!(error62 instanceof TomlSyntaxError)) throw error62;
27742
- if (ch === "[") current = /* @__PURE__ */ new Map();
27743
- this.skipLine();
27744
- }
27745
- }
27746
- return root;
27747
- }
27748
- /** `[a.b]` or `[[a.b]]`; returns the table that receives the following keys. */
27749
- header(root) {
27750
- const isArray = this.text.startsWith("[[", this.pos);
27751
- this.pos += isArray ? 2 : 1;
27752
- const { parents, last } = this.key();
27753
- this.expect(isArray ? "]]" : "]");
27754
- const table = parents.reduce(child, root);
27755
- if (!isArray) return child(table, last);
27756
- const existing = table.get(last);
27757
- const list = Array.isArray(existing) ? existing : [];
27758
- const created = /* @__PURE__ */ new Map();
27759
- list.push(created);
27760
- table.set(last, list);
27761
- return created;
27762
- }
27763
- keyValue(table) {
27764
- const { parents, last } = this.key();
27765
- this.expect("=");
27766
- this.skipBlank();
27767
- parents.reduce(child, table).set(last, this.value());
27768
- }
27769
- /** A possibly dotted key, split into its parent path and final segment. */
27770
- key() {
27771
- const parents = [];
27772
- let last = this.simpleKey();
27773
- for (; ; ) {
27774
- this.skipBlank();
27775
- if (this.text[this.pos] !== ".") return { parents, last };
27776
- this.pos++;
27777
- parents.push(last);
27778
- last = this.simpleKey();
27779
- }
27780
- }
27781
- simpleKey() {
27782
- this.skipBlank();
27783
- const ch = this.text[this.pos];
27784
- if (ch === '"') return this.basicString();
27785
- if (ch === "'") return this.literalString();
27786
- BARE_KEY.lastIndex = this.pos;
27787
- const match2 = BARE_KEY.exec(this.text);
27788
- if (match2 === null) throw new TomlSyntaxError(`Invalid key at ${this.pos}`);
27789
- this.pos = BARE_KEY.lastIndex;
27790
- return match2[0];
27791
- }
27792
- value() {
27793
- if (this.text.startsWith('"""', this.pos)) return this.multilineString('"""');
27794
- if (this.text.startsWith("'''", this.pos)) return this.multilineString("'''");
27795
- switch (this.text[this.pos]) {
27796
- case '"':
27797
- return this.basicString();
27798
- case "'":
27799
- return this.literalString();
27800
- case "[":
27801
- return this.array();
27802
- case "{":
27803
- return this.inlineTable();
27804
- default: {
27805
- BARE_VALUE.lastIndex = this.pos;
27806
- const match2 = BARE_VALUE.exec(this.text);
27807
- if (match2 === null || match2[0].trim() === "")
27808
- throw new TomlSyntaxError(`Missing value at ${this.pos}`);
27809
- this.pos = BARE_VALUE.lastIndex;
27810
- return null;
27811
- }
27812
- }
27813
- }
27814
- basicString() {
27815
- BASIC_STRING.lastIndex = this.pos;
27816
- const match2 = BASIC_STRING.exec(this.text);
27817
- if (match2 === null) throw new TomlSyntaxError(`Unterminated string at ${this.pos}`);
27818
- this.pos = BASIC_STRING.lastIndex;
27819
- return decodeEscapes(match2[1] ?? "");
27820
- }
27821
- literalString() {
27822
- const start = this.pos + 1;
27823
- const end = this.text.indexOf("'", start);
27824
- const newline = this.text.indexOf("\n", start);
27825
- if (end === -1 || newline !== -1 && newline < end) {
27826
- throw new TomlSyntaxError(`Unterminated string at ${this.pos}`);
27827
- }
27828
- this.pos = end + 1;
27829
- return this.text.slice(start, end);
27830
- }
27831
- /** `"""…"""` (with escapes and line-ending backslashes) or `'''…'''` (verbatim). */
27832
- multilineString(delimiter) {
27833
- let start = this.pos + 3;
27834
- if (this.text.startsWith("\r\n", start)) start += 2;
27835
- else if (this.text[start] === "\n") start++;
27836
- let end = this.text.indexOf(delimiter, start);
27837
- if (end === -1) throw new TomlSyntaxError(`Unterminated string at ${this.pos}`);
27838
- for (let extra = 0; extra < 2 && this.text[end + 3] === delimiter[0]; extra++) end++;
27839
- this.pos = end + 3;
27840
- const raw2 = this.text.slice(start, end);
27841
- return delimiter === "'''" ? raw2 : decodeEscapes(raw2.replace(/\\[ \t]*\r?\n\s*/g, ""));
27842
- }
27843
- array() {
27844
- this.pos++;
27845
- const items = [];
27846
- for (; ; ) {
27847
- this.skipInsignificant();
27848
- if (this.text[this.pos] === "]") {
27849
- this.pos++;
27850
- return items;
27851
- }
27852
- items.push(this.value());
27853
- this.skipInsignificant();
27854
- const ch = this.text[this.pos];
27855
- this.pos++;
27856
- if (ch === "]") return items;
27857
- if (ch !== ",") throw new TomlSyntaxError(`Expected , or ] at ${this.pos - 1}`);
27858
- }
27859
- }
27860
- /** `{ a = 1, b.c = "x" }`; newlines are tolerated inside, as many real manifests use them. */
27861
- inlineTable() {
27862
- this.pos++;
27863
- const table = /* @__PURE__ */ new Map();
27864
- for (; ; ) {
27865
- this.skipInsignificant();
27866
- if (this.text[this.pos] === "}") {
27867
- this.pos++;
27868
- return table;
27869
- }
27870
- this.keyValue(table);
27871
- this.skipInsignificant();
27872
- const ch = this.text[this.pos];
27873
- this.pos++;
27874
- if (ch === "}") return table;
27875
- if (ch !== ",") throw new TomlSyntaxError(`Expected , or } at ${this.pos - 1}`);
27876
- }
27877
- }
27878
- expect(token) {
27879
- this.skipBlank();
27880
- if (!this.text.startsWith(token, this.pos)) throw new TomlSyntaxError(`Expected ${token} at ${this.pos}`);
27881
- this.pos += token.length;
27882
- }
27883
- endOfLine() {
27884
- this.skipBlank();
27885
- const ch = this.text[this.pos];
27886
- if (ch === void 0 || ch === "#") this.skipLine();
27887
- else if (ch === "\n") this.pos++;
27888
- else if (this.text.startsWith("\r\n", this.pos)) this.pos += 2;
27889
- else throw new TomlSyntaxError(`Unexpected ${ch} at ${this.pos}`);
27890
- }
27891
- skipBlank() {
27892
- while (this.text[this.pos] === " " || this.text[this.pos] === " ") this.pos++;
27893
- }
27894
- /** Whitespace, newlines and comments, as allowed between array or inline-table items. */
27895
- skipInsignificant() {
27896
- for (; ; ) {
27897
- const ch = this.text[this.pos];
27898
- if (ch === " " || ch === " " || ch === "\n" || ch === "\r") this.pos++;
27899
- else if (ch === "#") this.skipLine();
27900
- else return;
27901
- }
27902
- }
27903
- skipLine() {
27904
- const newline = this.text.indexOf("\n", this.pos);
27905
- this.pos = newline === -1 ? this.text.length : newline + 1;
27906
- }
27907
- };
27908
- function child(table, key) {
27909
- const existing = table.get(key);
27910
- if (existing instanceof Map) return existing;
27911
- if (Array.isArray(existing)) {
27912
- const last = existing.at(-1);
27913
- if (last instanceof Map) return last;
27914
- }
27915
- const created = /* @__PURE__ */ new Map();
27916
- table.set(key, created);
27917
- return created;
27918
- }
27919
- function decodeEscapes(raw2) {
27920
- return raw2.replace(
27921
- /\\(?:u([0-9A-Fa-f]{4})|U([0-9A-Fa-f]{8})|([\s\S]))/g,
27922
- (match2, short, long, ch) => {
27923
- const hex3 = short ?? long;
27924
- if (hex3 !== void 0) {
27925
- const codePoint = Number.parseInt(hex3, 16);
27926
- return codePoint <= 1114111 ? String.fromCodePoint(codePoint) : "\uFFFD";
27927
- }
27928
- return ch !== void 0 && Object.hasOwn(ESCAPES, ch) ? ESCAPES[ch] ?? match2 : match2;
27929
- }
27930
- );
27931
- }
27932
-
27933
- // ../server/src/packages/manifests.ts
27934
- var MANIFEST_KINDS = {
27935
- "package.json": { ecosystem: "npm", priority: 0, read: readPackageJson },
27936
- "pyproject.toml": { ecosystem: "python", priority: 1, read: readPyproject },
27937
- "setup.py": { ecosystem: "python", priority: 2, read: readSetupPy },
27938
- "Cargo.toml": { ecosystem: "rust", priority: 3, read: readCargoToml },
27939
- "go.mod": { ecosystem: "go", priority: 4, read: readGoMod },
27940
- "pom.xml": { ecosystem: "maven", priority: 5, read: readPom },
27941
- "build.gradle": { ecosystem: "gradle", priority: 6, read: readGradle },
27942
- "build.gradle.kts": { ecosystem: "gradle", priority: 6, read: readGradle },
27943
- "composer.json": { ecosystem: "composer", priority: 7, read: readComposerJson }
27944
- };
27945
- function manifestKind(basename2) {
27946
- return Object.hasOwn(MANIFEST_KINDS, basename2) ? MANIFEST_KINDS[basename2] : void 0;
27947
- }
27948
- function readManifest(kind, text) {
27949
- if (text !== null) {
27950
- try {
27951
- return kind.read(text);
27952
- } catch {
27953
- }
27954
- }
27955
- return { name: null, deps: [], paths: [] };
27956
- }
27957
- function nonEmptyString(value) {
27958
- return typeof value === "string" && value.trim() !== "" ? value.trim() : null;
27959
- }
27960
- var DeclaredName = external_exports.string().optional().catch(void 0);
27961
- var DependencyMap = external_exports.record(external_exports.string(), external_exports.unknown()).optional().catch(void 0);
27962
- var PackageJson = external_exports.object({
27963
- name: DeclaredName,
27964
- dependencies: DependencyMap,
27965
- devDependencies: DependencyMap,
27966
- peerDependencies: DependencyMap,
27967
- optionalDependencies: DependencyMap
27968
- });
27969
- var ComposerJson = external_exports.object({ name: DeclaredName, require: DependencyMap, "require-dev": DependencyMap });
27970
- var NPM_LOCAL_SPEC = /^(?:file|link|portal):(.+)$/;
27971
- function readPackageJson(text) {
27972
- const data = PackageJson.parse(JSON.parse(text));
27973
- const deps = [];
27974
- const paths = [];
27975
- for (const entries of [
27976
- data.dependencies,
27977
- data.devDependencies,
27978
- data.peerDependencies,
27979
- data.optionalDependencies
27980
- ]) {
27981
- for (const [dep, spec] of Object.entries(entries ?? {})) {
27982
- deps.push(dep);
27983
- const local = typeof spec === "string" ? NPM_LOCAL_SPEC.exec(spec)?.[1] : void 0;
27984
- if (local !== void 0) paths.push(local);
27985
- }
27986
- }
27987
- return { name: nonEmptyString(data.name), deps, paths };
27988
- }
27989
- function readComposerJson(text) {
27990
- const data = ComposerJson.parse(JSON.parse(text));
27991
- const deps = [...Object.keys(data.require ?? {}), ...Object.keys(data["require-dev"] ?? {})];
27992
- return { name: nonEmptyString(data.name), deps, paths: [] };
27993
- }
27994
- function tomlAt(table, ...keys) {
27995
- let value = table;
27996
- for (const key of keys) value = value instanceof Map ? value.get(key) : void 0;
27997
- return value;
27998
- }
27999
- function requirementName(requirement) {
28000
- return /^\s*([A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?)/.exec(requirement)?.[1] ?? null;
28001
- }
28002
- function readPyproject(text) {
28003
- const doc = parseToml(text);
28004
- const deps = [];
28005
- const paths = [];
28006
- const requirements = (value) => {
28007
- if (!Array.isArray(value)) return;
28008
- for (const item of value) {
28009
- const name2 = typeof item === "string" ? requirementName(item) : null;
28010
- if (name2 !== null) deps.push(name2);
28011
- }
28012
- };
28013
- const keyedDependencies = (value) => {
28014
- if (!(value instanceof Map)) return;
28015
- for (const [dep, spec] of value) {
28016
- if (dep !== "python") deps.push(dep);
28017
- const path = nonEmptyString(tomlAt(spec instanceof Map ? spec : void 0, "path"));
28018
- if (path !== null) paths.push(path);
28019
- }
28020
- };
28021
- requirements(tomlAt(doc, "project", "dependencies"));
28022
- const optional2 = tomlAt(doc, "project", "optional-dependencies");
28023
- if (optional2 instanceof Map) for (const group of optional2.values()) requirements(group);
28024
- const dependencyGroups = tomlAt(doc, "dependency-groups");
28025
- if (dependencyGroups instanceof Map) for (const group of dependencyGroups.values()) requirements(group);
28026
- const poetry = tomlAt(doc, "tool", "poetry");
28027
- keyedDependencies(tomlAt(doc, "tool", "poetry", "dependencies"));
28028
- keyedDependencies(tomlAt(doc, "tool", "poetry", "dev-dependencies"));
28029
- const poetryGroups = tomlAt(doc, "tool", "poetry", "group");
28030
- if (poetryGroups instanceof Map) {
28031
- for (const group of poetryGroups.values()) {
28032
- keyedDependencies(tomlAt(group instanceof Map ? group : void 0, "dependencies"));
28033
- }
28034
- }
28035
- keyedDependencies(tomlAt(doc, "tool", "uv", "sources"));
28036
- const name = nonEmptyString(tomlAt(doc, "project", "name")) ?? nonEmptyString(tomlAt(poetry instanceof Map ? poetry : void 0, "name"));
28037
- return { name, deps, paths };
28038
- }
28039
- var CARGO_DEPENDENCY_TABLES = ["dependencies", "dev-dependencies", "build-dependencies"];
28040
- function readCargoToml(text) {
28041
- const doc = parseToml(text);
28042
- const deps = [];
28043
- const paths = [];
28044
- const tables = [
28045
- ...CARGO_DEPENDENCY_TABLES.map((key) => doc.get(key)),
28046
- tomlAt(doc, "workspace", "dependencies")
28047
- ];
28048
- const targets = doc.get("target");
28049
- if (targets instanceof Map) {
28050
- for (const target of targets.values()) {
28051
- if (target instanceof Map) tables.push(...CARGO_DEPENDENCY_TABLES.map((key) => target.get(key)));
28052
- }
28053
- }
28054
- for (const table of tables) {
28055
- if (!(table instanceof Map)) continue;
28056
- for (const [key, spec] of table) {
28057
- const detail = spec instanceof Map ? spec : void 0;
28058
- deps.push(nonEmptyString(tomlAt(detail, "package")) ?? key);
28059
- const path = nonEmptyString(tomlAt(detail, "path"));
28060
- if (path !== null) paths.push(path);
28061
- }
28062
- }
28063
- return { name: nonEmptyString(tomlAt(doc, "package", "name")), deps, paths };
28064
- }
28065
- var PYTHON_LIST_TOKEN = /(['"])((?:\\.|(?!\1)[^\\\n])*)\1|#[^\n]*|[\])]/g;
28066
- function readSetupPy(text) {
28067
- const name = /\bname\s*=\s*(['"])([^'"\n]+)\1/.exec(text)?.[2] ?? null;
28068
- const deps = [];
28069
- const opener = /\binstall_requires\s*=\s*[[(]/.exec(text);
28070
- if (opener !== null) {
28071
- PYTHON_LIST_TOKEN.lastIndex = opener.index + opener[0].length;
28072
- for (let token = PYTHON_LIST_TOKEN.exec(text); token !== null; token = PYTHON_LIST_TOKEN.exec(text)) {
28073
- if (token[0] === "]" || token[0] === ")") break;
28074
- const dep = token[1] !== void 0 ? requirementName(token[2] ?? "") : null;
28075
- if (dep !== null) deps.push(dep);
28076
- }
28077
- }
28078
- return { name: nonEmptyString(name), deps, paths: [] };
28079
- }
28080
- function readGoMod(text) {
28081
- let name = null;
28082
- const deps = [];
28083
- const paths = [];
28084
- const directive = (verb, args) => {
28085
- const first = args.split(/\s+/)[0]?.replace(/^"(.*)"$/, "$1") ?? "";
28086
- if (verb === "module" && first !== "") name = first;
28087
- else if (verb === "require" && first !== "") deps.push(first);
28088
- else if (verb === "replace") {
28089
- const target = args.split("=>")[1]?.trim().split(/\s+/)[0] ?? "";
28090
- if (/^\.\.?(?:\/|$)/.test(target)) paths.push(target);
28091
- }
28092
- };
28093
- let block = null;
28094
- for (const raw2 of text.split("\n")) {
28095
- const commentAt = raw2.indexOf("//");
28096
- const line = (commentAt === -1 ? raw2 : raw2.slice(0, commentAt)).trim();
28097
- if (line === "") continue;
28098
- if (block !== null) {
28099
- if (line === ")") block = null;
28100
- else directive(block, line);
28101
- continue;
28102
- }
28103
- const match2 = /^([a-z]+)\s*(.*)$/.exec(line);
28104
- const verb = match2?.[1];
28105
- const args = match2?.[2] ?? "";
28106
- if (verb === void 0) continue;
28107
- if (args === "(") block = verb;
28108
- else directive(verb, args);
28109
- }
28110
- return { name, deps, paths };
28111
- }
28112
- var XML_TAG = /<(\/?)([A-Za-z_][\w.:-]*)[^>]*?(\/?)>/g;
28113
- function readPom(text) {
28114
- const xml = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<!\[CDATA\[[\s\S]*?\]\]>/g, "");
28115
- const stack = [];
28116
- let name = null;
28117
- const deps = [];
28118
- for (const match2 of xml.matchAll(XML_TAG)) {
28119
- const [whole, closing, qualified = "", selfClosing] = match2;
28120
- const tag = qualified.slice(qualified.lastIndexOf(":") + 1);
28121
- if (selfClosing === "/") continue;
28122
- if (closing !== "/") {
28123
- stack.push({ tag, contentStart: match2.index + whole.length });
28124
- continue;
28125
- }
28126
- const openAt = stack.findLastIndex((element) => element.tag === tag);
28127
- const open2 = stack[openAt];
28128
- if (open2 === void 0) continue;
28129
- if (tag === "artifactId") {
28130
- const value = nonEmptyString(xml.slice(open2.contentStart, match2.index));
28131
- const ancestors = stack.slice(0, openAt).map((element) => element.tag);
28132
- if (value !== null && ancestors.length === 1 && ancestors[0] === "project") name ??= value;
28133
- else if (value !== null && ancestors.at(-1) === "dependency" && !ancestors.includes("dependencyManagement")) {
28134
- deps.push(value);
28135
- }
28136
- }
28137
- stack.length = openAt;
28138
- }
28139
- return { name, deps, paths: [] };
28140
- }
28141
- var C_COMMENT_OR_STRING = /("(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*')|\/\/[^\n]*|\/\*[\s\S]*?\*\//g;
28142
- var GRADLE_PROJECT_REF = /\bproject\s*\(\s*(?:path\s*[:=]\s*)?(['"])(:[^'"]*)\1/g;
28143
- function readGradle(text) {
28144
- const code = text.replace(C_COMMENT_OR_STRING, (_match, literal2) => literal2 ?? "");
28145
- const deps = [];
28146
- for (const match2 of code.matchAll(GRADLE_PROJECT_REF)) {
28147
- const path = (match2[2] ?? "").split(":").filter(Boolean).join("/");
28148
- if (path !== "") deps.push(path);
28149
- }
28150
- return { name: null, deps, paths: [] };
28151
- }
28152
-
28153
27607
  // ../server/src/packages/index.ts
28154
27608
  var REPO_ROOT_NAME = "(racine)";
28155
27609
  var EXCLUDED_DIRS = {
@@ -28157,53 +27611,72 @@ var EXCLUDED_DIRS = {
28157
27611
  vendor: true,
28158
27612
  dist: true,
28159
27613
  build: true,
28160
- target: true,
28161
27614
  out: true,
28162
27615
  ".git": true,
28163
- ".venv": true,
28164
- venv: true,
28165
- __pycache__: true,
28166
27616
  coverage: true,
28167
27617
  fixtures: true,
28168
27618
  __fixtures__: true,
28169
27619
  testdata: true,
28170
27620
  __mocks__: true
28171
27621
  };
28172
- function isManifestPath(path) {
27622
+ function manifestKind(basename2, ecosystems2) {
27623
+ let priority = 0;
27624
+ for (const ecosystem of ecosystems2) {
27625
+ for (const manifest of ecosystem.manifests) {
27626
+ if (manifest === basename2) return { ecosystem, priority };
27627
+ priority++;
27628
+ }
27629
+ }
27630
+ return void 0;
27631
+ }
27632
+ function isManifestPath(path, ecosystems2) {
28173
27633
  const segments = path.split("/");
28174
27634
  const basename2 = segments.pop() ?? "";
28175
- return manifestKind(basename2) !== void 0 && !segments.some((segment) => Object.hasOwn(EXCLUDED_DIRS, segment));
27635
+ return manifestKind(basename2, ecosystems2) !== void 0 && !segments.some((segment) => Object.hasOwn(EXCLUDED_DIRS, segment));
27636
+ }
27637
+ function readManifest(ecosystem, path, text2) {
27638
+ if (text2 !== null) {
27639
+ try {
27640
+ return ecosystem.readManifest(text2, path.slice(path.lastIndexOf("/") + 1));
27641
+ } catch {
27642
+ }
27643
+ }
27644
+ return { name: null, deps: [], paths: [] };
28176
27645
  }
28177
- function parseWorkspace(manifests) {
27646
+ function parseWorkspace(manifests, ecosystems2) {
28178
27647
  const chosen = /* @__PURE__ */ new Map();
28179
27648
  for (const file2 of manifests) {
28180
27649
  const slash = file2.path.lastIndexOf("/");
28181
- const kind = isManifestPath(file2.path) ? manifestKind(file2.path.slice(slash + 1)) : void 0;
27650
+ const kind = isManifestPath(file2.path, ecosystems2) ? manifestKind(file2.path.slice(slash + 1), ecosystems2) : void 0;
28182
27651
  if (kind === void 0) continue;
28183
27652
  const root = slash === -1 ? "" : file2.path.slice(0, slash);
28184
27653
  const current = chosen.get(root);
28185
27654
  const wins = current === void 0 || kind.priority < current.kind.priority || kind.priority === current.kind.priority && file2.path < current.file.path;
28186
27655
  if (wins) chosen.set(root, { file: file2, kind });
28187
27656
  }
28188
- const parsed = [...chosen].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([root, { file: file2, kind }]) => ({ root, path: file2.path, kind, info: readManifest(kind, file2.text) }));
27657
+ const parsed = [...chosen].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([root, { file: file2, kind }]) => ({
27658
+ root,
27659
+ path: file2.path,
27660
+ ecosystem: kind.ecosystem,
27661
+ info: readManifest(kind.ecosystem, file2.path, file2.text)
27662
+ }));
28189
27663
  const byName = /* @__PURE__ */ new Map();
28190
- for (const { root, kind, info } of parsed) {
27664
+ const matchKey = (ecosystem, name) => ecosystem.normalizeName?.(name) ?? name;
27665
+ for (const { root, ecosystem, info } of parsed) {
28191
27666
  if (info.name === null) continue;
28192
- let names = byName.get(kind.ecosystem);
27667
+ let names = byName.get(ecosystem);
28193
27668
  if (names === void 0) {
28194
27669
  names = /* @__PURE__ */ new Map();
28195
- byName.set(kind.ecosystem, names);
27670
+ byName.set(ecosystem, names);
28196
27671
  }
28197
- const key = matchKey(kind.ecosystem, info.name);
27672
+ const key = matchKey(ecosystem, info.name);
28198
27673
  if (!names.has(key)) names.set(key, root);
28199
27674
  }
28200
27675
  const roots = new Set(parsed.map(({ root }) => root));
28201
- const gradleRoots = parsed.filter(({ kind }) => kind.ecosystem === "gradle").map(({ root }) => root);
28202
- return parsed.map(({ root, path, kind, info }) => {
28203
- const { ecosystem } = kind;
27676
+ return parsed.map(({ root, path, ecosystem, info }) => {
28204
27677
  const targets = /* @__PURE__ */ new Set();
28205
27678
  for (const dep of info.deps) {
28206
- const target = ecosystem === "gradle" ? resolveGradleProject(dep, root, gradleRoots) : byName.get(ecosystem)?.get(matchKey(ecosystem, dep));
27679
+ const target = byName.get(ecosystem)?.get(matchKey(ecosystem, dep));
28207
27680
  if (target !== void 0) targets.add(target);
28208
27681
  }
28209
27682
  for (const relative2 of info.paths) {
@@ -28211,11 +27684,10 @@ function parseWorkspace(manifests) {
28211
27684
  if (target !== null && roots.has(target)) targets.add(target);
28212
27685
  }
28213
27686
  targets.delete(root);
28214
- const fallback = ecosystem === "gradle" ? root.slice(root.lastIndexOf("/") + 1) : root;
28215
27687
  return {
28216
27688
  root,
28217
- name: info.name ?? (fallback === "" ? REPO_ROOT_NAME : fallback),
28218
- ecosystem,
27689
+ name: info.name ?? (root === "" ? REPO_ROOT_NAME : root),
27690
+ ecosystem: ecosystem.id,
28219
27691
  manifest: path,
28220
27692
  dependsOn: [...targets].sort()
28221
27693
  };
@@ -28229,16 +27701,6 @@ function packageRootOf(path, roots) {
28229
27701
  }
28230
27702
  return best;
28231
27703
  }
28232
- function matchKey(ecosystem, name) {
28233
- switch (ecosystem) {
28234
- case "python":
28235
- return name.toLowerCase().replace(/[-_.]+/g, "-");
28236
- case "rust":
28237
- return name.toLowerCase().replace(/_/g, "-");
28238
- default:
28239
- return name;
28240
- }
28241
- }
28242
27704
  function resolvePath(dir, relative2) {
28243
27705
  const normalized = relative2.replace(/\\/g, "/");
28244
27706
  if (normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized)) return null;
@@ -28250,42 +27712,9 @@ function resolvePath(dir, relative2) {
28250
27712
  }
28251
27713
  return segments.join("/");
28252
27714
  }
28253
- function resolveGradleProject(projectPath, from, gradleRoots) {
28254
- let best;
28255
- let bestDepth = -1;
28256
- for (const root of gradleRoots) {
28257
- if (root !== projectPath && !root.endsWith(`/${projectPath}`)) continue;
28258
- const base = root.slice(0, Math.max(0, root.length - projectPath.length - 1));
28259
- const depth = base === "" || from === base || from.startsWith(`${base}/`) ? base.length : -1;
28260
- if (best === void 0 || depth > bestDepth) {
28261
- best = root;
28262
- bestDepth = depth;
28263
- }
28264
- }
28265
- if (best !== void 0) return best;
28266
- const projectName = projectPath.slice(projectPath.lastIndexOf("/") + 1);
28267
- const byBasename = gradleRoots.filter((root) => root.slice(root.lastIndexOf("/") + 1) === projectName);
28268
- return byBasename.length === 1 ? byBasename[0] : void 0;
28269
- }
28270
27715
 
28271
27716
  // ../server/src/prLinks.ts
28272
- var LINKS_VERSION = 6;
28273
- var languageSchema = external_exports.enum([
28274
- "typescript",
28275
- "javascript",
28276
- "python",
28277
- "css",
28278
- "go",
28279
- "java",
28280
- "kotlin",
28281
- "c",
28282
- "cpp",
28283
- "rust",
28284
- "ruby",
28285
- "vue",
28286
- "svelte",
28287
- "markdown"
28288
- ]).nullable();
27717
+ var LINKS_VERSION = 7;
28289
27718
  var cachedSchema = external_exports.object({
28290
27719
  edges: external_exports.array(
28291
27720
  external_exports.object({
@@ -28295,7 +27724,7 @@ var cachedSchema = external_exports.object({
28295
27724
  detail: external_exports.array(external_exports.string())
28296
27725
  })
28297
27726
  ),
28298
- languages: external_exports.record(external_exports.string(), languageSchema),
27727
+ languages: external_exports.record(external_exports.string(), external_exports.string().nullable()),
28299
27728
  externalImports: external_exports.record(external_exports.string(), external_exports.number()),
28300
27729
  packageImports: external_exports.record(external_exports.string(), external_exports.array(external_exports.string())),
28301
27730
  files: external_exports.array(external_exports.object({ path: external_exports.string(), status: external_exports.enum(["added", "deleted", "modified", "renamed"]) })),
@@ -28304,7 +27733,7 @@ var cachedSchema = external_exports.object({
28304
27733
  external_exports.object({
28305
27734
  root: external_exports.string(),
28306
27735
  name: external_exports.string(),
28307
- ecosystem: external_exports.enum(["npm", "python", "go", "rust", "maven", "gradle", "composer"]),
27736
+ ecosystem: external_exports.string(),
28308
27737
  files: external_exports.array(external_exports.string()),
28309
27738
  dependsOn: external_exports.array(external_exports.string()),
28310
27739
  usedBy: external_exports.array(external_exports.string())
@@ -28314,7 +27743,7 @@ var cachedSchema = external_exports.object({
28314
27743
  external_exports.object({
28315
27744
  root: external_exports.string(),
28316
27745
  name: external_exports.string(),
28317
- ecosystem: external_exports.enum(["npm", "python", "go", "rust", "maven", "gradle", "composer"]),
27746
+ ecosystem: external_exports.string(),
28318
27747
  touched: external_exports.boolean()
28319
27748
  })
28320
27749
  ),
@@ -28330,49 +27759,10 @@ async function manifestPaths(gh, store, ref, head) {
28330
27759
  const tree = await gh.rest(
28331
27760
  `/repos/${ref.owner}/${ref.repo}/git/trees/${head}?recursive=1`
28332
27761
  );
28333
- const paths = tree.tree.filter((t2) => t2.type === "blob" && isManifestPath(t2.path)).map((t2) => t2.path);
27762
+ const paths = tree.tree.filter((t2) => t2.type === "blob" && isManifestPath(t2.path, ecosystems)).map((t2) => t2.path);
28334
27763
  store.putDiff(key, JSON.stringify(paths));
28335
27764
  return paths;
28336
27765
  }
28337
- var SRC_EXTENSIONS = [".ts", ".tsx", ".mts", ".js", ".jsx"];
28338
- function exportTargets(value) {
28339
- if (typeof value === "string") return [value];
28340
- if (!value || typeof value !== "object") return [];
28341
- const entries = Object.entries(value);
28342
- const root = entries.find(([k]) => k === ".");
28343
- const ordered = root ? [root] : entries.filter(([k]) => !k.startsWith("./"));
28344
- return ordered.flatMap(([, v]) => exportTargets(v));
28345
- }
28346
- function entryCandidates(pkg, manifestText) {
28347
- const join5 = (rel) => {
28348
- const clean = rel.replace(/^\.\//, "");
28349
- return pkg.root ? `${pkg.root}/${clean}` : clean;
28350
- };
28351
- const out = [];
28352
- if (pkg.ecosystem === "npm" && manifestText) {
28353
- let manifest = null;
28354
- try {
28355
- manifest = JSON.parse(manifestText);
28356
- } catch {
28357
- }
28358
- if (manifest && typeof manifest === "object") {
28359
- const fields = ["exports", "module", "main", "types", "typings"];
28360
- for (const field of fields) {
28361
- if (!(field in manifest)) continue;
28362
- const value = Reflect.get(manifest, field);
28363
- for (const target of exportTargets(value)) {
28364
- out.push(join5(target));
28365
- const source = target.replace(/^\.?\/?(dist|build|lib|out)\//, "src/").replace(/(\.d)?\.(m|c)?[jt]sx?$/, "");
28366
- if (source !== target) for (const ext of SRC_EXTENSIONS) out.push(join5(source + ext));
28367
- }
28368
- }
28369
- }
28370
- for (const base of ["src/index", "index", "src/main"])
28371
- for (const ext of SRC_EXTENSIONS) out.push(join5(base + ext));
28372
- }
28373
- if (pkg.ecosystem === "rust") out.push(join5("src/lib.rs"), join5("src/main.rs"));
28374
- return [...new Set(out)];
28375
- }
28376
27766
  async function loadWorkspace(gh, store, ref, head) {
28377
27767
  const manifests = await manifestPaths(gh, store, ref, head);
28378
27768
  const dirs = new Set(manifests.map((p) => p.includes("/") ? p.slice(0, p.lastIndexOf("/")) : ""));
@@ -28383,11 +27773,14 @@ async function loadWorkspace(gh, store, ref, head) {
28383
27773
  manifests.map((path) => `${head}:${path}`)
28384
27774
  );
28385
27775
  const textOf = (path) => texts.get(`${head}:${path}`) ?? null;
28386
- const packages = parseWorkspace(manifests.map((path) => ({ path, text: textOf(path) })));
27776
+ const packages = parseWorkspace(
27777
+ manifests.map((path) => ({ path, text: textOf(path) })),
27778
+ ecosystems
27779
+ );
28387
27780
  const refs = packages.map((p) => ({
28388
27781
  name: p.name,
28389
27782
  root: p.root,
28390
- entries: entryCandidates(p, textOf(p.manifest))
27783
+ entries: ecosystems.find((e) => e.id === p.ecosystem)?.entryCandidates(p.root, textOf(p.manifest)) ?? []
28391
27784
  }));
28392
27785
  return { packages, refs };
28393
27786
  }
@@ -28446,20 +27839,18 @@ async function loadLinks(gh, store, ref, base, head, fullPr) {
28446
27839
  if (parsed.success) return parsed.data;
28447
27840
  }
28448
27841
  const diff = await loadDiff(gh, store, ref, base, head, fullPr);
28449
- const readable = diff.files.filter((f) => !f.binary);
27842
+ const analysed = diff.files.filter((f) => languages.detect(f.path) !== null);
28450
27843
  const expression = (f) => f.status === "deleted" ? `${base}:${f.oldPath}` : `${head}:${f.path}`;
28451
- const texts = await fetchTexts(gh, ref, readable.map(expression));
28452
- const sources = diff.files.map((f) => ({
28453
- path: f.path,
28454
- text: f.binary ? null : texts.get(expression(f)) ?? null
28455
- }));
27844
+ const texts = await fetchTexts(gh, ref, analysed.filter((f) => !f.binary).map(expression));
27845
+ const textOf = (f) => f.binary ? null : texts.get(expression(f)) ?? null;
27846
+ const sources = diff.files.map((f) => ({ path: f.path, text: textOf(f) }));
28456
27847
  const workspace = await loadWorkspace(gh, store, ref, head);
28457
- const graph = buildLinkGraph(sources, workspace ? { packages: workspace.refs } : void 0);
27848
+ const graph = buildLinkGraph(sources, languages, workspace ? { packages: workspace.refs } : void 0);
28458
27849
  const paths = diff.files.map((f) => f.path);
28459
27850
  const links = {
28460
27851
  ...graph,
28461
27852
  files: diff.files.map((f) => ({ path: f.path, status: f.status })),
28462
- unreadable: sources.filter((s) => s.text === null).map((s) => s.path),
27853
+ unreadable: analysed.filter((f) => textOf(f) === null).map((f) => f.path),
28463
27854
  ...workspace ? orderPackages(workspace.packages, paths, graph.edges) : { packages: [], workspace: [], packageEdges: [] }
28464
27855
  };
28465
27856
  store.putDiff(cacheKey2, JSON.stringify(links));
@@ -29023,8 +28414,11 @@ function createApp(options) {
29023
28414
  );
29024
28415
  if (options.webDist && existsSync2(options.webDist)) {
29025
28416
  const root = relative(process.cwd(), options.webDist);
29026
- app.use("/*", serveStatic({ root }));
29027
- app.get("*", serveStatic({ root, rewriteRequestPath: () => "/index.html" }));
28417
+ const onFound = (path, c) => {
28418
+ if (path.endsWith("index.html")) c.header("Cache-Control", "no-cache");
28419
+ };
28420
+ app.use("/*", serveStatic({ root, onFound }));
28421
+ app.get("*", serveStatic({ root, rewriteRequestPath: () => "/index.html", onFound }));
29028
28422
  }
29029
28423
  return app;
29030
28424
  }
@@ -29088,11 +28482,11 @@ var ConfigStore = class extends EventEmitter {
29088
28482
  }
29089
28483
  }
29090
28484
  #write(next) {
29091
- const text = JSON.stringify(next, null, 2) + "\n";
28485
+ const text2 = JSON.stringify(next, null, 2) + "\n";
29092
28486
  const tmp = this.path + ".tmp";
29093
- writeFileSync(tmp, text);
28487
+ writeFileSync(tmp, text2);
29094
28488
  renameSync(tmp, this.path);
29095
- this.#lastWritten = text;
28489
+ this.#lastWritten = text2;
29096
28490
  this.#config = next;
29097
28491
  this.emit("change", next);
29098
28492
  return next;