@ox-content/vite-plugin 0.17.0 → 1.1.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 (57) hide show
  1. package/dist/chunk.cjs +39 -49
  2. package/dist/github.cjs +323 -3
  3. package/dist/github.cjs.map +1 -0
  4. package/dist/github.mjs +2 -0
  5. package/dist/{github2.js → github2.mjs} +2 -3
  6. package/dist/github2.mjs.map +1 -0
  7. package/dist/index.cjs +626 -293
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +79 -66
  10. package/dist/index.d.cts.map +1 -1
  11. package/dist/{index.d.ts → index.d.mts} +80 -67
  12. package/dist/index.d.mts.map +1 -0
  13. package/dist/{index.js → index.mjs} +638 -318
  14. package/dist/index.mjs.map +1 -0
  15. package/dist/mermaid.cjs +115 -3
  16. package/dist/mermaid.cjs.map +1 -0
  17. package/dist/{mermaid2.js → mermaid.mjs} +14 -6
  18. package/dist/mermaid.mjs.map +1 -0
  19. package/dist/mermaid2.mjs +2 -0
  20. package/dist/ogp.cjs +316 -3
  21. package/dist/ogp.cjs.map +1 -0
  22. package/dist/ogp.mjs +2 -0
  23. package/dist/{ogp2.js → ogp2.mjs} +2 -3
  24. package/dist/ogp2.mjs.map +1 -0
  25. package/dist/tabs.cjs +212 -3
  26. package/dist/tabs.cjs.map +1 -0
  27. package/dist/tabs.mjs +2 -0
  28. package/dist/{tabs2.js → tabs2.mjs} +2 -3
  29. package/dist/tabs2.mjs.map +1 -0
  30. package/dist/youtube.cjs +135 -3
  31. package/dist/youtube.cjs.map +1 -0
  32. package/dist/youtube.mjs +2 -0
  33. package/dist/{youtube2.js → youtube2.mjs} +2 -3
  34. package/dist/youtube2.mjs.map +1 -0
  35. package/package.json +61 -56
  36. package/dist/github.js +0 -3
  37. package/dist/github2.cjs +0 -313
  38. package/dist/github2.cjs.map +0 -1
  39. package/dist/github2.js.map +0 -1
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/index.js.map +0 -1
  42. package/dist/mermaid.js +0 -3
  43. package/dist/mermaid2.cjs +0 -92
  44. package/dist/mermaid2.cjs.map +0 -1
  45. package/dist/mermaid2.js.map +0 -1
  46. package/dist/ogp.js +0 -3
  47. package/dist/ogp2.cjs +0 -306
  48. package/dist/ogp2.cjs.map +0 -1
  49. package/dist/ogp2.js.map +0 -1
  50. package/dist/tabs.js +0 -3
  51. package/dist/tabs2.cjs +0 -203
  52. package/dist/tabs2.cjs.map +0 -1
  53. package/dist/tabs2.js.map +0 -1
  54. package/dist/youtube.js +0 -3
  55. package/dist/youtube2.cjs +0 -127
  56. package/dist/youtube2.cjs.map +0 -1
  57. package/dist/youtube2.js.map +0 -1
@@ -1,23 +1,23 @@
1
- import { n as transformMermaidStatic, t as mermaidClientScript } from "./mermaid2.js";
2
- import { n as resetTabGroupCounter, r as transformTabs, t as generateTabsCSS } from "./tabs2.js";
3
- import { n as transformYouTube, t as extractVideoId } from "./youtube2.js";
4
- import { i as transformGitHub, n as fetchRepoData, r as prefetchGitHubRepos, t as collectGitHubRepos } from "./github2.js";
5
- import { i as transformOgp, n as fetchOgpData, r as prefetchOgpData, t as collectOgpUrls } from "./ogp2.js";
1
+ import { n as transformMermaidStatic, r as importNapiModule, t as mermaidClientScript } from "./mermaid.mjs";
2
+ import { n as resetTabGroupCounter, r as transformTabs, t as generateTabsCSS } from "./tabs2.mjs";
3
+ import { n as transformYouTube, t as extractVideoId } from "./youtube2.mjs";
4
+ import { i as transformGitHub, n as fetchRepoData, r as prefetchGitHubRepos, t as collectGitHubRepos } from "./github2.mjs";
5
+ import { i as transformOgp, n as fetchOgpData, r as prefetchOgpData, t as collectOgpUrls } from "./ogp2.mjs";
6
6
  import { createRequire } from "node:module";
7
- import * as path from "path";
8
- import path$1 from "path";
7
+ import * as path$1 from "path";
8
+ import path from "path";
9
9
  import { unified } from "unified";
10
10
  import rehypeParse from "rehype-parse";
11
11
  import rehypeStringify from "rehype-stringify";
12
12
  import { createHighlighter } from "shiki";
13
13
  import { dirname, join } from "node:path";
14
14
  import * as fs$1 from "fs";
15
+ import { createHash } from "node:crypto";
15
16
  import * as fs from "fs/promises";
16
17
  import { glob } from "glob";
17
18
  import * as crypto from "crypto";
18
19
  import { mkdir, writeFile } from "node:fs/promises";
19
-
20
- //#region rolldown:runtime
20
+ //#region \0rolldown/runtime.js
21
21
  var __create = Object.create;
22
22
  var __defProp = Object.defineProperty;
23
23
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -26,30 +26,22 @@ var __getProtoOf = Object.getPrototypeOf;
26
26
  var __hasOwnProp = Object.prototype.hasOwnProperty;
27
27
  var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
28
28
  var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
29
- var __exportAll = (all, symbols) => {
29
+ var __exportAll = (all, no_symbols) => {
30
30
  let target = {};
31
- for (var name in all) {
32
- __defProp(target, name, {
33
- get: all[name],
34
- enumerable: true
35
- });
36
- }
37
- if (symbols) {
38
- __defProp(target, Symbol.toStringTag, { value: "Module" });
39
- }
31
+ for (var name in all) __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true
34
+ });
35
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
40
36
  return target;
41
37
  };
42
38
  var __copyProps = (to, from, except, desc) => {
43
- if (from && typeof from === "object" || typeof from === "function") {
44
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
45
- key = keys[i];
46
- if (!__hasOwnProp.call(to, key) && key !== except) {
47
- __defProp(to, key, {
48
- get: ((k) => from[k]).bind(null, key),
49
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
50
- });
51
- }
52
- }
39
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
40
+ key = keys[i];
41
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
42
+ get: ((k) => from[k]).bind(null, key),
43
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
44
+ });
53
45
  }
54
46
  return to;
55
47
  };
@@ -59,7 +51,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
59
51
  }) : target, mod));
60
52
  var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
61
53
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
62
-
63
54
  //#endregion
64
55
  //#region src/environment.ts
65
56
  /**
@@ -107,7 +98,6 @@ function createMarkdownEnvironment(options) {
107
98
  }
108
99
  };
109
100
  }
110
-
111
101
  //#endregion
112
102
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
113
103
  var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -158,7 +148,6 @@ var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
158
148
  exports.isScalar = isScalar;
159
149
  exports.isSeq = isSeq;
160
150
  }));
161
-
162
151
  //#endregion
163
152
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/visit.js
164
153
  var require_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -349,7 +338,6 @@ var require_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
349
338
  exports.visit = visit;
350
339
  exports.visitAsync = visitAsync;
351
340
  }));
352
-
353
341
  //#endregion
354
342
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js
355
343
  var require_directives = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -515,7 +503,6 @@ var require_directives = /* @__PURE__ */ __commonJSMin(((exports) => {
515
503
  Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
516
504
  exports.Directives = Directives;
517
505
  }));
518
-
519
506
  //#endregion
520
507
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js
521
508
  var require_anchors = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -578,7 +565,6 @@ var require_anchors = /* @__PURE__ */ __commonJSMin(((exports) => {
578
565
  exports.createNodeAnchors = createNodeAnchors;
579
566
  exports.findNewAnchor = findNewAnchor;
580
567
  }));
581
-
582
568
  //#endregion
583
569
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js
584
570
  var require_applyReviver = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -619,7 +605,6 @@ var require_applyReviver = /* @__PURE__ */ __commonJSMin(((exports) => {
619
605
  }
620
606
  exports.applyReviver = applyReviver;
621
607
  }));
622
-
623
608
  //#endregion
624
609
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js
625
610
  var require_toJS = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -657,7 +642,6 @@ var require_toJS = /* @__PURE__ */ __commonJSMin(((exports) => {
657
642
  }
658
643
  exports.toJS = toJS;
659
644
  }));
660
-
661
645
  //#endregion
662
646
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js
663
647
  var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -692,7 +676,6 @@ var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
692
676
  };
693
677
  exports.NodeBase = NodeBase;
694
678
  }));
695
-
696
679
  //#endregion
697
680
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js
698
681
  var require_Alias = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -786,7 +769,6 @@ var require_Alias = /* @__PURE__ */ __commonJSMin(((exports) => {
786
769
  }
787
770
  exports.Alias = Alias;
788
771
  }));
789
-
790
772
  //#endregion
791
773
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js
792
774
  var require_Scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -814,7 +796,6 @@ var require_Scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
814
796
  exports.Scalar = Scalar;
815
797
  exports.isScalarValue = isScalarValue;
816
798
  }));
817
-
818
799
  //#endregion
819
800
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js
820
801
  var require_createNode = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -878,7 +859,6 @@ var require_createNode = /* @__PURE__ */ __commonJSMin(((exports) => {
878
859
  }
879
860
  exports.createNode = createNode;
880
861
  }));
881
-
882
862
  //#endregion
883
863
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js
884
864
  var require_Collection = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1000,7 +980,6 @@ var require_Collection = /* @__PURE__ */ __commonJSMin(((exports) => {
1000
980
  exports.collectionFromPath = collectionFromPath;
1001
981
  exports.isEmptyPath = isEmptyPath;
1002
982
  }));
1003
-
1004
983
  //#endregion
1005
984
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js
1006
985
  var require_stringifyComment = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1021,7 +1000,6 @@ var require_stringifyComment = /* @__PURE__ */ __commonJSMin(((exports) => {
1021
1000
  exports.lineComment = lineComment;
1022
1001
  exports.stringifyComment = stringifyComment;
1023
1002
  }));
1024
-
1025
1003
  //#endregion
1026
1004
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js
1027
1005
  var require_foldFlowLines = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1138,7 +1116,6 @@ var require_foldFlowLines = /* @__PURE__ */ __commonJSMin(((exports) => {
1138
1116
  exports.FOLD_QUOTED = FOLD_QUOTED;
1139
1117
  exports.foldFlowLines = foldFlowLines;
1140
1118
  }));
1141
-
1142
1119
  //#endregion
1143
1120
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js
1144
1121
  var require_stringifyString = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1363,7 +1340,6 @@ var require_stringifyString = /* @__PURE__ */ __commonJSMin(((exports) => {
1363
1340
  }
1364
1341
  exports.stringifyString = stringifyString;
1365
1342
  }));
1366
-
1367
1343
  //#endregion
1368
1344
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js
1369
1345
  var require_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1471,7 +1447,6 @@ var require_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
1471
1447
  exports.createStringifyContext = createStringifyContext;
1472
1448
  exports.stringify = stringify;
1473
1449
  }));
1474
-
1475
1450
  //#endregion
1476
1451
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js
1477
1452
  var require_stringifyPair = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1569,7 +1544,6 @@ var require_stringifyPair = /* @__PURE__ */ __commonJSMin(((exports) => {
1569
1544
  }
1570
1545
  exports.stringifyPair = stringifyPair;
1571
1546
  }));
1572
-
1573
1547
  //#endregion
1574
1548
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/log.js
1575
1549
  var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1584,7 +1558,6 @@ var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
1584
1558
  exports.debug = debug;
1585
1559
  exports.warn = warn;
1586
1560
  }));
1587
-
1588
1561
  //#endregion
1589
1562
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js
1590
1563
  var require_merge = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1625,7 +1598,6 @@ var require_merge = /* @__PURE__ */ __commonJSMin(((exports) => {
1625
1598
  exports.isMergeKey = isMergeKey;
1626
1599
  exports.merge = merge;
1627
1600
  }));
1628
-
1629
1601
  //#endregion
1630
1602
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js
1631
1603
  var require_addPairToJSMap = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1677,7 +1649,6 @@ var require_addPairToJSMap = /* @__PURE__ */ __commonJSMin(((exports) => {
1677
1649
  }
1678
1650
  exports.addPairToJSMap = addPairToJSMap;
1679
1651
  }));
1680
-
1681
1652
  //#endregion
1682
1653
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js
1683
1654
  var require_Pair = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1711,7 +1682,6 @@ var require_Pair = /* @__PURE__ */ __commonJSMin(((exports) => {
1711
1682
  exports.Pair = Pair;
1712
1683
  exports.createPair = createPair;
1713
1684
  }));
1714
-
1715
1685
  //#endregion
1716
1686
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js
1717
1687
  var require_stringifyCollection = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1826,7 +1796,6 @@ var require_stringifyCollection = /* @__PURE__ */ __commonJSMin(((exports) => {
1826
1796
  }
1827
1797
  exports.stringifyCollection = stringifyCollection;
1828
1798
  }));
1829
-
1830
1799
  //#endregion
1831
1800
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js
1832
1801
  var require_YAMLMap = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -1936,13 +1905,12 @@ var require_YAMLMap = /* @__PURE__ */ __commonJSMin(((exports) => {
1936
1905
  exports.YAMLMap = YAMLMap;
1937
1906
  exports.findPair = findPair;
1938
1907
  }));
1939
-
1940
1908
  //#endregion
1941
1909
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js
1942
1910
  var require_map = /* @__PURE__ */ __commonJSMin(((exports) => {
1943
1911
  var identity = require_identity();
1944
1912
  var YAMLMap = require_YAMLMap();
1945
- const map = {
1913
+ exports.map = {
1946
1914
  collection: "map",
1947
1915
  default: true,
1948
1916
  nodeClass: YAMLMap.YAMLMap,
@@ -1953,9 +1921,7 @@ var require_map = /* @__PURE__ */ __commonJSMin(((exports) => {
1953
1921
  },
1954
1922
  createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
1955
1923
  };
1956
- exports.map = map;
1957
1924
  }));
1958
-
1959
1925
  //#endregion
1960
1926
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js
1961
1927
  var require_YAMLSeq = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2062,13 +2028,12 @@ var require_YAMLSeq = /* @__PURE__ */ __commonJSMin(((exports) => {
2062
2028
  }
2063
2029
  exports.YAMLSeq = YAMLSeq;
2064
2030
  }));
2065
-
2066
2031
  //#endregion
2067
2032
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js
2068
2033
  var require_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
2069
2034
  var identity = require_identity();
2070
2035
  var YAMLSeq = require_YAMLSeq();
2071
- const seq = {
2036
+ exports.seq = {
2072
2037
  collection: "seq",
2073
2038
  default: true,
2074
2039
  nodeClass: YAMLSeq.YAMLSeq,
@@ -2079,14 +2044,12 @@ var require_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
2079
2044
  },
2080
2045
  createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
2081
2046
  };
2082
- exports.seq = seq;
2083
2047
  }));
2084
-
2085
2048
  //#endregion
