@ox-content/vite-plugin 1.0.0-alpha.0 → 2.0.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.
- package/dist/chunk.cjs +39 -49
- package/dist/github.cjs +323 -3
- package/dist/github.cjs.map +1 -0
- package/dist/github.mjs +2 -0
- package/dist/{github2.js → github2.mjs} +2 -3
- package/dist/github2.mjs.map +1 -0
- package/dist/index.cjs +1371 -598
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +114 -69
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1960 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +1383 -623
- package/dist/index.mjs.map +1 -0
- package/dist/mermaid.cjs +115 -3
- package/dist/mermaid.cjs.map +1 -0
- package/dist/{mermaid2.js → mermaid.mjs} +14 -6
- package/dist/mermaid.mjs.map +1 -0
- package/dist/mermaid2.mjs +2 -0
- package/dist/ogp.cjs +316 -3
- package/dist/ogp.cjs.map +1 -0
- package/dist/ogp.mjs +2 -0
- package/dist/{ogp2.js → ogp2.mjs} +2 -3
- package/dist/ogp2.mjs.map +1 -0
- package/dist/tabs.cjs +212 -3
- package/dist/tabs.cjs.map +1 -0
- package/dist/tabs.mjs +2 -0
- package/dist/{tabs2.js → tabs2.mjs} +2 -3
- package/dist/tabs2.mjs.map +1 -0
- package/dist/youtube.cjs +135 -3
- package/dist/youtube.cjs.map +1 -0
- package/dist/youtube.mjs +2 -0
- package/dist/{youtube2.js → youtube2.mjs} +2 -3
- package/dist/youtube2.mjs.map +1 -0
- package/package.json +61 -56
- package/dist/github.js +0 -3
- package/dist/github2.cjs +0 -313
- package/dist/github2.cjs.map +0 -1
- package/dist/github2.js.map +0 -1
- package/dist/index.d.ts +0 -1915
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/mermaid.js +0 -3
- package/dist/mermaid2.cjs +0 -92
- package/dist/mermaid2.cjs.map +0 -1
- package/dist/mermaid2.js.map +0 -1
- package/dist/ogp.js +0 -3
- package/dist/ogp2.cjs +0 -306
- package/dist/ogp2.cjs.map +0 -1
- package/dist/ogp2.js.map +0 -1
- package/dist/tabs.js +0 -3
- package/dist/tabs2.cjs +0 -203
- package/dist/tabs2.cjs.map +0 -1
- package/dist/tabs2.js.map +0 -1
- package/dist/youtube.js +0 -3
- package/dist/youtube2.cjs +0 -127
- package/dist/youtube2.cjs.map +0 -1
- package/dist/youtube2.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
path
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk.cjs");
|
|
3
|
+
const require_mermaid = require("./mermaid.cjs");
|
|
4
|
+
const require_tabs = require("./tabs.cjs");
|
|
5
|
+
const require_youtube = require("./youtube.cjs");
|
|
6
|
+
const require_github = require("./github.cjs");
|
|
7
|
+
const require_ogp = require("./ogp.cjs");
|
|
8
|
+
let path = require("path");
|
|
9
|
+
path = require_chunk.__toESM(path);
|
|
9
10
|
let unified = require("unified");
|
|
10
11
|
let rehype_parse = require("rehype-parse");
|
|
11
12
|
rehype_parse = require_chunk.__toESM(rehype_parse);
|
|
@@ -22,7 +23,6 @@ let glob = require("glob");
|
|
|
22
23
|
let crypto = require("crypto");
|
|
23
24
|
crypto = require_chunk.__toESM(crypto);
|
|
24
25
|
let node_fs_promises = require("node:fs/promises");
|
|
25
|
-
|
|
26
26
|
//#region src/environment.ts
|
|
27
27
|
/**
|
|
28
28
|
* Creates the Markdown processing environment configuration.
|
|
@@ -69,7 +69,6 @@ function createMarkdownEnvironment(options) {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
//#endregion
|
|
74
73
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
|
|
75
74
|
var require_identity = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -120,7 +119,6 @@ var require_identity = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
120
119
|
exports.isScalar = isScalar;
|
|
121
120
|
exports.isSeq = isSeq;
|
|
122
121
|
}));
|
|
123
|
-
|
|
124
122
|
//#endregion
|
|
125
123
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/visit.js
|
|
126
124
|
var require_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -311,7 +309,6 @@ var require_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
311
309
|
exports.visit = visit;
|
|
312
310
|
exports.visitAsync = visitAsync;
|
|
313
311
|
}));
|
|
314
|
-
|
|
315
312
|
//#endregion
|
|
316
313
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js
|
|
317
314
|
var require_directives = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -477,7 +474,6 @@ var require_directives = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
477
474
|
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
478
475
|
exports.Directives = Directives;
|
|
479
476
|
}));
|
|
480
|
-
|
|
481
477
|
//#endregion
|
|
482
478
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js
|
|
483
479
|
var require_anchors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -540,7 +536,6 @@ var require_anchors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
540
536
|
exports.createNodeAnchors = createNodeAnchors;
|
|
541
537
|
exports.findNewAnchor = findNewAnchor;
|
|
542
538
|
}));
|
|
543
|
-
|
|
544
539
|
//#endregion
|
|
545
540
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js
|
|
546
541
|
var require_applyReviver = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -581,7 +576,6 @@ var require_applyReviver = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
|
|
|
581
576
|
}
|
|
582
577
|
exports.applyReviver = applyReviver;
|
|
583
578
|
}));
|
|
584
|
-
|
|
585
579
|
//#endregion
|
|
586
580
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js
|
|
587
581
|
var require_toJS = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -619,7 +613,6 @@ var require_toJS = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
619
613
|
}
|
|
620
614
|
exports.toJS = toJS;
|
|
621
615
|
}));
|
|
622
|
-
|
|
623
616
|
//#endregion
|
|
624
617
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js
|
|
625
618
|
var require_Node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -654,7 +647,6 @@ var require_Node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
654
647
|
};
|
|
655
648
|
exports.NodeBase = NodeBase;
|
|
656
649
|
}));
|
|
657
|
-
|
|
658
650
|
//#endregion
|
|
659
651
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js
|
|
660
652
|
var require_Alias = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -748,7 +740,6 @@ var require_Alias = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
748
740
|
}
|
|
749
741
|
exports.Alias = Alias;
|
|
750
742
|
}));
|
|
751
|
-
|
|
752
743
|
//#endregion
|
|
753
744
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js
|
|
754
745
|
var require_Scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -776,7 +767,6 @@ var require_Scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
776
767
|
exports.Scalar = Scalar;
|
|
777
768
|
exports.isScalarValue = isScalarValue;
|
|
778
769
|
}));
|
|
779
|
-
|
|
780
770
|
//#endregion
|
|
781
771
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js
|
|
782
772
|
var require_createNode = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -840,7 +830,6 @@ var require_createNode = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
840
830
|
}
|
|
841
831
|
exports.createNode = createNode;
|
|
842
832
|
}));
|
|
843
|
-
|
|
844
833
|
//#endregion
|
|
845
834
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js
|
|
846
835
|
var require_Collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -962,7 +951,6 @@ var require_Collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
962
951
|
exports.collectionFromPath = collectionFromPath;
|
|
963
952
|
exports.isEmptyPath = isEmptyPath;
|
|
964
953
|
}));
|
|
965
|
-
|
|
966
954
|
//#endregion
|
|
967
955
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
968
956
|
var require_stringifyComment = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -983,7 +971,6 @@ var require_stringifyComment = /* @__PURE__ */ require_chunk.__commonJSMin(((exp
|
|
|
983
971
|
exports.lineComment = lineComment;
|
|
984
972
|
exports.stringifyComment = stringifyComment;
|
|
985
973
|
}));
|
|
986
|
-
|
|
987
974
|
//#endregion
|
|
988
975
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
989
976
|
var require_foldFlowLines = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1100,7 +1087,6 @@ var require_foldFlowLines = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
1100
1087
|
exports.FOLD_QUOTED = FOLD_QUOTED;
|
|
1101
1088
|
exports.foldFlowLines = foldFlowLines;
|
|
1102
1089
|
}));
|
|
1103
|
-
|
|
1104
1090
|
//#endregion
|
|
1105
1091
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1106
1092
|
var require_stringifyString = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1325,7 +1311,6 @@ var require_stringifyString = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
1325
1311
|
}
|
|
1326
1312
|
exports.stringifyString = stringifyString;
|
|
1327
1313
|
}));
|
|
1328
|
-
|
|
1329
1314
|
//#endregion
|
|
1330
1315
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js
|
|
1331
1316
|
var require_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1433,7 +1418,6 @@ var require_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
|
|
|
1433
1418
|
exports.createStringifyContext = createStringifyContext;
|
|
1434
1419
|
exports.stringify = stringify;
|
|
1435
1420
|
}));
|
|
1436
|
-
|
|
1437
1421
|
//#endregion
|
|
1438
1422
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1439
1423
|
var require_stringifyPair = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1531,7 +1515,6 @@ var require_stringifyPair = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
1531
1515
|
}
|
|
1532
1516
|
exports.stringifyPair = stringifyPair;
|
|
1533
1517
|
}));
|
|
1534
|
-
|
|
1535
1518
|
//#endregion
|
|
1536
1519
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/log.js
|
|
1537
1520
|
var require_log = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1546,7 +1529,6 @@ var require_log = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1546
1529
|
exports.debug = debug;
|
|
1547
1530
|
exports.warn = warn;
|
|
1548
1531
|
}));
|
|
1549
|
-
|
|
1550
1532
|
//#endregion
|
|
1551
1533
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1552
1534
|
var require_merge = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1587,7 +1569,6 @@ var require_merge = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1587
1569
|
exports.isMergeKey = isMergeKey;
|
|
1588
1570
|
exports.merge = merge;
|
|
1589
1571
|
}));
|
|
1590
|
-
|
|
1591
1572
|
//#endregion
|
|
1592
1573
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1593
1574
|
var require_addPairToJSMap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1639,7 +1620,6 @@ var require_addPairToJSMap = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
1639
1620
|
}
|
|
1640
1621
|
exports.addPairToJSMap = addPairToJSMap;
|
|
1641
1622
|
}));
|
|
1642
|
-
|
|
1643
1623
|
//#endregion
|
|
1644
1624
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js
|
|
1645
1625
|
var require_Pair = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1673,7 +1653,6 @@ var require_Pair = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1673
1653
|
exports.Pair = Pair;
|
|
1674
1654
|
exports.createPair = createPair;
|
|
1675
1655
|
}));
|
|
1676
|
-
|
|
1677
1656
|
//#endregion
|
|
1678
1657
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1679
1658
|
var require_stringifyCollection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1788,7 +1767,6 @@ var require_stringifyCollection = /* @__PURE__ */ require_chunk.__commonJSMin(((
|
|
|
1788
1767
|
}
|
|
1789
1768
|
exports.stringifyCollection = stringifyCollection;
|
|
1790
1769
|
}));
|
|
1791
|
-
|
|
1792
1770
|
//#endregion
|
|
1793
1771
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
1794
1772
|
var require_YAMLMap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1898,13 +1876,12 @@ var require_YAMLMap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
1898
1876
|
exports.YAMLMap = YAMLMap;
|
|
1899
1877
|
exports.findPair = findPair;
|
|
1900
1878
|
}));
|
|
1901
|
-
|
|
1902
1879
|
//#endregion
|
|
1903
1880
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js
|
|
1904
1881
|
var require_map = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
1905
1882
|
var identity = require_identity();
|
|
1906
1883
|
var YAMLMap = require_YAMLMap();
|
|
1907
|
-
|
|
1884
|
+
exports.map = {
|
|
1908
1885
|
collection: "map",
|
|
1909
1886
|
default: true,
|
|
1910
1887
|
nodeClass: YAMLMap.YAMLMap,
|
|
@@ -1915,9 +1892,7 @@ var require_map = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1915
1892
|
},
|
|
1916
1893
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
1917
1894
|
};
|
|
1918
|
-
exports.map = map;
|
|
1919
1895
|
}));
|
|
1920
|
-
|
|
1921
1896
|
//#endregion
|
|
1922
1897
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
1923
1898
|
var require_YAMLSeq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2024,13 +1999,12 @@ var require_YAMLSeq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2024
1999
|
}
|
|
2025
2000
|
exports.YAMLSeq = YAMLSeq;
|
|
2026
2001
|
}));
|
|
2027
|
-
|
|
2028
2002
|
//#endregion
|
|
2029
2003
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js
|
|
2030
2004
|
var require_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
2031
2005
|
var identity = require_identity();
|
|
2032
2006
|
var YAMLSeq = require_YAMLSeq();
|
|
2033
|
-
|
|
2007
|
+
exports.seq = {
|
|
2034
2008
|
collection: "seq",
|
|
2035
2009
|
default: true,
|
|
2036
2010
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
@@ -2041,14 +2015,12 @@ var require_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2041
2015
|
},
|
|
2042
2016
|
createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
|
|
2043
2017
|
};
|
|
2044
|
-
exports.seq = seq;
|
|
2045
2018
|
}));
|
|
2046
|
-
|
|
2047
2019
|
//#endregion
|
|
2048
2020
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js
|
|
2049
2021
|
var require_string = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
2050
2022
|
var stringifyString = require_stringifyString();
|
|
2051
|
-
|
|
2023
|
+
exports.string = {
|
|
2052
2024
|
identify: (value) => typeof value === "string",
|
|
2053
2025
|
default: true,
|
|
2054
2026
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -2058,9 +2030,7 @@ var require_string = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2058
2030
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
2059
2031
|
}
|
|
2060
2032
|
};
|
|
2061
|
-
exports.string = string;
|
|
2062
2033
|
}));
|
|
2063
|
-
|
|
2064
2034
|
//#endregion
|
|
2065
2035
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js
|
|
2066
2036
|
var require_null = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2076,7 +2046,6 @@ var require_null = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2076
2046
|
};
|
|
2077
2047
|
exports.nullTag = nullTag;
|
|
2078
2048
|
}));
|
|
2079
|
-
|
|
2080
2049
|
//#endregion
|
|
2081
2050
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js
|
|
2082
2051
|
var require_bool$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2096,7 +2065,6 @@ var require_bool$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2096
2065
|
};
|
|
2097
2066
|
exports.boolTag = boolTag;
|
|
2098
2067
|
}));
|
|
2099
|
-
|
|
2100
2068
|
//#endregion
|
|
2101
2069
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2102
2070
|
var require_stringifyNumber = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2118,7 +2086,6 @@ var require_stringifyNumber = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
2118
2086
|
}
|
|
2119
2087
|
exports.stringifyNumber = stringifyNumber;
|
|
2120
2088
|
}));
|
|
2121
|
-
|
|
2122
2089
|
//#endregion
|
|
2123
2090
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js
|
|
2124
2091
|
var require_float$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2144,7 +2111,7 @@ var require_float$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2144
2111
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2145
2112
|
}
|
|
2146
2113
|
};
|
|
2147
|
-
|
|
2114
|
+
exports.float = {
|
|
2148
2115
|
identify: (value) => typeof value === "number",
|
|
2149
2116
|
default: true,
|
|
2150
2117
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2157,11 +2124,9 @@ var require_float$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2157
2124
|
},
|
|
2158
2125
|
stringify: stringifyNumber.stringifyNumber
|
|
2159
2126
|
};
|
|
2160
|
-
exports.float = float;
|
|
2161
2127
|
exports.floatExp = floatExp;
|
|
2162
2128
|
exports.floatNaN = floatNaN;
|
|
2163
2129
|
}));
|
|
2164
|
-
|
|
2165
2130
|
//#endregion
|
|
2166
2131
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js
|
|
2167
2132
|
var require_int$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2203,7 +2168,6 @@ var require_int$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2203
2168
|
exports.intHex = intHex;
|
|
2204
2169
|
exports.intOct = intOct;
|
|
2205
2170
|
}));
|
|
2206
|
-
|
|
2207
2171
|
//#endregion
|
|
2208
2172
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js
|
|
2209
2173
|
var require_schema$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2214,7 +2178,7 @@ var require_schema$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2214
2178
|
var bool = require_bool$1();
|
|
2215
2179
|
var float = require_float$1();
|
|
2216
2180
|
var int = require_int$1();
|
|
2217
|
-
|
|
2181
|
+
exports.schema = [
|
|
2218
2182
|
map.map,
|
|
2219
2183
|
seq.seq,
|
|
2220
2184
|
string.string,
|
|
@@ -2227,9 +2191,7 @@ var require_schema$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2227
2191
|
float.floatExp,
|
|
2228
2192
|
float.float
|
|
2229
2193
|
];
|
|
2230
|
-
exports.schema = schema;
|
|
2231
2194
|
}));
|
|
2232
|
-
|
|
2233
2195
|
//#endregion
|
|
2234
2196
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js
|
|
2235
2197
|
var require_schema$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2282,7 +2244,7 @@ var require_schema$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2282
2244
|
stringify: stringifyJSON
|
|
2283
2245
|
}
|
|
2284
2246
|
];
|
|
2285
|
-
|
|
2247
|
+
exports.schema = [map.map, seq.seq].concat(jsonScalars, {
|
|
2286
2248
|
default: true,
|
|
2287
2249
|
tag: "",
|
|
2288
2250
|
test: /^/,
|
|
@@ -2291,16 +2253,14 @@ var require_schema$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2291
2253
|
return str;
|
|
2292
2254
|
}
|
|
2293
2255
|
});
|
|
2294
|
-
exports.schema = schema;
|
|
2295
2256
|
}));
|
|
2296
|
-
|
|
2297
2257
|
//#endregion
|
|
2298
2258
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2299
2259
|
var require_binary = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
2300
2260
|
var node_buffer = require("buffer");
|
|
2301
2261
|
var Scalar = require_Scalar();
|
|
2302
2262
|
var stringifyString = require_stringifyString();
|
|
2303
|
-
|
|
2263
|
+
exports.binary = {
|
|
2304
2264
|
identify: (value) => value instanceof Uint8Array,
|
|
2305
2265
|
default: false,
|
|
2306
2266
|
tag: "tag:yaml.org,2002:binary",
|
|
@@ -2341,9 +2301,7 @@ var require_binary = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2341
2301
|
}, ctx, onComment, onChompKeep);
|
|
2342
2302
|
}
|
|
2343
2303
|
};
|
|
2344
|
-
exports.binary = binary;
|
|
2345
2304
|
}));
|
|
2346
|
-
|
|
2347
2305
|
//#endregion
|
|
2348
2306
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2349
2307
|
var require_pairs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2404,7 +2362,6 @@ var require_pairs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2404
2362
|
exports.pairs = pairs;
|
|
2405
2363
|
exports.resolvePairs = resolvePairs;
|
|
2406
2364
|
}));
|
|
2407
|
-
|
|
2408
2365
|
//#endregion
|
|
2409
2366
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2410
2367
|
var require_omap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2468,7 +2425,6 @@ var require_omap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2468
2425
|
exports.YAMLOMap = YAMLOMap;
|
|
2469
2426
|
exports.omap = omap;
|
|
2470
2427
|
}));
|
|
2471
|
-
|
|
2472
2428
|
//#endregion
|
|
2473
2429
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2474
2430
|
var require_bool = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2496,7 +2452,6 @@ var require_bool = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2496
2452
|
exports.falseTag = falseTag;
|
|
2497
2453
|
exports.trueTag = trueTag;
|
|
2498
2454
|
}));
|
|
2499
|
-
|
|
2500
2455
|
//#endregion
|
|
2501
2456
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2502
2457
|
var require_float = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2522,7 +2477,7 @@ var require_float = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2522
2477
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2523
2478
|
}
|
|
2524
2479
|
};
|
|
2525
|
-
|
|
2480
|
+
exports.float = {
|
|
2526
2481
|
identify: (value) => typeof value === "number",
|
|
2527
2482
|
default: true,
|
|
2528
2483
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2538,11 +2493,9 @@ var require_float = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2538
2493
|
},
|
|
2539
2494
|
stringify: stringifyNumber.stringifyNumber
|
|
2540
2495
|
};
|
|
2541
|
-
exports.float = float;
|
|
2542
2496
|
exports.floatExp = floatExp;
|
|
2543
2497
|
exports.floatNaN = floatNaN;
|
|
2544
2498
|
}));
|
|
2545
|
-
|
|
2546
2499
|
//#endregion
|
|
2547
2500
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2548
2501
|
var require_int = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2618,7 +2571,6 @@ var require_int = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2618
2571
|
exports.intHex = intHex;
|
|
2619
2572
|
exports.intOct = intOct;
|
|
2620
2573
|
}));
|
|
2621
|
-
|
|
2622
2574
|
//#endregion
|
|
2623
2575
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
2624
2576
|
var require_set = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2687,7 +2639,6 @@ var require_set = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2687
2639
|
exports.YAMLSet = YAMLSet;
|
|
2688
2640
|
exports.set = set;
|
|
2689
2641
|
}));
|
|
2690
|
-
|
|
2691
2642
|
//#endregion
|
|
2692
2643
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
2693
2644
|
var require_timestamp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2771,7 +2722,6 @@ var require_timestamp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
|
|
|
2771
2722
|
exports.intTime = intTime;
|
|
2772
2723
|
exports.timestamp = timestamp;
|
|
2773
2724
|
}));
|
|
2774
|
-
|
|
2775
2725
|
//#endregion
|
|
2776
2726
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
2777
2727
|
var require_schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2788,7 +2738,7 @@ var require_schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2788
2738
|
var pairs = require_pairs();
|
|
2789
2739
|
var set = require_set();
|
|
2790
2740
|
var timestamp = require_timestamp();
|
|
2791
|
-
|
|
2741
|
+
exports.schema = [
|
|
2792
2742
|
map.map,
|
|
2793
2743
|
seq.seq,
|
|
2794
2744
|
string.string,
|
|
@@ -2811,9 +2761,7 @@ var require_schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2811
2761
|
timestamp.floatTime,
|
|
2812
2762
|
timestamp.timestamp
|
|
2813
2763
|
];
|
|
2814
|
-
exports.schema = schema;
|
|
2815
2764
|
}));
|
|
2816
|
-
|
|
2817
2765
|
//#endregion
|
|
2818
2766
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js
|
|
2819
2767
|
var require_tags = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2898,7 +2846,6 @@ var require_tags = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2898
2846
|
exports.coreKnownTags = coreKnownTags;
|
|
2899
2847
|
exports.getTags = getTags;
|
|
2900
2848
|
}));
|
|
2901
|
-
|
|
2902
2849
|
//#endregion
|
|
2903
2850
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js
|
|
2904
2851
|
var require_Schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2908,7 +2855,7 @@ var require_Schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2908
2855
|
var string = require_string();
|
|
2909
2856
|
var tags = require_tags();
|
|
2910
2857
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
2911
|
-
|
|
2858
|
+
exports.Schema = class Schema {
|
|
2912
2859
|
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
2913
2860
|
this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
|
|
2914
2861
|
this.name = typeof schema === "string" && schema || "core";
|
|
@@ -2926,9 +2873,7 @@ var require_Schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2926
2873
|
return copy;
|
|
2927
2874
|
}
|
|
2928
2875
|
};
|
|
2929
|
-
exports.Schema = Schema;
|
|
2930
2876
|
}));
|
|
2931
|
-
|
|
2932
2877
|
//#endregion
|
|
2933
2878
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
2934
2879
|
var require_stringifyDocument = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2990,7 +2935,6 @@ var require_stringifyDocument = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
2990
2935
|
}
|
|
2991
2936
|
exports.stringifyDocument = stringifyDocument;
|
|
2992
2937
|
}));
|
|
2993
|
-
|
|
2994
2938
|
//#endregion
|
|
2995
2939
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js
|
|
2996
2940
|
var require_Document = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3272,7 +3216,6 @@ var require_Document = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
3272
3216
|
}
|
|
3273
3217
|
exports.Document = Document;
|
|
3274
3218
|
}));
|
|
3275
|
-
|
|
3276
3219
|
//#endregion
|
|
3277
3220
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/errors.js
|
|
3278
3221
|
var require_errors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3326,7 +3269,6 @@ var require_errors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
3326
3269
|
exports.YAMLWarning = YAMLWarning;
|
|
3327
3270
|
exports.prettifyError = prettifyError;
|
|
3328
3271
|
}));
|
|
3329
|
-
|
|
3330
3272
|
//#endregion
|
|
3331
3273
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js
|
|
3332
3274
|
var require_resolve_props = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3434,7 +3376,6 @@ var require_resolve_props = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
3434
3376
|
}
|
|
3435
3377
|
exports.resolveProps = resolveProps;
|
|
3436
3378
|
}));
|
|
3437
|
-
|
|
3438
3379
|
//#endregion
|
|
3439
3380
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3440
3381
|
var require_util_contains_newline = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3464,7 +3405,6 @@ var require_util_contains_newline = /* @__PURE__ */ require_chunk.__commonJSMin(
|
|
|
3464
3405
|
}
|
|
3465
3406
|
exports.containsNewline = containsNewline;
|
|
3466
3407
|
}));
|
|
3467
|
-
|
|
3468
3408
|
//#endregion
|
|
3469
3409
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3470
3410
|
var require_util_flow_indent_check = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3477,7 +3417,6 @@ var require_util_flow_indent_check = /* @__PURE__ */ require_chunk.__commonJSMin
|
|
|
3477
3417
|
}
|
|
3478
3418
|
exports.flowIndentCheck = flowIndentCheck;
|
|
3479
3419
|
}));
|
|
3480
|
-
|
|
3481
3420
|
//#endregion
|
|
3482
3421
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js
|
|
3483
3422
|
var require_util_map_includes = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3490,7 +3429,6 @@ var require_util_map_includes = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
3490
3429
|
}
|
|
3491
3430
|
exports.mapIncludes = mapIncludes;
|
|
3492
3431
|
}));
|
|
3493
|
-
|
|
3494
3432
|
//#endregion
|
|
3495
3433
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3496
3434
|
var require_resolve_block_map = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3575,7 +3513,6 @@ var require_resolve_block_map = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
3575
3513
|
}
|
|
3576
3514
|
exports.resolveBlockMap = resolveBlockMap;
|
|
3577
3515
|
}));
|
|
3578
|
-
|
|
3579
3516
|
//#endregion
|
|
3580
3517
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
3581
3518
|
var require_resolve_block_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3618,7 +3555,6 @@ var require_resolve_block_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
3618
3555
|
}
|
|
3619
3556
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
3620
3557
|
}));
|
|
3621
|
-
|
|
3622
3558
|
//#endregion
|
|
3623
3559
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js
|
|
3624
3560
|
var require_resolve_end = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3657,7 +3593,6 @@ var require_resolve_end = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
3657
3593
|
}
|
|
3658
3594
|
exports.resolveEnd = resolveEnd;
|
|
3659
3595
|
}));
|
|
3660
|
-
|
|
3661
3596
|
//#endregion
|
|
3662
3597
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
3663
3598
|
var require_resolve_flow_collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3813,7 +3748,6 @@ var require_resolve_flow_collection = /* @__PURE__ */ require_chunk.__commonJSMi
|
|
|
3813
3748
|
}
|
|
3814
3749
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
3815
3750
|
}));
|
|
3816
|
-
|
|
3817
3751
|
//#endregion
|
|
3818
3752
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js
|
|
3819
3753
|
var require_compose_collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3866,7 +3800,6 @@ var require_compose_collection = /* @__PURE__ */ require_chunk.__commonJSMin(((e
|
|
|
3866
3800
|
}
|
|
3867
3801
|
exports.composeCollection = composeCollection;
|
|
3868
3802
|
}));
|
|
3869
|
-
|
|
3870
3803
|
//#endregion
|
|
3871
3804
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
3872
3805
|
var require_resolve_block_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4042,7 +3975,6 @@ var require_resolve_block_scalar = /* @__PURE__ */ require_chunk.__commonJSMin((
|
|
|
4042
3975
|
}
|
|
4043
3976
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4044
3977
|
}));
|
|
4045
|
-
|
|
4046
3978
|
//#endregion
|
|
4047
3979
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4048
3980
|
var require_resolve_flow_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4249,7 +4181,6 @@ var require_resolve_flow_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((
|
|
|
4249
4181
|
}
|
|
4250
4182
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4251
4183
|
}));
|
|
4252
|
-
|
|
4253
4184
|
//#endregion
|
|
4254
4185
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4255
4186
|
var require_compose_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4309,7 +4240,6 @@ var require_compose_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
4309
4240
|
}
|
|
4310
4241
|
exports.composeScalar = composeScalar;
|
|
4311
4242
|
}));
|
|
4312
|
-
|
|
4313
4243
|
//#endregion
|
|
4314
4244
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4315
4245
|
var require_util_empty_scalar_position = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4337,7 +4267,6 @@ var require_util_empty_scalar_position = /* @__PURE__ */ require_chunk.__commonJ
|
|
|
4337
4267
|
}
|
|
4338
4268
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
4339
4269
|
}));
|
|
4340
|
-
|
|
4341
4270
|
//#endregion
|
|
4342
4271
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js
|
|
4343
4272
|
var require_compose_node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4423,7 +4352,6 @@ var require_compose_node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
|
|
|
4423
4352
|
exports.composeEmptyNode = composeEmptyNode;
|
|
4424
4353
|
exports.composeNode = composeNode;
|
|
4425
4354
|
}));
|
|
4426
|
-
|
|
4427
4355
|
//#endregion
|
|
4428
4356
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js
|
|
4429
4357
|
var require_compose_doc = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4466,7 +4394,6 @@ var require_compose_doc = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
4466
4394
|
}
|
|
4467
4395
|
exports.composeDoc = composeDoc;
|
|
4468
4396
|
}));
|
|
4469
|
-
|
|
4470
4397
|
//#endregion
|
|
4471
4398
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js
|
|
4472
4399
|
var require_composer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4665,7 +4592,6 @@ var require_composer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
4665
4592
|
};
|
|
4666
4593
|
exports.Composer = Composer;
|
|
4667
4594
|
}));
|
|
4668
|
-
|
|
4669
4595
|
//#endregion
|
|
4670
4596
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js
|
|
4671
4597
|
var require_cst_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4933,7 +4859,6 @@ var require_cst_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
4933
4859
|
exports.resolveAsScalar = resolveAsScalar;
|
|
4934
4860
|
exports.setScalarValue = setScalarValue;
|
|
4935
4861
|
}));
|
|
4936
|
-
|
|
4937
4862
|
//#endregion
|
|
4938
4863
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js
|
|
4939
4864
|
var require_cst_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4985,7 +4910,6 @@ var require_cst_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
4985
4910
|
}
|
|
4986
4911
|
exports.stringify = stringify;
|
|
4987
4912
|
}));
|
|
4988
|
-
|
|
4989
4913
|
//#endregion
|
|
4990
4914
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js
|
|
4991
4915
|
var require_cst_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5077,7 +5001,6 @@ var require_cst_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
|
|
|
5077
5001
|
}
|
|
5078
5002
|
exports.visit = visit;
|
|
5079
5003
|
}));
|
|
5080
|
-
|
|
5081
5004
|
//#endregion
|
|
5082
5005
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js
|
|
5083
5006
|
var require_cst = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5157,7 +5080,6 @@ var require_cst = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
5157
5080
|
exports.prettyToken = prettyToken;
|
|
5158
5081
|
exports.tokenType = tokenType;
|
|
5159
5082
|
}));
|
|
5160
|
-
|
|
5161
5083
|
//#endregion
|
|
5162
5084
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js
|
|
5163
5085
|
var require_lexer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5677,7 +5599,6 @@ var require_lexer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
5677
5599
|
};
|
|
5678
5600
|
exports.Lexer = Lexer;
|
|
5679
5601
|
}));
|
|
5680
|
-
|
|
5681
5602
|
//#endregion
|
|
5682
5603
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js
|
|
5683
5604
|
var require_line_counter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5725,7 +5646,6 @@ var require_line_counter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
|
|
|
5725
5646
|
};
|
|
5726
5647
|
exports.LineCounter = LineCounter;
|
|
5727
5648
|
}));
|
|
5728
|
-
|
|
5729
5649
|
//#endregion
|
|
5730
5650
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js
|
|
5731
5651
|
var require_parser = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -6582,7 +6502,6 @@ var require_parser = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
6582
6502
|
};
|
|
6583
6503
|
exports.Parser = Parser;
|
|
6584
6504
|
}));
|
|
6585
|
-
|
|
6586
6505
|
//#endregion
|
|
6587
6506
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/public-api.js
|
|
6588
6507
|
var require_public_api = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -6670,7 +6589,6 @@ var require_public_api = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
6670
6589
|
exports.parseDocument = parseDocument;
|
|
6671
6590
|
exports.stringify = stringify;
|
|
6672
6591
|
}));
|
|
6673
|
-
|
|
6674
6592
|
//#endregion
|
|
6675
6593
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/index.js
|
|
6676
6594
|
var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -6684,7 +6602,7 @@ var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
6684
6602
|
var Scalar = require_Scalar();
|
|
6685
6603
|
var YAMLMap = require_YAMLMap();
|
|
6686
6604
|
var YAMLSeq = require_YAMLSeq();
|
|
6687
|
-
|
|
6605
|
+
require_cst();
|
|
6688
6606
|
var lexer = require_lexer();
|
|
6689
6607
|
var lineCounter = require_line_counter();
|
|
6690
6608
|
var parser = require_parser();
|
|
@@ -6719,7 +6637,6 @@ var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
6719
6637
|
exports.visit = visit.visit;
|
|
6720
6638
|
exports.visitAsync = visit.visitAsync;
|
|
6721
6639
|
}));
|
|
6722
|
-
|
|
6723
6640
|
//#endregion
|
|
6724
6641
|
//#region src/highlight.ts
|
|
6725
6642
|
var import_dist = /* @__PURE__ */ require_chunk.__toESM(require_dist(), 1);
|
|
@@ -6752,46 +6669,110 @@ const BUILTIN_LANGS = [
|
|
|
6752
6669
|
"diff",
|
|
6753
6670
|
"toml"
|
|
6754
6671
|
];
|
|
6755
|
-
|
|
6672
|
+
const highlighterCache = /* @__PURE__ */ new Map();
|
|
6756
6673
|
/**
|
|
6757
6674
|
* Get or create the Shiki highlighter.
|
|
6758
6675
|
*/
|
|
6759
6676
|
async function getHighlighter(theme, customLangs = []) {
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6677
|
+
const { themeInput } = normalizeThemeInput(theme);
|
|
6678
|
+
const cacheKey = JSON.stringify({
|
|
6679
|
+
theme: themeInput,
|
|
6680
|
+
langs: customLangs
|
|
6763
6681
|
});
|
|
6682
|
+
let highlighterPromise = highlighterCache.get(cacheKey);
|
|
6683
|
+
if (!highlighterPromise) {
|
|
6684
|
+
highlighterPromise = (0, shiki.createHighlighter)({
|
|
6685
|
+
themes: [themeInput],
|
|
6686
|
+
langs: [...BUILTIN_LANGS, ...customLangs]
|
|
6687
|
+
});
|
|
6688
|
+
highlighterCache.set(cacheKey, highlighterPromise);
|
|
6689
|
+
}
|
|
6764
6690
|
return highlighterPromise;
|
|
6765
6691
|
}
|
|
6692
|
+
function normalizeThemeInput(theme) {
|
|
6693
|
+
if (typeof theme === "string") return {
|
|
6694
|
+
themeInput: theme,
|
|
6695
|
+
themeName: theme
|
|
6696
|
+
};
|
|
6697
|
+
const themeName = theme.name || "ox-content-custom-theme";
|
|
6698
|
+
return {
|
|
6699
|
+
themeInput: theme.name ? theme : {
|
|
6700
|
+
...theme,
|
|
6701
|
+
name: themeName
|
|
6702
|
+
},
|
|
6703
|
+
themeName
|
|
6704
|
+
};
|
|
6705
|
+
}
|
|
6766
6706
|
/**
|
|
6767
6707
|
* Rehype plugin for syntax highlighting with Shiki.
|
|
6768
6708
|
*/
|
|
6769
6709
|
function rehypeShikiHighlight(options) {
|
|
6770
6710
|
const { theme, langs } = options;
|
|
6771
6711
|
return async (tree) => {
|
|
6712
|
+
const { themeName } = normalizeThemeInput(theme);
|
|
6772
6713
|
const highlighter = await getHighlighter(theme, langs);
|
|
6714
|
+
const highlightBlockCode = (codeElement) => {
|
|
6715
|
+
let lang = "text";
|
|
6716
|
+
const langClass = normalizeClassName(codeElement.properties?.className).find((value) => value.startsWith("language-"));
|
|
6717
|
+
if (langClass) lang = langClass.replace("language-", "");
|
|
6718
|
+
const codeText = getTextContent(codeElement);
|
|
6719
|
+
try {
|
|
6720
|
+
const highlighted = highlighter.codeToHtml(codeText, {
|
|
6721
|
+
lang,
|
|
6722
|
+
theme: themeName
|
|
6723
|
+
});
|
|
6724
|
+
const parsed = (0, unified.unified)().use(rehype_parse.default, { fragment: true }).parse(highlighted);
|
|
6725
|
+
if (parsed.children[0]?.type === "element") {
|
|
6726
|
+
const highlightedPre = parsed.children[0];
|
|
6727
|
+
highlightedPre.properties ??= {};
|
|
6728
|
+
highlightedPre.properties["data-language"] = lang;
|
|
6729
|
+
return highlightedPre;
|
|
6730
|
+
}
|
|
6731
|
+
} catch {}
|
|
6732
|
+
return null;
|
|
6733
|
+
};
|
|
6734
|
+
const highlightInlineCode = (codeElement) => {
|
|
6735
|
+
let lang = "text";
|
|
6736
|
+
const originalCodeClasses = normalizeClassName(codeElement.properties?.className);
|
|
6737
|
+
const langClass = originalCodeClasses.find((value) => value.startsWith("language-"));
|
|
6738
|
+
if (!langClass) return null;
|
|
6739
|
+
lang = langClass.replace("language-", "");
|
|
6740
|
+
const codeText = getTextContent(codeElement);
|
|
6741
|
+
try {
|
|
6742
|
+
const highlighted = highlighter.codeToHtml(codeText, {
|
|
6743
|
+
lang,
|
|
6744
|
+
theme: themeName
|
|
6745
|
+
});
|
|
6746
|
+
const parsed = (0, unified.unified)().use(rehype_parse.default, { fragment: true }).parse(highlighted);
|
|
6747
|
+
if (parsed.children[0]?.type === "element") {
|
|
6748
|
+
const highlightedCode = parsed.children[0].children.find((child) => child.type === "element" && child.tagName === "code");
|
|
6749
|
+
if (highlightedCode) {
|
|
6750
|
+
highlightedCode.properties ??= {};
|
|
6751
|
+
const highlightedClasses = normalizeClassName(highlightedCode.properties.className);
|
|
6752
|
+
highlightedCode.properties.className = [...new Set([
|
|
6753
|
+
...originalCodeClasses,
|
|
6754
|
+
...highlightedClasses,
|
|
6755
|
+
"shiki-inline"
|
|
6756
|
+
])];
|
|
6757
|
+
highlightedCode.properties["data-language"] = lang;
|
|
6758
|
+
return highlightedCode;
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
} catch {}
|
|
6762
|
+
return null;
|
|
6763
|
+
};
|
|
6773
6764
|
const visit = async (node) => {
|
|
6774
6765
|
if ("children" in node) for (let i = 0; i < node.children.length; i++) {
|
|
6775
6766
|
const child = node.children[i];
|
|
6776
6767
|
if (child.type === "element" && child.tagName === "pre") {
|
|
6777
6768
|
const codeElement = child.children.find((c) => c.type === "element" && c.tagName === "code");
|
|
6778
6769
|
if (codeElement) {
|
|
6779
|
-
const
|
|
6780
|
-
|
|
6781
|
-
if (Array.isArray(className)) {
|
|
6782
|
-
const langClass = className.find((c) => typeof c === "string" && c.startsWith("language-"));
|
|
6783
|
-
if (langClass && typeof langClass === "string") lang = langClass.replace("language-", "");
|
|
6784
|
-
}
|
|
6785
|
-
const codeText = getTextContent(codeElement);
|
|
6786
|
-
try {
|
|
6787
|
-
const highlighted = highlighter.codeToHtml(codeText, {
|
|
6788
|
-
lang,
|
|
6789
|
-
theme
|
|
6790
|
-
});
|
|
6791
|
-
const parsed = (0, unified.unified)().use(rehype_parse.default, { fragment: true }).parse(highlighted);
|
|
6792
|
-
if (parsed.children[0]) node.children[i] = parsed.children[0];
|
|
6793
|
-
} catch {}
|
|
6770
|
+
const highlightedPre = highlightBlockCode(codeElement);
|
|
6771
|
+
if (highlightedPre) node.children[i] = highlightedPre;
|
|
6794
6772
|
}
|
|
6773
|
+
} else if (child.type === "element" && child.tagName === "code") {
|
|
6774
|
+
const highlightedCode = highlightInlineCode(child);
|
|
6775
|
+
if (highlightedCode) node.children[i] = highlightedCode;
|
|
6795
6776
|
} else if (child.type === "element") await visit(child);
|
|
6796
6777
|
}
|
|
6797
6778
|
};
|
|
@@ -6809,6 +6790,11 @@ function getTextContent(node) {
|
|
|
6809
6790
|
}
|
|
6810
6791
|
return text;
|
|
6811
6792
|
}
|
|
6793
|
+
function normalizeClassName(className) {
|
|
6794
|
+
if (Array.isArray(className)) return className.filter((value) => typeof value === "string");
|
|
6795
|
+
if (typeof className === "string" && className) return className.split(/\s+/).filter(Boolean);
|
|
6796
|
+
return [];
|
|
6797
|
+
}
|
|
6812
6798
|
/**
|
|
6813
6799
|
* Apply syntax highlighting to HTML using Shiki.
|
|
6814
6800
|
*/
|
|
@@ -6819,7 +6805,6 @@ async function highlightCode(html, theme = "github-dark", langs = []) {
|
|
|
6819
6805
|
}).use(rehype_stringify.default).process(html);
|
|
6820
6806
|
return String(result);
|
|
6821
6807
|
}
|
|
6822
|
-
|
|
6823
6808
|
//#endregion
|
|
6824
6809
|
//#region src/plugins/mermaid-protect.ts
|
|
6825
6810
|
/**
|
|
@@ -6872,7 +6857,6 @@ function restoreMermaidSvgs(html, svgs) {
|
|
|
6872
6857
|
for (const [placeholder, content] of svgs) result = result.replace(placeholder, content);
|
|
6873
6858
|
return result;
|
|
6874
6859
|
}
|
|
6875
|
-
|
|
6876
6860
|
//#endregion
|
|
6877
6861
|
//#region src/transform.ts
|
|
6878
6862
|
/**
|
|
@@ -6960,7 +6944,7 @@ async function loadNapiBindings() {
|
|
|
6960
6944
|
if (napiLoadAttempted) return napiBindings ?? null;
|
|
6961
6945
|
napiLoadAttempted = true;
|
|
6962
6946
|
try {
|
|
6963
|
-
const mod = await
|
|
6947
|
+
const mod = await require_mermaid.importNapiModule();
|
|
6964
6948
|
napiBindings = mod;
|
|
6965
6949
|
return mod;
|
|
6966
6950
|
} catch (error) {
|
|
@@ -6982,7 +6966,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
6982
6966
|
tocMaxDepth: options.tocMaxDepth,
|
|
6983
6967
|
convertMdLinks: ssgOptions?.convertMdLinks,
|
|
6984
6968
|
baseUrl: ssgOptions?.baseUrl,
|
|
6985
|
-
sourcePath: ssgOptions?.sourcePath ?? filePath
|
|
6969
|
+
sourcePath: ssgOptions?.sourcePath ?? filePath,
|
|
6970
|
+
codeAnnotations: options.codeAnnotations.enabled,
|
|
6971
|
+
codeAnnotationMetaKey: options.codeAnnotations.metaKey,
|
|
6972
|
+
codeAnnotationSyntax: options.codeAnnotations.notation,
|
|
6973
|
+
codeAnnotationDefaultLineNumbers: options.codeAnnotations.defaultLineNumbers
|
|
6986
6974
|
});
|
|
6987
6975
|
if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
|
|
6988
6976
|
let html = result.html;
|
|
@@ -6994,7 +6982,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
6994
6982
|
if (options.mermaid) html = await require_mermaid.transformMermaidStatic(html);
|
|
6995
6983
|
const { html: protectedHtml, svgs } = protectMermaidSvgs(html);
|
|
6996
6984
|
html = protectedHtml;
|
|
6997
|
-
if (options.highlight)
|
|
6985
|
+
if (options.highlight) {
|
|
6986
|
+
const originalHtml = html;
|
|
6987
|
+
const highlightedHtml = await highlightCode(html, options.highlightTheme, options.highlightLangs);
|
|
6988
|
+
html = napi.mergeHighlightedCodeBlocks(originalHtml, highlightedHtml);
|
|
6989
|
+
}
|
|
6998
6990
|
html = restoreMermaidSvgs(html, svgs);
|
|
6999
6991
|
return {
|
|
7000
6992
|
code: generateModuleCode(html, frontmatter, toc, filePath, options),
|
|
@@ -7090,7 +7082,6 @@ if (import.meta.hot) {
|
|
|
7090
7082
|
}
|
|
7091
7083
|
`;
|
|
7092
7084
|
}
|
|
7093
|
-
|
|
7094
7085
|
//#endregion
|
|
7095
7086
|
//#region src/nav-generator.ts
|
|
7096
7087
|
/**
|
|
@@ -7237,7 +7228,7 @@ function generateNavMetadata(docs, basePath = "/api") {
|
|
|
7237
7228
|
* @internal
|
|
7238
7229
|
*/
|
|
7239
7230
|
function getDocDisplayName(filePath) {
|
|
7240
|
-
const fileName = path
|
|
7231
|
+
const fileName = path.default.basename(filePath, path.default.extname(filePath));
|
|
7241
7232
|
if (fileName === "index" || fileName === "index-module") return "Overview";
|
|
7242
7233
|
return fileName.replace(/[-_]([a-z])/g, (_, char) => " " + char.toUpperCase()).replace(/^[a-z]/, (char) => char.toUpperCase());
|
|
7243
7234
|
}
|
|
@@ -7254,7 +7245,7 @@ function getDocDisplayName(filePath) {
|
|
|
7254
7245
|
* @internal
|
|
7255
7246
|
*/
|
|
7256
7247
|
function getDocFileName(filePath) {
|
|
7257
|
-
const fileName = path
|
|
7248
|
+
const fileName = path.default.basename(filePath, path.default.extname(filePath));
|
|
7258
7249
|
if (fileName === "index") return "index";
|
|
7259
7250
|
return fileName;
|
|
7260
7251
|
}
|
|
@@ -7329,7 +7320,6 @@ export interface NavItem {
|
|
|
7329
7320
|
export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as const;
|
|
7330
7321
|
`;
|
|
7331
7322
|
}
|
|
7332
|
-
|
|
7333
7323
|
//#endregion
|
|
7334
7324
|
//#region src/docs.ts
|
|
7335
7325
|
/**
|
|
@@ -7383,16 +7373,160 @@ export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as
|
|
|
7383
7373
|
* ```
|
|
7384
7374
|
*/
|
|
7385
7375
|
const DOCS_MANIFEST_FILE = ".ox-content-docs-manifest.json";
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
const
|
|
7376
|
+
const DOCS_DATA_FILE = "docs.json";
|
|
7377
|
+
function escapeHtml$3(str) {
|
|
7378
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7379
|
+
}
|
|
7380
|
+
function entryAnchor(name) {
|
|
7381
|
+
return name.toLowerCase();
|
|
7382
|
+
}
|
|
7383
|
+
function cleanSummaryText(text, maxLength = 120) {
|
|
7384
|
+
if (!text) return "";
|
|
7385
|
+
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
7386
|
+
if (collapsed.length <= maxLength) return collapsed;
|
|
7387
|
+
return `${collapsed.slice(0, maxLength - 1).trimEnd()}…`;
|
|
7388
|
+
}
|
|
7389
|
+
function renderInlineHtml(text) {
|
|
7390
|
+
let html = "";
|
|
7391
|
+
let lastIndex = 0;
|
|
7392
|
+
const tokenPattern = /`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*]+)\*|_([^_]+)_/g;
|
|
7393
|
+
let match;
|
|
7394
|
+
while ((match = tokenPattern.exec(text)) !== null) {
|
|
7395
|
+
html += escapeHtml$3(text.slice(lastIndex, match.index));
|
|
7396
|
+
if (match[1]) html += `<code>${escapeHtml$3(match[1])}</code>`;
|
|
7397
|
+
else if (match[2] && match[3]) html += `<a href="${escapeHtml$3(match[3])}">${renderInlineHtml(match[2])}</a>`;
|
|
7398
|
+
else if (match[4] || match[5]) {
|
|
7399
|
+
const strongText = match[4] ?? match[5] ?? "";
|
|
7400
|
+
html += `<strong>${renderInlineHtml(strongText)}</strong>`;
|
|
7401
|
+
} else if (match[6] || match[7]) {
|
|
7402
|
+
const emphasisText = match[6] ?? match[7] ?? "";
|
|
7403
|
+
html += `<em>${renderInlineHtml(emphasisText)}</em>`;
|
|
7404
|
+
}
|
|
7405
|
+
lastIndex = match.index + match[0].length;
|
|
7406
|
+
}
|
|
7407
|
+
html += escapeHtml$3(text.slice(lastIndex));
|
|
7408
|
+
return html.replace(/\n/g, "<br>");
|
|
7409
|
+
}
|
|
7410
|
+
function isFenceStart(line) {
|
|
7411
|
+
return /^```([\w-]+)?\s*$/.exec(line.trim());
|
|
7412
|
+
}
|
|
7413
|
+
function isHeading(line) {
|
|
7414
|
+
return /^(#{1,6})\s+(.*)$/.exec(line.trim());
|
|
7415
|
+
}
|
|
7416
|
+
function isOrderedListItem(line) {
|
|
7417
|
+
return /^\d+\.\s+(.*)$/.exec(line.trim());
|
|
7418
|
+
}
|
|
7419
|
+
function isUnorderedListItem(line) {
|
|
7420
|
+
return /^[-*+]\s+(.*)$/.exec(line.trim());
|
|
7421
|
+
}
|
|
7422
|
+
function isMarkdownBlockStart(line) {
|
|
7423
|
+
return Boolean(isFenceStart(line) || isHeading(line) || isOrderedListItem(line) || isUnorderedListItem(line));
|
|
7424
|
+
}
|
|
7425
|
+
function renderMarkdownBlocksHtml(text) {
|
|
7426
|
+
const lines = text.split(/\r?\n/);
|
|
7427
|
+
const blocks = [];
|
|
7428
|
+
let index = 0;
|
|
7429
|
+
while (index < lines.length) {
|
|
7430
|
+
const line = lines[index];
|
|
7431
|
+
const trimmed = line.trim();
|
|
7432
|
+
if (!trimmed) {
|
|
7433
|
+
index++;
|
|
7434
|
+
continue;
|
|
7435
|
+
}
|
|
7436
|
+
const fenceMatch = isFenceStart(line);
|
|
7437
|
+
if (fenceMatch) {
|
|
7438
|
+
const language = fenceMatch[1] || "text";
|
|
7439
|
+
const codeLines = [];
|
|
7440
|
+
index++;
|
|
7441
|
+
while (index < lines.length && !lines[index].trim().startsWith("```")) {
|
|
7442
|
+
codeLines.push(lines[index]);
|
|
7443
|
+
index++;
|
|
7444
|
+
}
|
|
7445
|
+
if (index < lines.length) index++;
|
|
7446
|
+
blocks.push(renderCodeBlockHtml(codeLines.join("\n"), language));
|
|
7447
|
+
continue;
|
|
7448
|
+
}
|
|
7449
|
+
const headingMatch = isHeading(line);
|
|
7450
|
+
if (headingMatch) {
|
|
7451
|
+
const level = Math.min(headingMatch[1].length, 6);
|
|
7452
|
+
blocks.push(`<h${level}>${renderInlineHtml(headingMatch[2].trim())}</h${level}>`);
|
|
7453
|
+
index++;
|
|
7454
|
+
continue;
|
|
7455
|
+
}
|
|
7456
|
+
if (isOrderedListItem(line)) {
|
|
7457
|
+
const items = [];
|
|
7458
|
+
while (index < lines.length) {
|
|
7459
|
+
const currentLine = lines[index];
|
|
7460
|
+
const currentMatch = isOrderedListItem(currentLine);
|
|
7461
|
+
if (!currentMatch) break;
|
|
7462
|
+
const itemLines = [currentMatch[1].trim()];
|
|
7463
|
+
index++;
|
|
7464
|
+
while (index < lines.length) {
|
|
7465
|
+
const continuation = lines[index];
|
|
7466
|
+
const continuationTrimmed = continuation.trim();
|
|
7467
|
+
if (!continuationTrimmed || isMarkdownBlockStart(continuation) || /^ {0,1}\d+\.\s+/.test(continuationTrimmed)) break;
|
|
7468
|
+
itemLines.push(continuationTrimmed);
|
|
7469
|
+
index++;
|
|
7470
|
+
}
|
|
7471
|
+
items.push(`<li>${renderInlineHtml(itemLines.join(" "))}</li>`);
|
|
7472
|
+
if (index < lines.length && !lines[index].trim()) break;
|
|
7473
|
+
}
|
|
7474
|
+
blocks.push(`<ol>\n${items.join("\n")}\n</ol>`);
|
|
7475
|
+
continue;
|
|
7476
|
+
}
|
|
7477
|
+
if (isUnorderedListItem(line)) {
|
|
7478
|
+
const items = [];
|
|
7479
|
+
while (index < lines.length) {
|
|
7480
|
+
const currentLine = lines[index];
|
|
7481
|
+
const currentMatch = isUnorderedListItem(currentLine);
|
|
7482
|
+
if (!currentMatch) break;
|
|
7483
|
+
const itemLines = [currentMatch[1].trim()];
|
|
7484
|
+
index++;
|
|
7485
|
+
while (index < lines.length) {
|
|
7486
|
+
const continuation = lines[index];
|
|
7487
|
+
const continuationTrimmed = continuation.trim();
|
|
7488
|
+
if (!continuationTrimmed || isMarkdownBlockStart(continuation) || /^[-*+]\s+/.test(continuationTrimmed)) break;
|
|
7489
|
+
itemLines.push(continuationTrimmed);
|
|
7490
|
+
index++;
|
|
7491
|
+
}
|
|
7492
|
+
items.push(`<li>${renderInlineHtml(itemLines.join(" "))}</li>`);
|
|
7493
|
+
if (index < lines.length && !lines[index].trim()) break;
|
|
7494
|
+
}
|
|
7495
|
+
blocks.push(`<ul>\n${items.join("\n")}\n</ul>`);
|
|
7496
|
+
continue;
|
|
7497
|
+
}
|
|
7498
|
+
const paragraphLines = [trimmed];
|
|
7499
|
+
index++;
|
|
7500
|
+
while (index < lines.length) {
|
|
7501
|
+
const nextLine = lines[index];
|
|
7502
|
+
const nextTrimmed = nextLine.trim();
|
|
7503
|
+
if (!nextTrimmed || isMarkdownBlockStart(nextLine)) break;
|
|
7504
|
+
paragraphLines.push(nextTrimmed);
|
|
7505
|
+
index++;
|
|
7506
|
+
}
|
|
7507
|
+
blocks.push(`<p>${renderInlineHtml(paragraphLines.join(" "))}</p>`);
|
|
7508
|
+
}
|
|
7509
|
+
return `<div class="ox-api-entry__prose">\n${blocks.join("\n")}\n</div>`;
|
|
7510
|
+
}
|
|
7511
|
+
function renderCodeBlockHtml(code, language = "typescript") {
|
|
7512
|
+
return `<pre><code class="language-${language}">${escapeHtml$3(code)}</code></pre>`;
|
|
7513
|
+
}
|
|
7514
|
+
function renderHighlightedInlineCodeHtml(code, className, language = "typescript") {
|
|
7515
|
+
return `<code class="${escapeHtml$3(className)} language-${language}">${escapeHtml$3(code)}</code>`;
|
|
7516
|
+
}
|
|
7517
|
+
function renderDetailsControlsHtml(targetSelector) {
|
|
7518
|
+
return `<div class="ox-api-controls" data-ox-api-target="${targetSelector}" role="toolbar" aria-label="Reference display controls">
|
|
7519
|
+
<button type="button" class="ox-api-controls__button" data-ox-api-toggle="expand">Open all</button>
|
|
7520
|
+
<button type="button" class="ox-api-controls__button" data-ox-api-toggle="collapse">Close all</button>
|
|
7521
|
+
</div>`;
|
|
7522
|
+
}
|
|
7523
|
+
function buildDocsData(docs) {
|
|
7524
|
+
return {
|
|
7525
|
+
version: 1,
|
|
7526
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7527
|
+
modules: docs
|
|
7528
|
+
};
|
|
7529
|
+
}
|
|
7396
7530
|
/**
|
|
7397
7531
|
* Extracts JSDoc documentation from source files in specified directories.
|
|
7398
7532
|
*
|
|
@@ -7459,11 +7593,13 @@ const JSDOC_BLOCK = /^[ \t]*\/\*\*\s*([\s\S]*?)\s*\*\//gm;
|
|
|
7459
7593
|
* ```
|
|
7460
7594
|
*/
|
|
7461
7595
|
async function extractDocs(srcDirs, options) {
|
|
7596
|
+
const extractFileDocs = (await require_mermaid.importNapiModule()).extractFileDocs;
|
|
7597
|
+
if (!extractFileDocs) throw new Error("[ox-content] extractFileDocs is not available from @ox-content/napi.");
|
|
7462
7598
|
const results = [];
|
|
7463
7599
|
for (const srcDir of srcDirs) {
|
|
7464
7600
|
const files = await findFiles(srcDir, options);
|
|
7465
7601
|
for (const file of files) {
|
|
7466
|
-
const entries =
|
|
7602
|
+
const entries = extractFileDocs(file, options.private).map(parseNapiDocItem).filter((entry) => Boolean(entry));
|
|
7467
7603
|
if (entries.length > 0) results.push({
|
|
7468
7604
|
file,
|
|
7469
7605
|
entries
|
|
@@ -7487,7 +7623,7 @@ async function findFiles(dir, options) {
|
|
|
7487
7623
|
return;
|
|
7488
7624
|
}
|
|
7489
7625
|
for (const entry of entries) {
|
|
7490
|
-
const fullPath = path
|
|
7626
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
7491
7627
|
if (entry.isDirectory()) {
|
|
7492
7628
|
if (!isExcluded(fullPath, options.exclude)) await walk(fullPath);
|
|
7493
7629
|
} else if (entry.isFile()) {
|
|
@@ -7514,127 +7650,21 @@ function isExcluded(file, patterns) {
|
|
|
7514
7650
|
return false;
|
|
7515
7651
|
});
|
|
7516
7652
|
}
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
function extractFromContent(content, file, options) {
|
|
7521
|
-
const entries = [];
|
|
7522
|
-
let match;
|
|
7523
|
-
JSDOC_BLOCK.lastIndex = 0;
|
|
7524
|
-
while ((match = JSDOC_BLOCK.exec(content)) !== null) {
|
|
7525
|
-
const jsdocContent = match[1];
|
|
7526
|
-
const jsdocEnd = match.index + match[0].length;
|
|
7527
|
-
const afterJsdoc = content.slice(jsdocEnd).trim();
|
|
7528
|
-
const lineNumber = content.slice(0, match.index).split("\n").length;
|
|
7529
|
-
const entry = parseJsdocBlock(jsdocContent, afterJsdoc, file, lineNumber);
|
|
7530
|
-
if (entry && (options.private || !entry.private)) entries.push(entry);
|
|
7531
|
-
}
|
|
7532
|
-
return entries;
|
|
7533
|
-
}
|
|
7534
|
-
/**
|
|
7535
|
-
* Extracts the complete function signature for display.
|
|
7536
|
-
*
|
|
7537
|
-
* Captures the full function declaration from `export/async/function name(...): ReturnType`
|
|
7538
|
-
* or `export const name = (...): ReturnType => {}`, handling multi-line signatures.
|
|
7539
|
-
*
|
|
7540
|
-
* @param signature - Multi-line function declaration text
|
|
7541
|
-
* @returns Cleaned function signature or undefined if not found
|
|
7542
|
-
*
|
|
7543
|
-
* @internal
|
|
7544
|
-
*/
|
|
7545
|
-
function extractFunctionSignature(signature) {
|
|
7546
|
-
const match = signature.match(/(?:export\s+)?(?:async\s+)?(?:function\s+\w+|\w+\s*=\s*(?:async\s*)?\()\([^{]*?\)(?:\s*:\s*[^{;]+)?/s);
|
|
7547
|
-
if (match) {
|
|
7548
|
-
let sig = match[0].trim();
|
|
7549
|
-
sig = sig.split("\n").map((line) => line.trim()).filter((line) => line).join("\n ");
|
|
7550
|
-
return sig;
|
|
7551
|
-
}
|
|
7552
|
-
}
|
|
7553
|
-
/**
|
|
7554
|
-
* Extracts parameter and return types from a TypeScript function signature.
|
|
7555
|
-
*
|
|
7556
|
-
* Parses function signatures to extract:
|
|
7557
|
-
* - Parameter names and their type annotations
|
|
7558
|
-
* - Return type annotation
|
|
7559
|
-
*
|
|
7560
|
-
* Handles various function declaration styles:
|
|
7561
|
-
* - `function name(param: type): ReturnType`
|
|
7562
|
-
* - `const name = (param: type): ReturnType => {}`
|
|
7563
|
-
* - `export async function name(param: type): Promise<ReturnType>`
|
|
7564
|
-
*
|
|
7565
|
-
* @param signature - Multi-line function signature text
|
|
7566
|
-
* @param params - Array of parameter docs with names already extracted
|
|
7567
|
-
* @returns Object with extracted parameter types and return type
|
|
7568
|
-
*
|
|
7569
|
-
* @internal
|
|
7570
|
-
*/
|
|
7571
|
-
function extractTypesFromSignature(signature, _params) {
|
|
7572
|
-
const paramTypes = [];
|
|
7573
|
-
const paramListMatch = signature.match(/\(([^)]*)\)(?:\s*:\s*([^{=>]+))?/s);
|
|
7574
|
-
if (paramListMatch && paramListMatch[1]) {
|
|
7575
|
-
const paramListStr = paramListMatch[1];
|
|
7576
|
-
const paramParts = splitParameters(paramListStr);
|
|
7577
|
-
for (const part of paramParts) {
|
|
7578
|
-
const trimmed = part.trim();
|
|
7579
|
-
if (!trimmed) continue;
|
|
7580
|
-
const typeMatch = /:\s*(.+?)(?:\s*=|$)/.exec(trimmed);
|
|
7581
|
-
if (typeMatch) {
|
|
7582
|
-
let typeStr = typeMatch[1].trim();
|
|
7583
|
-
if (typeStr.includes("=")) typeStr = typeStr.split("=")[0].trim();
|
|
7584
|
-
paramTypes.push(typeStr);
|
|
7585
|
-
}
|
|
7586
|
-
}
|
|
7587
|
-
}
|
|
7588
|
-
let returnType;
|
|
7589
|
-
const returnTypeMatch = signature.match(/\)\s*:\s*(.+?)(?={|$)/);
|
|
7590
|
-
if (returnTypeMatch) returnType = returnTypeMatch[1].trim();
|
|
7591
|
-
return {
|
|
7592
|
-
paramTypes,
|
|
7593
|
-
returnType
|
|
7594
|
-
};
|
|
7595
|
-
}
|
|
7596
|
-
/**
|
|
7597
|
-
* Splits function parameters while respecting nested angle brackets (generics).
|
|
7598
|
-
*
|
|
7599
|
-
* Handles cases like:
|
|
7600
|
-
* - `a: string, b: number` → `["a: string", "b: number"]`
|
|
7601
|
-
* - `a: Promise<string>, b: Record<string, any>` → `["a: Promise<string>", "b: Record<string, any>"]`
|
|
7602
|
-
*
|
|
7603
|
-
* @param paramListStr - String containing all parameters
|
|
7604
|
-
* @returns Array of individual parameter strings
|
|
7605
|
-
*
|
|
7606
|
-
* @internal
|
|
7607
|
-
*/
|
|
7608
|
-
function splitParameters(paramListStr) {
|
|
7609
|
-
const parts = [];
|
|
7610
|
-
let current = "";
|
|
7611
|
-
let depth = 0;
|
|
7612
|
-
for (const char of paramListStr) if (char === "<") {
|
|
7613
|
-
depth++;
|
|
7614
|
-
current += char;
|
|
7615
|
-
} else if (char === ">") {
|
|
7616
|
-
depth--;
|
|
7617
|
-
current += char;
|
|
7618
|
-
} else if (char === "," && depth === 0) {
|
|
7619
|
-
parts.push(current);
|
|
7620
|
-
current = "";
|
|
7621
|
-
} else current += char;
|
|
7622
|
-
if (current) parts.push(current);
|
|
7623
|
-
return parts;
|
|
7624
|
-
}
|
|
7625
|
-
/**
|
|
7626
|
-
* Parses a JSDoc block and the following declaration.
|
|
7627
|
-
* Only matches if the declaration is immediately after the JSDoc (with only whitespace/keywords between).
|
|
7628
|
-
*/
|
|
7629
|
-
function parseJsdocBlock(jsdoc, declaration, file, line) {
|
|
7653
|
+
function parseNapiDocItem(item) {
|
|
7654
|
+
const kind = normalizeNapiKind(item.kind);
|
|
7655
|
+
if (!kind) return null;
|
|
7630
7656
|
const params = [];
|
|
7631
7657
|
const examples = [];
|
|
7632
7658
|
const tags = {};
|
|
7633
7659
|
let description = "";
|
|
7634
7660
|
let returns;
|
|
7635
7661
|
let isPrivate = false;
|
|
7636
|
-
const rawLines = jsdoc.split("\n").map((
|
|
7637
|
-
|
|
7662
|
+
const rawLines = (item.jsdoc ?? "").split("\n").map((line) => {
|
|
7663
|
+
const trimmedStart = line.trimStart();
|
|
7664
|
+
const withoutStar = trimmedStart.startsWith("*") ? trimmedStart.slice(1) : trimmedStart;
|
|
7665
|
+
return withoutStar.startsWith(" ") ? withoutStar.slice(1) : withoutStar;
|
|
7666
|
+
});
|
|
7667
|
+
const cleanedLines = rawLines.map((line) => line.trim()).filter(Boolean);
|
|
7638
7668
|
let currentExample = "";
|
|
7639
7669
|
let inExample = false;
|
|
7640
7670
|
let rawLineIndex = 0;
|
|
@@ -7681,47 +7711,40 @@ function parseJsdocBlock(jsdoc, declaration, file, line) {
|
|
|
7681
7711
|
else description += "\n" + lineText;
|
|
7682
7712
|
}
|
|
7683
7713
|
if (inExample && currentExample) examples.push(currentExample.trim());
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
}
|
|
7706
|
-
|
|
7707
|
-
|
|
7708
|
-
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
}
|
|
7716
|
-
if (signatureTypes.returnType && (!returns || returns.type === "unknown")) if (returns) returns.type = signatureTypes.returnType;
|
|
7717
|
-
else returns = {
|
|
7718
|
-
type: signatureTypes.returnType,
|
|
7719
|
-
description: ""
|
|
7720
|
-
};
|
|
7721
|
-
signature = extractFunctionSignature(firstFewLines);
|
|
7714
|
+
if (params.length === 0 && item.params.length > 0) params.push(...item.params.map((param) => ({
|
|
7715
|
+
name: param.name,
|
|
7716
|
+
type: param.typeAnnotation ?? "unknown",
|
|
7717
|
+
description: param.description ?? "",
|
|
7718
|
+
optional: param.optional || void 0,
|
|
7719
|
+
default: param.defaultValue
|
|
7720
|
+
})));
|
|
7721
|
+
else if (item.params.length > 0) {
|
|
7722
|
+
const paramMap = new Map(item.params.map((param) => [param.name, param]));
|
|
7723
|
+
for (const param of params) {
|
|
7724
|
+
const rustParam = paramMap.get(param.name);
|
|
7725
|
+
if (!rustParam) continue;
|
|
7726
|
+
if (param.type === "unknown" && rustParam.typeAnnotation) param.type = rustParam.typeAnnotation;
|
|
7727
|
+
if (!param.description && rustParam.description) param.description = rustParam.description;
|
|
7728
|
+
if (param.optional === void 0 && rustParam.optional) param.optional = true;
|
|
7729
|
+
if (!param.default && rustParam.defaultValue) param.default = rustParam.defaultValue;
|
|
7730
|
+
}
|
|
7731
|
+
}
|
|
7732
|
+
if (!returns && item.returnType) returns = {
|
|
7733
|
+
type: item.returnType,
|
|
7734
|
+
description: ""
|
|
7735
|
+
};
|
|
7736
|
+
else if (returns && returns.type === "unknown" && item.returnType) returns.type = item.returnType;
|
|
7737
|
+
if (!description) description = item.doc ?? "";
|
|
7738
|
+
for (const tag of item.tags) {
|
|
7739
|
+
if (tag.tag === "param" || tag.tag === "returns" || tag.tag === "return" || tag.tag === "example") continue;
|
|
7740
|
+
if (tag.tag === "private") {
|
|
7741
|
+
isPrivate = true;
|
|
7742
|
+
continue;
|
|
7743
|
+
}
|
|
7744
|
+
if (!tags[tag.tag]) tags[tag.tag] = tag.value;
|
|
7722
7745
|
}
|
|
7723
7746
|
return {
|
|
7724
|
-
name,
|
|
7747
|
+
name: item.name,
|
|
7725
7748
|
kind,
|
|
7726
7749
|
description,
|
|
7727
7750
|
params: params.length > 0 ? params : void 0,
|
|
@@ -7729,121 +7752,214 @@ function parseJsdocBlock(jsdoc, declaration, file, line) {
|
|
|
7729
7752
|
examples: examples.length > 0 ? examples : void 0,
|
|
7730
7753
|
tags: Object.keys(tags).length > 0 ? tags : void 0,
|
|
7731
7754
|
private: isPrivate,
|
|
7732
|
-
file,
|
|
7733
|
-
line,
|
|
7734
|
-
|
|
7755
|
+
file: item.sourcePath,
|
|
7756
|
+
line: item.line,
|
|
7757
|
+
endLine: item.endLine,
|
|
7758
|
+
signature: item.signature
|
|
7735
7759
|
};
|
|
7736
7760
|
}
|
|
7761
|
+
function normalizeNapiKind(kind) {
|
|
7762
|
+
switch (kind) {
|
|
7763
|
+
case "function":
|
|
7764
|
+
case "class":
|
|
7765
|
+
case "interface":
|
|
7766
|
+
case "type":
|
|
7767
|
+
case "variable":
|
|
7768
|
+
case "module": return kind;
|
|
7769
|
+
case "enum": return "type";
|
|
7770
|
+
default: return null;
|
|
7771
|
+
}
|
|
7772
|
+
}
|
|
7737
7773
|
/**
|
|
7738
7774
|
* Generates Markdown documentation from extracted docs.
|
|
7739
7775
|
*/
|
|
7740
7776
|
function generateMarkdown(docs, options) {
|
|
7741
7777
|
const result = {};
|
|
7742
|
-
const
|
|
7778
|
+
const sortedDocs = sortExtractedDocs(docs);
|
|
7779
|
+
const symbolMap = buildSymbolMap(sortedDocs);
|
|
7743
7780
|
if (options.groupBy === "file") {
|
|
7744
7781
|
const docToFile = /* @__PURE__ */ new Map();
|
|
7745
|
-
for (const doc of
|
|
7746
|
-
let fileName = path
|
|
7782
|
+
for (const doc of sortedDocs) {
|
|
7783
|
+
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7747
7784
|
if (fileName === "index") fileName = "index-module";
|
|
7748
7785
|
docToFile.set(doc, fileName);
|
|
7749
7786
|
const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);
|
|
7750
7787
|
result[`${fileName}.md`] = markdown;
|
|
7751
7788
|
}
|
|
7752
|
-
result["index.md"] = generateIndex(
|
|
7789
|
+
result["index.md"] = generateIndex(sortedDocs, docToFile);
|
|
7753
7790
|
} else {
|
|
7754
7791
|
const byKind = /* @__PURE__ */ new Map();
|
|
7755
|
-
for (const doc of
|
|
7792
|
+
for (const doc of sortedDocs) for (const entry of doc.entries) {
|
|
7756
7793
|
const existing = byKind.get(entry.kind) || [];
|
|
7757
7794
|
existing.push(entry);
|
|
7758
7795
|
byKind.set(entry.kind, existing);
|
|
7759
7796
|
}
|
|
7760
|
-
for (const
|
|
7797
|
+
for (const entries of byKind.values()) entries.sort(compareEntriesByName);
|
|
7798
|
+
for (const [kind, entries] of [...byKind.entries()].sort(([a], [b]) => compareStrings(a, b))) result[`${kind}s.md`] = generateCategoryMarkdown(kind, entries, options, symbolMap);
|
|
7761
7799
|
result["index.md"] = generateCategoryIndex(byKind);
|
|
7762
7800
|
}
|
|
7763
7801
|
return result;
|
|
7764
7802
|
}
|
|
7803
|
+
function compareStrings(a, b) {
|
|
7804
|
+
return a.localeCompare(b, "en", {
|
|
7805
|
+
numeric: true,
|
|
7806
|
+
sensitivity: "base"
|
|
7807
|
+
});
|
|
7808
|
+
}
|
|
7809
|
+
function compareEntriesByName(a, b) {
|
|
7810
|
+
return compareStrings(a.name, b.name);
|
|
7811
|
+
}
|
|
7812
|
+
function sortExtractedDocs(docs) {
|
|
7813
|
+
return [...docs].map((doc) => ({
|
|
7814
|
+
...doc,
|
|
7815
|
+
entries: [...doc.entries].sort(compareEntriesByName)
|
|
7816
|
+
})).sort((a, b) => compareStrings(path.basename(a.file), path.basename(b.file)));
|
|
7817
|
+
}
|
|
7765
7818
|
function generateFileMarkdown(doc, options, currentFileName, symbolMap) {
|
|
7766
|
-
let md = `# ${path
|
|
7819
|
+
let md = `# ${path.basename(doc.file)}\n\n`;
|
|
7767
7820
|
if (options.githubUrl) {
|
|
7768
7821
|
const sourceLink = generateSourceLink(doc.file, options.githubUrl);
|
|
7769
7822
|
if (sourceLink) md += sourceLink + "\n\n";
|
|
7770
7823
|
}
|
|
7824
|
+
md += `> ${doc.entries.length} documented symbol${doc.entries.length === 1 ? "" : "s"}. `;
|
|
7825
|
+
md += "Read the signatures first, then expand each item for parameters, return types, and examples.\n\n";
|
|
7826
|
+
md += "## Reference\n\n";
|
|
7827
|
+
if (doc.entries.length > 1) md += renderDetailsControlsHtml(".ox-api-entry") + "\n\n";
|
|
7771
7828
|
for (const entry of doc.entries) md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);
|
|
7772
7829
|
return md;
|
|
7773
7830
|
}
|
|
7831
|
+
function normalizeSignature(signature) {
|
|
7832
|
+
if (!signature) return;
|
|
7833
|
+
return signature.replace(/\s+/g, " ").replace(/^export\s+/, "").replace(/^declare\s+/, "").replace(/^abstract\s+/, "").replace(/^async\s+function\s+/, "").replace(/^function\s+/, "").replace(/^class\s+/, "").replace(/^interface\s+/, "").replace(/^type\s+/, "").trim();
|
|
7834
|
+
}
|
|
7835
|
+
function formatKindLabel(kind) {
|
|
7836
|
+
switch (kind) {
|
|
7837
|
+
case "function": return "fn";
|
|
7838
|
+
case "interface": return "interface";
|
|
7839
|
+
case "class": return "class";
|
|
7840
|
+
case "type": return "type";
|
|
7841
|
+
case "const": return "const";
|
|
7842
|
+
default: return kind;
|
|
7843
|
+
}
|
|
7844
|
+
}
|
|
7845
|
+
function renderOverviewLine(entry, href) {
|
|
7846
|
+
const signature = normalizeSignature(entry.signature);
|
|
7847
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7848
|
+
const parts = [`- [\`${entry.name}\`](${href})`, `\`${entry.kind}\``];
|
|
7849
|
+
if (signature) parts.push(`\`${signature}\``);
|
|
7850
|
+
if (summary) parts.push(`- ${summary}`);
|
|
7851
|
+
return `${parts.join(" ")}\n`;
|
|
7852
|
+
}
|
|
7853
|
+
function renderOverviewHtmlItem(entry, href) {
|
|
7854
|
+
const signature = normalizeSignature(entry.signature);
|
|
7855
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7856
|
+
const heading = signature ? `<a href="${escapeHtml$3(href)}" class="ox-api-module__link">${renderHighlightedInlineCodeHtml(signature, "ox-api-module__signature ox-api-module__signature--highlighted")}</a>` : `<a href="${escapeHtml$3(href)}" class="ox-api-module__link"><code class="ox-api-module__name">${escapeHtml$3(entry.name)}</code></a>`;
|
|
7857
|
+
return `<li><span class="ox-api-module__kind">${escapeHtml$3(formatKindLabel(entry.kind))}</span><div class="ox-api-module__item">${heading}${summary ? `<span class="ox-api-module__summary">${renderInlineHtml(summary)}</span>` : ""}</div></li>`;
|
|
7858
|
+
}
|
|
7859
|
+
function renderParamsListHtml(params) {
|
|
7860
|
+
return `<div class="ox-api-entry__section ox-api-entry__section--params">
|
|
7861
|
+
<h4>Parameters</h4>
|
|
7862
|
+
<ul class="ox-api-entry__params">
|
|
7863
|
+
${params.map((param) => {
|
|
7864
|
+
const flags = [param.optional ? "optional" : "", param.default ? `default: ${param.default}` : ""].filter(Boolean);
|
|
7865
|
+
const description = [param.description, flags.join(" · ")].filter(Boolean).join(" — ");
|
|
7866
|
+
return `<li class="ox-api-entry__param">
|
|
7867
|
+
<div class="ox-api-entry__param-heading">
|
|
7868
|
+
<code class="ox-api-entry__param-name">${escapeHtml$3(param.name)}</code>
|
|
7869
|
+
<code class="ox-api-entry__param-type">${escapeHtml$3(param.type)}</code>
|
|
7870
|
+
</div>
|
|
7871
|
+
${description ? `<p class="ox-api-entry__param-description">${renderInlineHtml(description)}</p>` : ""}
|
|
7872
|
+
</li>`;
|
|
7873
|
+
}).join("\n")}
|
|
7874
|
+
</ul>
|
|
7875
|
+
</div>`;
|
|
7876
|
+
}
|
|
7877
|
+
function renderTagListHtml(tags) {
|
|
7878
|
+
return `<div class="ox-api-entry__section ox-api-entry__section--tags">
|
|
7879
|
+
<h4>Tags</h4>
|
|
7880
|
+
<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 class="ox-api-entry__tag-value">${renderInlineHtml(value)}</span></li>`).join("")}</ul>
|
|
7881
|
+
</div>`;
|
|
7882
|
+
}
|
|
7774
7883
|
function generateEntryMarkdown(entry, options, currentFileName, symbolMap) {
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
}
|
|
7781
|
-
if (
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
}
|
|
7790
|
-
if (entry.params && entry.params.length > 0) {
|
|
7791
|
-
md += "### Parameters\n\n";
|
|
7792
|
-
md += "| Name | Type | Description |\n";
|
|
7793
|
-
md += "|------|------|-------------|\n";
|
|
7794
|
-
for (const param of entry.params) md += `| \`${param.name}\` | \`${param.type}\` | ${param.description} |\n`;
|
|
7795
|
-
md += "\n";
|
|
7796
|
-
}
|
|
7797
|
-
if (entry.returns) {
|
|
7798
|
-
md += "### Returns\n\n";
|
|
7799
|
-
md += `\`${entry.returns.type}\` - ${entry.returns.description}\n\n`;
|
|
7800
|
-
}
|
|
7884
|
+
const processedDescription = entry.description && currentFileName && symbolMap ? convertSymbolLinks(entry.description, currentFileName, symbolMap) : entry.description;
|
|
7885
|
+
const summarySignature = normalizeSignature(entry.signature);
|
|
7886
|
+
const sourceHref = options?.githubUrl ? generateSourceHref(entry.file, options.githubUrl, entry.line, entry.endLine) : void 0;
|
|
7887
|
+
let body = "";
|
|
7888
|
+
if (processedDescription) body += renderMarkdownBlocksHtml(processedDescription) + "\n";
|
|
7889
|
+
if (sourceHref) body += `<p class="ox-api-entry__source"><a href="${escapeHtml$3(sourceHref)}">View source</a></p>\n`;
|
|
7890
|
+
if (entry.params && entry.params.length > 0) body += renderParamsListHtml(entry.params) + "\n";
|
|
7891
|
+
if (entry.returns) body += `<div class="ox-api-entry__section ox-api-entry__section--returns">
|
|
7892
|
+
<h4>Returns</h4>
|
|
7893
|
+
<div class="ox-api-entry__return">
|
|
7894
|
+
<code class="ox-api-entry__return-type">${escapeHtml$3(entry.returns.type)}</code>
|
|
7895
|
+
${entry.returns.description ? `<p class="ox-api-entry__return-description">${renderInlineHtml(entry.returns.description)}</p>` : ""}
|
|
7896
|
+
</div>
|
|
7897
|
+
</div>\n`;
|
|
7801
7898
|
if (entry.examples && entry.examples.length > 0) {
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
}
|
|
7809
|
-
|
|
7810
|
-
|
|
7899
|
+
const examplesHtml = entry.examples.map((example) => example.replace(/^```\w*\n?/, "").replace(/\n?```$/, "")).map((example) => renderCodeBlockHtml(example, "ts")).join("\n");
|
|
7900
|
+
body += `<div class="ox-api-entry__section ox-api-entry__section--examples">\n<h4>Examples</h4>\n${examplesHtml}\n</div>\n`;
|
|
7901
|
+
}
|
|
7902
|
+
if (entry.tags && Object.keys(entry.tags).length > 0) body += renderTagListHtml(entry.tags) + "\n";
|
|
7903
|
+
const summaryDescription = cleanSummaryText(processedDescription, summarySignature ? 80 : 120);
|
|
7904
|
+
const summaryHeading = summarySignature ? renderHighlightedInlineCodeHtml(summarySignature, "ox-api-entry__signature ox-api-entry__signature--highlighted") : `<code class="ox-api-entry__name">${escapeHtml$3(entry.name)}</code>`;
|
|
7905
|
+
const summaryParts = [`<span class="ox-api-entry__kind">${escapeHtml$3(formatKindLabel(entry.kind))}</span>`, `<span class="ox-api-entry__summary-main">${summaryHeading}${summaryDescription ? `<span class="ox-api-entry__description">${renderInlineHtml(summaryDescription)}</span>` : ""}</span>`];
|
|
7906
|
+
return `<details id="${entryAnchor(entry.name)}" class="ox-api-entry">
|
|
7907
|
+
<summary>${summaryParts.join("")}</summary>
|
|
7908
|
+
<div class="ox-api-entry__body">
|
|
7909
|
+
${body.trim()}
|
|
7910
|
+
</div>
|
|
7911
|
+
</details>
|
|
7912
|
+
|
|
7913
|
+
`;
|
|
7811
7914
|
}
|
|
7812
7915
|
function generateIndex(docs, docToFile) {
|
|
7813
7916
|
let md = "# API Documentation\n\n";
|
|
7814
7917
|
md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
|
|
7918
|
+
md += "> Use search scopes like `@api transform` to limit results to the generated API reference.\n\n";
|
|
7815
7919
|
md += "## Modules\n\n";
|
|
7920
|
+
if (docs.length > 1) md += renderDetailsControlsHtml(".ox-api-module") + "\n\n";
|
|
7816
7921
|
for (const doc of docs) {
|
|
7817
|
-
const displayName = path
|
|
7922
|
+
const displayName = path.basename(doc.file, path.extname(doc.file));
|
|
7818
7923
|
let fileName = displayName;
|
|
7819
7924
|
if (docToFile && docToFile.has(doc)) fileName = docToFile.get(doc);
|
|
7820
7925
|
else if (fileName === "index") fileName = "index-module";
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7926
|
+
const countLabel = `${doc.entries.length} symbol${doc.entries.length === 1 ? "" : "s"}`;
|
|
7927
|
+
md += `<details class="ox-api-module">
|
|
7928
|
+
<summary>
|
|
7929
|
+
<span class="ox-api-module__title"><a href="./${fileName}.md">${escapeHtml$3(displayName)}</a></span>
|
|
7930
|
+
<span class="ox-api-module__count">${countLabel}</span>
|
|
7931
|
+
</summary>
|
|
7932
|
+
<div class="ox-api-module__body">
|
|
7933
|
+
<ul class="ox-api-module__list">
|
|
7934
|
+
`;
|
|
7935
|
+
for (const entry of doc.entries) md += ` ${renderOverviewHtmlItem(entry, `./${fileName}.md#${entryAnchor(entry.name)}`)}\n`;
|
|
7936
|
+
md += ` </ul>
|
|
7937
|
+
</div>
|
|
7938
|
+
</details>
|
|
7939
|
+
|
|
7940
|
+
`;
|
|
7828
7941
|
}
|
|
7829
7942
|
return md;
|
|
7830
7943
|
}
|
|
7831
7944
|
function generateCategoryMarkdown(kind, entries, options, symbolMap) {
|
|
7832
7945
|
const categoryFileName = `${kind}s`;
|
|
7833
7946
|
let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\n\n`;
|
|
7947
|
+
md += `> ${entries.length} documented ${kind}${entries.length === 1 ? "" : "s"} collected across modules.\n\n`;
|
|
7948
|
+
md += "## Overview\n\n";
|
|
7949
|
+
for (const entry of entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
|
|
7950
|
+
md += "\n## Reference\n\n";
|
|
7951
|
+
if (entries.length > 1) md += renderDetailsControlsHtml(".ox-api-entry") + "\n\n";
|
|
7834
7952
|
for (const entry of entries) md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);
|
|
7835
7953
|
return md;
|
|
7836
7954
|
}
|
|
7837
7955
|
function generateCategoryIndex(byKind) {
|
|
7838
7956
|
let md = "# API Documentation\n\n";
|
|
7839
7957
|
md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
|
|
7840
|
-
for (const [kind, entries] of byKind) {
|
|
7958
|
+
for (const [kind, entries] of [...byKind.entries()].sort(([a], [b]) => compareStrings(a, b))) {
|
|
7841
7959
|
const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + "s";
|
|
7842
7960
|
md += `## [${kindTitle}](./${kind}s.md)\n\n`;
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
md += `- **${entry.name}** - ${desc}...\n`;
|
|
7846
|
-
}
|
|
7961
|
+
md += `> ${entries.length} item${entries.length === 1 ? "" : "s"}.\n\n`;
|
|
7962
|
+
for (const entry of entries) md += renderOverviewLine(entry, `./${kind}s.md#${entryAnchor(entry.name)}`);
|
|
7847
7963
|
md += "\n";
|
|
7848
7964
|
}
|
|
7849
7965
|
return md;
|
|
@@ -7884,7 +8000,7 @@ function convertSymbolLinks(text, currentFileName, symbolMap) {
|
|
|
7884
8000
|
function buildSymbolMap(docs) {
|
|
7885
8001
|
const map = /* @__PURE__ */ new Map();
|
|
7886
8002
|
for (const doc of docs) {
|
|
7887
|
-
let fileName = path
|
|
8003
|
+
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7888
8004
|
if (fileName === "index") fileName = "index-module";
|
|
7889
8005
|
for (const entry of doc.entries) map.set(entry.name, {
|
|
7890
8006
|
name: entry.name,
|
|
@@ -7901,7 +8017,8 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7901
8017
|
await fs.promises.mkdir(outDir, { recursive: true });
|
|
7902
8018
|
const generatedFiles = new Set(Object.keys(docs));
|
|
7903
8019
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") generatedFiles.add("nav.ts");
|
|
7904
|
-
|
|
8020
|
+
if (extractedDocs) generatedFiles.add(DOCS_DATA_FILE);
|
|
8021
|
+
const manifestPath = path.join(outDir, DOCS_MANIFEST_FILE);
|
|
7905
8022
|
let previousFiles = [];
|
|
7906
8023
|
try {
|
|
7907
8024
|
previousFiles = JSON.parse(await fs.promises.readFile(manifestPath, "utf-8"));
|
|
@@ -7910,32 +8027,37 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7910
8027
|
}
|
|
7911
8028
|
for (const staleFile of previousFiles) {
|
|
7912
8029
|
if (generatedFiles.has(staleFile)) continue;
|
|
7913
|
-
await fs.promises.rm(path
|
|
8030
|
+
await fs.promises.rm(path.join(outDir, staleFile), { force: true });
|
|
7914
8031
|
}
|
|
7915
8032
|
for (const [fileName, content] of Object.entries(docs)) {
|
|
7916
|
-
const filePath = path
|
|
8033
|
+
const filePath = path.join(outDir, fileName);
|
|
7917
8034
|
await fs.promises.writeFile(filePath, content, "utf-8");
|
|
7918
8035
|
}
|
|
7919
8036
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") {
|
|
7920
8037
|
const navCode = generateNavCode(generateNavMetadata(extractedDocs, "/api"), "apiNav");
|
|
7921
|
-
const navFilePath = path
|
|
8038
|
+
const navFilePath = path.join(outDir, "nav.ts");
|
|
7922
8039
|
await fs.promises.writeFile(navFilePath, navCode, "utf-8");
|
|
7923
8040
|
}
|
|
8041
|
+
if (extractedDocs) await fs.promises.writeFile(path.join(outDir, DOCS_DATA_FILE), JSON.stringify(buildDocsData(extractedDocs), null, 2), "utf-8");
|
|
7924
8042
|
await fs.promises.writeFile(manifestPath, JSON.stringify([...generatedFiles].sort(), null, 2), "utf-8");
|
|
7925
8043
|
}
|
|
7926
8044
|
/**
|
|
7927
8045
|
* Resolves docs options with defaults.
|
|
7928
8046
|
*/
|
|
7929
8047
|
/**
|
|
7930
|
-
* Generates a GitHub source link for a file and optional line
|
|
8048
|
+
* Generates a GitHub source link for a file and optional line range.
|
|
7931
8049
|
*
|
|
7932
8050
|
* @param filePath - Full path to the source file
|
|
7933
8051
|
* @param githubUrl - Base GitHub repository URL
|
|
7934
|
-
* @param lineNumber - Optional line number to link to
|
|
7935
|
-
* @
|
|
8052
|
+
* @param lineNumber - Optional start line number to link to
|
|
8053
|
+
* @param endLineNumber - Optional end line number to link to
|
|
8054
|
+
* @returns Absolute GitHub URL to source code
|
|
7936
8055
|
*/
|
|
7937
|
-
function
|
|
7938
|
-
return
|
|
8056
|
+
function generateSourceHref(filePath, githubUrl, lineNumber, endLineNumber) {
|
|
8057
|
+
return `${githubUrl}/blob/main/${filePath.replace(/^.*?\/(npm|packages|crates|src)\//, "$1/")}${lineNumber ? endLineNumber && endLineNumber > lineNumber ? `#L${lineNumber}-L${endLineNumber}` : `#L${lineNumber}` : ""}`;
|
|
8058
|
+
}
|
|
8059
|
+
function generateSourceLink(filePath, githubUrl, lineNumber, endLineNumber) {
|
|
8060
|
+
return `**[Source](${generateSourceHref(filePath, githubUrl, lineNumber, endLineNumber)})**`;
|
|
7939
8061
|
}
|
|
7940
8062
|
function resolveDocsOptions(options) {
|
|
7941
8063
|
if (options === false) return false;
|
|
@@ -7958,7 +8080,6 @@ function resolveDocsOptions(options) {
|
|
|
7958
8080
|
generateNav: opts.generateNav ?? true
|
|
7959
8081
|
};
|
|
7960
8082
|
}
|
|
7961
|
-
|
|
7962
8083
|
//#endregion
|
|
7963
8084
|
//#region src/og-image/renderer.ts
|
|
7964
8085
|
/**
|
|
@@ -8003,10 +8124,10 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8003
8124
|
await route.continue();
|
|
8004
8125
|
return;
|
|
8005
8126
|
}
|
|
8006
|
-
const filePath = path
|
|
8127
|
+
const filePath = path.join(publicDir, url.pathname);
|
|
8007
8128
|
try {
|
|
8008
8129
|
const body = await fs.readFile(filePath);
|
|
8009
|
-
const ext = path
|
|
8130
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
8010
8131
|
await route.fulfill({
|
|
8011
8132
|
body,
|
|
8012
8133
|
contentType: {
|
|
@@ -8041,7 +8162,6 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8041
8162
|
});
|
|
8042
8163
|
return Buffer.from(screenshot);
|
|
8043
8164
|
}
|
|
8044
|
-
|
|
8045
8165
|
//#endregion
|
|
8046
8166
|
//#region src/og-image/browser.ts
|
|
8047
8167
|
/**
|
|
@@ -8087,7 +8207,6 @@ async function openBrowser() {
|
|
|
8087
8207
|
return null;
|
|
8088
8208
|
}
|
|
8089
8209
|
}
|
|
8090
|
-
|
|
8091
8210
|
//#endregion
|
|
8092
8211
|
//#region src/og-image/template.ts
|
|
8093
8212
|
/**
|
|
@@ -8096,28 +8215,78 @@ async function openBrowser() {
|
|
|
8096
8215
|
function escapeHtml$2(str) {
|
|
8097
8216
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
8098
8217
|
}
|
|
8218
|
+
function normalizeBrandValue(str) {
|
|
8219
|
+
return str.replace(/\s+/g, "").toLowerCase();
|
|
8220
|
+
}
|
|
8221
|
+
function renderWordmarkSvg() {
|
|
8222
|
+
return `<svg width="430" height="102" viewBox="0 0 270 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8223
|
+
<defs>
|
|
8224
|
+
<linearGradient id="ogWordmarkGradient" x1="286" y1="10" x2="320" y2="54" gradientUnits="userSpaceOnUse">
|
|
8225
|
+
<stop offset="0%" stop-color="#355cff"/>
|
|
8226
|
+
<stop offset="100%" stop-color="#74c7ff"/>
|
|
8227
|
+
</linearGradient>
|
|
8228
|
+
</defs>
|
|
8229
|
+
<text
|
|
8230
|
+
x="2"
|
|
8231
|
+
y="43"
|
|
8232
|
+
fill="#eff6ff"
|
|
8233
|
+
font-family="IBM Plex Sans, IBM Plex Mono, Avenir Next, Segoe UI, sans-serif"
|
|
8234
|
+
font-size="34"
|
|
8235
|
+
font-weight="700"
|
|
8236
|
+
letter-spacing="-1.4"
|
|
8237
|
+
>
|
|
8238
|
+
OXCONTENT
|
|
8239
|
+
</text>
|
|
8240
|
+
<text
|
|
8241
|
+
x="213"
|
|
8242
|
+
y="43.5"
|
|
8243
|
+
fill="#eff6ff"
|
|
8244
|
+
font-family="IBM Plex Sans, IBM Plex Mono, Avenir Next, Segoe UI, sans-serif"
|
|
8245
|
+
font-size="40"
|
|
8246
|
+
font-weight="400"
|
|
8247
|
+
>
|
|
8248
|
+
(
|
|
8249
|
+
</text>
|
|
8250
|
+
<g transform="translate(216 9) scale(0.089) rotate(-7 256 256)">
|
|
8251
|
+
<path
|
|
8252
|
+
d="M161 96H286C298 96 309 101 318 110L352 144C361 153 366 164 366 176V386C366 399 355 410 342 410H161C148 410 138 399 138 386V120C138 107 148 96 161 96Z"
|
|
8253
|
+
fill="url(#ogWordmarkGradient)"
|
|
8254
|
+
/>
|
|
8255
|
+
</g>
|
|
8256
|
+
<text
|
|
8257
|
+
x="252"
|
|
8258
|
+
y="43.5"
|
|
8259
|
+
fill="#eff6ff"
|
|
8260
|
+
font-family="IBM Plex Sans, IBM Plex Mono, Avenir Next, Segoe UI, sans-serif"
|
|
8261
|
+
font-size="40"
|
|
8262
|
+
font-weight="400"
|
|
8263
|
+
>
|
|
8264
|
+
)
|
|
8265
|
+
</text>
|
|
8266
|
+
</svg>`;
|
|
8267
|
+
}
|
|
8099
8268
|
/**
|
|
8100
8269
|
* Returns the built-in default template function.
|
|
8101
8270
|
*/
|
|
8102
8271
|
function getDefaultTemplate() {
|
|
8103
8272
|
return function defaultTemplate(props) {
|
|
8104
|
-
const { title, description, siteName
|
|
8105
|
-
const
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8273
|
+
const { title, description, siteName } = props;
|
|
8274
|
+
const rawBrand = siteName?.trim() ? siteName : "Ox Content";
|
|
8275
|
+
const isBrandCard = normalizeBrandValue(title) === normalizeBrandValue(rawBrand);
|
|
8276
|
+
const heroTitle = isBrandCard ? "cargo doc for JavaScript" : title;
|
|
8277
|
+
const heroDescription = isBrandCard ? "Rust-powered docs and high-performance Markdown tooling." : description && description.trim().length > 0 ? description : "Rust-powered docs and Markdown tooling.";
|
|
8278
|
+
const descriptionHtml = heroDescription.trim().length > 0 ? `<p style="max-width:760px;font-size:28px;color:#93a4c3;line-height:1.45;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;">${escapeHtml$2(heroDescription)}</p>` : "";
|
|
8279
|
+
return `<div style="width:100%;height:100%;position:relative;overflow:hidden;box-sizing:border-box;padding:56px 64px 52px;background:#0b1220;font-family:'IBM Plex Sans','Avenir Next','Segoe UI',system-ui,sans-serif;color:#eff6ff;border:1px solid #223252;border-top:4px solid #4f6fae;">
|
|
8280
|
+
<div style="position:relative;z-index:1;display:flex;flex-direction:column;height:100%;">
|
|
8281
|
+
<div style="display:flex;align-items:flex-start;">${renderWordmarkSvg()}</div>
|
|
8282
|
+
<div style="display:flex;flex-direction:column;justify-content:center;gap:24px;max-width:860px;flex:1;padding:22px 0 0;">
|
|
8283
|
+
<h1 style="font-size:78px;font-weight:700;color:#eff6ff;line-height:1.02;letter-spacing:-0.055em;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;">${escapeHtml$2(heroTitle)}</h1>
|
|
8284
|
+
${descriptionHtml}
|
|
8285
|
+
</div>
|
|
8116
8286
|
</div>
|
|
8117
8287
|
</div>`;
|
|
8118
8288
|
};
|
|
8119
8289
|
}
|
|
8120
|
-
|
|
8121
8290
|
//#endregion
|
|
8122
8291
|
//#region src/og-image/cache.ts
|
|
8123
8292
|
/**
|
|
@@ -8143,7 +8312,7 @@ function computeCacheKey(templateSource, props, width, height) {
|
|
|
8143
8312
|
* Returns the cached file path if found, null otherwise.
|
|
8144
8313
|
*/
|
|
8145
8314
|
async function getCached(cacheDir, key) {
|
|
8146
|
-
const filePath = path
|
|
8315
|
+
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8147
8316
|
try {
|
|
8148
8317
|
return await fs_promises.readFile(filePath);
|
|
8149
8318
|
} catch {
|
|
@@ -8155,12 +8324,11 @@ async function getCached(cacheDir, key) {
|
|
|
8155
8324
|
*/
|
|
8156
8325
|
async function writeCache(cacheDir, key, png) {
|
|
8157
8326
|
await fs_promises.mkdir(cacheDir, { recursive: true });
|
|
8158
|
-
const filePath = path
|
|
8327
|
+
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8159
8328
|
await fs_promises.writeFile(filePath, png);
|
|
8160
8329
|
}
|
|
8161
|
-
|
|
8162
8330
|
//#endregion
|
|
8163
|
-
//#region \0@oxc-project+runtime@0.
|
|
8331
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/usingCtx.js
|
|
8164
8332
|
function _usingCtx() {
|
|
8165
8333
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
8166
8334
|
var n = Error();
|
|
@@ -8215,7 +8383,6 @@ function _usingCtx() {
|
|
|
8215
8383
|
}
|
|
8216
8384
|
};
|
|
8217
8385
|
}
|
|
8218
|
-
|
|
8219
8386
|
//#endregion
|
|
8220
8387
|
//#region src/og-image/index.ts
|
|
8221
8388
|
/**
|
|
@@ -8248,14 +8415,14 @@ function resolveOgImageOptions(options) {
|
|
|
8248
8415
|
*/
|
|
8249
8416
|
async function resolveTemplate(options, root) {
|
|
8250
8417
|
if (!options.template) return getDefaultTemplate();
|
|
8251
|
-
const templatePath = path
|
|
8418
|
+
const templatePath = path.resolve(root, options.template);
|
|
8252
8419
|
const fs = await import("fs/promises");
|
|
8253
8420
|
try {
|
|
8254
8421
|
await fs.access(templatePath);
|
|
8255
8422
|
} catch {
|
|
8256
8423
|
throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);
|
|
8257
8424
|
}
|
|
8258
|
-
switch (path
|
|
8425
|
+
switch (path.extname(templatePath).toLowerCase()) {
|
|
8259
8426
|
case ".vue": return resolveVueTemplate(templatePath, options, root);
|
|
8260
8427
|
case ".svelte": return resolveSvelteTemplate(templatePath, root);
|
|
8261
8428
|
case ".tsx":
|
|
@@ -8269,9 +8436,9 @@ async function resolveTemplate(options, root) {
|
|
|
8269
8436
|
async function resolveTsTemplate(templatePath, options, root) {
|
|
8270
8437
|
const fs = await import("fs/promises");
|
|
8271
8438
|
const { rolldown } = await import("rolldown");
|
|
8272
|
-
const cacheDir = path
|
|
8439
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8273
8440
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8274
|
-
const outfile = path
|
|
8441
|
+
const outfile = path.join(cacheDir, "_template.mjs");
|
|
8275
8442
|
const bundle = await rolldown({
|
|
8276
8443
|
input: templatePath,
|
|
8277
8444
|
platform: "node"
|
|
@@ -8294,9 +8461,9 @@ async function resolveTsTemplate(templatePath, options, root) {
|
|
|
8294
8461
|
async function resolveVueTemplate(templatePath, options, root) {
|
|
8295
8462
|
const fs = await import("fs/promises");
|
|
8296
8463
|
const { rolldown } = await import("rolldown");
|
|
8297
|
-
const cacheDir = path
|
|
8464
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8298
8465
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8299
|
-
const outfile = path
|
|
8466
|
+
const outfile = path.join(cacheDir, "_template_vue.mjs");
|
|
8300
8467
|
const bundle = await rolldown({
|
|
8301
8468
|
input: templatePath,
|
|
8302
8469
|
platform: "node",
|
|
@@ -8392,9 +8559,9 @@ async function getVizejsPlugin() {
|
|
|
8392
8559
|
async function resolveSvelteTemplate(templatePath, root) {
|
|
8393
8560
|
const fs = await import("fs/promises");
|
|
8394
8561
|
const { rolldown } = await import("rolldown");
|
|
8395
|
-
const cacheDir = path
|
|
8562
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8396
8563
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8397
|
-
const outfile = path
|
|
8564
|
+
const outfile = path.join(cacheDir, "_template_svelte.mjs");
|
|
8398
8565
|
const bundle = await rolldown({
|
|
8399
8566
|
input: templatePath,
|
|
8400
8567
|
platform: "node",
|
|
@@ -8450,9 +8617,9 @@ function createSvelteCompilerPlugin() {
|
|
|
8450
8617
|
async function resolveReactTemplate(templatePath, root) {
|
|
8451
8618
|
const fs = await import("fs/promises");
|
|
8452
8619
|
const { rolldown } = await import("rolldown");
|
|
8453
|
-
const cacheDir = path
|
|
8620
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8454
8621
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8455
|
-
const outfile = path
|
|
8622
|
+
const outfile = path.join(cacheDir, "_template_react.mjs");
|
|
8456
8623
|
const bundle = await rolldown({
|
|
8457
8624
|
input: templatePath,
|
|
8458
8625
|
platform: "node",
|
|
@@ -8502,7 +8669,7 @@ async function resolveReactTemplate(templatePath, root) {
|
|
|
8502
8669
|
async function computeTemplateSource(options, root) {
|
|
8503
8670
|
if (!options.template) return "__default__";
|
|
8504
8671
|
const fs = await import("fs/promises");
|
|
8505
|
-
const templatePath = path
|
|
8672
|
+
const templatePath = path.resolve(root, options.template);
|
|
8506
8673
|
const content = await fs.readFile(templatePath, "utf-8");
|
|
8507
8674
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
8508
8675
|
}
|
|
@@ -8520,7 +8687,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8520
8687
|
if (pages.length === 0) return [];
|
|
8521
8688
|
const templateFn = await resolveTemplate(options, root);
|
|
8522
8689
|
const templateSource = await computeTemplateSource(options, root);
|
|
8523
|
-
const cacheDir = path
|
|
8690
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8524
8691
|
if (options.cache) {
|
|
8525
8692
|
const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);
|
|
8526
8693
|
if (allCached) return allCached;
|
|
@@ -8532,7 +8699,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8532
8699
|
error: "Chromium not available"
|
|
8533
8700
|
}));
|
|
8534
8701
|
const results = [];
|
|
8535
|
-
const publicDir = path
|
|
8702
|
+
const publicDir = path.join(root, "public");
|
|
8536
8703
|
const concurrency = Math.max(1, options.concurrency);
|
|
8537
8704
|
for (let i = 0; i < pages.length; i += concurrency) {
|
|
8538
8705
|
const batch = pages.slice(i, i + concurrency);
|
|
@@ -8556,7 +8723,7 @@ async function tryServeAllFromCache(pages, templateSource, options, cacheDir) {
|
|
|
8556
8723
|
for (const entry of pages) {
|
|
8557
8724
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8558
8725
|
if (!cached) return null;
|
|
8559
|
-
await fs.mkdir(path
|
|
8726
|
+
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8560
8727
|
await fs.writeFile(entry.outputPath, cached);
|
|
8561
8728
|
results.push({
|
|
8562
8729
|
outputPath: entry.outputPath,
|
|
@@ -8574,7 +8741,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8574
8741
|
if (options.cache) {
|
|
8575
8742
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8576
8743
|
if (cached) {
|
|
8577
|
-
await fs.mkdir(path
|
|
8744
|
+
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8578
8745
|
await fs.writeFile(entry.outputPath, cached);
|
|
8579
8746
|
return {
|
|
8580
8747
|
outputPath: entry.outputPath,
|
|
@@ -8584,7 +8751,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8584
8751
|
}
|
|
8585
8752
|
const html = await templateFn(entry.props);
|
|
8586
8753
|
const png = await session.renderPage(html, options.width, options.height, publicDir);
|
|
8587
|
-
await fs.mkdir(path
|
|
8754
|
+
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8588
8755
|
await fs.writeFile(entry.outputPath, png);
|
|
8589
8756
|
if (options.cache) await writeCache(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height), png);
|
|
8590
8757
|
return {
|
|
@@ -8599,7 +8766,6 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8599
8766
|
};
|
|
8600
8767
|
}
|
|
8601
8768
|
}
|
|
8602
|
-
|
|
8603
8769
|
//#endregion
|
|
8604
8770
|
//#region src/plugins/index.ts
|
|
8605
8771
|
/**
|
|
@@ -8609,28 +8775,27 @@ async function transformAllPlugins(html, options = {}) {
|
|
|
8609
8775
|
const { tabs = true, youtube = true, github = true, ogp = true, mermaid = true, githubToken } = options;
|
|
8610
8776
|
let result = html;
|
|
8611
8777
|
if (tabs) {
|
|
8612
|
-
const { transformTabs } = await Promise.resolve().then(() => require("./tabs.cjs"));
|
|
8778
|
+
const { transformTabs } = await Promise.resolve().then(() => require("./tabs.cjs")).then((n) => n.tabs_exports);
|
|
8613
8779
|
result = await transformTabs(result);
|
|
8614
8780
|
}
|
|
8615
8781
|
if (youtube) {
|
|
8616
|
-
const { transformYouTube } = await Promise.resolve().then(() => require("./youtube.cjs"));
|
|
8782
|
+
const { transformYouTube } = await Promise.resolve().then(() => require("./youtube.cjs")).then((n) => n.youtube_exports);
|
|
8617
8783
|
result = await transformYouTube(result);
|
|
8618
8784
|
}
|
|
8619
8785
|
if (github) {
|
|
8620
|
-
const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs"));
|
|
8786
|
+
const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs")).then((n) => n.github_exports);
|
|
8621
8787
|
result = await transformGitHub(result, void 0, { token: githubToken });
|
|
8622
8788
|
}
|
|
8623
8789
|
if (ogp) {
|
|
8624
|
-
const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs"));
|
|
8790
|
+
const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs")).then((n) => n.ogp_exports);
|
|
8625
8791
|
result = await transformOgp(result);
|
|
8626
8792
|
}
|
|
8627
8793
|
if (mermaid) {
|
|
8628
|
-
const { transformMermaidStatic } = await Promise.resolve().then(() => require("./mermaid.cjs"));
|
|
8794
|
+
const { transformMermaidStatic } = await Promise.resolve().then(() => require("./mermaid.cjs")).then((n) => n.mermaid_exports);
|
|
8629
8795
|
result = await transformMermaidStatic(result);
|
|
8630
8796
|
}
|
|
8631
8797
|
return result;
|
|
8632
8798
|
}
|
|
8633
|
-
|
|
8634
8799
|
//#endregion
|
|
8635
8800
|
//#region src/island/parse.ts
|
|
8636
8801
|
/**
|
|
@@ -8822,7 +8987,6 @@ initIslands((el, props) => {
|
|
|
8822
8987
|
});
|
|
8823
8988
|
`;
|
|
8824
8989
|
}
|
|
8825
|
-
|
|
8826
8990
|
//#endregion
|
|
8827
8991
|
//#region src/theme.ts
|
|
8828
8992
|
/**
|
|
@@ -8832,31 +8996,32 @@ initIslands((el, props) => {
|
|
|
8832
8996
|
const defaultTheme = {
|
|
8833
8997
|
name: "default",
|
|
8834
8998
|
colors: {
|
|
8835
|
-
primary: "#
|
|
8836
|
-
primaryHover: "#
|
|
8999
|
+
primary: "#4f6fae",
|
|
9000
|
+
primaryHover: "#425f96",
|
|
8837
9001
|
background: "#ffffff",
|
|
8838
|
-
backgroundAlt: "#
|
|
8839
|
-
text: "#
|
|
8840
|
-
textMuted: "#
|
|
8841
|
-
border: "#
|
|
8842
|
-
codeBackground: "#
|
|
8843
|
-
codeText: "#
|
|
9002
|
+
backgroundAlt: "#f5f7fb",
|
|
9003
|
+
text: "#131a30",
|
|
9004
|
+
textMuted: "#4f607b",
|
|
9005
|
+
border: "#d2dbea",
|
|
9006
|
+
codeBackground: "#101a31",
|
|
9007
|
+
codeText: "#edf3ff"
|
|
8844
9008
|
},
|
|
8845
9009
|
darkColors: {
|
|
8846
|
-
primary: "#
|
|
8847
|
-
primaryHover: "#
|
|
8848
|
-
background: "#
|
|
8849
|
-
backgroundAlt: "#
|
|
8850
|
-
text: "#
|
|
8851
|
-
textMuted: "#
|
|
8852
|
-
border: "#
|
|
8853
|
-
codeBackground: "#
|
|
8854
|
-
codeText: "#
|
|
9010
|
+
primary: "#86a4da",
|
|
9011
|
+
primaryHover: "#a3bbe8",
|
|
9012
|
+
background: "#060816",
|
|
9013
|
+
backgroundAlt: "#0d1528",
|
|
9014
|
+
text: "#ebf2ff",
|
|
9015
|
+
textMuted: "#8ea0bf",
|
|
9016
|
+
border: "#223252",
|
|
9017
|
+
codeBackground: "#0a1020",
|
|
9018
|
+
codeText: "#e7f0ff"
|
|
8855
9019
|
},
|
|
8856
9020
|
fonts: {
|
|
8857
|
-
sans: "
|
|
8858
|
-
mono: "
|
|
9021
|
+
sans: "\"IBM Plex Sans\", \"Avenir Next\", \"Segoe UI Variable\", \"Segoe UI\", sans-serif",
|
|
9022
|
+
mono: "\"IBM Plex Mono\", \"SFMono-Regular\", Consolas, monospace"
|
|
8859
9023
|
},
|
|
9024
|
+
entryPage: { mode: "default" },
|
|
8860
9025
|
layout: {
|
|
8861
9026
|
sidebarWidth: "260px",
|
|
8862
9027
|
headerHeight: "60px",
|
|
@@ -8864,6 +9029,9 @@ const defaultTheme = {
|
|
|
8864
9029
|
},
|
|
8865
9030
|
header: {
|
|
8866
9031
|
logo: void 0,
|
|
9032
|
+
logoLight: void 0,
|
|
9033
|
+
logoDark: void 0,
|
|
9034
|
+
showSiteNameText: true,
|
|
8867
9035
|
logoWidth: 28,
|
|
8868
9036
|
logoHeight: 28
|
|
8869
9037
|
},
|
|
@@ -8941,6 +9109,7 @@ function resolveTheme(config) {
|
|
|
8941
9109
|
colors: merged.colors ?? defaultTheme.colors,
|
|
8942
9110
|
darkColors: merged.darkColors ?? defaultTheme.darkColors,
|
|
8943
9111
|
fonts: merged.fonts ?? defaultTheme.fonts,
|
|
9112
|
+
entryPage: merged.entryPage ?? defaultTheme.entryPage,
|
|
8944
9113
|
layout: merged.layout ?? defaultTheme.layout,
|
|
8945
9114
|
header: merged.header ?? defaultTheme.header,
|
|
8946
9115
|
footer: merged.footer ?? defaultTheme.footer,
|
|
@@ -8981,13 +9150,17 @@ function themeToNapi(theme) {
|
|
|
8981
9150
|
sans: theme.fonts.sans,
|
|
8982
9151
|
mono: theme.fonts.mono
|
|
8983
9152
|
} : void 0,
|
|
9153
|
+
entryPage: theme.entryPage.mode ? { mode: theme.entryPage.mode } : void 0,
|
|
8984
9154
|
layout: theme.layout.sidebarWidth ? {
|
|
8985
9155
|
sidebarWidth: theme.layout.sidebarWidth,
|
|
8986
9156
|
headerHeight: theme.layout.headerHeight,
|
|
8987
9157
|
maxContentWidth: theme.layout.maxContentWidth
|
|
8988
9158
|
} : void 0,
|
|
8989
|
-
header: theme.header.logo ? {
|
|
9159
|
+
header: theme.header.logo || theme.header.logoLight || theme.header.logoDark ? {
|
|
8990
9160
|
logo: theme.header.logo,
|
|
9161
|
+
logoLight: theme.header.logoLight,
|
|
9162
|
+
logoDark: theme.header.logoDark,
|
|
9163
|
+
showSiteNameText: theme.header.showSiteNameText,
|
|
8991
9164
|
logoWidth: theme.header.logoWidth,
|
|
8992
9165
|
logoHeight: theme.header.logoHeight
|
|
8993
9166
|
} : void 0,
|
|
@@ -9005,7 +9178,6 @@ function themeToNapi(theme) {
|
|
|
9005
9178
|
js: theme.js || void 0
|
|
9006
9179
|
};
|
|
9007
9180
|
}
|
|
9008
|
-
|
|
9009
9181
|
//#endregion
|
|
9010
9182
|
//#region src/ssg.ts
|
|
9011
9183
|
/**
|
|
@@ -9037,40 +9209,65 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9037
9209
|
--sidebar-width: 260px;
|
|
9038
9210
|
--header-height: 60px;
|
|
9039
9211
|
--max-content-width: 960px;
|
|
9040
|
-
--font-sans:
|
|
9041
|
-
--font-mono:
|
|
9212
|
+
--font-sans: 'IBM Plex Sans', 'Avenir Next', 'Segoe UI Variable', 'Segoe UI', sans-serif;
|
|
9213
|
+
--font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
|
|
9042
9214
|
--color-bg: #ffffff;
|
|
9043
|
-
--color-bg-alt: #
|
|
9044
|
-
--color-text: #
|
|
9045
|
-
--color-text-muted: #
|
|
9046
|
-
--color-border: #
|
|
9047
|
-
--color-primary: #
|
|
9048
|
-
--color-primary-hover: #
|
|
9049
|
-
--color-code-bg: #
|
|
9050
|
-
--color-code-
|
|
9215
|
+
--color-bg-alt: #f5f7fb;
|
|
9216
|
+
--color-text: #131a30;
|
|
9217
|
+
--color-text-muted: #4f607b;
|
|
9218
|
+
--color-border: #d2dbea;
|
|
9219
|
+
--color-primary: #4f6fae;
|
|
9220
|
+
--color-primary-hover: #425f96;
|
|
9221
|
+
--color-code-bg: #101a31;
|
|
9222
|
+
--color-code-bg-top: #18264a;
|
|
9223
|
+
--color-code-text: #edf3ff;
|
|
9224
|
+
--color-code-line-highlight: rgba(56, 189, 248, 0.16);
|
|
9225
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.18);
|
|
9226
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9227
|
+
--color-code-line-error: rgba(239, 68, 68, 0.18);
|
|
9228
|
+
--color-code-line-error-border: #ef4444;
|
|
9229
|
+
--color-code-frame-border: rgba(147, 166, 200, 0.46);
|
|
9230
|
+
--surface-noise-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23noise)' opacity='0.062'/%3E%3C/svg%3E");
|
|
9231
|
+
--surface-noise-size: 164px 164px;
|
|
9051
9232
|
}
|
|
9052
9233
|
[data-theme="dark"] {
|
|
9053
|
-
--color-bg: #
|
|
9054
|
-
--color-bg-alt: #
|
|
9055
|
-
--color-text: #
|
|
9056
|
-
--color-text-muted: #
|
|
9057
|
-
--color-border: #
|
|
9058
|
-
--color-primary: #
|
|
9059
|
-
--color-primary-hover: #
|
|
9060
|
-
--color-code-bg: #
|
|
9061
|
-
--color-code-
|
|
9234
|
+
--color-bg: #060816;
|
|
9235
|
+
--color-bg-alt: #0d1528;
|
|
9236
|
+
--color-text: #ebf2ff;
|
|
9237
|
+
--color-text-muted: #8ea0bf;
|
|
9238
|
+
--color-border: #223252;
|
|
9239
|
+
--color-primary: #86a4da;
|
|
9240
|
+
--color-primary-hover: #a3bbe8;
|
|
9241
|
+
--color-code-bg: #0a1020;
|
|
9242
|
+
--color-code-bg-top: #0a1020;
|
|
9243
|
+
--color-code-text: #e7f0ff;
|
|
9244
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9245
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9246
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9247
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9248
|
+
--color-code-line-error-border: #f87171;
|
|
9249
|
+
--color-code-frame-border: rgba(34, 50, 82, 0.92);
|
|
9250
|
+
--surface-noise-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.25' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23noise)' opacity='0.098'/%3E%3C/svg%3E");
|
|
9062
9251
|
}
|
|
9063
9252
|
@media (prefers-color-scheme: dark) {
|
|
9064
9253
|
:root:not([data-theme="light"]) {
|
|
9065
|
-
--color-bg: #
|
|
9066
|
-
--color-bg-alt: #
|
|
9067
|
-
--color-text: #
|
|
9068
|
-
--color-text-muted: #
|
|
9069
|
-
--color-border: #
|
|
9070
|
-
--color-primary: #
|
|
9071
|
-
--color-primary-hover: #
|
|
9072
|
-
--color-code-bg: #
|
|
9073
|
-
--color-code-
|
|
9254
|
+
--color-bg: #060816;
|
|
9255
|
+
--color-bg-alt: #0d1528;
|
|
9256
|
+
--color-text: #ebf2ff;
|
|
9257
|
+
--color-text-muted: #8ea0bf;
|
|
9258
|
+
--color-border: #223252;
|
|
9259
|
+
--color-primary: #86a4da;
|
|
9260
|
+
--color-primary-hover: #a3bbe8;
|
|
9261
|
+
--color-code-bg: #0a1020;
|
|
9262
|
+
--color-code-bg-top: #0a1020;
|
|
9263
|
+
--color-code-text: #e7f0ff;
|
|
9264
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9265
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9266
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9267
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9268
|
+
--color-code-line-error-border: #f87171;
|
|
9269
|
+
--color-code-frame-border: rgba(34, 50, 82, 0.92);
|
|
9270
|
+
--surface-noise-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.25' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23noise)' opacity='0.098'/%3E%3C/svg%3E");
|
|
9074
9271
|
}
|
|
9075
9272
|
}
|
|
9076
9273
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
@@ -9080,6 +9277,10 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9080
9277
|
line-height: 1.7;
|
|
9081
9278
|
color: var(--color-text);
|
|
9082
9279
|
background: var(--color-bg);
|
|
9280
|
+
background-image: var(--surface-noise-image);
|
|
9281
|
+
background-size: var(--surface-noise-size);
|
|
9282
|
+
background-repeat: repeat;
|
|
9283
|
+
background-blend-mode: soft-light;
|
|
9083
9284
|
}
|
|
9084
9285
|
a { color: var(--color-primary); text-decoration: none; }
|
|
9085
9286
|
a:hover { color: var(--color-primary-hover); text-decoration: underline; }
|
|
@@ -9098,6 +9299,18 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9098
9299
|
padding: 0 1.5rem;
|
|
9099
9300
|
z-index: 100;
|
|
9100
9301
|
}
|
|
9302
|
+
.header,
|
|
9303
|
+
.sidebar,
|
|
9304
|
+
.search-modal,
|
|
9305
|
+
.mobile-footer,
|
|
9306
|
+
.content .ox-api-entry,
|
|
9307
|
+
.content .ox-api-module,
|
|
9308
|
+
.content blockquote.ox-callout {
|
|
9309
|
+
background-image: var(--surface-noise-image);
|
|
9310
|
+
background-size: var(--surface-noise-size);
|
|
9311
|
+
background-repeat: repeat;
|
|
9312
|
+
background-blend-mode: soft-light;
|
|
9313
|
+
}
|
|
9101
9314
|
.header-title {
|
|
9102
9315
|
font-size: 1.25rem;
|
|
9103
9316
|
font-weight: 600;
|
|
@@ -9122,7 +9335,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9122
9335
|
padding: 0.5rem 0.75rem;
|
|
9123
9336
|
background: var(--color-bg-alt);
|
|
9124
9337
|
border: 1px solid var(--color-border);
|
|
9125
|
-
border-radius:
|
|
9338
|
+
border-radius: 4px;
|
|
9126
9339
|
color: var(--color-text-muted);
|
|
9127
9340
|
cursor: pointer;
|
|
9128
9341
|
font-size: 0.875rem;
|
|
@@ -9148,7 +9361,6 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9148
9361
|
inset: 0;
|
|
9149
9362
|
z-index: 200;
|
|
9150
9363
|
background: rgba(0,0,0,0.6);
|
|
9151
|
-
backdrop-filter: blur(4px);
|
|
9152
9364
|
justify-content: center;
|
|
9153
9365
|
padding-top: 10vh;
|
|
9154
9366
|
}
|
|
@@ -9159,9 +9371,8 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9159
9371
|
margin: 0 1rem;
|
|
9160
9372
|
background: var(--color-bg);
|
|
9161
9373
|
border: 1px solid var(--color-border);
|
|
9162
|
-
border-radius:
|
|
9374
|
+
border-radius: 4px;
|
|
9163
9375
|
overflow: hidden;
|
|
9164
|
-
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
|
|
9165
9376
|
max-height: 70vh;
|
|
9166
9377
|
display: flex;
|
|
9167
9378
|
flex-direction: column;
|
|
@@ -9201,7 +9412,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9201
9412
|
.search-result {
|
|
9202
9413
|
display: block;
|
|
9203
9414
|
padding: 0.75rem 1rem;
|
|
9204
|
-
border-radius:
|
|
9415
|
+
border-radius: 4px;
|
|
9205
9416
|
color: var(--color-text);
|
|
9206
9417
|
text-decoration: none;
|
|
9207
9418
|
}
|
|
@@ -9232,7 +9443,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9232
9443
|
border: none;
|
|
9233
9444
|
cursor: pointer;
|
|
9234
9445
|
padding: 0.5rem;
|
|
9235
|
-
border-radius:
|
|
9446
|
+
border-radius: 4px;
|
|
9236
9447
|
color: var(--color-text-muted);
|
|
9237
9448
|
transition: background 0.15s, color 0.15s;
|
|
9238
9449
|
}
|
|
@@ -9261,38 +9472,50 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9261
9472
|
left: 0;
|
|
9262
9473
|
bottom: 0;
|
|
9263
9474
|
width: var(--sidebar-width);
|
|
9264
|
-
background: var(--color-bg-alt);
|
|
9265
|
-
border-right: 1px solid var(--color-border);
|
|
9475
|
+
background: color-mix(in srgb, var(--color-bg-alt) 16%, var(--color-bg));
|
|
9476
|
+
border-right: 1px solid color-mix(in srgb, var(--color-border) 48%, transparent);
|
|
9266
9477
|
overflow-y: auto;
|
|
9267
|
-
padding: 1.5rem
|
|
9478
|
+
padding: 1rem 0.875rem 1.5rem;
|
|
9479
|
+
}
|
|
9480
|
+
.sidebar--entry { display: none; }
|
|
9481
|
+
.sidebar nav {
|
|
9482
|
+
display: flex;
|
|
9483
|
+
flex-direction: column;
|
|
9484
|
+
gap: 1rem;
|
|
9268
9485
|
}
|
|
9269
|
-
.nav-section { margin-bottom:
|
|
9486
|
+
.nav-section { margin-bottom: 0; }
|
|
9270
9487
|
.nav-title {
|
|
9271
|
-
font-size: 0.
|
|
9488
|
+
font-size: 0.6875rem;
|
|
9272
9489
|
font-weight: 600;
|
|
9273
9490
|
text-transform: uppercase;
|
|
9274
|
-
letter-spacing: 0.
|
|
9491
|
+
letter-spacing: 0.08em;
|
|
9275
9492
|
color: var(--color-text-muted);
|
|
9276
|
-
margin-bottom: 0.
|
|
9277
|
-
padding: 0 0.
|
|
9493
|
+
margin-bottom: 0.4rem;
|
|
9494
|
+
padding: 0 0.625rem;
|
|
9495
|
+
}
|
|
9496
|
+
.nav-list {
|
|
9497
|
+
list-style: none;
|
|
9498
|
+
display: flex;
|
|
9499
|
+
flex-direction: column;
|
|
9500
|
+
gap: 0.125rem;
|
|
9278
9501
|
}
|
|
9279
|
-
.nav-
|
|
9280
|
-
.nav-item { margin: 0.125rem 0; }
|
|
9502
|
+
.nav-item { margin: 0; }
|
|
9281
9503
|
.nav-link {
|
|
9282
9504
|
display: block;
|
|
9283
|
-
padding: 0.
|
|
9284
|
-
border-radius:
|
|
9285
|
-
color: var(--color-text);
|
|
9505
|
+
padding: 0.45rem 0.625rem;
|
|
9506
|
+
border-radius: 0;
|
|
9507
|
+
color: color-mix(in srgb, var(--color-text) 92%, var(--color-text-muted));
|
|
9286
9508
|
font-size: 0.875rem;
|
|
9287
|
-
transition: background 0.15s;
|
|
9288
9509
|
}
|
|
9289
9510
|
.nav-link:hover {
|
|
9290
|
-
background: var(--color-
|
|
9511
|
+
background: color-mix(in srgb, var(--color-bg-alt) 58%, transparent);
|
|
9512
|
+
color: var(--color-text);
|
|
9291
9513
|
text-decoration: none;
|
|
9292
9514
|
}
|
|
9293
9515
|
.nav-link.active {
|
|
9294
|
-
background: var(--color-
|
|
9295
|
-
color:
|
|
9516
|
+
background: color-mix(in srgb, var(--color-bg-alt) 72%, transparent);
|
|
9517
|
+
color: var(--color-text);
|
|
9518
|
+
font-weight: 600;
|
|
9296
9519
|
}
|
|
9297
9520
|
|
|
9298
9521
|
/* Main content */
|
|
@@ -9347,8 +9570,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9347
9570
|
padding: 0.5rem 1rem;
|
|
9348
9571
|
margin: 1rem 0;
|
|
9349
9572
|
background: var(--color-bg-alt);
|
|
9350
|
-
border-radius: 0
|
|
9573
|
+
border-radius: 0 4px 4px 0;
|
|
9574
|
+
}
|
|
9575
|
+
.content blockquote.ox-callout {
|
|
9576
|
+
--callout-accent: var(--color-primary);
|
|
9577
|
+
border-left-width: 3px;
|
|
9578
|
+
border-left-color: var(--callout-accent);
|
|
9579
|
+
padding: 0.9rem 1rem;
|
|
9580
|
+
border-radius: 4px;
|
|
9581
|
+
background: color-mix(in srgb, var(--color-bg-alt) 92%, var(--callout-accent) 8%);
|
|
9582
|
+
}
|
|
9583
|
+
.content blockquote.ox-callout.ox-callout--note,
|
|
9584
|
+
.content blockquote.ox-callout.ox-callout--important { --callout-accent: var(--color-primary); }
|
|
9585
|
+
.content blockquote.ox-callout.ox-callout--tip { --callout-accent: #0891b2; }
|
|
9586
|
+
.content blockquote.ox-callout.ox-callout--warning { --callout-accent: #d97706; }
|
|
9587
|
+
.content blockquote.ox-callout.ox-callout--caution { --callout-accent: #dc2626; }
|
|
9588
|
+
.content .ox-callout-title {
|
|
9589
|
+
margin: 0 0 0.5rem;
|
|
9590
|
+
font-size: 0.75rem;
|
|
9591
|
+
font-weight: 700;
|
|
9592
|
+
letter-spacing: 0.08em;
|
|
9593
|
+
text-transform: uppercase;
|
|
9594
|
+
color: var(--callout-accent, var(--color-primary));
|
|
9351
9595
|
}
|
|
9596
|
+
.content blockquote.ox-callout > :last-child { margin-bottom: 0; }
|
|
9597
|
+
.content blockquote.ox-callout > :not(.ox-callout-title):first-of-type { margin-top: 0; }
|
|
9352
9598
|
.content code {
|
|
9353
9599
|
font-family: var(--font-mono);
|
|
9354
9600
|
font-size: 0.875em;
|
|
@@ -9358,18 +9604,45 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9358
9604
|
word-break: break-all;
|
|
9359
9605
|
}
|
|
9360
9606
|
.content pre {
|
|
9361
|
-
background:
|
|
9607
|
+
background: linear-gradient(
|
|
9608
|
+
180deg,
|
|
9609
|
+
var(--color-code-bg-top) 0,
|
|
9610
|
+
var(--color-code-bg) 3.5rem
|
|
9611
|
+
) !important;
|
|
9362
9612
|
color: var(--color-code-text);
|
|
9363
9613
|
padding: 1rem 1.25rem;
|
|
9364
|
-
border-radius:
|
|
9614
|
+
border-radius: 4px;
|
|
9615
|
+
border: 1px solid var(--color-code-frame-border);
|
|
9365
9616
|
overflow-x: auto;
|
|
9366
9617
|
margin: 1.5rem 0;
|
|
9367
9618
|
line-height: 1.5;
|
|
9368
9619
|
}
|
|
9369
9620
|
.content pre code {
|
|
9370
9621
|
background: transparent;
|
|
9622
|
+
border: 0;
|
|
9371
9623
|
padding: 0;
|
|
9624
|
+
border-radius: 0;
|
|
9372
9625
|
font-size: 0.8125rem;
|
|
9626
|
+
word-break: normal;
|
|
9627
|
+
}
|
|
9628
|
+
.content pre.ox-code-block code {
|
|
9629
|
+
display: block;
|
|
9630
|
+
}
|
|
9631
|
+
.content pre.ox-code-block .line {
|
|
9632
|
+
display: block;
|
|
9633
|
+
margin: 0 -1.25rem;
|
|
9634
|
+
padding: 0 1.25rem;
|
|
9635
|
+
}
|
|
9636
|
+
.content pre.ox-code-block .ox-code-line--highlight {
|
|
9637
|
+
background: var(--color-code-line-highlight);
|
|
9638
|
+
}
|
|
9639
|
+
.content pre.ox-code-block .ox-code-line--warning {
|
|
9640
|
+
background: var(--color-code-line-warning);
|
|
9641
|
+
border-left: 3px solid var(--color-code-line-warning-border);
|
|
9642
|
+
}
|
|
9643
|
+
.content pre.ox-code-block .ox-code-line--error {
|
|
9644
|
+
background: var(--color-code-line-error);
|
|
9645
|
+
border-left: 3px solid var(--color-code-line-error-border);
|
|
9373
9646
|
}
|
|
9374
9647
|
.content table {
|
|
9375
9648
|
width: 100%;
|
|
@@ -9383,21 +9656,355 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9383
9656
|
text-align: left;
|
|
9384
9657
|
}
|
|
9385
9658
|
.content th { background: var(--color-bg-alt); font-weight: 600; }
|
|
9386
|
-
.content img { max-width: 100%; height: auto; border-radius:
|
|
9659
|
+
.content img { max-width: 100%; height: auto; border-radius: 4px; display: block; }
|
|
9387
9660
|
.content img[alt*="Logo"] { max-width: 200px; display: block; margin: 1rem 0; }
|
|
9388
9661
|
.content img[alt*="Architecture"] { max-width: 600px; }
|
|
9389
9662
|
.content img[alt*="Benchmark"] { max-width: 680px; }
|
|
9390
9663
|
.content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }
|
|
9664
|
+
.content .ox-api-controls {
|
|
9665
|
+
display: flex;
|
|
9666
|
+
justify-content: flex-end;
|
|
9667
|
+
align-items: center;
|
|
9668
|
+
gap: 0.5rem;
|
|
9669
|
+
margin: 0 0 1rem;
|
|
9670
|
+
}
|
|
9671
|
+
.content .ox-api-controls__button {
|
|
9672
|
+
appearance: none;
|
|
9673
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
|
|
9674
|
+
background: color-mix(in srgb, var(--color-bg-alt) 82%, var(--color-bg));
|
|
9675
|
+
padding: 0.4rem 0.7rem;
|
|
9676
|
+
border-radius: 4px;
|
|
9677
|
+
color: color-mix(in srgb, var(--color-text) 82%, var(--color-text-muted));
|
|
9678
|
+
font-family: var(--font-mono);
|
|
9679
|
+
font-size: 0.78rem;
|
|
9680
|
+
font-weight: 600;
|
|
9681
|
+
line-height: 1.4;
|
|
9682
|
+
cursor: pointer;
|
|
9683
|
+
}
|
|
9684
|
+
.content .ox-api-controls__button:hover {
|
|
9685
|
+
color: var(--color-primary);
|
|
9686
|
+
border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
|
|
9687
|
+
background: color-mix(in srgb, var(--color-bg-alt) 68%, var(--color-primary) 6%);
|
|
9688
|
+
}
|
|
9689
|
+
.content .ox-api-entry,
|
|
9690
|
+
.content .ox-api-module {
|
|
9691
|
+
margin: 0;
|
|
9692
|
+
border: 0;
|
|
9693
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 74%, transparent);
|
|
9694
|
+
border-radius: 0;
|
|
9695
|
+
background: transparent;
|
|
9696
|
+
overflow: visible;
|
|
9697
|
+
}
|
|
9698
|
+
.content .ox-api-entry:last-child,
|
|
9699
|
+
.content .ox-api-module:last-child {
|
|
9700
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border) 74%, transparent);
|
|
9701
|
+
}
|
|
9702
|
+
.content .ox-api-entry summary,
|
|
9703
|
+
.content .ox-api-module summary {
|
|
9704
|
+
list-style: none;
|
|
9705
|
+
cursor: pointer;
|
|
9706
|
+
padding: 1rem 0;
|
|
9707
|
+
position: relative;
|
|
9708
|
+
}
|
|
9709
|
+
.content .ox-api-entry summary::-webkit-details-marker,
|
|
9710
|
+
.content .ox-api-module summary::-webkit-details-marker { display: none; }
|
|
9711
|
+
.content .ox-api-entry summary {
|
|
9712
|
+
display: grid;
|
|
9713
|
+
grid-template-columns: var(--octc-api-kind-width, 6.5rem) minmax(0, 1fr) auto;
|
|
9714
|
+
align-items: start;
|
|
9715
|
+
gap: 0.95rem;
|
|
9716
|
+
}
|
|
9717
|
+
.content .ox-api-entry summary::after,
|
|
9718
|
+
.content .ox-api-module summary::after {
|
|
9719
|
+
content: "+";
|
|
9720
|
+
align-self: center;
|
|
9721
|
+
color: var(--color-text-muted);
|
|
9722
|
+
font-family: var(--font-mono);
|
|
9723
|
+
font-size: 0.95rem;
|
|
9724
|
+
font-weight: 600;
|
|
9725
|
+
line-height: 1;
|
|
9726
|
+
}
|
|
9727
|
+
.content .ox-api-entry[open] summary::after,
|
|
9728
|
+
.content .ox-api-module[open] summary::after {
|
|
9729
|
+
content: "−";
|
|
9730
|
+
color: var(--color-primary);
|
|
9731
|
+
}
|
|
9732
|
+
.content .ox-api-entry[open] summary,
|
|
9733
|
+
.content .ox-api-module[open] summary {
|
|
9734
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
9735
|
+
}
|
|
9736
|
+
.content .ox-api-entry__kind,
|
|
9737
|
+
.content .ox-api-module__kind {
|
|
9738
|
+
display: block;
|
|
9739
|
+
width: var(--octc-api-kind-width, 6.5rem);
|
|
9740
|
+
padding: 0.3rem 0 0;
|
|
9741
|
+
background: transparent;
|
|
9742
|
+
border: 0;
|
|
9743
|
+
font-family: var(--font-mono);
|
|
9744
|
+
font-size: 0.76rem;
|
|
9745
|
+
font-weight: 600;
|
|
9746
|
+
letter-spacing: 0.01em;
|
|
9747
|
+
text-align: left;
|
|
9748
|
+
white-space: nowrap;
|
|
9749
|
+
color: var(--color-text-muted);
|
|
9750
|
+
}
|
|
9751
|
+
.content .ox-api-module__count {
|
|
9752
|
+
display: inline-flex;
|
|
9753
|
+
align-items: center;
|
|
9754
|
+
padding: 0.2rem 0.48rem;
|
|
9755
|
+
border-radius: 4px;
|
|
9756
|
+
background: color-mix(in srgb, var(--color-bg-alt) 84%, var(--color-primary) 8%);
|
|
9757
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
|
|
9758
|
+
color: var(--color-text-muted);
|
|
9759
|
+
font-family: var(--font-mono);
|
|
9760
|
+
font-size: 0.72rem;
|
|
9761
|
+
font-weight: 600;
|
|
9762
|
+
letter-spacing: 0.03em;
|
|
9763
|
+
white-space: nowrap;
|
|
9764
|
+
}
|
|
9765
|
+
.content .ox-api-entry__name {
|
|
9766
|
+
display: block;
|
|
9767
|
+
font-family: var(--font-mono);
|
|
9768
|
+
font-size: 0.95rem;
|
|
9769
|
+
font-weight: 600;
|
|
9770
|
+
line-height: 1.55;
|
|
9771
|
+
}
|
|
9772
|
+
.content .ox-api-entry__signature,
|
|
9773
|
+
.content .ox-api-module__signature {
|
|
9774
|
+
display: block;
|
|
9775
|
+
width: 100%;
|
|
9776
|
+
min-width: 0;
|
|
9777
|
+
font-family: var(--font-mono);
|
|
9778
|
+
font-size: 0.95rem;
|
|
9779
|
+
line-height: 1.55;
|
|
9780
|
+
white-space: nowrap;
|
|
9781
|
+
overflow-x: auto;
|
|
9782
|
+
overflow-y: hidden;
|
|
9783
|
+
-webkit-overflow-scrolling: touch;
|
|
9784
|
+
}
|
|
9785
|
+
.content .ox-api-entry__description {
|
|
9786
|
+
display: block;
|
|
9787
|
+
color: color-mix(in srgb, var(--color-text) 78%, var(--color-text-muted));
|
|
9788
|
+
font-size: 0.9rem;
|
|
9789
|
+
line-height: 1.6;
|
|
9790
|
+
max-width: 72ch;
|
|
9791
|
+
}
|
|
9792
|
+
.content .ox-api-entry__summary-main {
|
|
9793
|
+
min-width: 0;
|
|
9794
|
+
display: flex;
|
|
9795
|
+
flex-direction: column;
|
|
9796
|
+
gap: 0.55rem;
|
|
9797
|
+
}
|
|
9798
|
+
.content .ox-api-entry__name,
|
|
9799
|
+
.content .ox-api-entry__signature,
|
|
9800
|
+
.content .ox-api-module__name,
|
|
9801
|
+
.content .ox-api-module__signature {
|
|
9802
|
+
background: transparent;
|
|
9803
|
+
padding: 0;
|
|
9804
|
+
border-radius: 0;
|
|
9805
|
+
word-break: normal;
|
|
9806
|
+
}
|
|
9807
|
+
.content code.shiki-inline.ox-api-entry__signature--highlighted,
|
|
9808
|
+
.content code.shiki-inline.ox-api-module__signature--highlighted {
|
|
9809
|
+
display: block;
|
|
9810
|
+
width: 100%;
|
|
9811
|
+
max-width: 100%;
|
|
9812
|
+
background: linear-gradient(
|
|
9813
|
+
180deg,
|
|
9814
|
+
var(--color-code-bg-top) 0,
|
|
9815
|
+
var(--color-code-bg) 2.75rem
|
|
9816
|
+
) !important;
|
|
9817
|
+
border: 1px solid var(--color-code-frame-border) !important;
|
|
9818
|
+
padding: 0.55rem 0.7rem !important;
|
|
9819
|
+
border-radius: 4px !important;
|
|
9820
|
+
white-space: nowrap;
|
|
9821
|
+
overflow-x: auto;
|
|
9822
|
+
overflow-y: hidden;
|
|
9823
|
+
-webkit-overflow-scrolling: touch;
|
|
9824
|
+
}
|
|
9825
|
+
.content code.shiki-inline.ox-api-entry__signature--highlighted .line,
|
|
9826
|
+
.content code.shiki-inline.ox-api-module__signature--highlighted .line {
|
|
9827
|
+
display: block;
|
|
9828
|
+
width: max-content;
|
|
9829
|
+
min-width: 100%;
|
|
9830
|
+
}
|
|
9831
|
+
.content .ox-api-entry__body,
|
|
9832
|
+
.content .ox-api-module__body { padding: 0.7rem 0 1.9rem; }
|
|
9833
|
+
.content .ox-api-entry__body {
|
|
9834
|
+
margin-left: calc(var(--octc-api-kind-width, 6.5rem) + 0.95rem);
|
|
9835
|
+
margin-top: 0.7rem;
|
|
9836
|
+
padding: 1.45rem 1rem 2.1rem 1.1rem;
|
|
9837
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
9838
|
+
border-radius: 4px;
|
|
9839
|
+
background: color-mix(in srgb, var(--color-bg-alt) 68%, transparent);
|
|
9840
|
+
}
|
|
9841
|
+
.content .ox-api-entry__body > :first-child { margin-top: 0; }
|
|
9842
|
+
.content .ox-api-entry__body > :last-child { margin-bottom: 0; }
|
|
9843
|
+
.content .ox-api-entry[open] summary {
|
|
9844
|
+
padding-bottom: 0.35rem;
|
|
9845
|
+
}
|
|
9846
|
+
.content .ox-api-entry__section {
|
|
9847
|
+
display: grid;
|
|
9848
|
+
grid-template-columns: 6.5rem minmax(0, 1fr);
|
|
9849
|
+
gap: 0.2rem 1.25rem;
|
|
9850
|
+
align-items: start;
|
|
9851
|
+
margin-top: 1rem;
|
|
9852
|
+
padding-top: 1rem;
|
|
9853
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
9854
|
+
}
|
|
9855
|
+
.content .ox-api-entry__section h4 {
|
|
9856
|
+
margin-top: 0;
|
|
9857
|
+
margin-bottom: 0;
|
|
9858
|
+
padding-top: 0.25rem;
|
|
9859
|
+
font-family: var(--font-mono);
|
|
9860
|
+
font-size: 0.78rem;
|
|
9861
|
+
font-weight: 700;
|
|
9862
|
+
letter-spacing: 0.04em;
|
|
9863
|
+
text-transform: uppercase;
|
|
9864
|
+
color: var(--color-text-muted);
|
|
9865
|
+
}
|
|
9866
|
+
.content .ox-api-entry__section > :not(h4) { min-width: 0; }
|
|
9867
|
+
.content .ox-api-entry__source {
|
|
9868
|
+
margin: 0 0 0.15rem;
|
|
9869
|
+
font-family: var(--font-mono);
|
|
9870
|
+
font-size: 0.78rem;
|
|
9871
|
+
color: var(--color-text-muted);
|
|
9872
|
+
}
|
|
9873
|
+
.content .ox-api-entry__source a {
|
|
9874
|
+
color: inherit;
|
|
9875
|
+
text-decoration-color: color-mix(in srgb, var(--color-text-muted) 38%, transparent);
|
|
9876
|
+
}
|
|
9877
|
+
.content .ox-api-entry__tags,
|
|
9878
|
+
.content .ox-api-module__list {
|
|
9879
|
+
list-style: none;
|
|
9880
|
+
padding-left: 0;
|
|
9881
|
+
margin: 0;
|
|
9882
|
+
}
|
|
9883
|
+
.content .ox-api-entry__tags {
|
|
9884
|
+
display: flex;
|
|
9885
|
+
flex-wrap: wrap;
|
|
9886
|
+
gap: 0.6rem;
|
|
9887
|
+
}
|
|
9888
|
+
.content .ox-api-entry__tags li {
|
|
9889
|
+
display: inline-flex;
|
|
9890
|
+
align-items: center;
|
|
9891
|
+
gap: 0.45rem;
|
|
9892
|
+
padding: 0.4rem 0.55rem;
|
|
9893
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
|
|
9894
|
+
border-radius: 4px;
|
|
9895
|
+
background: color-mix(in srgb, var(--color-bg-alt) 72%, transparent);
|
|
9896
|
+
}
|
|
9897
|
+
.content .ox-api-module__list li {
|
|
9898
|
+
display: grid;
|
|
9899
|
+
grid-template-columns: var(--octc-api-kind-width, 6.5rem) minmax(0, 1fr);
|
|
9900
|
+
align-items: start;
|
|
9901
|
+
gap: 1rem;
|
|
9902
|
+
padding: 0.85rem 0;
|
|
9903
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
|
|
9904
|
+
}
|
|
9905
|
+
.content .ox-api-module__list li:first-child { border-top: none; }
|
|
9906
|
+
.content .ox-api-entry__tag-name,
|
|
9907
|
+
.content .ox-api-module__title { font-weight: 700; }
|
|
9908
|
+
.content .ox-api-entry__tag-name {
|
|
9909
|
+
color: var(--color-primary);
|
|
9910
|
+
font-family: var(--font-mono);
|
|
9911
|
+
font-size: 0.74rem;
|
|
9912
|
+
}
|
|
9913
|
+
.content .ox-api-entry__tag-value {
|
|
9914
|
+
color: var(--color-text);
|
|
9915
|
+
font-size: 0.84rem;
|
|
9916
|
+
line-height: 1.45;
|
|
9917
|
+
}
|
|
9918
|
+
.content .ox-api-module summary {
|
|
9919
|
+
display: grid;
|
|
9920
|
+
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
9921
|
+
align-items: center;
|
|
9922
|
+
gap: 0.9rem;
|
|
9923
|
+
}
|
|
9924
|
+
.content .ox-api-module__body { padding-top: 0.15rem; }
|
|
9925
|
+
.content .ox-api-module__item { min-width: 0; }
|
|
9926
|
+
.content .ox-api-module__link {
|
|
9927
|
+
display: block;
|
|
9928
|
+
text-decoration: none;
|
|
9929
|
+
}
|
|
9930
|
+
.content .ox-api-module__link:hover { text-decoration: none; }
|
|
9931
|
+
.content .ox-api-module__name,
|
|
9932
|
+
.content .ox-api-module__signature {
|
|
9933
|
+
display: block;
|
|
9934
|
+
font-family: var(--font-mono);
|
|
9935
|
+
font-size: 0.91rem;
|
|
9936
|
+
line-height: 1.55;
|
|
9937
|
+
color: var(--color-text);
|
|
9938
|
+
}
|
|
9939
|
+
.content .ox-api-module__summary {
|
|
9940
|
+
display: block;
|
|
9941
|
+
margin-top: 0.45rem;
|
|
9942
|
+
color: color-mix(in srgb, var(--color-text) 76%, var(--color-text-muted));
|
|
9943
|
+
font-size: 0.88rem;
|
|
9944
|
+
line-height: 1.55;
|
|
9945
|
+
}
|
|
9946
|
+
.content .ox-api-entry__section--examples pre {
|
|
9947
|
+
margin: 0;
|
|
9948
|
+
border: 1px solid var(--color-code-frame-border);
|
|
9949
|
+
border-radius: 4px;
|
|
9950
|
+
}
|
|
9951
|
+
.content .ox-api-entry__params {
|
|
9952
|
+
list-style: none;
|
|
9953
|
+
padding: 0;
|
|
9954
|
+
margin: 0;
|
|
9955
|
+
}
|
|
9956
|
+
.content .ox-api-entry__param {
|
|
9957
|
+
padding: 0.8rem 0;
|
|
9958
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
|
|
9959
|
+
}
|
|
9960
|
+
.content .ox-api-entry__param:first-child {
|
|
9961
|
+
padding-top: 0;
|
|
9962
|
+
border-top: 0;
|
|
9963
|
+
}
|
|
9964
|
+
.content .ox-api-entry__param-heading {
|
|
9965
|
+
display: flex;
|
|
9966
|
+
flex-wrap: wrap;
|
|
9967
|
+
align-items: center;
|
|
9968
|
+
gap: 0.5rem;
|
|
9969
|
+
}
|
|
9970
|
+
.content .ox-api-entry__param-name,
|
|
9971
|
+
.content .ox-api-entry__return-type {
|
|
9972
|
+
font-family: var(--font-mono);
|
|
9973
|
+
font-size: 0.84rem;
|
|
9974
|
+
font-weight: 600;
|
|
9975
|
+
color: var(--color-text);
|
|
9976
|
+
background: color-mix(in srgb, var(--color-bg-alt) 84%, transparent);
|
|
9977
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
|
|
9978
|
+
padding: 0.28rem 0.42rem;
|
|
9979
|
+
border-radius: 4px;
|
|
9980
|
+
}
|
|
9981
|
+
.content .ox-api-entry__param-type {
|
|
9982
|
+
font-family: var(--font-mono);
|
|
9983
|
+
font-size: 0.78rem;
|
|
9984
|
+
color: var(--color-code-text);
|
|
9985
|
+
background: color-mix(in srgb, var(--color-code-bg) 96%, #243556);
|
|
9986
|
+
border: 1px solid color-mix(in srgb, var(--color-code-bg) 82%, var(--color-border));
|
|
9987
|
+
padding: 0.26rem 0.42rem;
|
|
9988
|
+
border-radius: 4px;
|
|
9989
|
+
}
|
|
9990
|
+
.content .ox-api-entry__param-description,
|
|
9991
|
+
.content .ox-api-entry__return-description {
|
|
9992
|
+
margin: 0.55rem 0 0;
|
|
9993
|
+
font-size: 0.88rem;
|
|
9994
|
+
line-height: 1.6;
|
|
9995
|
+
color: color-mix(in srgb, var(--color-text) 78%, var(--color-text-muted));
|
|
9996
|
+
}
|
|
9997
|
+
.content .ox-api-entry__return { margin: 0; }
|
|
9391
9998
|
|
|
9392
9999
|
/* Responsive */
|
|
9393
10000
|
@media (max-width: 768px) {
|
|
9394
10001
|
.menu-toggle { display: block; }
|
|
9395
10002
|
.sidebar {
|
|
9396
10003
|
transform: translateX(-100%);
|
|
9397
|
-
transition: transform 0.3s ease;
|
|
9398
10004
|
z-index: 99;
|
|
9399
10005
|
width: 280px;
|
|
9400
10006
|
}
|
|
10007
|
+
.sidebar--entry { display: block; }
|
|
9401
10008
|
.sidebar.open { transform: translateX(0); }
|
|
9402
10009
|
.main { margin-left: 0; padding: 1rem 0.75rem; }
|
|
9403
10010
|
.content { padding: 0 0.25rem; }
|
|
@@ -9414,16 +10021,48 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9414
10021
|
overflow-x: auto;
|
|
9415
10022
|
-webkit-overflow-scrolling: touch;
|
|
9416
10023
|
}
|
|
10024
|
+
.content .ox-api-controls {
|
|
10025
|
+
justify-content: flex-start;
|
|
10026
|
+
gap: 0.75rem;
|
|
10027
|
+
}
|
|
10028
|
+
.content .ox-api-entry__body {
|
|
10029
|
+
margin-left: 0;
|
|
10030
|
+
margin-top: 0.55rem;
|
|
10031
|
+
padding: 1.2rem 0 1.7rem;
|
|
10032
|
+
border-left: 0;
|
|
10033
|
+
border-right: 0;
|
|
10034
|
+
border-bottom: 0;
|
|
10035
|
+
border-radius: 0;
|
|
10036
|
+
background: transparent;
|
|
10037
|
+
}
|
|
10038
|
+
.content .ox-api-entry__section {
|
|
10039
|
+
grid-template-columns: 1fr;
|
|
10040
|
+
gap: 0.5rem;
|
|
10041
|
+
}
|
|
10042
|
+
.content .ox-api-entry__tags li,
|
|
10043
|
+
.content .ox-api-module__list li,
|
|
10044
|
+
.content .ox-api-module summary {
|
|
10045
|
+
grid-template-columns: 1fr;
|
|
10046
|
+
}
|
|
10047
|
+
.content .ox-api-entry__signature { width: 100%; }
|
|
10048
|
+
.content pre.ox-code-block .line {
|
|
10049
|
+
margin: 0 -0.75rem;
|
|
10050
|
+
padding: 0 0.75rem;
|
|
10051
|
+
}
|
|
9417
10052
|
.content code { font-size: 0.8125em; }
|
|
9418
10053
|
.content table {
|
|
9419
10054
|
display: block;
|
|
10055
|
+
width: max-content;
|
|
10056
|
+
min-width: 100%;
|
|
10057
|
+
max-width: calc(100vw - 1.5rem);
|
|
9420
10058
|
overflow-x: auto;
|
|
9421
10059
|
-webkit-overflow-scrolling: touch;
|
|
9422
10060
|
font-size: 0.8125rem;
|
|
9423
|
-
margin: 1rem
|
|
9424
|
-
|
|
10061
|
+
margin: 1rem 0;
|
|
10062
|
+
border-collapse: separate;
|
|
10063
|
+
border-spacing: 0;
|
|
9425
10064
|
}
|
|
9426
|
-
.content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; }
|
|
10065
|
+
.content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; vertical-align: top; }
|
|
9427
10066
|
.content img { margin: 1rem 0; }
|
|
9428
10067
|
.content img[alt*="Logo"] { max-width: 150px; }
|
|
9429
10068
|
.content img[alt*="Architecture"] { max-width: 100%; }
|
|
@@ -9431,12 +10070,13 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9431
10070
|
.content blockquote { padding: 0.5rem 0.75rem; margin: 1rem 0; font-size: 0.9375rem; }
|
|
9432
10071
|
.header { padding: 0 1rem; }
|
|
9433
10072
|
.header-title { font-size: 1rem; }
|
|
9434
|
-
.header-title img { width: 24px; height: 24px; }
|
|
10073
|
+
.header-title:not(.header-title--logo-only) img { width: 24px; height: 24px; }
|
|
10074
|
+
.header-title--logo-only .header-logo { width: 152px; height: auto; }
|
|
9435
10075
|
.overlay {
|
|
9436
10076
|
display: none;
|
|
9437
10077
|
position: fixed;
|
|
9438
10078
|
inset: 0;
|
|
9439
|
-
background:
|
|
10079
|
+
background: transparent;
|
|
9440
10080
|
z-index: 98;
|
|
9441
10081
|
}
|
|
9442
10082
|
.overlay.open { display: block; }
|
|
@@ -9447,7 +10087,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9447
10087
|
.main { padding: 0.75rem 0.5rem; }
|
|
9448
10088
|
.content h1 { font-size: 1.35rem; }
|
|
9449
10089
|
.content pre { font-size: 0.6875rem; padding: 0.625rem; }
|
|
9450
|
-
.content table { font-size: 0.75rem; }
|
|
10090
|
+
.content table { max-width: calc(100vw - 1rem); font-size: 0.75rem; }
|
|
9451
10091
|
.content th, .content td { padding: 0.375rem 0.5rem; }
|
|
9452
10092
|
}
|
|
9453
10093
|
</style>
|
|
@@ -9500,7 +10140,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9500
10140
|
</div>
|
|
9501
10141
|
<div class="overlay"></div>
|
|
9502
10142
|
<div class="layout">
|
|
9503
|
-
<aside class="sidebar">
|
|
10143
|
+
<aside class="sidebar{{#entryPage}} sidebar--entry{{/entryPage}}">
|
|
9504
10144
|
<nav>
|
|
9505
10145
|
{{navigation}}
|
|
9506
10146
|
</nav>
|
|
@@ -9554,6 +10194,22 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9554
10194
|
});
|
|
9555
10195
|
}
|
|
9556
10196
|
|
|
10197
|
+
document.querySelectorAll('.ox-api-controls').forEach((controls) => {
|
|
10198
|
+
const targetSelector = controls.getAttribute('data-ox-api-target');
|
|
10199
|
+
if (!targetSelector) return;
|
|
10200
|
+
|
|
10201
|
+
controls.querySelectorAll('[data-ox-api-toggle]').forEach((button) => {
|
|
10202
|
+
button.addEventListener('click', () => {
|
|
10203
|
+
const shouldOpen = button.getAttribute('data-ox-api-toggle') === 'expand';
|
|
10204
|
+
document.querySelectorAll(targetSelector).forEach((entry) => {
|
|
10205
|
+
if (entry instanceof HTMLDetailsElement) {
|
|
10206
|
+
entry.open = shouldOpen;
|
|
10207
|
+
}
|
|
10208
|
+
});
|
|
10209
|
+
});
|
|
10210
|
+
});
|
|
10211
|
+
});
|
|
10212
|
+
|
|
9557
10213
|
// Search functionality
|
|
9558
10214
|
const searchButton = document.querySelector('.search-button');
|
|
9559
10215
|
const searchOverlay = document.querySelector('.search-modal-overlay');
|
|
@@ -9587,6 +10243,39 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9587
10243
|
}
|
|
9588
10244
|
};
|
|
9589
10245
|
|
|
10246
|
+
const parseScopedQuery = (query) => {
|
|
10247
|
+
const scopes = [];
|
|
10248
|
+
const terms = [];
|
|
10249
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
10250
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
10251
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
10252
|
+
} else {
|
|
10253
|
+
terms.push(part);
|
|
10254
|
+
}
|
|
10255
|
+
}
|
|
10256
|
+
return { text: terms.join(' ').trim(), scopes: [...new Set(scopes)] };
|
|
10257
|
+
};
|
|
10258
|
+
|
|
10259
|
+
const getScopesForDoc = (doc) => {
|
|
10260
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
10261
|
+
const segments = source.split('/').filter(Boolean);
|
|
10262
|
+
if (segments.length <= 1) return [];
|
|
10263
|
+
|
|
10264
|
+
const scopes = [];
|
|
10265
|
+
let current = '';
|
|
10266
|
+
for (const segment of segments.slice(0, -1)) {
|
|
10267
|
+
current = current ? current + '/' + segment : segment;
|
|
10268
|
+
scopes.push(current);
|
|
10269
|
+
}
|
|
10270
|
+
return scopes;
|
|
10271
|
+
};
|
|
10272
|
+
|
|
10273
|
+
const matchesScopes = (doc, scopes) => {
|
|
10274
|
+
if (!scopes.length) return true;
|
|
10275
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
10276
|
+
return scopes.some((scope) => docScopes.has(scope));
|
|
10277
|
+
};
|
|
10278
|
+
|
|
9590
10279
|
// Tokenize query
|
|
9591
10280
|
const tokenize = (text) => {
|
|
9592
10281
|
const tokens = [];
|
|
@@ -9609,27 +10298,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9609
10298
|
|
|
9610
10299
|
// Perform search
|
|
9611
10300
|
const performSearch = async (query) => {
|
|
9612
|
-
if (!query.trim()) {
|
|
9613
|
-
searchResults.innerHTML = '';
|
|
9614
|
-
results = [];
|
|
9615
|
-
return;
|
|
9616
|
-
}
|
|
9617
10301
|
await loadSearchIndex();
|
|
9618
10302
|
if (!searchIndex) {
|
|
9619
10303
|
searchResults.innerHTML = '<div class="search-empty">Search index not available</div>';
|
|
9620
10304
|
return;
|
|
9621
10305
|
}
|
|
9622
10306
|
|
|
9623
|
-
const
|
|
9624
|
-
if (!
|
|
10307
|
+
const parsedQuery = parseScopedQuery(query);
|
|
10308
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
9625
10309
|
searchResults.innerHTML = '';
|
|
9626
10310
|
results = [];
|
|
9627
10311
|
return;
|
|
9628
10312
|
}
|
|
9629
10313
|
|
|
10314
|
+
const tokens = tokenize(parsedQuery.text);
|
|
9630
10315
|
const k1 = 1.2, b = 0.75;
|
|
9631
10316
|
const docScores = new Map();
|
|
9632
10317
|
|
|
10318
|
+
if (!tokens.length) {
|
|
10319
|
+
searchIndex.documents.forEach((doc, docIdx) => {
|
|
10320
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
10321
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
10322
|
+
}
|
|
10323
|
+
});
|
|
10324
|
+
}
|
|
10325
|
+
|
|
9633
10326
|
for (let i = 0; i < tokens.length; i++) {
|
|
9634
10327
|
const token = tokens[i];
|
|
9635
10328
|
const isLast = i === tokens.length - 1;
|
|
@@ -9648,6 +10341,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9648
10341
|
for (const posting of postings) {
|
|
9649
10342
|
const doc = searchIndex.documents[posting.doc_idx];
|
|
9650
10343
|
if (!doc) continue;
|
|
10344
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
9651
10345
|
const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;
|
|
9652
10346
|
const tf = posting.tf;
|
|
9653
10347
|
const docLen = doc.body.length;
|
|
@@ -9666,6 +10360,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9666
10360
|
results = Array.from(docScores.entries())
|
|
9667
10361
|
.map(([docIdx, data]) => {
|
|
9668
10362
|
const doc = searchIndex.documents[docIdx];
|
|
10363
|
+
const scopes = getScopesForDoc(doc);
|
|
9669
10364
|
let snippet = '';
|
|
9670
10365
|
if (doc.body) {
|
|
9671
10366
|
const bodyLower = doc.body.toLowerCase();
|
|
@@ -9674,15 +10369,15 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9674
10369
|
const pos = bodyLower.indexOf(match);
|
|
9675
10370
|
if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;
|
|
9676
10371
|
}
|
|
9677
|
-
const start = Math.max(0, firstPos - 50);
|
|
10372
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
9678
10373
|
const end = Math.min(doc.body.length, start + 150);
|
|
9679
10374
|
snippet = doc.body.slice(start, end);
|
|
9680
10375
|
if (start > 0) snippet = '...' + snippet;
|
|
9681
10376
|
if (end < doc.body.length) snippet += '...';
|
|
9682
10377
|
}
|
|
9683
|
-
return { ...doc, score: data.score, snippet };
|
|
10378
|
+
return { ...doc, score: data.score, scopes, snippet };
|
|
9684
10379
|
})
|
|
9685
|
-
.sort((a, b) => b.score - a.score)
|
|
10380
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
9686
10381
|
.slice(0, 10);
|
|
9687
10382
|
|
|
9688
10383
|
selectedIndex = 0;
|
|
@@ -9696,7 +10391,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9696
10391
|
}
|
|
9697
10392
|
searchResults.innerHTML = results.map((r, i) =>
|
|
9698
10393
|
'<a href="' + r.url + '" class="search-result' + (i === selectedIndex ? ' selected' : '') + '">' +
|
|
9699
|
-
'<div class="search-result-title">' + r.title + '</div>' +
|
|
10394
|
+
'<div class="search-result-title">' + r.title + (r.scopes?.length ? '<span class="search-result-scope">@' + r.scopes[0] + '</span>' : '') + '</div>' +
|
|
9700
10395
|
(r.snippet ? '<div class="search-result-snippet">' + r.snippet + '</div>' : '') +
|
|
9701
10396
|
'</a>'
|
|
9702
10397
|
).join('');
|
|
@@ -9827,7 +10522,7 @@ function generateBareHtmlPage(content, title) {
|
|
|
9827
10522
|
* Generates HTML page with navigation using Rust NAPI bindings.
|
|
9828
10523
|
*/
|
|
9829
10524
|
async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, theme) {
|
|
9830
|
-
const mod = await
|
|
10525
|
+
const mod = await require_mermaid.importNapiModule();
|
|
9831
10526
|
const tocForRust = pageData.toc.map((entry) => ({
|
|
9832
10527
|
depth: entry.depth,
|
|
9833
10528
|
text: entry.text,
|
|
@@ -9847,8 +10542,14 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
|
|
|
9847
10542
|
name: pageData.entryPage.hero.name,
|
|
9848
10543
|
text: pageData.entryPage.hero.text,
|
|
9849
10544
|
tagline: pageData.entryPage.hero.tagline,
|
|
10545
|
+
notice: pageData.entryPage.hero.notice ? {
|
|
10546
|
+
title: pageData.entryPage.hero.notice.title,
|
|
10547
|
+
body: pageData.entryPage.hero.notice.body
|
|
10548
|
+
} : void 0,
|
|
9850
10549
|
image: pageData.entryPage.hero.image ? {
|
|
9851
10550
|
src: pageData.entryPage.hero.image.src,
|
|
10551
|
+
lightSrc: pageData.entryPage.hero.image.lightSrc,
|
|
10552
|
+
darkSrc: pageData.entryPage.hero.image.darkSrc,
|
|
9852
10553
|
alt: pageData.entryPage.hero.image.alt,
|
|
9853
10554
|
width: pageData.entryPage.hero.image.width,
|
|
9854
10555
|
height: pageData.entryPage.hero.image.height
|
|
@@ -9930,7 +10631,7 @@ function createSharedAssetChunk(type, label, content, outDir, base) {
|
|
|
9930
10631
|
const hash = createContentHash(content);
|
|
9931
10632
|
const fileName = `ox-content-${sanitizeChunkLabel(label)}-${hash}.${type}`;
|
|
9932
10633
|
return {
|
|
9933
|
-
outputPath: path
|
|
10634
|
+
outputPath: path.join(outDir, "assets", fileName),
|
|
9934
10635
|
publicPath: toPublicAssetPath(base, fileName),
|
|
9935
10636
|
content
|
|
9936
10637
|
};
|
|
@@ -10020,7 +10721,7 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10020
10721
|
});
|
|
10021
10722
|
const chunks = [...cssChunks.values(), ...jsChunks.values()];
|
|
10022
10723
|
await Promise.all(chunks.map(async (chunk) => {
|
|
10023
|
-
await fs_promises.mkdir(path
|
|
10724
|
+
await fs_promises.mkdir(path.dirname(chunk.outputPath), { recursive: true });
|
|
10024
10725
|
await fs_promises.writeFile(chunk.outputPath, chunk.content, "utf-8");
|
|
10025
10726
|
}));
|
|
10026
10727
|
return {
|
|
@@ -10032,16 +10733,16 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10032
10733
|
* Converts a markdown file path to its corresponding HTML output path.
|
|
10033
10734
|
*/
|
|
10034
10735
|
function getOutputPath(inputPath, srcDir, outDir, extension) {
|
|
10035
|
-
const baseName = path
|
|
10036
|
-
if (baseName.endsWith(`index${extension}`)) return path
|
|
10736
|
+
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
|
|
10737
|
+
if (baseName.endsWith(`index${extension}`)) return path.join(outDir, baseName);
|
|
10037
10738
|
const dirName = baseName.replace(new RegExp(`\\${extension}$`), "");
|
|
10038
|
-
return path
|
|
10739
|
+
return path.join(outDir, dirName, `index${extension}`);
|
|
10039
10740
|
}
|
|
10040
10741
|
/**
|
|
10041
10742
|
* Converts a markdown file path to a relative URL path.
|
|
10042
10743
|
*/
|
|
10043
10744
|
function getUrlPath$1(inputPath, srcDir) {
|
|
10044
|
-
const baseName = path
|
|
10745
|
+
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10045
10746
|
if (baseName === "index" || baseName.endsWith("/index")) return baseName.replace(/\/?index$/, "") || "/";
|
|
10046
10747
|
return baseName;
|
|
10047
10748
|
}
|
|
@@ -10057,12 +10758,12 @@ function getHref(inputPath, srcDir, base, extension) {
|
|
|
10057
10758
|
* Gets the OG image output path for a given markdown file.
|
|
10058
10759
|
*/
|
|
10059
10760
|
function getOgImagePath(inputPath, srcDir, outDir) {
|
|
10060
|
-
const baseName = path
|
|
10761
|
+
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10061
10762
|
if (baseName === "index" || baseName.endsWith("/index")) {
|
|
10062
10763
|
const dirPath = baseName.replace(/\/?index$/, "") || "";
|
|
10063
|
-
return path
|
|
10764
|
+
return path.join(outDir, dirPath, "og-image.png");
|
|
10064
10765
|
}
|
|
10065
|
-
return path
|
|
10766
|
+
return path.join(outDir, baseName, "og-image.png");
|
|
10066
10767
|
}
|
|
10067
10768
|
/**
|
|
10068
10769
|
* Gets the OG image URL for use in meta tags.
|
|
@@ -10080,9 +10781,9 @@ function getOgImageUrl(inputPath, srcDir, base, siteUrl) {
|
|
|
10080
10781
|
* Gets display title from file path.
|
|
10081
10782
|
*/
|
|
10082
10783
|
function getDisplayTitle(filePath) {
|
|
10083
|
-
const fileName = path
|
|
10784
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
|
10084
10785
|
if (fileName === "index") {
|
|
10085
|
-
const dirName = path
|
|
10786
|
+
const dirName = path.basename(path.dirname(filePath));
|
|
10086
10787
|
if (dirName && dirName !== ".") return formatTitle(dirName);
|
|
10087
10788
|
return "Home";
|
|
10088
10789
|
}
|
|
@@ -10098,7 +10799,7 @@ function formatTitle(name) {
|
|
|
10098
10799
|
* Collects all markdown files from the source directory.
|
|
10099
10800
|
*/
|
|
10100
10801
|
async function collectMarkdownFiles$1(srcDir) {
|
|
10101
|
-
return (await (0, glob.glob)(path
|
|
10802
|
+
return (await (0, glob.glob)(path.join(srcDir, "**/*.{md,markdown}"), {
|
|
10102
10803
|
nodir: true,
|
|
10103
10804
|
ignore: [
|
|
10104
10805
|
"**/node_modules/**",
|
|
@@ -10119,7 +10820,7 @@ function buildNavItems(markdownFiles, srcDir, base, extension) {
|
|
|
10119
10820
|
"api"
|
|
10120
10821
|
];
|
|
10121
10822
|
for (const file of markdownFiles) {
|
|
10122
|
-
const parts = path
|
|
10823
|
+
const parts = path.relative(srcDir, file).split(path.sep);
|
|
10123
10824
|
let groupKey = "";
|
|
10124
10825
|
if (parts.length > 1) groupKey = parts[0];
|
|
10125
10826
|
if (!groups.has(groupKey)) groups.set(groupKey, []);
|
|
@@ -10168,8 +10869,8 @@ async function buildSsg(options, root) {
|
|
|
10168
10869
|
files: [],
|
|
10169
10870
|
errors: []
|
|
10170
10871
|
};
|
|
10171
|
-
const srcDir = path
|
|
10172
|
-
const outDir = path
|
|
10872
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10873
|
+
const outDir = path.resolve(root, options.outDir);
|
|
10173
10874
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10174
10875
|
const generatedFiles = [];
|
|
10175
10876
|
const generatedPages = [];
|
|
@@ -10184,7 +10885,7 @@ async function buildSsg(options, root) {
|
|
|
10184
10885
|
const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);
|
|
10185
10886
|
let siteName = ssgOptions.siteName ?? "Documentation";
|
|
10186
10887
|
if (!ssgOptions.siteName) try {
|
|
10187
|
-
const pkgPath = path
|
|
10888
|
+
const pkgPath = path.join(root, "package.json");
|
|
10188
10889
|
const pkg = JSON.parse(await fs_promises.readFile(pkgPath, "utf-8"));
|
|
10189
10890
|
if (pkg.name) siteName = formatTitle(pkg.name);
|
|
10190
10891
|
} catch {}
|
|
@@ -10298,7 +10999,7 @@ async function buildSsg(options, root) {
|
|
|
10298
10999
|
const optimizedOutput = await externalizeSharedPageAssets(generatedPages, outDir, base);
|
|
10299
11000
|
generatedFiles.push(...optimizedOutput.assets);
|
|
10300
11001
|
for (const page of optimizedOutput.pages) {
|
|
10301
|
-
await fs_promises.mkdir(path
|
|
11002
|
+
await fs_promises.mkdir(path.dirname(page.outputPath), { recursive: true });
|
|
10302
11003
|
await fs_promises.writeFile(page.outputPath, page.html, "utf-8");
|
|
10303
11004
|
generatedFiles.push(page.outputPath);
|
|
10304
11005
|
}
|
|
@@ -10307,7 +11008,6 @@ async function buildSsg(options, root) {
|
|
|
10307
11008
|
errors
|
|
10308
11009
|
};
|
|
10309
11010
|
}
|
|
10310
|
-
|
|
10311
11011
|
//#endregion
|
|
10312
11012
|
//#region src/search.ts
|
|
10313
11013
|
/**
|
|
@@ -10318,7 +11018,7 @@ async function buildSsg(options, root) {
|
|
|
10318
11018
|
let oxContent$1 = null;
|
|
10319
11019
|
async function getOxContent() {
|
|
10320
11020
|
if (!oxContent$1) try {
|
|
10321
|
-
oxContent$1 = await
|
|
11021
|
+
oxContent$1 = await require_mermaid.importNapiModule();
|
|
10322
11022
|
} catch {
|
|
10323
11023
|
console.warn("[ox-content] Native bindings not available, search disabled");
|
|
10324
11024
|
return null;
|
|
@@ -10354,7 +11054,7 @@ async function collectMarkdownFiles(dir) {
|
|
|
10354
11054
|
try {
|
|
10355
11055
|
const entries = await fs_promises.readdir(currentDir, { withFileTypes: true });
|
|
10356
11056
|
for (const entry of entries) {
|
|
10357
|
-
const fullPath = path
|
|
11057
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
10358
11058
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") await walk(fullPath);
|
|
10359
11059
|
else if (entry.isFile() && entry.name.endsWith(".md")) files.push(fullPath);
|
|
10360
11060
|
}
|
|
@@ -10379,7 +11079,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10379
11079
|
const documents = [];
|
|
10380
11080
|
for (const file of files) try {
|
|
10381
11081
|
const content = await fs_promises.readFile(file, "utf-8");
|
|
10382
|
-
const relativePath = path
|
|
11082
|
+
const relativePath = path.relative(srcDir, file);
|
|
10383
11083
|
const url = base + relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10384
11084
|
const id = relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10385
11085
|
const extractSearchContent = napi.extractSearchContent;
|
|
@@ -10408,7 +11108,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10408
11108
|
* Writes the search index to a file.
|
|
10409
11109
|
*/
|
|
10410
11110
|
async function writeSearchIndex(indexJson, outDir) {
|
|
10411
|
-
const indexPath = path
|
|
11111
|
+
const indexPath = path.join(outDir, "search-index.json");
|
|
10412
11112
|
await fs_promises.mkdir(outDir, { recursive: true });
|
|
10413
11113
|
await fs_promises.writeFile(indexPath, indexJson, "utf-8");
|
|
10414
11114
|
}
|
|
@@ -10424,6 +11124,51 @@ const searchOptions = ${JSON.stringify(options)};
|
|
|
10424
11124
|
let searchIndex = null;
|
|
10425
11125
|
let indexPromise = null;
|
|
10426
11126
|
|
|
11127
|
+
function parseScopedQuery(query) {
|
|
11128
|
+
const scopes = [];
|
|
11129
|
+
const terms = [];
|
|
11130
|
+
|
|
11131
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
11132
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
11133
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
11134
|
+
} else {
|
|
11135
|
+
terms.push(part);
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
|
|
11139
|
+
return {
|
|
11140
|
+
text: terms.join(' ').trim(),
|
|
11141
|
+
scopes: [...new Set(scopes)],
|
|
11142
|
+
};
|
|
11143
|
+
}
|
|
11144
|
+
|
|
11145
|
+
function getScopesForDoc(doc) {
|
|
11146
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
11147
|
+
const segments = source.split('/').filter(Boolean);
|
|
11148
|
+
|
|
11149
|
+
if (segments.length <= 1) {
|
|
11150
|
+
return [];
|
|
11151
|
+
}
|
|
11152
|
+
|
|
11153
|
+
const scopes = [];
|
|
11154
|
+
let current = '';
|
|
11155
|
+
for (const segment of segments.slice(0, -1)) {
|
|
11156
|
+
current = current ? current + '/' + segment : segment;
|
|
11157
|
+
scopes.push(current);
|
|
11158
|
+
}
|
|
11159
|
+
|
|
11160
|
+
return scopes;
|
|
11161
|
+
}
|
|
11162
|
+
|
|
11163
|
+
function matchesScopes(doc, scopes) {
|
|
11164
|
+
if (!scopes.length) {
|
|
11165
|
+
return true;
|
|
11166
|
+
}
|
|
11167
|
+
|
|
11168
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
11169
|
+
return scopes.some(scope => docScopes.has(scope));
|
|
11170
|
+
}
|
|
11171
|
+
|
|
10427
11172
|
// Tokenizer for queries
|
|
10428
11173
|
function tokenizeQuery(text) {
|
|
10429
11174
|
const tokens = [];
|
|
@@ -10491,22 +11236,32 @@ async function loadIndex() {
|
|
|
10491
11236
|
export async function search(query, options = {}) {
|
|
10492
11237
|
const index = await loadIndex();
|
|
10493
11238
|
|
|
10494
|
-
if (!index
|
|
11239
|
+
if (!index) {
|
|
10495
11240
|
return [];
|
|
10496
11241
|
}
|
|
10497
11242
|
|
|
10498
|
-
const
|
|
10499
|
-
const prefix = options.prefix ?? searchOptions.prefix;
|
|
10500
|
-
const tokens = tokenizeQuery(query);
|
|
11243
|
+
const parsedQuery = parseScopedQuery(query);
|
|
10501
11244
|
|
|
10502
|
-
if (
|
|
11245
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
10503
11246
|
return [];
|
|
10504
11247
|
}
|
|
10505
11248
|
|
|
11249
|
+
const limit = options.limit ?? searchOptions.limit;
|
|
11250
|
+
const prefix = options.prefix ?? searchOptions.prefix;
|
|
11251
|
+
const tokens = tokenizeQuery(parsedQuery.text);
|
|
11252
|
+
|
|
10506
11253
|
const k1 = 1.2;
|
|
10507
11254
|
const b = 0.75;
|
|
10508
11255
|
const docScores = new Map();
|
|
10509
11256
|
|
|
11257
|
+
if (tokens.length === 0) {
|
|
11258
|
+
index.documents.forEach((doc, docIdx) => {
|
|
11259
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
11260
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
11261
|
+
}
|
|
11262
|
+
});
|
|
11263
|
+
}
|
|
11264
|
+
|
|
10510
11265
|
for (let i = 0; i < tokens.length; i++) {
|
|
10511
11266
|
const token = tokens[i];
|
|
10512
11267
|
const isLast = i === tokens.length - 1;
|
|
@@ -10527,6 +11282,7 @@ export async function search(query, options = {}) {
|
|
|
10527
11282
|
for (const posting of postings) {
|
|
10528
11283
|
const doc = index.documents[posting.doc_idx];
|
|
10529
11284
|
if (!doc) continue;
|
|
11285
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
10530
11286
|
|
|
10531
11287
|
const docLen = doc.body.length;
|
|
10532
11288
|
const tf = posting.tf;
|
|
@@ -10549,6 +11305,7 @@ export async function search(query, options = {}) {
|
|
|
10549
11305
|
.map(([docIdx, data]) => {
|
|
10550
11306
|
const doc = index.documents[docIdx];
|
|
10551
11307
|
const matches = Array.from(data.matches);
|
|
11308
|
+
const scopes = getScopesForDoc(doc);
|
|
10552
11309
|
|
|
10553
11310
|
// Generate snippet
|
|
10554
11311
|
let snippet = '';
|
|
@@ -10562,7 +11319,7 @@ export async function search(query, options = {}) {
|
|
|
10562
11319
|
}
|
|
10563
11320
|
}
|
|
10564
11321
|
|
|
10565
|
-
const start = Math.max(0, firstPos - 50);
|
|
11322
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
10566
11323
|
const end = Math.min(doc.body.length, start + 150);
|
|
10567
11324
|
snippet = doc.body.slice(start, end);
|
|
10568
11325
|
if (start > 0) snippet = '...' + snippet;
|
|
@@ -10576,9 +11333,10 @@ export async function search(query, options = {}) {
|
|
|
10576
11333
|
score: data.score,
|
|
10577
11334
|
matches,
|
|
10578
11335
|
snippet,
|
|
11336
|
+
scopes,
|
|
10579
11337
|
};
|
|
10580
11338
|
})
|
|
10581
|
-
.sort((a, b) => b.score - a.score)
|
|
11339
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
10582
11340
|
.slice(0, limit);
|
|
10583
11341
|
|
|
10584
11342
|
return results;
|
|
@@ -10588,7 +11346,6 @@ export { searchOptions };
|
|
|
10588
11346
|
export default { search, searchOptions, loadIndex };
|
|
10589
11347
|
`;
|
|
10590
11348
|
}
|
|
10591
|
-
|
|
10592
11349
|
//#endregion
|
|
10593
11350
|
//#region src/dev-server.ts
|
|
10594
11351
|
/**
|
|
@@ -10653,12 +11410,12 @@ async function resolveMarkdownFile(url, srcDir) {
|
|
|
10653
11410
|
let relativePath;
|
|
10654
11411
|
if (pathname === "/") relativePath = "index.md";
|
|
10655
11412
|
else relativePath = pathname.slice(1) + ".md";
|
|
10656
|
-
const filePath = path
|
|
11413
|
+
const filePath = path.join(srcDir, relativePath);
|
|
10657
11414
|
try {
|
|
10658
11415
|
await fs_promises.access(filePath);
|
|
10659
11416
|
return filePath;
|
|
10660
11417
|
} catch {
|
|
10661
|
-
const indexPath = path
|
|
11418
|
+
const indexPath = path.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
|
|
10662
11419
|
try {
|
|
10663
11420
|
await fs_promises.access(indexPath);
|
|
10664
11421
|
return indexPath;
|
|
@@ -10702,7 +11459,7 @@ function invalidatePageCache(cache, filePath) {
|
|
|
10702
11459
|
async function resolveSiteName(options, root) {
|
|
10703
11460
|
if (options.ssg.siteName) return options.ssg.siteName;
|
|
10704
11461
|
try {
|
|
10705
|
-
const pkgPath = path
|
|
11462
|
+
const pkgPath = path.join(root, "package.json");
|
|
10706
11463
|
const pkg = JSON.parse(await fs_promises.readFile(pkgPath, "utf-8"));
|
|
10707
11464
|
if (pkg.name) return formatTitle(pkg.name);
|
|
10708
11465
|
} catch {}
|
|
@@ -10712,7 +11469,7 @@ async function resolveSiteName(options, root) {
|
|
|
10712
11469
|
* Render a single markdown page to full HTML.
|
|
10713
11470
|
*/
|
|
10714
11471
|
async function renderPage$1(filePath, options, navGroups, siteName, base, root) {
|
|
10715
|
-
const srcDir = path
|
|
11472
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10716
11473
|
require_tabs.resetTabGroupCounter();
|
|
10717
11474
|
resetIslandCounter();
|
|
10718
11475
|
const result = await transformMarkdown(await fs_promises.readFile(filePath, "utf-8"), filePath, options, {
|
|
@@ -10757,7 +11514,7 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root)
|
|
|
10757
11514
|
* Create the dev server middleware for SSG page serving.
|
|
10758
11515
|
*/
|
|
10759
11516
|
function createDevServerMiddleware(options, root, cache) {
|
|
10760
|
-
const srcDir = path
|
|
11517
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10761
11518
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10762
11519
|
return async (req, res, next) => {
|
|
10763
11520
|
const url = req.url;
|
|
@@ -10789,7 +11546,6 @@ function createDevServerMiddleware(options, root, cache) {
|
|
|
10789
11546
|
}
|
|
10790
11547
|
};
|
|
10791
11548
|
}
|
|
10792
|
-
|
|
10793
11549
|
//#endregion
|
|
10794
11550
|
//#region src/og-viewer.ts
|
|
10795
11551
|
/**
|
|
@@ -10823,7 +11579,7 @@ function extractTitle(content, frontmatter) {
|
|
|
10823
11579
|
return match ? match[1].trim() : "";
|
|
10824
11580
|
}
|
|
10825
11581
|
function getUrlPath(filePath, srcDir) {
|
|
10826
|
-
let rel = path
|
|
11582
|
+
let rel = path.relative(srcDir, filePath).replace(/\\/g, "/");
|
|
10827
11583
|
rel = rel.replace(/\.md$/, "");
|
|
10828
11584
|
if (rel === "index") return "/";
|
|
10829
11585
|
if (rel.endsWith("/index")) rel = rel.slice(0, -6);
|
|
@@ -10863,7 +11619,7 @@ function validatePage(page, options) {
|
|
|
10863
11619
|
return warnings;
|
|
10864
11620
|
}
|
|
10865
11621
|
async function collectPages(options, root) {
|
|
10866
|
-
const srcDir = path
|
|
11622
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10867
11623
|
const files = await (0, glob.glob)("**/*.md", {
|
|
10868
11624
|
cwd: srcDir,
|
|
10869
11625
|
absolute: true
|
|
@@ -10881,7 +11637,7 @@ async function collectPages(options, root) {
|
|
|
10881
11637
|
const urlPath = getUrlPath(file, srcDir);
|
|
10882
11638
|
const ogImageUrl = computeOgImageUrl(urlPath, options.base, options.ssg.siteUrl, generateOgImage, options.ssg.ogImage);
|
|
10883
11639
|
const page = {
|
|
10884
|
-
path: path
|
|
11640
|
+
path: path.relative(srcDir, file),
|
|
10885
11641
|
urlPath,
|
|
10886
11642
|
title,
|
|
10887
11643
|
description,
|
|
@@ -10908,43 +11664,41 @@ function renderViewerHtml(pages, options) {
|
|
|
10908
11664
|
<style>
|
|
10909
11665
|
:root {
|
|
10910
11666
|
--bg: #ffffff;
|
|
10911
|
-
--bg-card: #
|
|
11667
|
+
--bg-card: #f5f7fb;
|
|
10912
11668
|
--bg-preview: #ffffff;
|
|
10913
|
-
--text: #
|
|
10914
|
-
--text-muted: #
|
|
10915
|
-
--border: #
|
|
10916
|
-
--accent: #
|
|
10917
|
-
--accent-light: #
|
|
11669
|
+
--text: #131a30;
|
|
11670
|
+
--text-muted: #4f607b;
|
|
11671
|
+
--border: #d2dbea;
|
|
11672
|
+
--accent: #4f6fae;
|
|
11673
|
+
--accent-light: #eef2fa;
|
|
10918
11674
|
--error: #dc2626;
|
|
10919
11675
|
--error-bg: #fef2f2;
|
|
10920
11676
|
--warning: #d97706;
|
|
10921
11677
|
--warning-bg: #fffbeb;
|
|
10922
11678
|
--success: #16a34a;
|
|
10923
|
-
--tag-bg: #
|
|
10924
|
-
--
|
|
10925
|
-
--radius: 8px;
|
|
11679
|
+
--tag-bg: #ecf3ff;
|
|
11680
|
+
--radius: 16px;
|
|
10926
11681
|
}
|
|
10927
11682
|
@media (prefers-color-scheme: dark) {
|
|
10928
11683
|
:root {
|
|
10929
|
-
--bg: #
|
|
10930
|
-
--bg-card: #
|
|
10931
|
-
--bg-preview: #
|
|
10932
|
-
--text: #
|
|
10933
|
-
--text-muted: #
|
|
10934
|
-
--border: #
|
|
10935
|
-
--accent: #
|
|
10936
|
-
--accent-light: #
|
|
11684
|
+
--bg: #060816;
|
|
11685
|
+
--bg-card: #0d1528;
|
|
11686
|
+
--bg-preview: #10172d;
|
|
11687
|
+
--text: #ebf2ff;
|
|
11688
|
+
--text-muted: #8ea0bf;
|
|
11689
|
+
--border: #223252;
|
|
11690
|
+
--accent: #86a4da;
|
|
11691
|
+
--accent-light: #151730;
|
|
10937
11692
|
--error: #f87171;
|
|
10938
11693
|
--error-bg: #450a0a;
|
|
10939
11694
|
--warning: #fbbf24;
|
|
10940
11695
|
--warning-bg: #451a03;
|
|
10941
11696
|
--success: #4ade80;
|
|
10942
|
-
--tag-bg: #
|
|
10943
|
-
--shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
11697
|
+
--tag-bg: #131b33;
|
|
10944
11698
|
}
|
|
10945
11699
|
}
|
|
10946
11700
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
10947
|
-
body { font-family:
|
|
11701
|
+
body { font-family: 'IBM Plex Sans', 'Avenir Next', 'Segoe UI', system-ui, sans-serif; background: radial-gradient(circle at top left, rgba(79,111,174,0.10), transparent 24%), radial-gradient(circle at 85% 14%, rgba(145,237,233,0.08), transparent 22%), var(--bg); color: var(--text); }
|
|
10948
11702
|
.header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
|
|
10949
11703
|
.header svg { width: 28px; height: 28px; color: var(--accent); }
|
|
10950
11704
|
.header h1 { font-size: 18px; font-weight: 600; }
|
|
@@ -10965,7 +11719,7 @@ function renderViewerHtml(pages, options) {
|
|
|
10965
11719
|
.search-input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 13px; flex: 1; min-width: 200px; }
|
|
10966
11720
|
.search-input::placeholder { color: var(--text-muted); }
|
|
10967
11721
|
.container { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1200px; margin: 0 auto; }
|
|
10968
|
-
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card);
|
|
11722
|
+
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
|
|
10969
11723
|
.card-header { padding: 16px; border-bottom: 1px solid var(--border); }
|
|
10970
11724
|
.card-path { font-size: 12px; color: var(--text-muted); font-family: monospace; margin-bottom: 4px; }
|
|
10971
11725
|
.card-title { font-size: 16px; font-weight: 600; }
|
|
@@ -11136,7 +11890,6 @@ function createOgViewerPlugin(options) {
|
|
|
11136
11890
|
}
|
|
11137
11891
|
};
|
|
11138
11892
|
}
|
|
11139
|
-
|
|
11140
11893
|
//#endregion
|
|
11141
11894
|
//#region src/i18n.ts
|
|
11142
11895
|
/**
|
|
@@ -11197,13 +11950,13 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11197
11950
|
},
|
|
11198
11951
|
async buildStart() {
|
|
11199
11952
|
if (!i18nOptions || !i18nOptions.check) return;
|
|
11200
|
-
const dictDir = path
|
|
11953
|
+
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11201
11954
|
if (!fs.existsSync(dictDir)) {
|
|
11202
11955
|
console.warn(`[ox-content:i18n] Dictionary directory not found: ${dictDir}`);
|
|
11203
11956
|
return;
|
|
11204
11957
|
}
|
|
11205
11958
|
try {
|
|
11206
|
-
const { loadDictionaries, checkI18n, extractTranslationKeys } = await
|
|
11959
|
+
const { loadDictionaries, checkI18n, extractTranslationKeys } = await require_mermaid.importNapiModule();
|
|
11207
11960
|
const loadResult = loadDictionaries(dictDir);
|
|
11208
11961
|
if (loadResult.errors.length > 0) {
|
|
11209
11962
|
for (const error of loadResult.errors) console.warn(`[ox-content:i18n] ${error}`);
|
|
@@ -11219,7 +11972,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11219
11972
|
},
|
|
11220
11973
|
configureServer(server) {
|
|
11221
11974
|
if (!i18nOptions) return;
|
|
11222
|
-
const dictDir = path
|
|
11975
|
+
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11223
11976
|
if (fs.existsSync(dictDir)) {
|
|
11224
11977
|
server.watcher.add(dictDir);
|
|
11225
11978
|
server.watcher.on("change", (filePath) => {
|
|
@@ -11246,7 +11999,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11246
11999
|
* Generates the virtual module for i18n configuration.
|
|
11247
12000
|
*/
|
|
11248
12001
|
function generateI18nModule(options, root) {
|
|
11249
|
-
const dictDir = path
|
|
12002
|
+
const dictDir = path.resolve(root, options.dir);
|
|
11250
12003
|
const localesJson = JSON.stringify(options.locales);
|
|
11251
12004
|
const defaultLocale = JSON.stringify(options.defaultLocale);
|
|
11252
12005
|
let dictionariesCode = "{}";
|
|
@@ -11329,15 +12082,15 @@ function flattenObject(obj, prefix, result) {
|
|
|
11329
12082
|
function loadDictionariesFallback(options, dictDir) {
|
|
11330
12083
|
const dictData = {};
|
|
11331
12084
|
for (const locale of options.locales) {
|
|
11332
|
-
const localeDir = path
|
|
12085
|
+
const localeDir = path.join(dictDir, locale.code);
|
|
11333
12086
|
if (!fs.existsSync(localeDir)) continue;
|
|
11334
12087
|
const files = fs.readdirSync(localeDir);
|
|
11335
12088
|
const localeDict = {};
|
|
11336
12089
|
for (const file of files) {
|
|
11337
12090
|
if (!file.endsWith(".json")) continue;
|
|
11338
|
-
const filePath = path
|
|
12091
|
+
const filePath = path.join(localeDir, file);
|
|
11339
12092
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
11340
|
-
const namespace = path
|
|
12093
|
+
const namespace = path.basename(file, ".json");
|
|
11341
12094
|
try {
|
|
11342
12095
|
flattenObject(JSON.parse(content), namespace, localeDict);
|
|
11343
12096
|
} catch {}
|
|
@@ -11350,13 +12103,13 @@ function loadDictionariesFallback(options, dictDir) {
|
|
|
11350
12103
|
* Collects translation keys from source files using NAPI extractTranslationKeys.
|
|
11351
12104
|
*/
|
|
11352
12105
|
function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
11353
|
-
const srcDir = path
|
|
12106
|
+
const srcDir = path.resolve(root, "src");
|
|
11354
12107
|
const keys = /* @__PURE__ */ new Set();
|
|
11355
12108
|
if (fs.existsSync(srcDir)) walkDir(srcDir, /\.(ts|tsx|js|jsx)$/, (filePath) => {
|
|
11356
12109
|
const usages = extractTranslationKeys(fs.readFileSync(filePath, "utf-8"), filePath, options.functionNames);
|
|
11357
12110
|
for (const usage of usages) keys.add(usage.key);
|
|
11358
12111
|
});
|
|
11359
|
-
const contentDir = path
|
|
12112
|
+
const contentDir = path.resolve(root, "content");
|
|
11360
12113
|
if (fs.existsSync(contentDir)) {
|
|
11361
12114
|
const tPattern = /\{\{t\(['"]([^'"]+)['"]\)\}\}/g;
|
|
11362
12115
|
walkDir(contentDir, /\.(md|mdx)$/, (filePath) => {
|
|
@@ -11374,14 +12127,13 @@ function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
|
11374
12127
|
function walkDir(dir, pattern, callback) {
|
|
11375
12128
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
11376
12129
|
for (const entry of entries) {
|
|
11377
|
-
const fullPath = path
|
|
12130
|
+
const fullPath = path.join(dir, entry.name);
|
|
11378
12131
|
if (entry.isDirectory()) {
|
|
11379
12132
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
11380
12133
|
walkDir(fullPath, pattern, callback);
|
|
11381
12134
|
} else if (pattern.test(entry.name)) callback(fullPath);
|
|
11382
12135
|
}
|
|
11383
12136
|
}
|
|
11384
|
-
|
|
11385
12137
|
//#endregion
|
|
11386
12138
|
//#region src/jsx-runtime.ts
|
|
11387
12139
|
/**
|
|
@@ -11571,7 +12323,6 @@ function when(condition, content) {
|
|
|
11571
12323
|
function each(items, render) {
|
|
11572
12324
|
return { __html: items.map((item, i) => render(item, i).__html).join("") };
|
|
11573
12325
|
}
|
|
11574
|
-
|
|
11575
12326
|
//#endregion
|
|
11576
12327
|
//#region src/page-context.ts
|
|
11577
12328
|
var page_context_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
@@ -11762,7 +12513,6 @@ var currentContext;
|
|
|
11762
12513
|
var init_page_context = require_chunk.__esmMin((() => {
|
|
11763
12514
|
currentContext = null;
|
|
11764
12515
|
}));
|
|
11765
|
-
|
|
11766
12516
|
//#endregion
|
|
11767
12517
|
//#region src/theme-renderer.ts
|
|
11768
12518
|
/**
|
|
@@ -11864,13 +12614,16 @@ function DefaultTheme({ children }) {
|
|
|
11864
12614
|
${page.description ? `<meta name="description" content="${escapeHtml(page.description)}">` : ""}
|
|
11865
12615
|
<style>
|
|
11866
12616
|
:root {
|
|
11867
|
-
--octc-color-primary: #
|
|
11868
|
-
--octc-color-text: #
|
|
12617
|
+
--octc-color-primary: #4f6fae;
|
|
12618
|
+
--octc-color-text: #131a30;
|
|
11869
12619
|
--octc-color-bg: #ffffff;
|
|
12620
|
+
--octc-color-bg-alt: #f5f7fb;
|
|
12621
|
+
--octc-color-text-muted: #4f607b;
|
|
12622
|
+
--octc-color-border: #d2dbea;
|
|
11870
12623
|
}
|
|
11871
12624
|
body {
|
|
11872
|
-
font-family:
|
|
11873
|
-
line-height: 1.
|
|
12625
|
+
font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
|
|
12626
|
+
line-height: 1.7;
|
|
11874
12627
|
color: var(--octc-color-text);
|
|
11875
12628
|
background: var(--octc-color-bg);
|
|
11876
12629
|
max-width: 800px;
|
|
@@ -11920,7 +12673,6 @@ function createTheme(config) {
|
|
|
11920
12673
|
return Layout({ children });
|
|
11921
12674
|
};
|
|
11922
12675
|
}
|
|
11923
|
-
|
|
11924
12676
|
//#endregion
|
|
11925
12677
|
//#region src/index.ts
|
|
11926
12678
|
/**
|
|
@@ -11955,8 +12707,8 @@ function oxContent(options = {}) {
|
|
|
11955
12707
|
async function regenerateDocs(root) {
|
|
11956
12708
|
const docsOptions = resolvedOptions.docs;
|
|
11957
12709
|
if (!docsOptions || !docsOptions.enabled) return 0;
|
|
11958
|
-
const srcDirs = docsOptions.src.map((src) => path
|
|
11959
|
-
const outDir = path
|
|
12710
|
+
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
12711
|
+
const outDir = path.resolve(root, docsOptions.out);
|
|
11960
12712
|
const extracted = await extractDocs(srcDirs, docsOptions);
|
|
11961
12713
|
const generated = generateMarkdown(extracted, docsOptions);
|
|
11962
12714
|
await writeDocs(generated, outDir, extracted, docsOptions);
|
|
@@ -12025,7 +12777,7 @@ function oxContent(options = {}) {
|
|
|
12025
12777
|
const docsOptions = resolvedOptions.docs;
|
|
12026
12778
|
if (!docsOptions || !docsOptions.enabled) return;
|
|
12027
12779
|
const root = config?.root || process.cwd();
|
|
12028
|
-
const srcDirs = docsOptions.src.map((src) => path
|
|
12780
|
+
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
12029
12781
|
for (const srcDir of srcDirs) devServer.watcher.add(srcDir);
|
|
12030
12782
|
devServer.watcher.on("all", async (event, file) => {
|
|
12031
12783
|
if (event !== "add" && event !== "change" && event !== "unlink") return;
|
|
@@ -12041,7 +12793,7 @@ function oxContent(options = {}) {
|
|
|
12041
12793
|
configureServer(devServer) {
|
|
12042
12794
|
if (!resolvedOptions.ssg.enabled) return;
|
|
12043
12795
|
const root = config?.root || process.cwd();
|
|
12044
|
-
const srcDir = path
|
|
12796
|
+
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12045
12797
|
devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));
|
|
12046
12798
|
devServer.watcher.on("add", (file) => {
|
|
12047
12799
|
if (file.startsWith(srcDir) && file.endsWith(".md")) {
|
|
@@ -12108,7 +12860,7 @@ function oxContent(options = {}) {
|
|
|
12108
12860
|
async buildStart() {
|
|
12109
12861
|
if (!resolvedOptions.search.enabled) return;
|
|
12110
12862
|
const root = config?.root || process.cwd();
|
|
12111
|
-
const srcDir = path
|
|
12863
|
+
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12112
12864
|
try {
|
|
12113
12865
|
searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);
|
|
12114
12866
|
console.log("[ox-content] Search index built");
|
|
@@ -12119,10 +12871,10 @@ function oxContent(options = {}) {
|
|
|
12119
12871
|
async closeBundle() {
|
|
12120
12872
|
if (!resolvedOptions.search.enabled || !searchIndexJson) return;
|
|
12121
12873
|
const root = config?.root || process.cwd();
|
|
12122
|
-
const outDir = path
|
|
12874
|
+
const outDir = path.resolve(root, resolvedOptions.outDir);
|
|
12123
12875
|
try {
|
|
12124
12876
|
await writeSearchIndex(searchIndexJson, outDir);
|
|
12125
|
-
console.log("[ox-content] Search index written to", path
|
|
12877
|
+
console.log("[ox-content] Search index written to", path.join(outDir, "search-index.json"));
|
|
12126
12878
|
} catch (err) {
|
|
12127
12879
|
console.warn("[ox-content] Failed to write search index:", err);
|
|
12128
12880
|
}
|
|
@@ -12150,6 +12902,7 @@ function resolveOptions(options) {
|
|
|
12150
12902
|
highlight: options.highlight ?? false,
|
|
12151
12903
|
highlightTheme: options.highlightTheme ?? "github-dark",
|
|
12152
12904
|
highlightLangs: options.highlightLangs ?? [],
|
|
12905
|
+
codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
|
|
12153
12906
|
mermaid: options.mermaid ?? false,
|
|
12154
12907
|
frontmatter: options.frontmatter ?? true,
|
|
12155
12908
|
toc: options.toc ?? true,
|
|
@@ -12163,12 +12916,32 @@ function resolveOptions(options) {
|
|
|
12163
12916
|
i18n: resolveI18nOptions(options.i18n)
|
|
12164
12917
|
};
|
|
12165
12918
|
}
|
|
12919
|
+
function resolveCodeAnnotationsOptions(options) {
|
|
12920
|
+
if (!options) return {
|
|
12921
|
+
enabled: false,
|
|
12922
|
+
notation: "attribute",
|
|
12923
|
+
metaKey: "annotate",
|
|
12924
|
+
defaultLineNumbers: false
|
|
12925
|
+
};
|
|
12926
|
+
if (options === true) return {
|
|
12927
|
+
enabled: true,
|
|
12928
|
+
notation: "attribute",
|
|
12929
|
+
metaKey: "annotate",
|
|
12930
|
+
defaultLineNumbers: false
|
|
12931
|
+
};
|
|
12932
|
+
return {
|
|
12933
|
+
enabled: true,
|
|
12934
|
+
notation: options.notation ?? "attribute",
|
|
12935
|
+
metaKey: options.metaKey ?? "annotate",
|
|
12936
|
+
defaultLineNumbers: options.defaultLineNumbers ?? false
|
|
12937
|
+
};
|
|
12938
|
+
}
|
|
12166
12939
|
/**
|
|
12167
12940
|
* Generates virtual module content.
|
|
12168
12941
|
*/
|
|
12169
|
-
function generateVirtualModule(path, options) {
|
|
12170
|
-
if (path === "config") return `export default ${JSON.stringify(options)};`;
|
|
12171
|
-
if (path === "runtime") return `
|
|
12942
|
+
function generateVirtualModule(path$2, options) {
|
|
12943
|
+
if (path$2 === "config") return `export default ${JSON.stringify(options)};`;
|
|
12944
|
+
if (path$2 === "runtime") return `
|
|
12172
12945
|
export function useMarkdown() {
|
|
12173
12946
|
return {
|
|
12174
12947
|
render: (content) => {
|
|
@@ -12180,7 +12953,6 @@ function generateVirtualModule(path, options) {
|
|
|
12180
12953
|
`;
|
|
12181
12954
|
return "export default {};";
|
|
12182
12955
|
}
|
|
12183
|
-
|
|
12184
12956
|
//#endregion
|
|
12185
12957
|
exports.DEFAULT_HTML_TEMPLATE = DEFAULT_HTML_TEMPLATE;
|
|
12186
12958
|
exports.DefaultTheme = DefaultTheme;
|
|
@@ -12243,4 +13015,5 @@ exports.useSiteConfig = useSiteConfig;
|
|
|
12243
13015
|
exports.when = when;
|
|
12244
13016
|
exports.writeDocs = writeDocs;
|
|
12245
13017
|
exports.writeSearchIndex = writeSearchIndex;
|
|
13018
|
+
|
|
12246
13019
|
//# sourceMappingURL=index.cjs.map
|