@ox-content/vite-plugin 1.0.0-alpha.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +467 -292
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -66
- package/dist/index.d.cts.map +1 -1
- package/dist/{index.d.ts → index.d.mts} +80 -67
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +479 -317
- 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.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,15 +6695,23 @@ 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
|
-
langs:
|
|
6703
|
+
const cacheKey = JSON.stringify({
|
|
6704
|
+
theme,
|
|
6705
|
+
langs: customLangs
|
|
6802
6706
|
});
|
|
6707
|
+
let highlighterPromise = highlighterCache.get(cacheKey);
|
|
6708
|
+
if (!highlighterPromise) {
|
|
6709
|
+
highlighterPromise = createHighlighter({
|
|
6710
|
+
themes: [theme],
|
|
6711
|
+
langs: [...BUILTIN_LANGS, ...customLangs]
|
|
6712
|
+
});
|
|
6713
|
+
highlighterCache.set(cacheKey, highlighterPromise);
|
|
6714
|
+
}
|
|
6803
6715
|
return highlighterPromise;
|
|
6804
6716
|
}
|
|
6805
6717
|
/**
|
|
@@ -6815,12 +6727,9 @@ function rehypeShikiHighlight(options) {
|
|
|
6815
6727
|
if (child.type === "element" && child.tagName === "pre") {
|
|
6816
6728
|
const codeElement = child.children.find((c) => c.type === "element" && c.tagName === "code");
|
|
6817
6729
|
if (codeElement) {
|
|
6818
|
-
const className = codeElement.properties?.className;
|
|
6819
6730
|
let lang = "text";
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
if (langClass && typeof langClass === "string") lang = langClass.replace("language-", "");
|
|
6823
|
-
}
|
|
6731
|
+
const langClass = normalizeClassName(codeElement.properties?.className).find((value) => value.startsWith("language-"));
|
|
6732
|
+
if (langClass) lang = langClass.replace("language-", "");
|
|
6824
6733
|
const codeText = getTextContent(codeElement);
|
|
6825
6734
|
try {
|
|
6826
6735
|
const highlighted = highlighter.codeToHtml(codeText, {
|
|
@@ -6828,7 +6737,12 @@ function rehypeShikiHighlight(options) {
|
|
|
6828
6737
|
theme
|
|
6829
6738
|
});
|
|
6830
6739
|
const parsed = unified().use(rehypeParse, { fragment: true }).parse(highlighted);
|
|
6831
|
-
if (parsed.children[0]
|
|
6740
|
+
if (parsed.children[0]?.type === "element") {
|
|
6741
|
+
const highlightedPre = parsed.children[0];
|
|
6742
|
+
highlightedPre.properties ??= {};
|
|
6743
|
+
highlightedPre.properties["data-language"] = lang;
|
|
6744
|
+
node.children[i] = highlightedPre;
|
|
6745
|
+
}
|
|
6832
6746
|
} catch {}
|
|
6833
6747
|
}
|
|
6834
6748
|
} else if (child.type === "element") await visit(child);
|
|
@@ -6848,6 +6762,11 @@ function getTextContent(node) {
|
|
|
6848
6762
|
}
|
|
6849
6763
|
return text;
|
|
6850
6764
|
}
|
|
6765
|
+
function normalizeClassName(className) {
|
|
6766
|
+
if (Array.isArray(className)) return className.filter((value) => typeof value === "string");
|
|
6767
|
+
if (typeof className === "string" && className) return className.split(/\s+/).filter(Boolean);
|
|
6768
|
+
return [];
|
|
6769
|
+
}
|
|
6851
6770
|
/**
|
|
6852
6771
|
* Apply syntax highlighting to HTML using Shiki.
|
|
6853
6772
|
*/
|
|
@@ -6858,7 +6777,6 @@ async function highlightCode(html, theme = "github-dark", langs = []) {
|
|
|
6858
6777
|
}).use(rehypeStringify).process(html);
|
|
6859
6778
|
return String(result);
|
|
6860
6779
|
}
|
|
6861
|
-
|
|
6862
6780
|
//#endregion
|
|
6863
6781
|
//#region src/plugins/mermaid-protect.ts
|
|
6864
6782
|
/**
|
|
@@ -6911,7 +6829,6 @@ function restoreMermaidSvgs(html, svgs) {
|
|
|
6911
6829
|
for (const [placeholder, content] of svgs) result = result.replace(placeholder, content);
|
|
6912
6830
|
return result;
|
|
6913
6831
|
}
|
|
6914
|
-
|
|
6915
6832
|
//#endregion
|
|
6916
6833
|
//#region src/transform.ts
|
|
6917
6834
|
/**
|
|
@@ -6999,7 +6916,7 @@ async function loadNapiBindings() {
|
|
|
6999
6916
|
if (napiLoadAttempted) return napiBindings ?? null;
|
|
7000
6917
|
napiLoadAttempted = true;
|
|
7001
6918
|
try {
|
|
7002
|
-
const mod = await
|
|
6919
|
+
const mod = await importNapiModule();
|
|
7003
6920
|
napiBindings = mod;
|
|
7004
6921
|
return mod;
|
|
7005
6922
|
} catch (error) {
|
|
@@ -7021,7 +6938,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
7021
6938
|
tocMaxDepth: options.tocMaxDepth,
|
|
7022
6939
|
convertMdLinks: ssgOptions?.convertMdLinks,
|
|
7023
6940
|
baseUrl: ssgOptions?.baseUrl,
|
|
7024
|
-
sourcePath: ssgOptions?.sourcePath ?? filePath
|
|
6941
|
+
sourcePath: ssgOptions?.sourcePath ?? filePath,
|
|
6942
|
+
codeAnnotations: options.codeAnnotations.enabled,
|
|
6943
|
+
codeAnnotationMetaKey: options.codeAnnotations.metaKey,
|
|
6944
|
+
codeAnnotationSyntax: options.codeAnnotations.notation,
|
|
6945
|
+
codeAnnotationDefaultLineNumbers: options.codeAnnotations.defaultLineNumbers
|
|
7025
6946
|
});
|
|
7026
6947
|
if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
|
|
7027
6948
|
let html = result.html;
|
|
@@ -7033,7 +6954,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
7033
6954
|
if (options.mermaid) html = await transformMermaidStatic(html);
|
|
7034
6955
|
const { html: protectedHtml, svgs } = protectMermaidSvgs(html);
|
|
7035
6956
|
html = protectedHtml;
|
|
7036
|
-
if (options.highlight)
|
|
6957
|
+
if (options.highlight) {
|
|
6958
|
+
const originalHtml = html;
|
|
6959
|
+
const highlightedHtml = await highlightCode(html, options.highlightTheme, options.highlightLangs);
|
|
6960
|
+
html = napi.mergeHighlightedCodeBlocks(originalHtml, highlightedHtml);
|
|
6961
|
+
}
|
|
7037
6962
|
html = restoreMermaidSvgs(html, svgs);
|
|
7038
6963
|
return {
|
|
7039
6964
|
code: generateModuleCode(html, frontmatter, toc, filePath, options),
|
|
@@ -7129,7 +7054,6 @@ if (import.meta.hot) {
|
|
|
7129
7054
|
}
|
|
7130
7055
|
`;
|
|
7131
7056
|
}
|
|
7132
|
-
|
|
7133
7057
|
//#endregion
|
|
7134
7058
|
//#region src/nav-generator.ts
|
|
7135
7059
|
/**
|
|
@@ -7276,7 +7200,7 @@ function generateNavMetadata(docs, basePath = "/api") {
|
|
|
7276
7200
|
* @internal
|
|
7277
7201
|
*/
|
|
7278
7202
|
function getDocDisplayName(filePath) {
|
|
7279
|
-
const fileName = path
|
|
7203
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
|
7280
7204
|
if (fileName === "index" || fileName === "index-module") return "Overview";
|
|
7281
7205
|
return fileName.replace(/[-_]([a-z])/g, (_, char) => " " + char.toUpperCase()).replace(/^[a-z]/, (char) => char.toUpperCase());
|
|
7282
7206
|
}
|
|
@@ -7293,7 +7217,7 @@ function getDocDisplayName(filePath) {
|
|
|
7293
7217
|
* @internal
|
|
7294
7218
|
*/
|
|
7295
7219
|
function getDocFileName(filePath) {
|
|
7296
|
-
const fileName = path
|
|
7220
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
|
7297
7221
|
if (fileName === "index") return "index";
|
|
7298
7222
|
return fileName;
|
|
7299
7223
|
}
|
|
@@ -7368,7 +7292,6 @@ export interface NavItem {
|
|
|
7368
7292
|
export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as const;
|
|
7369
7293
|
`;
|
|
7370
7294
|
}
|
|
7371
|
-
|
|
7372
7295
|
//#endregion
|
|
7373
7296
|
//#region src/docs.ts
|
|
7374
7297
|
/**
|
|
@@ -7422,6 +7345,46 @@ export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as
|
|
|
7422
7345
|
* ```
|
|
7423
7346
|
*/
|
|
7424
7347
|
const DOCS_MANIFEST_FILE = ".ox-content-docs-manifest.json";
|
|
7348
|
+
const DOCS_DATA_FILE = "docs.json";
|
|
7349
|
+
function escapeHtml$3(str) {
|
|
7350
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7351
|
+
}
|
|
7352
|
+
function entryAnchor(name) {
|
|
7353
|
+
return name.toLowerCase();
|
|
7354
|
+
}
|
|
7355
|
+
function cleanSummaryText(text, maxLength = 120) {
|
|
7356
|
+
if (!text) return "";
|
|
7357
|
+
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
7358
|
+
if (collapsed.length <= maxLength) return collapsed;
|
|
7359
|
+
return `${collapsed.slice(0, maxLength - 1).trimEnd()}…`;
|
|
7360
|
+
}
|
|
7361
|
+
function renderInlineHtml(text) {
|
|
7362
|
+
let html = "";
|
|
7363
|
+
let lastIndex = 0;
|
|
7364
|
+
const tokenPattern = /`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)/g;
|
|
7365
|
+
let match;
|
|
7366
|
+
while ((match = tokenPattern.exec(text)) !== null) {
|
|
7367
|
+
html += escapeHtml$3(text.slice(lastIndex, match.index));
|
|
7368
|
+
if (match[1]) html += `<code>${escapeHtml$3(match[1])}</code>`;
|
|
7369
|
+
else if (match[2] && match[3]) html += `<a href="${escapeHtml$3(match[3])}">${escapeHtml$3(match[2])}</a>`;
|
|
7370
|
+
lastIndex = match.index + match[0].length;
|
|
7371
|
+
}
|
|
7372
|
+
html += escapeHtml$3(text.slice(lastIndex));
|
|
7373
|
+
return html.replace(/\n/g, "<br>");
|
|
7374
|
+
}
|
|
7375
|
+
function renderParagraphsHtml(text) {
|
|
7376
|
+
return text.split(/\n\s*\n/).map((paragraph) => paragraph.trim()).filter(Boolean).map((paragraph) => `<p>${renderInlineHtml(paragraph)}</p>`).join("\n");
|
|
7377
|
+
}
|
|
7378
|
+
function renderCodeBlockHtml(code, language = "typescript") {
|
|
7379
|
+
return `<pre><code class="language-${language}">${escapeHtml$3(code)}</code></pre>`;
|
|
7380
|
+
}
|
|
7381
|
+
function buildDocsData(docs) {
|
|
7382
|
+
return {
|
|
7383
|
+
version: 1,
|
|
7384
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7385
|
+
modules: docs
|
|
7386
|
+
};
|
|
7387
|
+
}
|
|
7425
7388
|
/**
|
|
7426
7389
|
* Regex pattern for matching JSDoc comment blocks.
|
|
7427
7390
|
*
|
|
@@ -7526,7 +7489,7 @@ async function findFiles(dir, options) {
|
|
|
7526
7489
|
return;
|
|
7527
7490
|
}
|
|
7528
7491
|
for (const entry of entries) {
|
|
7529
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
7492
|
+
const fullPath = path$1.join(currentDir, entry.name);
|
|
7530
7493
|
if (entry.isDirectory()) {
|
|
7531
7494
|
if (!isExcluded(fullPath, options.exclude)) await walk(fullPath);
|
|
7532
7495
|
} else if (entry.isFile()) {
|
|
@@ -7782,7 +7745,7 @@ function generateMarkdown(docs, options) {
|
|
|
7782
7745
|
if (options.groupBy === "file") {
|
|
7783
7746
|
const docToFile = /* @__PURE__ */ new Map();
|
|
7784
7747
|
for (const doc of docs) {
|
|
7785
|
-
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7748
|
+
let fileName = path$1.basename(doc.file, path$1.extname(doc.file));
|
|
7786
7749
|
if (fileName === "index") fileName = "index-module";
|
|
7787
7750
|
docToFile.set(doc, fileName);
|
|
7788
7751
|
const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);
|
|
@@ -7802,74 +7765,132 @@ function generateMarkdown(docs, options) {
|
|
|
7802
7765
|
return result;
|
|
7803
7766
|
}
|
|
7804
7767
|
function generateFileMarkdown(doc, options, currentFileName, symbolMap) {
|
|
7805
|
-
let md = `# ${path.basename(doc.file)}\n\n`;
|
|
7768
|
+
let md = `# ${path$1.basename(doc.file)}\n\n`;
|
|
7806
7769
|
if (options.githubUrl) {
|
|
7807
7770
|
const sourceLink = generateSourceLink(doc.file, options.githubUrl);
|
|
7808
7771
|
if (sourceLink) md += sourceLink + "\n\n";
|
|
7809
7772
|
}
|
|
7773
|
+
md += `> ${doc.entries.length} documented symbol${doc.entries.length === 1 ? "" : "s"}. `;
|
|
7774
|
+
md += "Skim the one-line surface first, then expand the accordions for details.\n\n";
|
|
7775
|
+
md += "## Overview\n\n";
|
|
7776
|
+
for (const entry of doc.entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
|
|
7777
|
+
md += "\n## Reference\n\n";
|
|
7810
7778
|
for (const entry of doc.entries) md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);
|
|
7811
7779
|
return md;
|
|
7812
7780
|
}
|
|
7781
|
+
function normalizeSignature(signature) {
|
|
7782
|
+
if (!signature) return;
|
|
7783
|
+
return signature.replace(/\s+/g, " ").replace(/^export\s+/, "").replace(/^async\s+function\s+/, "").replace(/^function\s+/, "").replace(/^class\s+/, "").trim();
|
|
7784
|
+
}
|
|
7785
|
+
function renderOverviewLine(entry, href) {
|
|
7786
|
+
const signature = normalizeSignature(entry.signature);
|
|
7787
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7788
|
+
const parts = [`- [\`${entry.name}\`](${href})`, `\`${entry.kind}\``];
|
|
7789
|
+
if (signature) parts.push(`\`${signature}\``);
|
|
7790
|
+
if (summary) parts.push(`- ${summary}`);
|
|
7791
|
+
return `${parts.join(" ")}\n`;
|
|
7792
|
+
}
|
|
7793
|
+
function renderOverviewHtmlItem(entry, href) {
|
|
7794
|
+
const signature = normalizeSignature(entry.signature);
|
|
7795
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7796
|
+
const fragments = [`<a href="${escapeHtml$3(href)}"><code>${escapeHtml$3(entry.name)}</code></a>`, `<span class="ox-api-module__kind">${escapeHtml$3(entry.kind)}</span>`];
|
|
7797
|
+
if (signature) fragments.push(`<code>${escapeHtml$3(signature)}</code>`);
|
|
7798
|
+
if (summary) fragments.push(`<span>${renderInlineHtml(summary)}</span>`);
|
|
7799
|
+
return `<li>${fragments.join("")}</li>`;
|
|
7800
|
+
}
|
|
7801
|
+
function renderParamsTableHtml(params) {
|
|
7802
|
+
return `<div class="ox-api-entry__section">
|
|
7803
|
+
<h4>Parameters</h4>
|
|
7804
|
+
<table>
|
|
7805
|
+
<thead>
|
|
7806
|
+
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
|
|
7807
|
+
</thead>
|
|
7808
|
+
<tbody>
|
|
7809
|
+
${params.map((param) => {
|
|
7810
|
+
const flags = [param.optional ? "optional" : "", param.default ? `default: ${param.default}` : ""].filter(Boolean);
|
|
7811
|
+
const description = [param.description, flags.join(" · ")].filter(Boolean).join(" — ");
|
|
7812
|
+
return `<tr>
|
|
7813
|
+
<td><code>${escapeHtml$3(param.name)}</code></td>
|
|
7814
|
+
<td><code>${escapeHtml$3(param.type)}</code></td>
|
|
7815
|
+
<td>${renderInlineHtml(description)}</td>
|
|
7816
|
+
</tr>`;
|
|
7817
|
+
}).join("\n")}
|
|
7818
|
+
</tbody>
|
|
7819
|
+
</table>
|
|
7820
|
+
</div>`;
|
|
7821
|
+
}
|
|
7822
|
+
function renderTagListHtml(tags) {
|
|
7823
|
+
return `<div class="ox-api-entry__section">
|
|
7824
|
+
<h4>Tags</h4>
|
|
7825
|
+
<ul class="ox-api-entry__tags">${Object.entries(tags).map(([tag, value]) => `<li><span class="ox-api-entry__tag-name">@${escapeHtml$3(tag)}</span><span>${renderInlineHtml(value)}</span></li>`).join("")}</ul>
|
|
7826
|
+
</div>`;
|
|
7827
|
+
}
|
|
7813
7828
|
function generateEntryMarkdown(entry, options, currentFileName, symbolMap) {
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
}
|
|
7820
|
-
if (
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
md += entry.signature + "\n";
|
|
7827
|
-
md += "```\n\n";
|
|
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
|
-
}
|
|
7829
|
+
const processedDescription = entry.description && currentFileName && symbolMap ? convertSymbolLinks(entry.description, currentFileName, symbolMap) : entry.description;
|
|
7830
|
+
const summarySignature = normalizeSignature(entry.signature);
|
|
7831
|
+
const sourceHref = options?.githubUrl ? generateSourceHref(entry.file, options.githubUrl, entry.line) : void 0;
|
|
7832
|
+
let body = "";
|
|
7833
|
+
if (processedDescription) body += renderParagraphsHtml(processedDescription) + "\n";
|
|
7834
|
+
if (sourceHref) body += `<p class="ox-api-entry__source"><a href="${escapeHtml$3(sourceHref)}">View source</a></p>\n`;
|
|
7835
|
+
if (entry.signature) body += `<div class="ox-api-entry__section">\n<h4>Signature</h4>\n${renderCodeBlockHtml(entry.signature)}\n</div>\n`;
|
|
7836
|
+
if (entry.params && entry.params.length > 0) body += renderParamsTableHtml(entry.params) + "\n";
|
|
7837
|
+
if (entry.returns) body += `<div class="ox-api-entry__section">
|
|
7838
|
+
<h4>Returns</h4>
|
|
7839
|
+
<p><code>${escapeHtml$3(entry.returns.type)}</code>${entry.returns.description ? ` — ${renderInlineHtml(entry.returns.description)}` : ""}</p>
|
|
7840
|
+
</div>\n`;
|
|
7840
7841
|
if (entry.examples && entry.examples.length > 0) {
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
}
|
|
7848
|
-
|
|
7849
|
-
return
|
|
7842
|
+
const examplesHtml = entry.examples.map((example) => example.replace(/^```\w*\n?/, "").replace(/\n?```$/, "")).map((example) => renderCodeBlockHtml(example, "ts")).join("\n");
|
|
7843
|
+
body += `<div class="ox-api-entry__section">\n<h4>Examples</h4>\n${examplesHtml}\n</div>\n`;
|
|
7844
|
+
}
|
|
7845
|
+
if (entry.tags && Object.keys(entry.tags).length > 0) body += renderTagListHtml(entry.tags) + "\n";
|
|
7846
|
+
const summaryDescription = cleanSummaryText(processedDescription, summarySignature ? 80 : 120);
|
|
7847
|
+
const summaryParts = [`<span class="ox-api-entry__kind">${escapeHtml$3(entry.kind)}</span>`, `<code class="ox-api-entry__name">${escapeHtml$3(entry.name)}</code>`];
|
|
7848
|
+
if (summarySignature) summaryParts.push(`<code class="ox-api-entry__signature">${escapeHtml$3(summarySignature)}</code>`);
|
|
7849
|
+
if (summaryDescription) summaryParts.push(`<span class="ox-api-entry__description">${renderInlineHtml(summaryDescription)}</span>`);
|
|
7850
|
+
return `<details id="${entryAnchor(entry.name)}" class="ox-api-entry">
|
|
7851
|
+
<summary>${summaryParts.join("")}</summary>
|
|
7852
|
+
<div class="ox-api-entry__body">
|
|
7853
|
+
${body.trim()}
|
|
7854
|
+
</div>
|
|
7855
|
+
</details>
|
|
7856
|
+
|
|
7857
|
+
`;
|
|
7850
7858
|
}
|
|
7851
7859
|
function generateIndex(docs, docToFile) {
|
|
7852
7860
|
let md = "# API Documentation\n\n";
|
|
7853
7861
|
md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
|
|
7862
|
+
md += "> Use search scopes like `@api transform` to limit results to the generated API reference.\n\n";
|
|
7854
7863
|
md += "## Modules\n\n";
|
|
7855
7864
|
for (const doc of docs) {
|
|
7856
|
-
const displayName = path.basename(doc.file, path.extname(doc.file));
|
|
7865
|
+
const displayName = path$1.basename(doc.file, path$1.extname(doc.file));
|
|
7857
7866
|
let fileName = displayName;
|
|
7858
7867
|
if (docToFile && docToFile.has(doc)) fileName = docToFile.get(doc);
|
|
7859
7868
|
else if (fileName === "index") fileName = "index-module";
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
|
|
7863
|
-
|
|
7864
|
-
|
|
7865
|
-
|
|
7866
|
-
|
|
7869
|
+
const countLabel = `${doc.entries.length} symbol${doc.entries.length === 1 ? "" : "s"}`;
|
|
7870
|
+
md += `<details class="ox-api-module">
|
|
7871
|
+
<summary>
|
|
7872
|
+
<span class="ox-api-module__title"><a href="./${fileName}.md">${escapeHtml$3(displayName)}</a></span>
|
|
7873
|
+
<span class="ox-api-module__count">${countLabel}</span>
|
|
7874
|
+
</summary>
|
|
7875
|
+
<div class="ox-api-module__body">
|
|
7876
|
+
<ul class="ox-api-module__list">
|
|
7877
|
+
`;
|
|
7878
|
+
for (const entry of doc.entries) md += ` ${renderOverviewHtmlItem(entry, `./${fileName}.md#${entryAnchor(entry.name)}`)}\n`;
|
|
7879
|
+
md += ` </ul>
|
|
7880
|
+
</div>
|
|
7881
|
+
</details>
|
|
7882
|
+
|
|
7883
|
+
`;
|
|
7867
7884
|
}
|
|
7868
7885
|
return md;
|
|
7869
7886
|
}
|
|
7870
7887
|
function generateCategoryMarkdown(kind, entries, options, symbolMap) {
|
|
7871
7888
|
const categoryFileName = `${kind}s`;
|
|
7872
7889
|
let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\n\n`;
|
|
7890
|
+
md += `> ${entries.length} documented ${kind}${entries.length === 1 ? "" : "s"} collected across modules.\n\n`;
|
|
7891
|
+
md += "## Overview\n\n";
|
|
7892
|
+
for (const entry of entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
|
|
7893
|
+
md += "\n## Reference\n\n";
|
|
7873
7894
|
for (const entry of entries) md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);
|
|
7874
7895
|
return md;
|
|
7875
7896
|
}
|
|
@@ -7879,10 +7900,8 @@ function generateCategoryIndex(byKind) {
|
|
|
7879
7900
|
for (const [kind, entries] of byKind) {
|
|
7880
7901
|
const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + "s";
|
|
7881
7902
|
md += `## [${kindTitle}](./${kind}s.md)\n\n`;
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
md += `- **${entry.name}** - ${desc}...\n`;
|
|
7885
|
-
}
|
|
7903
|
+
md += `> ${entries.length} item${entries.length === 1 ? "" : "s"}.\n\n`;
|
|
7904
|
+
for (const entry of entries) md += renderOverviewLine(entry, `./${kind}s.md#${entryAnchor(entry.name)}`);
|
|
7886
7905
|
md += "\n";
|
|
7887
7906
|
}
|
|
7888
7907
|
return md;
|
|
@@ -7923,7 +7942,7 @@ function convertSymbolLinks(text, currentFileName, symbolMap) {
|
|
|
7923
7942
|
function buildSymbolMap(docs) {
|
|
7924
7943
|
const map = /* @__PURE__ */ new Map();
|
|
7925
7944
|
for (const doc of docs) {
|
|
7926
|
-
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7945
|
+
let fileName = path$1.basename(doc.file, path$1.extname(doc.file));
|
|
7927
7946
|
if (fileName === "index") fileName = "index-module";
|
|
7928
7947
|
for (const entry of doc.entries) map.set(entry.name, {
|
|
7929
7948
|
name: entry.name,
|
|
@@ -7940,7 +7959,8 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7940
7959
|
await fs$1.promises.mkdir(outDir, { recursive: true });
|
|
7941
7960
|
const generatedFiles = new Set(Object.keys(docs));
|
|
7942
7961
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") generatedFiles.add("nav.ts");
|
|
7943
|
-
|
|
7962
|
+
if (extractedDocs) generatedFiles.add(DOCS_DATA_FILE);
|
|
7963
|
+
const manifestPath = path$1.join(outDir, DOCS_MANIFEST_FILE);
|
|
7944
7964
|
let previousFiles = [];
|
|
7945
7965
|
try {
|
|
7946
7966
|
previousFiles = JSON.parse(await fs$1.promises.readFile(manifestPath, "utf-8"));
|
|
@@ -7949,17 +7969,18 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7949
7969
|
}
|
|
7950
7970
|
for (const staleFile of previousFiles) {
|
|
7951
7971
|
if (generatedFiles.has(staleFile)) continue;
|
|
7952
|
-
await fs$1.promises.rm(path.join(outDir, staleFile), { force: true });
|
|
7972
|
+
await fs$1.promises.rm(path$1.join(outDir, staleFile), { force: true });
|
|
7953
7973
|
}
|
|
7954
7974
|
for (const [fileName, content] of Object.entries(docs)) {
|
|
7955
|
-
const filePath = path.join(outDir, fileName);
|
|
7975
|
+
const filePath = path$1.join(outDir, fileName);
|
|
7956
7976
|
await fs$1.promises.writeFile(filePath, content, "utf-8");
|
|
7957
7977
|
}
|
|
7958
7978
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") {
|
|
7959
7979
|
const navCode = generateNavCode(generateNavMetadata(extractedDocs, "/api"), "apiNav");
|
|
7960
|
-
const navFilePath = path.join(outDir, "nav.ts");
|
|
7980
|
+
const navFilePath = path$1.join(outDir, "nav.ts");
|
|
7961
7981
|
await fs$1.promises.writeFile(navFilePath, navCode, "utf-8");
|
|
7962
7982
|
}
|
|
7983
|
+
if (extractedDocs) await fs$1.promises.writeFile(path$1.join(outDir, DOCS_DATA_FILE), JSON.stringify(buildDocsData(extractedDocs), null, 2), "utf-8");
|
|
7963
7984
|
await fs$1.promises.writeFile(manifestPath, JSON.stringify([...generatedFiles].sort(), null, 2), "utf-8");
|
|
7964
7985
|
}
|
|
7965
7986
|
/**
|
|
@@ -7971,10 +7992,13 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7971
7992
|
* @param filePath - Full path to the source file
|
|
7972
7993
|
* @param githubUrl - Base GitHub repository URL
|
|
7973
7994
|
* @param lineNumber - Optional line number to link to
|
|
7974
|
-
* @returns
|
|
7995
|
+
* @returns Absolute GitHub URL to source code
|
|
7975
7996
|
*/
|
|
7997
|
+
function generateSourceHref(filePath, githubUrl, lineNumber) {
|
|
7998
|
+
return `${githubUrl}/blob/main/${filePath.replace(/^.*?\/(npm|packages|crates|src)\//, "$1/")}${lineNumber ? `#L${lineNumber}` : ""}`;
|
|
7999
|
+
}
|
|
7976
8000
|
function generateSourceLink(filePath, githubUrl, lineNumber) {
|
|
7977
|
-
return `**[Source](${
|
|
8001
|
+
return `**[Source](${generateSourceHref(filePath, githubUrl, lineNumber)})**`;
|
|
7978
8002
|
}
|
|
7979
8003
|
function resolveDocsOptions(options) {
|
|
7980
8004
|
if (options === false) return false;
|
|
@@ -7997,7 +8021,6 @@ function resolveDocsOptions(options) {
|
|
|
7997
8021
|
generateNav: opts.generateNav ?? true
|
|
7998
8022
|
};
|
|
7999
8023
|
}
|
|
8000
|
-
|
|
8001
8024
|
//#endregion
|
|
8002
8025
|
//#region src/og-image/renderer.ts
|
|
8003
8026
|
/**
|
|
@@ -8042,10 +8065,10 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8042
8065
|
await route.continue();
|
|
8043
8066
|
return;
|
|
8044
8067
|
}
|
|
8045
|
-
const filePath = path.join(publicDir, url.pathname);
|
|
8068
|
+
const filePath = path$1.join(publicDir, url.pathname);
|
|
8046
8069
|
try {
|
|
8047
8070
|
const body = await fs.readFile(filePath);
|
|
8048
|
-
const ext = path.extname(filePath).toLowerCase();
|
|
8071
|
+
const ext = path$1.extname(filePath).toLowerCase();
|
|
8049
8072
|
await route.fulfill({
|
|
8050
8073
|
body,
|
|
8051
8074
|
contentType: {
|
|
@@ -8080,7 +8103,6 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8080
8103
|
});
|
|
8081
8104
|
return Buffer.from(screenshot);
|
|
8082
8105
|
}
|
|
8083
|
-
|
|
8084
8106
|
//#endregion
|
|
8085
8107
|
//#region src/og-image/browser.ts
|
|
8086
8108
|
/**
|
|
@@ -8126,7 +8148,6 @@ async function openBrowser() {
|
|
|
8126
8148
|
return null;
|
|
8127
8149
|
}
|
|
8128
8150
|
}
|
|
8129
|
-
|
|
8130
8151
|
//#endregion
|
|
8131
8152
|
//#region src/og-image/template.ts
|
|
8132
8153
|
/**
|
|
@@ -8156,7 +8177,6 @@ function getDefaultTemplate() {
|
|
|
8156
8177
|
</div>`;
|
|
8157
8178
|
};
|
|
8158
8179
|
}
|
|
8159
|
-
|
|
8160
8180
|
//#endregion
|
|
8161
8181
|
//#region src/og-image/cache.ts
|
|
8162
8182
|
/**
|
|
@@ -8182,7 +8202,7 @@ function computeCacheKey(templateSource, props, width, height) {
|
|
|
8182
8202
|
* Returns the cached file path if found, null otherwise.
|
|
8183
8203
|
*/
|
|
8184
8204
|
async function getCached(cacheDir, key) {
|
|
8185
|
-
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8205
|
+
const filePath = path$1.join(cacheDir, `${key}.png`);
|
|
8186
8206
|
try {
|
|
8187
8207
|
return await fs.readFile(filePath);
|
|
8188
8208
|
} catch {
|
|
@@ -8194,12 +8214,11 @@ async function getCached(cacheDir, key) {
|
|
|
8194
8214
|
*/
|
|
8195
8215
|
async function writeCache(cacheDir, key, png) {
|
|
8196
8216
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8197
|
-
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8217
|
+
const filePath = path$1.join(cacheDir, `${key}.png`);
|
|
8198
8218
|
await fs.writeFile(filePath, png);
|
|
8199
8219
|
}
|
|
8200
|
-
|
|
8201
8220
|
//#endregion
|
|
8202
|
-
//#region \0@oxc-project+runtime@0.
|
|
8221
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/usingCtx.js
|
|
8203
8222
|
function _usingCtx() {
|
|
8204
8223
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
8205
8224
|
var n = Error();
|
|
@@ -8254,7 +8273,6 @@ function _usingCtx() {
|
|
|
8254
8273
|
}
|
|
8255
8274
|
};
|
|
8256
8275
|
}
|
|
8257
|
-
|
|
8258
8276
|
//#endregion
|
|
8259
8277
|
//#region src/og-image/index.ts
|
|
8260
8278
|
/**
|
|
@@ -8287,14 +8305,14 @@ function resolveOgImageOptions(options) {
|
|
|
8287
8305
|
*/
|
|
8288
8306
|
async function resolveTemplate(options, root) {
|
|
8289
8307
|
if (!options.template) return getDefaultTemplate();
|
|
8290
|
-
const templatePath = path.resolve(root, options.template);
|
|
8308
|
+
const templatePath = path$1.resolve(root, options.template);
|
|
8291
8309
|
const fs = await import("fs/promises");
|
|
8292
8310
|
try {
|
|
8293
8311
|
await fs.access(templatePath);
|
|
8294
8312
|
} catch {
|
|
8295
8313
|
throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);
|
|
8296
8314
|
}
|
|
8297
|
-
switch (path.extname(templatePath).toLowerCase()) {
|
|
8315
|
+
switch (path$1.extname(templatePath).toLowerCase()) {
|
|
8298
8316
|
case ".vue": return resolveVueTemplate(templatePath, options, root);
|
|
8299
8317
|
case ".svelte": return resolveSvelteTemplate(templatePath, root);
|
|
8300
8318
|
case ".tsx":
|
|
@@ -8308,9 +8326,9 @@ async function resolveTemplate(options, root) {
|
|
|
8308
8326
|
async function resolveTsTemplate(templatePath, options, root) {
|
|
8309
8327
|
const fs = await import("fs/promises");
|
|
8310
8328
|
const { rolldown } = await import("rolldown");
|
|
8311
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8329
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8312
8330
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8313
|
-
const outfile = path.join(cacheDir, "_template.mjs");
|
|
8331
|
+
const outfile = path$1.join(cacheDir, "_template.mjs");
|
|
8314
8332
|
const bundle = await rolldown({
|
|
8315
8333
|
input: templatePath,
|
|
8316
8334
|
platform: "node"
|
|
@@ -8333,9 +8351,9 @@ async function resolveTsTemplate(templatePath, options, root) {
|
|
|
8333
8351
|
async function resolveVueTemplate(templatePath, options, root) {
|
|
8334
8352
|
const fs = await import("fs/promises");
|
|
8335
8353
|
const { rolldown } = await import("rolldown");
|
|
8336
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8354
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8337
8355
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8338
|
-
const outfile = path.join(cacheDir, "_template_vue.mjs");
|
|
8356
|
+
const outfile = path$1.join(cacheDir, "_template_vue.mjs");
|
|
8339
8357
|
const bundle = await rolldown({
|
|
8340
8358
|
input: templatePath,
|
|
8341
8359
|
platform: "node",
|
|
@@ -8431,9 +8449,9 @@ async function getVizejsPlugin() {
|
|
|
8431
8449
|
async function resolveSvelteTemplate(templatePath, root) {
|
|
8432
8450
|
const fs = await import("fs/promises");
|
|
8433
8451
|
const { rolldown } = await import("rolldown");
|
|
8434
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8452
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8435
8453
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8436
|
-
const outfile = path.join(cacheDir, "_template_svelte.mjs");
|
|
8454
|
+
const outfile = path$1.join(cacheDir, "_template_svelte.mjs");
|
|
8437
8455
|
const bundle = await rolldown({
|
|
8438
8456
|
input: templatePath,
|
|
8439
8457
|
platform: "node",
|
|
@@ -8489,9 +8507,9 @@ function createSvelteCompilerPlugin() {
|
|
|
8489
8507
|
async function resolveReactTemplate(templatePath, root) {
|
|
8490
8508
|
const fs = await import("fs/promises");
|
|
8491
8509
|
const { rolldown } = await import("rolldown");
|
|
8492
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8510
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8493
8511
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8494
|
-
const outfile = path.join(cacheDir, "_template_react.mjs");
|
|
8512
|
+
const outfile = path$1.join(cacheDir, "_template_react.mjs");
|
|
8495
8513
|
const bundle = await rolldown({
|
|
8496
8514
|
input: templatePath,
|
|
8497
8515
|
platform: "node",
|
|
@@ -8541,7 +8559,7 @@ async function resolveReactTemplate(templatePath, root) {
|
|
|
8541
8559
|
async function computeTemplateSource(options, root) {
|
|
8542
8560
|
if (!options.template) return "__default__";
|
|
8543
8561
|
const fs = await import("fs/promises");
|
|
8544
|
-
const templatePath = path.resolve(root, options.template);
|
|
8562
|
+
const templatePath = path$1.resolve(root, options.template);
|
|
8545
8563
|
const content = await fs.readFile(templatePath, "utf-8");
|
|
8546
8564
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
8547
8565
|
}
|
|
@@ -8559,7 +8577,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8559
8577
|
if (pages.length === 0) return [];
|
|
8560
8578
|
const templateFn = await resolveTemplate(options, root);
|
|
8561
8579
|
const templateSource = await computeTemplateSource(options, root);
|
|
8562
|
-
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8580
|
+
const cacheDir = path$1.join(root, ".cache", "og-images");
|
|
8563
8581
|
if (options.cache) {
|
|
8564
8582
|
const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);
|
|
8565
8583
|
if (allCached) return allCached;
|
|
@@ -8571,7 +8589,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8571
8589
|
error: "Chromium not available"
|
|
8572
8590
|
}));
|
|
8573
8591
|
const results = [];
|
|
8574
|
-
const publicDir = path.join(root, "public");
|
|
8592
|
+
const publicDir = path$1.join(root, "public");
|
|
8575
8593
|
const concurrency = Math.max(1, options.concurrency);
|
|
8576
8594
|
for (let i = 0; i < pages.length; i += concurrency) {
|
|
8577
8595
|
const batch = pages.slice(i, i + concurrency);
|
|
@@ -8595,7 +8613,7 @@ async function tryServeAllFromCache(pages, templateSource, options, cacheDir) {
|
|
|
8595
8613
|
for (const entry of pages) {
|
|
8596
8614
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8597
8615
|
if (!cached) return null;
|
|
8598
|
-
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8616
|
+
await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
|
|
8599
8617
|
await fs.writeFile(entry.outputPath, cached);
|
|
8600
8618
|
results.push({
|
|
8601
8619
|
outputPath: entry.outputPath,
|
|
@@ -8613,7 +8631,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8613
8631
|
if (options.cache) {
|
|
8614
8632
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8615
8633
|
if (cached) {
|
|
8616
|
-
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8634
|
+
await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
|
|
8617
8635
|
await fs.writeFile(entry.outputPath, cached);
|
|
8618
8636
|
return {
|
|
8619
8637
|
outputPath: entry.outputPath,
|
|
@@ -8623,7 +8641,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8623
8641
|
}
|
|
8624
8642
|
const html = await templateFn(entry.props);
|
|
8625
8643
|
const png = await session.renderPage(html, options.width, options.height, publicDir);
|
|
8626
|
-
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8644
|
+
await fs.mkdir(path$1.dirname(entry.outputPath), { recursive: true });
|
|
8627
8645
|
await fs.writeFile(entry.outputPath, png);
|
|
8628
8646
|
if (options.cache) await writeCache(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height), png);
|
|
8629
8647
|
return {
|
|
@@ -8638,7 +8656,6 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8638
8656
|
};
|
|
8639
8657
|
}
|
|
8640
8658
|
}
|
|
8641
|
-
|
|
8642
8659
|
//#endregion
|
|
8643
8660
|
//#region src/plugins/index.ts
|
|
8644
8661
|
/**
|
|
@@ -8648,28 +8665,27 @@ async function transformAllPlugins(html, options = {}) {
|
|
|
8648
8665
|
const { tabs = true, youtube = true, github = true, ogp = true, mermaid = true, githubToken } = options;
|
|
8649
8666
|
let result = html;
|
|
8650
8667
|
if (tabs) {
|
|
8651
|
-
const { transformTabs } = await import("./tabs.
|
|
8668
|
+
const { transformTabs } = await import("./tabs.mjs");
|
|
8652
8669
|
result = await transformTabs(result);
|
|
8653
8670
|
}
|
|
8654
8671
|
if (youtube) {
|
|
8655
|
-
const { transformYouTube } = await import("./youtube.
|
|
8672
|
+
const { transformYouTube } = await import("./youtube.mjs");
|
|
8656
8673
|
result = await transformYouTube(result);
|
|
8657
8674
|
}
|
|
8658
8675
|
if (github) {
|
|
8659
|
-
const { transformGitHub } = await import("./github.
|
|
8676
|
+
const { transformGitHub } = await import("./github.mjs");
|
|
8660
8677
|
result = await transformGitHub(result, void 0, { token: githubToken });
|
|
8661
8678
|
}
|
|
8662
8679
|
if (ogp) {
|
|
8663
|
-
const { transformOgp } = await import("./ogp.
|
|
8680
|
+
const { transformOgp } = await import("./ogp.mjs");
|
|
8664
8681
|
result = await transformOgp(result);
|
|
8665
8682
|
}
|
|
8666
8683
|
if (mermaid) {
|
|
8667
|
-
const { transformMermaidStatic } = await import("./
|
|
8684
|
+
const { transformMermaidStatic } = await import("./mermaid2.mjs");
|
|
8668
8685
|
result = await transformMermaidStatic(result);
|
|
8669
8686
|
}
|
|
8670
8687
|
return result;
|
|
8671
8688
|
}
|
|
8672
|
-
|
|
8673
8689
|
//#endregion
|
|
8674
8690
|
//#region src/island/parse.ts
|
|
8675
8691
|
/**
|
|
@@ -8861,7 +8877,6 @@ initIslands((el, props) => {
|
|
|
8861
8877
|
});
|
|
8862
8878
|
`;
|
|
8863
8879
|
}
|
|
8864
|
-
|
|
8865
8880
|
//#endregion
|
|
8866
8881
|
//#region src/theme.ts
|
|
8867
8882
|
/**
|
|
@@ -9044,7 +9059,6 @@ function themeToNapi(theme) {
|
|
|
9044
9059
|
js: theme.js || void 0
|
|
9045
9060
|
};
|
|
9046
9061
|
}
|
|
9047
|
-
|
|
9048
9062
|
//#endregion
|
|
9049
9063
|
//#region src/ssg.ts
|
|
9050
9064
|
/**
|
|
@@ -9087,6 +9101,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9087
9101
|
--color-primary-hover: #ce5937;
|
|
9088
9102
|
--color-code-bg: #1e293b;
|
|
9089
9103
|
--color-code-text: #e2e8f0;
|
|
9104
|
+
--color-code-line-highlight: rgba(56, 189, 248, 0.16);
|
|
9105
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.18);
|
|
9106
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9107
|
+
--color-code-line-error: rgba(239, 68, 68, 0.18);
|
|
9108
|
+
--color-code-line-error-border: #ef4444;
|
|
9090
9109
|
}
|
|
9091
9110
|
[data-theme="dark"] {
|
|
9092
9111
|
--color-bg: #141414;
|
|
@@ -9098,6 +9117,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9098
9117
|
--color-primary-hover: #d4845f;
|
|
9099
9118
|
--color-code-bg: #1a1a1a;
|
|
9100
9119
|
--color-code-text: #e5e5e5;
|
|
9120
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9121
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9122
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9123
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9124
|
+
--color-code-line-error-border: #f87171;
|
|
9101
9125
|
}
|
|
9102
9126
|
@media (prefers-color-scheme: dark) {
|
|
9103
9127
|
:root:not([data-theme="light"]) {
|
|
@@ -9110,6 +9134,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9110
9134
|
--color-primary-hover: #d4845f;
|
|
9111
9135
|
--color-code-bg: #1a1a1a;
|
|
9112
9136
|
--color-code-text: #e5e5e5;
|
|
9137
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9138
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9139
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9140
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9141
|
+
--color-code-line-error-border: #f87171;
|
|
9113
9142
|
}
|
|
9114
9143
|
}
|
|
9115
9144
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
@@ -9410,6 +9439,25 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9410
9439
|
padding: 0;
|
|
9411
9440
|
font-size: 0.8125rem;
|
|
9412
9441
|
}
|
|
9442
|
+
.content pre.ox-code-block code {
|
|
9443
|
+
display: block;
|
|
9444
|
+
}
|
|
9445
|
+
.content pre.ox-code-block .line {
|
|
9446
|
+
display: block;
|
|
9447
|
+
margin: 0 -1.25rem;
|
|
9448
|
+
padding: 0 1.25rem;
|
|
9449
|
+
}
|
|
9450
|
+
.content pre.ox-code-block .ox-code-line--highlight {
|
|
9451
|
+
background: var(--color-code-line-highlight);
|
|
9452
|
+
}
|
|
9453
|
+
.content pre.ox-code-block .ox-code-line--warning {
|
|
9454
|
+
background: var(--color-code-line-warning);
|
|
9455
|
+
box-shadow: inset 3px 0 0 var(--color-code-line-warning-border);
|
|
9456
|
+
}
|
|
9457
|
+
.content pre.ox-code-block .ox-code-line--error {
|
|
9458
|
+
background: var(--color-code-line-error);
|
|
9459
|
+
box-shadow: inset 3px 0 0 var(--color-code-line-error-border);
|
|
9460
|
+
}
|
|
9413
9461
|
.content table {
|
|
9414
9462
|
width: 100%;
|
|
9415
9463
|
border-collapse: collapse;
|
|
@@ -9453,6 +9501,10 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9453
9501
|
overflow-x: auto;
|
|
9454
9502
|
-webkit-overflow-scrolling: touch;
|
|
9455
9503
|
}
|
|
9504
|
+
.content pre.ox-code-block .line {
|
|
9505
|
+
margin: 0 -0.75rem;
|
|
9506
|
+
padding: 0 0.75rem;
|
|
9507
|
+
}
|
|
9456
9508
|
.content code { font-size: 0.8125em; }
|
|
9457
9509
|
.content table {
|
|
9458
9510
|
display: block;
|
|
@@ -9626,6 +9678,39 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9626
9678
|
}
|
|
9627
9679
|
};
|
|
9628
9680
|
|
|
9681
|
+
const parseScopedQuery = (query) => {
|
|
9682
|
+
const scopes = [];
|
|
9683
|
+
const terms = [];
|
|
9684
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
9685
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
9686
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
9687
|
+
} else {
|
|
9688
|
+
terms.push(part);
|
|
9689
|
+
}
|
|
9690
|
+
}
|
|
9691
|
+
return { text: terms.join(' ').trim(), scopes: [...new Set(scopes)] };
|
|
9692
|
+
};
|
|
9693
|
+
|
|
9694
|
+
const getScopesForDoc = (doc) => {
|
|
9695
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
9696
|
+
const segments = source.split('/').filter(Boolean);
|
|
9697
|
+
if (segments.length <= 1) return [];
|
|
9698
|
+
|
|
9699
|
+
const scopes = [];
|
|
9700
|
+
let current = '';
|
|
9701
|
+
for (const segment of segments.slice(0, -1)) {
|
|
9702
|
+
current = current ? current + '/' + segment : segment;
|
|
9703
|
+
scopes.push(current);
|
|
9704
|
+
}
|
|
9705
|
+
return scopes;
|
|
9706
|
+
};
|
|
9707
|
+
|
|
9708
|
+
const matchesScopes = (doc, scopes) => {
|
|
9709
|
+
if (!scopes.length) return true;
|
|
9710
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
9711
|
+
return scopes.some((scope) => docScopes.has(scope));
|
|
9712
|
+
};
|
|
9713
|
+
|
|
9629
9714
|
// Tokenize query
|
|
9630
9715
|
const tokenize = (text) => {
|
|
9631
9716
|
const tokens = [];
|
|
@@ -9648,27 +9733,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9648
9733
|
|
|
9649
9734
|
// Perform search
|
|
9650
9735
|
const performSearch = async (query) => {
|
|
9651
|
-
if (!query.trim()) {
|
|
9652
|
-
searchResults.innerHTML = '';
|
|
9653
|
-
results = [];
|
|
9654
|
-
return;
|
|
9655
|
-
}
|
|
9656
9736
|
await loadSearchIndex();
|
|
9657
9737
|
if (!searchIndex) {
|
|
9658
9738
|
searchResults.innerHTML = '<div class="search-empty">Search index not available</div>';
|
|
9659
9739
|
return;
|
|
9660
9740
|
}
|
|
9661
9741
|
|
|
9662
|
-
const
|
|
9663
|
-
if (!
|
|
9742
|
+
const parsedQuery = parseScopedQuery(query);
|
|
9743
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
9664
9744
|
searchResults.innerHTML = '';
|
|
9665
9745
|
results = [];
|
|
9666
9746
|
return;
|
|
9667
9747
|
}
|
|
9668
9748
|
|
|
9749
|
+
const tokens = tokenize(parsedQuery.text);
|
|
9669
9750
|
const k1 = 1.2, b = 0.75;
|
|
9670
9751
|
const docScores = new Map();
|
|
9671
9752
|
|
|
9753
|
+
if (!tokens.length) {
|
|
9754
|
+
searchIndex.documents.forEach((doc, docIdx) => {
|
|
9755
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
9756
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
9757
|
+
}
|
|
9758
|
+
});
|
|
9759
|
+
}
|
|
9760
|
+
|
|
9672
9761
|
for (let i = 0; i < tokens.length; i++) {
|
|
9673
9762
|
const token = tokens[i];
|
|
9674
9763
|
const isLast = i === tokens.length - 1;
|
|
@@ -9687,6 +9776,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9687
9776
|
for (const posting of postings) {
|
|
9688
9777
|
const doc = searchIndex.documents[posting.doc_idx];
|
|
9689
9778
|
if (!doc) continue;
|
|
9779
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
9690
9780
|
const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;
|
|
9691
9781
|
const tf = posting.tf;
|
|
9692
9782
|
const docLen = doc.body.length;
|
|
@@ -9705,6 +9795,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9705
9795
|
results = Array.from(docScores.entries())
|
|
9706
9796
|
.map(([docIdx, data]) => {
|
|
9707
9797
|
const doc = searchIndex.documents[docIdx];
|
|
9798
|
+
const scopes = getScopesForDoc(doc);
|
|
9708
9799
|
let snippet = '';
|
|
9709
9800
|
if (doc.body) {
|
|
9710
9801
|
const bodyLower = doc.body.toLowerCase();
|
|
@@ -9713,15 +9804,15 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9713
9804
|
const pos = bodyLower.indexOf(match);
|
|
9714
9805
|
if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;
|
|
9715
9806
|
}
|
|
9716
|
-
const start = Math.max(0, firstPos - 50);
|
|
9807
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
9717
9808
|
const end = Math.min(doc.body.length, start + 150);
|
|
9718
9809
|
snippet = doc.body.slice(start, end);
|
|
9719
9810
|
if (start > 0) snippet = '...' + snippet;
|
|
9720
9811
|
if (end < doc.body.length) snippet += '...';
|
|
9721
9812
|
}
|
|
9722
|
-
return { ...doc, score: data.score, snippet };
|
|
9813
|
+
return { ...doc, score: data.score, scopes, snippet };
|
|
9723
9814
|
})
|
|
9724
|
-
.sort((a, b) => b.score - a.score)
|
|
9815
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
9725
9816
|
.slice(0, 10);
|
|
9726
9817
|
|
|
9727
9818
|
selectedIndex = 0;
|
|
@@ -9735,7 +9826,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9735
9826
|
}
|
|
9736
9827
|
searchResults.innerHTML = results.map((r, i) =>
|
|
9737
9828
|
'<a href="' + r.url + '" class="search-result' + (i === selectedIndex ? ' selected' : '') + '">' +
|
|
9738
|
-
'<div class="search-result-title">' + r.title + '</div>' +
|
|
9829
|
+
'<div class="search-result-title">' + r.title + (r.scopes?.length ? '<span class="search-result-scope">@' + r.scopes[0] + '</span>' : '') + '</div>' +
|
|
9739
9830
|
(r.snippet ? '<div class="search-result-snippet">' + r.snippet + '</div>' : '') +
|
|
9740
9831
|
'</a>'
|
|
9741
9832
|
).join('');
|
|
@@ -9866,7 +9957,7 @@ function generateBareHtmlPage(content, title) {
|
|
|
9866
9957
|
* Generates HTML page with navigation using Rust NAPI bindings.
|
|
9867
9958
|
*/
|
|
9868
9959
|
async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, theme) {
|
|
9869
|
-
const mod = await
|
|
9960
|
+
const mod = await importNapiModule();
|
|
9870
9961
|
const tocForRust = pageData.toc.map((entry) => ({
|
|
9871
9962
|
depth: entry.depth,
|
|
9872
9963
|
text: entry.text,
|
|
@@ -9969,7 +10060,7 @@ function createSharedAssetChunk(type, label, content, outDir, base) {
|
|
|
9969
10060
|
const hash = createContentHash(content);
|
|
9970
10061
|
const fileName = `ox-content-${sanitizeChunkLabel(label)}-${hash}.${type}`;
|
|
9971
10062
|
return {
|
|
9972
|
-
outputPath: path.join(outDir, "assets", fileName),
|
|
10063
|
+
outputPath: path$1.join(outDir, "assets", fileName),
|
|
9973
10064
|
publicPath: toPublicAssetPath(base, fileName),
|
|
9974
10065
|
content
|
|
9975
10066
|
};
|
|
@@ -10059,7 +10150,7 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10059
10150
|
});
|
|
10060
10151
|
const chunks = [...cssChunks.values(), ...jsChunks.values()];
|
|
10061
10152
|
await Promise.all(chunks.map(async (chunk) => {
|
|
10062
|
-
await fs.mkdir(path.dirname(chunk.outputPath), { recursive: true });
|
|
10153
|
+
await fs.mkdir(path$1.dirname(chunk.outputPath), { recursive: true });
|
|
10063
10154
|
await fs.writeFile(chunk.outputPath, chunk.content, "utf-8");
|
|
10064
10155
|
}));
|
|
10065
10156
|
return {
|
|
@@ -10071,16 +10162,16 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10071
10162
|
* Converts a markdown file path to its corresponding HTML output path.
|
|
10072
10163
|
*/
|
|
10073
10164
|
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);
|
|
10165
|
+
const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
|
|
10166
|
+
if (baseName.endsWith(`index${extension}`)) return path$1.join(outDir, baseName);
|
|
10076
10167
|
const dirName = baseName.replace(new RegExp(`\\${extension}$`), "");
|
|
10077
|
-
return path.join(outDir, dirName, `index${extension}`);
|
|
10168
|
+
return path$1.join(outDir, dirName, `index${extension}`);
|
|
10078
10169
|
}
|
|
10079
10170
|
/**
|
|
10080
10171
|
* Converts a markdown file path to a relative URL path.
|
|
10081
10172
|
*/
|
|
10082
10173
|
function getUrlPath$1(inputPath, srcDir) {
|
|
10083
|
-
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10174
|
+
const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10084
10175
|
if (baseName === "index" || baseName.endsWith("/index")) return baseName.replace(/\/?index$/, "") || "/";
|
|
10085
10176
|
return baseName;
|
|
10086
10177
|
}
|
|
@@ -10096,12 +10187,12 @@ function getHref(inputPath, srcDir, base, extension) {
|
|
|
10096
10187
|
* Gets the OG image output path for a given markdown file.
|
|
10097
10188
|
*/
|
|
10098
10189
|
function getOgImagePath(inputPath, srcDir, outDir) {
|
|
10099
|
-
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10190
|
+
const baseName = path$1.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10100
10191
|
if (baseName === "index" || baseName.endsWith("/index")) {
|
|
10101
10192
|
const dirPath = baseName.replace(/\/?index$/, "") || "";
|
|
10102
|
-
return path.join(outDir, dirPath, "og-image.png");
|
|
10193
|
+
return path$1.join(outDir, dirPath, "og-image.png");
|
|
10103
10194
|
}
|
|
10104
|
-
return path.join(outDir, baseName, "og-image.png");
|
|
10195
|
+
return path$1.join(outDir, baseName, "og-image.png");
|
|
10105
10196
|
}
|
|
10106
10197
|
/**
|
|
10107
10198
|
* Gets the OG image URL for use in meta tags.
|
|
@@ -10119,9 +10210,9 @@ function getOgImageUrl(inputPath, srcDir, base, siteUrl) {
|
|
|
10119
10210
|
* Gets display title from file path.
|
|
10120
10211
|
*/
|
|
10121
10212
|
function getDisplayTitle(filePath) {
|
|
10122
|
-
const fileName = path.basename(filePath, path.extname(filePath));
|
|
10213
|
+
const fileName = path$1.basename(filePath, path$1.extname(filePath));
|
|
10123
10214
|
if (fileName === "index") {
|
|
10124
|
-
const dirName = path.basename(path.dirname(filePath));
|
|
10215
|
+
const dirName = path$1.basename(path$1.dirname(filePath));
|
|
10125
10216
|
if (dirName && dirName !== ".") return formatTitle(dirName);
|
|
10126
10217
|
return "Home";
|
|
10127
10218
|
}
|
|
@@ -10137,7 +10228,7 @@ function formatTitle(name) {
|
|
|
10137
10228
|
* Collects all markdown files from the source directory.
|
|
10138
10229
|
*/
|
|
10139
10230
|
async function collectMarkdownFiles$1(srcDir) {
|
|
10140
|
-
return (await glob(path.join(srcDir, "**/*.{md,markdown}"), {
|
|
10231
|
+
return (await glob(path$1.join(srcDir, "**/*.{md,markdown}"), {
|
|
10141
10232
|
nodir: true,
|
|
10142
10233
|
ignore: [
|
|
10143
10234
|
"**/node_modules/**",
|
|
@@ -10158,7 +10249,7 @@ function buildNavItems(markdownFiles, srcDir, base, extension) {
|
|
|
10158
10249
|
"api"
|
|
10159
10250
|
];
|
|
10160
10251
|
for (const file of markdownFiles) {
|
|
10161
|
-
const parts = path.relative(srcDir, file).split(path.sep);
|
|
10252
|
+
const parts = path$1.relative(srcDir, file).split(path$1.sep);
|
|
10162
10253
|
let groupKey = "";
|
|
10163
10254
|
if (parts.length > 1) groupKey = parts[0];
|
|
10164
10255
|
if (!groups.has(groupKey)) groups.set(groupKey, []);
|
|
@@ -10207,8 +10298,8 @@ async function buildSsg(options, root) {
|
|
|
10207
10298
|
files: [],
|
|
10208
10299
|
errors: []
|
|
10209
10300
|
};
|
|
10210
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
10211
|
-
const outDir = path.resolve(root, options.outDir);
|
|
10301
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10302
|
+
const outDir = path$1.resolve(root, options.outDir);
|
|
10212
10303
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10213
10304
|
const generatedFiles = [];
|
|
10214
10305
|
const generatedPages = [];
|
|
@@ -10223,7 +10314,7 @@ async function buildSsg(options, root) {
|
|
|
10223
10314
|
const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);
|
|
10224
10315
|
let siteName = ssgOptions.siteName ?? "Documentation";
|
|
10225
10316
|
if (!ssgOptions.siteName) try {
|
|
10226
|
-
const pkgPath = path.join(root, "package.json");
|
|
10317
|
+
const pkgPath = path$1.join(root, "package.json");
|
|
10227
10318
|
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
|
|
10228
10319
|
if (pkg.name) siteName = formatTitle(pkg.name);
|
|
10229
10320
|
} catch {}
|
|
@@ -10337,7 +10428,7 @@ async function buildSsg(options, root) {
|
|
|
10337
10428
|
const optimizedOutput = await externalizeSharedPageAssets(generatedPages, outDir, base);
|
|
10338
10429
|
generatedFiles.push(...optimizedOutput.assets);
|
|
10339
10430
|
for (const page of optimizedOutput.pages) {
|
|
10340
|
-
await fs.mkdir(path.dirname(page.outputPath), { recursive: true });
|
|
10431
|
+
await fs.mkdir(path$1.dirname(page.outputPath), { recursive: true });
|
|
10341
10432
|
await fs.writeFile(page.outputPath, page.html, "utf-8");
|
|
10342
10433
|
generatedFiles.push(page.outputPath);
|
|
10343
10434
|
}
|
|
@@ -10346,7 +10437,6 @@ async function buildSsg(options, root) {
|
|
|
10346
10437
|
errors
|
|
10347
10438
|
};
|
|
10348
10439
|
}
|
|
10349
|
-
|
|
10350
10440
|
//#endregion
|
|
10351
10441
|
//#region src/search.ts
|
|
10352
10442
|
/**
|
|
@@ -10357,7 +10447,7 @@ async function buildSsg(options, root) {
|
|
|
10357
10447
|
let oxContent$1 = null;
|
|
10358
10448
|
async function getOxContent() {
|
|
10359
10449
|
if (!oxContent$1) try {
|
|
10360
|
-
oxContent$1 = await
|
|
10450
|
+
oxContent$1 = await importNapiModule();
|
|
10361
10451
|
} catch {
|
|
10362
10452
|
console.warn("[ox-content] Native bindings not available, search disabled");
|
|
10363
10453
|
return null;
|
|
@@ -10393,7 +10483,7 @@ async function collectMarkdownFiles(dir) {
|
|
|
10393
10483
|
try {
|
|
10394
10484
|
const entries = await fs.readdir(currentDir, { withFileTypes: true });
|
|
10395
10485
|
for (const entry of entries) {
|
|
10396
|
-
const fullPath = path.join(currentDir, entry.name);
|
|
10486
|
+
const fullPath = path$1.join(currentDir, entry.name);
|
|
10397
10487
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") await walk(fullPath);
|
|
10398
10488
|
else if (entry.isFile() && entry.name.endsWith(".md")) files.push(fullPath);
|
|
10399
10489
|
}
|
|
@@ -10418,7 +10508,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10418
10508
|
const documents = [];
|
|
10419
10509
|
for (const file of files) try {
|
|
10420
10510
|
const content = await fs.readFile(file, "utf-8");
|
|
10421
|
-
const relativePath = path.relative(srcDir, file);
|
|
10511
|
+
const relativePath = path$1.relative(srcDir, file);
|
|
10422
10512
|
const url = base + relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10423
10513
|
const id = relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10424
10514
|
const extractSearchContent = napi.extractSearchContent;
|
|
@@ -10447,7 +10537,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10447
10537
|
* Writes the search index to a file.
|
|
10448
10538
|
*/
|
|
10449
10539
|
async function writeSearchIndex(indexJson, outDir) {
|
|
10450
|
-
const indexPath = path.join(outDir, "search-index.json");
|
|
10540
|
+
const indexPath = path$1.join(outDir, "search-index.json");
|
|
10451
10541
|
await fs.mkdir(outDir, { recursive: true });
|
|
10452
10542
|
await fs.writeFile(indexPath, indexJson, "utf-8");
|
|
10453
10543
|
}
|
|
@@ -10463,6 +10553,51 @@ const searchOptions = ${JSON.stringify(options)};
|
|
|
10463
10553
|
let searchIndex = null;
|
|
10464
10554
|
let indexPromise = null;
|
|
10465
10555
|
|
|
10556
|
+
function parseScopedQuery(query) {
|
|
10557
|
+
const scopes = [];
|
|
10558
|
+
const terms = [];
|
|
10559
|
+
|
|
10560
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
10561
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
10562
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
10563
|
+
} else {
|
|
10564
|
+
terms.push(part);
|
|
10565
|
+
}
|
|
10566
|
+
}
|
|
10567
|
+
|
|
10568
|
+
return {
|
|
10569
|
+
text: terms.join(' ').trim(),
|
|
10570
|
+
scopes: [...new Set(scopes)],
|
|
10571
|
+
};
|
|
10572
|
+
}
|
|
10573
|
+
|
|
10574
|
+
function getScopesForDoc(doc) {
|
|
10575
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
10576
|
+
const segments = source.split('/').filter(Boolean);
|
|
10577
|
+
|
|
10578
|
+
if (segments.length <= 1) {
|
|
10579
|
+
return [];
|
|
10580
|
+
}
|
|
10581
|
+
|
|
10582
|
+
const scopes = [];
|
|
10583
|
+
let current = '';
|
|
10584
|
+
for (const segment of segments.slice(0, -1)) {
|
|
10585
|
+
current = current ? current + '/' + segment : segment;
|
|
10586
|
+
scopes.push(current);
|
|
10587
|
+
}
|
|
10588
|
+
|
|
10589
|
+
return scopes;
|
|
10590
|
+
}
|
|
10591
|
+
|
|
10592
|
+
function matchesScopes(doc, scopes) {
|
|
10593
|
+
if (!scopes.length) {
|
|
10594
|
+
return true;
|
|
10595
|
+
}
|
|
10596
|
+
|
|
10597
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
10598
|
+
return scopes.some(scope => docScopes.has(scope));
|
|
10599
|
+
}
|
|
10600
|
+
|
|
10466
10601
|
// Tokenizer for queries
|
|
10467
10602
|
function tokenizeQuery(text) {
|
|
10468
10603
|
const tokens = [];
|
|
@@ -10530,22 +10665,32 @@ async function loadIndex() {
|
|
|
10530
10665
|
export async function search(query, options = {}) {
|
|
10531
10666
|
const index = await loadIndex();
|
|
10532
10667
|
|
|
10533
|
-
if (!index
|
|
10668
|
+
if (!index) {
|
|
10534
10669
|
return [];
|
|
10535
10670
|
}
|
|
10536
10671
|
|
|
10537
|
-
const
|
|
10538
|
-
const prefix = options.prefix ?? searchOptions.prefix;
|
|
10539
|
-
const tokens = tokenizeQuery(query);
|
|
10672
|
+
const parsedQuery = parseScopedQuery(query);
|
|
10540
10673
|
|
|
10541
|
-
if (
|
|
10674
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
10542
10675
|
return [];
|
|
10543
10676
|
}
|
|
10544
10677
|
|
|
10678
|
+
const limit = options.limit ?? searchOptions.limit;
|
|
10679
|
+
const prefix = options.prefix ?? searchOptions.prefix;
|
|
10680
|
+
const tokens = tokenizeQuery(parsedQuery.text);
|
|
10681
|
+
|
|
10545
10682
|
const k1 = 1.2;
|
|
10546
10683
|
const b = 0.75;
|
|
10547
10684
|
const docScores = new Map();
|
|
10548
10685
|
|
|
10686
|
+
if (tokens.length === 0) {
|
|
10687
|
+
index.documents.forEach((doc, docIdx) => {
|
|
10688
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
10689
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
10690
|
+
}
|
|
10691
|
+
});
|
|
10692
|
+
}
|
|
10693
|
+
|
|
10549
10694
|
for (let i = 0; i < tokens.length; i++) {
|
|
10550
10695
|
const token = tokens[i];
|
|
10551
10696
|
const isLast = i === tokens.length - 1;
|
|
@@ -10566,6 +10711,7 @@ export async function search(query, options = {}) {
|
|
|
10566
10711
|
for (const posting of postings) {
|
|
10567
10712
|
const doc = index.documents[posting.doc_idx];
|
|
10568
10713
|
if (!doc) continue;
|
|
10714
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
10569
10715
|
|
|
10570
10716
|
const docLen = doc.body.length;
|
|
10571
10717
|
const tf = posting.tf;
|
|
@@ -10588,6 +10734,7 @@ export async function search(query, options = {}) {
|
|
|
10588
10734
|
.map(([docIdx, data]) => {
|
|
10589
10735
|
const doc = index.documents[docIdx];
|
|
10590
10736
|
const matches = Array.from(data.matches);
|
|
10737
|
+
const scopes = getScopesForDoc(doc);
|
|
10591
10738
|
|
|
10592
10739
|
// Generate snippet
|
|
10593
10740
|
let snippet = '';
|
|
@@ -10601,7 +10748,7 @@ export async function search(query, options = {}) {
|
|
|
10601
10748
|
}
|
|
10602
10749
|
}
|
|
10603
10750
|
|
|
10604
|
-
const start = Math.max(0, firstPos - 50);
|
|
10751
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
10605
10752
|
const end = Math.min(doc.body.length, start + 150);
|
|
10606
10753
|
snippet = doc.body.slice(start, end);
|
|
10607
10754
|
if (start > 0) snippet = '...' + snippet;
|
|
@@ -10615,9 +10762,10 @@ export async function search(query, options = {}) {
|
|
|
10615
10762
|
score: data.score,
|
|
10616
10763
|
matches,
|
|
10617
10764
|
snippet,
|
|
10765
|
+
scopes,
|
|
10618
10766
|
};
|
|
10619
10767
|
})
|
|
10620
|
-
.sort((a, b) => b.score - a.score)
|
|
10768
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
10621
10769
|
.slice(0, limit);
|
|
10622
10770
|
|
|
10623
10771
|
return results;
|
|
@@ -10627,7 +10775,6 @@ export { searchOptions };
|
|
|
10627
10775
|
export default { search, searchOptions, loadIndex };
|
|
10628
10776
|
`;
|
|
10629
10777
|
}
|
|
10630
|
-
|
|
10631
10778
|
//#endregion
|
|
10632
10779
|
//#region src/dev-server.ts
|
|
10633
10780
|
/**
|
|
@@ -10692,12 +10839,12 @@ async function resolveMarkdownFile(url, srcDir) {
|
|
|
10692
10839
|
let relativePath;
|
|
10693
10840
|
if (pathname === "/") relativePath = "index.md";
|
|
10694
10841
|
else relativePath = pathname.slice(1) + ".md";
|
|
10695
|
-
const filePath = path.join(srcDir, relativePath);
|
|
10842
|
+
const filePath = path$1.join(srcDir, relativePath);
|
|
10696
10843
|
try {
|
|
10697
10844
|
await fs.access(filePath);
|
|
10698
10845
|
return filePath;
|
|
10699
10846
|
} catch {
|
|
10700
|
-
const indexPath = path.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
|
|
10847
|
+
const indexPath = path$1.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
|
|
10701
10848
|
try {
|
|
10702
10849
|
await fs.access(indexPath);
|
|
10703
10850
|
return indexPath;
|
|
@@ -10741,7 +10888,7 @@ function invalidatePageCache(cache, filePath) {
|
|
|
10741
10888
|
async function resolveSiteName(options, root) {
|
|
10742
10889
|
if (options.ssg.siteName) return options.ssg.siteName;
|
|
10743
10890
|
try {
|
|
10744
|
-
const pkgPath = path.join(root, "package.json");
|
|
10891
|
+
const pkgPath = path$1.join(root, "package.json");
|
|
10745
10892
|
const pkg = JSON.parse(await fs.readFile(pkgPath, "utf-8"));
|
|
10746
10893
|
if (pkg.name) return formatTitle(pkg.name);
|
|
10747
10894
|
} catch {}
|
|
@@ -10751,7 +10898,7 @@ async function resolveSiteName(options, root) {
|
|
|
10751
10898
|
* Render a single markdown page to full HTML.
|
|
10752
10899
|
*/
|
|
10753
10900
|
async function renderPage$1(filePath, options, navGroups, siteName, base, root) {
|
|
10754
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
10901
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10755
10902
|
resetTabGroupCounter();
|
|
10756
10903
|
resetIslandCounter();
|
|
10757
10904
|
const result = await transformMarkdown(await fs.readFile(filePath, "utf-8"), filePath, options, {
|
|
@@ -10796,7 +10943,7 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root)
|
|
|
10796
10943
|
* Create the dev server middleware for SSG page serving.
|
|
10797
10944
|
*/
|
|
10798
10945
|
function createDevServerMiddleware(options, root, cache) {
|
|
10799
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
10946
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10800
10947
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10801
10948
|
return async (req, res, next) => {
|
|
10802
10949
|
const url = req.url;
|
|
@@ -10828,7 +10975,6 @@ function createDevServerMiddleware(options, root, cache) {
|
|
|
10828
10975
|
}
|
|
10829
10976
|
};
|
|
10830
10977
|
}
|
|
10831
|
-
|
|
10832
10978
|
//#endregion
|
|
10833
10979
|
//#region src/og-viewer.ts
|
|
10834
10980
|
/**
|
|
@@ -10862,7 +11008,7 @@ function extractTitle(content, frontmatter) {
|
|
|
10862
11008
|
return match ? match[1].trim() : "";
|
|
10863
11009
|
}
|
|
10864
11010
|
function getUrlPath(filePath, srcDir) {
|
|
10865
|
-
let rel = path.relative(srcDir, filePath).replace(/\\/g, "/");
|
|
11011
|
+
let rel = path$1.relative(srcDir, filePath).replace(/\\/g, "/");
|
|
10866
11012
|
rel = rel.replace(/\.md$/, "");
|
|
10867
11013
|
if (rel === "index") return "/";
|
|
10868
11014
|
if (rel.endsWith("/index")) rel = rel.slice(0, -6);
|
|
@@ -10902,7 +11048,7 @@ function validatePage(page, options) {
|
|
|
10902
11048
|
return warnings;
|
|
10903
11049
|
}
|
|
10904
11050
|
async function collectPages(options, root) {
|
|
10905
|
-
const srcDir = path.resolve(root, options.srcDir);
|
|
11051
|
+
const srcDir = path$1.resolve(root, options.srcDir);
|
|
10906
11052
|
const files = await glob("**/*.md", {
|
|
10907
11053
|
cwd: srcDir,
|
|
10908
11054
|
absolute: true
|
|
@@ -10920,7 +11066,7 @@ async function collectPages(options, root) {
|
|
|
10920
11066
|
const urlPath = getUrlPath(file, srcDir);
|
|
10921
11067
|
const ogImageUrl = computeOgImageUrl(urlPath, options.base, options.ssg.siteUrl, generateOgImage, options.ssg.ogImage);
|
|
10922
11068
|
const page = {
|
|
10923
|
-
path: path.relative(srcDir, file),
|
|
11069
|
+
path: path$1.relative(srcDir, file),
|
|
10924
11070
|
urlPath,
|
|
10925
11071
|
title,
|
|
10926
11072
|
description,
|
|
@@ -11175,7 +11321,6 @@ function createOgViewerPlugin(options) {
|
|
|
11175
11321
|
}
|
|
11176
11322
|
};
|
|
11177
11323
|
}
|
|
11178
|
-
|
|
11179
11324
|
//#endregion
|
|
11180
11325
|
//#region src/i18n.ts
|
|
11181
11326
|
/**
|
|
@@ -11236,13 +11381,13 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11236
11381
|
},
|
|
11237
11382
|
async buildStart() {
|
|
11238
11383
|
if (!i18nOptions || !i18nOptions.check) return;
|
|
11239
|
-
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11384
|
+
const dictDir = path$1.resolve(root, i18nOptions.dir);
|
|
11240
11385
|
if (!fs$1.existsSync(dictDir)) {
|
|
11241
11386
|
console.warn(`[ox-content:i18n] Dictionary directory not found: ${dictDir}`);
|
|
11242
11387
|
return;
|
|
11243
11388
|
}
|
|
11244
11389
|
try {
|
|
11245
|
-
const { loadDictionaries, checkI18n, extractTranslationKeys } = await
|
|
11390
|
+
const { loadDictionaries, checkI18n, extractTranslationKeys } = await importNapiModule();
|
|
11246
11391
|
const loadResult = loadDictionaries(dictDir);
|
|
11247
11392
|
if (loadResult.errors.length > 0) {
|
|
11248
11393
|
for (const error of loadResult.errors) console.warn(`[ox-content:i18n] ${error}`);
|
|
@@ -11258,7 +11403,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11258
11403
|
},
|
|
11259
11404
|
configureServer(server) {
|
|
11260
11405
|
if (!i18nOptions) return;
|
|
11261
|
-
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11406
|
+
const dictDir = path$1.resolve(root, i18nOptions.dir);
|
|
11262
11407
|
if (fs$1.existsSync(dictDir)) {
|
|
11263
11408
|
server.watcher.add(dictDir);
|
|
11264
11409
|
server.watcher.on("change", (filePath) => {
|
|
@@ -11285,7 +11430,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11285
11430
|
* Generates the virtual module for i18n configuration.
|
|
11286
11431
|
*/
|
|
11287
11432
|
function generateI18nModule(options, root) {
|
|
11288
|
-
const dictDir = path.resolve(root, options.dir);
|
|
11433
|
+
const dictDir = path$1.resolve(root, options.dir);
|
|
11289
11434
|
const localesJson = JSON.stringify(options.locales);
|
|
11290
11435
|
const defaultLocale = JSON.stringify(options.defaultLocale);
|
|
11291
11436
|
let dictionariesCode = "{}";
|
|
@@ -11368,15 +11513,15 @@ function flattenObject(obj, prefix, result) {
|
|
|
11368
11513
|
function loadDictionariesFallback(options, dictDir) {
|
|
11369
11514
|
const dictData = {};
|
|
11370
11515
|
for (const locale of options.locales) {
|
|
11371
|
-
const localeDir = path.join(dictDir, locale.code);
|
|
11516
|
+
const localeDir = path$1.join(dictDir, locale.code);
|
|
11372
11517
|
if (!fs$1.existsSync(localeDir)) continue;
|
|
11373
11518
|
const files = fs$1.readdirSync(localeDir);
|
|
11374
11519
|
const localeDict = {};
|
|
11375
11520
|
for (const file of files) {
|
|
11376
11521
|
if (!file.endsWith(".json")) continue;
|
|
11377
|
-
const filePath = path.join(localeDir, file);
|
|
11522
|
+
const filePath = path$1.join(localeDir, file);
|
|
11378
11523
|
const content = fs$1.readFileSync(filePath, "utf-8");
|
|
11379
|
-
const namespace = path.basename(file, ".json");
|
|
11524
|
+
const namespace = path$1.basename(file, ".json");
|
|
11380
11525
|
try {
|
|
11381
11526
|
flattenObject(JSON.parse(content), namespace, localeDict);
|
|
11382
11527
|
} catch {}
|
|
@@ -11389,13 +11534,13 @@ function loadDictionariesFallback(options, dictDir) {
|
|
|
11389
11534
|
* Collects translation keys from source files using NAPI extractTranslationKeys.
|
|
11390
11535
|
*/
|
|
11391
11536
|
function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
11392
|
-
const srcDir = path.resolve(root, "src");
|
|
11537
|
+
const srcDir = path$1.resolve(root, "src");
|
|
11393
11538
|
const keys = /* @__PURE__ */ new Set();
|
|
11394
11539
|
if (fs$1.existsSync(srcDir)) walkDir(srcDir, /\.(ts|tsx|js|jsx)$/, (filePath) => {
|
|
11395
11540
|
const usages = extractTranslationKeys(fs$1.readFileSync(filePath, "utf-8"), filePath, options.functionNames);
|
|
11396
11541
|
for (const usage of usages) keys.add(usage.key);
|
|
11397
11542
|
});
|
|
11398
|
-
const contentDir = path.resolve(root, "content");
|
|
11543
|
+
const contentDir = path$1.resolve(root, "content");
|
|
11399
11544
|
if (fs$1.existsSync(contentDir)) {
|
|
11400
11545
|
const tPattern = /\{\{t\(['"]([^'"]+)['"]\)\}\}/g;
|
|
11401
11546
|
walkDir(contentDir, /\.(md|mdx)$/, (filePath) => {
|
|
@@ -11413,14 +11558,13 @@ function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
|
11413
11558
|
function walkDir(dir, pattern, callback) {
|
|
11414
11559
|
const entries = fs$1.readdirSync(dir, { withFileTypes: true });
|
|
11415
11560
|
for (const entry of entries) {
|
|
11416
|
-
const fullPath = path.join(dir, entry.name);
|
|
11561
|
+
const fullPath = path$1.join(dir, entry.name);
|
|
11417
11562
|
if (entry.isDirectory()) {
|
|
11418
11563
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
11419
11564
|
walkDir(fullPath, pattern, callback);
|
|
11420
11565
|
} else if (pattern.test(entry.name)) callback(fullPath);
|
|
11421
11566
|
}
|
|
11422
11567
|
}
|
|
11423
|
-
|
|
11424
11568
|
//#endregion
|
|
11425
11569
|
//#region src/jsx-runtime.ts
|
|
11426
11570
|
/**
|
|
@@ -11610,7 +11754,6 @@ function when(condition, content) {
|
|
|
11610
11754
|
function each(items, render) {
|
|
11611
11755
|
return { __html: items.map((item, i) => render(item, i).__html).join("") };
|
|
11612
11756
|
}
|
|
11613
|
-
|
|
11614
11757
|
//#endregion
|
|
11615
11758
|
//#region src/page-context.ts
|
|
11616
11759
|
var page_context_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -11801,7 +11944,6 @@ var currentContext;
|
|
|
11801
11944
|
var init_page_context = __esmMin((() => {
|
|
11802
11945
|
currentContext = null;
|
|
11803
11946
|
}));
|
|
11804
|
-
|
|
11805
11947
|
//#endregion
|
|
11806
11948
|
//#region src/theme-renderer.ts
|
|
11807
11949
|
/**
|
|
@@ -11959,7 +12101,6 @@ function createTheme(config) {
|
|
|
11959
12101
|
return Layout({ children });
|
|
11960
12102
|
};
|
|
11961
12103
|
}
|
|
11962
|
-
|
|
11963
12104
|
//#endregion
|
|
11964
12105
|
//#region src/index.ts
|
|
11965
12106
|
/**
|
|
@@ -11994,8 +12135,8 @@ function oxContent(options = {}) {
|
|
|
11994
12135
|
async function regenerateDocs(root) {
|
|
11995
12136
|
const docsOptions = resolvedOptions.docs;
|
|
11996
12137
|
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);
|
|
12138
|
+
const srcDirs = docsOptions.src.map((src) => path$1.resolve(root, src));
|
|
12139
|
+
const outDir = path$1.resolve(root, docsOptions.out);
|
|
11999
12140
|
const extracted = await extractDocs(srcDirs, docsOptions);
|
|
12000
12141
|
const generated = generateMarkdown(extracted, docsOptions);
|
|
12001
12142
|
await writeDocs(generated, outDir, extracted, docsOptions);
|
|
@@ -12064,7 +12205,7 @@ function oxContent(options = {}) {
|
|
|
12064
12205
|
const docsOptions = resolvedOptions.docs;
|
|
12065
12206
|
if (!docsOptions || !docsOptions.enabled) return;
|
|
12066
12207
|
const root = config?.root || process.cwd();
|
|
12067
|
-
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
12208
|
+
const srcDirs = docsOptions.src.map((src) => path$1.resolve(root, src));
|
|
12068
12209
|
for (const srcDir of srcDirs) devServer.watcher.add(srcDir);
|
|
12069
12210
|
devServer.watcher.on("all", async (event, file) => {
|
|
12070
12211
|
if (event !== "add" && event !== "change" && event !== "unlink") return;
|
|
@@ -12080,7 +12221,7 @@ function oxContent(options = {}) {
|
|
|
12080
12221
|
configureServer(devServer) {
|
|
12081
12222
|
if (!resolvedOptions.ssg.enabled) return;
|
|
12082
12223
|
const root = config?.root || process.cwd();
|
|
12083
|
-
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12224
|
+
const srcDir = path$1.resolve(root, resolvedOptions.srcDir);
|
|
12084
12225
|
devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));
|
|
12085
12226
|
devServer.watcher.on("add", (file) => {
|
|
12086
12227
|
if (file.startsWith(srcDir) && file.endsWith(".md")) {
|
|
@@ -12147,7 +12288,7 @@ function oxContent(options = {}) {
|
|
|
12147
12288
|
async buildStart() {
|
|
12148
12289
|
if (!resolvedOptions.search.enabled) return;
|
|
12149
12290
|
const root = config?.root || process.cwd();
|
|
12150
|
-
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12291
|
+
const srcDir = path$1.resolve(root, resolvedOptions.srcDir);
|
|
12151
12292
|
try {
|
|
12152
12293
|
searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);
|
|
12153
12294
|
console.log("[ox-content] Search index built");
|
|
@@ -12158,10 +12299,10 @@ function oxContent(options = {}) {
|
|
|
12158
12299
|
async closeBundle() {
|
|
12159
12300
|
if (!resolvedOptions.search.enabled || !searchIndexJson) return;
|
|
12160
12301
|
const root = config?.root || process.cwd();
|
|
12161
|
-
const outDir = path.resolve(root, resolvedOptions.outDir);
|
|
12302
|
+
const outDir = path$1.resolve(root, resolvedOptions.outDir);
|
|
12162
12303
|
try {
|
|
12163
12304
|
await writeSearchIndex(searchIndexJson, outDir);
|
|
12164
|
-
console.log("[ox-content] Search index written to", path.join(outDir, "search-index.json"));
|
|
12305
|
+
console.log("[ox-content] Search index written to", path$1.join(outDir, "search-index.json"));
|
|
12165
12306
|
} catch (err) {
|
|
12166
12307
|
console.warn("[ox-content] Failed to write search index:", err);
|
|
12167
12308
|
}
|
|
@@ -12189,6 +12330,7 @@ function resolveOptions(options) {
|
|
|
12189
12330
|
highlight: options.highlight ?? false,
|
|
12190
12331
|
highlightTheme: options.highlightTheme ?? "github-dark",
|
|
12191
12332
|
highlightLangs: options.highlightLangs ?? [],
|
|
12333
|
+
codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
|
|
12192
12334
|
mermaid: options.mermaid ?? false,
|
|
12193
12335
|
frontmatter: options.frontmatter ?? true,
|
|
12194
12336
|
toc: options.toc ?? true,
|
|
@@ -12202,6 +12344,26 @@ function resolveOptions(options) {
|
|
|
12202
12344
|
i18n: resolveI18nOptions(options.i18n)
|
|
12203
12345
|
};
|
|
12204
12346
|
}
|
|
12347
|
+
function resolveCodeAnnotationsOptions(options) {
|
|
12348
|
+
if (!options) return {
|
|
12349
|
+
enabled: false,
|
|
12350
|
+
notation: "attribute",
|
|
12351
|
+
metaKey: "annotate",
|
|
12352
|
+
defaultLineNumbers: false
|
|
12353
|
+
};
|
|
12354
|
+
if (options === true) return {
|
|
12355
|
+
enabled: true,
|
|
12356
|
+
notation: "attribute",
|
|
12357
|
+
metaKey: "annotate",
|
|
12358
|
+
defaultLineNumbers: false
|
|
12359
|
+
};
|
|
12360
|
+
return {
|
|
12361
|
+
enabled: true,
|
|
12362
|
+
notation: options.notation ?? "attribute",
|
|
12363
|
+
metaKey: options.metaKey ?? "annotate",
|
|
12364
|
+
defaultLineNumbers: options.defaultLineNumbers ?? false
|
|
12365
|
+
};
|
|
12366
|
+
}
|
|
12205
12367
|
/**
|
|
12206
12368
|
* Generates virtual module content.
|
|
12207
12369
|
*/
|
|
@@ -12219,7 +12381,7 @@ function generateVirtualModule(path, options) {
|
|
|
12219
12381
|
`;
|
|
12220
12382
|
return "export default {};";
|
|
12221
12383
|
}
|
|
12222
|
-
|
|
12223
12384
|
//#endregion
|
|
12224
12385
|
export { DEFAULT_HTML_TEMPLATE, DefaultTheme, Fragment, buildSearchIndex, buildSsg, clearRenderContext, collectGitHubRepos, collectOgpUrls, createI18nPlugin, createMarkdownEnvironment, createTheme, defaultTheme, defineTheme, each, extractDocs, extractIslandInfo, extractVideoId, fetchOgpData, fetchRepoData, generateFrontmatterTypes, generateHydrationScript, generateMarkdown, generateOgImages, generateTabsCSS, generateTypes, hasIslands, inferType, jsx, jsxs, mergeThemes, mermaidClientScript, oxContent, prefetchGitHubRepos, prefetchOgpData, raw, renderAllPages, renderPage, renderToString, resolveDocsOptions, resolveI18nOptions, resolveOgImageOptions, resolveSearchOptions, resolveSsgOptions, resolveTheme, setRenderContext, transformAllPlugins, transformGitHub, transformIslands, transformMarkdown, transformMermaidStatic, transformOgp, transformTabs, transformYouTube, useIsActive, useNav, usePageProps, useRenderContext, useSiteConfig, when, writeDocs, writeSearchIndex };
|
|
12225
|
-
|
|
12386
|
+
|
|
12387
|
+
//# sourceMappingURL=index.mjs.map
|