2086
2049
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js
2087
2050
  var require_string = /* @__PURE__ */ __commonJSMin(((exports) => {
2088
2051
  var stringifyString = require_stringifyString();
2089
- const string = {
2052
+ exports.string = {
2090
2053
  identify: (value) => typeof value === "string",
2091
2054
  default: true,
2092
2055
  tag: "tag:yaml.org,2002:str",
@@ -2096,9 +2059,7 @@ var require_string = /* @__PURE__ */ __commonJSMin(((exports) => {
2096
2059
  return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
2097
2060
  }
2098
2061
  };
2099
- exports.string = string;
2100
2062
  }));
2101
-
2102
2063
  //#endregion
2103
2064
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js
2104
2065
  var require_null = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2114,7 +2075,6 @@ var require_null = /* @__PURE__ */ __commonJSMin(((exports) => {
2114
2075
  };
2115
2076
  exports.nullTag = nullTag;
2116
2077
  }));
2117
-
2118
2078
  //#endregion
2119
2079
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js
2120
2080
  var require_bool$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2134,7 +2094,6 @@ var require_bool$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
2134
2094
  };
2135
2095
  exports.boolTag = boolTag;
2136
2096
  }));
2137
-
2138
2097
  //#endregion
2139
2098
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js
2140
2099
  var require_stringifyNumber = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2156,7 +2115,6 @@ var require_stringifyNumber = /* @__PURE__ */ __commonJSMin(((exports) => {
2156
2115
  }
2157
2116
  exports.stringifyNumber = stringifyNumber;
2158
2117
  }));
2159
-
2160
2118
  //#endregion
2161
2119
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js
2162
2120
  var require_float$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2182,7 +2140,7 @@ var require_float$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
2182
2140
  return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
2183
2141
  }
2184
2142
  };
2185
- const float = {
2143
+ exports.float = {
2186
2144
  identify: (value) => typeof value === "number",
2187
2145
  default: true,
2188
2146
  tag: "tag:yaml.org,2002:float",
@@ -2195,11 +2153,9 @@ var require_float$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
2195
2153
  },
2196
2154
  stringify: stringifyNumber.stringifyNumber
2197
2155
  };
2198
- exports.float = float;
2199
2156
  exports.floatExp = floatExp;
2200
2157
  exports.floatNaN = floatNaN;
2201
2158
  }));
2202
-
2203
2159
  //#endregion
2204
2160
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js
2205
2161
  var require_int$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2241,7 +2197,6 @@ var require_int$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
2241
2197
  exports.intHex = intHex;
2242
2198
  exports.intOct = intOct;
2243
2199
  }));
2244
-
2245
2200
  //#endregion
2246
2201
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js
2247
2202
  var require_schema$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2252,7 +2207,7 @@ var require_schema$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
2252
2207
  var bool = require_bool$1();
2253
2208
  var float = require_float$1();
2254
2209
  var int = require_int$1();
2255
- const schema = [
2210
+ exports.schema = [
2256
2211
  map.map,
2257
2212
  seq.seq,
2258
2213
  string.string,
@@ -2265,9 +2220,7 @@ var require_schema$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
2265
2220
  float.floatExp,
2266
2221
  float.float
2267
2222
  ];
2268
- exports.schema = schema;
2269
2223
  }));
2270
-
2271
2224
  //#endregion
2272
2225
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js
2273
2226
  var require_schema$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2320,7 +2273,7 @@ var require_schema$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
2320
2273
  stringify: stringifyJSON
2321
2274
  }
2322
2275
  ];
2323
- const schema = [map.map, seq.seq].concat(jsonScalars, {
2276
+ exports.schema = [map.map, seq.seq].concat(jsonScalars, {
2324
2277
  default: true,
2325
2278
  tag: "",
2326
2279
  test: /^/,
@@ -2329,16 +2282,14 @@ var require_schema$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
2329
2282
  return str;
2330
2283
  }
2331
2284
  });
2332
- exports.schema = schema;
2333
2285
  }));
2334
-
2335
2286
  //#endregion
2336
2287
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js
2337
2288
  var require_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
2338
2289
  var node_buffer = __require("buffer");
2339
2290
  var Scalar = require_Scalar();
2340
2291
  var stringifyString = require_stringifyString();
2341
- const binary = {
2292
+ exports.binary = {
2342
2293
  identify: (value) => value instanceof Uint8Array,
2343
2294
  default: false,
2344
2295
  tag: "tag:yaml.org,2002:binary",
@@ -2379,9 +2330,7 @@ var require_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
2379
2330
  }, ctx, onComment, onChompKeep);
2380
2331
  }
2381
2332
  };
2382
- exports.binary = binary;
2383
2333
  }));
2384
-
2385
2334
  //#endregion
2386
2335
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
2387
2336
  var require_pairs = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2442,7 +2391,6 @@ var require_pairs = /* @__PURE__ */ __commonJSMin(((exports) => {
2442
2391
  exports.pairs = pairs;
2443
2392
  exports.resolvePairs = resolvePairs;
2444
2393
  }));
2445
-
2446
2394
  //#endregion
2447
2395
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js
2448
2396
  var require_omap = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2506,7 +2454,6 @@ var require_omap = /* @__PURE__ */ __commonJSMin(((exports) => {
2506
2454
  exports.YAMLOMap = YAMLOMap;
2507
2455
  exports.omap = omap;
2508
2456
  }));
2509
-
2510
2457
  //#endregion
2511
2458
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
2512
2459
  var require_bool = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2534,7 +2481,6 @@ var require_bool = /* @__PURE__ */ __commonJSMin(((exports) => {
2534
2481
  exports.falseTag = falseTag;
2535
2482
  exports.trueTag = trueTag;
2536
2483
  }));
2537
-
2538
2484
  //#endregion
2539
2485
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js
2540
2486
  var require_float = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2560,7 +2506,7 @@ var require_float = /* @__PURE__ */ __commonJSMin(((exports) => {
2560
2506
  return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
2561
2507
  }
2562
2508
  };
2563
- const float = {
2509
+ exports.float = {
2564
2510
  identify: (value) => typeof value === "number",
2565
2511
  default: true,
2566
2512
  tag: "tag:yaml.org,2002:float",
@@ -2576,11 +2522,9 @@ var require_float = /* @__PURE__ */ __commonJSMin(((exports) => {
2576
2522
  },
2577
2523
  stringify: stringifyNumber.stringifyNumber
2578
2524
  };
2579
- exports.float = float;
2580
2525
  exports.floatExp = floatExp;
2581
2526
  exports.floatNaN = floatNaN;
2582
2527
  }));
2583
-
2584
2528
  //#endregion
2585
2529
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js
2586
2530
  var require_int = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2656,7 +2600,6 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports) => {
2656
2600
  exports.intHex = intHex;
2657
2601
  exports.intOct = intOct;
2658
2602
  }));
2659
-
2660
2603
  //#endregion
2661
2604
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js
2662
2605
  var require_set = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2725,7 +2668,6 @@ var require_set = /* @__PURE__ */ __commonJSMin(((exports) => {
2725
2668
  exports.YAMLSet = YAMLSet;
2726
2669
  exports.set = set;
2727
2670
  }));
2728
-
2729
2671
  //#endregion
2730
2672
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
2731
2673
  var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2809,7 +2751,6 @@ var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports) => {
2809
2751
  exports.intTime = intTime;
2810
2752
  exports.timestamp = timestamp;
2811
2753
  }));
2812
-
2813
2754
  //#endregion
2814
2755
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js
2815
2756
  var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2826,7 +2767,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
2826
2767
  var pairs = require_pairs();
2827
2768
  var set = require_set();
2828
2769
  var timestamp = require_timestamp();
2829
- const schema = [
2770
+ exports.schema = [
2830
2771
  map.map,
2831
2772
  seq.seq,
2832
2773
  string.string,
@@ -2849,9 +2790,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
2849
2790
  timestamp.floatTime,
2850
2791
  timestamp.timestamp
2851
2792
  ];
2852
- exports.schema = schema;
2853
2793
  }));
2854
-
2855
2794
  //#endregion
2856
2795
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js
2857
2796
  var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2936,7 +2875,6 @@ var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
2936
2875
  exports.coreKnownTags = coreKnownTags;
2937
2876
  exports.getTags = getTags;
2938
2877
  }));
2939
-
2940
2878
  //#endregion
2941
2879
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js
2942
2880
  var require_Schema = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -2946,7 +2884,7 @@ var require_Schema = /* @__PURE__ */ __commonJSMin(((exports) => {
2946
2884
  var string = require_string();
2947
2885
  var tags = require_tags();
2948
2886
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
2949
- var Schema = class Schema {
2887
+ exports.Schema = class Schema {
2950
2888
  constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
2951
2889
  this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
2952
2890
  this.name = typeof schema === "string" && schema || "core";
@@ -2964,9 +2902,7 @@ var require_Schema = /* @__PURE__ */ __commonJSMin(((exports) => {
2964
2902
  return copy;
2965
2903
  }
2966
2904
  };
2967
- exports.Schema = Schema;
2968
2905
  }));
2969
-
2970
2906
  //#endregion
2971
2907
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js
2972
2908
  var require_stringifyDocument = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3028,7 +2964,6 @@ var require_stringifyDocument = /* @__PURE__ */ __commonJSMin(((exports) => {
3028
2964
  }
3029
2965
  exports.stringifyDocument = stringifyDocument;
3030
2966
  }));
3031
-
3032
2967
  //#endregion
3033
2968
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js
3034
2969
  var require_Document = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3310,7 +3245,6 @@ var require_Document = /* @__PURE__ */ __commonJSMin(((exports) => {
3310
3245
  }
3311
3246
  exports.Document = Document;
3312
3247
  }));
3313
-
3314
3248
  //#endregion
3315
3249
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/errors.js
3316
3250
  var require_errors = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3364,7 +3298,6 @@ var require_errors = /* @__PURE__ */ __commonJSMin(((exports) => {
3364
3298
  exports.YAMLWarning = YAMLWarning;
3365
3299
  exports.prettifyError = prettifyError;
3366
3300
  }));
3367
-
3368
3301
  //#endregion
3369
3302
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js
3370
3303
  var require_resolve_props = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3472,7 +3405,6 @@ var require_resolve_props = /* @__PURE__ */ __commonJSMin(((exports) => {
3472
3405
  }
3473
3406
  exports.resolveProps = resolveProps;
3474
3407
  }));
3475
-
3476
3408
  //#endregion
3477
3409
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js
3478
3410
  var require_util_contains_newline = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3502,7 +3434,6 @@ var require_util_contains_newline = /* @__PURE__ */ __commonJSMin(((exports) =>
3502
3434
  }
3503
3435
  exports.containsNewline = containsNewline;
3504
3436
  }));
3505
-
3506
3437
  //#endregion
3507
3438
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js
3508
3439
  var require_util_flow_indent_check = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3515,7 +3446,6 @@ var require_util_flow_indent_check = /* @__PURE__ */ __commonJSMin(((exports) =>
3515
3446
  }
3516
3447
  exports.flowIndentCheck = flowIndentCheck;
3517
3448
  }));
3518
-
3519
3449
  //#endregion
3520
3450
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js
3521
3451
  var require_util_map_includes = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3528,7 +3458,6 @@ var require_util_map_includes = /* @__PURE__ */ __commonJSMin(((exports) => {
3528
3458
  }
3529
3459
  exports.mapIncludes = mapIncludes;
3530
3460
  }));
3531
-
3532
3461
  //#endregion
3533
3462
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js
3534
3463
  var require_resolve_block_map = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3613,7 +3542,6 @@ var require_resolve_block_map = /* @__PURE__ */ __commonJSMin(((exports) => {
3613
3542
  }
3614
3543
  exports.resolveBlockMap = resolveBlockMap;
3615
3544
  }));
3616
-
3617
3545
  //#endregion
3618
3546
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js
3619
3547
  var require_resolve_block_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3656,7 +3584,6 @@ var require_resolve_block_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
3656
3584
  }
3657
3585
  exports.resolveBlockSeq = resolveBlockSeq;
3658
3586
  }));
3659
-
3660
3587
  //#endregion
3661
3588
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js
3662
3589
  var require_resolve_end = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3695,7 +3622,6 @@ var require_resolve_end = /* @__PURE__ */ __commonJSMin(((exports) => {
3695
3622
  }
3696
3623
  exports.resolveEnd = resolveEnd;
3697
3624
  }));
3698
-
3699
3625
  //#endregion
3700
3626
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js
3701
3627
  var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3851,7 +3777,6 @@ var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) =
3851
3777
  }
3852
3778
  exports.resolveFlowCollection = resolveFlowCollection;
3853
3779
  }));
3854
-
3855
3780
  //#endregion
3856
3781
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js
3857
3782
  var require_compose_collection = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -3904,7 +3829,6 @@ var require_compose_collection = /* @__PURE__ */ __commonJSMin(((exports) => {
3904
3829
  }
3905
3830
  exports.composeCollection = composeCollection;
3906
3831
  }));
3907
-
3908
3832
  //#endregion
3909
3833
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js
3910
3834
  var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4080,7 +4004,6 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
4080
4004
  }
4081
4005
  exports.resolveBlockScalar = resolveBlockScalar;
4082
4006
  }));
4083
-
4084
4007
  //#endregion
4085
4008
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js
4086
4009
  var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4287,7 +4210,6 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
4287
4210
  }
4288
4211
  exports.resolveFlowScalar = resolveFlowScalar;
4289
4212
  }));
4290
-
4291
4213
  //#endregion
4292
4214
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js
4293
4215
  var require_compose_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4347,7 +4269,6 @@ var require_compose_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
4347
4269
  }
4348
4270
  exports.composeScalar = composeScalar;
4349
4271
  }));
4350
-
4351
4272
  //#endregion
4352
4273
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js
4353
4274
  var require_util_empty_scalar_position = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4375,7 +4296,6 @@ var require_util_empty_scalar_position = /* @__PURE__ */ __commonJSMin(((exports
4375
4296
  }
4376
4297
  exports.emptyScalarPosition = emptyScalarPosition;
4377
4298
  }));
4378
-
4379
4299
  //#endregion
4380
4300
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js
4381
4301
  var require_compose_node = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4461,7 +4381,6 @@ var require_compose_node = /* @__PURE__ */ __commonJSMin(((exports) => {
4461
4381
  exports.composeEmptyNode = composeEmptyNode;
4462
4382
  exports.composeNode = composeNode;
4463
4383
  }));
4464
-
4465
4384
  //#endregion
4466
4385
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js
4467
4386
  var require_compose_doc = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4504,7 +4423,6 @@ var require_compose_doc = /* @__PURE__ */ __commonJSMin(((exports) => {
4504
4423
  }
4505
4424
  exports.composeDoc = composeDoc;
4506
4425
  }));
4507
-
4508
4426
  //#endregion
4509
4427
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js
4510
4428
  var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4703,7 +4621,6 @@ var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
4703
4621
  };
4704
4622
  exports.Composer = Composer;
4705
4623
  }));
4706
-
4707
4624
  //#endregion
4708
4625
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js
4709
4626
  var require_cst_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -4971,7 +4888,6 @@ var require_cst_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
4971
4888
  exports.resolveAsScalar = resolveAsScalar;
4972
4889
  exports.setScalarValue = setScalarValue;
4973
4890
  }));
4974
-
4975
4891
  //#endregion
4976
4892
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js
4977
4893
  var require_cst_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -5023,7 +4939,6 @@ var require_cst_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
5023
4939
  }
5024
4940
  exports.stringify = stringify;
