@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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as transformMermaidStatic, t as mermaidClientScript } from "./
|
|
2
|
-
import { n as resetTabGroupCounter, r as transformTabs, t as generateTabsCSS } from "./tabs2.
|
|
3
|
-
import { n as transformYouTube, t as extractVideoId } from "./youtube2.
|
|
4
|
-
import { i as transformGitHub, n as fetchRepoData, r as prefetchGitHubRepos, t as collectGitHubRepos } from "./github2.
|
|
5
|
-
import { i as transformOgp, n as fetchOgpData, r as prefetchOgpData, t as collectOgpUrls } from "./ogp2.
|
|
1
|
+
import { n as transformMermaidStatic, r as importNapiModule, t as mermaidClientScript } from "./mermaid.mjs";
|
|
2
|
+
import { n as resetTabGroupCounter, r as transformTabs, t as generateTabsCSS } from "./tabs2.mjs";
|
|
3
|
+
import { n as transformYouTube, t as extractVideoId } from "./youtube2.mjs";
|
|
4
|
+
import { i as transformGitHub, n as fetchRepoData, r as prefetchGitHubRepos, t as collectGitHubRepos } from "./github2.mjs";
|
|
5
|
+
import { i as transformOgp, n as fetchOgpData, r as prefetchOgpData, t as collectOgpUrls } from "./ogp2.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
|
-
import * as path from "path";
|
|
8
|
-
import path
|
|
7
|
+
import * as path$1 from "path";
|
|
8
|
+
import path from "path";
|
|
9
9
|
import { unified } from "unified";
|
|
10
10
|
import rehypeParse from "rehype-parse";
|
|
11
11
|
import rehypeStringify from "rehype-stringify";
|
|
@@ -17,8 +17,7 @@ import * as fs from "fs/promises";
|
|
|
17
17
|
import { glob } from "glob";
|
|
18
18
|
import * as crypto from "crypto";
|
|
19
19
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
20
|
-
|
|
21
|
-
//#region rolldown:runtime
|
|
20
|
+
//#region \0rolldown/runtime.js
|
|
22
21
|
var __create = Object.create;
|
|
23
22
|
var __defProp = Object.defineProperty;
|
|
24
23
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -27,30 +26,22 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
27
26
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
28
27
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
29
28
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
30
|
-
var __exportAll = (all,
|
|
29
|
+
var __exportAll = (all, no_symbols) => {
|
|
31
30
|
let target = {};
|
|
32
|
-
for (var name in all) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
if (symbols) {
|
|
39
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
40
|
-
}
|
|
31
|
+
for (var name in all) __defProp(target, name, {
|
|
32
|
+
get: all[name],
|
|
33
|
+
enumerable: true
|
|
34
|
+
});
|
|
35
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
41
36
|
return target;
|
|
42
37
|
};
|
|
43
38
|
var __copyProps = (to, from, except, desc) => {
|
|
44
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
39
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
40
|
+
key = keys[i];
|
|
41
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
42
|
+
get: ((k) => from[k]).bind(null, key),
|
|
43
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
44
|
+
});
|
|
54
45
|
}
|
|
55
46
|
return to;
|
|
56
47
|
};
|
|
@@ -60,7 +51,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
60
51
|
}) : target, mod));
|
|
61
52
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
53
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
63
|
-
|
|
64
54
|
//#endregion
|
|
65
55
|
//#region src/environment.ts
|
|
66
56
|
/**
|
|
@@ -108,7 +98,6 @@ function createMarkdownEnvironment(options) {
|
|
|
108
98
|
}
|
|
109
99
|
};
|
|
110
100
|
}
|
|
111
|
-
|
|
112
101
|
//#endregion
|
|
113
102
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
|
|
114
103
|
var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -159,7 +148,6 @@ var require_identity = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
159
148
|
exports.isScalar = isScalar;
|
|
160
149
|
exports.isSeq = isSeq;
|
|
161
150
|
}));
|
|
162
|
-
|
|
163
151
|
//#endregion
|
|
164
152
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/visit.js
|
|
165
153
|
var require_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -350,7 +338,6 @@ var require_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
350
338
|
exports.visit = visit;
|
|
351
339
|
exports.visitAsync = visitAsync;
|
|
352
340
|
}));
|
|
353
|
-
|
|
354
341
|
//#endregion
|
|
355
342
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js
|
|
356
343
|
var require_directives = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -516,7 +503,6 @@ var require_directives = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
516
503
|
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
517
504
|
exports.Directives = Directives;
|
|
518
505
|
}));
|
|
519
|
-
|
|
520
506
|
//#endregion
|
|
521
507
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js
|
|
522
508
|
var require_anchors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -579,7 +565,6 @@ var require_anchors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
579
565
|
exports.createNodeAnchors = createNodeAnchors;
|
|
580
566
|
exports.findNewAnchor = findNewAnchor;
|
|
581
567
|
}));
|
|
582
|
-
|
|
583
568
|
//#endregion
|
|
584
569
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js
|
|
585
570
|
var require_applyReviver = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -620,7 +605,6 @@ var require_applyReviver = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
620
605
|
}
|
|
621
606
|
exports.applyReviver = applyReviver;
|
|
622
607
|
}));
|
|
623
|
-
|
|
624
608
|
//#endregion
|
|
625
609
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js
|
|
626
610
|
var require_toJS = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -658,7 +642,6 @@ var require_toJS = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
658
642
|
}
|
|
659
643
|
exports.toJS = toJS;
|
|
660
644
|
}));
|
|
661
|
-
|
|
662
645
|
//#endregion
|
|
663
646
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js
|
|
664
647
|
var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -693,7 +676,6 @@ var require_Node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
693
676
|
};
|
|
694
677
|
exports.NodeBase = NodeBase;
|
|
695
678
|
}));
|
|
696
|
-
|
|
697
679
|
//#endregion
|
|
698
680
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js
|
|
699
681
|
var require_Alias = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -787,7 +769,6 @@ var require_Alias = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
787
769
|
}
|
|
788
770
|
exports.Alias = Alias;
|
|
789
771
|
}));
|
|
790
|
-
|
|
791
772
|
//#endregion
|
|
792
773
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js
|
|
793
774
|
var require_Scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -815,7 +796,6 @@ var require_Scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
815
796
|
exports.Scalar = Scalar;
|
|
816
797
|
exports.isScalarValue = isScalarValue;
|
|
817
798
|
}));
|
|
818
|
-
|
|
819
799
|
//#endregion
|
|
820
800
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js
|
|
821
801
|
var require_createNode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -879,7 +859,6 @@ var require_createNode = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
879
859
|
}
|
|
880
860
|
exports.createNode = createNode;
|
|
881
861
|
}));
|
|
882
|
-
|
|
883
862
|
//#endregion
|
|
884
863
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js
|
|
885
864
|
var require_Collection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1001,7 +980,6 @@ var require_Collection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1001
980
|
exports.collectionFromPath = collectionFromPath;
|
|
1002
981
|
exports.isEmptyPath = isEmptyPath;
|
|
1003
982
|
}));
|
|
1004
|
-
|
|
1005
983
|
//#endregion
|
|
1006
984
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
1007
985
|
var require_stringifyComment = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1022,7 +1000,6 @@ var require_stringifyComment = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1022
1000
|
exports.lineComment = lineComment;
|
|
1023
1001
|
exports.stringifyComment = stringifyComment;
|
|
1024
1002
|
}));
|
|
1025
|
-
|
|
1026
1003
|
//#endregion
|
|
1027
1004
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
1028
1005
|
var require_foldFlowLines = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1139,7 +1116,6 @@ var require_foldFlowLines = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1139
1116
|
exports.FOLD_QUOTED = FOLD_QUOTED;
|
|
1140
1117
|
exports.foldFlowLines = foldFlowLines;
|
|
1141
1118
|
}));
|
|
1142
|
-
|
|
1143
1119
|
//#endregion
|
|
1144
1120
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1145
1121
|
var require_stringifyString = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1364,7 +1340,6 @@ var require_stringifyString = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1364
1340
|
}
|
|
1365
1341
|
exports.stringifyString = stringifyString;
|
|
1366
1342
|
}));
|
|
1367
|
-
|
|
1368
1343
|
//#endregion
|
|
1369
1344
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js
|
|
1370
1345
|
var require_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1472,7 +1447,6 @@ var require_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1472
1447
|
exports.createStringifyContext = createStringifyContext;
|
|
1473
1448
|
exports.stringify = stringify;
|
|
1474
1449
|
}));
|
|
1475
|
-
|
|
1476
1450
|
//#endregion
|
|
1477
1451
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1478
1452
|
var require_stringifyPair = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1570,7 +1544,6 @@ var require_stringifyPair = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1570
1544
|
}
|
|
1571
1545
|
exports.stringifyPair = stringifyPair;
|
|
1572
1546
|
}));
|
|
1573
|
-
|
|
1574
1547
|
//#endregion
|
|
1575
1548
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/log.js
|
|
1576
1549
|
var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1585,7 +1558,6 @@ var require_log = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1585
1558
|
exports.debug = debug;
|
|
1586
1559
|
exports.warn = warn;
|
|
1587
1560
|
}));
|
|
1588
|
-
|
|
1589
1561
|
//#endregion
|
|
1590
1562
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1591
1563
|
var require_merge = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1626,7 +1598,6 @@ var require_merge = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1626
1598
|
exports.isMergeKey = isMergeKey;
|
|
1627
1599
|
exports.merge = merge;
|
|
1628
1600
|
}));
|
|
1629
|
-
|
|
1630
1601
|
//#endregion
|
|
1631
1602
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1632
1603
|
var require_addPairToJSMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1678,7 +1649,6 @@ var require_addPairToJSMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1678
1649
|
}
|
|
1679
1650
|
exports.addPairToJSMap = addPairToJSMap;
|
|
1680
1651
|
}));
|
|
1681
|
-
|
|
1682
1652
|
//#endregion
|
|
1683
1653
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js
|
|
1684
1654
|
var require_Pair = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1712,7 +1682,6 @@ var require_Pair = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1712
1682
|
exports.Pair = Pair;
|
|
1713
1683
|
exports.createPair = createPair;
|
|
1714
1684
|
}));
|
|
1715
|
-
|
|
1716
1685
|
//#endregion
|
|
1717
1686
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1718
1687
|
var require_stringifyCollection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1827,7 +1796,6 @@ var require_stringifyCollection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1827
1796
|
}
|
|
1828
1797
|
exports.stringifyCollection = stringifyCollection;
|
|
1829
1798
|
}));
|
|
1830
|
-
|
|
1831
1799
|
//#endregion
|
|
1832
1800
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
1833
1801
|
var require_YAMLMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1937,13 +1905,12 @@ var require_YAMLMap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1937
1905
|
exports.YAMLMap = YAMLMap;
|
|
1938
1906
|
exports.findPair = findPair;
|
|
1939
1907
|
}));
|
|
1940
|
-
|
|
1941
1908
|
//#endregion
|
|
1942
1909
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js
|
|
1943
1910
|
var require_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1944
1911
|
var identity = require_identity();
|
|
1945
1912
|
var YAMLMap = require_YAMLMap();
|
|
1946
|
-
|
|
1913
|
+
exports.map = {
|
|
1947
1914
|
collection: "map",
|
|
1948
1915
|
default: true,
|
|
1949
1916
|
nodeClass: YAMLMap.YAMLMap,
|
|
@@ -1954,9 +1921,7 @@ var require_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1954
1921
|
},
|
|
1955
1922
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
1956
1923
|
};
|
|
1957
|
-
exports.map = map;
|
|
1958
1924
|
}));
|
|
1959
|
-
|
|
1960
1925
|
//#endregion
|
|
1961
1926
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
1962
1927
|
var require_YAMLSeq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2063,13 +2028,12 @@ var require_YAMLSeq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2063
2028
|
}
|
|
2064
2029
|
exports.YAMLSeq = YAMLSeq;
|
|
2065
2030
|
}));
|
|
2066
|
-
|
|
2067
2031
|
//#endregion
|
|
2068
2032
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js
|
|
2069
2033
|
var require_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2070
2034
|
var identity = require_identity();
|
|
2071
2035
|
var YAMLSeq = require_YAMLSeq();
|
|
2072
|
-
|
|
2036
|
+
exports.seq = {
|
|
2073
2037
|
collection: "seq",
|
|
2074
2038
|
default: true,
|
|
2075
2039
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
@@ -2080,14 +2044,12 @@ var require_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2080
2044
|
},
|
|
2081
2045
|
createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
|
|
2082
2046
|
};
|
|
2083
|
-
exports.seq = seq;
|
|
2084
2047
|
}));
|
|
2085
|
-
|
|
2086
2048
|
//#endregion
|
|
2087
2049
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js
|
|
2088
2050
|
var require_string = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2089
2051
|
var stringifyString = require_stringifyString();
|
|
2090
|
-
|
|
2052
|
+
exports.string = {
|
|
2091
2053
|
identify: (value) => typeof value === "string",
|
|
2092
2054
|
default: true,
|
|
2093
2055
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -2097,9 +2059,7 @@ var require_string = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2097
2059
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
2098
2060
|
}
|
|
2099
2061
|
};
|
|
2100
|
-
exports.string = string;
|
|
2101
2062
|
}));
|
|
2102
|
-
|
|
2103
2063
|
//#endregion
|
|
2104
2064
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js
|
|
2105
2065
|
var require_null = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2115,7 +2075,6 @@ var require_null = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2115
2075
|
};
|
|
2116
2076
|
exports.nullTag = nullTag;
|
|
2117
2077
|
}));
|
|
2118
|
-
|
|
2119
2078
|
//#endregion
|
|
2120
2079
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js
|
|
2121
2080
|
var require_bool$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2135,7 +2094,6 @@ var require_bool$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2135
2094
|
};
|
|
2136
2095
|
exports.boolTag = boolTag;
|
|
2137
2096
|
}));
|
|
2138
|
-
|
|
2139
2097
|
//#endregion
|
|
2140
2098
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2141
2099
|
var require_stringifyNumber = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2157,7 +2115,6 @@ var require_stringifyNumber = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2157
2115
|
}
|
|
2158
2116
|
exports.stringifyNumber = stringifyNumber;
|
|
2159
2117
|
}));
|
|
2160
|
-
|
|
2161
2118
|
//#endregion
|
|
2162
2119
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js
|
|
2163
2120
|
var require_float$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2183,7 +2140,7 @@ var require_float$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2183
2140
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2184
2141
|
}
|
|
2185
2142
|
};
|
|
2186
|
-
|
|
2143
|
+
exports.float = {
|
|
2187
2144
|
identify: (value) => typeof value === "number",
|
|
2188
2145
|
default: true,
|
|
2189
2146
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2196,11 +2153,9 @@ var require_float$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2196
2153
|
},
|
|
2197
2154
|
stringify: stringifyNumber.stringifyNumber
|
|
2198
2155
|
};
|
|
2199
|
-
exports.float = float;
|
|
2200
2156
|
exports.floatExp = floatExp;
|
|
2201
2157
|
exports.floatNaN = floatNaN;
|
|
2202
2158
|
}));
|
|
2203
|
-
|
|
2204
2159
|
//#endregion
|
|
2205
2160
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js
|
|
2206
2161
|
var require_int$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2242,7 +2197,6 @@ var require_int$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2242
2197
|
exports.intHex = intHex;
|
|
2243
2198
|
exports.intOct = intOct;
|
|
2244
2199
|
}));
|
|
2245
|
-
|
|
2246
2200
|
//#endregion
|
|
2247
2201
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js
|
|
2248
2202
|
var require_schema$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2253,7 +2207,7 @@ var require_schema$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2253
2207
|
var bool = require_bool$1();
|
|
2254
2208
|
var float = require_float$1();
|
|
2255
2209
|
var int = require_int$1();
|
|
2256
|
-
|
|
2210
|
+
exports.schema = [
|
|
2257
2211
|
map.map,
|
|
2258
2212
|
seq.seq,
|
|
2259
2213
|
string.string,
|
|
@@ -2266,9 +2220,7 @@ var require_schema$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2266
2220
|
float.floatExp,
|
|
2267
2221
|
float.float
|
|
2268
2222
|
];
|
|
2269
|
-
exports.schema = schema;
|
|
2270
2223
|
}));
|
|
2271
|
-
|
|
2272
2224
|
//#endregion
|
|
2273
2225
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js
|
|
2274
2226
|
var require_schema$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2321,7 +2273,7 @@ var require_schema$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2321
2273
|
stringify: stringifyJSON
|
|
2322
2274
|
}
|
|
2323
2275
|
];
|
|
2324
|
-
|
|
2276
|
+
exports.schema = [map.map, seq.seq].concat(jsonScalars, {
|
|
2325
2277
|
default: true,
|
|
2326
2278
|
tag: "",
|
|
2327
2279
|
test: /^/,
|
|
@@ -2330,16 +2282,14 @@ var require_schema$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2330
2282
|
return str;
|
|
2331
2283
|
}
|
|
2332
2284
|
});
|
|
2333
|
-
exports.schema = schema;
|
|
2334
2285
|
}));
|
|
2335
|
-
|
|
2336
2286
|
//#endregion
|
|
2337
2287
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2338
2288
|
var require_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2339
2289
|
var node_buffer = __require("buffer");
|
|
2340
2290
|
var Scalar = require_Scalar();
|
|
2341
2291
|
var stringifyString = require_stringifyString();
|
|
2342
|
-
|
|
2292
|
+
exports.binary = {
|
|
2343
2293
|
identify: (value) => value instanceof Uint8Array,
|
|
2344
2294
|
default: false,
|
|
2345
2295
|
tag: "tag:yaml.org,2002:binary",
|
|
@@ -2380,9 +2330,7 @@ var require_binary = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2380
2330
|
}, ctx, onComment, onChompKeep);
|
|
2381
2331
|
}
|
|
2382
2332
|
};
|
|
2383
|
-
exports.binary = binary;
|
|
2384
2333
|
}));
|
|
2385
|
-
|
|
2386
2334
|
//#endregion
|
|
2387
2335
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2388
2336
|
var require_pairs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2443,7 +2391,6 @@ var require_pairs = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2443
2391
|
exports.pairs = pairs;
|
|
2444
2392
|
exports.resolvePairs = resolvePairs;
|
|
2445
2393
|
}));
|
|
2446
|
-
|
|
2447
2394
|
//#endregion
|
|
2448
2395
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2449
2396
|
var require_omap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2507,7 +2454,6 @@ var require_omap = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2507
2454
|
exports.YAMLOMap = YAMLOMap;
|
|
2508
2455
|
exports.omap = omap;
|
|
2509
2456
|
}));
|
|
2510
|
-
|
|
2511
2457
|
//#endregion
|
|
2512
2458
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2513
2459
|
var require_bool = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2535,7 +2481,6 @@ var require_bool = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2535
2481
|
exports.falseTag = falseTag;
|
|
2536
2482
|
exports.trueTag = trueTag;
|
|
2537
2483
|
}));
|
|
2538
|
-
|
|
2539
2484
|
//#endregion
|
|
2540
2485
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2541
2486
|
var require_float = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2561,7 +2506,7 @@ var require_float = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2561
2506
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2562
2507
|
}
|
|
2563
2508
|
};
|
|
2564
|
-
|
|
2509
|
+
exports.float = {
|
|
2565
2510
|
identify: (value) => typeof value === "number",
|
|
2566
2511
|
default: true,
|
|
2567
2512
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2577,11 +2522,9 @@ var require_float = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2577
2522
|
},
|
|
2578
2523
|
stringify: stringifyNumber.stringifyNumber
|
|
2579
2524
|
};
|
|
2580
|
-
exports.float = float;
|
|
2581
2525
|
exports.floatExp = floatExp;
|
|
2582
2526
|
exports.floatNaN = floatNaN;
|
|
2583
2527
|
}));
|
|
2584
|
-
|
|
2585
2528
|
//#endregion
|
|
2586
2529
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2587
2530
|
var require_int = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2657,7 +2600,6 @@ var require_int = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2657
2600
|
exports.intHex = intHex;
|
|
2658
2601
|
exports.intOct = intOct;
|
|
2659
2602
|
}));
|
|
2660
|
-
|
|
2661
2603
|
//#endregion
|
|
2662
2604
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
2663
2605
|
var require_set = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2726,7 +2668,6 @@ var require_set = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2726
2668
|
exports.YAMLSet = YAMLSet;
|
|
2727
2669
|
exports.set = set;
|
|
2728
2670
|
}));
|
|
2729
|
-
|
|
2730
2671
|
//#endregion
|
|
2731
2672
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
2732
2673
|
var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2810,7 +2751,6 @@ var require_timestamp = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2810
2751
|
exports.intTime = intTime;
|
|
2811
2752
|
exports.timestamp = timestamp;
|
|
2812
2753
|
}));
|
|
2813
|
-
|
|
2814
2754
|
//#endregion
|
|
2815
2755
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
2816
2756
|
var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2827,7 +2767,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2827
2767
|
var pairs = require_pairs();
|
|
2828
2768
|
var set = require_set();
|
|
2829
2769
|
var timestamp = require_timestamp();
|
|
2830
|
-
|
|
2770
|
+
exports.schema = [
|
|
2831
2771
|
map.map,
|
|
2832
2772
|
seq.seq,
|
|
2833
2773
|
string.string,
|
|
@@ -2850,9 +2790,7 @@ var require_schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2850
2790
|
timestamp.floatTime,
|
|
2851
2791
|
timestamp.timestamp
|
|
2852
2792
|
];
|
|
2853
|
-
exports.schema = schema;
|
|
2854
2793
|
}));
|
|
2855
|
-
|
|
2856
2794
|
//#endregion
|
|
2857
2795
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js
|
|
2858
2796
|
var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2937,7 +2875,6 @@ var require_tags = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2937
2875
|
exports.coreKnownTags = coreKnownTags;
|
|
2938
2876
|
exports.getTags = getTags;
|
|
2939
2877
|
}));
|
|
2940
|
-
|
|
2941
2878
|
//#endregion
|
|
2942
2879
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js
|
|
2943
2880
|
var require_Schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -2947,7 +2884,7 @@ var require_Schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2947
2884
|
var string = require_string();
|
|
2948
2885
|
var tags = require_tags();
|
|
2949
2886
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
2950
|
-
|
|
2887
|
+
exports.Schema = class Schema {
|
|
2951
2888
|
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
2952
2889
|
this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
|
|
2953
2890
|
this.name = typeof schema === "string" && schema || "core";
|
|
@@ -2965,9 +2902,7 @@ var require_Schema = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2965
2902
|
return copy;
|
|
2966
2903
|
}
|
|
2967
2904
|
};
|
|
2968
|
-
exports.Schema = Schema;
|
|
2969
2905
|
}));
|
|
2970
|
-
|
|
2971
2906
|
//#endregion
|
|
2972
2907
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
2973
2908
|
var require_stringifyDocument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3029,7 +2964,6 @@ var require_stringifyDocument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3029
2964
|
}
|
|
3030
2965
|
exports.stringifyDocument = stringifyDocument;
|
|
3031
2966
|
}));
|
|
3032
|
-
|
|
3033
2967
|
//#endregion
|
|
3034
2968
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js
|
|
3035
2969
|
var require_Document = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3311,7 +3245,6 @@ var require_Document = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3311
3245
|
}
|
|
3312
3246
|
exports.Document = Document;
|
|
3313
3247
|
}));
|
|
3314
|
-
|
|
3315
3248
|
//#endregion
|
|
3316
3249
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/errors.js
|
|
3317
3250
|
var require_errors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3365,7 +3298,6 @@ var require_errors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3365
3298
|
exports.YAMLWarning = YAMLWarning;
|
|
3366
3299
|
exports.prettifyError = prettifyError;
|
|
3367
3300
|
}));
|
|
3368
|
-
|
|
3369
3301
|
//#endregion
|
|
3370
3302
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js
|
|
3371
3303
|
var require_resolve_props = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3473,7 +3405,6 @@ var require_resolve_props = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3473
3405
|
}
|
|
3474
3406
|
exports.resolveProps = resolveProps;
|
|
3475
3407
|
}));
|
|
3476
|
-
|
|
3477
3408
|
//#endregion
|
|
3478
3409
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3479
3410
|
var require_util_contains_newline = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3503,7 +3434,6 @@ var require_util_contains_newline = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
3503
3434
|
}
|
|
3504
3435
|
exports.containsNewline = containsNewline;
|
|
3505
3436
|
}));
|
|
3506
|
-
|
|
3507
3437
|
//#endregion
|
|
3508
3438
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3509
3439
|
var require_util_flow_indent_check = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3516,7 +3446,6 @@ var require_util_flow_indent_check = /* @__PURE__ */ __commonJSMin(((exports) =>
|
|
|
3516
3446
|
}
|
|
3517
3447
|
exports.flowIndentCheck = flowIndentCheck;
|
|
3518
3448
|
}));
|
|
3519
|
-
|
|
3520
3449
|
//#endregion
|
|
3521
3450
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js
|
|
3522
3451
|
var require_util_map_includes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3529,7 +3458,6 @@ var require_util_map_includes = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3529
3458
|
}
|
|
3530
3459
|
exports.mapIncludes = mapIncludes;
|
|
3531
3460
|
}));
|
|
3532
|
-
|
|
3533
3461
|
//#endregion
|
|
3534
3462
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3535
3463
|
var require_resolve_block_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3614,7 +3542,6 @@ var require_resolve_block_map = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3614
3542
|
}
|
|
3615
3543
|
exports.resolveBlockMap = resolveBlockMap;
|
|
3616
3544
|
}));
|
|
3617
|
-
|
|
3618
3545
|
//#endregion
|
|
3619
3546
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
3620
3547
|
var require_resolve_block_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3657,7 +3584,6 @@ var require_resolve_block_seq = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3657
3584
|
}
|
|
3658
3585
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
3659
3586
|
}));
|
|
3660
|
-
|
|
3661
3587
|
//#endregion
|
|
3662
3588
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js
|
|
3663
3589
|
var require_resolve_end = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3696,7 +3622,6 @@ var require_resolve_end = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3696
3622
|
}
|
|
3697
3623
|
exports.resolveEnd = resolveEnd;
|
|
3698
3624
|
}));
|
|
3699
|
-
|
|
3700
3625
|
//#endregion
|
|
3701
3626
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
3702
3627
|
var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3852,7 +3777,6 @@ var require_resolve_flow_collection = /* @__PURE__ */ __commonJSMin(((exports) =
|
|
|
3852
3777
|
}
|
|
3853
3778
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
3854
3779
|
}));
|
|
3855
|
-
|
|
3856
3780
|
//#endregion
|
|
3857
3781
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js
|
|
3858
3782
|
var require_compose_collection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -3905,7 +3829,6 @@ var require_compose_collection = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3905
3829
|
}
|
|
3906
3830
|
exports.composeCollection = composeCollection;
|
|
3907
3831
|
}));
|
|
3908
|
-
|
|
3909
3832
|
//#endregion
|
|
3910
3833
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
3911
3834
|
var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4081,7 +4004,6 @@ var require_resolve_block_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4081
4004
|
}
|
|
4082
4005
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4083
4006
|
}));
|
|
4084
|
-
|
|
4085
4007
|
//#endregion
|
|
4086
4008
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4087
4009
|
var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4288,7 +4210,6 @@ var require_resolve_flow_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4288
4210
|
}
|
|
4289
4211
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4290
4212
|
}));
|
|
4291
|
-
|
|
4292
4213
|
//#endregion
|
|
4293
4214
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4294
4215
|
var require_compose_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4348,7 +4269,6 @@ var require_compose_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4348
4269
|
}
|
|
4349
4270
|
exports.composeScalar = composeScalar;
|
|
4350
4271
|
}));
|
|
4351
|
-
|
|
4352
4272
|
//#endregion
|
|
4353
4273
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4354
4274
|
var require_util_empty_scalar_position = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4376,7 +4296,6 @@ var require_util_empty_scalar_position = /* @__PURE__ */ __commonJSMin(((exports
|
|
|
4376
4296
|
}
|
|
4377
4297
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
4378
4298
|
}));
|
|
4379
|
-
|
|
4380
4299
|
//#endregion
|
|
4381
4300
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js
|
|
4382
4301
|
var require_compose_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4462,7 +4381,6 @@ var require_compose_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4462
4381
|
exports.composeEmptyNode = composeEmptyNode;
|
|
4463
4382
|
exports.composeNode = composeNode;
|
|
4464
4383
|
}));
|
|
4465
|
-
|
|
4466
4384
|
//#endregion
|
|
4467
4385
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js
|
|
4468
4386
|
var require_compose_doc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4505,7 +4423,6 @@ var require_compose_doc = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4505
4423
|
}
|
|
4506
4424
|
exports.composeDoc = composeDoc;
|
|
4507
4425
|
}));
|
|
4508
|
-
|
|
4509
4426
|
//#endregion
|
|
4510
4427
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js
|
|
4511
4428
|
var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4704,7 +4621,6 @@ var require_composer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4704
4621
|
};
|
|
4705
4622
|
exports.Composer = Composer;
|
|
4706
4623
|
}));
|
|
4707
|
-
|
|
4708
4624
|
//#endregion
|
|
4709
4625
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js
|
|
4710
4626
|
var require_cst_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -4972,7 +4888,6 @@ var require_cst_scalar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4972
4888
|
exports.resolveAsScalar = resolveAsScalar;
|
|
4973
4889
|
exports.setScalarValue = setScalarValue;
|
|
4974
4890
|
}));
|
|
4975
|
-
|
|
4976
4891
|
//#endregion
|
|
4977
4892
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js
|
|
4978
4893
|
var require_cst_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -5024,7 +4939,6 @@ var require_cst_stringify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5024
4939
|
}
|
|
5025
4940
|
exports.stringify = stringify;
|
|
5026
4941
|
}));
|
|
5027
|
-
|
|
5028
4942
|
//#endregion
|
|
5029
4943
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js
|
|
5030
4944
|
var require_cst_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -5116,7 +5030,6 @@ var require_cst_visit = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5116
5030
|
}
|
|
5117
5031
|
exports.visit = visit;
|
|
5118
5032
|
}));
|
|
5119
|
-
|
|
5120
5033
|
//#endregion
|
|
5121
5034
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js
|
|
5122
5035
|
var require_cst = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -5196,7 +5109,6 @@ var require_cst = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5196
5109
|
exports.prettyToken = prettyToken;
|
|
5197
5110
|
exports.tokenType = tokenType;
|
|
5198
5111
|
}));
|
|
5199
|
-
|
|
5200
5112
|
//#endregion
|
|
5201
5113
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js
|
|
5202
5114
|
var require_lexer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -5716,7 +5628,6 @@ var require_lexer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5716
5628
|
};
|
|
5717
5629
|
exports.Lexer = Lexer;
|
|
5718
5630
|
}));
|
|
5719
|
-
|
|
5720
5631
|
//#endregion
|
|
5721
5632
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js
|
|
5722
5633
|
var require_line_counter = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -5764,7 +5675,6 @@ var require_line_counter = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5764
5675
|
};
|
|
5765
5676
|
exports.LineCounter = LineCounter;
|
|
5766
5677
|
}));
|
|
5767
|
-
|
|
5768
5678
|
//#endregion
|
|
5769
5679
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js
|
|
5770
5680
|
var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -6621,7 +6531,6 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6621
6531
|
};
|
|
6622
6532
|
exports.Parser = Parser;
|
|
6623
6533
|
}));
|
|
6624
|
-
|
|
6625
6534
|
//#endregion
|
|
6626
6535
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/public-api.js
|
|
6627
6536
|
var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -6709,10 +6618,9 @@ var require_public_api = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6709
6618
|
exports.parseDocument = parseDocument;
|
|
6710
6619
|
exports.stringify = stringify;
|
|
6711
6620
|
}));
|
|
6712
|
-
|
|
6713
6621
|
//#endregion
|
|
6714
|
-
//#region
|
|
6715
|
-
var
|
|
6622
|
+
//#region src/highlight.ts
|
|
6623
|
+
var import_dist = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6716
6624
|
var composer = require_composer();
|
|
6717
6625
|
var Document = require_Document();
|
|
6718
6626
|
var Schema = require_Schema();
|
|
@@ -6723,7 +6631,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6723
6631
|
var Scalar = require_Scalar();
|
|
6724
6632
|
var YAMLMap = require_YAMLMap();
|
|
6725
6633
|
var YAMLSeq = require_YAMLSeq();
|
|
6726
|
-
|
|
6634
|
+
require_cst();
|
|
6727
6635
|
var lexer = require_lexer();
|
|
6728
6636
|
var lineCounter = require_line_counter();
|
|
6729
6637
|
var parser = require_parser();
|
|
@@ -6757,11 +6665,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6757
6665
|
exports.stringify = publicApi.stringify;
|
|
6758
6666
|
exports.visit = visit.visit;
|
|
6759
6667
|
exports.visitAsync = visit.visitAsync;
|
|
6760
|
-
}));
|
|
6761
|
-
|
|
6762
|
-
//#endregion
|
|
6763
|
-
//#region src/highlight.ts
|
|
6764
|
-
var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
|
|
6668
|
+
})))(), 1);
|
|
6765
6669
|
/**
|
|
6766
6670
|
* Syntax highlighting with Shiki via rehype.
|
|
6767
6671
|
*/
|
|
@@ -6791,46 +6695,110 @@ const BUILTIN_LANGS = [
|
|
|
6791
6695
|
"diff",
|
|
6792
6696
|
"toml"
|
|
6793
6697
|
];
|
|
6794
|
-
|
|
6698
|
+
const highlighterCache = /* @__PURE__ */ new Map();
|
|
6795
6699
|
/**
|
|
6796
6700
|
* Get or create the Shiki highlighter.
|
|
6797
6701
|
*/
|
|
6798
6702
|
async function getHighlighter(theme, customLangs = []) {
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6703
|
+
const { themeInput } = normalizeThemeInput(theme);
|
|
6704
|
+
const cacheKey = JSON.stringify({
|
|
6705
|
+
theme: themeInput,
|
|
6706
|
+
langs: customLangs
|
|
6802
6707
|
});
|
|
6708
|
+
let highlighterPromise = highlighterCache.get(cacheKey);
|
|
6709
|
+
if (!highlighterPromise) {
|
|
6710
|
+
highlighterPromise = createHighlighter({
|
|
6711
|
+
themes: [themeInput],
|
|
6712
|
+
langs: [...BUILTIN_LANGS, ...customLangs]
|
|
6713
|
+
});
|
|
6714
|
+
highlighterCache.set(cacheKey, highlighterPromise);
|
|
6715
|
+
}
|
|
6803
6716
|
return highlighterPromise;
|
|
6804
6717
|
}
|
|
6718
|
+
function normalizeThemeInput(theme) {
|
|
6719
|
+
if (typeof theme === "string") return {
|
|
6720
|
+
themeInput: theme,
|
|
6721
|
+
themeName: theme
|
|
6722
|
+
};
|
|
6723
|
+
const themeName = theme.name || "ox-content-custom-theme";
|
|
6724
|
+
return {
|
|
6725
|
+
themeInput: theme.name ? theme : {
|
|
6726
|
+
...theme,
|
|
6727
|
+
name: themeName
|
|
6728
|
+
},
|
|
6729
|
+
themeName
|
|
6730
|
+
};
|
|
6731
|
+
}
|
|
6805
6732
|
/**
|
|
6806
6733
|
* Rehype plugin for syntax highlighting with Shiki.
|
|
6807
6734
|
*/
|
|
6808
6735
|
function rehypeShikiHighlight(options) {
|
|
6809
6736
|
const { theme, langs } = options;
|
|
6810
6737
|
return async (tree) => {
|
|
6738
|
+
const { themeName } = normalizeThemeInput(theme);
|
|
6811
6739
|
const highlighter = await getHighlighter(theme, langs);
|
|
6740
|
+
const highlightBlockCode = (codeElement) => {
|
|
6741
|
+
let lang = "text";
|
|
6742
|
+
const langClass = normalizeClassName(codeElement.properties?.className).find((value) => value.startsWith("language-"));
|
|
6743
|
+
if (langClass) lang = langClass.replace("language-", "");
|
|
6744
|
+
const codeText = getTextContent(codeElement);
|
|
6745
|
+
try {
|
|
6746
|
+
const highlighted = highlighter.codeToHtml(codeText, {
|
|
6747
|
+
lang,
|
|
6748
|
+
theme: themeName
|
|
6749
|
+
});
|
|
6750
|
+
const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);
|
|
6751
|
+
if (parsed.children[0]?.type === "element") {
|
|
6752
|
+
const highlightedPre = parsed.children[0];
|
|
6753
|
+
highlightedPre.properties ??= {};
|
|
6754
|
+
highlightedPre.properties["data-language"] = lang;
|
|
6755
|
+
return highlightedPre;
|
|
6756
|
+
}
|
|
6757
|
+
} catch {}
|
|
6758
|
+
return null;
|
|
6759
|
+
};
|
|
6760
|
+
const highlightInlineCode = (codeElement) => {
|
|
6761
|
+
let lang = "text";
|
|
6762
|
+
const originalCodeClasses = normalizeClassName(codeElement.properties?.className);
|
|
6763
|
+
const langClass = originalCodeClasses.find((value) => value.startsWith("language-"));
|
|
6764
|
+
if (!langClass) return null;
|
|
6765
|
+
lang = langClass.replace("language-", "");
|
|
6766
|
+
const codeText = getTextContent(codeElement);
|
|
6767
|
+
try {
|
|
6768
|
+
const highlighted = highlighter.codeToHtml(codeText, {
|
|
6769
|
+
lang,
|
|
6770
|
+
theme: themeName
|
|
6771
|
+
});
|
|
6772
|
+
const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);
|
|
6773
|
+
if (parsed.children[0]?.type === "element") {
|
|
6774
|
+
const highlightedCode = parsed.children[0].children.find((child) => child.type === "element" && child.tagName === "code");
|
|
6775
|
+
if (highlightedCode) {
|
|
6776
|
+
highlightedCode.properties ??= {};
|
|
6777
|
+
const highlightedClasses = normalizeClassName(highlightedCode.properties.className);
|
|
6778
|
+
highlightedCode.properties.className = [...new Set([
|
|
6779
|
+
...originalCodeClasses,
|
|
6780
|
+
...highlightedClasses,
|
|
6781
|
+
"shiki-inline"
|
|
6782
|
+
])];
|
|
6783
|
+
highlightedCode.properties["data-language"] = lang;
|
|
6784
|
+
return highlightedCode;
|
|
6785
|
+
}
|
|
6786
|
+
}
|
|
6787
|
+
} catch {}
|
|
6788
|
+
return null;
|
|
6789
|
+
};
|
|
6812
6790
|
const visit = async (node) => {
|
|
6813
6791
|
if ("children" in node) for (let i = 0; i < node.children.length; i++) {
|
|
6814
6792
|
const child = node.children[i];
|
|
6815
6793
|
if (child.type === "element" && child.tagName === "pre") {
|
|
6816
6794
|
const codeElement = child.children.find((c) => c.type === "element" && c.tagName === "code");
|
|
6817
6795
|
if (codeElement) {
|
|
6818
|
-
const
|
|
6819
|
-
|
|
6820
|
-
if (Array.isArray(className)) {
|
|
6821
|
-
const langClass = className.find((c) => typeof c === "string" && c.startsWith("language-"));
|
|
6822
|
-
if (langClass && typeof langClass === "string") lang = langClass.replace("language-", "");
|
|
6823
|
-
}
|
|
6824
|
-
const codeText = getTextContent(codeElement);
|
|
6825
|
-
try {
|
|
6826
|
-
const highlighted = highlighter.codeToHtml(codeText, {
|
|
6827
|
-
lang,
|
|
6828
|
-
theme
|
|
6829
|
-
});
|
|
6830
|
-
const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);
|
|
6831
|
-
if (parsed.children[0]) node.children[i] = parsed.children[0];
|
|
6832
|
-
} catch {}
|
|
6796
|
+
const highlightedPre = highlightBlockCode(codeElement);
|
|
6797
|
+
if (highlightedPre) node.children[i] = highlightedPre;
|
|
6833
6798
|
}
|
|
6799
|
+
} else if (child.type === "element" && child.tagName === "code") {
|
|
6800
|
+
const highlightedCode = highlightInlineCode(child);
|
|
6801
|
+
if (highlightedCode) node.children[i] = highlightedCode;
|
|
6834
6802
|
} else if (child.type === "element") await visit(child);
|
|
6835
6803
|
}
|
|
6836
6804
|
};
|
|
@@ -6848,6 +6816,11 @@ function getTextContent(node) {
|
|
|
6848
6816
|
}
|
|
6849
6817
|
return text;
|
|
6850
6818
|
}
|
|
6819
|
+
function normalizeClassName(className) {
|
|
6820
|
+
if (Array.isArray(className)) return className.filter((value) => typeof value === "string");
|
|
6821
|
+
if (typeof className === "string" && className) return className.split(/\s+/).filter(Boolean);
|
|
6822
|
+
return [];
|
|
6823
|
+
}
|
|
6851
6824
|
/**
|
|
6852
6825
|
* Apply syntax highlighting to HTML using Shiki.
|
|
6853
6826
|
*/
|
|
@@ -6858,7 +6831,6 @@ async function highlightCode(html, theme = "github-dark", langs = []) {
|
|
|
6858
6831
|
}).use(rehypeStringify).process(html);
|
|
6859
6832
|
return String(result);
|
|
6860
6833
|
}
|
|
6861
|
-
|
|
6862
6834
|
//#endregion
|
|
6863
6835
|
//#region src/plugins/mermaid-protect.ts
|
|
6864
6836
|
/**
|
|
@@ -6911,7 +6883,6 @@ function restoreMermaidSvgs(html, svgs) {
|
|
|
6911
6883
|
for (const [placeholder, content] of svgs) result = result.replace(placeholder, content);
|
|
6912
6884
|
return result;
|
|
6913
6885
|
}
|
|
6914
|
-
|
|
6915
6886
|
//#endregion
|
|
6916
6887
|
//#region src/transform.ts
|
|
6917
6888
|
/**
|
|
@@ -6999,7 +6970,7 @@ async function loadNapiBindings() {
|
|
|
6999
6970
|
if (napiLoadAttempted) return napiBindings ?? null;
|
|
7000
6971
|
napiLoadAttempted = true;
|
|
7001
6972
|
try {
|
|
7002
|
-
const mod = await
|
|
6973
|
+
const mod = await importNapiModule();
|
|
7003
6974
|
napiBindings = mod;
|
|
7004
6975
|
return mod;
|
|
7005
6976
|
} catch (error) {
|
|
@@ -7021,7 +6992,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
7021
6992
|
tocMaxDepth: options.tocMaxDepth,
|
|
7022
6993
|
convertMdLinks: ssgOptions?.convertMdLinks,
|
|
7023
6994
|
baseUrl: ssgOptions?.baseUrl,
|
|
7024
|
-
sourcePath: ssgOptions?.sourcePath ?? filePath
|
|
6995
|
+
sourcePath: ssgOptions?.sourcePath ?? filePath,
|
|
6996
|
+
codeAnnotations: options.codeAnnotations.enabled,
|
|
6997
|
+
codeAnnotationMetaKey: options.codeAnnotations.metaKey,
|
|
6998
|
+
codeAnnotationSyntax: options.codeAnnotations.notation,
|
|
6999
|
+
codeAnnotationDefaultLineNumbers: options.codeAnnotations.defaultLineNumbers
|
|
7025
7000
|
});
|
|
7026
7001
|
if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
|
|
7027
7002
|
let html = result.html;
|
|
@@ -7033,7 +7008,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
7033
7008
|
if (options.mermaid) html = await transformMermaidStatic(html);
|
|
7034
7009
|
const { html: protectedHtml, svgs } = protectMermaidSvgs(html);
|
|
7035
7010
|
html = protectedHtml;
|
|
7036
|
-
if (options.highlight)
|
|
7011
|
+
if (options.highlight) {
|
|
7012
|
+
const originalHtml = html;
|
|
7013
|
+
const highlightedHtml = await highlightCode(html, options.highlightTheme, options.highlightLangs);
|
|
7014
|
+
html = napi.mergeHighlightedCodeBlocks(originalHtml, highlightedHtml);
|
|
7015
|
+
}
|
|
7037
7016
|
html = restoreMermaidSvgs(html, svgs);
|
|
7038
7017
|
return {
|
|
7039
7018
|
code: generateModuleCode(html, frontmatter, toc, filePath, options),
|
|
@@ -7129,7 +7108,6 @@ if (import.meta.hot) {
|
|
|
7129
7108
|
}
|
|
7130
7109
|
`;
|
|
7131
7110
|
}
|
|
7132
|
-
|
|
7133
7111
|
//#endregion
|
|
7134
7112
|
//#region src/nav-generator.ts
|
|
7135
7113
|
/**
|
|
@@ -7276,7 +7254,7 @@ function generateNavMetadata(docs, basePath = "/api") {
|
|
|
7276
7254
|
* @internal
|
|
7277
7255
|
*/
|
|
7278
7256
|
function getDocDisplayName(filePath) {
|
|
7279
|
-
const fileName = path
|
|
7257
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
|
7280
7258
|
if (fileName === "index" || fileName === "index-module") return "Overview";
|
|
7281
7259
|
return fileName.replace(/[-_]([a-z])/g, (_, char) => " " + char.toUpperCase()).replace(/^[a-z]/, (char) => char.toUpperCase());
|
|
7282
7260
|
}
|
|
@@ -7293,7 +7271,7 @@ function getDocDisplayName(filePath) {
|
|
|
7293
7271
|
* @internal
|
|
7294
7272
|
*/
|
|
7295
7273
|
function getDocFileName(filePath) {
|
|
7296
|
-
const fileName = path
|
|
7274
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
|
7297
7275
|
if (fileName === "index") return "index";
|
|
7298
7276
|
return fileName;
|
|
7299
7277
|
}
|
|
@@ -7368,7 +7346,6 @@ export interface NavItem {
|
|
|
7368
7346
|
export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as const;
|
|
7369
7347
|
`;
|
|
7370
7348
|
}
|
|
7371
|
-
|
|
7372
7349
|
//#endregion
|
|
7373
7350
|
//#region src/docs.ts
|
|
7374
7351
|
/**
|
|
@@ -7422,16 +7399,160 @@ export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as
|
|
|
7422
7399
|
* ```
|
|
7423
7400
|
*/
|
|
7424
7401
|
const DOCS_MANIFEST_FILE = ".ox-content-docs-manifest.json";
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
const
|
|
7402
|
+
const DOCS_DATA_FILE = "docs.json";
|
|
7403
|
+
function escapeHtml$3(str) {
|
|
7404
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7405
|
+
}
|
|
7406
|
+
function entryAnchor(name) {
|
|
7407
|
+
return name.toLowerCase();
|
|
7408
|
+
}
|
|
7409
|
+
function cleanSummaryText(text, maxLength = 120) {
|
|
7410
|
+
if (!text) return "";
|
|
7411
|
+
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
7412
|
+
if (collapsed.length <= maxLength) return collapsed;
|
|
7413
|
+
return `${collapsed.slice(0, maxLength - 1).trimEnd()}…`;
|
|
7414
|
+
}
|
|
7415
|
+
function renderInlineHtml(text) {
|
|
7416
|
+
let html = "";
|
|
7417
|
+
let lastIndex = 0;
|
|
7418
|
+
const tokenPattern = /`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*]+)\*|_([^_]+)_/g;
|
|
7419
|
+
let match;
|
|
7420
|
+
while ((match = tokenPattern.exec(text)) !== null) {
|
|
7421
|
+
html += escapeHtml$3(text.slice(lastIndex, match.index));
|
|
7422
|
+
if (match[1]) html += `<code>${escapeHtml$3(match[1])}</code>`;
|
|
7423
|
+
else if (match[2] && match[3]) html += `<a href="${escapeHtml$3(match[3])}">${renderInlineHtml(match[2])}</a>`;
|
|
7424
|
+
else if (match[4] || match[5]) {
|
|
7425
|
+
const strongText = match[4] ?? match[5] ?? "";
|
|
7426
|
+
html += `<strong>${renderInlineHtml(strongText)}</strong>`;
|
|
7427
|
+
} else if (match[6] || match[7]) {
|
|
7428
|
+
const emphasisText = match[6] ?? match[7] ?? "";
|
|
7429
|
+
html += `<em>${renderInlineHtml(emphasisText)}</em>`;
|
|
7430
|
+
}
|
|
7431
|
+
lastIndex = match.index + match[0].length;
|
|
7432
|
+
}
|
|
7433
|
+
html += escapeHtml$3(text.slice(lastIndex));
|
|
7434
|
+
return html.replace(/\n/g, "<br>");
|
|
7435
|
+
}
|
|
7436
|
+
function isFenceStart(line) {
|
|
7437
|
+
return /^```([\w-]+)?\s*$/.exec(line.trim());
|
|
7438
|
+
}
|
|
7439
|
+
function isHeading(line) {
|
|
7440
|
+
return /^(#{1,6})\s+(.*)$/.exec(line.trim());
|
|
7441
|
+
}
|
|
7442
|
+
function isOrderedListItem(line) {
|
|
7443
|
+
return /^\d+\.\s+(.*)$/.exec(line.trim());
|
|
7444
|
+
}
|
|
7445
|
+
function isUnorderedListItem(line) {
|
|
7446
|
+
return /^[-*+]\s+(.*)$/.exec(line.trim());
|
|
7447
|
+
}
|
|
7448
|
+
function isMarkdownBlockStart(line) {
|
|
7449
|
+
return Boolean(isFenceStart(line) || isHeading(line) || isOrderedListItem(line) || isUnorderedListItem(line));
|
|
7450
|
+
}
|
|
7451
|
+
function renderMarkdownBlocksHtml(text) {
|
|
7452
|
+
const lines = text.split(/\r?\n/);
|
|
7453
|
+
const blocks = [];
|
|
7454
|
+
let index = 0;
|
|
7455
|
+
while (index < lines.length) {
|
|
7456
|
+
const line = lines[index];
|
|
7457
|
+
const trimmed = line.trim();
|
|
7458
|
+
if (!trimmed) {
|
|
7459
|
+
index++;
|
|
7460
|
+
continue;
|
|
7461
|
+
}
|
|
7462
|
+
const fenceMatch = isFenceStart(line);
|
|
7463
|
+
if (fenceMatch) {
|
|
7464
|
+
const language = fenceMatch[1] || "text";
|
|
7465
|
+
const codeLines = [];
|
|
7466
|
+
index++;
|
|
7467
|
+
while (index < lines.length && !lines[index].trim().startsWith("```")) {
|
|
7468
|
+
codeLines.push(lines[index]);
|
|
7469
|
+
index++;
|
|
7470
|
+
}
|
|
7471
|
+
if (index < lines.length) index++;
|
|
7472
|
+
blocks.push(renderCodeBlockHtml(codeLines.join("\n"), language));
|
|
7473
|
+
continue;
|
|
7474
|
+
}
|
|
7475
|
+
const headingMatch = isHeading(line);
|
|
7476
|
+
if (headingMatch) {
|
|
7477
|
+
const level = Math.min(headingMatch[1].length, 6);
|
|
7478
|
+
blocks.push(`<h${level}>${renderInlineHtml(headingMatch[2].trim())}</h${level}>`);
|
|
7479
|
+
index++;
|
|
7480
|
+
continue;
|
|
7481
|
+
}
|
|
7482
|
+
if (isOrderedListItem(line)) {
|
|
7483
|
+
const items = [];
|
|
7484
|
+
while (index < lines.length) {
|
|
7485
|
+
const currentLine = lines[index];
|
|
7486
|
+
const currentMatch = isOrderedListItem(currentLine);
|
|
7487
|
+
if (!currentMatch) break;
|
|
7488
|
+
const itemLines = [currentMatch[1].trim()];
|
|
7489
|
+
index++;
|
|
7490
|
+
while (index < lines.length) {
|
|
7491
|
+
const continuation = lines[index];
|
|
7492
|
+
const continuationTrimmed = continuation.trim();
|
|
7493
|
+
if (!continuationTrimmed || isMarkdownBlockStart(continuation) || /^ {0,1}\d+\.\s+/.test(continuationTrimmed)) break;
|
|
7494
|
+
itemLines.push(continuationTrimmed);
|
|
7495
|
+
index++;
|
|
7496
|
+
}
|
|
7497
|
+
items.push(`<li>${renderInlineHtml(itemLines.join(" "))}</li>`);
|
|
7498
|
+
if (index < lines.length && !lines[index].trim()) break;
|
|
7499
|
+
}
|
|
7500
|
+
blocks.push(`<ol>\n${items.join("\n")}\n</ol>`);
|
|
7501
|
+
continue;
|
|
7502
|
+
}
|
|
7503
|
+
if (isUnorderedListItem(line)) {
|
|
7504
|
+
const items = [];
|
|
7505
|
+
while (index < lines.length) {
|
|
7506
|
+
const currentLine = lines[index];
|
|
7507
|
+
const currentMatch = isUnorderedListItem(currentLine);
|
|
7508
|
+
if (!currentMatch) break;
|
|
7509
|
+
const itemLines = [currentMatch[1].trim()];
|
|
7510
|
+
index++;
|
|
7511
|
+
while (index < lines.length) {
|
|
7512
|
+
const continuation = lines[index];
|
|
7513
|
+
const continuationTrimmed = continuation.trim();
|
|
7514
|
+
if (!continuationTrimmed || isMarkdownBlockStart(continuation) || /^[-*+]\s+/.test(continuationTrimmed)) break;
|
|
7515
|
+
itemLines.push(continuationTrimmed);
|
|
7516
|
+
index++;
|
|
7517
|
+
}
|
|
7518
|
+
items.push(`<li>${renderInlineHtml(itemLines.join(" "))}</li>`);
|
|
7519
|
+
if (index < lines.length && !lines[index].trim()) break;
|
|
7520
|
+
}
|
|
7521
|
+
blocks.push(`<ul>\n${items.join("\n")}\n</ul>`);
|
|
7522
|
+
continue;
|
|
7523
|
+
}
|
|
7524
|
+
const paragraphLines = [trimmed];
|
|
7525
|
+
index++;
|
|
7526
|
+
while (index < lines.length) {
|
|
7527
|
+
const nextLine = lines[index];
|
|
7528
|
+
const nextTrimmed = nextLine.trim();
|
|
7529
|
+
if (!nextTrimmed || isMarkdownBlockStart(nextLine)) break;
|
|
7530
|
+
paragraphLines.push(nextTrimmed);
|
|
7531
|
+
index++;
|
|
7532
|
+
}
|
|
7533
|
+
blocks.push(`<p>${renderInlineHtml(paragraphLines.join(" "))}</p>`);
|
|
7534
|
+
}
|
|
7535
|
+
return `<div class="ox-api-entry__prose">\n${blocks.join("\n")}\n</div>`;
|
|
7536
|
+
}
|
|
7537
|
+
function renderCodeBlockHtml(code, language = "typescript") {
|
|
7538
|
+
return `<pre><code class="language-${language}">${escapeHtml$3(code)}</code></pre>`;
|
|
7539
|
+
}
|
|
7540
|
+
function renderHighlightedInlineCodeHtml(code, className, language = "typescript") {
|
|
7541
|
+
return `<code class="${escapeHtml$3(className)} language-${language}">${escapeHtml$3(code)}</code>`;
|
|
7542
|
+
}
|
|
7543
|
+
function renderDetailsControlsHtml(targetSelector) {
|
|
7544
|
+
return `<div class="ox-api-controls" data-ox-api-target="${targetSelector}" role="toolbar" aria-label="Reference display controls">
|
|
7545
|
+
<button type="button" class="ox-api-controls__button" data-ox-api-toggle="expand">Open all</button>
|
|
7546
|
+
<button type="button" class="ox-api-controls__button" data-ox-api-toggle="collapse">Close all</button>
|
|
7547
|
+
</div>`;
|
|
7548
|
+
}
|
|
7549
|
+
function buildDocsData(docs) {
|
|
7550
|
+
return {
|
|
7551
|
+
version: 1,
|
|
7552
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7553
|
+
modules: docs
|
|
7554
|
+
};
|
|
7555
|
+
}
|
|
7435
7556
|
/**
|
|
7436
7557
|
* Extracts JSDoc documentation from source files in specified directories.
|
|
7437
7558
|
*
|
|
@@ -7498,11 +7619,13 @@ const JSDOC_BLOCK = /^[ \t]*\/\*\*\s*([\s\S]*?)\s*\*\//gm;
|
|
|
7498
7619
|
* ```
|
|
7499
7620
|
*/
|
|
7500
7621
|
async function extractDocs(srcDirs, options) {
|
|
7622
|
+
const extractFileDocs = (await importNapiModule()).extractFileDocs;
|
|
7623
|
+
if (!extractFileDocs) throw new Error("[ox-content] extractFileDocs is not available from @ox-content/napi.");
|
|
7501
7624
|
const results = [];
|
|
7502
7625
|
for (const srcDir of srcDirs) {
|
|
7503
7626
|
const files = await findFiles(srcDir, options);
|
|
7504
7627
|
for (const file of files) {
|
|
7505
|
-
const entries =
|
|
7628
|
+
const entries = extractFileDocs(file, options.private).map(parseNapiDocItem).filter((entry) => Boolean(entry));
|
|
7506
7629
|
if (entries.length > 0) results.push({
|
|
7507
7630
|
file,
|
|
7508
7631
|
entries
|
|
@@ -7526,7 +7649,7 @@ async function findFiles(dir, options) {
|
|
|
7526
7649
|
return;
|
|
7527
7650
|
}
|
|
7528
7651
|
for (const entry of entries) {
|
|
7529
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
7652
|
+
const fullPath = path$1.join(currentDir, entry.name);
|
|
7530
7653
|
if (entry.isDirectory()) {
|
|
7531
7654
|
if (!isExcluded(fullPath, options.exclude)) await walk(fullPath);
|
|
7532
7655
|
} else if (entry.isFile()) {
|
|
@@ -7553,127 +7676,21 @@ function isExcluded(file, patterns) {
|
|
|
7553
7676
|
return false;
|
|
7554
7677
|
});
|
|
7555
7678
|
}
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
function extractFromContent(content, file, options) {
|
|
7560
|
-
const entries = [];
|
|
7561
|
-
let match;
|
|
7562
|
-
JSDOC_BLOCK.lastIndex = 0;
|
|
7563
|
-
while ((match = JSDOC_BLOCK.exec(content)) !== null) {
|
|
7564
|
-
const jsdocContent = match[1];
|
|
7565
|
-
const jsdocEnd = match.index + match[0].length;
|
|
7566
|
-
const afterJsdoc = content.slice(jsdocEnd).trim();
|
|
7567
|
-
const lineNumber = content.slice(0, match.index).split("\n").length;
|
|
7568
|
-
const entry = parseJsdocBlock(jsdocContent, afterJsdoc, file, lineNumber);
|
|
7569
|
-
if (entry && (options.private || !entry.private)) entries.push(entry);
|
|
7570
|
-
}
|
|
7571
|
-
return entries;
|
|
7572
|
-
}
|
|
7573
|
-
/**
|
|
7574
|
-
* Extracts the complete function signature for display.
|
|
7575
|
-
*
|
|
7576
|
-
* Captures the full function declaration from `export/async/function name(...): ReturnType`
|
|
7577
|
-
* or `export const name = (...): ReturnType => {}`, handling multi-line signatures.
|
|
7578
|
-
*
|
|
7579
|
-
* @param signature - Multi-line function declaration text
|
|
7580
|
-
* @returns Cleaned function signature or undefined if not found
|
|
7581
|
-
*
|
|
7582
|
-
* @internal
|
|
7583
|
-
*/
|
|
7584
|
-
function extractFunctionSignature(signature) {
|
|
7585
|
-
const match = signature.match(/(?:export\s+)?(?:async\s+)?(?:function\s+\w+|\w+\s*=\s*(?:async\s*)?\()\([^{]*?\)(?:\s*:\s*[^{;]+)?/s);
|
|
7586
|
-
if (match) {
|
|
7587
|
-
let sig = match[0].trim();
|
|
7588
|
-
sig = sig.split("\n").map((line) => line.trim()).filter((line) => line).join("\n ");
|
|
7589
|
-
return sig;
|
|
7590
|
-
}
|
|
7591
|
-
}
|
|
7592
|
-
/**
|
|
7593
|
-
* Extracts parameter and return types from a TypeScript function signature.
|
|
7594
|
-
*
|
|
7595
|
-
* Parses function signatures to extract:
|
|
7596
|
-
* - Parameter names and their type annotations
|
|
7597
|
-
* - Return type annotation
|
|
7598
|
-
*
|
|
7599
|
-
* Handles various function declaration styles:
|
|
7600
|
-
* - `function name(param: type): ReturnType`
|
|
7601
|
-
* - `const name = (param: type): ReturnType => {}`
|
|
7602
|
-
* - `export async function name(param: type): Promise<ReturnType>`
|
|
7603
|
-
*
|
|
7604
|
-
* @param signature - Multi-line function signature text
|
|
7605
|
-
* @param params - Array of parameter docs with names already extracted
|
|
7606
|
-
* @returns Object with extracted parameter types and return type
|
|
7607
|
-
*
|
|
7608
|
-
* @internal
|
|
7609
|
-
*/
|
|
7610
|
-
function extractTypesFromSignature(signature, _params) {
|
|
7611
|
-
const paramTypes = [];
|
|
7612
|
-
const paramListMatch = signature.match(/\(([^)]*)\)(?:\s*:\s*([^{=>]+))?/s);
|
|
7613
|
-
if (paramListMatch && paramListMatch[1]) {
|
|
7614
|
-
const paramListStr = paramListMatch[1];
|
|
7615
|
-
const paramParts = splitParameters(paramListStr);
|
|
7616
|
-
for (const part of paramParts) {
|
|
7617
|
-
const trimmed = part.trim();
|
|
7618
|
-
if (!trimmed) continue;
|
|
7619
|
-
const typeMatch = /:\s*(.+?)(?:\s*=|$)/.exec(trimmed);
|
|
7620
|
-
if (typeMatch) {
|
|
7621
|
-
let typeStr = typeMatch[1].trim();
|
|
7622
|
-
if (typeStr.includes("=")) typeStr = typeStr.split("=")[0].trim();
|
|
7623
|
-
paramTypes.push(typeStr);
|
|
7624
|
-
}
|
|
7625
|
-
}
|
|
7626
|
-
}
|
|
7627
|
-
let returnType;
|
|
7628
|
-
const returnTypeMatch = signature.match(/\)\s*:\s*(.+?)(?={|$)/);
|
|
7629
|
-
if (returnTypeMatch) returnType = returnTypeMatch[1].trim();
|
|
7630
|
-
return {
|
|
7631
|
-
paramTypes,
|
|
7632
|
-
returnType
|
|
7633
|
-
};
|
|
7634
|
-
}
|
|
7635
|
-
/**
|
|
7636
|
-
* Splits function parameters while respecting nested angle brackets (generics).
|
|
7637
|
-
*
|
|
7638
|
-
* Handles cases like:
|
|
7639
|
-
* - `a: string, b: number` → `["a: string", "b: number"]`
|
|
7640
|
-
* - `a: Promise<string>, b: Record<string, any>` → `["a: Promise<string>", "b: Record<string, any>"]`
|
|
7641
|
-
*
|
|
7642
|
-
* @param paramListStr - String containing all parameters
|
|
7643
|
-
* @returns Array of individual parameter strings
|
|
7644
|
-
*
|
|
7645
|
-
* @internal
|
|
7646
|
-
*/
|
|
7647
|
-
function splitParameters(paramListStr) {
|
|
7648
|
-
const parts = [];
|
|
7649
|
-
let current = "";
|
|
7650
|
-
let depth = 0;
|
|
7651
|
-
for (const char of paramListStr) if (char === "<") {
|
|
7652
|
-
depth++;
|
|
7653
|
-
current += char;
|
|
7654
|
-
} else if (char === ">") {
|
|
7655
|
-
depth--;
|
|
7656
|
-
current += char;
|
|
7657
|
-
} else if (char === "," && depth === 0) {
|
|
7658
|
-
parts.push(current);
|
|
7659
|
-
current = "";
|
|
7660
|
-
} else current += char;
|
|
7661
|
-
if (current) parts.push(current);
|
|
7662
|
-
return parts;
|
|
7663
|
-
}
|
|
7664
|
-
/**
|
|
7665
|
-
* Parses a JSDoc block and the following declaration.
|
|
7666
|
-
* Only matches if the declaration is immediately after the JSDoc (with only whitespace/keywords between).
|
|
7667
|
-
*/
|
|
7668
|
-
function parseJsdocBlock(jsdoc, declaration, file, line) {
|
|
7679
|
+
function parseNapiDocItem(item) {
|
|
7680
|
+
const kind = normalizeNapiKind(item.kind);
|
|
7681
|
+
if (!kind) return null;
|
|
7669
7682
|
const params = [];
|
|
7670
7683
|
const examples = [];
|
|
7671
7684
|
const tags = {};
|
|
7672
7685
|
let description = "";
|
|
7673
7686
|
let returns;
|
|
7674
7687
|
let isPrivate = false;
|
|
7675
|
-
const rawLines = jsdoc.split("\n").map((
|
|
7676
|
-
|
|
7688
|
+
const rawLines = (item.jsdoc ?? "").split("\n").map((line) => {
|
|
7689
|
+
const trimmedStart = line.trimStart();
|
|
7690
|
+
const withoutStar = trimmedStart.startsWith("*") ? trimmedStart.slice(1) : trimmedStart;
|
|
7691
|
+
return withoutStar.startsWith(" ") ? withoutStar.slice(1) : withoutStar;
|
|
7692
|
+
});
|
|
7693
|
+
const cleanedLines = rawLines.map((line) => line.trim()).filter(Boolean);
|
|
7677
7694
|
let currentExample = "";
|
|
7678
7695
|
let inExample = false;
|
|
7679
7696
|
let rawLineIndex = 0;
|
|
@@ -7720,47 +7737,40 @@ function parseJsdocBlock(jsdoc, declaration, file, line) {
|
|
|
7720
7737
|
else description += "\n" + lineText;
|
|
7721
7738
|
}
|
|
7722
7739
|
if (inExample && currentExample) examples.push(currentExample.trim());
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
}
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
}
|
|
7755
|
-
if (signatureTypes.returnType && (!returns || returns.type === "unknown")) if (returns) returns.type = signatureTypes.returnType;
|
|
7756
|
-
else returns = {
|
|
7757
|
-
type: signatureTypes.returnType,
|
|
7758
|
-
description: ""
|
|
7759
|
-
};
|
|
7760
|
-
signature = extractFunctionSignature(firstFewLines);
|
|
7740
|
+
if (params.length === 0 && item.params.length > 0) params.push(...item.params.map((param) => ({
|
|
7741
|
+
name: param.name,
|
|
7742
|
+
type: param.typeAnnotation ?? "unknown",
|
|
7743
|
+
description: param.description ?? "",
|
|
7744
|
+
optional: param.optional || void 0,
|
|
7745
|
+
default: param.defaultValue
|
|
7746
|
+
})));
|
|
7747
|
+
else if (item.params.length > 0) {
|
|
7748
|
+
const paramMap = new Map(item.params.map((param) => [param.name, param]));
|
|
7749
|
+
for (const param of params) {
|
|
7750
|
+
const rustParam = paramMap.get(param.name);
|
|
7751
|
+
if (!rustParam) continue;
|
|
7752
|
+
if (param.type === "unknown" && rustParam.typeAnnotation) param.type = rustParam.typeAnnotation;
|
|
7753
|
+
if (!param.description && rustParam.description) param.description = rustParam.description;
|
|
7754
|
+
if (param.optional === void 0 && rustParam.optional) param.optional = true;
|
|
7755
|
+
if (!param.default && rustParam.defaultValue) param.default = rustParam.defaultValue;
|
|
7756
|
+
}
|
|
7757
|
+
}
|
|
7758
|
+
if (!returns && item.returnType) returns = {
|
|
7759
|
+
type: item.returnType,
|
|
7760
|
+
description: ""
|
|
7761
|
+
};
|
|
7762
|
+
else if (returns && returns.type === "unknown" && item.returnType) returns.type = item.returnType;
|
|
7763
|
+
if (!description) description = item.doc ?? "";
|
|
7764
|
+
for (const tag of item.tags) {
|
|
7765
|
+
if (tag.tag === "param" || tag.tag === "returns" || tag.tag === "return" || tag.tag === "example") continue;
|
|
7766
|
+
if (tag.tag === "private") {
|
|
7767
|
+
isPrivate = true;
|
|
7768
|
+
continue;
|
|
7769
|
+
}
|
|
7770
|
+
if (!tags[tag.tag]) tags[tag.tag] = tag.value;
|
|
7761
7771
|
}
|
|
7762
7772
|
return {
|
|
7763
|
-
name,
|
|
7773
|
+
name: item.name,
|
|
7764
7774
|
kind,
|
|
7765
7775
|
description,
|
|
7766
7776
|
params: params.length > 0 ? params : void 0,
|
|
@@ -7768,121 +7778,214 @@ function parseJsdocBlock(jsdoc, declaration, file, line) {
|
|
|
7768
7778
|
examples: examples.length > 0 ? examples : void 0,
|
|
7769
7779
|
tags: Object.keys(tags).length > 0 ? tags : void 0,
|
|
7770
7780
|
private: isPrivate,
|
|
7771
|
-
file,
|
|
7772
|
-
line,
|
|
7773
|
-
|
|
7781
|
+
file: item.sourcePath,
|
|
7782
|
+
line: item.line,
|
|
7783
|
+
endLine: item.endLine,
|
|
7784
|
+
signature: item.signature
|
|
7774
7785
|
};
|
|
7775
7786
|
}
|
|
7787
|
+
function normalizeNapiKind(kind) {
|
|
7788
|
+
switch (kind) {
|
|
7789
|
+
case "function":
|
|
7790
|
+
case "class":
|
|
7791
|
+
case "interface":
|
|
7792
|
+
case "type":
|
|
7793
|
+
case "variable":
|
|
7794
|
+
case "module": return kind;
|
|
7795
|
+
case "enum": return "type";
|
|
7796
|
+
default: return null;
|
|
7797
|
+
}
|
|
7798
|
+
}
|
|
7776
7799
|
/**
|
|
7777
7800
|
* Generates Markdown documentation from extracted docs.
|
|
7778
7801
|
*/
|
|
7779
7802
|
function generateMarkdown(docs, options) {
|
|
7780
7803
|
const result = {};
|
|
7781
|
-
const
|
|
7804
|
+
const sortedDocs = sortExtractedDocs(docs);
|
|
7805
|
+
const symbolMap = buildSymbolMap(sortedDocs);
|
|
7782
7806
|
if (options.groupBy === "file") {
|
|
7783
7807
|
const docToFile = /* @__PURE__ */ new Map();
|
|
7784
|
-
for (const doc of
|
|
7785
|
-
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7808
|
+
for (const doc of sortedDocs) {
|
|
7809
|
+
let fileName = path$1.basename(doc.file, path$1.extname(doc.file));
|
|
7786
7810
|
if (fileName === "index") fileName = "index-module";
|
|
7787
7811
|
docToFile.set(doc, fileName);
|
|
7788
7812
|
const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);
|
|
7789
7813
|
result[`${fileName}.md`] = markdown;
|
|
7790
7814
|
}
|
|
7791
|
-
result["index.md"] = generateIndex(
|
|
7815
|
+
result["index.md"] = generateIndex(sortedDocs, docToFile);
|
|
7792
7816
|
} else {
|
|
7793
7817
|
const byKind = /* @__PURE__ */ new Map();
|
|
7794
|
-
for (const doc of
|
|
7818
|
+
for (const doc of sortedDocs) for (const entry of doc.entries) {
|
|
7795
7819
|
const existing = byKind.get(entry.kind) || [];
|
|
7796
7820
|
existing.push(entry);
|
|
7797
7821
|
byKind.set(entry.kind, existing);
|
|
7798
7822
|
}
|
|
7799
|
-
for (const
|
|
7823
|
+
for (const entries of byKind.values()) entries.sort(compareEntriesByName);
|
|
7824
|
+
for (const [kind, entries] of [...byKind.entries()].sort(([a], [b]) => compareStrings(a, b))) result[`${kind}s.md`] = generateCategoryMarkdown(kind, entries, options, symbolMap);
|
|
7800
7825
|
result["index.md"] = generateCategoryIndex(byKind);
|
|
7801
7826
|
}
|
|
7802
7827
|
return result;
|
|
7803
7828
|
}
|
|
7829
|
+
function compareStrings(a, b) {
|
|
7830
|
+
return a.localeCompare(b, "en", {
|
|
7831
|
+
numeric: true,
|
|
7832
|
+
sensitivity: "base"
|
|
7833
|
+
});
|
|
7834
|
+
}
|
|
7835
|
+
function compareEntriesByName(a, b) {
|
|
7836
|
+
return compareStrings(a.name, b.name);
|
|
7837
|
+
}
|
|
7838
|
+
function sortExtractedDocs(docs) {
|
|
7839
|
+
return [...docs].map((doc) => ({
|
|
7840
|
+
...doc,
|
|
7841
|
+
entries: [...doc.entries].sort(compareEntriesByName)
|
|
7842
|
+
})).sort((a, b) => compareStrings(path$1.basename(a.file), path$1.basename(b.file)));
|
|
7843
|
+
}
|
|
7804
7844
|
function generateFileMarkdown(doc, options, currentFileName, symbolMap) {
|
|
7805
|
-
let md = `# ${path.basename(doc.file)}\n\n`;
|
|
7845
|
+
let md = `# ${path$1.basename(doc.file)}\n\n`;
|
|
7806
7846
|
if (options.githubUrl) {
|
|
7807
7847
|
const sourceLink = generateSourceLink(doc.file, options.githubUrl);
|
|
7808
7848
|
if (sourceLink) md += sourceLink + "\n\n";
|
|
7809
7849
|
}
|
|
7850
|
+
md += `> ${doc.entries.length} documented symbol${doc.entries.length === 1 ? "" : "s"}. `;
|
|
7851
|
+
md += "Read the signatures first, then expand each item for parameters, return types, and examples.\n\n";
|
|
7852
|
+
md += "## Reference\n\n";
|
|
7853
|
+
if (doc.entries.length > 1) md += renderDetailsControlsHtml(".ox-api-entry") + "\n\n";
|
|
7810
7854
|
for (const entry of doc.entries) md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);
|
|
7811
7855
|
return md;
|
|
7812
7856
|
}
|
|
7857
|
+
function normalizeSignature(signature) {
|
|
7858
|
+
if (!signature) return;
|
|
7859
|
+
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();
|
|
7860
|
+
}
|
|
7861
|
+
function formatKindLabel(kind) {
|
|
7862
|
+
switch (kind) {
|
|
7863
|
+
case "function": return "fn";
|
|
7864
|
+
case "interface": return "interface";
|
|
7865
|
+
case "class": return "class";
|
|
7866
|
+
case "type": return "type";
|
|
7867
|
+
case "const": return "const";
|
|
7868
|
+
default: return kind;
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
function renderOverviewLine(entry, href) {
|
|
7872
|
+
const signature = normalizeSignature(entry.signature);
|
|
7873
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7874
|
+
const parts = [`- [\`${entry.name}\`](${href})`, `\`${entry.kind}\``];
|
|
7875
|
+
if (signature) parts.push(`\`${signature}\``);
|
|
7876
|
+
if (summary) parts.push(`- ${summary}`);
|
|
7877
|
+
return `${parts.join(" ")}\n`;
|
|
7878
|
+
}
|
|
7879
|
+
function renderOverviewHtmlItem(entry, href) {
|
|
7880
|
+
const signature = normalizeSignature(entry.signature);
|
|
7881
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7882
|
+
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>`;
|
|
7883
|
+
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>`;
|
|
7884
|
+
}
|
|
7885
|
+
function renderParamsListHtml(params) {
|
|
7886
|
+
return `<div class="ox-api-entry__section ox-api-entry__section--params">
|
|
7887
|
+
<h4>Parameters</h4>
|
|
7888
|
+
<ul class="ox-api-entry__params">
|
|
7889
|
+
${params.map((param) => {
|
|
7890
|
+
const flags = [param.optional ? "optional" : "", param.default ? `default: ${param.default}` : ""].filter(Boolean);
|
|
7891
|
+
const description = [param.description, flags.join(" · ")].filter(Boolean).join(" — ");
|
|
7892
|
+
return `<li class="ox-api-entry__param">
|
|
7893
|
+
<div class="ox-api-entry__param-heading">
|
|
7894
|
+
<code class="ox-api-entry__param-name">${escapeHtml$3(param.name)}</code>
|
|
7895
|
+
<code class="ox-api-entry__param-type">${escapeHtml$3(param.type)}</code>
|
|
7896
|
+
</div>
|
|
7897
|
+
${description ? `<p class="ox-api-entry__param-description">${renderInlineHtml(description)}</p>` : ""}
|
|
7898
|
+
</li>`;
|
|
7899
|
+
}).join("\n")}
|
|
7900
|
+
</ul>
|
|
7901
|
+
</div>`;
|
|
7902
|
+
}
|
|
7903
|
+
function renderTagListHtml(tags) {
|
|
7904
|
+
return `<div class="ox-api-entry__section ox-api-entry__section--tags">
|
|
7905
|
+
<h4>Tags</h4>
|
|
7906
|
+
<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>
|
|
7907
|
+
</div>`;
|
|
7908
|
+
}
|
|
7813
7909
|
function generateEntryMarkdown(entry, options, currentFileName, symbolMap) {
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
}
|
|
7820
|
-
if (
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
}
|
|
7829
|
-
if (entry.params && entry.params.length > 0) {
|
|
7830
|
-
md += "### Parameters\n\n";
|
|
7831
|
-
md += "| Name | Type | Description |\n";
|
|
7832
|
-
md += "|------|------|-------------|\n";
|
|
7833
|
-
for (const param of entry.params) md += `| \`${param.name}\` | \`${param.type}\` | ${param.description} |\n`;
|
|
7834
|
-
md += "\n";
|
|
7835
|
-
}
|
|
7836
|
-
if (entry.returns) {
|
|
7837
|
-
md += "### Returns\n\n";
|
|
7838
|
-
md += `\`${entry.returns.type}\` - ${entry.returns.description}\n\n`;
|
|
7839
|
-
}
|
|
7910
|
+
const processedDescription = entry.description && currentFileName && symbolMap ? convertSymbolLinks(entry.description, currentFileName, symbolMap) : entry.description;
|
|
7911
|
+
const summarySignature = normalizeSignature(entry.signature);
|
|
7912
|
+
const sourceHref = options?.githubUrl ? generateSourceHref(entry.file, options.githubUrl, entry.line, entry.endLine) : void 0;
|
|
7913
|
+
let body = "";
|
|
7914
|
+
if (processedDescription) body += renderMarkdownBlocksHtml(processedDescription) + "\n";
|
|
7915
|
+
if (sourceHref) body += `<p class="ox-api-entry__source"><a href="${escapeHtml$3(sourceHref)}">View source</a></p>\n`;
|
|
7916
|
+
if (entry.params && entry.params.length > 0) body += renderParamsListHtml(entry.params) + "\n";
|
|
7917
|
+
if (entry.returns) body += `<div class="ox-api-entry__section ox-api-entry__section--returns">
|
|
7918
|
+
<h4>Returns</h4>
|
|
7919
|
+
<div class="ox-api-entry__return">
|
|
7920
|
+
<code class="ox-api-entry__return-type">${escapeHtml$3(entry.returns.type)}</code>
|
|
7921
|
+
${entry.returns.description ? `<p class="ox-api-entry__return-description">${renderInlineHtml(entry.returns.description)}</p>` : ""}
|
|
7922
|
+
</div>
|
|
7923
|
+
</div>\n`;
|
|
7840
7924
|
if (entry.examples && entry.examples.length > 0) {
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
}
|
|
7848
|
-
|
|
7849
|
-
|
|
7925
|
+
const examplesHtml = entry.examples.map((example) => example.replace(/^```\w*\n?/, "").replace(/\n?```$/, "")).map((example) => renderCodeBlockHtml(example, "ts")).join("\n");
|
|
7926
|
+
body += `<div class="ox-api-entry__section ox-api-entry__section--examples">\n<h4>Examples</h4>\n${examplesHtml}\n</div>\n`;
|
|
7927
|
+
}
|
|
7928
|
+
if (entry.tags && Object.keys(entry.tags).length > 0) body += renderTagListHtml(entry.tags) + "\n";
|
|
7929
|
+
const summaryDescription = cleanSummaryText(processedDescription, summarySignature ? 80 : 120);
|
|
7930
|
+
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>`;
|
|
7931
|
+
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>`];
|
|
7932
|
+
return `<details id="${entryAnchor(entry.name)}" class="ox-api-entry">
|
|
7933
|
+
<summary>${summaryParts.join("")}</summary>
|
|
7934
|
+
<div class="ox-api-entry__body">
|
|
7935
|
+
${body.trim()}
|
|
7936
|
+
</div>
|
|
7937
|
+
</details>
|
|
7938
|
+
|
|
7939
|
+
`;
|
|
7850
7940
|
}
|
|
7851
7941
|
function generateIndex(docs, docToFile) {
|
|
7852
7942
|
let md = "# API Documentation\n\n";
|
|
7853
7943
|
md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
|
|
7944
|
+
md += "> Use search scopes like `@api transform` to limit results to the generated API reference.\n\n";
|
|
7854
7945
|
md += "## Modules\n\n";
|
|
7946
|
+
if (docs.length > 1) md += renderDetailsControlsHtml(".ox-api-module") + "\n\n";
|
|
7855
7947
|
for (const doc of docs) {
|
|
7856
|
-
const displayName = path.basename(doc.file, path.extname(doc.file));
|
|
7948
|
+
const displayName = path$1.basename(doc.file, path$1.extname(doc.file));
|
|
7857
7949
|
let fileName = displayName;
|
|
7858
7950
|
if (docToFile && docToFile.has(doc)) fileName = docToFile.get(doc);
|
|
7859
7951
|
else if (fileName === "index") fileName = "index-module";
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7952
|
+
const countLabel = `${doc.entries.length} symbol${doc.entries.length === 1 ? "" : "s"}`;
|
|
7953
|
+
md += `<details class="ox-api-module">
|
|
7954
|
+
<summary>
|
|
7955
|
+
<span class="ox-api-module__title"><a href="./${fileName}.md">${escapeHtml$3(displayName)}</a></span>
|
|
7956
|
+
<span class="ox-api-module__count">${countLabel}</span>
|
|
7957
|
+
</summary>
|
|
7958
|
+
<div class="ox-api-module__body">
|
|
7959
|
+
<ul class="ox-api-module__list">
|
|
7960
|
+
`;
|
|
7961
|
+
for (const entry of doc.entries) md += ` ${renderOverviewHtmlItem(entry, `./${fileName}.md#${entryAnchor(entry.name)}`)}\n`;
|
|
7962
|
+
md += ` </ul>
|
|
7963
|
+
</div>
|
|
7964
|
+
</details>
|
|
7965
|
+
|
|
7966
|
+
`;
|
|
7867
7967
|
}
|
|
7868
7968
|
return md;
|
|
7869
7969
|
}
|
|
7870
7970
|
function generateCategoryMarkdown(kind, entries, options, symbolMap) {
|
|
7871
7971
|
const categoryFileName = `${kind}s`;
|
|
7872
7972
|
let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\n\n`;
|
|
7973
|
+
md += `> ${entries.length} documented ${kind}${entries.length === 1 ? "" : "s"} collected across modules.\n\n`;
|
|
7974
|
+
md += "## Overview\n\n";
|
|
7975
|
+
for (const entry of entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
|
|
7976
|
+
md += "\n## Reference\n\n";
|
|
7977
|
+
if (entries.length > 1) md += renderDetailsControlsHtml(".ox-api-entry") + "\n\n";
|
|
7873
7978
|
for (const entry of entries) md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);
|
|
7874
7979
|
return md;
|
|
7875
7980
|
}
|
|
7876
7981
|
function generateCategoryIndex(byKind) {
|
|
7877
7982
|
let md = "# API Documentation\n\n";
|
|
7878
7983
|
md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
|
|
7879
|
-
for (const [kind, entries] of byKind) {
|
|
7984
|
+
for (const [kind, entries] of [...byKind.entries()].sort(([a], [b]) => compareStrings(a, b))) {
|
|
7880
7985
|
const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + "s";
|
|
7881
7986
|
md += `## [${kindTitle}](./${kind}s.md)\n\n`;
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
md += `- **${entry.name}** - ${desc}...\n`;
|
|
7885
|
-
}
|
|
7987
|
+
md += `> ${entries.length} item${entries.length === 1 ? "" : "s"}.\n\n`;
|
|
7988
|
+
for (const entry of entries) md += renderOverviewLine(entry, `./${kind}s.md#${entryAnchor(entry.name)}`);
|
|
7886
7989
|
md += "\n";
|
|
7887
7990
|
}
|
|
7888
7991
|
return md;
|
|
@@ -7923,7 +8026,7 @@ function convertSymbolLinks(text, currentFileName, symbolMap) {
|
|
|
7923
8026
|
function buildSymbolMap(docs) {
|
|
7924
8027
|
const map = /* @__PURE__ */ new Map();
|
|
7925
8028
|
for (const doc of docs) {
|
|
7926
|
-
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
8029
|
+
let fileName = path$1.basename(doc.file, path$1.extname(doc.file));
|
|
7927
8030
|
if (fileName === "index") fileName = "index-module";
|
|
7928
8031
|
for (const entry of doc.entries) map.set(entry.name, {
|
|
7929
8032
|
name: entry.name,
|
|
@@ -7940,7 +8043,8 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7940
8043
|
await fs$1.promises.mkdir(outDir, { recursive: true });
|
|
7941
8044
|
const generatedFiles = new Set(Object.keys(docs));
|
|
7942
8045
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") generatedFiles.add("nav.ts");
|
|
7943
|
-
|
|
8046
|
+
if (extractedDocs) generatedFiles.add(DOCS_DATA_FILE);
|
|
8047
|
+
const manifestPath = path$1.join(outDir, DOCS_MANIFEST_FILE);
|
|
7944
8048
|
let previousFiles = [];
|
|
7945
8049
|
try {
|
|
7946
8050
|
previousFiles = JSON.parse(await fs$1.promises.readFile(manifestPath, "utf-8"));
|
|
@@ -7949,32 +8053,37 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7949
8053
|
}
|
|
7950
8054
|
for (const staleFile of previousFiles) {
|
|
7951
8055
|
if (generatedFiles.has(staleFile)) continue;
|
|
7952
|
-
await fs$1.promises.rm(path.join(outDir, staleFile), { force: true });
|
|
8056
|
+
await fs$1.promises.rm(path$1.join(outDir, staleFile), { force: true });
|
|
7953
8057
|
}
|
|
7954
8058
|
for (const [fileName, content] of Object.entries(docs)) {
|
|
7955
|
-
const filePath = path.join(outDir, fileName);
|
|
8059
|
+
const filePath = path$1.join(outDir, fileName);
|
|
7956
8060
|
await fs$1.promises.writeFile(filePath, content, "utf-8");
|
|
7957
8061
|
}
|
|
7958
8062
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") {
|
|
7959
8063
|
const navCode = generateNavCode(generateNavMetadata(extractedDocs, "/api"), "apiNav");
|
|
7960
|
-
const navFilePath = path.join(outDir, "nav.ts");
|
|
8064
|
+
const navFilePath = path$1.join(outDir, "nav.ts");
|
|
7961
8065
|
await fs$1.promises.writeFile(navFilePath, navCode, "utf-8");
|
|
7962
8066
|
}
|
|
8067
|
+
if (extractedDocs) await fs$1.promises.writeFile(path$1.join(outDir, DOCS_DATA_FILE), JSON.stringify(buildDocsData(extractedDocs), null, 2), "utf-8");
|
|
7963
8068
|
await fs$1.promises.writeFile(manifestPath, JSON.stringify([...generatedFiles].sort(), null, 2), "utf-8");
|
|
7964
8069
|
}
|
|
7965
8070
|
/**
|
|
7966
8071
|
* Resolves docs options with defaults.
|
|
7967
8072
|
*/
|
|
7968
8073
|
/**
|
|
7969
|
-
* Generates a GitHub source link for a file and optional line
|
|
8074
|
+
* Generates a GitHub source link for a file and optional line range.
|
|
7970
8075
|
*
|
|
7971
8076
|
* @param filePath - Full path to the source file
|
|
7972
8077
|
* @param githubUrl - Base GitHub repository URL
|
|
7973
|
-
* @param lineNumber - Optional line number to link to
|
|
7974
|
-
* @
|
|
8078
|
+
* @param lineNumber - Optional start line number to link to
|
|
8079
|
+
* @param endLineNumber - Optional end line number to link to
|
|
8080
|
+
* @returns Absolute GitHub URL to source code
|
|
7975
8081
|
*/
|
|
7976
|
-
function
|
|
7977
|
-
return
|
|
8082
|
+
function generateSourceHref(filePath, githubUrl, lineNumber, endLineNumber) {
|
|
8083
|
+
return `${githubUrl}/blob/main/${filePath.replace(/^.*?\/(npm|packages|crates|src)\//, "$1/")}${lineNumber ? endLineNumber && endLineNumber > lineNumber ? `#L${lineNumber}-L${endLineNumber}` : `#L${lineNumber}` : ""}`;
|
|
8084
|
+
}
|
|
8085
|
+
function generateSourceLink(filePath, githubUrl, lineNumber, endLineNumber) {
|
|
8086
|
+
return `**[Source](${generateSourceHref(filePath, githubUrl, lineNumber, endLineNumber)})**`;
|
|
7978
8087
|
}
|
|
7979
8088
|
function resolveDocsOptions(options) {
|
|
7980
8089
|
if (options === false) return false;
|
|
@@ -7997,7 +8106,6 @@ function resolveDocsOptions(options) {
|
|
|
7997
8106
|
generateNav: opts.generateNav ?? true
|
|
7998
8107
|
};
|
|
7999
8108
|
}
|
|
8000
|
-
|
|
8001
8109
|
//#endregion
|
|
8002
8110
|
//#region src/og-image/renderer.ts
|
|
8003
8111
|
/**
|
|
@@ -8042,10 +8150,10 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8042
8150
|
await route.continue();
|
|
8043
8151
|
return;
|
|
8044
8152
|
}
|
|
8045
|
-
const filePath = path.join(publicDir, url.pathname);
|
|
8153
|
+
const filePath = path$1.join(publicDir, url.pathname);
|
|
8046
8154
|
try {
|
|
8047
8155
|
const body = await fs.readFile(filePath);
|
|
8048
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
8156
|
+
const ext = path$1.extname(filePath).toLowerCase();
|
|
8049
8157
|
await route.fulfill({
|
|
8050
8158
|
body,
|
|
8051
8159
|
contentType: {
|
|
@@ -8080,7 +8188,6 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8080
8188
|
});
|
|
8081
8189
|
return Buffer.from(screenshot);
|
|
8082
8190
|
}
|
|
8083
|
-
|
|
8084
8191
|
//#endregion
|
|
8085
8192
|
//#region src/og-image/browser.ts
|
|
8086
8193
|
/**
|
|
@@ -8126,7 +8233,6 @@ async function openBrowser() {
|
|
|
8126
8233
|
return null;
|
|
8127
8234
|
}
|
|
8128
8235
|
}
|
|
8129
|
-
|
|
8130
8236
|
//#endregion
|
|
8131
8237
|
//#region src/og-image/template.ts
|
|
8132
8238
|
/**
|
|
@@ -8135,28 +8241,78 @@ async function openBrowser() {
|
|
|
8135
8241
|
function escapeHtml$2(str) {
|
|
8136
8242
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
8137
8243
|
}
|
|
8244
|
+
function normalizeBrandValue(str) {
|
|
8245
|
+
return str.replace(/\s+/g, "").toLowerCase();
|
|
8246
|
+
}
|
|
8247
|
+
function renderWordmarkSvg() {
|
|
8248
|
+
return `<svg width="430" height="102" viewBox="0 0 270 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8249
|
+
<defs>
|
|
8250
|
+
<linearGradient id="ogWordmarkGradient" x1="286" y1="10" x2="320" y2="54" gradientUnits="userSpaceOnUse">
|
|
8251
|
+
<stop offset="0%" stop-color="#355cff"/>
|
|
8252
|
+
<stop offset="100%" stop-color="#74c7ff"/>
|
|
8253
|
+
</linearGradient>
|
|
8254
|
+
</defs>
|
|
8255
|
+
<text
|
|
8256
|
+
x="2"
|
|
8257
|
+
y="43"
|
|
8258
|
+
fill="#eff6ff"
|
|
8259
|
+
font-family="IBM Plex Sans, IBM Plex Mono, Avenir Next, Segoe UI, sans-serif"
|
|
8260
|
+
font-size="34"
|
|
8261
|
+
font-weight="700"
|
|
8262
|
+
letter-spacing="-1.4"
|
|
8263
|
+
>
|
|
8264
|
+
OXCONTENT
|
|
8265
|
+
</text>
|
|
8266
|
+
<text
|
|
8267
|
+
x="213"
|
|
8268
|
+
y="43.5"
|
|
8269
|
+
fill="#eff6ff"
|
|
8270
|
+
font-family="IBM Plex Sans, IBM Plex Mono, Avenir Next, Segoe UI, sans-serif"
|
|
8271
|
+
font-size="40"
|
|
8272
|
+
font-weight="400"
|
|
8273
|
+
>
|
|
8274
|
+
(
|
|
8275
|
+
</text>
|
|
8276
|
+
<g transform="translate(216 9) scale(0.089) rotate(-7 256 256)">
|
|
8277
|
+
<path
|
|
8278
|
+
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"
|
|
8279
|
+
fill="url(#ogWordmarkGradient)"
|
|
8280
|
+
/>
|
|
8281
|
+
</g>
|
|
8282
|
+
<text
|
|
8283
|
+
x="252"
|
|
8284
|
+
y="43.5"
|
|
8285
|
+
fill="#eff6ff"
|
|
8286
|
+
font-family="IBM Plex Sans, IBM Plex Mono, Avenir Next, Segoe UI, sans-serif"
|
|
8287
|
+
font-size="40"
|
|
8288
|
+
font-weight="400"
|
|
8289
|
+
>
|
|
8290
|
+
)
|
|
8291
|
+
</text>
|
|
8292
|
+
</svg>`;
|
|
8293
|
+
}
|
|
8138
8294
|
/**
|
|
8139
8295
|
* Returns the built-in default template function.
|
|
8140
8296
|
*/
|
|
8141
8297
|
function getDefaultTemplate() {
|
|
8142
8298
|
return function defaultTemplate(props) {
|
|
8143
|
-
const { title, description, siteName
|
|
8144
|
-
const
|
|
8145
|
-
|
|
8146
|
-
|
|
8147
|
-
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8299
|
+
const { title, description, siteName } = props;
|
|
8300
|
+
const rawBrand = siteName?.trim() ? siteName : "Ox Content";
|
|
8301
|
+
const isBrandCard = normalizeBrandValue(title) === normalizeBrandValue(rawBrand);
|
|
8302
|
+
const heroTitle = isBrandCard ? "cargo doc for JavaScript" : title;
|
|
8303
|
+
const heroDescription = isBrandCard ? "Rust-powered docs and high-performance Markdown tooling." : description && description.trim().length > 0 ? description : "Rust-powered docs and Markdown tooling.";
|
|
8304
|
+
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>` : "";
|
|
8305
|
+
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;">
|
|
8306
|
+
<div style="position:relative;z-index:1;display:flex;flex-direction:column;height:100%;">
|
|
8307
|
+
<div style="display:flex;align-items:flex-start;">${renderWordmarkSvg()}</div>
|
|
8308
|
+
<div style="display:flex;flex-direction:column;justify-content:center;gap:24px;max-width:860px;flex:1;padding:22px 0 0;">
|
|
8309
|
+
<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>
|
|
8310
|
+
${descriptionHtml}
|
|
8311
|
+
</div>
|
|
8155
8312
|
</div>
|
|
8156
8313
|
</div>`;
|
|
8157
8314
|
};
|
|
8158
8315
|
}
|
|
8159
|
-
|
|
8160
8316
|
//#endregion
|
|
8161
8317
|
//#region src/og-image/cache.ts
|
|
8162
8318
|
/**
|
|
@@ -8182,7 +8338,7 @@ function computeCacheKey(templateSource, props, width, height) {
|
|
|
8182
8338
|
* Returns the cached file path if found, null otherwise.
|
|
8183
8339
|
*/
|
|
8184
8340
|
async function getCached(cacheDir, key) {
|
|
8185
|
-
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8341
|
+
const filePath = path$1.join(cacheDir, `${key}.png`);
|
|
8186
8342
|
try {
|
|
8187
8343
|
return await fs.readFile(filePath);
|
|
8188
8344
|
} catch {
|
|
@@ -8194,12 +8350,11 @@ async function getCached(cacheDir, key) {
|
|
|
8194
8350
|
*/
|
|
8195
8351
|
async function writeCache(cacheDir, key, png) {
|
|
8196
8352
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8197
|
-
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8353
|
+
const filePath = path$1.join(cacheDir, `${key}.png`);
|
|
8198
8354
|
await fs.writeFile(filePath, png);
|
|
8199
8355
|
}
|
|
8200
|
-
|
|
8201
8356
|
//#endregion
|
|
8202
|
-
//#region \0@oxc-project+runtime@0.
|
|
8357
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/usingCtx.js
|
|
8203
8358
|
function _usingCtx() {
|
|
8204
8359
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
8205
8360
|
var n = Error();
|
|
@@ -8254,7 +8409,6 @@ function _usingCtx() {
|
|
|
8254
8409
|
}
|
|
8255
8410
|
};
|
|
8256
8411
|
}
|
|
8257
|
-
|
|
8258
8412
|
//#endregion
|
|
8259
8413
|
//#region src/og-image/index.ts
|
|
8260
8414
|
/**
|
|
@@ -8287,14 +8441,14 @@ function resolveOgImageOptions(options) {
|
|
|
8287
8441
|
*/
|
|
8288
8442
|
async function resolveTemplate(options, root) {
|
|
8289
8443
|
if (!options.template) return getDefaultTemplate();
|
|
8290
|
-
const templatePath = path.resolve(root, options.template);
|
|
8444
|
+
const templatePath = path$1.resolve(root, options.template);
|
|
8291
8445
|
const fs = await import("fs/promises");
|
|
8292
8446
|
try {
|
|
8293
8447
|
await fs.access(templatePath);
|
|
8294
8448
|
} catch {
|
|
8295
8449
|
throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);
|
|
8296
8450
|
}
|
|
8297
|
-
switch (path.extname(templatePath).toLowerCase()) {
|
|
8451
|
+
switch (path$1.extname(templatePath).toLowerCase()) {
|
|
8298
8452
|
case ".vue": return resolveVueTemplate(templatePath, options, root);
|
|
8299
8453
|
case ".svelte": return resolveSvelteTemplate(templatePath, root);
|
|
8300
8454
|
case ".tsx":
|
|
@@ -8308,9 +8462,9 @@ async function resolveTemplate(options, root) {
|
|
|
8308
8462
|
async function resolveTsTemplate(templatePath, options, root) {
|
|
8309
8463
|
const fs = await import("fs/promises");
|
|
8310
8464
|
const { rolldown } = await import("rolldown");
|
|
8311
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8465
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8312
8466
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8313
|
-
const outfile = path.join(cacheDir, "_template.mjs");
|
|
8467
|
+
const outfile = path$1.join(cacheDir, "_template.mjs");
|
|
8314
8468
|
const bundle = await rolldown({
|
|
8315
8469
|
input: templatePath,
|
|
8316
8470
|
platform: "node"
|
|
@@ -8333,9 +8487,9 @@ async function resolveTsTemplate(templatePath, options, root) {
|
|
|
8333
8487
|
async function resolveVueTemplate(templatePath, options, root) {
|
|
8334
8488
|
const fs = await import("fs/promises");
|
|
8335
8489
|
const { rolldown } = await import("rolldown");
|
|
8336
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8490
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8337
8491
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8338
|
-
const outfile = path.join(cacheDir, "_template_vue.mjs");
|
|
8492
|
+
const outfile = path$1.join(cacheDir, "_template_vue.mjs");
|
|
8339
8493
|
const bundle = await rolldown({
|
|
8340
8494
|
input: templatePath,
|
|
8341
8495
|
platform: "node",
|
|
@@ -8431,9 +8585,9 @@ async function getVizejsPlugin() {
|
|
|
8431
8585
|
async function resolveSvelteTemplate(templatePath, root) {
|
|
8432
8586
|
const fs = await import("fs/promises");
|
|
8433
8587
|
const { rolldown } = await import("rolldown");
|
|
8434
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8588
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8435
8589
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8436
|
-
const outfile = path.join(cacheDir, "_template_svelte.mjs");
|
|
8590
|
+
const outfile = path$1.join(cacheDir, "_template_svelte.mjs");
|
|
8437
8591
|
const bundle = await rolldown({
|
|
8438
8592
|
input: templatePath,
|
|
8439
8593
|
platform: "node",
|
|
@@ -8489,9 +8643,9 @@ function createSvelteCompilerPlugin() {
|
|
|
8489
8643
|
async function resolveReactTemplate(templatePath, root) {
|
|
8490
8644
|
const fs = await import("fs/promises");
|
|
8491
8645
|
const { rolldown } = await import("rolldown");
|
|
8492
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8646
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8493
8647
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8494
|
-
const outfile = path.join(cacheDir, "_template_react.mjs");
|
|
8648
|
+
const outfile = path$1.join(cacheDir, "_template_react.mjs");
|
|
8495
8649
|
const bundle = await rolldown({
|
|
8496
8650
|
input: templatePath,
|
|
8497
8651
|
platform: "node",
|
|
@@ -8541,7 +8695,7 @@ async function resolveReactTemplate(templatePath, root) {
|
|
|
8541
8695
|
async function computeTemplateSource(options, root) {
|
|
8542
8696
|
if (!options.template) return "__default__";
|
|
8543
8697
|
const fs = await import("fs/promises");
|
|
8544
|
-
const templatePath = path.resolve(root, options.template);
|
|
8698
|
+
const templatePath = path$1.resolve(root, options.template);
|
|
8545
8699
|
const content = await fs.readFile(templatePath, "utf-8");
|
|
8546
8700
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
8547
8701
|
}
|
|
@@ -8559,7 +8713,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8559
8713
|
if (pages.length === 0) return [];
|
|
8560
8714
|
const templateFn = await resolveTemplate(options, root);
|
|
8561
8715
|
const templateSource = await computeTemplateSource(options, root);
|
|
8562
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8716
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8563
8717
|
if (options.cache) {
|
|
8564
8718
|
const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);
|
|
8565
8719
|
if (allCached) return allCached;
|
|
@@ -8571,7 +8725,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8571
8725
|
error: "Chromium not available"
|
|
8572
8726
|
}));
|
|
8573
8727
|
const results = [];
|
|
8574
|
-
const publicDir = path.join(root, "public");
|
|
8728
|
+
const publicDir = path$1.join(root, "public");
|
|
8575
8729
|
const concurrency = Math.max(1, options.concurrency);
|
|
8576
8730
|
for (let i = 0; i < pages.length; i += concurrency) {
|
|
8577
8731
|
const batch = pages.slice(i, i + concurrency);
|
|
@@ -8595,7 +8749,7 @@ async function tryServeAllFromCache(pages, templateSource, options, cacheDir) {
|
|
|
8595
8749
|
for (const entry of pages) {
|
|
8596
8750
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8597
8751
|
if (!cached) return null;
|
|
8598
|
-
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8752
|
+
await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
|
|
8599
8753
|
await fs.writeFile(entry.outputPath, cached);
|
|
8600
8754
|
results.push({
|
|
8601
8755
|
outputPath: entry.outputPath,
|
|
@@ -8613,7 +8767,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8613
8767
|
if (options.cache) {
|
|
8614
8768
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8615
8769
|
if (cached) {
|
|
8616
|
-
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8770
|
+
await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
|
|
8617
8771
|
await fs.writeFile(entry.outputPath, cached);
|
|
8618
8772
|
return {
|
|
8619
8773
|
outputPath: entry.outputPath,
|
|
@@ -8623,7 +8777,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8623
8777
|
}
|
|
8624
8778
|
const html = await templateFn(entry.props);
|
|
8625
8779
|
const png = await session.renderPage(html, options.width, options.height, publicDir);
|
|
8626
|
-
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8780
|
+
await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
|
|
8627
8781
|
await fs.writeFile(entry.outputPath, png);
|
|
8628
8782
|
if (options.cache) await writeCache(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height), png);
|
|
8629
8783
|
return {
|
|
@@ -8638,7 +8792,6 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8638
8792
|
};
|
|
8639
8793
|
}
|
|
8640
8794
|
}
|
|
8641
|
-
|
|
8642
8795
|
//#endregion
|
|
8643
8796
|
//#region src/plugins/index.ts
|
|
8644
8797
|
/**
|
|
@@ -8648,28 +8801,27 @@ async function transformAllPlugins(html, options = {}) {
|
|
|
8648
8801
|
const { tabs = true, youtube = true, github = true, ogp = true, mermaid = true, githubToken } = options;
|
|
8649
8802
|
let result = html;
|
|
8650
8803
|
if (tabs) {
|
|
8651
|
-
const { transformTabs } = await import("./tabs.
|
|
8804
|
+
const { transformTabs } = await import("./tabs.mjs");
|
|
8652
8805
|
result = await transformTabs(result);
|
|
8653
8806
|
}
|
|
8654
8807
|
if (youtube) {
|
|
8655
|
-
const { transformYouTube } = await import("./youtube.
|
|
8808
|
+
const { transformYouTube } = await import("./youtube.mjs");
|
|
8656
8809
|
result = await transformYouTube(result);
|
|
8657
8810
|
}
|
|
8658
8811
|
if (github) {
|
|
8659
|
-
const { transformGitHub } = await import("./github.
|
|
8812
|
+
const { transformGitHub } = await import("./github.mjs");
|
|
8660
8813
|
result = await transformGitHub(result, void 0, { token: githubToken });
|
|
8661
8814
|
}
|
|
8662
8815
|
if (ogp) {
|
|
8663
|
-
const { transformOgp } = await import("./ogp.
|
|
8816
|
+
const { transformOgp } = await import("./ogp.mjs");
|
|
8664
8817
|
result = await transformOgp(result);
|
|
8665
8818
|
}
|
|
8666
8819
|
if (mermaid) {
|
|
8667
|
-
const { transformMermaidStatic } = await import("./
|
|
8820
|
+
const { transformMermaidStatic } = await import("./mermaid2.mjs");
|
|
8668
8821
|
result = await transformMermaidStatic(result);
|
|
8669
8822
|
}
|
|
8670
8823
|
return result;
|
|
8671
8824
|
}
|
|
8672
|
-
|
|
8673
8825
|
//#endregion
|
|
8674
8826
|
//#region src/island/parse.ts
|
|
8675
8827
|
/**
|
|
@@ -8861,7 +9013,6 @@ initIslands((el, props) => {
|
|
|
8861
9013
|
});
|
|
8862
9014
|
`;
|
|
8863
9015
|
}
|
|
8864
|
-
|
|
8865
9016
|
//#endregion
|
|
8866
9017
|
//#region src/theme.ts
|
|
8867
9018
|
/**
|
|
@@ -8871,31 +9022,32 @@ initIslands((el, props) => {
|
|
|
8871
9022
|
const defaultTheme = {
|
|
8872
9023
|
name: "default",
|
|
8873
9024
|
colors: {
|
|
8874
|
-
primary: "#
|
|
8875
|
-
primaryHover: "#
|
|
9025
|
+
primary: "#4f6fae",
|
|
9026
|
+
primaryHover: "#425f96",
|
|
8876
9027
|
background: "#ffffff",
|
|
8877
|
-
backgroundAlt: "#
|
|
8878
|
-
text: "#
|
|
8879
|
-
textMuted: "#
|
|
8880
|
-
border: "#
|
|
8881
|
-
codeBackground: "#
|
|
8882
|
-
codeText: "#
|
|
9028
|
+
backgroundAlt: "#f5f7fb",
|
|
9029
|
+
text: "#131a30",
|
|
9030
|
+
textMuted: "#4f607b",
|
|
9031
|
+
border: "#d2dbea",
|
|
9032
|
+
codeBackground: "#101a31",
|
|
9033
|
+
codeText: "#edf3ff"
|
|
8883
9034
|
},
|
|
8884
9035
|
darkColors: {
|
|
8885
|
-
primary: "#
|
|
8886
|
-
primaryHover: "#
|
|
8887
|
-
background: "#
|
|
8888
|
-
backgroundAlt: "#
|
|
8889
|
-
text: "#
|
|
8890
|
-
textMuted: "#
|
|
8891
|
-
border: "#
|
|
8892
|
-
codeBackground: "#
|
|
8893
|
-
codeText: "#
|
|
9036
|
+
primary: "#86a4da",
|
|
9037
|
+
primaryHover: "#a3bbe8",
|
|
9038
|
+
background: "#060816",
|
|
9039
|
+
backgroundAlt: "#0d1528",
|
|
9040
|
+
text: "#ebf2ff",
|
|
9041
|
+
textMuted: "#8ea0bf",
|
|
9042
|
+
border: "#223252",
|
|
9043
|
+
codeBackground: "#0a1020",
|
|
9044
|
+
codeText: "#e7f0ff"
|
|
8894
9045
|
},
|
|
8895
9046
|
fonts: {
|
|
8896
|
-
sans: "
|
|
8897
|
-
mono: "
|
|
9047
|
+
sans: "\"IBM Plex Sans\", \"Avenir Next\", \"Segoe UI Variable\", \"Segoe UI\", sans-serif",
|
|
9048
|
+
mono: "\"IBM Plex Mono\", \"SFMono-Regular\", Consolas, monospace"
|
|
8898
9049
|
},
|
|
9050
|
+
entryPage: { mode: "default" },
|
|
8899
9051
|
layout: {
|
|
8900
9052
|
sidebarWidth: "260px",
|
|
8901
9053
|
headerHeight: "60px",
|
|
@@ -8903,6 +9055,9 @@ const defaultTheme = {
|
|
|
8903
9055
|
},
|
|
8904
9056
|
header: {
|
|
8905
9057
|
logo: void 0,
|
|
9058
|
+
logoLight: void 0,
|
|
9059
|
+
logoDark: void 0,
|
|
9060
|
+
showSiteNameText: true,
|
|
8906
9061
|
logoWidth: 28,
|
|
8907
9062
|
logoHeight: 28
|
|
8908
9063
|
},
|
|
@@ -8980,6 +9135,7 @@ function resolveTheme(config) {
|
|
|
8980
9135
|
colors: merged.colors ?? defaultTheme.colors,
|
|
8981
9136
|
darkColors: merged.darkColors ?? defaultTheme.darkColors,
|
|
8982
9137
|
fonts: merged.fonts ?? defaultTheme.fonts,
|
|
9138
|
+
entryPage: merged.entryPage ?? defaultTheme.entryPage,
|
|
8983
9139
|
layout: merged.layout ?? defaultTheme.layout,
|
|
8984
9140
|
header: merged.header ?? defaultTheme.header,
|
|
8985
9141
|
footer: merged.footer ?? defaultTheme.footer,
|
|
@@ -9020,13 +9176,17 @@ function themeToNapi(theme) {
|
|
|
9020
9176
|
sans: theme.fonts.sans,
|
|
9021
9177
|
mono: theme.fonts.mono
|
|
9022
9178
|
} : void 0,
|
|
9179
|
+
entryPage: theme.entryPage.mode ? { mode: theme.entryPage.mode } : void 0,
|
|
9023
9180
|
layout: theme.layout.sidebarWidth ? {
|
|
9024
9181
|
sidebarWidth: theme.layout.sidebarWidth,
|
|
9025
9182
|
headerHeight: theme.layout.headerHeight,
|
|
9026
9183
|
maxContentWidth: theme.layout.maxContentWidth
|
|
9027
9184
|
} : void 0,
|
|
9028
|
-
header: theme.header.logo ? {
|
|
9185
|
+
header: theme.header.logo || theme.header.logoLight || theme.header.logoDark ? {
|
|
9029
9186
|
logo: theme.header.logo,
|
|
9187
|
+
logoLight: theme.header.logoLight,
|
|
9188
|
+
logoDark: theme.header.logoDark,
|
|
9189
|
+
showSiteNameText: theme.header.showSiteNameText,
|
|
9030
9190
|
logoWidth: theme.header.logoWidth,
|
|
9031
9191
|
logoHeight: theme.header.logoHeight
|
|
9032
9192
|
} : void 0,
|
|
@@ -9044,7 +9204,6 @@ function themeToNapi(theme) {
|
|
|
9044
9204
|
js: theme.js || void 0
|
|
9045
9205
|
};
|
|
9046
9206
|
}
|
|
9047
|
-
|
|
9048
9207
|
//#endregion
|
|
9049
9208
|
//#region src/ssg.ts
|
|
9050
9209
|
/**
|
|
@@ -9076,40 +9235,65 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9076
9235
|
--sidebar-width: 260px;
|
|
9077
9236
|
--header-height: 60px;
|
|
9078
9237
|
--max-content-width: 960px;
|
|
9079
|
-
--font-sans:
|
|
9080
|
-
--font-mono:
|
|
9238
|
+
--font-sans: 'IBM Plex Sans', 'Avenir Next', 'Segoe UI Variable', 'Segoe UI', sans-serif;
|
|
9239
|
+
--font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
|
|
9081
9240
|
--color-bg: #ffffff;
|
|
9082
|
-
--color-bg-alt: #
|
|
9083
|
-
--color-text: #
|
|
9084
|
-
--color-text-muted: #
|
|
9085
|
-
--color-border: #
|
|
9086
|
-
--color-primary: #
|
|
9087
|
-
--color-primary-hover: #
|
|
9088
|
-
--color-code-bg: #
|
|
9089
|
-
--color-code-
|
|
9241
|
+
--color-bg-alt: #f5f7fb;
|
|
9242
|
+
--color-text: #131a30;
|
|
9243
|
+
--color-text-muted: #4f607b;
|
|
9244
|
+
--color-border: #d2dbea;
|
|
9245
|
+
--color-primary: #4f6fae;
|
|
9246
|
+
--color-primary-hover: #425f96;
|
|
9247
|
+
--color-code-bg: #101a31;
|
|
9248
|
+
--color-code-bg-top: #18264a;
|
|
9249
|
+
--color-code-text: #edf3ff;
|
|
9250
|
+
--color-code-line-highlight: rgba(56, 189, 248, 0.16);
|
|
9251
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.18);
|
|
9252
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9253
|
+
--color-code-line-error: rgba(239, 68, 68, 0.18);
|
|
9254
|
+
--color-code-line-error-border: #ef4444;
|
|
9255
|
+
--color-code-frame-border: rgba(147, 166, 200, 0.46);
|
|
9256
|
+
--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");
|
|
9257
|
+
--surface-noise-size: 164px 164px;
|
|
9090
9258
|
}
|
|
9091
9259
|
[data-theme="dark"] {
|
|
9092
|
-
--color-bg: #
|
|
9093
|
-
--color-bg-alt: #
|
|
9094
|
-
--color-text: #
|
|
9095
|
-
--color-text-muted: #
|
|
9096
|
-
--color-border: #
|
|
9097
|
-
--color-primary: #
|
|
9098
|
-
--color-primary-hover: #
|
|
9099
|
-
--color-code-bg: #
|
|
9100
|
-
--color-code-
|
|
9260
|
+
--color-bg: #060816;
|
|
9261
|
+
--color-bg-alt: #0d1528;
|
|
9262
|
+
--color-text: #ebf2ff;
|
|
9263
|
+
--color-text-muted: #8ea0bf;
|
|
9264
|
+
--color-border: #223252;
|
|
9265
|
+
--color-primary: #86a4da;
|
|
9266
|
+
--color-primary-hover: #a3bbe8;
|
|
9267
|
+
--color-code-bg: #0a1020;
|
|
9268
|
+
--color-code-bg-top: #0a1020;
|
|
9269
|
+
--color-code-text: #e7f0ff;
|
|
9270
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9271
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9272
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9273
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9274
|
+
--color-code-line-error-border: #f87171;
|
|
9275
|
+
--color-code-frame-border: rgba(34, 50, 82, 0.92);
|
|
9276
|
+
--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");
|
|
9101
9277
|
}
|
|
9102
9278
|
@media (prefers-color-scheme: dark) {
|
|
9103
9279
|
:root:not([data-theme="light"]) {
|
|
9104
|
-
--color-bg: #
|
|
9105
|
-
--color-bg-alt: #
|
|
9106
|
-
--color-text: #
|
|
9107
|
-
--color-text-muted: #
|
|
9108
|
-
--color-border: #
|
|
9109
|
-
--color-primary: #
|
|
9110
|
-
--color-primary-hover: #
|
|
9111
|
-
--color-code-bg: #
|
|
9112
|
-
--color-code-
|
|
9280
|
+
--color-bg: #060816;
|
|
9281
|
+
--color-bg-alt: #0d1528;
|
|
9282
|
+
--color-text: #ebf2ff;
|
|
9283
|
+
--color-text-muted: #8ea0bf;
|
|
9284
|
+
--color-border: #223252;
|
|
9285
|
+
--color-primary: #86a4da;
|
|
9286
|
+
--color-primary-hover: #a3bbe8;
|
|
9287
|
+
--color-code-bg: #0a1020;
|
|
9288
|
+
--color-code-bg-top: #0a1020;
|
|
9289
|
+
--color-code-text: #e7f0ff;
|
|
9290
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9291
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9292
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9293
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9294
|
+
--color-code-line-error-border: #f87171;
|
|
9295
|
+
--color-code-frame-border: rgba(34, 50, 82, 0.92);
|
|
9296
|
+
--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");
|
|
9113
9297
|
}
|
|
9114
9298
|
}
|
|
9115
9299
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
@@ -9119,6 +9303,10 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9119
9303
|
line-height: 1.7;
|
|
9120
9304
|
color: var(--color-text);
|
|
9121
9305
|
background: var(--color-bg);
|
|
9306
|
+
background-image: var(--surface-noise-image);
|
|
9307
|
+
background-size: var(--surface-noise-size);
|
|
9308
|
+
background-repeat: repeat;
|
|
9309
|
+
background-blend-mode: soft-light;
|
|
9122
9310
|
}
|
|
9123
9311
|
a { color: var(--color-primary); text-decoration: none; }
|
|
9124
9312
|
a:hover { color: var(--color-primary-hover); text-decoration: underline; }
|
|
@@ -9137,6 +9325,18 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9137
9325
|
padding: 0 1.5rem;
|
|
9138
9326
|
z-index: 100;
|
|
9139
9327
|
}
|
|
9328
|
+
.header,
|
|
9329
|
+
.sidebar,
|
|
9330
|
+
.search-modal,
|
|
9331
|
+
.mobile-footer,
|
|
9332
|
+
.content .ox-api-entry,
|
|
9333
|
+
.content .ox-api-module,
|
|
9334
|
+
.content blockquote.ox-callout {
|
|
9335
|
+
background-image: var(--surface-noise-image);
|
|
9336
|
+
background-size: var(--surface-noise-size);
|
|
9337
|
+
background-repeat: repeat;
|
|
9338
|
+
background-blend-mode: soft-light;
|
|
9339
|
+
}
|
|
9140
9340
|
.header-title {
|
|
9141
9341
|
font-size: 1.25rem;
|
|
9142
9342
|
font-weight: 600;
|
|
@@ -9161,7 +9361,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9161
9361
|
padding: 0.5rem 0.75rem;
|
|
9162
9362
|
background: var(--color-bg-alt);
|
|
9163
9363
|
border: 1px solid var(--color-border);
|
|
9164
|
-
border-radius:
|
|
9364
|
+
border-radius: 4px;
|
|
9165
9365
|
color: var(--color-text-muted);
|
|
9166
9366
|
cursor: pointer;
|
|
9167
9367
|
font-size: 0.875rem;
|
|
@@ -9187,7 +9387,6 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9187
9387
|
inset: 0;
|
|
9188
9388
|
z-index: 200;
|
|
9189
9389
|
background: rgba(0,0,0,0.6);
|
|
9190
|
-
backdrop-filter: blur(4px);
|
|
9191
9390
|
justify-content: center;
|
|
9192
9391
|
padding-top: 10vh;
|
|
9193
9392
|
}
|
|
@@ -9198,9 +9397,8 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9198
9397
|
margin: 0 1rem;
|
|
9199
9398
|
background: var(--color-bg);
|
|
9200
9399
|
border: 1px solid var(--color-border);
|
|
9201
|
-
border-radius:
|
|
9400
|
+
border-radius: 4px;
|
|
9202
9401
|
overflow: hidden;
|
|
9203
|
-
box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
|
|
9204
9402
|
max-height: 70vh;
|
|
9205
9403
|
display: flex;
|
|
9206
9404
|
flex-direction: column;
|
|
@@ -9240,7 +9438,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9240
9438
|
.search-result {
|
|
9241
9439
|
display: block;
|
|
9242
9440
|
padding: 0.75rem 1rem;
|
|
9243
|
-
border-radius:
|
|
9441
|
+
border-radius: 4px;
|
|
9244
9442
|
color: var(--color-text);
|
|
9245
9443
|
text-decoration: none;
|
|
9246
9444
|
}
|
|
@@ -9271,7 +9469,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9271
9469
|
border: none;
|
|
9272
9470
|
cursor: pointer;
|
|
9273
9471
|
padding: 0.5rem;
|
|
9274
|
-
border-radius:
|
|
9472
|
+
border-radius: 4px;
|
|
9275
9473
|
color: var(--color-text-muted);
|
|
9276
9474
|
transition: background 0.15s, color 0.15s;
|
|
9277
9475
|
}
|
|
@@ -9300,38 +9498,50 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9300
9498
|
left: 0;
|
|
9301
9499
|
bottom: 0;
|
|
9302
9500
|
width: var(--sidebar-width);
|
|
9303
|
-
background: var(--color-bg-alt);
|
|
9304
|
-
border-right: 1px solid var(--color-border);
|
|
9501
|
+
background: color-mix(in srgb, var(--color-bg-alt) 16%, var(--color-bg));
|
|
9502
|
+
border-right: 1px solid color-mix(in srgb, var(--color-border) 48%, transparent);
|
|
9305
9503
|
overflow-y: auto;
|
|
9306
|
-
padding: 1.5rem
|
|
9504
|
+
padding: 1rem 0.875rem 1.5rem;
|
|
9505
|
+
}
|
|
9506
|
+
.sidebar--entry { display: none; }
|
|
9507
|
+
.sidebar nav {
|
|
9508
|
+
display: flex;
|
|
9509
|
+
flex-direction: column;
|
|
9510
|
+
gap: 1rem;
|
|
9307
9511
|
}
|
|
9308
|
-
.nav-section { margin-bottom:
|
|
9512
|
+
.nav-section { margin-bottom: 0; }
|
|
9309
9513
|
.nav-title {
|
|
9310
|
-
font-size: 0.
|
|
9514
|
+
font-size: 0.6875rem;
|
|
9311
9515
|
font-weight: 600;
|
|
9312
9516
|
text-transform: uppercase;
|
|
9313
|
-
letter-spacing: 0.
|
|
9517
|
+
letter-spacing: 0.08em;
|
|
9314
9518
|
color: var(--color-text-muted);
|
|
9315
|
-
margin-bottom: 0.
|
|
9316
|
-
padding: 0 0.
|
|
9519
|
+
margin-bottom: 0.4rem;
|
|
9520
|
+
padding: 0 0.625rem;
|
|
9521
|
+
}
|
|
9522
|
+
.nav-list {
|
|
9523
|
+
list-style: none;
|
|
9524
|
+
display: flex;
|
|
9525
|
+
flex-direction: column;
|
|
9526
|
+
gap: 0.125rem;
|
|
9317
9527
|
}
|
|
9318
|
-
.nav-
|
|
9319
|
-
.nav-item { margin: 0.125rem 0; }
|
|
9528
|
+
.nav-item { margin: 0; }
|
|
9320
9529
|
.nav-link {
|
|
9321
9530
|
display: block;
|
|
9322
|
-
padding: 0.
|
|
9323
|
-
border-radius:
|
|
9324
|
-
color: var(--color-text);
|
|
9531
|
+
padding: 0.45rem 0.625rem;
|
|
9532
|
+
border-radius: 0;
|
|
9533
|
+
color: color-mix(in srgb, var(--color-text) 92%, var(--color-text-muted));
|
|
9325
9534
|
font-size: 0.875rem;
|
|
9326
|
-
transition: background 0.15s;
|
|
9327
9535
|
}
|
|
9328
9536
|
.nav-link:hover {
|
|
9329
|
-
background: var(--color-
|
|
9537
|
+
background: color-mix(in srgb, var(--color-bg-alt) 58%, transparent);
|
|
9538
|
+
color: var(--color-text);
|
|
9330
9539
|
text-decoration: none;
|
|
9331
9540
|
}
|
|
9332
9541
|
.nav-link.active {
|
|
9333
|
-
background: var(--color-
|
|
9334
|
-
color:
|
|
9542
|
+
background: color-mix(in srgb, var(--color-bg-alt) 72%, transparent);
|
|
9543
|
+
color: var(--color-text);
|
|
9544
|
+
font-weight: 600;
|
|
9335
9545
|
}
|
|
9336
9546
|
|
|
9337
9547
|
/* Main content */
|
|
@@ -9386,8 +9596,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9386
9596
|
padding: 0.5rem 1rem;
|
|
9387
9597
|
margin: 1rem 0;
|
|
9388
9598
|
background: var(--color-bg-alt);
|
|
9389
|
-
border-radius: 0
|
|
9599
|
+
border-radius: 0 4px 4px 0;
|
|
9600
|
+
}
|
|
9601
|
+
.content blockquote.ox-callout {
|
|
9602
|
+
--callout-accent: var(--color-primary);
|
|
9603
|
+
border-left-width: 3px;
|
|
9604
|
+
border-left-color: var(--callout-accent);
|
|
9605
|
+
padding: 0.9rem 1rem;
|
|
9606
|
+
border-radius: 4px;
|
|
9607
|
+
background: color-mix(in srgb, var(--color-bg-alt) 92%, var(--callout-accent) 8%);
|
|
9608
|
+
}
|
|
9609
|
+
.content blockquote.ox-callout.ox-callout--note,
|
|
9610
|
+
.content blockquote.ox-callout.ox-callout--important { --callout-accent: var(--color-primary); }
|
|
9611
|
+
.content blockquote.ox-callout.ox-callout--tip { --callout-accent: #0891b2; }
|
|
9612
|
+
.content blockquote.ox-callout.ox-callout--warning { --callout-accent: #d97706; }
|
|
9613
|
+
.content blockquote.ox-callout.ox-callout--caution { --callout-accent: #dc2626; }
|
|
9614
|
+
.content .ox-callout-title {
|
|
9615
|
+
margin: 0 0 0.5rem;
|
|
9616
|
+
font-size: 0.75rem;
|
|
9617
|
+
font-weight: 700;
|
|
9618
|
+
letter-spacing: 0.08em;
|
|
9619
|
+
text-transform: uppercase;
|
|
9620
|
+
color: var(--callout-accent, var(--color-primary));
|
|
9390
9621
|
}
|
|
9622
|
+
.content blockquote.ox-callout > :last-child { margin-bottom: 0; }
|
|
9623
|
+
.content blockquote.ox-callout > :not(.ox-callout-title):first-of-type { margin-top: 0; }
|
|
9391
9624
|
.content code {
|
|
9392
9625
|
font-family: var(--font-mono);
|
|
9393
9626
|
font-size: 0.875em;
|
|
@@ -9397,18 +9630,45 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9397
9630
|
word-break: break-all;
|
|
9398
9631
|
}
|
|
9399
9632
|
.content pre {
|
|
9400
|
-
background:
|
|
9633
|
+
background: linear-gradient(
|
|
9634
|
+
180deg,
|
|
9635
|
+
var(--color-code-bg-top) 0,
|
|
9636
|
+
var(--color-code-bg) 3.5rem
|
|
9637
|
+
) !important;
|
|
9401
9638
|
color: var(--color-code-text);
|
|
9402
9639
|
padding: 1rem 1.25rem;
|
|
9403
|
-
border-radius:
|
|
9640
|
+
border-radius: 4px;
|
|
9641
|
+
border: 1px solid var(--color-code-frame-border);
|
|
9404
9642
|
overflow-x: auto;
|
|
9405
9643
|
margin: 1.5rem 0;
|
|
9406
9644
|
line-height: 1.5;
|
|
9407
9645
|
}
|
|
9408
9646
|
.content pre code {
|
|
9409
9647
|
background: transparent;
|
|
9648
|
+
border: 0;
|
|
9410
9649
|
padding: 0;
|
|
9650
|
+
border-radius: 0;
|
|
9411
9651
|
font-size: 0.8125rem;
|
|
9652
|
+
word-break: normal;
|
|
9653
|
+
}
|
|
9654
|
+
.content pre.ox-code-block code {
|
|
9655
|
+
display: block;
|
|
9656
|
+
}
|
|
9657
|
+
.content pre.ox-code-block .line {
|
|
9658
|
+
display: block;
|
|
9659
|
+
margin: 0 -1.25rem;
|
|
9660
|
+
padding: 0 1.25rem;
|
|
9661
|
+
}
|
|
9662
|
+
.content pre.ox-code-block .ox-code-line--highlight {
|
|
9663
|
+
background: var(--color-code-line-highlight);
|
|
9664
|
+
}
|
|
9665
|
+
.content pre.ox-code-block .ox-code-line--warning {
|
|
9666
|
+
background: var(--color-code-line-warning);
|
|
9667
|
+
border-left: 3px solid var(--color-code-line-warning-border);
|
|
9668
|
+
}
|
|
9669
|
+
.content pre.ox-code-block .ox-code-line--error {
|
|
9670
|
+
background: var(--color-code-line-error);
|
|
9671
|
+
border-left: 3px solid var(--color-code-line-error-border);
|
|
9412
9672
|
}
|
|
9413
9673
|
.content table {
|
|
9414
9674
|
width: 100%;
|
|
@@ -9422,21 +9682,355 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9422
9682
|
text-align: left;
|
|
9423
9683
|
}
|
|
9424
9684
|
.content th { background: var(--color-bg-alt); font-weight: 600; }
|
|
9425
|
-
.content img { max-width: 100%; height: auto; border-radius:
|
|
9685
|
+
.content img { max-width: 100%; height: auto; border-radius: 4px; display: block; }
|
|
9426
9686
|
.content img[alt*="Logo"] { max-width: 200px; display: block; margin: 1rem 0; }
|
|
9427
9687
|
.content img[alt*="Architecture"] { max-width: 600px; }
|
|
9428
9688
|
.content img[alt*="Benchmark"] { max-width: 680px; }
|
|
9429
9689
|
.content hr { border: none; border-top: 1px solid var(--color-border); margin: 2rem 0; }
|
|
9690
|
+
.content .ox-api-controls {
|
|
9691
|
+
display: flex;
|
|
9692
|
+
justify-content: flex-end;
|
|
9693
|
+
align-items: center;
|
|
9694
|
+
gap: 0.5rem;
|
|
9695
|
+
margin: 0 0 1rem;
|
|
9696
|
+
}
|
|
9697
|
+
.content .ox-api-controls__button {
|
|
9698
|
+
appearance: none;
|
|
9699
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
|
|
9700
|
+
background: color-mix(in srgb, var(--color-bg-alt) 82%, var(--color-bg));
|
|
9701
|
+
padding: 0.4rem 0.7rem;
|
|
9702
|
+
border-radius: 4px;
|
|
9703
|
+
color: color-mix(in srgb, var(--color-text) 82%, var(--color-text-muted));
|
|
9704
|
+
font-family: var(--font-mono);
|
|
9705
|
+
font-size: 0.78rem;
|
|
9706
|
+
font-weight: 600;
|
|
9707
|
+
line-height: 1.4;
|
|
9708
|
+
cursor: pointer;
|
|
9709
|
+
}
|
|
9710
|
+
.content .ox-api-controls__button:hover {
|
|
9711
|
+
color: var(--color-primary);
|
|
9712
|
+
border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
|
|
9713
|
+
background: color-mix(in srgb, var(--color-bg-alt) 68%, var(--color-primary) 6%);
|
|
9714
|
+
}
|
|
9715
|
+
.content .ox-api-entry,
|
|
9716
|
+
.content .ox-api-module {
|
|
9717
|
+
margin: 0;
|
|
9718
|
+
border: 0;
|
|
9719
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 74%, transparent);
|
|
9720
|
+
border-radius: 0;
|
|
9721
|
+
background: transparent;
|
|
9722
|
+
overflow: visible;
|
|
9723
|
+
}
|
|
9724
|
+
.content .ox-api-entry:last-child,
|
|
9725
|
+
.content .ox-api-module:last-child {
|
|
9726
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border) 74%, transparent);
|
|
9727
|
+
}
|
|
9728
|
+
.content .ox-api-entry summary,
|
|
9729
|
+
.content .ox-api-module summary {
|
|
9730
|
+
list-style: none;
|
|
9731
|
+
cursor: pointer;
|
|
9732
|
+
padding: 1rem 0;
|
|
9733
|
+
position: relative;
|
|
9734
|
+
}
|
|
9735
|
+
.content .ox-api-entry summary::-webkit-details-marker,
|
|
9736
|
+
.content .ox-api-module summary::-webkit-details-marker { display: none; }
|
|
9737
|
+
.content .ox-api-entry summary {
|
|
9738
|
+
display: grid;
|
|
9739
|
+
grid-template-columns: var(--octc-api-kind-width, 6.5rem) minmax(0, 1fr) auto;
|
|
9740
|
+
align-items: start;
|
|
9741
|
+
gap: 0.95rem;
|
|
9742
|
+
}
|
|
9743
|
+
.content .ox-api-entry summary::after,
|
|
9744
|
+
.content .ox-api-module summary::after {
|
|
9745
|
+
content: "+";
|
|
9746
|
+
align-self: center;
|
|
9747
|
+
color: var(--color-text-muted);
|
|
9748
|
+
font-family: var(--font-mono);
|
|
9749
|
+
font-size: 0.95rem;
|
|
9750
|
+
font-weight: 600;
|
|
9751
|
+
line-height: 1;
|
|
9752
|
+
}
|
|
9753
|
+
.content .ox-api-entry[open] summary::after,
|
|
9754
|
+
.content .ox-api-module[open] summary::after {
|
|
9755
|
+
content: "−";
|
|
9756
|
+
color: var(--color-primary);
|
|
9757
|
+
}
|
|
9758
|
+
.content .ox-api-entry[open] summary,
|
|
9759
|
+
.content .ox-api-module[open] summary {
|
|
9760
|
+
border-bottom: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
9761
|
+
}
|
|
9762
|
+
.content .ox-api-entry__kind,
|
|
9763
|
+
.content .ox-api-module__kind {
|
|
9764
|
+
display: block;
|
|
9765
|
+
width: var(--octc-api-kind-width, 6.5rem);
|
|
9766
|
+
padding: 0.3rem 0 0;
|
|
9767
|
+
background: transparent;
|
|
9768
|
+
border: 0;
|
|
9769
|
+
font-family: var(--font-mono);
|
|
9770
|
+
font-size: 0.76rem;
|
|
9771
|
+
font-weight: 600;
|
|
9772
|
+
letter-spacing: 0.01em;
|
|
9773
|
+
text-align: left;
|
|
9774
|
+
white-space: nowrap;
|
|
9775
|
+
color: var(--color-text-muted);
|
|
9776
|
+
}
|
|
9777
|
+
.content .ox-api-module__count {
|
|
9778
|
+
display: inline-flex;
|
|
9779
|
+
align-items: center;
|
|
9780
|
+
padding: 0.2rem 0.48rem;
|
|
9781
|
+
border-radius: 4px;
|
|
9782
|
+
background: color-mix(in srgb, var(--color-bg-alt) 84%, var(--color-primary) 8%);
|
|
9783
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
|
|
9784
|
+
color: var(--color-text-muted);
|
|
9785
|
+
font-family: var(--font-mono);
|
|
9786
|
+
font-size: 0.72rem;
|
|
9787
|
+
font-weight: 600;
|
|
9788
|
+
letter-spacing: 0.03em;
|
|
9789
|
+
white-space: nowrap;
|
|
9790
|
+
}
|
|
9791
|
+
.content .ox-api-entry__name {
|
|
9792
|
+
display: block;
|
|
9793
|
+
font-family: var(--font-mono);
|
|
9794
|
+
font-size: 0.95rem;
|
|
9795
|
+
font-weight: 600;
|
|
9796
|
+
line-height: 1.55;
|
|
9797
|
+
}
|
|
9798
|
+
.content .ox-api-entry__signature,
|
|
9799
|
+
.content .ox-api-module__signature {
|
|
9800
|
+
display: block;
|
|
9801
|
+
width: 100%;
|
|
9802
|
+
min-width: 0;
|
|
9803
|
+
font-family: var(--font-mono);
|
|
9804
|
+
font-size: 0.95rem;
|
|
9805
|
+
line-height: 1.55;
|
|
9806
|
+
white-space: nowrap;
|
|
9807
|
+
overflow-x: auto;
|
|
9808
|
+
overflow-y: hidden;
|
|
9809
|
+
-webkit-overflow-scrolling: touch;
|
|
9810
|
+
}
|
|
9811
|
+
.content .ox-api-entry__description {
|
|
9812
|
+
display: block;
|
|
9813
|
+
color: color-mix(in srgb, var(--color-text) 78%, var(--color-text-muted));
|
|
9814
|
+
font-size: 0.9rem;
|
|
9815
|
+
line-height: 1.6;
|
|
9816
|
+
max-width: 72ch;
|
|
9817
|
+
}
|
|
9818
|
+
.content .ox-api-entry__summary-main {
|
|
9819
|
+
min-width: 0;
|
|
9820
|
+
display: flex;
|
|
9821
|
+
flex-direction: column;
|
|
9822
|
+
gap: 0.55rem;
|
|
9823
|
+
}
|
|
9824
|
+
.content .ox-api-entry__name,
|
|
9825
|
+
.content .ox-api-entry__signature,
|
|
9826
|
+
.content .ox-api-module__name,
|
|
9827
|
+
.content .ox-api-module__signature {
|
|
9828
|
+
background: transparent;
|
|
9829
|
+
padding: 0;
|
|
9830
|
+
border-radius: 0;
|
|
9831
|
+
word-break: normal;
|
|
9832
|
+
}
|
|
9833
|
+
.content code.shiki-inline.ox-api-entry__signature--highlighted,
|
|
9834
|
+
.content code.shiki-inline.ox-api-module__signature--highlighted {
|
|
9835
|
+
display: block;
|
|
9836
|
+
width: 100%;
|
|
9837
|
+
max-width: 100%;
|
|
9838
|
+
background: linear-gradient(
|
|
9839
|
+
180deg,
|
|
9840
|
+
var(--color-code-bg-top) 0,
|
|
9841
|
+
var(--color-code-bg) 2.75rem
|
|
9842
|
+
) !important;
|
|
9843
|
+
border: 1px solid var(--color-code-frame-border) !important;
|
|
9844
|
+
padding: 0.55rem 0.7rem !important;
|
|
9845
|
+
border-radius: 4px !important;
|
|
9846
|
+
white-space: nowrap;
|
|
9847
|
+
overflow-x: auto;
|
|
9848
|
+
overflow-y: hidden;
|
|
9849
|
+
-webkit-overflow-scrolling: touch;
|
|
9850
|
+
}
|
|
9851
|
+
.content code.shiki-inline.ox-api-entry__signature--highlighted .line,
|
|
9852
|
+
.content code.shiki-inline.ox-api-module__signature--highlighted .line {
|
|
9853
|
+
display: block;
|
|
9854
|
+
width: max-content;
|
|
9855
|
+
min-width: 100%;
|
|
9856
|
+
}
|
|
9857
|
+
.content .ox-api-entry__body,
|
|
9858
|
+
.content .ox-api-module__body { padding: 0.7rem 0 1.9rem; }
|
|
9859
|
+
.content .ox-api-entry__body {
|
|
9860
|
+
margin-left: calc(var(--octc-api-kind-width, 6.5rem) + 0.95rem);
|
|
9861
|
+
margin-top: 0.7rem;
|
|
9862
|
+
padding: 1.45rem 1rem 2.1rem 1.1rem;
|
|
9863
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
9864
|
+
border-radius: 4px;
|
|
9865
|
+
background: color-mix(in srgb, var(--color-bg-alt) 68%, transparent);
|
|
9866
|
+
}
|
|
9867
|
+
.content .ox-api-entry__body > :first-child { margin-top: 0; }
|
|
9868
|
+
.content .ox-api-entry__body > :last-child { margin-bottom: 0; }
|
|
9869
|
+
.content .ox-api-entry[open] summary {
|
|
9870
|
+
padding-bottom: 0.35rem;
|
|
9871
|
+
}
|
|
9872
|
+
.content .ox-api-entry__section {
|
|
9873
|
+
display: grid;
|
|
9874
|
+
grid-template-columns: 6.5rem minmax(0, 1fr);
|
|
9875
|
+
gap: 0.2rem 1.25rem;
|
|
9876
|
+
align-items: start;
|
|
9877
|
+
margin-top: 1rem;
|
|
9878
|
+
padding-top: 1rem;
|
|
9879
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
|
|
9880
|
+
}
|
|
9881
|
+
.content .ox-api-entry__section h4 {
|
|
9882
|
+
margin-top: 0;
|
|
9883
|
+
margin-bottom: 0;
|
|
9884
|
+
padding-top: 0.25rem;
|
|
9885
|
+
font-family: var(--font-mono);
|
|
9886
|
+
font-size: 0.78rem;
|
|
9887
|
+
font-weight: 700;
|
|
9888
|
+
letter-spacing: 0.04em;
|
|
9889
|
+
text-transform: uppercase;
|
|
9890
|
+
color: var(--color-text-muted);
|
|
9891
|
+
}
|
|
9892
|
+
.content .ox-api-entry__section > :not(h4) { min-width: 0; }
|
|
9893
|
+
.content .ox-api-entry__source {
|
|
9894
|
+
margin: 0 0 0.15rem;
|
|
9895
|
+
font-family: var(--font-mono);
|
|
9896
|
+
font-size: 0.78rem;
|
|
9897
|
+
color: var(--color-text-muted);
|
|
9898
|
+
}
|
|
9899
|
+
.content .ox-api-entry__source a {
|
|
9900
|
+
color: inherit;
|
|
9901
|
+
text-decoration-color: color-mix(in srgb, var(--color-text-muted) 38%, transparent);
|
|
9902
|
+
}
|
|
9903
|
+
.content .ox-api-entry__tags,
|
|
9904
|
+
.content .ox-api-module__list {
|
|
9905
|
+
list-style: none;
|
|
9906
|
+
padding-left: 0;
|
|
9907
|
+
margin: 0;
|
|
9908
|
+
}
|
|
9909
|
+
.content .ox-api-entry__tags {
|
|
9910
|
+
display: flex;
|
|
9911
|
+
flex-wrap: wrap;
|
|
9912
|
+
gap: 0.6rem;
|
|
9913
|
+
}
|
|
9914
|
+
.content .ox-api-entry__tags li {
|
|
9915
|
+
display: inline-flex;
|
|
9916
|
+
align-items: center;
|
|
9917
|
+
gap: 0.45rem;
|
|
9918
|
+
padding: 0.4rem 0.55rem;
|
|
9919
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 80%, transparent);
|
|
9920
|
+
border-radius: 4px;
|
|
9921
|
+
background: color-mix(in srgb, var(--color-bg-alt) 72%, transparent);
|
|
9922
|
+
}
|
|
9923
|
+
.content .ox-api-module__list li {
|
|
9924
|
+
display: grid;
|
|
9925
|
+
grid-template-columns: var(--octc-api-kind-width, 6.5rem) minmax(0, 1fr);
|
|
9926
|
+
align-items: start;
|
|
9927
|
+
gap: 1rem;
|
|
9928
|
+
padding: 0.85rem 0;
|
|
9929
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
|
|
9930
|
+
}
|
|
9931
|
+
.content .ox-api-module__list li:first-child { border-top: none; }
|
|
9932
|
+
.content .ox-api-entry__tag-name,
|
|
9933
|
+
.content .ox-api-module__title { font-weight: 700; }
|
|
9934
|
+
.content .ox-api-entry__tag-name {
|
|
9935
|
+
color: var(--color-primary);
|
|
9936
|
+
font-family: var(--font-mono);
|
|
9937
|
+
font-size: 0.74rem;
|
|
9938
|
+
}
|
|
9939
|
+
.content .ox-api-entry__tag-value {
|
|
9940
|
+
color: var(--color-text);
|
|
9941
|
+
font-size: 0.84rem;
|
|
9942
|
+
line-height: 1.45;
|
|
9943
|
+
}
|
|
9944
|
+
.content .ox-api-module summary {
|
|
9945
|
+
display: grid;
|
|
9946
|
+
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
9947
|
+
align-items: center;
|
|
9948
|
+
gap: 0.9rem;
|
|
9949
|
+
}
|
|
9950
|
+
.content .ox-api-module__body { padding-top: 0.15rem; }
|
|
9951
|
+
.content .ox-api-module__item { min-width: 0; }
|
|
9952
|
+
.content .ox-api-module__link {
|
|
9953
|
+
display: block;
|
|
9954
|
+
text-decoration: none;
|
|
9955
|
+
}
|
|
9956
|
+
.content .ox-api-module__link:hover { text-decoration: none; }
|
|
9957
|
+
.content .ox-api-module__name,
|
|
9958
|
+
.content .ox-api-module__signature {
|
|
9959
|
+
display: block;
|
|
9960
|
+
font-family: var(--font-mono);
|
|
9961
|
+
font-size: 0.91rem;
|
|
9962
|
+
line-height: 1.55;
|
|
9963
|
+
color: var(--color-text);
|
|
9964
|
+
}
|
|
9965
|
+
.content .ox-api-module__summary {
|
|
9966
|
+
display: block;
|
|
9967
|
+
margin-top: 0.45rem;
|
|
9968
|
+
color: color-mix(in srgb, var(--color-text) 76%, var(--color-text-muted));
|
|
9969
|
+
font-size: 0.88rem;
|
|
9970
|
+
line-height: 1.55;
|
|
9971
|
+
}
|
|
9972
|
+
.content .ox-api-entry__section--examples pre {
|
|
9973
|
+
margin: 0;
|
|
9974
|
+
border: 1px solid var(--color-code-frame-border);
|
|
9975
|
+
border-radius: 4px;
|
|
9976
|
+
}
|
|
9977
|
+
.content .ox-api-entry__params {
|
|
9978
|
+
list-style: none;
|
|
9979
|
+
padding: 0;
|
|
9980
|
+
margin: 0;
|
|
9981
|
+
}
|
|
9982
|
+
.content .ox-api-entry__param {
|
|
9983
|
+
padding: 0.8rem 0;
|
|
9984
|
+
border-top: 1px solid color-mix(in srgb, var(--color-border) 70%, transparent);
|
|
9985
|
+
}
|
|
9986
|
+
.content .ox-api-entry__param:first-child {
|
|
9987
|
+
padding-top: 0;
|
|
9988
|
+
border-top: 0;
|
|
9989
|
+
}
|
|
9990
|
+
.content .ox-api-entry__param-heading {
|
|
9991
|
+
display: flex;
|
|
9992
|
+
flex-wrap: wrap;
|
|
9993
|
+
align-items: center;
|
|
9994
|
+
gap: 0.5rem;
|
|
9995
|
+
}
|
|
9996
|
+
.content .ox-api-entry__param-name,
|
|
9997
|
+
.content .ox-api-entry__return-type {
|
|
9998
|
+
font-family: var(--font-mono);
|
|
9999
|
+
font-size: 0.84rem;
|
|
10000
|
+
font-weight: 600;
|
|
10001
|
+
color: var(--color-text);
|
|
10002
|
+
background: color-mix(in srgb, var(--color-bg-alt) 84%, transparent);
|
|
10003
|
+
border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
|
|
10004
|
+
padding: 0.28rem 0.42rem;
|
|
10005
|
+
border-radius: 4px;
|
|
10006
|
+
}
|
|
10007
|
+
.content .ox-api-entry__param-type {
|
|
10008
|
+
font-family: var(--font-mono);
|
|
10009
|
+
font-size: 0.78rem;
|
|
10010
|
+
color: var(--color-code-text);
|
|
10011
|
+
background: color-mix(in srgb, var(--color-code-bg) 96%, #243556);
|
|
10012
|
+
border: 1px solid color-mix(in srgb, var(--color-code-bg) 82%, var(--color-border));
|
|
10013
|
+
padding: 0.26rem 0.42rem;
|
|
10014
|
+
border-radius: 4px;
|
|
10015
|
+
}
|
|
10016
|
+
.content .ox-api-entry__param-description,
|
|
10017
|
+
.content .ox-api-entry__return-description {
|
|
10018
|
+
margin: 0.55rem 0 0;
|
|
10019
|
+
font-size: 0.88rem;
|
|
10020
|
+
line-height: 1.6;
|
|
10021
|
+
color: color-mix(in srgb, var(--color-text) 78%, var(--color-text-muted));
|
|
10022
|
+
}
|
|
10023
|
+
.content .ox-api-entry__return { margin: 0; }
|
|
9430
10024
|
|
|
9431
10025
|
/* Responsive */
|
|
9432
10026
|
@media (max-width: 768px) {
|
|
9433
10027
|
.menu-toggle { display: block; }
|
|
9434
10028
|
.sidebar {
|
|
9435
10029
|
transform: translateX(-100%);
|
|
9436
|
-
transition: transform 0.3s ease;
|
|
9437
10030
|
z-index: 99;
|
|
9438
10031
|
width: 280px;
|
|
9439
10032
|
}
|
|
10033
|
+
.sidebar--entry { display: block; }
|
|
9440
10034
|
.sidebar.open { transform: translateX(0); }
|
|
9441
10035
|
.main { margin-left: 0; padding: 1rem 0.75rem; }
|
|
9442
10036
|
.content { padding: 0 0.25rem; }
|
|
@@ -9453,16 +10047,48 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9453
10047
|
overflow-x: auto;
|
|
9454
10048
|
-webkit-overflow-scrolling: touch;
|
|
9455
10049
|
}
|
|
10050
|
+
.content .ox-api-controls {
|
|
10051
|
+
justify-content: flex-start;
|
|
10052
|
+
gap: 0.75rem;
|
|
10053
|
+
}
|
|
10054
|
+
.content .ox-api-entry__body {
|
|
10055
|
+
margin-left: 0;
|
|
10056
|
+
margin-top: 0.55rem;
|
|
10057
|
+
padding: 1.2rem 0 1.7rem;
|
|
10058
|
+
border-left: 0;
|
|
10059
|
+
border-right: 0;
|
|
10060
|
+
border-bottom: 0;
|
|
10061
|
+
border-radius: 0;
|
|
10062
|
+
background: transparent;
|
|
10063
|
+
}
|
|
10064
|
+
.content .ox-api-entry__section {
|
|
10065
|
+
grid-template-columns: 1fr;
|
|
10066
|
+
gap: 0.5rem;
|
|
10067
|
+
}
|
|
10068
|
+
.content .ox-api-entry__tags li,
|
|
10069
|
+
.content .ox-api-module__list li,
|
|
10070
|
+
.content .ox-api-module summary {
|
|
10071
|
+
grid-template-columns: 1fr;
|
|
10072
|
+
}
|
|
10073
|
+
.content .ox-api-entry__signature { width: 100%; }
|
|
10074
|
+
.content pre.ox-code-block .line {
|
|
10075
|
+
margin: 0 -0.75rem;
|
|
10076
|
+
padding: 0 0.75rem;
|
|
10077
|
+
}
|
|
9456
10078
|
.content code { font-size: 0.8125em; }
|
|
9457
10079
|
.content table {
|
|
9458
10080
|
display: block;
|
|
10081
|
+
width: max-content;
|
|
10082
|
+
min-width: 100%;
|
|
10083
|
+
max-width: calc(100vw - 1.5rem);
|
|
9459
10084
|
overflow-x: auto;
|
|
9460
10085
|
-webkit-overflow-scrolling: touch;
|
|
9461
10086
|
font-size: 0.8125rem;
|
|
9462
|
-
margin: 1rem
|
|
9463
|
-
|
|
10087
|
+
margin: 1rem 0;
|
|
10088
|
+
border-collapse: separate;
|
|
10089
|
+
border-spacing: 0;
|
|
9464
10090
|
}
|
|
9465
|
-
.content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; }
|
|
10091
|
+
.content th, .content td { padding: 0.5rem 0.75rem; white-space: nowrap; vertical-align: top; }
|
|
9466
10092
|
.content img { margin: 1rem 0; }
|
|
9467
10093
|
.content img[alt*="Logo"] { max-width: 150px; }
|
|
9468
10094
|
.content img[alt*="Architecture"] { max-width: 100%; }
|
|
@@ -9470,12 +10096,13 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9470
10096
|
.content blockquote { padding: 0.5rem 0.75rem; margin: 1rem 0; font-size: 0.9375rem; }
|
|
9471
10097
|
.header { padding: 0 1rem; }
|
|
9472
10098
|
.header-title { font-size: 1rem; }
|
|
9473
|
-
.header-title img { width: 24px; height: 24px; }
|
|
10099
|
+
.header-title:not(.header-title--logo-only) img { width: 24px; height: 24px; }
|
|
10100
|
+
.header-title--logo-only .header-logo { width: 152px; height: auto; }
|
|
9474
10101
|
.overlay {
|
|
9475
10102
|
display: none;
|
|
9476
10103
|
position: fixed;
|
|
9477
10104
|
inset: 0;
|
|
9478
|
-
background:
|
|
10105
|
+
background: transparent;
|
|
9479
10106
|
z-index: 98;
|
|
9480
10107
|
}
|
|
9481
10108
|
.overlay.open { display: block; }
|
|
@@ -9486,7 +10113,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9486
10113
|
.main { padding: 0.75rem 0.5rem; }
|
|
9487
10114
|
.content h1 { font-size: 1.35rem; }
|
|
9488
10115
|
.content pre { font-size: 0.6875rem; padding: 0.625rem; }
|
|
9489
|
-
.content table { font-size: 0.75rem; }
|
|
10116
|
+
.content table { max-width: calc(100vw - 1rem); font-size: 0.75rem; }
|
|
9490
10117
|
.content th, .content td { padding: 0.375rem 0.5rem; }
|
|
9491
10118
|
}
|
|
9492
10119
|
</style>
|
|
@@ -9539,7 +10166,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9539
10166
|
</div>
|
|
9540
10167
|
<div class="overlay"></div>
|
|
9541
10168
|
<div class="layout">
|
|
9542
|
-
<aside class="sidebar">
|
|
10169
|
+
<aside class="sidebar{{#entryPage}} sidebar--entry{{/entryPage}}">
|
|
9543
10170
|
<nav>
|
|
9544
10171
|
{{navigation}}
|
|
9545
10172
|
</nav>
|
|
@@ -9593,6 +10220,22 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9593
10220
|
});
|
|
9594
10221
|
}
|
|
9595
10222
|
|
|
10223
|
+
document.querySelectorAll('.ox-api-controls').forEach((controls) => {
|
|
10224
|
+
const targetSelector = controls.getAttribute('data-ox-api-target');
|
|
10225
|
+
if (!targetSelector) return;
|
|
10226
|
+
|
|
10227
|
+
controls.querySelectorAll('[data-ox-api-toggle]').forEach((button) => {
|
|
10228
|
+
button.addEventListener('click', () => {
|
|
10229
|
+
const shouldOpen = button.getAttribute('data-ox-api-toggle') === 'expand';
|
|
10230
|
+
document.querySelectorAll(targetSelector).forEach((entry) => {
|
|
10231
|
+
if (entry instanceof HTMLDetailsElement) {
|
|
10232
|
+
entry.open = shouldOpen;
|
|
10233
|
+
}
|
|
10234
|
+
});
|
|
10235
|
+
});
|
|
10236
|
+
});
|
|
10237
|
+
});
|
|
10238
|
+
|
|
9596
10239
|
// Search functionality
|
|
9597
10240
|
const searchButton = document.querySelector('.search-button');
|
|
9598
10241
|
const searchOverlay = document.querySelector('.search-modal-overlay');
|
|
@@ -9626,6 +10269,39 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9626
10269
|
}
|
|
9627
10270
|
};
|
|
9628
10271
|
|
|
10272
|
+
const parseScopedQuery = (query) => {
|
|
10273
|
+
const scopes = [];
|
|
10274
|
+
const terms = [];
|
|
10275
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
10276
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
10277
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
10278
|
+
} else {
|
|
10279
|
+
terms.push(part);
|
|
10280
|
+
}
|
|
10281
|
+
}
|
|
10282
|
+
return { text: terms.join(' ').trim(), scopes: [...new Set(scopes)] };
|
|
10283
|
+
};
|
|
10284
|
+
|
|
10285
|
+
const getScopesForDoc = (doc) => {
|
|
10286
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
10287
|
+
const segments = source.split('/').filter(Boolean);
|
|
10288
|
+
if (segments.length <= 1) return [];
|
|
10289
|
+
|
|
10290
|
+
const scopes = [];
|
|
10291
|
+
let current = '';
|
|
10292
|
+
for (const segment of segments.slice(0, -1)) {
|
|
10293
|
+
current = current ? current + '/' + segment : segment;
|
|
10294
|
+
scopes.push(current);
|
|
10295
|
+
}
|
|
10296
|
+
return scopes;
|
|
10297
|
+
};
|
|
10298
|
+
|
|
10299
|
+
const matchesScopes = (doc, scopes) => {
|
|
10300
|
+
if (!scopes.length) return true;
|
|
10301
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
10302
|
+
return scopes.some((scope) => docScopes.has(scope));
|
|
10303
|
+
};
|
|
10304
|
+
|
|
9629
10305
|
// Tokenize query
|
|
9630
10306
|
const tokenize = (text) => {
|
|
9631
10307
|
const tokens = [];
|
|
@@ -9648,27 +10324,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9648
10324
|
|
|
9649
10325
|
// Perform search
|
|
9650
10326
|
const performSearch = async (query) => {
|
|
9651
|
-
if (!query.trim()) {
|
|
9652
|
-
searchResults.innerHTML = '';
|
|
9653
|
-
results = [];
|
|
9654
|
-
return;
|
|
9655
|
-
}
|
|
9656
10327
|
await loadSearchIndex();
|
|
9657
10328
|
if (!searchIndex) {
|
|
9658
10329
|
searchResults.innerHTML = '<div class="search-empty">Search index not available</div>';
|
|
9659
10330
|
return;
|
|
9660
10331
|
}
|
|
9661
10332
|
|
|
9662
|
-
const
|
|
9663
|
-
if (!
|
|
10333
|
+
const parsedQuery = parseScopedQuery(query);
|
|
10334
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
9664
10335
|
searchResults.innerHTML = '';
|
|
9665
10336
|
results = [];
|
|
9666
10337
|
return;
|
|
9667
10338
|
}
|
|
9668
10339
|
|
|
10340
|
+
const tokens = tokenize(parsedQuery.text);
|
|
9669
10341
|
const k1 = 1.2, b = 0.75;
|
|
9670
10342
|
const docScores = new Map();
|
|
9671
10343
|
|
|
10344
|
+
if (!tokens.length) {
|
|
10345
|
+
searchIndex.documents.forEach((doc, docIdx) => {
|
|
10346
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
10347
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
10348
|
+
}
|
|
10349
|
+
});
|
|
10350
|
+
}
|
|
10351
|
+
|
|
9672
10352
|
for (let i = 0; i < tokens.length; i++) {
|
|
9673
10353
|
const token = tokens[i];
|
|
9674
10354
|
const isLast = i === tokens.length - 1;
|
|
@@ -9687,6 +10367,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9687
10367
|
for (const posting of postings) {
|
|
9688
10368
|
const doc = searchIndex.documents[posting.doc_idx];
|
|
9689
10369
|
if (!doc) continue;
|
|
10370
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
9690
10371
|
const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;
|
|
9691
10372
|
const tf = posting.tf;
|
|
9692
10373
|
const docLen = doc.body.length;
|
|
@@ -9705,6 +10386,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9705
10386
|
results = Array.from(docScores.entries())
|
|
9706
10387
|
.map(([docIdx, data]) => {
|
|
9707
10388
|
const doc = searchIndex.documents[docIdx];
|
|
10389
|
+
const scopes = getScopesForDoc(doc);
|
|
9708
10390
|
let snippet = '';
|
|
9709
10391
|
if (doc.body) {
|
|
9710
10392
|
const bodyLower = doc.body.toLowerCase();
|
|
@@ -9713,15 +10395,15 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9713
10395
|
const pos = bodyLower.indexOf(match);
|
|
9714
10396
|
if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;
|
|
9715
10397
|
}
|
|
9716
|
-
const start = Math.max(0, firstPos - 50);
|
|
10398
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
9717
10399
|
const end = Math.min(doc.body.length, start + 150);
|
|
9718
10400
|
snippet = doc.body.slice(start, end);
|
|
9719
10401
|
if (start > 0) snippet = '...' + snippet;
|
|
9720
10402
|
if (end < doc.body.length) snippet += '...';
|
|
9721
10403
|
}
|
|
9722
|
-
return { ...doc, score: data.score, snippet };
|
|
10404
|
+
return { ...doc, score: data.score, scopes, snippet };
|
|
9723
10405
|
})
|
|
9724
|
-
.sort((a, b) => b.score - a.score)
|
|
10406
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
9725
10407
|
.slice(0, 10);
|
|
9726
10408
|
|
|
9727
10409
|
selectedIndex = 0;
|
|
@@ -9735,7 +10417,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9735
10417
|
}
|
|
9736
10418
|
searchResults.innerHTML = results.map((r, i) =>
|
|
9737
10419
|
'<a href="' + r.url + '" class="search-result' + (i === selectedIndex ? ' selected' : '') + '">' +
|
|
9738
|
-
'<div class="search-result-title">' + r.title + '</div>' +
|
|
10420
|
+
'<div class="search-result-title">' + r.title + (r.scopes?.length ? '<span class="search-result-scope">@' + r.scopes[0] + '</span>' : '') + '</div>' +
|
|
9739
10421
|
(r.snippet ? '<div class="search-result-snippet">' + r.snippet + '</div>' : '') +
|
|
9740
10422
|
'</a>'
|
|
9741
10423
|
).join('');
|
|
@@ -9866,7 +10548,7 @@ function generateBareHtmlPage(content, title) {
|
|
|
9866
10548
|
* Generates HTML page with navigation using Rust NAPI bindings.
|
|
9867
10549
|
*/
|
|
9868
10550
|
async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, theme) {
|
|
9869
|
-
const mod = await
|
|
10551
|
+
const mod = await importNapiModule();
|
|
9870
10552
|
const tocForRust = pageData.toc.map((entry) => ({
|
|
9871
10553
|
depth: entry.depth,
|
|
9872
10554
|
text: entry.text,
|
|
@@ -9886,8 +10568,14 @@ async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, th
|
|
|
9886
10568
|
name: pageData.entryPage.hero.name,
|
|
9887
10569
|
text: pageData.entryPage.hero.text,
|
|
9888
10570
|
tagline: pageData.entryPage.hero.tagline,
|
|
10571
|
+
notice: pageData.entryPage.hero.notice ? {
|
|
10572
|
+
title: pageData.entryPage.hero.notice.title,
|
|
10573
|
+
body: pageData.entryPage.hero.notice.body
|
|
10574
|
+
} : void 0,
|
|
9889
10575
|
image: pageData.entryPage.hero.image ? {
|
|
9890
10576
|
src: pageData.entryPage.hero.image.src,
|
|
10577
|
+
lightSrc: pageData.entryPage.hero.image.lightSrc,
|
|
10578
|
+
darkSrc: pageData.entryPage.hero.image.darkSrc,
|
|
9891
10579
|
alt: pageData.entryPage.hero.image.alt,
|
|
9892
10580
|
width: pageData.entryPage.hero.image.width,
|
|
9893
10581
|
height: pageData.entryPage.hero.image.height
|
|
@@ -9969,7 +10657,7 @@ function createSharedAssetChunk(type, label, content, outDir, base) {
|
|
|
9969
10657
|
const hash = createContentHash(content);
|
|
9970
10658
|
const fileName = `ox-content-${sanitizeChunkLabel(label)}-${hash}.${type}`;
|
|
9971
10659
|
return {
|
|
9972
|
-
outputPath: path.join(outDir, "assets", fileName),
|
|
10660
|
+
outputPath: path$1.join(outDir, "assets", fileName),
|
|
9973
10661
|
publicPath: toPublicAssetPath(base, fileName),
|
|
9974
10662
|
content
|
|
9975
10663
|
};
|
|
@@ -10059,7 +10747,7 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10059
10747
|
});
|
|
10060
10748
|
const chunks = [...cssChunks.values(), ...jsChunks.values()];
|
|
10061
10749
|
await Promise.all(chunks.map(async (chunk) => {
|
|
10062
|
-
await fs.mkdir(path.dirname(chunk.outputPath), { recursive: true });
|
|
10750
|
+
await fs.mkdir(path$1.dirname(chunk.outputPath), { recursive: true });
|
|
10063
10751
|
await fs.writeFile(chunk.outputPath, chunk.content, "utf-8");
|
|
10064
10752
|
}));
|
|
10065
10753
|
return {
|
|
@@ -10071,16 +10759,16 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10071
10759
|
* Converts a markdown file path to its corresponding HTML output path.
|
|
10072
10760
|
*/
|
|
10073
10761
|
function getOutputPath(inputPath, srcDir, outDir, extension) {
|
|
10074
|
-
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
|
|
10075
|
-
if (baseName.endsWith(`index${extension}`)) return path.join(outDir, baseName);
|
|
10762
|
+
const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
|
|
10763
|
+
if (baseName.endsWith(`index${extension}`)) return path$1.join(outDir, baseName);
|
|
10076
10764
|
const dirName = baseName.replace(new RegExp(`\\${extension}$`), "");
|
|
10077
|
-
return path.join(outDir, dirName, `index${extension}`);
|
|
10765
|
+
return path$1.join(outDir, dirName, `index${extension}`);
|
|
10078
10766
|
}
|
|
10079
10767
|
/**
|
|
10080
10768
|
* Converts a markdown file path to a relative URL path.
|
|
10081
10769
|
*/
|
|
10082
10770
|
function getUrlPath$1(inputPath, srcDir) {
|
|
10083
|
-
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10771
|
+
const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10084
10772
|
if (baseName === "index" || baseName.endsWith("/index")) return baseName.replace(/\/?index$/, "") || "/";
|
|
10085
10773
|
return baseName;
|
|
10086
10774
|
}
|
|
@@ -10096,12 +10784,12 @@ function getHref(inputPath, srcDir, base, extension) {
|
|
|
10096
10784
|
* Gets the OG image output path for a given markdown file.
|
|
10097
10785
|
*/
|
|
10098
10786
|
function getOgImagePath(inputPath, srcDir, outDir) {
|
|
10099
|
-
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10787
|
+
const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10100
10788
|
if (baseName === "index" || baseName.endsWith("/index")) {
|
|
10101
10789
|
const dirPath = baseName.replace(/\/?index$/, "") || "";
|
|
10102
|
-
return path.join(outDir, dirPath, "og-image.png");
|
|
10790
|
+
return path$1.join(outDir, dirPath, "og-image.png");
|
|
10103
10791
|
}
|
|
10104
|
-
return path.join(outDir, baseName, "og-image.png");
|
|
10792
|
+
return path$1.join(outDir, baseName, "og-image.png");
|
|
10105
10793
|
}
|
|
10106
10794
|
/**
|
|
10107
10795
|
* Gets the OG image URL for use in meta tags.
|
|
@@ -10119,9 +10807,9 @@ function getOgImageUrl(inputPath, srcDir, base, siteUrl) {
|
|
|
10119
10807
|
* Gets display title from file path.
|
|
10120
10808
|
*/
|
|
10121
10809
|
function getDisplayTitle(filePath) {
|
|
10122
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
10810
|
+
const fileName = path$1.basename(filePath, path$1.extname(filePath));
|
|
10123
10811
|
if (fileName === "index") {
|
|
10124
|
-
const dirName = path.basename(path.dirname(filePath));
|
|
10812
|
+
const dirName = path$1.basename(path$1.dirname(filePath));
|
|
10125
10813
|
if (dirName && dirName !== ".") return formatTitle(dirName);
|
|
10126
10814
|
return "Home";
|
|
10127
10815
|
}
|
|
@@ -10137,7 +10825,7 @@ function formatTitle(name) {
|
|
|
10137
10825
|
* Collects all markdown files from the source directory.
|
|
10138
10826
|
*/
|
|
10139
10827
|
async function collectMarkdownFiles$1(srcDir) {
|
|
10140
|
-
return (await glob(path.join(srcDir, "**/*.{md,markdown}"), {
|
|
10828
|
+
return (await glob(path$1.join(srcDir, "**/*.{md,markdown}"), {
|
|
10141
10829
|
nodir: true,
|
|
10142
10830
|
ignore: [
|
|
10143
10831
|
"**/node_modules/**",
|
|
@@ -10158,7 +10846,7 @@ function buildNavItems(markdownFiles, srcDir, base, extension) {
|
|
|
10158
10846
|
"api"
|
|
10159
10847
|
];
|
|
10160
10848
|
for (const file of markdownFiles) {
|
|
10161
|
-
const parts = path.relative(srcDir, file).split(path.sep);
|
|
10849
|
+
const parts = path$1.relative(srcDir, file).split(path$1.sep);
|
|
10162
10850
|
let groupKey = "";
|
|
10163
10851
|
if (parts.length > 1) groupKey = parts[0];
|
|
10164
10852
|
if (!groups.has(groupKey)) groups.set(groupKey, []);
|
|
@@ -10207,8 +10895,8 @@ async function buildSsg(options, root) {
|
|
|
10207
10895
|
files: [],
|
|
10208
10896
|
errors: []
|
|
10209
10897
|
};
|
|
10210
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
10211
|
-
const outDir = path.resolve(root, options.outDir);
|
|
10898
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10899
|
+
const outDir = path$1.resolve(root, options.outDir);
|
|
10212
10900
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10213
10901
|
const generatedFiles = [];
|
|
10214
10902
|
const generatedPages = [];
|
|
@@ -10223,7 +10911,7 @@ async function buildSsg(options, root) {
|
|
|
10223
10911
|
const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);
|
|
10224
10912
|
let siteName = ssgOptions.siteName ?? "Documentation";
|
|
10225
10913
|
if (!ssgOptions.siteName) try {
|
|
10226
|
-
const pkgPath = path.join(root, "package.json");
|
|
10914
|
+
const pkgPath = path$1.join(root, "package.json");
|
|
10227
10915
|
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
|
|
10228
10916
|
if (pkg.name) siteName = formatTitle(pkg.name);
|
|
10229
10917
|
} catch {}
|
|
@@ -10337,7 +11025,7 @@ async function buildSsg(options, root) {
|
|
|
10337
11025
|
const optimizedOutput = await externalizeSharedPageAssets(generatedPages, outDir, base);
|
|
10338
11026
|
generatedFiles.push(...optimizedOutput.assets);
|
|
10339
11027
|
for (const page of optimizedOutput.pages) {
|
|
10340
|
-
await fs.mkdir(path.dirname(page.outputPath), { recursive: true });
|
|
11028
|
+
await fs.mkdir(path$1.dirname(page.outputPath), { recursive: true });
|
|
10341
11029
|
await fs.writeFile(page.outputPath, page.html, "utf-8");
|
|
10342
11030
|
generatedFiles.push(page.outputPath);
|
|
10343
11031
|
}
|
|
@@ -10346,7 +11034,6 @@ async function buildSsg(options, root) {
|
|
|
10346
11034
|
errors
|
|
10347
11035
|
};
|
|
10348
11036
|
}
|
|
10349
|
-
|
|
10350
11037
|
//#endregion
|
|
10351
11038
|
//#region src/search.ts
|
|
10352
11039
|
/**
|
|
@@ -10357,7 +11044,7 @@ async function buildSsg(options, root) {
|
|
|
10357
11044
|
let oxContent$1 = null;
|
|
10358
11045
|
async function getOxContent() {
|
|
10359
11046
|
if (!oxContent$1) try {
|
|
10360
|
-
oxContent$1 = await
|
|
11047
|
+
oxContent$1 = await importNapiModule();
|
|
10361
11048
|
} catch {
|
|
10362
11049
|
console.warn("[ox-content] Native bindings not available, search disabled");
|
|
10363
11050
|
return null;
|
|
@@ -10393,7 +11080,7 @@ async function collectMarkdownFiles(dir) {
|
|
|
10393
11080
|
try {
|
|
10394
11081
|
const entries = await fs.readdir(currentDir, { withFileTypes: true });
|
|
10395
11082
|
for (const entry of entries) {
|
|
10396
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
11083
|
+
const fullPath = path$1.join(currentDir, entry.name);
|
|
10397
11084
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") await walk(fullPath);
|
|
10398
11085
|
else if (entry.isFile() && entry.name.endsWith(".md")) files.push(fullPath);
|
|
10399
11086
|
}
|
|
@@ -10418,7 +11105,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10418
11105
|
const documents = [];
|
|
10419
11106
|
for (const file of files) try {
|
|
10420
11107
|
const content = await fs.readFile(file, "utf-8");
|
|
10421
|
-
const relativePath = path.relative(srcDir, file);
|
|
11108
|
+
const relativePath = path$1.relative(srcDir, file);
|
|
10422
11109
|
const url = base + relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10423
11110
|
const id = relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10424
11111
|
const extractSearchContent = napi.extractSearchContent;
|
|
@@ -10447,7 +11134,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10447
11134
|
* Writes the search index to a file.
|
|
10448
11135
|
*/
|
|
10449
11136
|
async function writeSearchIndex(indexJson, outDir) {
|
|
10450
|
-
const indexPath = path.join(outDir, "search-index.json");
|
|
11137
|
+
const indexPath = path$1.join(outDir, "search-index.json");
|
|
10451
11138
|
await fs.mkdir(outDir, { recursive: true });
|
|
10452
11139
|
await fs.writeFile(indexPath, indexJson, "utf-8");
|
|
10453
11140
|
}
|
|
@@ -10463,6 +11150,51 @@ const searchOptions = ${JSON.stringify(options)};
|
|
|
10463
11150
|
let searchIndex = null;
|
|
10464
11151
|
let indexPromise = null;
|
|
10465
11152
|
|
|
11153
|
+
function parseScopedQuery(query) {
|
|
11154
|
+
const scopes = [];
|
|
11155
|
+
const terms = [];
|
|
11156
|
+
|
|
11157
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
11158
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
11159
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
11160
|
+
} else {
|
|
11161
|
+
terms.push(part);
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
|
|
11165
|
+
return {
|
|
11166
|
+
text: terms.join(' ').trim(),
|
|
11167
|
+
scopes: [...new Set(scopes)],
|
|
11168
|
+
};
|
|
11169
|
+
}
|
|
11170
|
+
|
|
11171
|
+
function getScopesForDoc(doc) {
|
|
11172
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
11173
|
+
const segments = source.split('/').filter(Boolean);
|
|
11174
|
+
|
|
11175
|
+
if (segments.length <= 1) {
|
|
11176
|
+
return [];
|
|
11177
|
+
}
|
|
11178
|
+
|
|
11179
|
+
const scopes = [];
|
|
11180
|
+
let current = '';
|
|
11181
|
+
for (const segment of segments.slice(0, -1)) {
|
|
11182
|
+
current = current ? current + '/' + segment : segment;
|
|
11183
|
+
scopes.push(current);
|
|
11184
|
+
}
|
|
11185
|
+
|
|
11186
|
+
return scopes;
|
|
11187
|
+
}
|
|
11188
|
+
|
|
11189
|
+
function matchesScopes(doc, scopes) {
|
|
11190
|
+
if (!scopes.length) {
|
|
11191
|
+
return true;
|
|
11192
|
+
}
|
|
11193
|
+
|
|
11194
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
11195
|
+
return scopes.some(scope => docScopes.has(scope));
|
|
11196
|
+
}
|
|
11197
|
+
|
|
10466
11198
|
// Tokenizer for queries
|
|
10467
11199
|
function tokenizeQuery(text) {
|
|
10468
11200
|
const tokens = [];
|
|
@@ -10530,22 +11262,32 @@ async function loadIndex() {
|
|
|
10530
11262
|
export async function search(query, options = {}) {
|
|
10531
11263
|
const index = await loadIndex();
|
|
10532
11264
|
|
|
10533
|
-
if (!index
|
|
11265
|
+
if (!index) {
|
|
10534
11266
|
return [];
|
|
10535
11267
|
}
|
|
10536
11268
|
|
|
10537
|
-
const
|
|
10538
|
-
const prefix = options.prefix ?? searchOptions.prefix;
|
|
10539
|
-
const tokens = tokenizeQuery(query);
|
|
11269
|
+
const parsedQuery = parseScopedQuery(query);
|
|
10540
11270
|
|
|
10541
|
-
if (
|
|
11271
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
10542
11272
|
return [];
|
|
10543
11273
|
}
|
|
10544
11274
|
|
|
11275
|
+
const limit = options.limit ?? searchOptions.limit;
|
|
11276
|
+
const prefix = options.prefix ?? searchOptions.prefix;
|
|
11277
|
+
const tokens = tokenizeQuery(parsedQuery.text);
|
|
11278
|
+
|
|
10545
11279
|
const k1 = 1.2;
|
|
10546
11280
|
const b = 0.75;
|
|
10547
11281
|
const docScores = new Map();
|
|
10548
11282
|
|
|
11283
|
+
if (tokens.length === 0) {
|
|
11284
|
+
index.documents.forEach((doc, docIdx) => {
|
|
11285
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
11286
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
11287
|
+
}
|
|
11288
|
+
});
|
|
11289
|
+
}
|
|
11290
|
+
|
|
10549
11291
|
for (let i = 0; i < tokens.length; i++) {
|
|
10550
11292
|
const token = tokens[i];
|
|
10551
11293
|
const isLast = i === tokens.length - 1;
|
|
@@ -10566,6 +11308,7 @@ export async function search(query, options = {}) {
|
|
|
10566
11308
|
for (const posting of postings) {
|
|
10567
11309
|
const doc = index.documents[posting.doc_idx];
|
|
10568
11310
|
if (!doc) continue;
|
|
11311
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
10569
11312
|
|
|
10570
11313
|
const docLen = doc.body.length;
|
|
10571
11314
|
const tf = posting.tf;
|
|
@@ -10588,6 +11331,7 @@ export async function search(query, options = {}) {
|
|
|
10588
11331
|
.map(([docIdx, data]) => {
|
|
10589
11332
|
const doc = index.documents[docIdx];
|
|
10590
11333
|
const matches = Array.from(data.matches);
|
|
11334
|
+
const scopes = getScopesForDoc(doc);
|
|
10591
11335
|
|
|
10592
11336
|
// Generate snippet
|
|
10593
11337
|
let snippet = '';
|
|
@@ -10601,7 +11345,7 @@ export async function search(query, options = {}) {
|
|
|
10601
11345
|
}
|
|
10602
11346
|
}
|
|
10603
11347
|
|
|
10604
|
-
const start = Math.max(0, firstPos - 50);
|
|
11348
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
10605
11349
|
const end = Math.min(doc.body.length, start + 150);
|
|
10606
11350
|
snippet = doc.body.slice(start, end);
|
|
10607
11351
|
if (start > 0) snippet = '...' + snippet;
|
|
@@ -10615,9 +11359,10 @@ export async function search(query, options = {}) {
|
|
|
10615
11359
|
score: data.score,
|
|
10616
11360
|
matches,
|
|
10617
11361
|
snippet,
|
|
11362
|
+
scopes,
|
|
10618
11363
|
};
|
|
10619
11364
|
})
|
|
10620
|
-
.sort((a, b) => b.score - a.score)
|
|
11365
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
10621
11366
|
.slice(0, limit);
|
|
10622
11367
|
|
|
10623
11368
|
return results;
|
|
@@ -10627,7 +11372,6 @@ export { searchOptions };
|
|
|
10627
11372
|
export default { search, searchOptions, loadIndex };
|
|
10628
11373
|
`;
|
|
10629
11374
|
}
|
|
10630
|
-
|
|
10631
11375
|
//#endregion
|
|
10632
11376
|
//#region src/dev-server.ts
|
|
10633
11377
|
/**
|
|
@@ -10692,12 +11436,12 @@ async function resolveMarkdownFile(url, srcDir) {
|
|
|
10692
11436
|
let relativePath;
|
|
10693
11437
|
if (pathname === "/") relativePath = "index.md";
|
|
10694
11438
|
else relativePath = pathname.slice(1) + ".md";
|
|
10695
|
-
const filePath = path.join(srcDir, relativePath);
|
|
11439
|
+
const filePath = path$1.join(srcDir, relativePath);
|
|
10696
11440
|
try {
|
|
10697
11441
|
await fs.access(filePath);
|
|
10698
11442
|
return filePath;
|
|
10699
11443
|
} catch {
|
|
10700
|
-
const indexPath = path.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
|
|
11444
|
+
const indexPath = path$1.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
|
|
10701
11445
|
try {
|
|
10702
11446
|
await fs.access(indexPath);
|
|
10703
11447
|
return indexPath;
|
|
@@ -10741,7 +11485,7 @@ function invalidatePageCache(cache, filePath) {
|
|
|
10741
11485
|
async function resolveSiteName(options, root) {
|
|
10742
11486
|
if (options.ssg.siteName) return options.ssg.siteName;
|
|
10743
11487
|
try {
|
|
10744
|
-
const pkgPath = path.join(root, "package.json");
|
|
11488
|
+
const pkgPath = path$1.join(root, "package.json");
|
|
10745
11489
|
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
|
|
10746
11490
|
if (pkg.name) return formatTitle(pkg.name);
|
|
10747
11491
|
} catch {}
|
|
@@ -10751,7 +11495,7 @@ async function resolveSiteName(options, root) {
|
|
|
10751
11495
|
* Render a single markdown page to full HTML.
|
|
10752
11496
|
*/
|
|
10753
11497
|
async function renderPage$1(filePath, options, navGroups, siteName, base, root) {
|
|
10754
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
11498
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10755
11499
|
resetTabGroupCounter();
|
|
10756
11500
|
resetIslandCounter();
|
|
10757
11501
|
const result = await transformMarkdown(await fs.readFile(filePath, "utf-8"), filePath, options, {
|
|
@@ -10796,7 +11540,7 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root)
|
|
|
10796
11540
|
* Create the dev server middleware for SSG page serving.
|
|
10797
11541
|
*/
|
|
10798
11542
|
function createDevServerMiddleware(options, root, cache) {
|
|
10799
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
11543
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10800
11544
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10801
11545
|
return async (req, res, next) => {
|
|
10802
11546
|
const url = req.url;
|
|
@@ -10828,7 +11572,6 @@ function createDevServerMiddleware(options, root, cache) {
|
|
|
10828
11572
|
}
|
|
10829
11573
|
};
|
|
10830
11574
|
}
|
|
10831
|
-
|
|
10832
11575
|
//#endregion
|
|
10833
11576
|
//#region src/og-viewer.ts
|
|
10834
11577
|
/**
|
|
@@ -10862,7 +11605,7 @@ function extractTitle(content, frontmatter) {
|
|
|
10862
11605
|
return match ? match[1].trim() : "";
|
|
10863
11606
|
}
|
|
10864
11607
|
function getUrlPath(filePath, srcDir) {
|
|
10865
|
-
let rel = path.relative(srcDir, filePath).replace(/\\/g, "/");
|
|
11608
|
+
let rel = path$1.relative(srcDir, filePath).replace(/\\/g, "/");
|
|
10866
11609
|
rel = rel.replace(/\.md$/, "");
|
|
10867
11610
|
if (rel === "index") return "/";
|
|
10868
11611
|
if (rel.endsWith("/index")) rel = rel.slice(0, -6);
|
|
@@ -10902,7 +11645,7 @@ function validatePage(page, options) {
|
|
|
10902
11645
|
return warnings;
|
|
10903
11646
|
}
|
|
10904
11647
|
async function collectPages(options, root) {
|
|
10905
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
11648
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10906
11649
|
const files = await glob("**/*.md", {
|
|
10907
11650
|
cwd: srcDir,
|
|
10908
11651
|
absolute: true
|
|
@@ -10920,7 +11663,7 @@ async function collectPages(options, root) {
|
|
|
10920
11663
|
const urlPath = getUrlPath(file, srcDir);
|
|
10921
11664
|
const ogImageUrl = computeOgImageUrl(urlPath, options.base, options.ssg.siteUrl, generateOgImage, options.ssg.ogImage);
|
|
10922
11665
|
const page = {
|
|
10923
|
-
path: path.relative(srcDir, file),
|
|
11666
|
+
path: path$1.relative(srcDir, file),
|
|
10924
11667
|
urlPath,
|
|
10925
11668
|
title,
|
|
10926
11669
|
description,
|
|
@@ -10947,43 +11690,41 @@ function renderViewerHtml(pages, options) {
|
|
|
10947
11690
|
<style>
|
|
10948
11691
|
:root {
|
|
10949
11692
|
--bg: #ffffff;
|
|
10950
|
-
--bg-card: #
|
|
11693
|
+
--bg-card: #f5f7fb;
|
|
10951
11694
|
--bg-preview: #ffffff;
|
|
10952
|
-
--text: #
|
|
10953
|
-
--text-muted: #
|
|
10954
|
-
--border: #
|
|
10955
|
-
--accent: #
|
|
10956
|
-
--accent-light: #
|
|
11695
|
+
--text: #131a30;
|
|
11696
|
+
--text-muted: #4f607b;
|
|
11697
|
+
--border: #d2dbea;
|
|
11698
|
+
--accent: #4f6fae;
|
|
11699
|
+
--accent-light: #eef2fa;
|
|
10957
11700
|
--error: #dc2626;
|
|
10958
11701
|
--error-bg: #fef2f2;
|
|
10959
11702
|
--warning: #d97706;
|
|
10960
11703
|
--warning-bg: #fffbeb;
|
|
10961
11704
|
--success: #16a34a;
|
|
10962
|
-
--tag-bg: #
|
|
10963
|
-
--
|
|
10964
|
-
--radius: 8px;
|
|
11705
|
+
--tag-bg: #ecf3ff;
|
|
11706
|
+
--radius: 16px;
|
|
10965
11707
|
}
|
|
10966
11708
|
@media (prefers-color-scheme: dark) {
|
|
10967
11709
|
:root {
|
|
10968
|
-
--bg: #
|
|
10969
|
-
--bg-card: #
|
|
10970
|
-
--bg-preview: #
|
|
10971
|
-
--text: #
|
|
10972
|
-
--text-muted: #
|
|
10973
|
-
--border: #
|
|
10974
|
-
--accent: #
|
|
10975
|
-
--accent-light: #
|
|
11710
|
+
--bg: #060816;
|
|
11711
|
+
--bg-card: #0d1528;
|
|
11712
|
+
--bg-preview: #10172d;
|
|
11713
|
+
--text: #ebf2ff;
|
|
11714
|
+
--text-muted: #8ea0bf;
|
|
11715
|
+
--border: #223252;
|
|
11716
|
+
--accent: #86a4da;
|
|
11717
|
+
--accent-light: #151730;
|
|
10976
11718
|
--error: #f87171;
|
|
10977
11719
|
--error-bg: #450a0a;
|
|
10978
11720
|
--warning: #fbbf24;
|
|
10979
11721
|
--warning-bg: #451a03;
|
|
10980
11722
|
--success: #4ade80;
|
|
10981
|
-
--tag-bg: #
|
|
10982
|
-
--shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
11723
|
+
--tag-bg: #131b33;
|
|
10983
11724
|
}
|
|
10984
11725
|
}
|
|
10985
11726
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
10986
|
-
body { font-family:
|
|
11727
|
+
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); }
|
|
10987
11728
|
.header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
|
|
10988
11729
|
.header svg { width: 28px; height: 28px; color: var(--accent); }
|
|
10989
11730
|
.header h1 { font-size: 18px; font-weight: 600; }
|
|
@@ -11004,7 +11745,7 @@ function renderViewerHtml(pages, options) {
|
|
|
11004
11745
|
.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; }
|
|
11005
11746
|
.search-input::placeholder { color: var(--text-muted); }
|
|
11006
11747
|
.container { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1200px; margin: 0 auto; }
|
|
11007
|
-
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card);
|
|
11748
|
+
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
|
|
11008
11749
|
.card-header { padding: 16px; border-bottom: 1px solid var(--border); }
|
|
11009
11750
|
.card-path { font-size: 12px; color: var(--text-muted); font-family: monospace; margin-bottom: 4px; }
|
|
11010
11751
|
.card-title { font-size: 16px; font-weight: 600; }
|
|
@@ -11175,7 +11916,6 @@ function createOgViewerPlugin(options) {
|
|
|
11175
11916
|
}
|
|
11176
11917
|
};
|
|
11177
11918
|
}
|
|
11178
|
-
|
|
11179
11919
|
//#endregion
|
|
11180
11920
|
//#region src/i18n.ts
|
|
11181
11921
|
/**
|
|
@@ -11236,13 +11976,13 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11236
11976
|
},
|
|
11237
11977
|
async buildStart() {
|
|
11238
11978
|
if (!i18nOptions || !i18nOptions.check) return;
|
|
11239
|
-
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11979
|
+
const dictDir = path$1.resolve(root, i18nOptions.dir);
|
|
11240
11980
|
if (!fs$1.existsSync(dictDir)) {
|
|
11241
11981
|
console.warn(`[ox-content:i18n] Dictionary directory not found: ${dictDir}`);
|
|
11242
11982
|
return;
|
|
11243
11983
|
}
|
|
11244
11984
|
try {
|
|
11245
|
-
const { loadDictionaries, checkI18n, extractTranslationKeys } = await
|
|
11985
|
+
const { loadDictionaries, checkI18n, extractTranslationKeys } = await importNapiModule();
|
|
11246
11986
|
const loadResult = loadDictionaries(dictDir);
|
|
11247
11987
|
if (loadResult.errors.length > 0) {
|
|
11248
11988
|
for (const error of loadResult.errors) console.warn(`[ox-content:i18n] ${error}`);
|
|
@@ -11258,7 +11998,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11258
11998
|
},
|
|
11259
11999
|
configureServer(server) {
|
|
11260
12000
|
if (!i18nOptions) return;
|
|
11261
|
-
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
12001
|
+
const dictDir = path$1.resolve(root, i18nOptions.dir);
|
|
11262
12002
|
if (fs$1.existsSync(dictDir)) {
|
|
11263
12003
|
server.watcher.add(dictDir);
|
|
11264
12004
|
server.watcher.on("change", (filePath) => {
|
|
@@ -11285,7 +12025,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11285
12025
|
* Generates the virtual module for i18n configuration.
|
|
11286
12026
|
*/
|
|
11287
12027
|
function generateI18nModule(options, root) {
|
|
11288
|
-
const dictDir = path.resolve(root, options.dir);
|
|
12028
|
+
const dictDir = path$1.resolve(root, options.dir);
|
|
11289
12029
|
const localesJson = JSON.stringify(options.locales);
|
|
11290
12030
|
const defaultLocale = JSON.stringify(options.defaultLocale);
|
|
11291
12031
|
let dictionariesCode = "{}";
|
|
@@ -11368,15 +12108,15 @@ function flattenObject(obj, prefix, result) {
|
|
|
11368
12108
|
function loadDictionariesFallback(options, dictDir) {
|
|
11369
12109
|
const dictData = {};
|
|
11370
12110
|
for (const locale of options.locales) {
|
|
11371
|
-
const localeDir = path.join(dictDir, locale.code);
|
|
12111
|
+
const localeDir = path$1.join(dictDir, locale.code);
|
|
11372
12112
|
if (!fs$1.existsSync(localeDir)) continue;
|
|
11373
12113
|
const files = fs$1.readdirSync(localeDir);
|
|
11374
12114
|
const localeDict = {};
|
|
11375
12115
|
for (const file of files) {
|
|
11376
12116
|
if (!file.endsWith(".json")) continue;
|
|
11377
|
-
const filePath = path.join(localeDir, file);
|
|
12117
|
+
const filePath = path$1.join(localeDir, file);
|
|
11378
12118
|
const content = fs$1.readFileSync(filePath, "utf-8");
|
|
11379
|
-
const namespace = path.basename(file, ".json");
|
|
12119
|
+
const namespace = path$1.basename(file, ".json");
|
|
11380
12120
|
try {
|
|
11381
12121
|
flattenObject(JSON.parse(content), namespace, localeDict);
|
|
11382
12122
|
} catch {}
|
|
@@ -11389,13 +12129,13 @@ function loadDictionariesFallback(options, dictDir) {
|
|
|
11389
12129
|
* Collects translation keys from source files using NAPI extractTranslationKeys.
|
|
11390
12130
|
*/
|
|
11391
12131
|
function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
11392
|
-
const srcDir = path.resolve(root, "src");
|
|
12132
|
+
const srcDir = path$1.resolve(root, "src");
|
|
11393
12133
|
const keys = /* @__PURE__ */ new Set();
|
|
11394
12134
|
if (fs$1.existsSync(srcDir)) walkDir(srcDir, /\.(ts|tsx|js|jsx)$/, (filePath) => {
|
|
11395
12135
|
const usages = extractTranslationKeys(fs$1.readFileSync(filePath, "utf-8"), filePath, options.functionNames);
|
|
11396
12136
|
for (const usage of usages) keys.add(usage.key);
|
|
11397
12137
|
});
|
|
11398
|
-
const contentDir = path.resolve(root, "content");
|
|
12138
|
+
const contentDir = path$1.resolve(root, "content");
|
|
11399
12139
|
if (fs$1.existsSync(contentDir)) {
|
|
11400
12140
|
const tPattern = /\{\{t\(['"]([^'"]+)['"]\)\}\}/g;
|
|
11401
12141
|
walkDir(contentDir, /\.(md|mdx)$/, (filePath) => {
|
|
@@ -11413,14 +12153,13 @@ function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
|
11413
12153
|
function walkDir(dir, pattern, callback) {
|
|
11414
12154
|
const entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
11415
12155
|
for (const entry of entries) {
|
|
11416
|
-
const fullPath = path.join(dir, entry.name);
|
|
12156
|
+
const fullPath = path$1.join(dir, entry.name);
|
|
11417
12157
|
if (entry.isDirectory()) {
|
|
11418
12158
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
11419
12159
|
walkDir(fullPath, pattern, callback);
|
|
11420
12160
|
} else if (pattern.test(entry.name)) callback(fullPath);
|
|
11421
12161
|
}
|
|
11422
12162
|
}
|
|
11423
|
-
|
|
11424
12163
|
//#endregion
|
|
11425
12164
|
//#region src/jsx-runtime.ts
|
|
11426
12165
|
/**
|
|
@@ -11610,7 +12349,6 @@ function when(condition, content) {
|
|
|
11610
12349
|
function each(items, render) {
|
|
11611
12350
|
return { __html: items.map((item, i) => render(item, i).__html).join("") };
|
|
11612
12351
|
}
|
|
11613
|
-
|
|
11614
12352
|
//#endregion
|
|
11615
12353
|
//#region src/page-context.ts
|
|
11616
12354
|
var page_context_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -11801,7 +12539,6 @@ var currentContext;
|
|
|
11801
12539
|
var init_page_context = __esmMin((() => {
|
|
11802
12540
|
currentContext = null;
|
|
11803
12541
|
}));
|
|
11804
|
-
|
|
11805
12542
|
//#endregion
|
|
11806
12543
|
//#region src/theme-renderer.ts
|
|
11807
12544
|
/**
|
|
@@ -11903,13 +12640,16 @@ function DefaultTheme({ children }) {
|
|
|
11903
12640
|
${page.description ? `<meta name="description" content="${escapeHtml(page.description)}">` : ""}
|
|
11904
12641
|
<style>
|
|
11905
12642
|
:root {
|
|
11906
|
-
--octc-color-primary: #
|
|
11907
|
-
--octc-color-text: #
|
|
12643
|
+
--octc-color-primary: #4f6fae;
|
|
12644
|
+
--octc-color-text: #131a30;
|
|
11908
12645
|
--octc-color-bg: #ffffff;
|
|
12646
|
+
--octc-color-bg-alt: #f5f7fb;
|
|
12647
|
+
--octc-color-text-muted: #4f607b;
|
|
12648
|
+
--octc-color-border: #d2dbea;
|
|
11909
12649
|
}
|
|
11910
12650
|
body {
|
|
11911
|
-
font-family:
|
|
11912
|
-
line-height: 1.
|
|
12651
|
+
font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI Variable", "Segoe UI", sans-serif;
|
|
12652
|
+
line-height: 1.7;
|
|
11913
12653
|
color: var(--octc-color-text);
|
|
11914
12654
|
background: var(--octc-color-bg);
|
|
11915
12655
|
max-width: 800px;
|
|
@@ -11959,7 +12699,6 @@ function createTheme(config) {
|
|
|
11959
12699
|
return Layout({ children });
|
|
11960
12700
|
};
|
|
11961
12701
|
}
|
|
11962
|
-
|
|
11963
12702
|
//#endregion
|
|
11964
12703
|
//#region src/index.ts
|
|
11965
12704
|
/**
|
|
@@ -11994,8 +12733,8 @@ function oxContent(options = {}) {
|
|
|
11994
12733
|
async function regenerateDocs(root) {
|
|
11995
12734
|
const docsOptions = resolvedOptions.docs;
|
|
11996
12735
|
if (!docsOptions || !docsOptions.enabled) return 0;
|
|
11997
|
-
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
11998
|
-
const outDir = path.resolve(root, docsOptions.out);
|
|
12736
|
+
const srcDirs = docsOptions.src.map((src) => path$1.resolve(root, src));
|
|
12737
|
+
const outDir = path$1.resolve(root, docsOptions.out);
|
|
11999
12738
|
const extracted = await extractDocs(srcDirs, docsOptions);
|
|
12000
12739
|
const generated = generateMarkdown(extracted, docsOptions);
|
|
12001
12740
|
await writeDocs(generated, outDir, extracted, docsOptions);
|
|
@@ -12064,7 +12803,7 @@ function oxContent(options = {}) {
|
|
|
12064
12803
|
const docsOptions = resolvedOptions.docs;
|
|
12065
12804
|
if (!docsOptions || !docsOptions.enabled) return;
|
|
12066
12805
|
const root = config?.root || process.cwd();
|
|
12067
|
-
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
12806
|
+
const srcDirs = docsOptions.src.map((src) => path$1.resolve(root, src));
|
|
12068
12807
|
for (const srcDir of srcDirs) devServer.watcher.add(srcDir);
|
|
12069
12808
|
devServer.watcher.on("all", async (event, file) => {
|
|
12070
12809
|
if (event !== "add" && event !== "change" && event !== "unlink") return;
|
|
@@ -12080,7 +12819,7 @@ function oxContent(options = {}) {
|
|
|
12080
12819
|
configureServer(devServer) {
|
|
12081
12820
|
if (!resolvedOptions.ssg.enabled) return;
|
|
12082
12821
|
const root = config?.root || process.cwd();
|
|
12083
|
-
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12822
|
+
const srcDir = path$1.resolve(root, resolvedOptions.srcDir);
|
|
12084
12823
|
devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));
|
|
12085
12824
|
devServer.watcher.on("add", (file) => {
|
|
12086
12825
|
if (file.startsWith(srcDir) && file.endsWith(".md")) {
|
|
@@ -12147,7 +12886,7 @@ function oxContent(options = {}) {
|
|
|
12147
12886
|
async buildStart() {
|
|
12148
12887
|
if (!resolvedOptions.search.enabled) return;
|
|
12149
12888
|
const root = config?.root || process.cwd();
|
|
12150
|
-
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12889
|
+
const srcDir = path$1.resolve(root, resolvedOptions.srcDir);
|
|
12151
12890
|
try {
|
|
12152
12891
|
searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);
|
|
12153
12892
|
console.log("[ox-content] Search index built");
|
|
@@ -12158,10 +12897,10 @@ function oxContent(options = {}) {
|
|
|
12158
12897
|
async closeBundle() {
|
|
12159
12898
|
if (!resolvedOptions.search.enabled || !searchIndexJson) return;
|
|
12160
12899
|
const root = config?.root || process.cwd();
|
|
12161
|
-
const outDir = path.resolve(root, resolvedOptions.outDir);
|
|
12900
|
+
const outDir = path$1.resolve(root, resolvedOptions.outDir);
|
|
12162
12901
|
try {
|
|
12163
12902
|
await writeSearchIndex(searchIndexJson, outDir);
|
|
12164
|
-
console.log("[ox-content] Search index written to", path.join(outDir, "search-index.json"));
|
|
12903
|
+
console.log("[ox-content] Search index written to", path$1.join(outDir, "search-index.json"));
|
|
12165
12904
|
} catch (err) {
|
|
12166
12905
|
console.warn("[ox-content] Failed to write search index:", err);
|
|
12167
12906
|
}
|
|
@@ -12189,6 +12928,7 @@ function resolveOptions(options) {
|
|
|
12189
12928
|
highlight: options.highlight ?? false,
|
|
12190
12929
|
highlightTheme: options.highlightTheme ?? "github-dark",
|
|
12191
12930
|
highlightLangs: options.highlightLangs ?? [],
|
|
12931
|
+
codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
|
|
12192
12932
|
mermaid: options.mermaid ?? false,
|
|
12193
12933
|
frontmatter: options.frontmatter ?? true,
|
|
12194
12934
|
toc: options.toc ?? true,
|
|
@@ -12202,6 +12942,26 @@ function resolveOptions(options) {
|
|
|
12202
12942
|
i18n: resolveI18nOptions(options.i18n)
|
|
12203
12943
|
};
|
|
12204
12944
|
}
|
|
12945
|
+
function resolveCodeAnnotationsOptions(options) {
|
|
12946
|
+
if (!options) return {
|
|
12947
|
+
enabled: false,
|
|
12948
|
+
notation: "attribute",
|
|
12949
|
+
metaKey: "annotate",
|
|
12950
|
+
defaultLineNumbers: false
|
|
12951
|
+
};
|
|
12952
|
+
if (options === true) return {
|
|
12953
|
+
enabled: true,
|
|
12954
|
+
notation: "attribute",
|
|
12955
|
+
metaKey: "annotate",
|
|
12956
|
+
defaultLineNumbers: false
|
|
12957
|
+
};
|
|
12958
|
+
return {
|
|
12959
|
+
enabled: true,
|
|
12960
|
+
notation: options.notation ?? "attribute",
|
|
12961
|
+
metaKey: options.metaKey ?? "annotate",
|
|
12962
|
+
defaultLineNumbers: options.defaultLineNumbers ?? false
|
|
12963
|
+
};
|
|
12964
|
+
}
|
|
12205
12965
|
/**
|
|
12206
12966
|
* Generates virtual module content.
|
|
12207
12967
|
*/
|
|
@@ -12219,7 +12979,7 @@ function generateVirtualModule(path, options) {
|
|
|
12219
12979
|
`;
|
|
12220
12980
|
return "export default {};";
|
|
12221
12981
|
}
|
|
12222
|
-
|
|
12223
12982
|
//#endregion
|
|
12224
12983
|
export { DEFAULT_HTML_TEMPLATE, DefaultTheme, Fragment, buildSearchIndex, buildSsg, clearRenderContext, collectGitHubRepos, collectOgpUrls, createI18nPlugin, createMarkdownEnvironment, createTheme, defaultTheme, defineTheme, each, extractDocs, extractIslandInfo, extractVideoId, fetchOgpData, fetchRepoData, generateFrontmatterTypes, generateHydrationScript, generateMarkdown, generateOgImages, generateTabsCSS, generateTypes, hasIslands, inferType, jsx, jsxs, mergeThemes, mermaidClientScript, oxContent, prefetchGitHubRepos, prefetchOgpData, raw, renderAllPages, renderPage, renderToString, resolveDocsOptions, resolveI18nOptions, resolveOgImageOptions, resolveSearchOptions, resolveSsgOptions, resolveTheme, setRenderContext, transformAllPlugins, transformGitHub, transformIslands, transformMarkdown, transformMermaidStatic, transformOgp, transformTabs, transformYouTube, useIsActive, useNav, usePageProps, useRenderContext, useSiteConfig, when, writeDocs, writeSearchIndex };
|
|
12225
|
-
|
|
12984
|
+
|
|
12985
|
+
//# sourceMappingURL=index.mjs.map
|