5025
4941
  }));
5026
-
5027
4942
  //#endregion
5028
4943
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js
5029
4944
  var require_cst_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -5115,7 +5030,6 @@ var require_cst_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
5115
5030
  }
5116
5031
  exports.visit = visit;
5117
5032
  }));
5118
-
5119
5033
  //#endregion
5120
5034
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js
5121
5035
  var require_cst = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -5195,7 +5109,6 @@ var require_cst = /* @__PURE__ */ __commonJSMin(((exports) => {
5195
5109
  exports.prettyToken = prettyToken;
5196
5110
  exports.tokenType = tokenType;
5197
5111
  }));
5198
-
5199
5112
  //#endregion
5200
5113
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js
5201
5114
  var require_lexer = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -5715,7 +5628,6 @@ var require_lexer = /* @__PURE__ */ __commonJSMin(((exports) => {
5715
5628
  };
5716
5629
  exports.Lexer = Lexer;
5717
5630
  }));
5718
-
5719
5631
  //#endregion
5720
5632
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js
5721
5633
  var require_line_counter = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -5763,7 +5675,6 @@ var require_line_counter = /* @__PURE__ */ __commonJSMin(((exports) => {
5763
5675
  };
5764
5676
  exports.LineCounter = LineCounter;
5765
5677
  }));
5766
-
5767
5678
  //#endregion
5768
5679
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js
5769
5680
  var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -6620,7 +6531,6 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
6620
6531
  };
6621
6532
  exports.Parser = Parser;
6622
6533
  }));
6623
-
6624
6534
  //#endregion
6625
6535
  //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/public-api.js
6626
6536
  var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
@@ -6708,10 +6618,9 @@ var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
6708
6618
  exports.parseDocument = parseDocument;
6709
6619
  exports.stringify = stringify;
6710
6620
  }));
6711
-
6712
6621
  //#endregion
6713
- //#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/index.js
6714
- var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
6622
+ //#region src/highlight.ts
6623
+ var import_dist = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
6715
6624
  var composer = require_composer();
6716
6625
  var Document = require_Document();
6717
6626
  var Schema = require_Schema();
@@ -6722,7 +6631,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
6722
6631
  var Scalar = require_Scalar();
6723
6632
  var YAMLMap = require_YAMLMap();
6724
6633
  var YAMLSeq = require_YAMLSeq();
6725
- var cst = require_cst();
6634
+ require_cst();
6726
6635
  var lexer = require_lexer();
6727
6636
  var lineCounter = require_line_counter();
6728
6637
  var parser = require_parser();
@@ -6756,11 +6665,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
6756
6665
  exports.stringify = publicApi.stringify;
6757
6666
  exports.visit = visit.visit;
6758
6667
  exports.visitAsync = visit.visitAsync;
6759
- }));
6760
-
6761
- //#endregion
6762
- //#region src/highlight.ts
6763
- var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
6668
+ })))(), 1);
6764
6669
  /**
6765
6670
  * Syntax highlighting with Shiki via rehype.
6766
6671
  */
@@ -6790,15 +6695,23 @@ const BUILTIN_LANGS = [
6790
6695
  "diff",
6791
6696
  "toml"
6792
6697
  ];
6793
- let highlighterPromise = null;
6698
+ const highlighterCache = /* @__PURE__ */ new Map();
6794
6699
  /**
6795
6700
  * Get or create the Shiki highlighter.
6796
6701
  */
6797
6702
  async function getHighlighter(theme, customLangs = []) {
6798
- if (!highlighterPromise) highlighterPromise = createHighlighter({
6799
- themes: [theme],
6800
- langs: [...BUILTIN_LANGS, ...customLangs]
6703
+ const cacheKey = JSON.stringify({
6704
+ theme,
6705
+ langs: customLangs
6801
6706
  });
6707
+ let highlighterPromise = highlighterCache.get(cacheKey);
6708
+ if (!highlighterPromise) {
6709
+ highlighterPromise = createHighlighter({
6710
+ themes: [theme],
6711
+ langs: [...BUILTIN_LANGS, ...customLangs]
6712
+ });
6713
+ highlighterCache.set(cacheKey, highlighterPromise);
6714
+ }
6802
6715
  return highlighterPromise;
6803
6716
  }
6804
6717
  /**
@@ -6814,12 +6727,9 @@ function rehypeShikiHighlight(options) {
6814
6727
  if (child.type === "element" && child.tagName === "pre") {
6815
6728
  const codeElement = child.children.find((c) => c.type === "element" && c.tagName === "code");
6816
6729
  if (codeElement) {
6817
- const className = codeElement.properties?.className;
6818
6730
  let lang = "text";
6819
- if (Array.isArray(className)) {
6820
- const langClass = className.find((c) => typeof c === "string" && c.startsWith("language-"));
6821
- if (langClass && typeof langClass === "string") lang = langClass.replace("language-", "");
6822
- }
6731
+ const langClass = normalizeClassName(codeElement.properties?.className).find((value) => value.startsWith("language-"));
6732
+ if (langClass) lang = langClass.replace("language-", "");
6823
6733
  const codeText = getTextContent(codeElement);
6824
6734
  try {
6825
6735
  const highlighted = highlighter.codeToHtml(codeText, {
@@ -6827,7 +6737,12 @@ function rehypeShikiHighlight(options) {
6827
6737
  theme
6828
6738
  });
6829
6739
  const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);
6830
- if (parsed.children[0]) node.children[i] = parsed.children[0];
6740
+ if (parsed.children[0]?.type === "element") {
6741
+ const highlightedPre = parsed.children[0];
6742
+ highlightedPre.properties ??= {};
6743
+ highlightedPre.properties["data-language"] = lang;
6744
+ node.children[i] = highlightedPre;
6745
+ }
6831
6746
  } catch {}
6832
6747
  }
6833
6748
  } else if (child.type === "element") await visit(child);
@@ -6847,6 +6762,11 @@ function getTextContent(node) {
6847
6762
  }
6848
6763
  return text;
6849
6764
  }
6765
+ function normalizeClassName(className) {
6766
+ if (Array.isArray(className)) return className.filter((value) => typeof value === "string");
6767
+ if (typeof className === "string" && className) return className.split(/\s+/).filter(Boolean);
6768
+ return [];
6769
+ }
6850
6770
  /**
6851
6771
  * Apply syntax highlighting to HTML using Shiki.
6852
6772
  */
@@ -6857,7 +6777,6 @@ async function highlightCode(html, theme = "github-dark", langs = []) {
6857
6777
  }).use(rehypeStringify).process(html);
6858
6778
  return String(result);
6859
6779
  }
6860
-
6861
6780
  //#endregion
6862
6781
  //#region src/plugins/mermaid-protect.ts
6863
6782
  /**
@@ -6910,7 +6829,6 @@ function restoreMermaidSvgs(html, svgs) {
6910
6829
  for (const [placeholder, content] of svgs) result = result.replace(placeholder, content);
6911
6830
  return result;
6912
6831
  }
6913
-
6914
6832
  //#endregion
6915
6833
  //#region src/transform.ts
6916
6834
  /**
@@ -6998,7 +6916,7 @@ async function loadNapiBindings() {
6998
6916
  if (napiLoadAttempted) return napiBindings ?? null;
6999
6917
  napiLoadAttempted = true;
7000
6918
  try {
7001
- const mod = await import("@ox-content/napi");
6919
+ const mod = await importNapiModule();
7002
6920
  napiBindings = mod;
7003
6921
  return mod;
7004
6922
  } catch (error) {
@@ -7020,7 +6938,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
7020
6938
  tocMaxDepth: options.tocMaxDepth,
7021
6939
  convertMdLinks: ssgOptions?.convertMdLinks,
7022
6940
  baseUrl: ssgOptions?.baseUrl,
7023
- sourcePath: ssgOptions?.sourcePath ?? filePath
6941
+ sourcePath: ssgOptions?.sourcePath ?? filePath,
6942
+ codeAnnotations: options.codeAnnotations.enabled,
6943
+ codeAnnotationMetaKey: options.codeAnnotations.metaKey,
6944
+ codeAnnotationSyntax: options.codeAnnotations.notation,
6945
+ codeAnnotationDefaultLineNumbers: options.codeAnnotations.defaultLineNumbers
7024
6946
  });
7025
6947
  if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
7026
6948
  let html = result.html;
@@ -7032,7 +6954,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
7032
6954
  if (options.mermaid) html = await transformMermaidStatic(html);
7033
6955
  const { html: protectedHtml, svgs } = protectMermaidSvgs(html);
7034
6956
  html = protectedHtml;
7035
- if (options.highlight) html = await highlightCode(html, options.highlightTheme, options.highlightLangs);
6957
+ if (options.highlight) {
6958
+ const originalHtml = html;
6959
+ const highlightedHtml = await highlightCode(html, options.highlightTheme, options.highlightLangs);
6960
+ html = napi.mergeHighlightedCodeBlocks(originalHtml, highlightedHtml);
6961
+ }
7036
6962
  html = restoreMermaidSvgs(html, svgs);
7037
6963
  return {
7038
6964
  code: generateModuleCode(html, frontmatter, toc, filePath, options),
@@ -7128,7 +7054,6 @@ if (import.meta.hot) {
7128
7054
  }
7129
7055
  `;
7130
7056
  }
7131
-
7132
7057
  //#endregion
7133
7058
  //#region src/nav-generator.ts
7134
7059
  /**
@@ -7275,7 +7200,7 @@ function generateNavMetadata(docs, basePath = "/api") {
7275
7200
  * @internal
7276
7201
  */
7277
7202
  function getDocDisplayName(filePath) {
7278
- const fileName = path$1.basename(filePath, path$1.extname(filePath));
7203
+ const fileName = path.basename(filePath, path.extname(filePath));
7279
7204
  if (fileName === "index" || fileName === "index-module") return "Overview";
7280
7205
  return fileName.replace(/[-_]([a-z])/g, (_, char) => " " + char.toUpperCase()).replace(/^[a-z]/, (char) => char.toUpperCase());
7281
7206
  }
@@ -7292,7 +7217,7 @@ function getDocDisplayName(filePath) {
7292
7217
  * @internal
7293
7218
  */
7294
7219
  function getDocFileName(filePath) {
7295
- const fileName = path$1.basename(filePath, path$1.extname(filePath));
7220
+ const fileName = path.basename(filePath, path.extname(filePath));
7296
7221
  if (fileName === "index") return "index";
7297
7222
  return fileName;
7298
7223
  }
@@ -7367,7 +7292,6 @@ export interface NavItem {
7367
7292
  export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as const;
7368
7293
  `;
7369
7294
  }
7370
-
7371
7295
  //#endregion
7372
7296
  //#region src/docs.ts
7373
7297
  /**
@@ -7421,6 +7345,46 @@ export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as
7421
7345
  * ```
7422
7346
  */
7423
7347
  const DOCS_MANIFEST_FILE = ".ox-content-docs-manifest.json";
7348
+ const DOCS_DATA_FILE = "docs.json";
7349
+ function escapeHtml$3(str) {
7350
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
7351
+ }
7352
+ function entryAnchor(name) {
7353
+ return name.toLowerCase();
7354
+ }
7355
+ function cleanSummaryText(text, maxLength = 120) {
7356
+ if (!text) return "";
7357
+ const collapsed = text.replace(/\s+/g, " ").trim();
7358
+ if (collapsed.length <= maxLength) return collapsed;
7359
+ return `${collapsed.slice(0, maxLength - 1).trimEnd()}…`;
7360
+ }
7361
+ function renderInlineHtml(text) {
7362
+ let html = "";
7363
+ let lastIndex = 0;
7364
+ const tokenPattern = /`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)/g;
7365
+ let match;
7366
+ while ((match = tokenPattern.exec(text)) !== null) {
7367
+ html += escapeHtml$3(text.slice(lastIndex, match.index));
7368
+ if (match[1]) html += `<code>${escapeHtml$3(match[1])}</code>`;
7369
+ else if (match[2] && match[3]) html += `<a href="${escapeHtml$3(match[3])}">${escapeHtml$3(match[2])}</a>`;
7370
+ lastIndex = match.index + match[0].length;
7371
+ }
7372
+ html += escapeHtml$3(text.slice(lastIndex));
7373
+ return html.replace(/\n/g, "<br>");
7374
+ }
7375
+ function renderParagraphsHtml(text) {
7376
+ return text.split(/\n\s*\n/).map((paragraph) => paragraph.trim()).filter(Boolean).map((paragraph) => `<p>${renderInlineHtml(paragraph)}</p>`).join("\n");
7377
+ }
7378
+ function renderCodeBlockHtml(code, language = "typescript") {
7379
+ return `<pre><code class="language-${language}">${escapeHtml$3(code)}</code></pre>`;
7380
+ }
7381
+ function buildDocsData(docs) {
7382
+ return {
7383
+ version: 1,
7384
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
7385
+ modules: docs
7386
+ };
7387
+ }
7424
7388
  /**
7425
7389
  * Regex pattern for matching JSDoc comment blocks.
7426
7390
  *
@@ -7525,7 +7489,7 @@ async function findFiles(dir, options) {
7525
7489
  return;
7526
7490
  }
7527
7491
  for (const entry of entries) {
7528
- const fullPath = path.join(currentDir, entry.name);
7492
+ const fullPath = path$1.join(currentDir, entry.name);
7529
7493
  if (entry.isDirectory()) {
7530
7494
  if (!isExcluded(fullPath, options.exclude)) await walk(fullPath);
7531
7495
  } else if (entry.isFile()) {
@@ -7781,7 +7745,7 @@ function generateMarkdown(docs, options) {
7781
7745
  if (options.groupBy === "file") {
7782
7746
  const docToFile = /* @__PURE__ */ new Map();
7783
7747
  for (const doc of docs) {
7784
- let fileName = path.basename(doc.file, path.extname(doc.file));
7748
+ let fileName = path$1.basename(doc.file, path$1.extname(doc.file));
7785
7749
  if (fileName === "index") fileName = "index-module";
7786
7750
  docToFile.set(doc, fileName);
7787
7751
  const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);
@@ -7801,74 +7765,132 @@ function generateMarkdown(docs, options) {
7801
7765
  return result;
7802
7766
  }
7803
7767
  function generateFileMarkdown(doc, options, currentFileName, symbolMap) {
7804
- let md = `# ${path.basename(doc.file)}\n\n`;
7768
+ let md = `# ${path$1.basename(doc.file)}\n\n`;
7805
7769
  if (options.githubUrl) {
7806
7770
  const sourceLink = generateSourceLink(doc.file, options.githubUrl);
7807
7771
  if (sourceLink) md += sourceLink + "\n\n";
7808
7772
  }
7773
+ md += `> ${doc.entries.length} documented symbol${doc.entries.length === 1 ? "" : "s"}. `;
7774
+ md += "Skim the one-line surface first, then expand the accordions for details.\n\n";
7775
+ md += "## Overview\n\n";
7776
+ for (const entry of doc.entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
7777
+ md += "\n## Reference\n\n";
7809
7778
  for (const entry of doc.entries) md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);
7810
7779
  return md;
7811
7780
  }
7781
+ function normalizeSignature(signature) {
7782
+ if (!signature) return;
7783
+ return signature.replace(/\s+/g, " ").replace(/^export\s+/, "").replace(/^async\s+function\s+/, "").replace(/^function\s+/, "").replace(/^class\s+/, "").trim();
7784
+ }
7785
+ function renderOverviewLine(entry, href) {
7786
+ const signature = normalizeSignature(entry.signature);
7787
+ const summary = cleanSummaryText(entry.description, 88);
7788
+ const parts = [`- [\`${entry.name}\`](${href})`, `\`${entry.kind}\``];
7789
+ if (signature) parts.push(`\`${signature}\``);
7790
+ if (summary) parts.push(`- ${summary}`);
7791
+ return `${parts.join(" ")}\n`;
7792
+ }
7793
+ function renderOverviewHtmlItem(entry, href) {
7794
+ const signature = normalizeSignature(entry.signature);
7795
+ const summary = cleanSummaryText(entry.description, 88);
7796
+ const fragments = [`<a href="${escapeHtml$3(href)}"><code>${escapeHtml$3(entry.name)}</code></a>`, `<span class="ox-api-module__kind">${escapeHtml$3(entry.kind)}</span>`];
7797
+ if (signature) fragments.push(`<code>${escapeHtml$3(signature)}</code>`);
7798
+ if (summary) fragments.push(`<span>${renderInlineHtml(summary)}</span>`);
7799
+ return `<li>${fragments.join("")}</li>`;
7800
+ }
7801
+ function renderParamsTableHtml(params) {
7802
+ return `<div class="ox-api-entry__section">
7803
+ <h4>Parameters</h4>
7804
+ <table>
7805
+ <thead>
7806
+ <tr><th>Name</th><th>Type</th><th>Description</th></tr>
7807
+ </thead>
7808
+ <tbody>
7809
+ ${params.map((param) => {
7810
+ const flags = [param.optional ? "optional" : "", param.default ? `default: ${param.default}` : ""].filter(Boolean);
7811
+ const description = [param.description, flags.join(" · ")].filter(Boolean).join(" — ");
7812
+ return `<tr>
7813
+ <td><code>${escapeHtml$3(param.name)}</code></td>
7814
+ <td><code>${escapeHtml$3(param.type)}</code></td>
7815
+ <td>${renderInlineHtml(description)}</td>
7816
+ </tr>`;
7817
+ }).join("\n")}
7818
+ </tbody>
7819
+ </table>
7820
+ </div>`;
7821
+ }
7822
+ function renderTagListHtml(tags) {
7823
+ return `<div class="ox-api-entry__section">
7824
+ <h4>Tags</h4>
7825
+ <ul class="ox-api-entry__tags">${Object.entries(tags).map(([tag, value]) => `<li><span class="ox-api-entry__tag-name">@${escapeHtml$3(tag)}</span><span>${renderInlineHtml(value)}</span></li>`).join("")}</ul>
7826
+ </div>`;
7827
+ }
7812
7828
  function generateEntryMarkdown(entry, options, currentFileName, symbolMap) {
7813
- let md = `## ${entry.name}\n\n`;
7814
- md += `\`${entry.kind}\`\n\n`;
7815
- if (entry.description) {
7816
- const processedDescription = currentFileName && symbolMap ? convertSymbolLinks(entry.description, currentFileName, symbolMap) : entry.description;
7817
- md += `${processedDescription}\n\n`;
7818
- }
7819
- if (options?.githubUrl) {
7820
- const sourceLink = generateSourceLink(entry.file, options.githubUrl, entry.line);
7821
- if (sourceLink) md += sourceLink + "\n\n";
7822
- }
7823
- if (entry.signature && entry.kind === "function") {
7824
- md += "```typescript\n";
7825
- md += entry.signature + "\n";
7826
- md += "```\n\n";
7827
- }
7828
- if (entry.params && entry.params.length > 0) {
7829
- md += "### Parameters\n\n";
7830
- md += "| Name | Type | Description |\n";
7831
- md += "|------|------|-------------|\n";
7832
- for (const param of entry.params) md += `| \`${param.name}\` | \`${param.type}\` | ${param.description} |\n`;
7833
- md += "\n";
7834
- }
7835
- if (entry.returns) {
7836
- md += "### Returns\n\n";
7837
- md += `\`${entry.returns.type}\` - ${entry.returns.description}\n\n`;
7838
- }
7829
+ const processedDescription = entry.description && currentFileName && symbolMap ? convertSymbolLinks(entry.description, currentFileName, symbolMap) : entry.description;
7830
+ const summarySignature = normalizeSignature(entry.signature);
7831
+ const sourceHref = options?.githubUrl ? generateSourceHref(entry.file, options.githubUrl, entry.line) : void 0;
7832
+ let body = "";
7833
+ if (processedDescription) body += renderParagraphsHtml(processedDescription) + "\n";
7834
+ if (sourceHref) body += `<p class="ox-api-entry__source"><a href="${escapeHtml$3(sourceHref)}">View source</a></p>\n`;
7835
+ if (entry.signature) body += `<div class="ox-api-entry__section">\n<h4>Signature</h4>\n${renderCodeBlockHtml(entry.signature)}\n</div>\n`;
7836
+ if (entry.params && entry.params.length > 0) body += renderParamsTableHtml(entry.params) + "\n";
7837
+ if (entry.returns) body += `<div class="ox-api-entry__section">
7838
+ <h4>Returns</h4>
7839
+ <p><code>${escapeHtml$3(entry.returns.type)}</code>${entry.returns.description ? ` — ${renderInlineHtml(entry.returns.description)}` : ""}</p>
7840
+ </div>\n`;
7839
7841
  if (entry.examples && entry.examples.length > 0) {
7840
- md += "### Examples\n\n";
7841
- for (const example of entry.examples) {
7842
- md += "```ts\n";
7843
- md += example.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
7844
- md += "\n```\n\n";
7845
- }
7846
- }
7847
- md += "---\n\n";
7848
- return md;
7842
+ const examplesHtml = entry.examples.map((example) => example.replace(/^```\w*\n?/, "").replace(/\n?```$/, "")).map((example) => renderCodeBlockHtml(example, "ts")).join("\n");
7843
+ body += `<div class="ox-api-entry__section">\n<h4>Examples</h4>\n${examplesHtml}\n</div>\n`;
7844
+ }
7845
+ if (entry.tags && Object.keys(entry.tags).length > 0) body += renderTagListHtml(entry.tags) + "\n";
7846
+ const summaryDescription = cleanSummaryText(processedDescription, summarySignature ? 80 : 120);
7847
+ const summaryParts = [`<span class="ox-api-entry__kind">${escapeHtml$3(entry.kind)}</span>`, `<code class="ox-api-entry__name">${escapeHtml$3(entry.name)}</code>`];
7848
+ if (summarySignature) summaryParts.push(`<code class="ox-api-entry__signature">${escapeHtml$3(summarySignature)}</code>`);
7849
+ if (summaryDescription) summaryParts.push(`<span class="ox-api-entry__description">${renderInlineHtml(summaryDescription)}</span>`);
7850
+ return `<details id="${entryAnchor(entry.name)}" class="ox-api-entry">
7851
+ <summary>${summaryParts.join("")}</summary>
7852
+ <div class="ox-api-entry__body">
7853
+ ${body.trim()}
7854
+ </div>
7855
+ </details>
7856
+
7857
+ `;
7849
7858
  }
7850
7859
  function generateIndex(docs, docToFile) {
7851
7860
  let md = "# API Documentation\n\n";
7852
7861
  md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
7862
+ md += "> Use search scopes like `@api transform` to limit results to the generated API reference.\n\n";
7853
7863
  md += "## Modules\n\n";
7854
7864
  for (const doc of docs) {
7855
- const displayName = path.basename(doc.file, path.extname(doc.file));
7865
+ const displayName = path$1.basename(doc.file, path$1.extname(doc.file));
7856
7866
  let fileName = displayName;
7857
7867
  if (docToFile && docToFile.has(doc)) fileName = docToFile.get(doc);
7858
7868
  else if (fileName === "index") fileName = "index-module";
7859
- md += `### [${displayName}](./${fileName}.md)\n\n`;
7860
- for (const entry of doc.entries) {
7861
- const desc = entry.description?.slice(0, 80) || "";
7862
- const ellipsis = entry.description && entry.description.length > 80 ? "..." : "";
7863
- md += `- \`${entry.kind}\` **${entry.name}** - ${desc}${ellipsis}\n`;
7864
- }
7865
- md += "\n";
7869
+ const countLabel = `${doc.entries.length} symbol${doc.entries.length === 1 ? "" : "s"}`;
7870
+ md += `<details class="ox-api-module">
7871
+ <summary>
7872
+ <span class="ox-api-module__title"><a href="./${fileName}.md">${escapeHtml$3(displayName)}</a></span>
7873
+ <span class="ox-api-module__count">${countLabel}</span>
7874
+ </summary>
7875
+ <div class="ox-api-module__body">
7876
+ <ul class="ox-api-module__list">
7877
+ `;
7878
+ for (const entry of doc.entries) md += ` ${renderOverviewHtmlItem(entry, `./${fileName}.md#${entryAnchor(entry.name)}`)}\n`;
7879
+ md += ` </ul>
7880
+ </div>
7881
+ </details>
7882
+
7883
+ `;
7866
7884
  }
7867
7885
  return md;
7868
7886
  }
7869
7887
  function generateCategoryMarkdown(kind, entries, options, symbolMap) {
7870
7888
  const categoryFileName = `${kind}s`;
7871
7889
  let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\n\n`;
7890
+ md += `> ${entries.length} documented ${kind}${entries.length === 1 ? "" : "s"} collected across modules.\n\n`;
7891
+ md += "## Overview\n\n";
7892
+ for (const entry of entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
7893
+ md += "\n## Reference\n\n";
7872
7894
  for (const entry of entries) md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);
7873
7895
  return md;
7874
7896
  }
@@ -7878,10 +7900,8 @@ function generateCategoryIndex(byKind) {
7878
7900
  for (const [kind, entries] of byKind) {
7879
7901
  const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + "s";
7880
7902
  md += `## [${kindTitle}](./${kind}s.md)\n\n`;
7881
- for (const entry of entries) {
7882
- const desc = entry.description?.slice(0, 60) || "";
7883
- md += `- **${entry.name}** - ${desc}...\n`;
7884
- }
7903
+ md += `> ${entries.length} item${entries.length === 1 ? "" : "s"}.\n\n`;
7904
+ for (const entry of entries) md += renderOverviewLine(entry, `./${kind}s.md#${entryAnchor(entry.name)}`);
7885
7905
  md += "\n";
7886
7906
  }
7887
7907
  return md;
@@ -7922,7 +7942,7 @@ function convertSymbolLinks(text, currentFileName, symbolMap) {
7922
7942
  function buildSymbolMap(docs) {
7923
7943
  const map = /* @__PURE__ */ new Map();
7924
7944
  for (const doc of docs) {
7925
- let fileName = path.basename(doc.file, path.extname(doc.file));
7945
+ let fileName = path$1.basename(doc.file, path$1.extname(doc.file));
7926
7946
  if (fileName === "index") fileName = "index-module";
7927
7947
  for (const entry of doc.entries) map.set(entry.name, {
7928
7948
  name: entry.name,
@@ -7939,7 +7959,8 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
7939
7959
  await fs$1.promises.mkdir(outDir, { recursive: true });
7940
7960
  const generatedFiles = new Set(Object.keys(docs));
7941
7961
  if (extractedDocs && options?.generateNav && options.groupBy === "file") generatedFiles.add("nav.ts");
7942
- const manifestPath = path.join(outDir, DOCS_MANIFEST_FILE);
7962
+ if (extractedDocs) generatedFiles.add(DOCS_DATA_FILE);
7963
+ const manifestPath = path$1.join(outDir, DOCS_MANIFEST_FILE);
7943
7964
  let previousFiles = [];
7944
7965
  try {
7945
7966
  previousFiles = JSON.parse(await fs$1.promises.readFile(manifestPath, "utf-8"));
@@ -7948,17 +7969,18 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
7948
7969
  }
7949
7970
  for (const staleFile of previousFiles) {
7950
7971
  if (generatedFiles.has(staleFile)) continue;
7951
- await fs$1.promises.rm(path.join(outDir, staleFile), { force: true });
7972
+ await fs$1.promises.rm(path$1.join(outDir, staleFile), { force: true });
7952
7973
  }
7953
7974
  for (const [fileName, content] of Object.entries(docs)) {
7954
- const filePath = path.join(outDir, fileName);
7975
+ const filePath = path$1.join(outDir, fileName);
7955
7976
  await fs$1.promises.writeFile(filePath, content, "utf-8");
7956
7977
  }
7957
7978
  if (extractedDocs && options?.generateNav && options.groupBy === "file") {
7958
7979
  const navCode = generateNavCode(generateNavMetadata(extractedDocs, "/api"), "apiNav");
7959
- const navFilePath = path.join(outDir, "nav.ts");
7980
+ const navFilePath = path$1.join(outDir, "nav.ts");
7960
7981
  await fs$1.promises.writeFile(navFilePath, navCode, "utf-8");
7961
7982
  }
7983
+ if (extractedDocs) await fs$1.promises.writeFile(path$1.join(outDir, DOCS_DATA_FILE), JSON.stringify(buildDocsData(extractedDocs), null, 2), "utf-8");
7962
7984
  await fs$1.promises.writeFile(manifestPath, JSON.stringify([...generatedFiles].sort(), null, 2), "utf-8");
7963
7985
  }
7964
7986
  /**
@@ -7970,10 +7992,13 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
7970
7992
  * @param filePath - Full path to the source file
7971
7993
  * @param githubUrl - Base GitHub repository URL
7972
7994
  * @param lineNumber - Optional line number to link to
7973
- * @returns Markdown link to source code
7995
+ * @returns Absolute GitHub URL to source code
7974
7996
  */
7997
+ function generateSourceHref(filePath, githubUrl, lineNumber) {
7998
+ return `${githubUrl}/blob/main/${filePath.replace(/^.*?\/(npm|packages|crates|src)\//, "$1/")}${lineNumber ? `#L${lineNumber}` : ""}`;
7999
+ }
7975
8000
  function generateSourceLink(filePath, githubUrl, lineNumber) {
7976
- return `**[Source](${`${githubUrl}/blob/main/${filePath.replace(/^.*?\/(npm|packages|crates|src)\//, "$1/")}${lineNumber ? `#L${lineNumber}` : ""}`})**`;
8001
+ return `**[Source](${generateSourceHref(filePath, githubUrl, lineNumber)})**`;
7977
8002
  }
7978
8003
  function resolveDocsOptions(options) {
7979
8004
  if (options === false) return false;
@@ -7996,7 +8021,6 @@ function resolveDocsOptions(options) {
7996
8021
  generateNav: opts.generateNav ?? true
7997
8022
  };
7998
8023
  }
7999
-
8000
8024
  //#endregion
8001
8025
  //#region src/og-image/renderer.ts
8002
8026
  /**
@@ -8041,10 +8065,10 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
8041
8065
  await route.continue();
8042
8066
  return;
8043
8067
  }
8044
- const filePath = path.join(publicDir, url.pathname);
8068
+ const filePath = path$1.join(publicDir, url.pathname);
8045
8069
  try {
8046
8070
  const body = await fs.readFile(filePath);
8047
- const ext = path.extname(filePath).toLowerCase();
8071
+ const ext = path$1.extname(filePath).toLowerCase();
8048
8072
  await route.fulfill({
8049
8073
  body,
8050
8074
  contentType: {
@@ -8079,7 +8103,6 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
8079
8103
  });
8080
8104
  return Buffer.from(screenshot);
8081
8105
  }
8082
-
8083
8106
  //#endregion
8084
8107
  //#region src/og-image/browser.ts
8085
8108
  /**
@@ -8125,7 +8148,6 @@ async function openBrowser() {
8125
8148
  return null;
8126
8149
  }
8127
8150
  }
8128
-
8129
8151
  //#endregion
8130
8152
  //#region src/og-image/template.ts
8131
8153
  /**
@@ -8155,7 +8177,6 @@ function getDefaultTemplate() {
8155
8177
  </div>`;
8156
8178
  };
8157
8179
  }
8158
-
8159
8180
  //#endregion
8160
8181
  //#region src/og-image/cache.ts
8161
8182
  /**
@@ -8181,7 +8202,7 @@ function computeCacheKey(templateSource, props, width, height) {
8181
8202
  * Returns the cached file path if found, null otherwise.
8182
8203
  */
8183
8204
  async function getCached(cacheDir, key) {
8184
- const filePath = path.join(cacheDir, `${key}.png`);
8205
+ const filePath = path$1.join(cacheDir, `${key}.png`);
8185
8206
  try {
8186
8207
  return await fs.readFile(filePath);
8187
8208
  } catch {
@@ -8193,12 +8214,11 @@ async function getCached(cacheDir, key) {
8193
8214
  */
8194
8215
  async function writeCache(cacheDir, key, png) {
8195
8216
  await fs.mkdir(cacheDir, { recursive: true });
8196
- const filePath = path.join(cacheDir, `${key}.png`);
8217
+ const filePath = path$1.join(cacheDir, `${key}.png`);
8197
8218
  await fs.writeFile(filePath, png);
8198
8219
  }
8199
-
8200
8220
  //#endregion
8201
- //#region \0@oxc-project+runtime@0.110.0/helpers/usingCtx.js
8221
+ //#region \0@oxc-project+runtime@0.115.0/helpers/usingCtx.js
8202
8222
  function _usingCtx() {
8203
8223
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
8204
8224
  var n = Error();
@@ -8253,7 +8273,6 @@ function _usingCtx() {
8253
8273
  }
8254
8274
  };
8255
8275
  }
8256
-
8257
8276
  //#endregion
8258
8277
  //#region src/og-image/index.ts
8259
8278
  /**
@@ -8286,14 +8305,14 @@ function resolveOgImageOptions(options) {
8286
8305
  */
8287
8306
  async function resolveTemplate(options, root) {
8288
8307
  if (!options.template) return getDefaultTemplate();
8289
- const templatePath = path.resolve(root, options.template);
8308
+ const templatePath = path$1.resolve(root, options.template);
8290
8309
  const fs = await import("fs/promises");
8291
8310
  try {
8292
8311
  await fs.access(templatePath);
8293
8312
  } catch {
8294
8313
  throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);
8295
8314
  }
8296
- switch (path.extname(templatePath).toLowerCase()) {
8315
+ switch (path$1.extname(templatePath).toLowerCase()) {
8297
8316
  case ".vue": return resolveVueTemplate(templatePath, options, root);
8298
8317
  case ".svelte": return resolveSvelteTemplate(templatePath, root);
8299
8318
  case ".tsx":
@@ -8307,9 +8326,9 @@ async function resolveTemplate(options, root) {
8307
8326
  async function resolveTsTemplate(templatePath, options, root) {
8308
8327
  const fs = await import("fs/promises");
8309
8328
  const { rolldown } = await import("rolldown");
8310
- const cacheDir = path.join(root, ".cache", "og-images");
8329
+ const cacheDir = path$1.join(root, ".cache", "og-images");
8311
8330
  await fs.mkdir(cacheDir, { recursive: true });
8312
- const outfile = path.join(cacheDir, "_template.mjs");
8331
+ const outfile = path$1.join(cacheDir, "_template.mjs");
8313
8332
  const bundle = await rolldown({
8314
8333
  input: templatePath,
8315
8334
  platform: "node"
@@ -8332,9 +8351,9 @@ async function resolveTsTemplate(templatePath, options, root) {
8332
8351
  async function resolveVueTemplate(templatePath, options, root) {
8333
8352
  const fs = await import("fs/promises");
8334
8353
  const { rolldown } = await import("rolldown");
8335
- const cacheDir = path.join(root, ".cache", "og-images");
8354
+ const cacheDir = path$1.join(root, ".cache", "og-images");
8336
8355
  await fs.mkdir(cacheDir, { recursive: true });
8337
- const outfile = path.join(cacheDir, "_template_vue.mjs");
8356
+ const outfile = path$1.join(cacheDir, "_template_vue.mjs");
8338
8357
  const bundle = await rolldown({
8339
8358
  input: templatePath,
8340
8359
  platform: "node",
@@ -8430,9 +8449,9 @@ async function getVizejsPlugin() {
8430
8449
  async function resolveSvelteTemplate(templatePath, root) {
8431
8450
  const fs = await import("fs/promises");
8432
8451
  const { rolldown } = await import("rolldown");
8433
- const cacheDir = path.join(root, ".cache", "og-images");
8452
+ const cacheDir = path$1.join(root, ".cache", "og-images");
8434
8453
  await fs.mkdir(cacheDir, { recursive: true });
8435
- const outfile = path.join(cacheDir, "_template_svelte.mjs");
8454
+ const outfile = path$1.join(cacheDir, "_template_svelte.mjs");
8436
8455
  const bundle = await rolldown({
8437
8456
  input: templatePath,
8438
8457
  platform: "node",
@@ -8488,9 +8507,9 @@ function createSvelteCompilerPlugin() {
8488
8507
  async function resolveReactTemplate(templatePath, root) {
8489
8508
  const fs = await import("fs/promises");
8490
8509
  const { rolldown } = await import("rolldown");
8491
- const cacheDir = path.join(root, ".cache", "og-images");
8510
+ const cacheDir = path$1.join(root, ".cache", "og-images");
8492
8511
  await fs.mkdir(cacheDir, { recursive: true });
8493
- const outfile = path.join(cacheDir, "_template_react.mjs");
8512
+ const outfile = path$1.join(cacheDir, "_template_react.mjs");
8494
8513
  const bundle = await rolldown({
8495
8514
  input: templatePath,
8496
8515
  platform: "node",
@@ -8540,7 +8559,7 @@ async function resolveReactTemplate(templatePath, root) {
8540
8559
  async function computeTemplateSource(options, root) {
8541
8560
  if (!options.template) return "__default__";
8542
8561
  const fs = await import("fs/promises");
8543
- const templatePath = path.resolve(root, options.template);
8562
+ const templatePath = path$1.resolve(root, options.template);
8544
8563
  const content = await fs.readFile(templatePath, "utf-8");
8545
8564
  return crypto.createHash("sha256").update(content).digest("hex");
8546
8565
  }
@@ -8558,7 +8577,7 @@ async function generateOgImages(pages, options, root) {
8558
8577
  if (pages.length === 0) return [];
8559
8578
  const templateFn = await resolveTemplate(options, root);
8560
8579
  const templateSource = await computeTemplateSource(options, root);
8561
- const cacheDir = path.join(root, ".cache", "og-images");
8580
+ const cacheDir = path$1.join(root, ".cache", "og-images");
8562
8581
  if (options.cache) {
8563
8582
  const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);
8564
8583
  if (allCached) return allCached;
@@ -8570,7 +8589,7 @@ async function generateOgImages(pages, options, root) {
8570
8589
  error: "Chromium not available"
8571
8590
  }));
8572
8591
  const results = [];
8573
- const publicDir = path.join(root, "public");
8592
+ const publicDir = path$1.join(root, "public");
8574
8593
  const concurrency = Math.max(1, options.concurrency);
8575
8594
  for (let i = 0; i < pages.length; i += concurrency) {
8576
8595
  const batch = pages.slice(i, i + concurrency);
@@ -8594,7 +8613,7 @@ async function tryServeAllFromCache(pages, templateSource, options, cacheDir) {
8594
8613
  for (const entry of pages) {
8595
8614
  const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
8596
8615
  if (!cached) return null;
8597
- await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
8616
+ await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
8598
8617
  await fs.writeFile(entry.outputPath, cached);
8599
8618
  results.push({
8600
8619
  outputPath: entry.outputPath,
@@ -8612,7 +8631,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
8612
8631
  if (options.cache) {
8613
8632
  const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
8614
8633
  if (cached) {
8615
- await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
8634
+ await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
8616
8635
  await fs.writeFile(entry.outputPath, cached);
8617
8636
  return {
8618
8637
  outputPath: entry.outputPath,
@@ -8622,7 +8641,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
8622
8641
  }
8623
8642
  const html = await templateFn(entry.props);
8624
8643
  const png = await session.renderPage(html, options.width, options.height, publicDir);
8625
- await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
8644
+ await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
8626
8645
  await fs.writeFile(entry.outputPath, png);
8627
8646
  if (options.cache) await writeCache(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height), png);
8628
8647
  return {
@@ -8637,7 +8656,6 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
8637
8656
  };
8638
8657
  }
8639
8658
  }
8640
-
8641
8659
  //#endregion
8642
8660
  //#region src/plugins/index.ts
8643
8661
  /**
@@ -8647,28 +8665,27 @@ async function transformAllPlugins(html, options = {}) {
8647
8665
  const { tabs = true, youtube = true, github = true, ogp = true, mermaid = true, githubToken } = options;
8648
8666
  let result = html;
8649
8667
  if (tabs) {
8650
- const { transformTabs } = await import("./tabs.js");
8668
+ const { transformTabs } = await import("./tabs.mjs");
8651
8669
  result = await transformTabs(result);
8652
8670
  }
8653
8671
  if (youtube) {
8654
- const { transformYouTube } = await import("./youtube.js");
8672
+ const { transformYouTube } = await import("./youtube.mjs");
8655
8673
  result = await transformYouTube(result);
8656
8674
  }
8657
8675
  if (github) {
8658
- const { transformGitHub } = await import("./github.js");
8676
+ const { transformGitHub } = await import("./github.mjs");
8659
8677
  result = await transformGitHub(result, void 0, { token: githubToken });
8660
8678
  }
8661
8679
  if (ogp) {
8662
- const { transformOgp } = await import("./ogp.js");
8680
+ const { transformOgp } = await import("./ogp.mjs");
8663
8681
  result = await transformOgp(result);
8664
8682
  }
8665
8683
  if (mermaid) {
8666
- const { transformMermaidStatic } = await import("./mermaid.js");
8684
+ const { transformMermaidStatic } = await import("./mermaid2.mjs");
8667
8685
  result = await transformMermaidStatic(result);
8668
8686
  }
8669
8687
  return result;
8670
8688
  }
8671
-
8672
8689
  //#endregion
8673
8690
  //#region src/island/parse.ts
8674
8691
  /**
@@ -8860,7 +8877,6 @@ initIslands((el, props) => {
8860
8877
  });
8861
8878
  `;
8862
8879
  }
8863
-
8864
8880
  //#endregion
8865
8881
  //#region src/theme.ts
8866
8882
  /**
@@ -9043,7 +9059,6 @@ function themeToNapi(theme) {
9043
9059
  js: theme.js || void 0
9044
9060
  };
9045
9061
  }
9046
-
9047
9062
  //#endregion
9048
9063
  //#region src/ssg.ts
9049
9064
  /**
@@ -9086,6 +9101,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9086
9101
  --color-primary-hover: #ce5937;
9087
9102
  --color-code-bg: #1e293b;
9088
9103
  --color-code-text: #e2e8f0;
9104
+ --color-code-line-highlight: rgba(56, 189, 248, 0.16);
9105
+ --color-code-line-warning: rgba(245, 158, 11, 0.18);
9106
+ --color-code-line-warning-border: #f59e0b;
9107
+ --color-code-line-error: rgba(239, 68, 68, 0.18);
9108
+ --color-code-line-error-border: #ef4444;
9089
9109
  }
9090
9110
  [data-theme="dark"] {
9091
9111
  --color-bg: #141414;
@@ -9097,6 +9117,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9097
9117
  --color-primary-hover: #d4845f;
9098
9118
  --color-code-bg: #1a1a1a;
9099
9119
  --color-code-text: #e5e5e5;
9120
+ --color-code-line-highlight: rgba(14, 165, 233, 0.2);
9121
+ --color-code-line-warning: rgba(245, 158, 11, 0.2);
9122
+ --color-code-line-warning-border: #f59e0b;
9123
+ --color-code-line-error: rgba(239, 68, 68, 0.22);
9124
+ --color-code-line-error-border: #f87171;
9100
9125
  }
9101
9126
  @media (prefers-color-scheme: dark) {
9102
9127
  :root:not([data-theme="light"]) {
@@ -9109,6 +9134,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9109
9134
  --color-primary-hover: #d4845f;
9110
9135
  --color-code-bg: #1a1a1a;
9111
9136
  --color-code-text: #e5e5e5;
9137
+ --color-code-line-highlight: rgba(14, 165, 233, 0.2);
9138
+ --color-code-line-warning: rgba(245, 158, 11, 0.2);
9139
+ --color-code-line-warning-border: #f59e0b;
9140
+ --color-code-line-error: rgba(239, 68, 68, 0.22);
9141
+ --color-code-line-error-border: #f87171;
9112
9142
  }
9113
9143
  }
9114
9144
  * { box-sizing: border-box; margin: 0; padding: 0; }
@@ -9409,6 +9439,25 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9409
9439
  padding: 0;
9410
9440
  font-size: 0.8125rem;
9411
9441
  }
9442
+ .content pre.ox-code-block code {
9443
+ display: block;
9444
+ }
9445
+ .content pre.ox-code-block .line {
9446
+ display: block;
9447
+ margin: 0 -1.25rem;
9448
+ padding: 0 1.25rem;
9449
+ }
9450
+ .content pre.ox-code-block .ox-code-line--highlight {
9451
+ background: var(--color-code-line-highlight);
9452
+ }
9453
+ .content pre.ox-code-block .ox-code-line--warning {
9454
+ background: var(--color-code-line-warning);
9455
+ box-shadow: inset 3px 0 0 var(--color-code-line-warning-border);
9456
+ }
9457
+ .content pre.ox-code-block .ox-code-line--error {
9458
+ background: var(--color-code-line-error);
9459
+ box-shadow: inset 3px 0 0 var(--color-code-line-error-border);
9460
+ }
9412
9461
  .content table {
9413
9462
  width: 100%;
9414
9463
  border-collapse: collapse;
@@ -9452,6 +9501,10 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9452
9501
  overflow-x: auto;
9453
9502
  -webkit-overflow-scrolling: touch;
9454
9503
  }
9504
+ .content pre.ox-code-block .line {
9505
+ margin: 0 -0.75rem;
9506
+ padding: 0 0.75rem;
9507
+ }
9455
9508
  .content code { font-size: 0.8125em; }
9456
9509
  .content table {
9457
9510
  display: block;
@@ -9625,6 +9678,39 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9625
9678
  }
9626
9679
  };
9627
9680
 
9681
+ const parseScopedQuery = (query) => {
9682
+ const scopes = [];
9683
+ const terms = [];
9684
+ for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
9685
+ if (part.startsWith('@') && part.length > 1) {
9686
+ scopes.push(part.slice(1).toLowerCase());
9687
+ } else {
9688
+ terms.push(part);
9689
+ }
9690
+ }
9691
+ return { text: terms.join(' ').trim(), scopes: [...new Set(scopes)] };
9692
+ };
9693
+
9694
+ const getScopesForDoc = (doc) => {
9695
+ const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
9696
+ const segments = source.split('/').filter(Boolean);
9697
+ if (segments.length <= 1) return [];
9698
+
9699
+ const scopes = [];
9700
+ let current = '';
9701
+ for (const segment of segments.slice(0, -1)) {
9702
+ current = current ? current + '/' + segment : segment;
9703
+ scopes.push(current);
9704
+ }
9705
+ return scopes;
9706
+ };
9707
+
9708
+ const matchesScopes = (doc, scopes) => {
9709
+ if (!scopes.length) return true;
9710
+ const docScopes = new Set(getScopesForDoc(doc));
9711
+ return scopes.some((scope) => docScopes.has(scope));
9712
+ };
9713
+
9628
9714
  // Tokenize query
9629
9715
  const tokenize = (text) => {
9630
9716
  const tokens = [];
@@ -9647,27 +9733,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9647
9733
 
9648
9734
  // Perform search
9649
9735
  const performSearch = async (query) => {
9650
- if (!query.trim()) {
9651
- searchResults.innerHTML = '';
9652
- results = [];
9653
- return;
9654
- }
9655
9736
  await loadSearchIndex();
9656
9737
  if (!searchIndex) {
9657
9738
  searchResults.innerHTML = '<div class="search-empty">Search index not available</div>';
9658
9739
  return;
9659
9740
  }
9660
9741
 
9661
- const tokens = tokenize(query);
9662
- if (!tokens.length) {
9742
+ const parsedQuery = parseScopedQuery(query);
9743
+ if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
9663
9744
  searchResults.innerHTML = '';
9664
9745
  results = [];
9665
9746
  return;
9666
9747
  }
9667
9748
 
9749
+ const tokens = tokenize(parsedQuery.text);
9668
9750
  const k1 = 1.2, b = 0.75;
9669
9751
  const docScores = new Map();
9670
9752
 
9753
+ if (!tokens.length) {
9754
+ searchIndex.documents.forEach((doc, docIdx) => {
9755
+ if (matchesScopes(doc, parsedQuery.scopes)) {
9756
+ docScores.set(docIdx, { score: 0, matches: new Set() });
9757
+ }
9758
+ });
9759
+ }
9760
+
9671
9761
  for (let i = 0; i < tokens.length; i++) {
9672
9762
  const token = tokens[i];
9673
9763
  const isLast = i === tokens.length - 1;
@@ -9686,6 +9776,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9686
9776
  for (const posting of postings) {
9687
9777
  const doc = searchIndex.documents[posting.doc_idx];
9688
9778
  if (!doc) continue;
9779
+ if (!matchesScopes(doc, parsedQuery.scopes)) continue;
9689
9780
  const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;
9690
9781
  const tf = posting.tf;
9691
9782
  const docLen = doc.body.length;
@@ -9704,6 +9795,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9704
9795
  results = Array.from(docScores.entries())
9705
9796
  .map(([docIdx, data]) => {
9706
9797
  const doc = searchIndex.documents[docIdx];
9798
+ const scopes = getScopesForDoc(doc);
9707
9799
  let snippet = '';
9708
9800
  if (doc.body) {
9709
9801
  const bodyLower = doc.body.toLowerCase();
@@ -9712,15 +9804,15 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9712
9804
  const pos = bodyLower.indexOf(match);
9713
9805
  if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;
9714
9806
  }
9715
- const start = Math.max(0, firstPos - 50);
9807
+ const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
9716
9808
  const end = Math.min(doc.body.length, start + 150);
9717
9809
  snippet = doc.body.slice(start, end);
9718
9810
  if (start > 0) snippet = '...' + snippet;
9719
9811
  if (end < doc.body.length) snippet += '...';
9720
9812
  }
9721
- return { ...doc, score: data.score, snippet };
9813
+ return { ...doc, score: data.score, scopes, snippet };
9722
9814
  })
9723
- .sort((a, b) => b.score - a.score)
9815
+ .sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
9724
9816
  .slice(0, 10);
9725
9817
 
9726
9818
  selectedIndex = 0;
@@ -9734,7 +9826,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
9734
9826
  }
9735
9827
  searchResults.innerHTML = results.map((r, i) =>
9736
9828
  '<a href="' + r.url + '" class="search-result' + (i === selectedIndex ? ' selected' : '') + '">' +
9737
- '<div class="search-result-title">' + r.title + '</div>' +
9829
+ '<div class="search-result-title">' + r.title + (r.scopes?.length ? '<span class="search-result-scope">@' + r.scopes[0] + '</span>' : '') + '</div>' +
9738
9830
  (r.snippet ? '<div class="search-result-snippet">' + r.snippet + '</div>' : '') +
9739
9831
  '</a>'
9740
9832
  ).join('');
@@ -9865,7 +9957,7 @@ function generateBareHtmlPage(content, title) {
9865
9957
  * Generates HTML page with navigation using Rust NAPI bindings.
9866
9958
  */
9867
9959
  async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, theme) {
9868
- const mod = await import("@ox-content/napi");
9960
+ const mod = await importNapiModule();
9869
9961
  const tocForRust = pageData.toc.map((entry) => ({
9870
9962
  depth: entry.depth,
9871
9963
  text: entry.text,
@@ -9919,20 +10011,167 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
9919
10011
  theme: themeForRust
9920
10012
  });
9921
10013
  }
10014
+ const SSG_STYLE_BLOCK_RE = /[ \t]*<!-- ox-content:styles:start -->\s*<style>([\s\S]*?)<\/style>\s*<!-- ox-content:styles:end -->/;
10015
+ const SSG_SCRIPT_BLOCK_RE = /[ \t]*<!-- ox-content:scripts:start -->\s*<script>([\s\S]*?)<\/script>\s*<!-- ox-content:scripts:end -->/;
10016
+ const FIRST_INLINE_STYLE_RE = /[ \t]*<style>([\s\S]*?)<\/style>/;
10017
+ const LAST_INLINE_BODY_SCRIPT_RE = /[ \t]*<script>([\s\S]*?)<\/script>\s*<\/body>/;
10018
+ const CSS_SECTION_RE = /\/\* ox-content:css:([a-z0-9-]+):start \*\/\s*([\s\S]*?)\s*\/\* ox-content:css:\1:end \*\//g;
10019
+ const SEARCH_CHUNK_RE = /\/\/ ox-content:search:start\s*([\s\S]*?)\s*\/\/ ox-content:search:end/;
10020
+ const SEARCH_CHUNK_PLACEHOLDER = "__OX_CONTENT_SEARCH_CHUNK__";
10021
+ const CORE_CSS_SECTION_NAMES = new Set(["base", "footer"]);
10022
+ const THEME_INLINE_CSS_MAX_BYTES = 2048;
10023
+ function createContentHash(content) {
10024
+ return createHash("sha256").update(content).digest("hex").slice(0, 10);
10025
+ }
10026
+ function sanitizeChunkLabel(label) {
10027
+ return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "asset";
10028
+ }
10029
+ function toPublicAssetPath(base, fileName) {
10030
+ return `${base.endsWith("/") ? base : `${base}/`}assets/${fileName}`;
10031
+ }
10032
+ function hasRelativeCssUrls(css) {
10033
+ let cursor = 0;
10034
+ while (cursor < css.length) {
10035
+ const urlIndex = css.indexOf("url(", cursor);
10036
+ if (urlIndex === -1) return false;
10037
+ let valueStart = urlIndex + 4;
10038
+ while (valueStart < css.length && /\s/.test(css[valueStart])) valueStart++;
10039
+ const quote = css[valueStart] === "\"" || css[valueStart] === "'" ? css[valueStart] : "";
10040
+ if (quote) valueStart++;
10041
+ let valueEnd = valueStart;
10042
+ while (valueEnd < css.length) {
10043
+ const char = css[valueEnd];
10044
+ if (quote) {
10045
+ if (char === "\\") {
10046
+ valueEnd += 2;
10047
+ continue;
10048
+ }
10049
+ if (char === quote) break;
10050
+ } else if (char === ")") break;
10051
+ valueEnd++;
10052
+ }
10053
+ const value = css.slice(valueStart, valueEnd).trim();
10054
+ if (value && !value.startsWith("data:") && !value.startsWith("http:") && !value.startsWith("https:") && !value.startsWith("//") && !value.startsWith("/") && !value.startsWith("#") && !value.startsWith("blob:") && !value.startsWith("var(")) return true;
10055
+ cursor = valueEnd + 1;
10056
+ }
10057
+ return false;
10058
+ }
10059
+ function createSharedAssetChunk(type, label, content, outDir, base) {
10060
+ const hash = createContentHash(content);
10061
+ const fileName = `ox-content-${sanitizeChunkLabel(label)}-${hash}.${type}`;
10062
+ return {
10063
+ outputPath: path$1.join(outDir, "assets", fileName),
10064
+ publicPath: toPublicAssetPath(base, fileName),
10065
+ content
10066
+ };
10067
+ }
10068
+ function extractCssSections(cssContent) {
10069
+ return Array.from(cssContent.matchAll(CSS_SECTION_RE)).map(([, name, content]) => ({
10070
+ name,
10071
+ content: content.trim()
10072
+ })).filter((section) => section.content.length > 0);
10073
+ }
10074
+ function getOrCreateSharedChunk(chunks, type, label, content, outDir, base) {
10075
+ let chunk = chunks.get(content);
10076
+ if (!chunk) {
10077
+ chunk = createSharedAssetChunk(type, label, content, outDir, base);
10078
+ chunks.set(content, chunk);
10079
+ }
10080
+ return chunk;
10081
+ }
10082
+ function buildStyleReplacement(cssContent, cssChunks, outDir, base) {
10083
+ const sections = extractCssSections(cssContent);
10084
+ const effectiveSections = sections.length > 0 ? sections : [{
10085
+ name: "css",
10086
+ content: cssContent.trim()
10087
+ }];
10088
+ const coreContent = effectiveSections.filter((section) => CORE_CSS_SECTION_NAMES.has(section.name)).map((section) => section.content).join("\n").trim();
10089
+ const fragments = [];
10090
+ if (coreContent) {
10091
+ const coreChunk = getOrCreateSharedChunk(cssChunks, "css", "core", coreContent, outDir, base);
10092
+ fragments.push(` <link rel="stylesheet" href="${coreChunk.publicPath}">`);
10093
+ }
10094
+ for (const section of effectiveSections) {
10095
+ if (CORE_CSS_SECTION_NAMES.has(section.name)) continue;
10096
+ if (section.name === "theme" && (hasRelativeCssUrls(section.content) || section.content.length <= THEME_INLINE_CSS_MAX_BYTES) || hasRelativeCssUrls(section.content)) {
10097
+ fragments.push(` <style>${section.content}</style>`);
10098
+ continue;
10099
+ }
10100
+ const chunk = getOrCreateSharedChunk(cssChunks, "css", section.name, section.content, outDir, base);
10101
+ fragments.push(` <link rel="stylesheet" href="${chunk.publicPath}">`);
10102
+ }
10103
+ return fragments.join("\n");
10104
+ }
10105
+ function buildScriptReplacement(jsContent, jsChunks, outDir, base) {
10106
+ const searchMatch = jsContent.match(SEARCH_CHUNK_RE);
10107
+ if (searchMatch && jsContent.includes(SEARCH_CHUNK_PLACEHOLDER)) {
10108
+ const searchContent = searchMatch[1].trim();
10109
+ if (searchContent) {
10110
+ const searchChunk = getOrCreateSharedChunk(jsChunks, "js", "search", searchContent, outDir, base);
10111
+ const coreContent = jsContent.replace(SEARCH_CHUNK_RE, "").replaceAll(SEARCH_CHUNK_PLACEHOLDER, searchChunk.publicPath).trim();
10112
+ if (coreContent) return ` <script defer src="${getOrCreateSharedChunk(jsChunks, "js", "core", coreContent, outDir, base).publicPath}"><\/script>`;
10113
+ }
10114
+ }
10115
+ const fallbackContent = jsContent.trim();
10116
+ if (!fallbackContent) return "";
10117
+ return ` <script defer src="${getOrCreateSharedChunk(jsChunks, "js", "js", fallbackContent, outDir, base).publicPath}"><\/script>`;
10118
+ }
10119
+ async function externalizeSharedPageAssets(pages, outDir, base) {
10120
+ const cssChunks = /* @__PURE__ */ new Map();
10121
+ const jsChunks = /* @__PURE__ */ new Map();
10122
+ const optimizedPages = pages.map((page) => {
10123
+ let html = page.html;
10124
+ const styleMatch = html.match(SSG_STYLE_BLOCK_RE);
10125
+ if (styleMatch) {
10126
+ const replacement = buildStyleReplacement(styleMatch[1], cssChunks, outDir, base);
10127
+ html = html.replace(SSG_STYLE_BLOCK_RE, replacement);
10128
+ } else {
10129
+ const inlineStyleMatch = html.match(FIRST_INLINE_STYLE_RE);
10130
+ if (inlineStyleMatch) {
10131
+ const replacement = buildStyleReplacement(inlineStyleMatch[1], cssChunks, outDir, base);
10132
+ html = html.replace(FIRST_INLINE_STYLE_RE, replacement);
10133
+ }
10134
+ }
10135
+ const scriptMatch = html.match(SSG_SCRIPT_BLOCK_RE);
10136
+ if (scriptMatch) {
10137
+ const replacement = buildScriptReplacement(scriptMatch[1], jsChunks, outDir, base);
10138
+ html = html.replace(SSG_SCRIPT_BLOCK_RE, replacement);
10139
+ } else {
10140
+ const inlineScriptMatch = html.match(LAST_INLINE_BODY_SCRIPT_RE);
10141
+ if (inlineScriptMatch) {
10142
+ const replacement = buildScriptReplacement(inlineScriptMatch[1], jsChunks, outDir, base);
10143
+ html = html.replace(LAST_INLINE_BODY_SCRIPT_RE, replacement ? `${replacement}\n</body>` : "</body>");
10144
+ }
10145
+ }
10146
+ return {
10147
+ ...page,
10148
+ html
10149
+ };
10150
+ });
10151
+ const chunks = [...cssChunks.values(), ...jsChunks.values()];
10152
+ await Promise.all(chunks.map(async (chunk) => {
10153
+ await fs.mkdir(path$1.dirname(chunk.outputPath), { recursive: true });
10154
+ await fs.writeFile(chunk.outputPath, chunk.content, "utf-8");
10155
+ }));
10156
+ return {
10157
+ pages: optimizedPages,
10158
+ assets: chunks.map((chunk) => chunk.outputPath)
10159
+ };
10160
+ }
9922
10161
  /**
9923
10162
  * Converts a markdown file path to its corresponding HTML output path.
9924
10163
  */
9925
10164
  function getOutputPath(inputPath, srcDir, outDir, extension) {
9926
- const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
9927
- if (baseName.endsWith(`index${extension}`)) return path.join(outDir, baseName);
10165
+ const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
10166
+ if (baseName.endsWith(`index${extension}`)) return path$1.join(outDir, baseName);
9928
10167
  const dirName = baseName.replace(new RegExp(`\\${extension}$`), "");
9929
- return path.join(outDir, dirName, `index${extension}`);
10168
+ return path$1.join(outDir, dirName, `index${extension}`);
9930
10169
  }
9931
10170
  /**
9932
10171
  * Converts a markdown file path to a relative URL path.
9933
10172
  */
9934
10173
  function getUrlPath$1(inputPath, srcDir) {
9935
- const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
10174
+ const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
9936
10175
  if (baseName === "index" || baseName.endsWith("/index")) return baseName.replace(/\/?index$/, "") || "/";
9937
10176
  return baseName;
9938
10177
  }
@@ -9948,12 +10187,12 @@ function getHref(inputPath, srcDir, base, extension) {
9948
10187
  * Gets the OG image output path for a given markdown file.
9949
10188
  */
9950
10189
  function getOgImagePath(inputPath, srcDir, outDir) {
9951
- const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
10190
+ const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
9952
10191
  if (baseName === "index" || baseName.endsWith("/index")) {
9953
10192
  const dirPath = baseName.replace(/\/?index$/, "") || "";
9954
- return path.join(outDir, dirPath, "og-image.png");
10193
+ return path$1.join(outDir, dirPath, "og-image.png");
9955
10194
  }
9956
- return path.join(outDir, baseName, "og-image.png");
10195
+ return path$1.join(outDir, baseName, "og-image.png");
9957
10196
  }
9958
10197
  /**
9959
10198
  * Gets the OG image URL for use in meta tags.
@@ -9971,9 +10210,9 @@ function getOgImageUrl(inputPath, srcDir, base, siteUrl) {
9971
10210
  * Gets display title from file path.
9972
10211
  */
9973
10212
  function getDisplayTitle(filePath) {
9974
- const fileName = path.basename(filePath, path.extname(filePath));
10213
+ const fileName = path$1.basename(filePath, path$1.extname(filePath));
9975
10214
  if (fileName === "index") {
9976
- const dirName = path.basename(path.dirname(filePath));
10215
+ const dirName = path$1.basename(path$1.dirname(filePath));
9977
10216
  if (dirName && dirName !== ".") return formatTitle(dirName);
9978
10217
  return "Home";
9979
10218
  }
@@ -9989,7 +10228,7 @@ function formatTitle(name) {
9989
10228
  * Collects all markdown files from the source directory.
9990
10229
  */
9991
10230
  async function collectMarkdownFiles$1(srcDir) {
9992
- return (await glob(path.join(srcDir, "**/*.{md,markdown}"), {
10231
+ return (await glob(path$1.join(srcDir, "**/*.{md,markdown}"), {
9993
10232
  nodir: true,
9994
10233
  ignore: [
9995
10234
  "**/node_modules/**",
@@ -10010,7 +10249,7 @@ function buildNavItems(markdownFiles, srcDir, base, extension) {
10010
10249
  "api"
10011
10250
  ];
10012
10251
  for (const file of markdownFiles) {
10013
- const parts = path.relative(srcDir, file).split(path.sep);
10252
+ const parts = path$1.relative(srcDir, file).split(path$1.sep);
10014
10253
  let groupKey = "";
10015
10254
  if (parts.length > 1) groupKey = parts[0];
10016
10255
  if (!groups.has(groupKey)) groups.set(groupKey, []);
@@ -10059,10 +10298,11 @@ async function buildSsg(options, root) {
10059
10298
  files: [],
10060
10299
  errors: []
10061
10300
  };
10062
- const srcDir = path.resolve(root, options.srcDir);
10063
- const outDir = path.resolve(root, options.outDir);
10301
+ const srcDir = path$1.resolve(root, options.srcDir);
10302
+ const outDir = path$1.resolve(root, options.outDir);
10064
10303
  const base = options.base.endsWith("/") ? options.base : options.base + "/";
10065
10304
  const generatedFiles = [];
10305
+ const generatedPages = [];
10066
10306
  const errors = [];
10067
10307
  if (ssgOptions.clean) try {
10068
10308
  await fs.rm(outDir, {
@@ -10074,7 +10314,7 @@ async function buildSsg(options, root) {
10074
10314
  const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);
10075
10315
  let siteName = ssgOptions.siteName ?? "Documentation";
10076
10316
  if (!ssgOptions.siteName) try {
10077
- const pkgPath = path.join(root, "package.json");
10317
+ const pkgPath = path$1.join(root, "package.json");
10078
10318
  const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
10079
10319
  if (pkg.name) siteName = formatTitle(pkg.name);
10080
10320
  } catch {}
@@ -10176,19 +10416,27 @@ async function buildSsg(options, root) {
10176
10416
  entryPage
10177
10417
  }, navItems, siteName, base, pageOgImage, ssgOptions.theme);
10178
10418
  const outputPath = getOutputPath(inputPath, srcDir, outDir, ssgOptions.extension);
10179
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
10180
- await fs.writeFile(outputPath, html, "utf-8");
10181
- generatedFiles.push(outputPath);
10419
+ generatedPages.push({
10420
+ inputPath,
10421
+ outputPath,
10422
+ html
10423
+ });
10182
10424
  } catch (err) {
10183
10425
  const errorMessage = err instanceof Error ? err.message : String(err);
10184
10426
  errors.push(`Failed to generate HTML for ${pageResult.inputPath}: ${errorMessage}`);
10185
10427
  }
10428
+ const optimizedOutput = await externalizeSharedPageAssets(generatedPages, outDir, base);
10429
+ generatedFiles.push(...optimizedOutput.assets);
10430
+ for (const page of optimizedOutput.pages) {
10431
+ await fs.mkdir(path$1.dirname(page.outputPath), { recursive: true });
10432
+ await fs.writeFile(page.outputPath, page.html, "utf-8");
10433
+ generatedFiles.push(page.outputPath);
10434
+ }
10186
10435
  return {
10187
10436
  files: generatedFiles,
10188
10437
  errors
10189
10438
  };
10190
10439
  }
10191
-
10192
10440
  //#endregion
10193
10441
  //#region src/search.ts
10194
10442
  /**
@@ -10199,7 +10447,7 @@ async function buildSsg(options, root) {
10199
10447
  let oxContent$1 = null;
10200
10448
  async function getOxContent() {
10201
10449
  if (!oxContent$1) try {
10202
- oxContent$1 = await import("@ox-content/napi");
10450
+ oxContent$1 = await importNapiModule();
10203
10451
  } catch {
10204
10452
  console.warn("[ox-content] Native bindings not available, search disabled");
10205
10453
  return null;
@@ -10235,7 +10483,7 @@ async function collectMarkdownFiles(dir) {
10235
10483
  try {
10236
10484
  const entries = await fs.readdir(currentDir, { withFileTypes: true });
10237
10485
  for (const entry of entries) {
10238
- const fullPath = path.join(currentDir, entry.name);
10486
+ const fullPath = path$1.join(currentDir, entry.name);
10239
10487
  if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") await walk(fullPath);
10240
10488
  else if (entry.isFile() && entry.name.endsWith(".md")) files.push(fullPath);
10241
10489
  }
@@ -10260,7 +10508,7 @@ async function buildSearchIndex(srcDir, base) {
10260
10508
  const documents = [];
10261
10509
  for (const file of files) try {
10262
10510
  const content = await fs.readFile(file, "utf-8");
10263
- const relativePath = path.relative(srcDir, file);
10511
+ const relativePath = path$1.relative(srcDir, file);
10264
10512
  const url = base + relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
10265
10513
  const id = relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
10266
10514
  const extractSearchContent = napi.extractSearchContent;
@@ -10289,7 +10537,7 @@ async function buildSearchIndex(srcDir, base) {
10289
10537
  * Writes the search index to a file.
10290
10538
  */
10291
10539
  async function writeSearchIndex(indexJson, outDir) {
10292
- const indexPath = path.join(outDir, "search-index.json");
10540
+ const indexPath = path$1.join(outDir, "search-index.json");
10293
10541
  await fs.mkdir(outDir, { recursive: true });
10294
10542
  await fs.writeFile(indexPath, indexJson, "utf-8");
10295
10543
  }
@@ -10305,6 +10553,51 @@ const searchOptions = ${JSON.stringify(options)};
10305
10553
  let searchIndex = null;
10306
10554
  let indexPromise = null;
10307
10555
 
10556
+ function parseScopedQuery(query) {
10557
+ const scopes = [];
10558
+ const terms = [];
10559
+
10560
+ for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
10561
+ if (part.startsWith('@') && part.length > 1) {
10562
+ scopes.push(part.slice(1).toLowerCase());
10563
+ } else {
10564
+ terms.push(part);
10565
+ }
10566
+ }
10567
+
10568
+ return {
10569
+ text: terms.join(' ').trim(),
10570
+ scopes: [...new Set(scopes)],
10571
+ };
10572
+ }
10573
+
10574
+ function getScopesForDoc(doc) {
10575
+ const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
10576
+ const segments = source.split('/').filter(Boolean);
10577
+
10578
+ if (segments.length <= 1) {
10579
+ return [];
10580
+ }
10581
+
10582
+ const scopes = [];
10583
+ let current = '';
10584
+ for (const segment of segments.slice(0, -1)) {
10585
+ current = current ? current + '/' + segment : segment;
10586
+ scopes.push(current);
10587
+ }
10588
+
10589
+ return scopes;
10590
+ }
10591
+
10592
+ function matchesScopes(doc, scopes) {
10593
+ if (!scopes.length) {
10594
+ return true;
10595
+ }
10596
+
10597
+ const docScopes = new Set(getScopesForDoc(doc));
10598
+ return scopes.some(scope => docScopes.has(scope));
10599
+ }
10600
+
10308
10601
  // Tokenizer for queries
10309
10602
  function tokenizeQuery(text) {
10310
10603
  const tokens = [];
@@ -10372,22 +10665,32 @@ async function loadIndex() {
10372
10665
  export async function search(query, options = {}) {
10373
10666
  const index = await loadIndex();
10374
10667
 
10375
- if (!index || !query.trim()) {
10668
+ if (!index) {
10376
10669
  return [];
10377
10670
  }
10378
10671
 
10379
- const limit = options.limit ?? searchOptions.limit;
10380
- const prefix = options.prefix ?? searchOptions.prefix;
10381
- const tokens = tokenizeQuery(query);
10672
+ const parsedQuery = parseScopedQuery(query);
10382
10673
 
10383
- if (tokens.length === 0) {
10674
+ if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
10384
10675
  return [];
10385
10676
  }
10386
10677
 
10678
+ const limit = options.limit ?? searchOptions.limit;
10679
+ const prefix = options.prefix ?? searchOptions.prefix;
10680
+ const tokens = tokenizeQuery(parsedQuery.text);
10681
+
10387
10682
  const k1 = 1.2;
10388
10683
  const b = 0.75;
10389
10684
  const docScores = new Map();
10390
10685
 
10686
+ if (tokens.length === 0) {
10687
+ index.documents.forEach((doc, docIdx) => {
10688
+ if (matchesScopes(doc, parsedQuery.scopes)) {
10689
+ docScores.set(docIdx, { score: 0, matches: new Set() });
10690
+ }
10691
+ });
10692
+ }
10693
+
10391
10694
  for (let i = 0; i < tokens.length; i++) {
10392
10695
  const token = tokens[i];
10393
10696
  const isLast = i === tokens.length - 1;
@@ -10408,6 +10711,7 @@ export async function search(query, options = {}) {
10408
10711
  for (const posting of postings) {
10409
10712
  const doc = index.documents[posting.doc_idx];
10410
10713
  if (!doc) continue;
10714
+ if (!matchesScopes(doc, parsedQuery.scopes)) continue;
10411
10715
 
10412
10716
  const docLen = doc.body.length;
10413
10717
  const tf = posting.tf;
@@ -10430,6 +10734,7 @@ export async function search(query, options = {}) {
10430
10734
  .map(([docIdx, data]) => {
10431
10735
  const doc = index.documents[docIdx];
10432
10736
  const matches = Array.from(data.matches);
10737
+ const scopes = getScopesForDoc(doc);
10433
10738
 
10434
10739
  // Generate snippet
10435
10740
  let snippet = '';
@@ -10443,7 +10748,7 @@ export async function search(query, options = {}) {
10443
10748
  }
10444
10749
  }
10445
10750
 
10446
- const start = Math.max(0, firstPos - 50);
10751
+ const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
10447
10752
  const end = Math.min(doc.body.length, start + 150);
10448
10753
  snippet = doc.body.slice(start, end);
10449
10754
  if (start > 0) snippet = '...' + snippet;
@@ -10457,9 +10762,10 @@ export async function search(query, options = {}) {
10457
10762
  score: data.score,
10458
10763
  matches,
10459
10764
  snippet,
10765
+ scopes,
10460
10766
  };
10461
10767
  })
10462
- .sort((a, b) => b.score - a.score)
10768
+ .sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
10463
10769
  .slice(0, limit);
10464
10770
 
10465
10771
  return results;
@@ -10469,7 +10775,6 @@ export { searchOptions };
10469
10775
  export default { search, searchOptions, loadIndex };
10470
10776
  `;
10471
10777
  }
10472
-
10473
10778
  //#endregion
10474
10779
  //#region src/dev-server.ts
10475
10780
  /**
@@ -10534,12 +10839,12 @@ async function resolveMarkdownFile(url, srcDir) {
10534
10839
  let relativePath;
10535
10840
  if (pathname === "/") relativePath = "index.md";
10536
10841
  else relativePath = pathname.slice(1) + ".md";
10537
- const filePath = path.join(srcDir, relativePath);
10842
+ const filePath = path$1.join(srcDir, relativePath);
10538
10843
  try {
10539
10844
  await fs.access(filePath);
10540
10845
  return filePath;
10541
10846
  } catch {
10542
- const indexPath = path.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
10847
+ const indexPath = path$1.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
10543
10848
  try {
10544
10849
  await fs.access(indexPath);
10545
10850
  return indexPath;
@@ -10583,7 +10888,7 @@ function invalidatePageCache(cache, filePath) {
10583
10888
  async function resolveSiteName(options, root) {
10584
10889
  if (options.ssg.siteName) return options.ssg.siteName;
10585
10890
  try {
10586
- const pkgPath = path.join(root, "package.json");
10891
+ const pkgPath = path$1.join(root, "package.json");
10587
10892
  const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
10588
10893
  if (pkg.name) return formatTitle(pkg.name);
10589
10894
  } catch {}
@@ -10593,7 +10898,7 @@ async function resolveSiteName(options, root) {
10593
10898
  * Render a single markdown page to full HTML.
10594
10899
  */
10595
10900
  async function renderPage$1(filePath, options, navGroups, siteName, base, root) {
10596
- const srcDir = path.resolve(root, options.srcDir);
10901
+ const srcDir = path$1.resolve(root, options.srcDir);
10597
10902
  resetTabGroupCounter();
10598
10903
  resetIslandCounter();
10599
10904
  const result = await transformMarkdown(await fs.readFile(filePath, "utf-8"), filePath, options, {
@@ -10638,7 +10943,7 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root)
10638
10943
  * Create the dev server middleware for SSG page serving.
10639
10944
  */
10640
10945
  function createDevServerMiddleware(options, root, cache) {
10641
- const srcDir = path.resolve(root, options.srcDir);
10946
+ const srcDir = path$1.resolve(root, options.srcDir);
10642
10947
  const base = options.base.endsWith("/") ? options.base : options.base + "/";
10643
10948
  return async (req, res, next) => {
10644
10949
  const url = req.url;
@@ -10670,7 +10975,6 @@ function createDevServerMiddleware(options, root, cache) {
10670
10975
  }
10671
10976
  };
10672
10977
  }
10673
-
10674
10978
  //#endregion
10675
10979
  //#region src/og-viewer.ts
10676
10980
  /**
@@ -10704,7 +11008,7 @@ function extractTitle(content, frontmatter) {
10704
11008
  return match ? match[1].trim() : "";
10705
11009
  }
10706
11010
  function getUrlPath(filePath, srcDir) {
10707
- let rel = path.relative(srcDir, filePath).replace(/\\/g, "/");
11011
+ let rel = path$1.relative(srcDir, filePath).replace(/\\/g, "/");
10708
11012
  rel = rel.replace(/\.md$/, "");
10709
11013
  if (rel === "index") return "/";
10710
11014
  if (rel.endsWith("/index")) rel = rel.slice(0, -6);
@@ -10744,7 +11048,7 @@ function validatePage(page, options) {
10744
11048
  return warnings;
10745
11049
  }
10746
11050
  async function collectPages(options, root) {
10747
- const srcDir = path.resolve(root, options.srcDir);
11051
+ const srcDir = path$1.resolve(root, options.srcDir);
10748
11052
  const files = await glob("**/*.md", {
10749
11053
  cwd: srcDir,
10750
11054
  absolute: true
@@ -10762,7 +11066,7 @@ async function collectPages(options, root) {
10762
11066
  const urlPath = getUrlPath(file, srcDir);
10763
11067
  const ogImageUrl = computeOgImageUrl(urlPath, options.base, options.ssg.siteUrl, generateOgImage, options.ssg.ogImage);
10764
11068
  const page = {
10765
- path: path.relative(srcDir, file),
11069
+ path: path$1.relative(srcDir, file),
10766
11070
  urlPath,
10767
11071
  title,
10768
11072
  description,
@@ -11017,7 +11321,6 @@ function createOgViewerPlugin(options) {
11017
11321
  }
11018
11322
  };
11019
11323
  }
11020
-
11021
11324
  //#endregion
11022
11325
  //#region src/i18n.ts
11023
11326
  /**
@@ -11078,13 +11381,13 @@ function createI18nPlugin(resolvedOptions) {
11078
11381
  },
11079
11382
  async buildStart() {
11080
11383
  if (!i18nOptions || !i18nOptions.check) return;
11081
- const dictDir = path.resolve(root, i18nOptions.dir);
11384
+ const dictDir = path$1.resolve(root, i18nOptions.dir);
11082
11385
  if (!fs$1.existsSync(dictDir)) {
11083
11386
  console.warn(`[ox-content:i18n] Dictionary directory not found: ${dictDir}`);
11084
11387
  return;
11085
11388
  }
11086
11389
  try {
11087
- const { loadDictionaries, checkI18n, extractTranslationKeys } = await import("@ox-content/napi");
11390
+ const { loadDictionaries, checkI18n, extractTranslationKeys } = await importNapiModule();
11088
11391
  const loadResult = loadDictionaries(dictDir);
11089
11392
  if (loadResult.errors.length > 0) {
11090
11393
  for (const error of loadResult.errors) console.warn(`[ox-content:i18n] ${error}`);
@@ -11100,7 +11403,7 @@ function createI18nPlugin(resolvedOptions) {
11100
11403
  },
11101
11404
  configureServer(server) {
11102
11405
  if (!i18nOptions) return;
11103
- const dictDir = path.resolve(root, i18nOptions.dir);
11406
+ const dictDir = path$1.resolve(root, i18nOptions.dir);
11104
11407
  if (fs$1.existsSync(dictDir)) {
11105
11408
  server.watcher.add(dictDir);
11106
11409
  server.watcher.on("change", (filePath) => {
@@ -11127,7 +11430,7 @@ function createI18nPlugin(resolvedOptions) {
11127
11430
  * Generates the virtual module for i18n configuration.
11128
11431
  */
11129
11432
  function generateI18nModule(options, root) {
11130
- const dictDir = path.resolve(root, options.dir);
11433
+ const dictDir = path$1.resolve(root, options.dir);
11131
11434
  const localesJson = JSON.stringify(options.locales);
11132
11435
  const defaultLocale = JSON.stringify(options.defaultLocale);
11133
11436
  let dictionariesCode = "{}";
@@ -11210,15 +11513,15 @@ function flattenObject(obj, prefix, result) {
11210
11513
  function loadDictionariesFallback(options, dictDir) {
11211
11514
  const dictData = {};
11212
11515
  for (const locale of options.locales) {
11213
- const localeDir = path.join(dictDir, locale.code);
11516
+ const localeDir = path$1.join(dictDir, locale.code);
11214
11517
  if (!fs$1.existsSync(localeDir)) continue;
11215
11518
  const files = fs$1.readdirSync(localeDir);
11216
11519
  const localeDict = {};
11217
11520
  for (const file of files) {
11218
11521
  if (!file.endsWith(".json")) continue;
11219
- const filePath = path.join(localeDir, file);
11522
+ const filePath = path$1.join(localeDir, file);
11220
11523
  const content = fs$1.readFileSync(filePath, "utf-8");
11221
- const namespace = path.basename(file, ".json");
11524
+ const namespace = path$1.basename(file, ".json");
11222
11525
  try {
11223
11526
  flattenObject(JSON.parse(content), namespace, localeDict);
11224
11527
  } catch {}
@@ -11231,13 +11534,13 @@ function loadDictionariesFallback(options, dictDir) {
11231
11534
  * Collects translation keys from source files using NAPI extractTranslationKeys.
11232
11535
  */
11233
11536
  function collectKeysFromSource(root, extractTranslationKeys, options) {
11234
- const srcDir = path.resolve(root, "src");
11537
+ const srcDir = path$1.resolve(root, "src");
11235
11538
  const keys = /* @__PURE__ */ new Set();
11236
11539
  if (fs$1.existsSync(srcDir)) walkDir(srcDir, /\.(ts|tsx|js|jsx)$/, (filePath) => {
11237
11540
  const usages = extractTranslationKeys(fs$1.readFileSync(filePath, "utf-8"), filePath, options.functionNames);
11238
11541
  for (const usage of usages) keys.add(usage.key);
11239
11542
  });
11240
- const contentDir = path.resolve(root, "content");
11543
+ const contentDir = path$1.resolve(root, "content");
11241
11544
  if (fs$1.existsSync(contentDir)) {
11242
11545
  const tPattern = /\{\{t\(['"]([^'"]+)['"]\)\}\}/g;
11243
11546
  walkDir(contentDir, /\.(md|mdx)$/, (filePath) => {
@@ -11255,14 +11558,13 @@ function collectKeysFromSource(root, extractTranslationKeys, options) {
11255
11558
  function walkDir(dir, pattern, callback) {
11256
11559
  const entries = fs$1.readdirSync(dir, { withFileTypes: true });
11257
11560
  for (const entry of entries) {
11258
- const fullPath = path.join(dir, entry.name);
11561
+ const fullPath = path$1.join(dir, entry.name);
11259
11562
  if (entry.isDirectory()) {
11260
11563
  if (entry.name === "node_modules" || entry.name === ".git") continue;
11261
11564
  walkDir(fullPath, pattern, callback);
11262
11565
  } else if (pattern.test(entry.name)) callback(fullPath);
11263
11566
  }
11264
11567
  }
11265
-
11266
11568
  //#endregion
11267
11569
  //#region src/jsx-runtime.ts
11268
11570
  /**
@@ -11452,7 +11754,6 @@ function when(condition, content) {
11452
11754
  function each(items, render) {
11453
11755
  return { __html: items.map((item, i) => render(item, i).__html).join("") };
11454
11756
  }
11455
-
11456
11757
  //#endregion
11457
11758
  //#region src/page-context.ts
11458
11759
  var page_context_exports = /* @__PURE__ */ __exportAll({
@@ -11643,7 +11944,6 @@ var currentContext;
11643
11944
  var init_page_context = __esmMin((() => {
11644
11945
  currentContext = null;
11645
11946
  }));
11646
-
11647
11947
  //#endregion
11648
11948
  //#region src/theme-renderer.ts
11649
11949
  /**
@@ -11801,7 +12101,6 @@ function createTheme(config) {
11801
12101
  return Layout({ children });
11802
12102
  };
11803
12103
  }
11804
-
11805
12104
  //#endregion
11806
12105
  //#region src/index.ts
11807
12106
  /**
@@ -11836,8 +12135,8 @@ function oxContent(options = {}) {
11836
12135
  async function regenerateDocs(root) {
11837
12136
  const docsOptions = resolvedOptions.docs;
11838
12137
  if (!docsOptions || !docsOptions.enabled) return 0;
11839
- const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
11840
- const outDir = path.resolve(root, docsOptions.out);
12138
+ const srcDirs = docsOptions.src.map((src) => path$1.resolve(root, src));
12139
+ const outDir = path$1.resolve(root, docsOptions.out);
11841
12140
  const extracted = await extractDocs(srcDirs, docsOptions);
11842
12141
  const generated = generateMarkdown(extracted, docsOptions);
11843
12142
  await writeDocs(generated, outDir, extracted, docsOptions);
@@ -11906,7 +12205,7 @@ function oxContent(options = {}) {
11906
12205
  const docsOptions = resolvedOptions.docs;
11907
12206
  if (!docsOptions || !docsOptions.enabled) return;
11908
12207
  const root = config?.root || process.cwd();
11909
- const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
12208
+ const srcDirs = docsOptions.src.map((src) => path$1.resolve(root, src));
11910
12209
  for (const srcDir of srcDirs) devServer.watcher.add(srcDir);
11911
12210
  devServer.watcher.on("all", async (event, file) => {
11912
12211
  if (event !== "add" && event !== "change" && event !== "unlink") return;
@@ -11922,7 +12221,7 @@ function oxContent(options = {}) {
11922
12221
  configureServer(devServer) {
11923
12222
  if (!resolvedOptions.ssg.enabled) return;
11924
12223
  const root = config?.root || process.cwd();
11925
- const srcDir = path.resolve(root, resolvedOptions.srcDir);
12224
+ const srcDir = path$1.resolve(root, resolvedOptions.srcDir);
11926
12225
  devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));
11927
12226
  devServer.watcher.on("add", (file) => {
11928
12227
  if (file.startsWith(srcDir) && file.endsWith(".md")) {
@@ -11959,7 +12258,7 @@ function oxContent(options = {}) {
11959
12258
  const root = config?.root || process.cwd();
11960
12259
  try {
11961
12260
  const result = await buildSsg(resolvedOptions, root);
11962
- if (result.files.length > 0) console.log(`[ox-content] Generated ${result.files.length} HTML files`);
12261
+ if (result.files.length > 0) console.log(`[ox-content] Generated ${result.files.length} output files`);
11963
12262
  if (result.errors.length > 0) for (const error of result.errors) console.warn(`[ox-content] ${error}`);
11964
12263
  } catch (err) {
11965
12264
  console.error("[ox-content] SSG build failed:", err);
@@ -11989,7 +12288,7 @@ function oxContent(options = {}) {
11989
12288
  async buildStart() {
11990
12289
  if (!resolvedOptions.search.enabled) return;
11991
12290
  const root = config?.root || process.cwd();
11992
- const srcDir = path.resolve(root, resolvedOptions.srcDir);
12291
+ const srcDir = path$1.resolve(root, resolvedOptions.srcDir);
11993
12292
  try {
11994
12293
  searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);
11995
12294
  console.log("[ox-content] Search index built");
@@ -12000,10 +12299,10 @@ function oxContent(options = {}) {
12000
12299
  async closeBundle() {
12001
12300
  if (!resolvedOptions.search.enabled || !searchIndexJson) return;
12002
12301
  const root = config?.root || process.cwd();
12003
- const outDir = path.resolve(root, resolvedOptions.outDir);
12302
+ const outDir = path$1.resolve(root, resolvedOptions.outDir);
12004
12303
  try {
12005
12304
  await writeSearchIndex(searchIndexJson, outDir);
12006
- console.log("[ox-content] Search index written to", path.join(outDir, "search-index.json"));
12305
+ console.log("[ox-content] Search index written to", path$1.join(outDir, "search-index.json"));
12007
12306
  } catch (err) {
12008
12307
  console.warn("[ox-content] Failed to write search index:", err);
12009
12308
  }
@@ -12031,6 +12330,7 @@ function resolveOptions(options) {
12031
12330
  highlight: options.highlight ?? false,
12032
12331
  highlightTheme: options.highlightTheme ?? "github-dark",
12033
12332
  highlightLangs: options.highlightLangs ?? [],
12333
+ codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
12034
12334
  mermaid: options.mermaid ?? false,
12035
12335
  frontmatter: options.frontmatter ?? true,
12036
12336
  toc: options.toc ?? true,
@@ -12044,6 +12344,26 @@ function resolveOptions(options) {
12044
12344
  i18n: resolveI18nOptions(options.i18n)
12045
12345
  };
12046
12346
  }
12347
+ function resolveCodeAnnotationsOptions(options) {
12348
+ if (!options) return {
12349
+ enabled: false,
12350
+ notation: "attribute",
12351
+ metaKey: "annotate",
12352
+ defaultLineNumbers: false
12353
+ };
12354
+ if (options === true) return {
12355
+ enabled: true,
12356
+ notation: "attribute",
12357
+ metaKey: "annotate",
12358
+ defaultLineNumbers: false
12359
+ };
12360
+ return {
12361
+ enabled: true,
12362
+ notation: options.notation ?? "attribute",
12363
+ metaKey: options.metaKey ?? "annotate",
12364
+ defaultLineNumbers: options.defaultLineNumbers ?? false
12365
+ };
12366
+ }
12047
12367
  /**
12048
12368
  * Generates virtual module content.
12049
12369
  */
@@ -12061,7 +12381,7 @@ function generateVirtualModule(path, options) {
12061
12381
  `;
12062
12382
  return "export default {};";
12063
12383
  }
12064
-
12065
12384
  //#endregion
12066
12385
  export { DEFAULT_HTML_TEMPLATE, DefaultTheme, Fragment, buildSearchIndex, buildSsg, clearRenderContext, collectGitHubRepos, collectOgpUrls, createI18nPlugin, createMarkdownEnvironment, createTheme, defaultTheme, defineTheme, each, extractDocs, extractIslandInfo, extractVideoId, fetchOgpData, fetchRepoData, generateFrontmatterTypes, generateHydrationScript, generateMarkdown, generateOgImages, generateTabsCSS, generateTypes, hasIslands, inferType, jsx, jsxs, mergeThemes, mermaidClientScript, oxContent, prefetchGitHubRepos, prefetchOgpData, raw, renderAllPages, renderPage, renderToString, resolveDocsOptions, resolveI18nOptions, resolveOgImageOptions, resolveSearchOptions, resolveSsgOptions, resolveTheme, setRenderContext, transformAllPlugins, transformGitHub, transformIslands, transformMarkdown, transformMermaidStatic, transformOgp, transformTabs, transformYouTube, useIsActive, useNav, usePageProps, useRenderContext, useSiteConfig, when, writeDocs, writeSearchIndex };
12067
- //# sourceMappingURL=index.js.map
12386
+
12387
+ //# sourceMappingURL=index.mjs.map