@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
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
path
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk.cjs");
|
|
3
|
+
const require_mermaid = require("./mermaid.cjs");
|
|
4
|
+
const require_tabs = require("./tabs.cjs");
|
|
5
|
+
const require_youtube = require("./youtube.cjs");
|
|
6
|
+
const require_github = require("./github.cjs");
|
|
7
|
+
const require_ogp = require("./ogp.cjs");
|
|
8
|
+
let path = require("path");
|
|
9
|
+
path = require_chunk.__toESM(path);
|
|
9
10
|
let unified = require("unified");
|
|
10
11
|
let rehype_parse = require("rehype-parse");
|
|
11
12
|
rehype_parse = require_chunk.__toESM(rehype_parse);
|
|
@@ -22,7 +23,6 @@ let glob = require("glob");
|
|
|
22
23
|
let crypto = require("crypto");
|
|
23
24
|
crypto = require_chunk.__toESM(crypto);
|
|
24
25
|
let node_fs_promises = require("node:fs/promises");
|
|
25
|
-
|
|
26
26
|
//#region src/environment.ts
|
|
27
27
|
/**
|
|
28
28
|
* Creates the Markdown processing environment configuration.
|
|
@@ -69,7 +69,6 @@ function createMarkdownEnvironment(options) {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
|
|
73
72
|
//#endregion
|
|
74
73
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/identity.js
|
|
75
74
|
var require_identity = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -120,7 +119,6 @@ var require_identity = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
120
119
|
exports.isScalar = isScalar;
|
|
121
120
|
exports.isSeq = isSeq;
|
|
122
121
|
}));
|
|
123
|
-
|
|
124
122
|
//#endregion
|
|
125
123
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/visit.js
|
|
126
124
|
var require_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -311,7 +309,6 @@ var require_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
311
309
|
exports.visit = visit;
|
|
312
310
|
exports.visitAsync = visitAsync;
|
|
313
311
|
}));
|
|
314
|
-
|
|
315
312
|
//#endregion
|
|
316
313
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/directives.js
|
|
317
314
|
var require_directives = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -477,7 +474,6 @@ var require_directives = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
477
474
|
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
478
475
|
exports.Directives = Directives;
|
|
479
476
|
}));
|
|
480
|
-
|
|
481
477
|
//#endregion
|
|
482
478
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/anchors.js
|
|
483
479
|
var require_anchors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -540,7 +536,6 @@ var require_anchors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
540
536
|
exports.createNodeAnchors = createNodeAnchors;
|
|
541
537
|
exports.findNewAnchor = findNewAnchor;
|
|
542
538
|
}));
|
|
543
|
-
|
|
544
539
|
//#endregion
|
|
545
540
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/applyReviver.js
|
|
546
541
|
var require_applyReviver = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -581,7 +576,6 @@ var require_applyReviver = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
|
|
|
581
576
|
}
|
|
582
577
|
exports.applyReviver = applyReviver;
|
|
583
578
|
}));
|
|
584
|
-
|
|
585
579
|
//#endregion
|
|
586
580
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/toJS.js
|
|
587
581
|
var require_toJS = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -619,7 +613,6 @@ var require_toJS = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
619
613
|
}
|
|
620
614
|
exports.toJS = toJS;
|
|
621
615
|
}));
|
|
622
|
-
|
|
623
616
|
//#endregion
|
|
624
617
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Node.js
|
|
625
618
|
var require_Node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -654,7 +647,6 @@ var require_Node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
654
647
|
};
|
|
655
648
|
exports.NodeBase = NodeBase;
|
|
656
649
|
}));
|
|
657
|
-
|
|
658
650
|
//#endregion
|
|
659
651
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Alias.js
|
|
660
652
|
var require_Alias = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -748,7 +740,6 @@ var require_Alias = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
748
740
|
}
|
|
749
741
|
exports.Alias = Alias;
|
|
750
742
|
}));
|
|
751
|
-
|
|
752
743
|
//#endregion
|
|
753
744
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Scalar.js
|
|
754
745
|
var require_Scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -776,7 +767,6 @@ var require_Scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
776
767
|
exports.Scalar = Scalar;
|
|
777
768
|
exports.isScalarValue = isScalarValue;
|
|
778
769
|
}));
|
|
779
|
-
|
|
780
770
|
//#endregion
|
|
781
771
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/createNode.js
|
|
782
772
|
var require_createNode = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -840,7 +830,6 @@ var require_createNode = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
840
830
|
}
|
|
841
831
|
exports.createNode = createNode;
|
|
842
832
|
}));
|
|
843
|
-
|
|
844
833
|
//#endregion
|
|
845
834
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Collection.js
|
|
846
835
|
var require_Collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -962,7 +951,6 @@ var require_Collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
962
951
|
exports.collectionFromPath = collectionFromPath;
|
|
963
952
|
exports.isEmptyPath = isEmptyPath;
|
|
964
953
|
}));
|
|
965
|
-
|
|
966
954
|
//#endregion
|
|
967
955
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyComment.js
|
|
968
956
|
var require_stringifyComment = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -983,7 +971,6 @@ var require_stringifyComment = /* @__PURE__ */ require_chunk.__commonJSMin(((exp
|
|
|
983
971
|
exports.lineComment = lineComment;
|
|
984
972
|
exports.stringifyComment = stringifyComment;
|
|
985
973
|
}));
|
|
986
|
-
|
|
987
974
|
//#endregion
|
|
988
975
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/foldFlowLines.js
|
|
989
976
|
var require_foldFlowLines = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1100,7 +1087,6 @@ var require_foldFlowLines = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
1100
1087
|
exports.FOLD_QUOTED = FOLD_QUOTED;
|
|
1101
1088
|
exports.foldFlowLines = foldFlowLines;
|
|
1102
1089
|
}));
|
|
1103
|
-
|
|
1104
1090
|
//#endregion
|
|
1105
1091
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyString.js
|
|
1106
1092
|
var require_stringifyString = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1325,7 +1311,6 @@ var require_stringifyString = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
1325
1311
|
}
|
|
1326
1312
|
exports.stringifyString = stringifyString;
|
|
1327
1313
|
}));
|
|
1328
|
-
|
|
1329
1314
|
//#endregion
|
|
1330
1315
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringify.js
|
|
1331
1316
|
var require_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1433,7 +1418,6 @@ var require_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
|
|
|
1433
1418
|
exports.createStringifyContext = createStringifyContext;
|
|
1434
1419
|
exports.stringify = stringify;
|
|
1435
1420
|
}));
|
|
1436
|
-
|
|
1437
1421
|
//#endregion
|
|
1438
1422
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyPair.js
|
|
1439
1423
|
var require_stringifyPair = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1531,7 +1515,6 @@ var require_stringifyPair = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
1531
1515
|
}
|
|
1532
1516
|
exports.stringifyPair = stringifyPair;
|
|
1533
1517
|
}));
|
|
1534
|
-
|
|
1535
1518
|
//#endregion
|
|
1536
1519
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/log.js
|
|
1537
1520
|
var require_log = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1546,7 +1529,6 @@ var require_log = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1546
1529
|
exports.debug = debug;
|
|
1547
1530
|
exports.warn = warn;
|
|
1548
1531
|
}));
|
|
1549
|
-
|
|
1550
1532
|
//#endregion
|
|
1551
1533
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/merge.js
|
|
1552
1534
|
var require_merge = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1587,7 +1569,6 @@ var require_merge = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1587
1569
|
exports.isMergeKey = isMergeKey;
|
|
1588
1570
|
exports.merge = merge;
|
|
1589
1571
|
}));
|
|
1590
|
-
|
|
1591
1572
|
//#endregion
|
|
1592
1573
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/addPairToJSMap.js
|
|
1593
1574
|
var require_addPairToJSMap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1639,7 +1620,6 @@ var require_addPairToJSMap = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
1639
1620
|
}
|
|
1640
1621
|
exports.addPairToJSMap = addPairToJSMap;
|
|
1641
1622
|
}));
|
|
1642
|
-
|
|
1643
1623
|
//#endregion
|
|
1644
1624
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/Pair.js
|
|
1645
1625
|
var require_Pair = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1673,7 +1653,6 @@ var require_Pair = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1673
1653
|
exports.Pair = Pair;
|
|
1674
1654
|
exports.createPair = createPair;
|
|
1675
1655
|
}));
|
|
1676
|
-
|
|
1677
1656
|
//#endregion
|
|
1678
1657
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyCollection.js
|
|
1679
1658
|
var require_stringifyCollection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1788,7 +1767,6 @@ var require_stringifyCollection = /* @__PURE__ */ require_chunk.__commonJSMin(((
|
|
|
1788
1767
|
}
|
|
1789
1768
|
exports.stringifyCollection = stringifyCollection;
|
|
1790
1769
|
}));
|
|
1791
|
-
|
|
1792
1770
|
//#endregion
|
|
1793
1771
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLMap.js
|
|
1794
1772
|
var require_YAMLMap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -1898,13 +1876,12 @@ var require_YAMLMap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
1898
1876
|
exports.YAMLMap = YAMLMap;
|
|
1899
1877
|
exports.findPair = findPair;
|
|
1900
1878
|
}));
|
|
1901
|
-
|
|
1902
1879
|
//#endregion
|
|
1903
1880
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/map.js
|
|
1904
1881
|
var require_map = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
1905
1882
|
var identity = require_identity();
|
|
1906
1883
|
var YAMLMap = require_YAMLMap();
|
|
1907
|
-
|
|
1884
|
+
exports.map = {
|
|
1908
1885
|
collection: "map",
|
|
1909
1886
|
default: true,
|
|
1910
1887
|
nodeClass: YAMLMap.YAMLMap,
|
|
@@ -1915,9 +1892,7 @@ var require_map = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
1915
1892
|
},
|
|
1916
1893
|
createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)
|
|
1917
1894
|
};
|
|
1918
|
-
exports.map = map;
|
|
1919
1895
|
}));
|
|
1920
|
-
|
|
1921
1896
|
//#endregion
|
|
1922
1897
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/nodes/YAMLSeq.js
|
|
1923
1898
|
var require_YAMLSeq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2024,13 +1999,12 @@ var require_YAMLSeq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2024
1999
|
}
|
|
2025
2000
|
exports.YAMLSeq = YAMLSeq;
|
|
2026
2001
|
}));
|
|
2027
|
-
|
|
2028
2002
|
//#endregion
|
|
2029
2003
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/seq.js
|
|
2030
2004
|
var require_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
2031
2005
|
var identity = require_identity();
|
|
2032
2006
|
var YAMLSeq = require_YAMLSeq();
|
|
2033
|
-
|
|
2007
|
+
exports.seq = {
|
|
2034
2008
|
collection: "seq",
|
|
2035
2009
|
default: true,
|
|
2036
2010
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
@@ -2041,14 +2015,12 @@ var require_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2041
2015
|
},
|
|
2042
2016
|
createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)
|
|
2043
2017
|
};
|
|
2044
|
-
exports.seq = seq;
|
|
2045
2018
|
}));
|
|
2046
|
-
|
|
2047
2019
|
//#endregion
|
|
2048
2020
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/string.js
|
|
2049
2021
|
var require_string = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
2050
2022
|
var stringifyString = require_stringifyString();
|
|
2051
|
-
|
|
2023
|
+
exports.string = {
|
|
2052
2024
|
identify: (value) => typeof value === "string",
|
|
2053
2025
|
default: true,
|
|
2054
2026
|
tag: "tag:yaml.org,2002:str",
|
|
@@ -2058,9 +2030,7 @@ var require_string = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2058
2030
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
2059
2031
|
}
|
|
2060
2032
|
};
|
|
2061
|
-
exports.string = string;
|
|
2062
2033
|
}));
|
|
2063
|
-
|
|
2064
2034
|
//#endregion
|
|
2065
2035
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/common/null.js
|
|
2066
2036
|
var require_null = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2076,7 +2046,6 @@ var require_null = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2076
2046
|
};
|
|
2077
2047
|
exports.nullTag = nullTag;
|
|
2078
2048
|
}));
|
|
2079
|
-
|
|
2080
2049
|
//#endregion
|
|
2081
2050
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/bool.js
|
|
2082
2051
|
var require_bool$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2096,7 +2065,6 @@ var require_bool$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2096
2065
|
};
|
|
2097
2066
|
exports.boolTag = boolTag;
|
|
2098
2067
|
}));
|
|
2099
|
-
|
|
2100
2068
|
//#endregion
|
|
2101
2069
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js
|
|
2102
2070
|
var require_stringifyNumber = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2118,7 +2086,6 @@ var require_stringifyNumber = /* @__PURE__ */ require_chunk.__commonJSMin(((expo
|
|
|
2118
2086
|
}
|
|
2119
2087
|
exports.stringifyNumber = stringifyNumber;
|
|
2120
2088
|
}));
|
|
2121
|
-
|
|
2122
2089
|
//#endregion
|
|
2123
2090
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/float.js
|
|
2124
2091
|
var require_float$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2144,7 +2111,7 @@ var require_float$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2144
2111
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2145
2112
|
}
|
|
2146
2113
|
};
|
|
2147
|
-
|
|
2114
|
+
exports.float = {
|
|
2148
2115
|
identify: (value) => typeof value === "number",
|
|
2149
2116
|
default: true,
|
|
2150
2117
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2157,11 +2124,9 @@ var require_float$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2157
2124
|
},
|
|
2158
2125
|
stringify: stringifyNumber.stringifyNumber
|
|
2159
2126
|
};
|
|
2160
|
-
exports.float = float;
|
|
2161
2127
|
exports.floatExp = floatExp;
|
|
2162
2128
|
exports.floatNaN = floatNaN;
|
|
2163
2129
|
}));
|
|
2164
|
-
|
|
2165
2130
|
//#endregion
|
|
2166
2131
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/int.js
|
|
2167
2132
|
var require_int$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2203,7 +2168,6 @@ var require_int$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2203
2168
|
exports.intHex = intHex;
|
|
2204
2169
|
exports.intOct = intOct;
|
|
2205
2170
|
}));
|
|
2206
|
-
|
|
2207
2171
|
//#endregion
|
|
2208
2172
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/core/schema.js
|
|
2209
2173
|
var require_schema$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2214,7 +2178,7 @@ var require_schema$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2214
2178
|
var bool = require_bool$1();
|
|
2215
2179
|
var float = require_float$1();
|
|
2216
2180
|
var int = require_int$1();
|
|
2217
|
-
|
|
2181
|
+
exports.schema = [
|
|
2218
2182
|
map.map,
|
|
2219
2183
|
seq.seq,
|
|
2220
2184
|
string.string,
|
|
@@ -2227,9 +2191,7 @@ var require_schema$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2227
2191
|
float.floatExp,
|
|
2228
2192
|
float.float
|
|
2229
2193
|
];
|
|
2230
|
-
exports.schema = schema;
|
|
2231
2194
|
}));
|
|
2232
|
-
|
|
2233
2195
|
//#endregion
|
|
2234
2196
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/json/schema.js
|
|
2235
2197
|
var require_schema$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2282,7 +2244,7 @@ var require_schema$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2282
2244
|
stringify: stringifyJSON
|
|
2283
2245
|
}
|
|
2284
2246
|
];
|
|
2285
|
-
|
|
2247
|
+
exports.schema = [map.map, seq.seq].concat(jsonScalars, {
|
|
2286
2248
|
default: true,
|
|
2287
2249
|
tag: "",
|
|
2288
2250
|
test: /^/,
|
|
@@ -2291,16 +2253,14 @@ var require_schema$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
2291
2253
|
return str;
|
|
2292
2254
|
}
|
|
2293
2255
|
});
|
|
2294
|
-
exports.schema = schema;
|
|
2295
2256
|
}));
|
|
2296
|
-
|
|
2297
2257
|
//#endregion
|
|
2298
2258
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/binary.js
|
|
2299
2259
|
var require_binary = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
2300
2260
|
var node_buffer = require("buffer");
|
|
2301
2261
|
var Scalar = require_Scalar();
|
|
2302
2262
|
var stringifyString = require_stringifyString();
|
|
2303
|
-
|
|
2263
|
+
exports.binary = {
|
|
2304
2264
|
identify: (value) => value instanceof Uint8Array,
|
|
2305
2265
|
default: false,
|
|
2306
2266
|
tag: "tag:yaml.org,2002:binary",
|
|
@@ -2341,9 +2301,7 @@ var require_binary = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2341
2301
|
}, ctx, onComment, onChompKeep);
|
|
2342
2302
|
}
|
|
2343
2303
|
};
|
|
2344
|
-
exports.binary = binary;
|
|
2345
2304
|
}));
|
|
2346
|
-
|
|
2347
2305
|
//#endregion
|
|
2348
2306
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/pairs.js
|
|
2349
2307
|
var require_pairs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2404,7 +2362,6 @@ var require_pairs = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2404
2362
|
exports.pairs = pairs;
|
|
2405
2363
|
exports.resolvePairs = resolvePairs;
|
|
2406
2364
|
}));
|
|
2407
|
-
|
|
2408
2365
|
//#endregion
|
|
2409
2366
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/omap.js
|
|
2410
2367
|
var require_omap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2468,7 +2425,6 @@ var require_omap = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2468
2425
|
exports.YAMLOMap = YAMLOMap;
|
|
2469
2426
|
exports.omap = omap;
|
|
2470
2427
|
}));
|
|
2471
|
-
|
|
2472
2428
|
//#endregion
|
|
2473
2429
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/bool.js
|
|
2474
2430
|
var require_bool = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2496,7 +2452,6 @@ var require_bool = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2496
2452
|
exports.falseTag = falseTag;
|
|
2497
2453
|
exports.trueTag = trueTag;
|
|
2498
2454
|
}));
|
|
2499
|
-
|
|
2500
2455
|
//#endregion
|
|
2501
2456
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/float.js
|
|
2502
2457
|
var require_float = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2522,7 +2477,7 @@ var require_float = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2522
2477
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
2523
2478
|
}
|
|
2524
2479
|
};
|
|
2525
|
-
|
|
2480
|
+
exports.float = {
|
|
2526
2481
|
identify: (value) => typeof value === "number",
|
|
2527
2482
|
default: true,
|
|
2528
2483
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -2538,11 +2493,9 @@ var require_float = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2538
2493
|
},
|
|
2539
2494
|
stringify: stringifyNumber.stringifyNumber
|
|
2540
2495
|
};
|
|
2541
|
-
exports.float = float;
|
|
2542
2496
|
exports.floatExp = floatExp;
|
|
2543
2497
|
exports.floatNaN = floatNaN;
|
|
2544
2498
|
}));
|
|
2545
|
-
|
|
2546
2499
|
//#endregion
|
|
2547
2500
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/int.js
|
|
2548
2501
|
var require_int = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2618,7 +2571,6 @@ var require_int = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2618
2571
|
exports.intHex = intHex;
|
|
2619
2572
|
exports.intOct = intOct;
|
|
2620
2573
|
}));
|
|
2621
|
-
|
|
2622
2574
|
//#endregion
|
|
2623
2575
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/set.js
|
|
2624
2576
|
var require_set = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2687,7 +2639,6 @@ var require_set = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2687
2639
|
exports.YAMLSet = YAMLSet;
|
|
2688
2640
|
exports.set = set;
|
|
2689
2641
|
}));
|
|
2690
|
-
|
|
2691
2642
|
//#endregion
|
|
2692
2643
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js
|
|
2693
2644
|
var require_timestamp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2771,7 +2722,6 @@ var require_timestamp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
|
|
|
2771
2722
|
exports.intTime = intTime;
|
|
2772
2723
|
exports.timestamp = timestamp;
|
|
2773
2724
|
}));
|
|
2774
|
-
|
|
2775
2725
|
//#endregion
|
|
2776
2726
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/yaml-1.1/schema.js
|
|
2777
2727
|
var require_schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2788,7 +2738,7 @@ var require_schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2788
2738
|
var pairs = require_pairs();
|
|
2789
2739
|
var set = require_set();
|
|
2790
2740
|
var timestamp = require_timestamp();
|
|
2791
|
-
|
|
2741
|
+
exports.schema = [
|
|
2792
2742
|
map.map,
|
|
2793
2743
|
seq.seq,
|
|
2794
2744
|
string.string,
|
|
@@ -2811,9 +2761,7 @@ var require_schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2811
2761
|
timestamp.floatTime,
|
|
2812
2762
|
timestamp.timestamp
|
|
2813
2763
|
];
|
|
2814
|
-
exports.schema = schema;
|
|
2815
2764
|
}));
|
|
2816
|
-
|
|
2817
2765
|
//#endregion
|
|
2818
2766
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/tags.js
|
|
2819
2767
|
var require_tags = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2898,7 +2846,6 @@ var require_tags = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2898
2846
|
exports.coreKnownTags = coreKnownTags;
|
|
2899
2847
|
exports.getTags = getTags;
|
|
2900
2848
|
}));
|
|
2901
|
-
|
|
2902
2849
|
//#endregion
|
|
2903
2850
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/schema/Schema.js
|
|
2904
2851
|
var require_Schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2908,7 +2855,7 @@ var require_Schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2908
2855
|
var string = require_string();
|
|
2909
2856
|
var tags = require_tags();
|
|
2910
2857
|
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
2911
|
-
|
|
2858
|
+
exports.Schema = class Schema {
|
|
2912
2859
|
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
2913
2860
|
this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
|
|
2914
2861
|
this.name = typeof schema === "string" && schema || "core";
|
|
@@ -2926,9 +2873,7 @@ var require_Schema = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
2926
2873
|
return copy;
|
|
2927
2874
|
}
|
|
2928
2875
|
};
|
|
2929
|
-
exports.Schema = Schema;
|
|
2930
2876
|
}));
|
|
2931
|
-
|
|
2932
2877
|
//#endregion
|
|
2933
2878
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyDocument.js
|
|
2934
2879
|
var require_stringifyDocument = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -2990,7 +2935,6 @@ var require_stringifyDocument = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
2990
2935
|
}
|
|
2991
2936
|
exports.stringifyDocument = stringifyDocument;
|
|
2992
2937
|
}));
|
|
2993
|
-
|
|
2994
2938
|
//#endregion
|
|
2995
2939
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/doc/Document.js
|
|
2996
2940
|
var require_Document = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3272,7 +3216,6 @@ var require_Document = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
3272
3216
|
}
|
|
3273
3217
|
exports.Document = Document;
|
|
3274
3218
|
}));
|
|
3275
|
-
|
|
3276
3219
|
//#endregion
|
|
3277
3220
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/errors.js
|
|
3278
3221
|
var require_errors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3326,7 +3269,6 @@ var require_errors = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
3326
3269
|
exports.YAMLWarning = YAMLWarning;
|
|
3327
3270
|
exports.prettifyError = prettifyError;
|
|
3328
3271
|
}));
|
|
3329
|
-
|
|
3330
3272
|
//#endregion
|
|
3331
3273
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-props.js
|
|
3332
3274
|
var require_resolve_props = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3434,7 +3376,6 @@ var require_resolve_props = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
3434
3376
|
}
|
|
3435
3377
|
exports.resolveProps = resolveProps;
|
|
3436
3378
|
}));
|
|
3437
|
-
|
|
3438
3379
|
//#endregion
|
|
3439
3380
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-contains-newline.js
|
|
3440
3381
|
var require_util_contains_newline = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3464,7 +3405,6 @@ var require_util_contains_newline = /* @__PURE__ */ require_chunk.__commonJSMin(
|
|
|
3464
3405
|
}
|
|
3465
3406
|
exports.containsNewline = containsNewline;
|
|
3466
3407
|
}));
|
|
3467
|
-
|
|
3468
3408
|
//#endregion
|
|
3469
3409
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-flow-indent-check.js
|
|
3470
3410
|
var require_util_flow_indent_check = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3477,7 +3417,6 @@ var require_util_flow_indent_check = /* @__PURE__ */ require_chunk.__commonJSMin
|
|
|
3477
3417
|
}
|
|
3478
3418
|
exports.flowIndentCheck = flowIndentCheck;
|
|
3479
3419
|
}));
|
|
3480
|
-
|
|
3481
3420
|
//#endregion
|
|
3482
3421
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-map-includes.js
|
|
3483
3422
|
var require_util_map_includes = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3490,7 +3429,6 @@ var require_util_map_includes = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
3490
3429
|
}
|
|
3491
3430
|
exports.mapIncludes = mapIncludes;
|
|
3492
3431
|
}));
|
|
3493
|
-
|
|
3494
3432
|
//#endregion
|
|
3495
3433
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-map.js
|
|
3496
3434
|
var require_resolve_block_map = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3575,7 +3513,6 @@ var require_resolve_block_map = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
3575
3513
|
}
|
|
3576
3514
|
exports.resolveBlockMap = resolveBlockMap;
|
|
3577
3515
|
}));
|
|
3578
|
-
|
|
3579
3516
|
//#endregion
|
|
3580
3517
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-seq.js
|
|
3581
3518
|
var require_resolve_block_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3618,7 +3555,6 @@ var require_resolve_block_seq = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
|
|
|
3618
3555
|
}
|
|
3619
3556
|
exports.resolveBlockSeq = resolveBlockSeq;
|
|
3620
3557
|
}));
|
|
3621
|
-
|
|
3622
3558
|
//#endregion
|
|
3623
3559
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-end.js
|
|
3624
3560
|
var require_resolve_end = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3657,7 +3593,6 @@ var require_resolve_end = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
3657
3593
|
}
|
|
3658
3594
|
exports.resolveEnd = resolveEnd;
|
|
3659
3595
|
}));
|
|
3660
|
-
|
|
3661
3596
|
//#endregion
|
|
3662
3597
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-collection.js
|
|
3663
3598
|
var require_resolve_flow_collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3813,7 +3748,6 @@ var require_resolve_flow_collection = /* @__PURE__ */ require_chunk.__commonJSMi
|
|
|
3813
3748
|
}
|
|
3814
3749
|
exports.resolveFlowCollection = resolveFlowCollection;
|
|
3815
3750
|
}));
|
|
3816
|
-
|
|
3817
3751
|
//#endregion
|
|
3818
3752
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-collection.js
|
|
3819
3753
|
var require_compose_collection = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -3866,7 +3800,6 @@ var require_compose_collection = /* @__PURE__ */ require_chunk.__commonJSMin(((e
|
|
|
3866
3800
|
}
|
|
3867
3801
|
exports.composeCollection = composeCollection;
|
|
3868
3802
|
}));
|
|
3869
|
-
|
|
3870
3803
|
//#endregion
|
|
3871
3804
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-block-scalar.js
|
|
3872
3805
|
var require_resolve_block_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4042,7 +3975,6 @@ var require_resolve_block_scalar = /* @__PURE__ */ require_chunk.__commonJSMin((
|
|
|
4042
3975
|
}
|
|
4043
3976
|
exports.resolveBlockScalar = resolveBlockScalar;
|
|
4044
3977
|
}));
|
|
4045
|
-
|
|
4046
3978
|
//#endregion
|
|
4047
3979
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/resolve-flow-scalar.js
|
|
4048
3980
|
var require_resolve_flow_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4249,7 +4181,6 @@ var require_resolve_flow_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((
|
|
|
4249
4181
|
}
|
|
4250
4182
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
4251
4183
|
}));
|
|
4252
|
-
|
|
4253
4184
|
//#endregion
|
|
4254
4185
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-scalar.js
|
|
4255
4186
|
var require_compose_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4309,7 +4240,6 @@ var require_compose_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
|
|
|
4309
4240
|
}
|
|
4310
4241
|
exports.composeScalar = composeScalar;
|
|
4311
4242
|
}));
|
|
4312
|
-
|
|
4313
4243
|
//#endregion
|
|
4314
4244
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/util-empty-scalar-position.js
|
|
4315
4245
|
var require_util_empty_scalar_position = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4337,7 +4267,6 @@ var require_util_empty_scalar_position = /* @__PURE__ */ require_chunk.__commonJ
|
|
|
4337
4267
|
}
|
|
4338
4268
|
exports.emptyScalarPosition = emptyScalarPosition;
|
|
4339
4269
|
}));
|
|
4340
|
-
|
|
4341
4270
|
//#endregion
|
|
4342
4271
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-node.js
|
|
4343
4272
|
var require_compose_node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4423,7 +4352,6 @@ var require_compose_node = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
|
|
|
4423
4352
|
exports.composeEmptyNode = composeEmptyNode;
|
|
4424
4353
|
exports.composeNode = composeNode;
|
|
4425
4354
|
}));
|
|
4426
|
-
|
|
4427
4355
|
//#endregion
|
|
4428
4356
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/compose-doc.js
|
|
4429
4357
|
var require_compose_doc = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4466,7 +4394,6 @@ var require_compose_doc = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
4466
4394
|
}
|
|
4467
4395
|
exports.composeDoc = composeDoc;
|
|
4468
4396
|
}));
|
|
4469
|
-
|
|
4470
4397
|
//#endregion
|
|
4471
4398
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/compose/composer.js
|
|
4472
4399
|
var require_composer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4665,7 +4592,6 @@ var require_composer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =>
|
|
|
4665
4592
|
};
|
|
4666
4593
|
exports.Composer = Composer;
|
|
4667
4594
|
}));
|
|
4668
|
-
|
|
4669
4595
|
//#endregion
|
|
4670
4596
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-scalar.js
|
|
4671
4597
|
var require_cst_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4933,7 +4859,6 @@ var require_cst_scalar = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
4933
4859
|
exports.resolveAsScalar = resolveAsScalar;
|
|
4934
4860
|
exports.setScalarValue = setScalarValue;
|
|
4935
4861
|
}));
|
|
4936
|
-
|
|
4937
4862
|
//#endregion
|
|
4938
4863
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-stringify.js
|
|
4939
4864
|
var require_cst_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -4985,7 +4910,6 @@ var require_cst_stringify = /* @__PURE__ */ require_chunk.__commonJSMin(((export
|
|
|
4985
4910
|
}
|
|
4986
4911
|
exports.stringify = stringify;
|
|
4987
4912
|
}));
|
|
4988
|
-
|
|
4989
4913
|
//#endregion
|
|
4990
4914
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst-visit.js
|
|
4991
4915
|
var require_cst_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5077,7 +5001,6 @@ var require_cst_visit = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) =
|
|
|
5077
5001
|
}
|
|
5078
5002
|
exports.visit = visit;
|
|
5079
5003
|
}));
|
|
5080
|
-
|
|
5081
5004
|
//#endregion
|
|
5082
5005
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/cst.js
|
|
5083
5006
|
var require_cst = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5157,7 +5080,6 @@ var require_cst = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
5157
5080
|
exports.prettyToken = prettyToken;
|
|
5158
5081
|
exports.tokenType = tokenType;
|
|
5159
5082
|
}));
|
|
5160
|
-
|
|
5161
5083
|
//#endregion
|
|
5162
5084
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/lexer.js
|
|
5163
5085
|
var require_lexer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5677,7 +5599,6 @@ var require_lexer = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
5677
5599
|
};
|
|
5678
5600
|
exports.Lexer = Lexer;
|
|
5679
5601
|
}));
|
|
5680
|
-
|
|
5681
5602
|
//#endregion
|
|
5682
5603
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/line-counter.js
|
|
5683
5604
|
var require_line_counter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -5725,7 +5646,6 @@ var require_line_counter = /* @__PURE__ */ require_chunk.__commonJSMin(((exports
|
|
|
5725
5646
|
};
|
|
5726
5647
|
exports.LineCounter = LineCounter;
|
|
5727
5648
|
}));
|
|
5728
|
-
|
|
5729
5649
|
//#endregion
|
|
5730
5650
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/parse/parser.js
|
|
5731
5651
|
var require_parser = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -6582,7 +6502,6 @@ var require_parser = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
6582
6502
|
};
|
|
6583
6503
|
exports.Parser = Parser;
|
|
6584
6504
|
}));
|
|
6585
|
-
|
|
6586
6505
|
//#endregion
|
|
6587
6506
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/public-api.js
|
|
6588
6507
|
var require_public_api = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -6670,7 +6589,6 @@ var require_public_api = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
|
|
|
6670
6589
|
exports.parseDocument = parseDocument;
|
|
6671
6590
|
exports.stringify = stringify;
|
|
6672
6591
|
}));
|
|
6673
|
-
|
|
6674
6592
|
//#endregion
|
|
6675
6593
|
//#region ../../node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/dist/index.js
|
|
6676
6594
|
var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
@@ -6684,7 +6602,7 @@ var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
6684
6602
|
var Scalar = require_Scalar();
|
|
6685
6603
|
var YAMLMap = require_YAMLMap();
|
|
6686
6604
|
var YAMLSeq = require_YAMLSeq();
|
|
6687
|
-
|
|
6605
|
+
require_cst();
|
|
6688
6606
|
var lexer = require_lexer();
|
|
6689
6607
|
var lineCounter = require_line_counter();
|
|
6690
6608
|
var parser = require_parser();
|
|
@@ -6719,7 +6637,6 @@ var require_dist = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
|
|
|
6719
6637
|
exports.visit = visit.visit;
|
|
6720
6638
|
exports.visitAsync = visit.visitAsync;
|
|
6721
6639
|
}));
|
|
6722
|
-
|
|
6723
6640
|
//#endregion
|
|
6724
6641
|
//#region src/highlight.ts
|
|
6725
6642
|
var import_dist = /* @__PURE__ */ require_chunk.__toESM(require_dist(), 1);
|
|
@@ -6752,15 +6669,23 @@ const BUILTIN_LANGS = [
|
|
|
6752
6669
|
"diff",
|
|
6753
6670
|
"toml"
|
|
6754
6671
|
];
|
|
6755
|
-
|
|
6672
|
+
const highlighterCache = /* @__PURE__ */ new Map();
|
|
6756
6673
|
/**
|
|
6757
6674
|
* Get or create the Shiki highlighter.
|
|
6758
6675
|
*/
|
|
6759
6676
|
async function getHighlighter(theme, customLangs = []) {
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
langs:
|
|
6677
|
+
const cacheKey = JSON.stringify({
|
|
6678
|
+
theme,
|
|
6679
|
+
langs: customLangs
|
|
6763
6680
|
});
|
|
6681
|
+
let highlighterPromise = highlighterCache.get(cacheKey);
|
|
6682
|
+
if (!highlighterPromise) {
|
|
6683
|
+
highlighterPromise = (0, shiki.createHighlighter)({
|
|
6684
|
+
themes: [theme],
|
|
6685
|
+
langs: [...BUILTIN_LANGS, ...customLangs]
|
|
6686
|
+
});
|
|
6687
|
+
highlighterCache.set(cacheKey, highlighterPromise);
|
|
6688
|
+
}
|
|
6764
6689
|
return highlighterPromise;
|
|
6765
6690
|
}
|
|
6766
6691
|
/**
|
|
@@ -6776,12 +6701,9 @@ function rehypeShikiHighlight(options) {
|
|
|
6776
6701
|
if (child.type === "element" && child.tagName === "pre") {
|
|
6777
6702
|
const codeElement = child.children.find((c) => c.type === "element" && c.tagName === "code");
|
|
6778
6703
|
if (codeElement) {
|
|
6779
|
-
const className = codeElement.properties?.className;
|
|
6780
6704
|
let lang = "text";
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
if (langClass && typeof langClass === "string") lang = langClass.replace("language-", "");
|
|
6784
|
-
}
|
|
6705
|
+
const langClass = normalizeClassName(codeElement.properties?.className).find((value) => value.startsWith("language-"));
|
|
6706
|
+
if (langClass) lang = langClass.replace("language-", "");
|
|
6785
6707
|
const codeText = getTextContent(codeElement);
|
|
6786
6708
|
try {
|
|
6787
6709
|
const highlighted = highlighter.codeToHtml(codeText, {
|
|
@@ -6789,7 +6711,12 @@ function rehypeShikiHighlight(options) {
|
|
|
6789
6711
|
theme
|
|
6790
6712
|
});
|
|
6791
6713
|
const parsed = (0, unified.unified)().use(rehype_parse.default, { fragment: true }).parse(highlighted);
|
|
6792
|
-
if (parsed.children[0]
|
|
6714
|
+
if (parsed.children[0]?.type === "element") {
|
|
6715
|
+
const highlightedPre = parsed.children[0];
|
|
6716
|
+
highlightedPre.properties ??= {};
|
|
6717
|
+
highlightedPre.properties["data-language"] = lang;
|
|
6718
|
+
node.children[i] = highlightedPre;
|
|
6719
|
+
}
|
|
6793
6720
|
} catch {}
|
|
6794
6721
|
}
|
|
6795
6722
|
} else if (child.type === "element") await visit(child);
|
|
@@ -6809,6 +6736,11 @@ function getTextContent(node) {
|
|
|
6809
6736
|
}
|
|
6810
6737
|
return text;
|
|
6811
6738
|
}
|
|
6739
|
+
function normalizeClassName(className) {
|
|
6740
|
+
if (Array.isArray(className)) return className.filter((value) => typeof value === "string");
|
|
6741
|
+
if (typeof className === "string" && className) return className.split(/\s+/).filter(Boolean);
|
|
6742
|
+
return [];
|
|
6743
|
+
}
|
|
6812
6744
|
/**
|
|
6813
6745
|
* Apply syntax highlighting to HTML using Shiki.
|
|
6814
6746
|
*/
|
|
@@ -6819,7 +6751,6 @@ async function highlightCode(html, theme = "github-dark", langs = []) {
|
|
|
6819
6751
|
}).use(rehype_stringify.default).process(html);
|
|
6820
6752
|
return String(result);
|
|
6821
6753
|
}
|
|
6822
|
-
|
|
6823
6754
|
//#endregion
|
|
6824
6755
|
//#region src/plugins/mermaid-protect.ts
|
|
6825
6756
|
/**
|
|
@@ -6872,7 +6803,6 @@ function restoreMermaidSvgs(html, svgs) {
|
|
|
6872
6803
|
for (const [placeholder, content] of svgs) result = result.replace(placeholder, content);
|
|
6873
6804
|
return result;
|
|
6874
6805
|
}
|
|
6875
|
-
|
|
6876
6806
|
//#endregion
|
|
6877
6807
|
//#region src/transform.ts
|
|
6878
6808
|
/**
|
|
@@ -6960,7 +6890,7 @@ async function loadNapiBindings() {
|
|
|
6960
6890
|
if (napiLoadAttempted) return napiBindings ?? null;
|
|
6961
6891
|
napiLoadAttempted = true;
|
|
6962
6892
|
try {
|
|
6963
|
-
const mod = await
|
|
6893
|
+
const mod = await require_mermaid.importNapiModule();
|
|
6964
6894
|
napiBindings = mod;
|
|
6965
6895
|
return mod;
|
|
6966
6896
|
} catch (error) {
|
|
@@ -6982,7 +6912,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
6982
6912
|
tocMaxDepth: options.tocMaxDepth,
|
|
6983
6913
|
convertMdLinks: ssgOptions?.convertMdLinks,
|
|
6984
6914
|
baseUrl: ssgOptions?.baseUrl,
|
|
6985
|
-
sourcePath: ssgOptions?.sourcePath ?? filePath
|
|
6915
|
+
sourcePath: ssgOptions?.sourcePath ?? filePath,
|
|
6916
|
+
codeAnnotations: options.codeAnnotations.enabled,
|
|
6917
|
+
codeAnnotationMetaKey: options.codeAnnotations.metaKey,
|
|
6918
|
+
codeAnnotationSyntax: options.codeAnnotations.notation,
|
|
6919
|
+
codeAnnotationDefaultLineNumbers: options.codeAnnotations.defaultLineNumbers
|
|
6986
6920
|
});
|
|
6987
6921
|
if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
|
|
6988
6922
|
let html = result.html;
|
|
@@ -6994,7 +6928,11 @@ async function transformMarkdown(source, filePath, options, ssgOptions) {
|
|
|
6994
6928
|
if (options.mermaid) html = await require_mermaid.transformMermaidStatic(html);
|
|
6995
6929
|
const { html: protectedHtml, svgs } = protectMermaidSvgs(html);
|
|
6996
6930
|
html = protectedHtml;
|
|
6997
|
-
if (options.highlight)
|
|
6931
|
+
if (options.highlight) {
|
|
6932
|
+
const originalHtml = html;
|
|
6933
|
+
const highlightedHtml = await highlightCode(html, options.highlightTheme, options.highlightLangs);
|
|
6934
|
+
html = napi.mergeHighlightedCodeBlocks(originalHtml, highlightedHtml);
|
|
6935
|
+
}
|
|
6998
6936
|
html = restoreMermaidSvgs(html, svgs);
|
|
6999
6937
|
return {
|
|
7000
6938
|
code: generateModuleCode(html, frontmatter, toc, filePath, options),
|
|
@@ -7090,7 +7028,6 @@ if (import.meta.hot) {
|
|
|
7090
7028
|
}
|
|
7091
7029
|
`;
|
|
7092
7030
|
}
|
|
7093
|
-
|
|
7094
7031
|
//#endregion
|
|
7095
7032
|
//#region src/nav-generator.ts
|
|
7096
7033
|
/**
|
|
@@ -7237,7 +7174,7 @@ function generateNavMetadata(docs, basePath = "/api") {
|
|
|
7237
7174
|
* @internal
|
|
7238
7175
|
*/
|
|
7239
7176
|
function getDocDisplayName(filePath) {
|
|
7240
|
-
const fileName = path
|
|
7177
|
+
const fileName = path.default.basename(filePath, path.default.extname(filePath));
|
|
7241
7178
|
if (fileName === "index" || fileName === "index-module") return "Overview";
|
|
7242
7179
|
return fileName.replace(/[-_]([a-z])/g, (_, char) => " " + char.toUpperCase()).replace(/^[a-z]/, (char) => char.toUpperCase());
|
|
7243
7180
|
}
|
|
@@ -7254,7 +7191,7 @@ function getDocDisplayName(filePath) {
|
|
|
7254
7191
|
* @internal
|
|
7255
7192
|
*/
|
|
7256
7193
|
function getDocFileName(filePath) {
|
|
7257
|
-
const fileName = path
|
|
7194
|
+
const fileName = path.default.basename(filePath, path.default.extname(filePath));
|
|
7258
7195
|
if (fileName === "index") return "index";
|
|
7259
7196
|
return fileName;
|
|
7260
7197
|
}
|
|
@@ -7329,7 +7266,6 @@ export interface NavItem {
|
|
|
7329
7266
|
export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as const;
|
|
7330
7267
|
`;
|
|
7331
7268
|
}
|
|
7332
|
-
|
|
7333
7269
|
//#endregion
|
|
7334
7270
|
//#region src/docs.ts
|
|
7335
7271
|
/**
|
|
@@ -7383,6 +7319,46 @@ export const ${exportName}: NavItem[] = ${JSON.stringify(navItems, null, 2)} as
|
|
|
7383
7319
|
* ```
|
|
7384
7320
|
*/
|
|
7385
7321
|
const DOCS_MANIFEST_FILE = ".ox-content-docs-manifest.json";
|
|
7322
|
+
const DOCS_DATA_FILE = "docs.json";
|
|
7323
|
+
function escapeHtml$3(str) {
|
|
7324
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7325
|
+
}
|
|
7326
|
+
function entryAnchor(name) {
|
|
7327
|
+
return name.toLowerCase();
|
|
7328
|
+
}
|
|
7329
|
+
function cleanSummaryText(text, maxLength = 120) {
|
|
7330
|
+
if (!text) return "";
|
|
7331
|
+
const collapsed = text.replace(/\s+/g, " ").trim();
|
|
7332
|
+
if (collapsed.length <= maxLength) return collapsed;
|
|
7333
|
+
return `${collapsed.slice(0, maxLength - 1).trimEnd()}…`;
|
|
7334
|
+
}
|
|
7335
|
+
function renderInlineHtml(text) {
|
|
7336
|
+
let html = "";
|
|
7337
|
+
let lastIndex = 0;
|
|
7338
|
+
const tokenPattern = /`([^`]+)`|\[([^\]]+)\]\(([^)]+)\)/g;
|
|
7339
|
+
let match;
|
|
7340
|
+
while ((match = tokenPattern.exec(text)) !== null) {
|
|
7341
|
+
html += escapeHtml$3(text.slice(lastIndex, match.index));
|
|
7342
|
+
if (match[1]) html += `<code>${escapeHtml$3(match[1])}</code>`;
|
|
7343
|
+
else if (match[2] && match[3]) html += `<a href="${escapeHtml$3(match[3])}">${escapeHtml$3(match[2])}</a>`;
|
|
7344
|
+
lastIndex = match.index + match[0].length;
|
|
7345
|
+
}
|
|
7346
|
+
html += escapeHtml$3(text.slice(lastIndex));
|
|
7347
|
+
return html.replace(/\n/g, "<br>");
|
|
7348
|
+
}
|
|
7349
|
+
function renderParagraphsHtml(text) {
|
|
7350
|
+
return text.split(/\n\s*\n/).map((paragraph) => paragraph.trim()).filter(Boolean).map((paragraph) => `<p>${renderInlineHtml(paragraph)}</p>`).join("\n");
|
|
7351
|
+
}
|
|
7352
|
+
function renderCodeBlockHtml(code, language = "typescript") {
|
|
7353
|
+
return `<pre><code class="language-${language}">${escapeHtml$3(code)}</code></pre>`;
|
|
7354
|
+
}
|
|
7355
|
+
function buildDocsData(docs) {
|
|
7356
|
+
return {
|
|
7357
|
+
version: 1,
|
|
7358
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7359
|
+
modules: docs
|
|
7360
|
+
};
|
|
7361
|
+
}
|
|
7386
7362
|
/**
|
|
7387
7363
|
* Regex pattern for matching JSDoc comment blocks.
|
|
7388
7364
|
*
|
|
@@ -7487,7 +7463,7 @@ async function findFiles(dir, options) {
|
|
|
7487
7463
|
return;
|
|
7488
7464
|
}
|
|
7489
7465
|
for (const entry of entries) {
|
|
7490
|
-
const fullPath = path
|
|
7466
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
7491
7467
|
if (entry.isDirectory()) {
|
|
7492
7468
|
if (!isExcluded(fullPath, options.exclude)) await walk(fullPath);
|
|
7493
7469
|
} else if (entry.isFile()) {
|
|
@@ -7743,7 +7719,7 @@ function generateMarkdown(docs, options) {
|
|
|
7743
7719
|
if (options.groupBy === "file") {
|
|
7744
7720
|
const docToFile = /* @__PURE__ */ new Map();
|
|
7745
7721
|
for (const doc of docs) {
|
|
7746
|
-
let fileName = path
|
|
7722
|
+
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7747
7723
|
if (fileName === "index") fileName = "index-module";
|
|
7748
7724
|
docToFile.set(doc, fileName);
|
|
7749
7725
|
const markdown = generateFileMarkdown(doc, options, fileName, symbolMap);
|
|
@@ -7763,74 +7739,132 @@ function generateMarkdown(docs, options) {
|
|
|
7763
7739
|
return result;
|
|
7764
7740
|
}
|
|
7765
7741
|
function generateFileMarkdown(doc, options, currentFileName, symbolMap) {
|
|
7766
|
-
let md = `# ${path
|
|
7742
|
+
let md = `# ${path.basename(doc.file)}\n\n`;
|
|
7767
7743
|
if (options.githubUrl) {
|
|
7768
7744
|
const sourceLink = generateSourceLink(doc.file, options.githubUrl);
|
|
7769
7745
|
if (sourceLink) md += sourceLink + "\n\n";
|
|
7770
7746
|
}
|
|
7747
|
+
md += `> ${doc.entries.length} documented symbol${doc.entries.length === 1 ? "" : "s"}. `;
|
|
7748
|
+
md += "Skim the one-line surface first, then expand the accordions for details.\n\n";
|
|
7749
|
+
md += "## Overview\n\n";
|
|
7750
|
+
for (const entry of doc.entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
|
|
7751
|
+
md += "\n## Reference\n\n";
|
|
7771
7752
|
for (const entry of doc.entries) md += generateEntryMarkdown(entry, options, currentFileName, symbolMap);
|
|
7772
7753
|
return md;
|
|
7773
7754
|
}
|
|
7755
|
+
function normalizeSignature(signature) {
|
|
7756
|
+
if (!signature) return;
|
|
7757
|
+
return signature.replace(/\s+/g, " ").replace(/^export\s+/, "").replace(/^async\s+function\s+/, "").replace(/^function\s+/, "").replace(/^class\s+/, "").trim();
|
|
7758
|
+
}
|
|
7759
|
+
function renderOverviewLine(entry, href) {
|
|
7760
|
+
const signature = normalizeSignature(entry.signature);
|
|
7761
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7762
|
+
const parts = [`- [\`${entry.name}\`](${href})`, `\`${entry.kind}\``];
|
|
7763
|
+
if (signature) parts.push(`\`${signature}\``);
|
|
7764
|
+
if (summary) parts.push(`- ${summary}`);
|
|
7765
|
+
return `${parts.join(" ")}\n`;
|
|
7766
|
+
}
|
|
7767
|
+
function renderOverviewHtmlItem(entry, href) {
|
|
7768
|
+
const signature = normalizeSignature(entry.signature);
|
|
7769
|
+
const summary = cleanSummaryText(entry.description, 88);
|
|
7770
|
+
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>`];
|
|
7771
|
+
if (signature) fragments.push(`<code>${escapeHtml$3(signature)}</code>`);
|
|
7772
|
+
if (summary) fragments.push(`<span>${renderInlineHtml(summary)}</span>`);
|
|
7773
|
+
return `<li>${fragments.join("")}</li>`;
|
|
7774
|
+
}
|
|
7775
|
+
function renderParamsTableHtml(params) {
|
|
7776
|
+
return `<div class="ox-api-entry__section">
|
|
7777
|
+
<h4>Parameters</h4>
|
|
7778
|
+
<table>
|
|
7779
|
+
<thead>
|
|
7780
|
+
<tr><th>Name</th><th>Type</th><th>Description</th></tr>
|
|
7781
|
+
</thead>
|
|
7782
|
+
<tbody>
|
|
7783
|
+
${params.map((param) => {
|
|
7784
|
+
const flags = [param.optional ? "optional" : "", param.default ? `default: ${param.default}` : ""].filter(Boolean);
|
|
7785
|
+
const description = [param.description, flags.join(" · ")].filter(Boolean).join(" — ");
|
|
7786
|
+
return `<tr>
|
|
7787
|
+
<td><code>${escapeHtml$3(param.name)}</code></td>
|
|
7788
|
+
<td><code>${escapeHtml$3(param.type)}</code></td>
|
|
7789
|
+
<td>${renderInlineHtml(description)}</td>
|
|
7790
|
+
</tr>`;
|
|
7791
|
+
}).join("\n")}
|
|
7792
|
+
</tbody>
|
|
7793
|
+
</table>
|
|
7794
|
+
</div>`;
|
|
7795
|
+
}
|
|
7796
|
+
function renderTagListHtml(tags) {
|
|
7797
|
+
return `<div class="ox-api-entry__section">
|
|
7798
|
+
<h4>Tags</h4>
|
|
7799
|
+
<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>
|
|
7800
|
+
</div>`;
|
|
7801
|
+
}
|
|
7774
7802
|
function generateEntryMarkdown(entry, options, currentFileName, symbolMap) {
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
}
|
|
7781
|
-
if (
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
md += entry.signature + "\n";
|
|
7788
|
-
md += "```\n\n";
|
|
7789
|
-
}
|
|
7790
|
-
if (entry.params && entry.params.length > 0) {
|
|
7791
|
-
md += "### Parameters\n\n";
|
|
7792
|
-
md += "| Name | Type | Description |\n";
|
|
7793
|
-
md += "|------|------|-------------|\n";
|
|
7794
|
-
for (const param of entry.params) md += `| \`${param.name}\` | \`${param.type}\` | ${param.description} |\n`;
|
|
7795
|
-
md += "\n";
|
|
7796
|
-
}
|
|
7797
|
-
if (entry.returns) {
|
|
7798
|
-
md += "### Returns\n\n";
|
|
7799
|
-
md += `\`${entry.returns.type}\` - ${entry.returns.description}\n\n`;
|
|
7800
|
-
}
|
|
7803
|
+
const processedDescription = entry.description && currentFileName && symbolMap ? convertSymbolLinks(entry.description, currentFileName, symbolMap) : entry.description;
|
|
7804
|
+
const summarySignature = normalizeSignature(entry.signature);
|
|
7805
|
+
const sourceHref = options?.githubUrl ? generateSourceHref(entry.file, options.githubUrl, entry.line) : void 0;
|
|
7806
|
+
let body = "";
|
|
7807
|
+
if (processedDescription) body += renderParagraphsHtml(processedDescription) + "\n";
|
|
7808
|
+
if (sourceHref) body += `<p class="ox-api-entry__source"><a href="${escapeHtml$3(sourceHref)}">View source</a></p>\n`;
|
|
7809
|
+
if (entry.signature) body += `<div class="ox-api-entry__section">\n<h4>Signature</h4>\n${renderCodeBlockHtml(entry.signature)}\n</div>\n`;
|
|
7810
|
+
if (entry.params && entry.params.length > 0) body += renderParamsTableHtml(entry.params) + "\n";
|
|
7811
|
+
if (entry.returns) body += `<div class="ox-api-entry__section">
|
|
7812
|
+
<h4>Returns</h4>
|
|
7813
|
+
<p><code>${escapeHtml$3(entry.returns.type)}</code>${entry.returns.description ? ` — ${renderInlineHtml(entry.returns.description)}` : ""}</p>
|
|
7814
|
+
</div>\n`;
|
|
7801
7815
|
if (entry.examples && entry.examples.length > 0) {
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
}
|
|
7809
|
-
|
|
7810
|
-
return
|
|
7816
|
+
const examplesHtml = entry.examples.map((example) => example.replace(/^```\w*\n?/, "").replace(/\n?```$/, "")).map((example) => renderCodeBlockHtml(example, "ts")).join("\n");
|
|
7817
|
+
body += `<div class="ox-api-entry__section">\n<h4>Examples</h4>\n${examplesHtml}\n</div>\n`;
|
|
7818
|
+
}
|
|
7819
|
+
if (entry.tags && Object.keys(entry.tags).length > 0) body += renderTagListHtml(entry.tags) + "\n";
|
|
7820
|
+
const summaryDescription = cleanSummaryText(processedDescription, summarySignature ? 80 : 120);
|
|
7821
|
+
const summaryParts = [`<span class="ox-api-entry__kind">${escapeHtml$3(entry.kind)}</span>`, `<code class="ox-api-entry__name">${escapeHtml$3(entry.name)}</code>`];
|
|
7822
|
+
if (summarySignature) summaryParts.push(`<code class="ox-api-entry__signature">${escapeHtml$3(summarySignature)}</code>`);
|
|
7823
|
+
if (summaryDescription) summaryParts.push(`<span class="ox-api-entry__description">${renderInlineHtml(summaryDescription)}</span>`);
|
|
7824
|
+
return `<details id="${entryAnchor(entry.name)}" class="ox-api-entry">
|
|
7825
|
+
<summary>${summaryParts.join("")}</summary>
|
|
7826
|
+
<div class="ox-api-entry__body">
|
|
7827
|
+
${body.trim()}
|
|
7828
|
+
</div>
|
|
7829
|
+
</details>
|
|
7830
|
+
|
|
7831
|
+
`;
|
|
7811
7832
|
}
|
|
7812
7833
|
function generateIndex(docs, docToFile) {
|
|
7813
7834
|
let md = "# API Documentation\n\n";
|
|
7814
7835
|
md += "Generated by [Ox Content](https://github.com/ubugeeei/ox-content)\n\n";
|
|
7836
|
+
md += "> Use search scopes like `@api transform` to limit results to the generated API reference.\n\n";
|
|
7815
7837
|
md += "## Modules\n\n";
|
|
7816
7838
|
for (const doc of docs) {
|
|
7817
|
-
const displayName = path
|
|
7839
|
+
const displayName = path.basename(doc.file, path.extname(doc.file));
|
|
7818
7840
|
let fileName = displayName;
|
|
7819
7841
|
if (docToFile && docToFile.has(doc)) fileName = docToFile.get(doc);
|
|
7820
7842
|
else if (fileName === "index") fileName = "index-module";
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7843
|
+
const countLabel = `${doc.entries.length} symbol${doc.entries.length === 1 ? "" : "s"}`;
|
|
7844
|
+
md += `<details class="ox-api-module">
|
|
7845
|
+
<summary>
|
|
7846
|
+
<span class="ox-api-module__title"><a href="./${fileName}.md">${escapeHtml$3(displayName)}</a></span>
|
|
7847
|
+
<span class="ox-api-module__count">${countLabel}</span>
|
|
7848
|
+
</summary>
|
|
7849
|
+
<div class="ox-api-module__body">
|
|
7850
|
+
<ul class="ox-api-module__list">
|
|
7851
|
+
`;
|
|
7852
|
+
for (const entry of doc.entries) md += ` ${renderOverviewHtmlItem(entry, `./${fileName}.md#${entryAnchor(entry.name)}`)}\n`;
|
|
7853
|
+
md += ` </ul>
|
|
7854
|
+
</div>
|
|
7855
|
+
</details>
|
|
7856
|
+
|
|
7857
|
+
`;
|
|
7828
7858
|
}
|
|
7829
7859
|
return md;
|
|
7830
7860
|
}
|
|
7831
7861
|
function generateCategoryMarkdown(kind, entries, options, symbolMap) {
|
|
7832
7862
|
const categoryFileName = `${kind}s`;
|
|
7833
7863
|
let md = `# ${kind.charAt(0).toUpperCase() + kind.slice(1)}s\n\n`;
|
|
7864
|
+
md += `> ${entries.length} documented ${kind}${entries.length === 1 ? "" : "s"} collected across modules.\n\n`;
|
|
7865
|
+
md += "## Overview\n\n";
|
|
7866
|
+
for (const entry of entries) md += renderOverviewLine(entry, `#${entryAnchor(entry.name)}`);
|
|
7867
|
+
md += "\n## Reference\n\n";
|
|
7834
7868
|
for (const entry of entries) md += generateEntryMarkdown(entry, options, categoryFileName, symbolMap);
|
|
7835
7869
|
return md;
|
|
7836
7870
|
}
|
|
@@ -7840,10 +7874,8 @@ function generateCategoryIndex(byKind) {
|
|
|
7840
7874
|
for (const [kind, entries] of byKind) {
|
|
7841
7875
|
const kindTitle = kind.charAt(0).toUpperCase() + kind.slice(1) + "s";
|
|
7842
7876
|
md += `## [${kindTitle}](./${kind}s.md)\n\n`;
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
md += `- **${entry.name}** - ${desc}...\n`;
|
|
7846
|
-
}
|
|
7877
|
+
md += `> ${entries.length} item${entries.length === 1 ? "" : "s"}.\n\n`;
|
|
7878
|
+
for (const entry of entries) md += renderOverviewLine(entry, `./${kind}s.md#${entryAnchor(entry.name)}`);
|
|
7847
7879
|
md += "\n";
|
|
7848
7880
|
}
|
|
7849
7881
|
return md;
|
|
@@ -7884,7 +7916,7 @@ function convertSymbolLinks(text, currentFileName, symbolMap) {
|
|
|
7884
7916
|
function buildSymbolMap(docs) {
|
|
7885
7917
|
const map = /* @__PURE__ */ new Map();
|
|
7886
7918
|
for (const doc of docs) {
|
|
7887
|
-
let fileName = path
|
|
7919
|
+
let fileName = path.basename(doc.file, path.extname(doc.file));
|
|
7888
7920
|
if (fileName === "index") fileName = "index-module";
|
|
7889
7921
|
for (const entry of doc.entries) map.set(entry.name, {
|
|
7890
7922
|
name: entry.name,
|
|
@@ -7901,7 +7933,8 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7901
7933
|
await fs.promises.mkdir(outDir, { recursive: true });
|
|
7902
7934
|
const generatedFiles = new Set(Object.keys(docs));
|
|
7903
7935
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") generatedFiles.add("nav.ts");
|
|
7904
|
-
|
|
7936
|
+
if (extractedDocs) generatedFiles.add(DOCS_DATA_FILE);
|
|
7937
|
+
const manifestPath = path.join(outDir, DOCS_MANIFEST_FILE);
|
|
7905
7938
|
let previousFiles = [];
|
|
7906
7939
|
try {
|
|
7907
7940
|
previousFiles = JSON.parse(await fs.promises.readFile(manifestPath, "utf-8"));
|
|
@@ -7910,17 +7943,18 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7910
7943
|
}
|
|
7911
7944
|
for (const staleFile of previousFiles) {
|
|
7912
7945
|
if (generatedFiles.has(staleFile)) continue;
|
|
7913
|
-
await fs.promises.rm(path
|
|
7946
|
+
await fs.promises.rm(path.join(outDir, staleFile), { force: true });
|
|
7914
7947
|
}
|
|
7915
7948
|
for (const [fileName, content] of Object.entries(docs)) {
|
|
7916
|
-
const filePath = path
|
|
7949
|
+
const filePath = path.join(outDir, fileName);
|
|
7917
7950
|
await fs.promises.writeFile(filePath, content, "utf-8");
|
|
7918
7951
|
}
|
|
7919
7952
|
if (extractedDocs && options?.generateNav && options.groupBy === "file") {
|
|
7920
7953
|
const navCode = generateNavCode(generateNavMetadata(extractedDocs, "/api"), "apiNav");
|
|
7921
|
-
const navFilePath = path
|
|
7954
|
+
const navFilePath = path.join(outDir, "nav.ts");
|
|
7922
7955
|
await fs.promises.writeFile(navFilePath, navCode, "utf-8");
|
|
7923
7956
|
}
|
|
7957
|
+
if (extractedDocs) await fs.promises.writeFile(path.join(outDir, DOCS_DATA_FILE), JSON.stringify(buildDocsData(extractedDocs), null, 2), "utf-8");
|
|
7924
7958
|
await fs.promises.writeFile(manifestPath, JSON.stringify([...generatedFiles].sort(), null, 2), "utf-8");
|
|
7925
7959
|
}
|
|
7926
7960
|
/**
|
|
@@ -7932,10 +7966,13 @@ async function writeDocs(docs, outDir, extractedDocs, options) {
|
|
|
7932
7966
|
* @param filePath - Full path to the source file
|
|
7933
7967
|
* @param githubUrl - Base GitHub repository URL
|
|
7934
7968
|
* @param lineNumber - Optional line number to link to
|
|
7935
|
-
* @returns
|
|
7969
|
+
* @returns Absolute GitHub URL to source code
|
|
7936
7970
|
*/
|
|
7971
|
+
function generateSourceHref(filePath, githubUrl, lineNumber) {
|
|
7972
|
+
return `${githubUrl}/blob/main/${filePath.replace(/^.*?\/(npm|packages|crates|src)\//, "$1/")}${lineNumber ? `#L${lineNumber}` : ""}`;
|
|
7973
|
+
}
|
|
7937
7974
|
function generateSourceLink(filePath, githubUrl, lineNumber) {
|
|
7938
|
-
return `**[Source](${
|
|
7975
|
+
return `**[Source](${generateSourceHref(filePath, githubUrl, lineNumber)})**`;
|
|
7939
7976
|
}
|
|
7940
7977
|
function resolveDocsOptions(options) {
|
|
7941
7978
|
if (options === false) return false;
|
|
@@ -7958,7 +7995,6 @@ function resolveDocsOptions(options) {
|
|
|
7958
7995
|
generateNav: opts.generateNav ?? true
|
|
7959
7996
|
};
|
|
7960
7997
|
}
|
|
7961
|
-
|
|
7962
7998
|
//#endregion
|
|
7963
7999
|
//#region src/og-image/renderer.ts
|
|
7964
8000
|
/**
|
|
@@ -8003,10 +8039,10 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8003
8039
|
await route.continue();
|
|
8004
8040
|
return;
|
|
8005
8041
|
}
|
|
8006
|
-
const filePath = path
|
|
8042
|
+
const filePath = path.join(publicDir, url.pathname);
|
|
8007
8043
|
try {
|
|
8008
8044
|
const body = await fs.readFile(filePath);
|
|
8009
|
-
const ext = path
|
|
8045
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
8010
8046
|
await route.fulfill({
|
|
8011
8047
|
body,
|
|
8012
8048
|
contentType: {
|
|
@@ -8041,7 +8077,6 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
|
|
|
8041
8077
|
});
|
|
8042
8078
|
return Buffer.from(screenshot);
|
|
8043
8079
|
}
|
|
8044
|
-
|
|
8045
8080
|
//#endregion
|
|
8046
8081
|
//#region src/og-image/browser.ts
|
|
8047
8082
|
/**
|
|
@@ -8087,7 +8122,6 @@ async function openBrowser() {
|
|
|
8087
8122
|
return null;
|
|
8088
8123
|
}
|
|
8089
8124
|
}
|
|
8090
|
-
|
|
8091
8125
|
//#endregion
|
|
8092
8126
|
//#region src/og-image/template.ts
|
|
8093
8127
|
/**
|
|
@@ -8117,7 +8151,6 @@ function getDefaultTemplate() {
|
|
|
8117
8151
|
</div>`;
|
|
8118
8152
|
};
|
|
8119
8153
|
}
|
|
8120
|
-
|
|
8121
8154
|
//#endregion
|
|
8122
8155
|
//#region src/og-image/cache.ts
|
|
8123
8156
|
/**
|
|
@@ -8143,7 +8176,7 @@ function computeCacheKey(templateSource, props, width, height) {
|
|
|
8143
8176
|
* Returns the cached file path if found, null otherwise.
|
|
8144
8177
|
*/
|
|
8145
8178
|
async function getCached(cacheDir, key) {
|
|
8146
|
-
const filePath = path
|
|
8179
|
+
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8147
8180
|
try {
|
|
8148
8181
|
return await fs_promises.readFile(filePath);
|
|
8149
8182
|
} catch {
|
|
@@ -8155,12 +8188,11 @@ async function getCached(cacheDir, key) {
|
|
|
8155
8188
|
*/
|
|
8156
8189
|
async function writeCache(cacheDir, key, png) {
|
|
8157
8190
|
await fs_promises.mkdir(cacheDir, { recursive: true });
|
|
8158
|
-
const filePath = path
|
|
8191
|
+
const filePath = path.join(cacheDir, `${key}.png`);
|
|
8159
8192
|
await fs_promises.writeFile(filePath, png);
|
|
8160
8193
|
}
|
|
8161
|
-
|
|
8162
8194
|
//#endregion
|
|
8163
|
-
//#region \0@oxc-project+runtime@0.
|
|
8195
|
+
//#region \0@oxc-project+runtime@0.115.0/helpers/usingCtx.js
|
|
8164
8196
|
function _usingCtx() {
|
|
8165
8197
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
8166
8198
|
var n = Error();
|
|
@@ -8215,7 +8247,6 @@ function _usingCtx() {
|
|
|
8215
8247
|
}
|
|
8216
8248
|
};
|
|
8217
8249
|
}
|
|
8218
|
-
|
|
8219
8250
|
//#endregion
|
|
8220
8251
|
//#region src/og-image/index.ts
|
|
8221
8252
|
/**
|
|
@@ -8248,14 +8279,14 @@ function resolveOgImageOptions(options) {
|
|
|
8248
8279
|
*/
|
|
8249
8280
|
async function resolveTemplate(options, root) {
|
|
8250
8281
|
if (!options.template) return getDefaultTemplate();
|
|
8251
|
-
const templatePath = path
|
|
8282
|
+
const templatePath = path.resolve(root, options.template);
|
|
8252
8283
|
const fs = await import("fs/promises");
|
|
8253
8284
|
try {
|
|
8254
8285
|
await fs.access(templatePath);
|
|
8255
8286
|
} catch {
|
|
8256
8287
|
throw new Error(`[ox-content:og-image] Template file not found: ${templatePath}`);
|
|
8257
8288
|
}
|
|
8258
|
-
switch (path
|
|
8289
|
+
switch (path.extname(templatePath).toLowerCase()) {
|
|
8259
8290
|
case ".vue": return resolveVueTemplate(templatePath, options, root);
|
|
8260
8291
|
case ".svelte": return resolveSvelteTemplate(templatePath, root);
|
|
8261
8292
|
case ".tsx":
|
|
@@ -8269,9 +8300,9 @@ async function resolveTemplate(options, root) {
|
|
|
8269
8300
|
async function resolveTsTemplate(templatePath, options, root) {
|
|
8270
8301
|
const fs = await import("fs/promises");
|
|
8271
8302
|
const { rolldown } = await import("rolldown");
|
|
8272
|
-
const cacheDir = path
|
|
8303
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8273
8304
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8274
|
-
const outfile = path
|
|
8305
|
+
const outfile = path.join(cacheDir, "_template.mjs");
|
|
8275
8306
|
const bundle = await rolldown({
|
|
8276
8307
|
input: templatePath,
|
|
8277
8308
|
platform: "node"
|
|
@@ -8294,9 +8325,9 @@ async function resolveTsTemplate(templatePath, options, root) {
|
|
|
8294
8325
|
async function resolveVueTemplate(templatePath, options, root) {
|
|
8295
8326
|
const fs = await import("fs/promises");
|
|
8296
8327
|
const { rolldown } = await import("rolldown");
|
|
8297
|
-
const cacheDir = path
|
|
8328
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8298
8329
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8299
|
-
const outfile = path
|
|
8330
|
+
const outfile = path.join(cacheDir, "_template_vue.mjs");
|
|
8300
8331
|
const bundle = await rolldown({
|
|
8301
8332
|
input: templatePath,
|
|
8302
8333
|
platform: "node",
|
|
@@ -8392,9 +8423,9 @@ async function getVizejsPlugin() {
|
|
|
8392
8423
|
async function resolveSvelteTemplate(templatePath, root) {
|
|
8393
8424
|
const fs = await import("fs/promises");
|
|
8394
8425
|
const { rolldown } = await import("rolldown");
|
|
8395
|
-
const cacheDir = path
|
|
8426
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8396
8427
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8397
|
-
const outfile = path
|
|
8428
|
+
const outfile = path.join(cacheDir, "_template_svelte.mjs");
|
|
8398
8429
|
const bundle = await rolldown({
|
|
8399
8430
|
input: templatePath,
|
|
8400
8431
|
platform: "node",
|
|
@@ -8450,9 +8481,9 @@ function createSvelteCompilerPlugin() {
|
|
|
8450
8481
|
async function resolveReactTemplate(templatePath, root) {
|
|
8451
8482
|
const fs = await import("fs/promises");
|
|
8452
8483
|
const { rolldown } = await import("rolldown");
|
|
8453
|
-
const cacheDir = path
|
|
8484
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8454
8485
|
await fs.mkdir(cacheDir, { recursive: true });
|
|
8455
|
-
const outfile = path
|
|
8486
|
+
const outfile = path.join(cacheDir, "_template_react.mjs");
|
|
8456
8487
|
const bundle = await rolldown({
|
|
8457
8488
|
input: templatePath,
|
|
8458
8489
|
platform: "node",
|
|
@@ -8502,7 +8533,7 @@ async function resolveReactTemplate(templatePath, root) {
|
|
|
8502
8533
|
async function computeTemplateSource(options, root) {
|
|
8503
8534
|
if (!options.template) return "__default__";
|
|
8504
8535
|
const fs = await import("fs/promises");
|
|
8505
|
-
const templatePath = path
|
|
8536
|
+
const templatePath = path.resolve(root, options.template);
|
|
8506
8537
|
const content = await fs.readFile(templatePath, "utf-8");
|
|
8507
8538
|
return crypto.createHash("sha256").update(content).digest("hex");
|
|
8508
8539
|
}
|
|
@@ -8520,7 +8551,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8520
8551
|
if (pages.length === 0) return [];
|
|
8521
8552
|
const templateFn = await resolveTemplate(options, root);
|
|
8522
8553
|
const templateSource = await computeTemplateSource(options, root);
|
|
8523
|
-
const cacheDir = path
|
|
8554
|
+
const cacheDir = path.join(root, ".cache", "og-images");
|
|
8524
8555
|
if (options.cache) {
|
|
8525
8556
|
const allCached = await tryServeAllFromCache(pages, templateSource, options, cacheDir);
|
|
8526
8557
|
if (allCached) return allCached;
|
|
@@ -8532,7 +8563,7 @@ async function generateOgImages(pages, options, root) {
|
|
|
8532
8563
|
error: "Chromium not available"
|
|
8533
8564
|
}));
|
|
8534
8565
|
const results = [];
|
|
8535
|
-
const publicDir = path
|
|
8566
|
+
const publicDir = path.join(root, "public");
|
|
8536
8567
|
const concurrency = Math.max(1, options.concurrency);
|
|
8537
8568
|
for (let i = 0; i < pages.length; i += concurrency) {
|
|
8538
8569
|
const batch = pages.slice(i, i + concurrency);
|
|
@@ -8556,7 +8587,7 @@ async function tryServeAllFromCache(pages, templateSource, options, cacheDir) {
|
|
|
8556
8587
|
for (const entry of pages) {
|
|
8557
8588
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8558
8589
|
if (!cached) return null;
|
|
8559
|
-
await fs.mkdir(path
|
|
8590
|
+
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8560
8591
|
await fs.writeFile(entry.outputPath, cached);
|
|
8561
8592
|
results.push({
|
|
8562
8593
|
outputPath: entry.outputPath,
|
|
@@ -8574,7 +8605,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8574
8605
|
if (options.cache) {
|
|
8575
8606
|
const cached = await getCached(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height));
|
|
8576
8607
|
if (cached) {
|
|
8577
|
-
await fs.mkdir(path
|
|
8608
|
+
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8578
8609
|
await fs.writeFile(entry.outputPath, cached);
|
|
8579
8610
|
return {
|
|
8580
8611
|
outputPath: entry.outputPath,
|
|
@@ -8584,7 +8615,7 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8584
8615
|
}
|
|
8585
8616
|
const html = await templateFn(entry.props);
|
|
8586
8617
|
const png = await session.renderPage(html, options.width, options.height, publicDir);
|
|
8587
|
-
await fs.mkdir(path
|
|
8618
|
+
await fs.mkdir(path.dirname(entry.outputPath), { recursive: true });
|
|
8588
8619
|
await fs.writeFile(entry.outputPath, png);
|
|
8589
8620
|
if (options.cache) await writeCache(cacheDir, computeCacheKey(templateSource, entry.props, options.width, options.height), png);
|
|
8590
8621
|
return {
|
|
@@ -8599,7 +8630,6 @@ async function renderSinglePage(entry, templateFn, templateSource, options, cach
|
|
|
8599
8630
|
};
|
|
8600
8631
|
}
|
|
8601
8632
|
}
|
|
8602
|
-
|
|
8603
8633
|
//#endregion
|
|
8604
8634
|
//#region src/plugins/index.ts
|
|
8605
8635
|
/**
|
|
@@ -8609,28 +8639,27 @@ async function transformAllPlugins(html, options = {}) {
|
|
|
8609
8639
|
const { tabs = true, youtube = true, github = true, ogp = true, mermaid = true, githubToken } = options;
|
|
8610
8640
|
let result = html;
|
|
8611
8641
|
if (tabs) {
|
|
8612
|
-
const { transformTabs } = await Promise.resolve().then(() => require("./tabs.cjs"));
|
|
8642
|
+
const { transformTabs } = await Promise.resolve().then(() => require("./tabs.cjs")).then((n) => n.tabs_exports);
|
|
8613
8643
|
result = await transformTabs(result);
|
|
8614
8644
|
}
|
|
8615
8645
|
if (youtube) {
|
|
8616
|
-
const { transformYouTube } = await Promise.resolve().then(() => require("./youtube.cjs"));
|
|
8646
|
+
const { transformYouTube } = await Promise.resolve().then(() => require("./youtube.cjs")).then((n) => n.youtube_exports);
|
|
8617
8647
|
result = await transformYouTube(result);
|
|
8618
8648
|
}
|
|
8619
8649
|
if (github) {
|
|
8620
|
-
const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs"));
|
|
8650
|
+
const { transformGitHub } = await Promise.resolve().then(() => require("./github.cjs")).then((n) => n.github_exports);
|
|
8621
8651
|
result = await transformGitHub(result, void 0, { token: githubToken });
|
|
8622
8652
|
}
|
|
8623
8653
|
if (ogp) {
|
|
8624
|
-
const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs"));
|
|
8654
|
+
const { transformOgp } = await Promise.resolve().then(() => require("./ogp.cjs")).then((n) => n.ogp_exports);
|
|
8625
8655
|
result = await transformOgp(result);
|
|
8626
8656
|
}
|
|
8627
8657
|
if (mermaid) {
|
|
8628
|
-
const { transformMermaidStatic } = await Promise.resolve().then(() => require("./mermaid.cjs"));
|
|
8658
|
+
const { transformMermaidStatic } = await Promise.resolve().then(() => require("./mermaid.cjs")).then((n) => n.mermaid_exports);
|
|
8629
8659
|
result = await transformMermaidStatic(result);
|
|
8630
8660
|
}
|
|
8631
8661
|
return result;
|
|
8632
8662
|
}
|
|
8633
|
-
|
|
8634
8663
|
//#endregion
|
|
8635
8664
|
//#region src/island/parse.ts
|
|
8636
8665
|
/**
|
|
@@ -8822,7 +8851,6 @@ initIslands((el, props) => {
|
|
|
8822
8851
|
});
|
|
8823
8852
|
`;
|
|
8824
8853
|
}
|
|
8825
|
-
|
|
8826
8854
|
//#endregion
|
|
8827
8855
|
//#region src/theme.ts
|
|
8828
8856
|
/**
|
|
@@ -9005,7 +9033,6 @@ function themeToNapi(theme) {
|
|
|
9005
9033
|
js: theme.js || void 0
|
|
9006
9034
|
};
|
|
9007
9035
|
}
|
|
9008
|
-
|
|
9009
9036
|
//#endregion
|
|
9010
9037
|
//#region src/ssg.ts
|
|
9011
9038
|
/**
|
|
@@ -9048,6 +9075,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9048
9075
|
--color-primary-hover: #ce5937;
|
|
9049
9076
|
--color-code-bg: #1e293b;
|
|
9050
9077
|
--color-code-text: #e2e8f0;
|
|
9078
|
+
--color-code-line-highlight: rgba(56, 189, 248, 0.16);
|
|
9079
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.18);
|
|
9080
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9081
|
+
--color-code-line-error: rgba(239, 68, 68, 0.18);
|
|
9082
|
+
--color-code-line-error-border: #ef4444;
|
|
9051
9083
|
}
|
|
9052
9084
|
[data-theme="dark"] {
|
|
9053
9085
|
--color-bg: #141414;
|
|
@@ -9059,6 +9091,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9059
9091
|
--color-primary-hover: #d4845f;
|
|
9060
9092
|
--color-code-bg: #1a1a1a;
|
|
9061
9093
|
--color-code-text: #e5e5e5;
|
|
9094
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9095
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9096
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9097
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9098
|
+
--color-code-line-error-border: #f87171;
|
|
9062
9099
|
}
|
|
9063
9100
|
@media (prefers-color-scheme: dark) {
|
|
9064
9101
|
:root:not([data-theme="light"]) {
|
|
@@ -9071,6 +9108,11 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9071
9108
|
--color-primary-hover: #d4845f;
|
|
9072
9109
|
--color-code-bg: #1a1a1a;
|
|
9073
9110
|
--color-code-text: #e5e5e5;
|
|
9111
|
+
--color-code-line-highlight: rgba(14, 165, 233, 0.2);
|
|
9112
|
+
--color-code-line-warning: rgba(245, 158, 11, 0.2);
|
|
9113
|
+
--color-code-line-warning-border: #f59e0b;
|
|
9114
|
+
--color-code-line-error: rgba(239, 68, 68, 0.22);
|
|
9115
|
+
--color-code-line-error-border: #f87171;
|
|
9074
9116
|
}
|
|
9075
9117
|
}
|
|
9076
9118
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
@@ -9371,6 +9413,25 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9371
9413
|
padding: 0;
|
|
9372
9414
|
font-size: 0.8125rem;
|
|
9373
9415
|
}
|
|
9416
|
+
.content pre.ox-code-block code {
|
|
9417
|
+
display: block;
|
|
9418
|
+
}
|
|
9419
|
+
.content pre.ox-code-block .line {
|
|
9420
|
+
display: block;
|
|
9421
|
+
margin: 0 -1.25rem;
|
|
9422
|
+
padding: 0 1.25rem;
|
|
9423
|
+
}
|
|
9424
|
+
.content pre.ox-code-block .ox-code-line--highlight {
|
|
9425
|
+
background: var(--color-code-line-highlight);
|
|
9426
|
+
}
|
|
9427
|
+
.content pre.ox-code-block .ox-code-line--warning {
|
|
9428
|
+
background: var(--color-code-line-warning);
|
|
9429
|
+
box-shadow: inset 3px 0 0 var(--color-code-line-warning-border);
|
|
9430
|
+
}
|
|
9431
|
+
.content pre.ox-code-block .ox-code-line--error {
|
|
9432
|
+
background: var(--color-code-line-error);
|
|
9433
|
+
box-shadow: inset 3px 0 0 var(--color-code-line-error-border);
|
|
9434
|
+
}
|
|
9374
9435
|
.content table {
|
|
9375
9436
|
width: 100%;
|
|
9376
9437
|
border-collapse: collapse;
|
|
@@ -9414,6 +9475,10 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9414
9475
|
overflow-x: auto;
|
|
9415
9476
|
-webkit-overflow-scrolling: touch;
|
|
9416
9477
|
}
|
|
9478
|
+
.content pre.ox-code-block .line {
|
|
9479
|
+
margin: 0 -0.75rem;
|
|
9480
|
+
padding: 0 0.75rem;
|
|
9481
|
+
}
|
|
9417
9482
|
.content code { font-size: 0.8125em; }
|
|
9418
9483
|
.content table {
|
|
9419
9484
|
display: block;
|
|
@@ -9587,6 +9652,39 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9587
9652
|
}
|
|
9588
9653
|
};
|
|
9589
9654
|
|
|
9655
|
+
const parseScopedQuery = (query) => {
|
|
9656
|
+
const scopes = [];
|
|
9657
|
+
const terms = [];
|
|
9658
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
9659
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
9660
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
9661
|
+
} else {
|
|
9662
|
+
terms.push(part);
|
|
9663
|
+
}
|
|
9664
|
+
}
|
|
9665
|
+
return { text: terms.join(' ').trim(), scopes: [...new Set(scopes)] };
|
|
9666
|
+
};
|
|
9667
|
+
|
|
9668
|
+
const getScopesForDoc = (doc) => {
|
|
9669
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
9670
|
+
const segments = source.split('/').filter(Boolean);
|
|
9671
|
+
if (segments.length <= 1) return [];
|
|
9672
|
+
|
|
9673
|
+
const scopes = [];
|
|
9674
|
+
let current = '';
|
|
9675
|
+
for (const segment of segments.slice(0, -1)) {
|
|
9676
|
+
current = current ? current + '/' + segment : segment;
|
|
9677
|
+
scopes.push(current);
|
|
9678
|
+
}
|
|
9679
|
+
return scopes;
|
|
9680
|
+
};
|
|
9681
|
+
|
|
9682
|
+
const matchesScopes = (doc, scopes) => {
|
|
9683
|
+
if (!scopes.length) return true;
|
|
9684
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
9685
|
+
return scopes.some((scope) => docScopes.has(scope));
|
|
9686
|
+
};
|
|
9687
|
+
|
|
9590
9688
|
// Tokenize query
|
|
9591
9689
|
const tokenize = (text) => {
|
|
9592
9690
|
const tokens = [];
|
|
@@ -9609,27 +9707,31 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9609
9707
|
|
|
9610
9708
|
// Perform search
|
|
9611
9709
|
const performSearch = async (query) => {
|
|
9612
|
-
if (!query.trim()) {
|
|
9613
|
-
searchResults.innerHTML = '';
|
|
9614
|
-
results = [];
|
|
9615
|
-
return;
|
|
9616
|
-
}
|
|
9617
9710
|
await loadSearchIndex();
|
|
9618
9711
|
if (!searchIndex) {
|
|
9619
9712
|
searchResults.innerHTML = '<div class="search-empty">Search index not available</div>';
|
|
9620
9713
|
return;
|
|
9621
9714
|
}
|
|
9622
9715
|
|
|
9623
|
-
const
|
|
9624
|
-
if (!
|
|
9716
|
+
const parsedQuery = parseScopedQuery(query);
|
|
9717
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
9625
9718
|
searchResults.innerHTML = '';
|
|
9626
9719
|
results = [];
|
|
9627
9720
|
return;
|
|
9628
9721
|
}
|
|
9629
9722
|
|
|
9723
|
+
const tokens = tokenize(parsedQuery.text);
|
|
9630
9724
|
const k1 = 1.2, b = 0.75;
|
|
9631
9725
|
const docScores = new Map();
|
|
9632
9726
|
|
|
9727
|
+
if (!tokens.length) {
|
|
9728
|
+
searchIndex.documents.forEach((doc, docIdx) => {
|
|
9729
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
9730
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
9731
|
+
}
|
|
9732
|
+
});
|
|
9733
|
+
}
|
|
9734
|
+
|
|
9633
9735
|
for (let i = 0; i < tokens.length; i++) {
|
|
9634
9736
|
const token = tokens[i];
|
|
9635
9737
|
const isLast = i === tokens.length - 1;
|
|
@@ -9648,6 +9750,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9648
9750
|
for (const posting of postings) {
|
|
9649
9751
|
const doc = searchIndex.documents[posting.doc_idx];
|
|
9650
9752
|
if (!doc) continue;
|
|
9753
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
9651
9754
|
const boost = posting.field === 'Title' ? 10 : posting.field === 'Heading' ? 5 : 1;
|
|
9652
9755
|
const tf = posting.tf;
|
|
9653
9756
|
const docLen = doc.body.length;
|
|
@@ -9666,6 +9769,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9666
9769
|
results = Array.from(docScores.entries())
|
|
9667
9770
|
.map(([docIdx, data]) => {
|
|
9668
9771
|
const doc = searchIndex.documents[docIdx];
|
|
9772
|
+
const scopes = getScopesForDoc(doc);
|
|
9669
9773
|
let snippet = '';
|
|
9670
9774
|
if (doc.body) {
|
|
9671
9775
|
const bodyLower = doc.body.toLowerCase();
|
|
@@ -9674,15 +9778,15 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9674
9778
|
const pos = bodyLower.indexOf(match);
|
|
9675
9779
|
if (pos !== -1 && (firstPos === -1 || pos < firstPos)) firstPos = pos;
|
|
9676
9780
|
}
|
|
9677
|
-
const start = Math.max(0, firstPos - 50);
|
|
9781
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
9678
9782
|
const end = Math.min(doc.body.length, start + 150);
|
|
9679
9783
|
snippet = doc.body.slice(start, end);
|
|
9680
9784
|
if (start > 0) snippet = '...' + snippet;
|
|
9681
9785
|
if (end < doc.body.length) snippet += '...';
|
|
9682
9786
|
}
|
|
9683
|
-
return { ...doc, score: data.score, snippet };
|
|
9787
|
+
return { ...doc, score: data.score, scopes, snippet };
|
|
9684
9788
|
})
|
|
9685
|
-
.sort((a, b) => b.score - a.score)
|
|
9789
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
9686
9790
|
.slice(0, 10);
|
|
9687
9791
|
|
|
9688
9792
|
selectedIndex = 0;
|
|
@@ -9696,7 +9800,7 @@ const DEFAULT_HTML_TEMPLATE = `<!DOCTYPE html>
|
|
|
9696
9800
|
}
|
|
9697
9801
|
searchResults.innerHTML = results.map((r, i) =>
|
|
9698
9802
|
'<a href="' + r.url + '" class="search-result' + (i === selectedIndex ? ' selected' : '') + '">' +
|
|
9699
|
-
'<div class="search-result-title">' + r.title + '</div>' +
|
|
9803
|
+
'<div class="search-result-title">' + r.title + (r.scopes?.length ? '<span class="search-result-scope">@' + r.scopes[0] + '</span>' : '') + '</div>' +
|
|
9700
9804
|
(r.snippet ? '<div class="search-result-snippet">' + r.snippet + '</div>' : '') +
|
|
9701
9805
|
'</a>'
|
|
9702
9806
|
).join('');
|
|
@@ -9827,7 +9931,7 @@ function generateBareHtmlPage(content, title) {
|
|
|
9827
9931
|
* Generates HTML page with navigation using Rust NAPI bindings.
|
|
9828
9932
|
*/
|
|
9829
9933
|
async function generateHtmlPage(pageData, navGroups, siteName, base, ogImage, theme) {
|
|
9830
|
-
const mod = await
|
|
9934
|
+
const mod = await require_mermaid.importNapiModule();
|
|
9831
9935
|
const tocForRust = pageData.toc.map((entry) => ({
|
|
9832
9936
|
depth: entry.depth,
|
|
9833
9937
|
text: entry.text,
|
|
@@ -9930,7 +10034,7 @@ function createSharedAssetChunk(type, label, content, outDir, base) {
|
|
|
9930
10034
|
const hash = createContentHash(content);
|
|
9931
10035
|
const fileName = `ox-content-${sanitizeChunkLabel(label)}-${hash}.${type}`;
|
|
9932
10036
|
return {
|
|
9933
|
-
outputPath: path
|
|
10037
|
+
outputPath: path.join(outDir, "assets", fileName),
|
|
9934
10038
|
publicPath: toPublicAssetPath(base, fileName),
|
|
9935
10039
|
content
|
|
9936
10040
|
};
|
|
@@ -10020,7 +10124,7 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10020
10124
|
});
|
|
10021
10125
|
const chunks = [...cssChunks.values(), ...jsChunks.values()];
|
|
10022
10126
|
await Promise.all(chunks.map(async (chunk) => {
|
|
10023
|
-
await fs_promises.mkdir(path
|
|
10127
|
+
await fs_promises.mkdir(path.dirname(chunk.outputPath), { recursive: true });
|
|
10024
10128
|
await fs_promises.writeFile(chunk.outputPath, chunk.content, "utf-8");
|
|
10025
10129
|
}));
|
|
10026
10130
|
return {
|
|
@@ -10032,16 +10136,16 @@ async function externalizeSharedPageAssets(pages, outDir, base) {
|
|
|
10032
10136
|
* Converts a markdown file path to its corresponding HTML output path.
|
|
10033
10137
|
*/
|
|
10034
10138
|
function getOutputPath(inputPath, srcDir, outDir, extension) {
|
|
10035
|
-
const baseName = path
|
|
10036
|
-
if (baseName.endsWith(`index${extension}`)) return path
|
|
10139
|
+
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, extension);
|
|
10140
|
+
if (baseName.endsWith(`index${extension}`)) return path.join(outDir, baseName);
|
|
10037
10141
|
const dirName = baseName.replace(new RegExp(`\\${extension}$`), "");
|
|
10038
|
-
return path
|
|
10142
|
+
return path.join(outDir, dirName, `index${extension}`);
|
|
10039
10143
|
}
|
|
10040
10144
|
/**
|
|
10041
10145
|
* Converts a markdown file path to a relative URL path.
|
|
10042
10146
|
*/
|
|
10043
10147
|
function getUrlPath$1(inputPath, srcDir) {
|
|
10044
|
-
const baseName = path
|
|
10148
|
+
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10045
10149
|
if (baseName === "index" || baseName.endsWith("/index")) return baseName.replace(/\/?index$/, "") || "/";
|
|
10046
10150
|
return baseName;
|
|
10047
10151
|
}
|
|
@@ -10057,12 +10161,12 @@ function getHref(inputPath, srcDir, base, extension) {
|
|
|
10057
10161
|
* Gets the OG image output path for a given markdown file.
|
|
10058
10162
|
*/
|
|
10059
10163
|
function getOgImagePath(inputPath, srcDir, outDir) {
|
|
10060
|
-
const baseName = path
|
|
10164
|
+
const baseName = path.relative(srcDir, inputPath).replace(/\.(?:md|markdown)$/i, "");
|
|
10061
10165
|
if (baseName === "index" || baseName.endsWith("/index")) {
|
|
10062
10166
|
const dirPath = baseName.replace(/\/?index$/, "") || "";
|
|
10063
|
-
return path
|
|
10167
|
+
return path.join(outDir, dirPath, "og-image.png");
|
|
10064
10168
|
}
|
|
10065
|
-
return path
|
|
10169
|
+
return path.join(outDir, baseName, "og-image.png");
|
|
10066
10170
|
}
|
|
10067
10171
|
/**
|
|
10068
10172
|
* Gets the OG image URL for use in meta tags.
|
|
@@ -10080,9 +10184,9 @@ function getOgImageUrl(inputPath, srcDir, base, siteUrl) {
|
|
|
10080
10184
|
* Gets display title from file path.
|
|
10081
10185
|
*/
|
|
10082
10186
|
function getDisplayTitle(filePath) {
|
|
10083
|
-
const fileName = path
|
|
10187
|
+
const fileName = path.basename(filePath, path.extname(filePath));
|
|
10084
10188
|
if (fileName === "index") {
|
|
10085
|
-
const dirName = path
|
|
10189
|
+
const dirName = path.basename(path.dirname(filePath));
|
|
10086
10190
|
if (dirName && dirName !== ".") return formatTitle(dirName);
|
|
10087
10191
|
return "Home";
|
|
10088
10192
|
}
|
|
@@ -10098,7 +10202,7 @@ function formatTitle(name) {
|
|
|
10098
10202
|
* Collects all markdown files from the source directory.
|
|
10099
10203
|
*/
|
|
10100
10204
|
async function collectMarkdownFiles$1(srcDir) {
|
|
10101
|
-
return (await (0, glob.glob)(path
|
|
10205
|
+
return (await (0, glob.glob)(path.join(srcDir, "**/*.{md,markdown}"), {
|
|
10102
10206
|
nodir: true,
|
|
10103
10207
|
ignore: [
|
|
10104
10208
|
"**/node_modules/**",
|
|
@@ -10119,7 +10223,7 @@ function buildNavItems(markdownFiles, srcDir, base, extension) {
|
|
|
10119
10223
|
"api"
|
|
10120
10224
|
];
|
|
10121
10225
|
for (const file of markdownFiles) {
|
|
10122
|
-
const parts = path
|
|
10226
|
+
const parts = path.relative(srcDir, file).split(path.sep);
|
|
10123
10227
|
let groupKey = "";
|
|
10124
10228
|
if (parts.length > 1) groupKey = parts[0];
|
|
10125
10229
|
if (!groups.has(groupKey)) groups.set(groupKey, []);
|
|
@@ -10168,8 +10272,8 @@ async function buildSsg(options, root) {
|
|
|
10168
10272
|
files: [],
|
|
10169
10273
|
errors: []
|
|
10170
10274
|
};
|
|
10171
|
-
const srcDir = path
|
|
10172
|
-
const outDir = path
|
|
10275
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10276
|
+
const outDir = path.resolve(root, options.outDir);
|
|
10173
10277
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10174
10278
|
const generatedFiles = [];
|
|
10175
10279
|
const generatedPages = [];
|
|
@@ -10184,7 +10288,7 @@ async function buildSsg(options, root) {
|
|
|
10184
10288
|
const navItems = buildNavItems(markdownFiles, srcDir, base, ssgOptions.extension);
|
|
10185
10289
|
let siteName = ssgOptions.siteName ?? "Documentation";
|
|
10186
10290
|
if (!ssgOptions.siteName) try {
|
|
10187
|
-
const pkgPath = path
|
|
10291
|
+
const pkgPath = path.join(root, "package.json");
|
|
10188
10292
|
const pkg = JSON.parse(await fs_promises.readFile(pkgPath, "utf-8"));
|
|
10189
10293
|
if (pkg.name) siteName = formatTitle(pkg.name);
|
|
10190
10294
|
} catch {}
|
|
@@ -10298,7 +10402,7 @@ async function buildSsg(options, root) {
|
|
|
10298
10402
|
const optimizedOutput = await externalizeSharedPageAssets(generatedPages, outDir, base);
|
|
10299
10403
|
generatedFiles.push(...optimizedOutput.assets);
|
|
10300
10404
|
for (const page of optimizedOutput.pages) {
|
|
10301
|
-
await fs_promises.mkdir(path
|
|
10405
|
+
await fs_promises.mkdir(path.dirname(page.outputPath), { recursive: true });
|
|
10302
10406
|
await fs_promises.writeFile(page.outputPath, page.html, "utf-8");
|
|
10303
10407
|
generatedFiles.push(page.outputPath);
|
|
10304
10408
|
}
|
|
@@ -10307,7 +10411,6 @@ async function buildSsg(options, root) {
|
|
|
10307
10411
|
errors
|
|
10308
10412
|
};
|
|
10309
10413
|
}
|
|
10310
|
-
|
|
10311
10414
|
//#endregion
|
|
10312
10415
|
//#region src/search.ts
|
|
10313
10416
|
/**
|
|
@@ -10318,7 +10421,7 @@ async function buildSsg(options, root) {
|
|
|
10318
10421
|
let oxContent$1 = null;
|
|
10319
10422
|
async function getOxContent() {
|
|
10320
10423
|
if (!oxContent$1) try {
|
|
10321
|
-
oxContent$1 = await
|
|
10424
|
+
oxContent$1 = await require_mermaid.importNapiModule();
|
|
10322
10425
|
} catch {
|
|
10323
10426
|
console.warn("[ox-content] Native bindings not available, search disabled");
|
|
10324
10427
|
return null;
|
|
@@ -10354,7 +10457,7 @@ async function collectMarkdownFiles(dir) {
|
|
|
10354
10457
|
try {
|
|
10355
10458
|
const entries = await fs_promises.readdir(currentDir, { withFileTypes: true });
|
|
10356
10459
|
for (const entry of entries) {
|
|
10357
|
-
const fullPath = path
|
|
10460
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
10358
10461
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") await walk(fullPath);
|
|
10359
10462
|
else if (entry.isFile() && entry.name.endsWith(".md")) files.push(fullPath);
|
|
10360
10463
|
}
|
|
@@ -10379,7 +10482,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10379
10482
|
const documents = [];
|
|
10380
10483
|
for (const file of files) try {
|
|
10381
10484
|
const content = await fs_promises.readFile(file, "utf-8");
|
|
10382
|
-
const relativePath = path
|
|
10485
|
+
const relativePath = path.relative(srcDir, file);
|
|
10383
10486
|
const url = base + relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10384
10487
|
const id = relativePath.replace(/\.md$/, "").replace(/\\/g, "/");
|
|
10385
10488
|
const extractSearchContent = napi.extractSearchContent;
|
|
@@ -10408,7 +10511,7 @@ async function buildSearchIndex(srcDir, base) {
|
|
|
10408
10511
|
* Writes the search index to a file.
|
|
10409
10512
|
*/
|
|
10410
10513
|
async function writeSearchIndex(indexJson, outDir) {
|
|
10411
|
-
const indexPath = path
|
|
10514
|
+
const indexPath = path.join(outDir, "search-index.json");
|
|
10412
10515
|
await fs_promises.mkdir(outDir, { recursive: true });
|
|
10413
10516
|
await fs_promises.writeFile(indexPath, indexJson, "utf-8");
|
|
10414
10517
|
}
|
|
@@ -10424,6 +10527,51 @@ const searchOptions = ${JSON.stringify(options)};
|
|
|
10424
10527
|
let searchIndex = null;
|
|
10425
10528
|
let indexPromise = null;
|
|
10426
10529
|
|
|
10530
|
+
function parseScopedQuery(query) {
|
|
10531
|
+
const scopes = [];
|
|
10532
|
+
const terms = [];
|
|
10533
|
+
|
|
10534
|
+
for (const part of query.trim().split(/\\s+/).filter(Boolean)) {
|
|
10535
|
+
if (part.startsWith('@') && part.length > 1) {
|
|
10536
|
+
scopes.push(part.slice(1).toLowerCase());
|
|
10537
|
+
} else {
|
|
10538
|
+
terms.push(part);
|
|
10539
|
+
}
|
|
10540
|
+
}
|
|
10541
|
+
|
|
10542
|
+
return {
|
|
10543
|
+
text: terms.join(' ').trim(),
|
|
10544
|
+
scopes: [...new Set(scopes)],
|
|
10545
|
+
};
|
|
10546
|
+
}
|
|
10547
|
+
|
|
10548
|
+
function getScopesForDoc(doc) {
|
|
10549
|
+
const source = (doc.id || doc.url || '').replace(/^\\/+/, '').toLowerCase();
|
|
10550
|
+
const segments = source.split('/').filter(Boolean);
|
|
10551
|
+
|
|
10552
|
+
if (segments.length <= 1) {
|
|
10553
|
+
return [];
|
|
10554
|
+
}
|
|
10555
|
+
|
|
10556
|
+
const scopes = [];
|
|
10557
|
+
let current = '';
|
|
10558
|
+
for (const segment of segments.slice(0, -1)) {
|
|
10559
|
+
current = current ? current + '/' + segment : segment;
|
|
10560
|
+
scopes.push(current);
|
|
10561
|
+
}
|
|
10562
|
+
|
|
10563
|
+
return scopes;
|
|
10564
|
+
}
|
|
10565
|
+
|
|
10566
|
+
function matchesScopes(doc, scopes) {
|
|
10567
|
+
if (!scopes.length) {
|
|
10568
|
+
return true;
|
|
10569
|
+
}
|
|
10570
|
+
|
|
10571
|
+
const docScopes = new Set(getScopesForDoc(doc));
|
|
10572
|
+
return scopes.some(scope => docScopes.has(scope));
|
|
10573
|
+
}
|
|
10574
|
+
|
|
10427
10575
|
// Tokenizer for queries
|
|
10428
10576
|
function tokenizeQuery(text) {
|
|
10429
10577
|
const tokens = [];
|
|
@@ -10491,22 +10639,32 @@ async function loadIndex() {
|
|
|
10491
10639
|
export async function search(query, options = {}) {
|
|
10492
10640
|
const index = await loadIndex();
|
|
10493
10641
|
|
|
10494
|
-
if (!index
|
|
10642
|
+
if (!index) {
|
|
10495
10643
|
return [];
|
|
10496
10644
|
}
|
|
10497
10645
|
|
|
10498
|
-
const
|
|
10499
|
-
const prefix = options.prefix ?? searchOptions.prefix;
|
|
10500
|
-
const tokens = tokenizeQuery(query);
|
|
10646
|
+
const parsedQuery = parseScopedQuery(query);
|
|
10501
10647
|
|
|
10502
|
-
if (
|
|
10648
|
+
if (!parsedQuery.text && parsedQuery.scopes.length === 0) {
|
|
10503
10649
|
return [];
|
|
10504
10650
|
}
|
|
10505
10651
|
|
|
10652
|
+
const limit = options.limit ?? searchOptions.limit;
|
|
10653
|
+
const prefix = options.prefix ?? searchOptions.prefix;
|
|
10654
|
+
const tokens = tokenizeQuery(parsedQuery.text);
|
|
10655
|
+
|
|
10506
10656
|
const k1 = 1.2;
|
|
10507
10657
|
const b = 0.75;
|
|
10508
10658
|
const docScores = new Map();
|
|
10509
10659
|
|
|
10660
|
+
if (tokens.length === 0) {
|
|
10661
|
+
index.documents.forEach((doc, docIdx) => {
|
|
10662
|
+
if (matchesScopes(doc, parsedQuery.scopes)) {
|
|
10663
|
+
docScores.set(docIdx, { score: 0, matches: new Set() });
|
|
10664
|
+
}
|
|
10665
|
+
});
|
|
10666
|
+
}
|
|
10667
|
+
|
|
10510
10668
|
for (let i = 0; i < tokens.length; i++) {
|
|
10511
10669
|
const token = tokens[i];
|
|
10512
10670
|
const isLast = i === tokens.length - 1;
|
|
@@ -10527,6 +10685,7 @@ export async function search(query, options = {}) {
|
|
|
10527
10685
|
for (const posting of postings) {
|
|
10528
10686
|
const doc = index.documents[posting.doc_idx];
|
|
10529
10687
|
if (!doc) continue;
|
|
10688
|
+
if (!matchesScopes(doc, parsedQuery.scopes)) continue;
|
|
10530
10689
|
|
|
10531
10690
|
const docLen = doc.body.length;
|
|
10532
10691
|
const tf = posting.tf;
|
|
@@ -10549,6 +10708,7 @@ export async function search(query, options = {}) {
|
|
|
10549
10708
|
.map(([docIdx, data]) => {
|
|
10550
10709
|
const doc = index.documents[docIdx];
|
|
10551
10710
|
const matches = Array.from(data.matches);
|
|
10711
|
+
const scopes = getScopesForDoc(doc);
|
|
10552
10712
|
|
|
10553
10713
|
// Generate snippet
|
|
10554
10714
|
let snippet = '';
|
|
@@ -10562,7 +10722,7 @@ export async function search(query, options = {}) {
|
|
|
10562
10722
|
}
|
|
10563
10723
|
}
|
|
10564
10724
|
|
|
10565
|
-
const start = Math.max(0, firstPos - 50);
|
|
10725
|
+
const start = firstPos === -1 ? 0 : Math.max(0, firstPos - 50);
|
|
10566
10726
|
const end = Math.min(doc.body.length, start + 150);
|
|
10567
10727
|
snippet = doc.body.slice(start, end);
|
|
10568
10728
|
if (start > 0) snippet = '...' + snippet;
|
|
@@ -10576,9 +10736,10 @@ export async function search(query, options = {}) {
|
|
|
10576
10736
|
score: data.score,
|
|
10577
10737
|
matches,
|
|
10578
10738
|
snippet,
|
|
10739
|
+
scopes,
|
|
10579
10740
|
};
|
|
10580
10741
|
})
|
|
10581
|
-
.sort((a, b) => b.score - a.score)
|
|
10742
|
+
.sort((a, b) => b.score - a.score || a.title.localeCompare(b.title))
|
|
10582
10743
|
.slice(0, limit);
|
|
10583
10744
|
|
|
10584
10745
|
return results;
|
|
@@ -10588,7 +10749,6 @@ export { searchOptions };
|
|
|
10588
10749
|
export default { search, searchOptions, loadIndex };
|
|
10589
10750
|
`;
|
|
10590
10751
|
}
|
|
10591
|
-
|
|
10592
10752
|
//#endregion
|
|
10593
10753
|
//#region src/dev-server.ts
|
|
10594
10754
|
/**
|
|
@@ -10653,12 +10813,12 @@ async function resolveMarkdownFile(url, srcDir) {
|
|
|
10653
10813
|
let relativePath;
|
|
10654
10814
|
if (pathname === "/") relativePath = "index.md";
|
|
10655
10815
|
else relativePath = pathname.slice(1) + ".md";
|
|
10656
|
-
const filePath = path
|
|
10816
|
+
const filePath = path.join(srcDir, relativePath);
|
|
10657
10817
|
try {
|
|
10658
10818
|
await fs_promises.access(filePath);
|
|
10659
10819
|
return filePath;
|
|
10660
10820
|
} catch {
|
|
10661
|
-
const indexPath = path
|
|
10821
|
+
const indexPath = path.join(srcDir, pathname === "/" ? "" : pathname.slice(1), "index.md");
|
|
10662
10822
|
try {
|
|
10663
10823
|
await fs_promises.access(indexPath);
|
|
10664
10824
|
return indexPath;
|
|
@@ -10702,7 +10862,7 @@ function invalidatePageCache(cache, filePath) {
|
|
|
10702
10862
|
async function resolveSiteName(options, root) {
|
|
10703
10863
|
if (options.ssg.siteName) return options.ssg.siteName;
|
|
10704
10864
|
try {
|
|
10705
|
-
const pkgPath = path
|
|
10865
|
+
const pkgPath = path.join(root, "package.json");
|
|
10706
10866
|
const pkg = JSON.parse(await fs_promises.readFile(pkgPath, "utf-8"));
|
|
10707
10867
|
if (pkg.name) return formatTitle(pkg.name);
|
|
10708
10868
|
} catch {}
|
|
@@ -10712,7 +10872,7 @@ async function resolveSiteName(options, root) {
|
|
|
10712
10872
|
* Render a single markdown page to full HTML.
|
|
10713
10873
|
*/
|
|
10714
10874
|
async function renderPage$1(filePath, options, navGroups, siteName, base, root) {
|
|
10715
|
-
const srcDir = path
|
|
10875
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10716
10876
|
require_tabs.resetTabGroupCounter();
|
|
10717
10877
|
resetIslandCounter();
|
|
10718
10878
|
const result = await transformMarkdown(await fs_promises.readFile(filePath, "utf-8"), filePath, options, {
|
|
@@ -10757,7 +10917,7 @@ async function renderPage$1(filePath, options, navGroups, siteName, base, root)
|
|
|
10757
10917
|
* Create the dev server middleware for SSG page serving.
|
|
10758
10918
|
*/
|
|
10759
10919
|
function createDevServerMiddleware(options, root, cache) {
|
|
10760
|
-
const srcDir = path
|
|
10920
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10761
10921
|
const base = options.base.endsWith("/") ? options.base : options.base + "/";
|
|
10762
10922
|
return async (req, res, next) => {
|
|
10763
10923
|
const url = req.url;
|
|
@@ -10789,7 +10949,6 @@ function createDevServerMiddleware(options, root, cache) {
|
|
|
10789
10949
|
}
|
|
10790
10950
|
};
|
|
10791
10951
|
}
|
|
10792
|
-
|
|
10793
10952
|
//#endregion
|
|
10794
10953
|
//#region src/og-viewer.ts
|
|
10795
10954
|
/**
|
|
@@ -10823,7 +10982,7 @@ function extractTitle(content, frontmatter) {
|
|
|
10823
10982
|
return match ? match[1].trim() : "";
|
|
10824
10983
|
}
|
|
10825
10984
|
function getUrlPath(filePath, srcDir) {
|
|
10826
|
-
let rel = path
|
|
10985
|
+
let rel = path.relative(srcDir, filePath).replace(/\\/g, "/");
|
|
10827
10986
|
rel = rel.replace(/\.md$/, "");
|
|
10828
10987
|
if (rel === "index") return "/";
|
|
10829
10988
|
if (rel.endsWith("/index")) rel = rel.slice(0, -6);
|
|
@@ -10863,7 +11022,7 @@ function validatePage(page, options) {
|
|
|
10863
11022
|
return warnings;
|
|
10864
11023
|
}
|
|
10865
11024
|
async function collectPages(options, root) {
|
|
10866
|
-
const srcDir = path
|
|
11025
|
+
const srcDir = path.resolve(root, options.srcDir);
|
|
10867
11026
|
const files = await (0, glob.glob)("**/*.md", {
|
|
10868
11027
|
cwd: srcDir,
|
|
10869
11028
|
absolute: true
|
|
@@ -10881,7 +11040,7 @@ async function collectPages(options, root) {
|
|
|
10881
11040
|
const urlPath = getUrlPath(file, srcDir);
|
|
10882
11041
|
const ogImageUrl = computeOgImageUrl(urlPath, options.base, options.ssg.siteUrl, generateOgImage, options.ssg.ogImage);
|
|
10883
11042
|
const page = {
|
|
10884
|
-
path: path
|
|
11043
|
+
path: path.relative(srcDir, file),
|
|
10885
11044
|
urlPath,
|
|
10886
11045
|
title,
|
|
10887
11046
|
description,
|
|
@@ -11136,7 +11295,6 @@ function createOgViewerPlugin(options) {
|
|
|
11136
11295
|
}
|
|
11137
11296
|
};
|
|
11138
11297
|
}
|
|
11139
|
-
|
|
11140
11298
|
//#endregion
|
|
11141
11299
|
//#region src/i18n.ts
|
|
11142
11300
|
/**
|
|
@@ -11197,13 +11355,13 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11197
11355
|
},
|
|
11198
11356
|
async buildStart() {
|
|
11199
11357
|
if (!i18nOptions || !i18nOptions.check) return;
|
|
11200
|
-
const dictDir = path
|
|
11358
|
+
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11201
11359
|
if (!fs.existsSync(dictDir)) {
|
|
11202
11360
|
console.warn(`[ox-content:i18n] Dictionary directory not found: ${dictDir}`);
|
|
11203
11361
|
return;
|
|
11204
11362
|
}
|
|
11205
11363
|
try {
|
|
11206
|
-
const { loadDictionaries, checkI18n, extractTranslationKeys } = await
|
|
11364
|
+
const { loadDictionaries, checkI18n, extractTranslationKeys } = await require_mermaid.importNapiModule();
|
|
11207
11365
|
const loadResult = loadDictionaries(dictDir);
|
|
11208
11366
|
if (loadResult.errors.length > 0) {
|
|
11209
11367
|
for (const error of loadResult.errors) console.warn(`[ox-content:i18n] ${error}`);
|
|
@@ -11219,7 +11377,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11219
11377
|
},
|
|
11220
11378
|
configureServer(server) {
|
|
11221
11379
|
if (!i18nOptions) return;
|
|
11222
|
-
const dictDir = path
|
|
11380
|
+
const dictDir = path.resolve(root, i18nOptions.dir);
|
|
11223
11381
|
if (fs.existsSync(dictDir)) {
|
|
11224
11382
|
server.watcher.add(dictDir);
|
|
11225
11383
|
server.watcher.on("change", (filePath) => {
|
|
@@ -11246,7 +11404,7 @@ function createI18nPlugin(resolvedOptions) {
|
|
|
11246
11404
|
* Generates the virtual module for i18n configuration.
|
|
11247
11405
|
*/
|
|
11248
11406
|
function generateI18nModule(options, root) {
|
|
11249
|
-
const dictDir = path
|
|
11407
|
+
const dictDir = path.resolve(root, options.dir);
|
|
11250
11408
|
const localesJson = JSON.stringify(options.locales);
|
|
11251
11409
|
const defaultLocale = JSON.stringify(options.defaultLocale);
|
|
11252
11410
|
let dictionariesCode = "{}";
|
|
@@ -11329,15 +11487,15 @@ function flattenObject(obj, prefix, result) {
|
|
|
11329
11487
|
function loadDictionariesFallback(options, dictDir) {
|
|
11330
11488
|
const dictData = {};
|
|
11331
11489
|
for (const locale of options.locales) {
|
|
11332
|
-
const localeDir = path
|
|
11490
|
+
const localeDir = path.join(dictDir, locale.code);
|
|
11333
11491
|
if (!fs.existsSync(localeDir)) continue;
|
|
11334
11492
|
const files = fs.readdirSync(localeDir);
|
|
11335
11493
|
const localeDict = {};
|
|
11336
11494
|
for (const file of files) {
|
|
11337
11495
|
if (!file.endsWith(".json")) continue;
|
|
11338
|
-
const filePath = path
|
|
11496
|
+
const filePath = path.join(localeDir, file);
|
|
11339
11497
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
11340
|
-
const namespace = path
|
|
11498
|
+
const namespace = path.basename(file, ".json");
|
|
11341
11499
|
try {
|
|
11342
11500
|
flattenObject(JSON.parse(content), namespace, localeDict);
|
|
11343
11501
|
} catch {}
|
|
@@ -11350,13 +11508,13 @@ function loadDictionariesFallback(options, dictDir) {
|
|
|
11350
11508
|
* Collects translation keys from source files using NAPI extractTranslationKeys.
|
|
11351
11509
|
*/
|
|
11352
11510
|
function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
11353
|
-
const srcDir = path
|
|
11511
|
+
const srcDir = path.resolve(root, "src");
|
|
11354
11512
|
const keys = /* @__PURE__ */ new Set();
|
|
11355
11513
|
if (fs.existsSync(srcDir)) walkDir(srcDir, /\.(ts|tsx|js|jsx)$/, (filePath) => {
|
|
11356
11514
|
const usages = extractTranslationKeys(fs.readFileSync(filePath, "utf-8"), filePath, options.functionNames);
|
|
11357
11515
|
for (const usage of usages) keys.add(usage.key);
|
|
11358
11516
|
});
|
|
11359
|
-
const contentDir = path
|
|
11517
|
+
const contentDir = path.resolve(root, "content");
|
|
11360
11518
|
if (fs.existsSync(contentDir)) {
|
|
11361
11519
|
const tPattern = /\{\{t\(['"]([^'"]+)['"]\)\}\}/g;
|
|
11362
11520
|
walkDir(contentDir, /\.(md|mdx)$/, (filePath) => {
|
|
@@ -11374,14 +11532,13 @@ function collectKeysFromSource(root, extractTranslationKeys, options) {
|
|
|
11374
11532
|
function walkDir(dir, pattern, callback) {
|
|
11375
11533
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
11376
11534
|
for (const entry of entries) {
|
|
11377
|
-
const fullPath = path
|
|
11535
|
+
const fullPath = path.join(dir, entry.name);
|
|
11378
11536
|
if (entry.isDirectory()) {
|
|
11379
11537
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
11380
11538
|
walkDir(fullPath, pattern, callback);
|
|
11381
11539
|
} else if (pattern.test(entry.name)) callback(fullPath);
|
|
11382
11540
|
}
|
|
11383
11541
|
}
|
|
11384
|
-
|
|
11385
11542
|
//#endregion
|
|
11386
11543
|
//#region src/jsx-runtime.ts
|
|
11387
11544
|
/**
|
|
@@ -11571,7 +11728,6 @@ function when(condition, content) {
|
|
|
11571
11728
|
function each(items, render) {
|
|
11572
11729
|
return { __html: items.map((item, i) => render(item, i).__html).join("") };
|
|
11573
11730
|
}
|
|
11574
|
-
|
|
11575
11731
|
//#endregion
|
|
11576
11732
|
//#region src/page-context.ts
|
|
11577
11733
|
var page_context_exports = /* @__PURE__ */ require_chunk.__exportAll({
|
|
@@ -11762,7 +11918,6 @@ var currentContext;
|
|
|
11762
11918
|
var init_page_context = require_chunk.__esmMin((() => {
|
|
11763
11919
|
currentContext = null;
|
|
11764
11920
|
}));
|
|
11765
|
-
|
|
11766
11921
|
//#endregion
|
|
11767
11922
|
//#region src/theme-renderer.ts
|
|
11768
11923
|
/**
|
|
@@ -11920,7 +12075,6 @@ function createTheme(config) {
|
|
|
11920
12075
|
return Layout({ children });
|
|
11921
12076
|
};
|
|
11922
12077
|
}
|
|
11923
|
-
|
|
11924
12078
|
//#endregion
|
|
11925
12079
|
//#region src/index.ts
|
|
11926
12080
|
/**
|
|
@@ -11955,8 +12109,8 @@ function oxContent(options = {}) {
|
|
|
11955
12109
|
async function regenerateDocs(root) {
|
|
11956
12110
|
const docsOptions = resolvedOptions.docs;
|
|
11957
12111
|
if (!docsOptions || !docsOptions.enabled) return 0;
|
|
11958
|
-
const srcDirs = docsOptions.src.map((src) => path
|
|
11959
|
-
const outDir = path
|
|
12112
|
+
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
12113
|
+
const outDir = path.resolve(root, docsOptions.out);
|
|
11960
12114
|
const extracted = await extractDocs(srcDirs, docsOptions);
|
|
11961
12115
|
const generated = generateMarkdown(extracted, docsOptions);
|
|
11962
12116
|
await writeDocs(generated, outDir, extracted, docsOptions);
|
|
@@ -12025,7 +12179,7 @@ function oxContent(options = {}) {
|
|
|
12025
12179
|
const docsOptions = resolvedOptions.docs;
|
|
12026
12180
|
if (!docsOptions || !docsOptions.enabled) return;
|
|
12027
12181
|
const root = config?.root || process.cwd();
|
|
12028
|
-
const srcDirs = docsOptions.src.map((src) => path
|
|
12182
|
+
const srcDirs = docsOptions.src.map((src) => path.resolve(root, src));
|
|
12029
12183
|
for (const srcDir of srcDirs) devServer.watcher.add(srcDir);
|
|
12030
12184
|
devServer.watcher.on("all", async (event, file) => {
|
|
12031
12185
|
if (event !== "add" && event !== "change" && event !== "unlink") return;
|
|
@@ -12041,7 +12195,7 @@ function oxContent(options = {}) {
|
|
|
12041
12195
|
configureServer(devServer) {
|
|
12042
12196
|
if (!resolvedOptions.ssg.enabled) return;
|
|
12043
12197
|
const root = config?.root || process.cwd();
|
|
12044
|
-
const srcDir = path
|
|
12198
|
+
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12045
12199
|
devServer.middlewares.use(createDevServerMiddleware(resolvedOptions, root, ssgDevCache));
|
|
12046
12200
|
devServer.watcher.on("add", (file) => {
|
|
12047
12201
|
if (file.startsWith(srcDir) && file.endsWith(".md")) {
|
|
@@ -12108,7 +12262,7 @@ function oxContent(options = {}) {
|
|
|
12108
12262
|
async buildStart() {
|
|
12109
12263
|
if (!resolvedOptions.search.enabled) return;
|
|
12110
12264
|
const root = config?.root || process.cwd();
|
|
12111
|
-
const srcDir = path
|
|
12265
|
+
const srcDir = path.resolve(root, resolvedOptions.srcDir);
|
|
12112
12266
|
try {
|
|
12113
12267
|
searchIndexJson = await buildSearchIndex(srcDir, resolvedOptions.base);
|
|
12114
12268
|
console.log("[ox-content] Search index built");
|
|
@@ -12119,10 +12273,10 @@ function oxContent(options = {}) {
|
|
|
12119
12273
|
async closeBundle() {
|
|
12120
12274
|
if (!resolvedOptions.search.enabled || !searchIndexJson) return;
|
|
12121
12275
|
const root = config?.root || process.cwd();
|
|
12122
|
-
const outDir = path
|
|
12276
|
+
const outDir = path.resolve(root, resolvedOptions.outDir);
|
|
12123
12277
|
try {
|
|
12124
12278
|
await writeSearchIndex(searchIndexJson, outDir);
|
|
12125
|
-
console.log("[ox-content] Search index written to", path
|
|
12279
|
+
console.log("[ox-content] Search index written to", path.join(outDir, "search-index.json"));
|
|
12126
12280
|
} catch (err) {
|
|
12127
12281
|
console.warn("[ox-content] Failed to write search index:", err);
|
|
12128
12282
|
}
|
|
@@ -12150,6 +12304,7 @@ function resolveOptions(options) {
|
|
|
12150
12304
|
highlight: options.highlight ?? false,
|
|
12151
12305
|
highlightTheme: options.highlightTheme ?? "github-dark",
|
|
12152
12306
|
highlightLangs: options.highlightLangs ?? [],
|
|
12307
|
+
codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
|
|
12153
12308
|
mermaid: options.mermaid ?? false,
|
|
12154
12309
|
frontmatter: options.frontmatter ?? true,
|
|
12155
12310
|
toc: options.toc ?? true,
|
|
@@ -12163,12 +12318,32 @@ function resolveOptions(options) {
|
|
|
12163
12318
|
i18n: resolveI18nOptions(options.i18n)
|
|
12164
12319
|
};
|
|
12165
12320
|
}
|
|
12321
|
+
function resolveCodeAnnotationsOptions(options) {
|
|
12322
|
+
if (!options) return {
|
|
12323
|
+
enabled: false,
|
|
12324
|
+
notation: "attribute",
|
|
12325
|
+
metaKey: "annotate",
|
|
12326
|
+
defaultLineNumbers: false
|
|
12327
|
+
};
|
|
12328
|
+
if (options === true) return {
|
|
12329
|
+
enabled: true,
|
|
12330
|
+
notation: "attribute",
|
|
12331
|
+
metaKey: "annotate",
|
|
12332
|
+
defaultLineNumbers: false
|
|
12333
|
+
};
|
|
12334
|
+
return {
|
|
12335
|
+
enabled: true,
|
|
12336
|
+
notation: options.notation ?? "attribute",
|
|
12337
|
+
metaKey: options.metaKey ?? "annotate",
|
|
12338
|
+
defaultLineNumbers: options.defaultLineNumbers ?? false
|
|
12339
|
+
};
|
|
12340
|
+
}
|
|
12166
12341
|
/**
|
|
12167
12342
|
* Generates virtual module content.
|
|
12168
12343
|
*/
|
|
12169
|
-
function generateVirtualModule(path, options) {
|
|
12170
|
-
if (path === "config") return `export default ${JSON.stringify(options)};`;
|
|
12171
|
-
if (path === "runtime") return `
|
|
12344
|
+
function generateVirtualModule(path$2, options) {
|
|
12345
|
+
if (path$2 === "config") return `export default ${JSON.stringify(options)};`;
|
|
12346
|
+
if (path$2 === "runtime") return `
|
|
12172
12347
|
export function useMarkdown() {
|
|
12173
12348
|
return {
|
|
12174
12349
|
render: (content) => {
|
|
@@ -12180,7 +12355,6 @@ function generateVirtualModule(path, options) {
|
|
|
12180
12355
|
`;
|
|
12181
12356
|
return "export default {};";
|
|
12182
12357
|
}
|
|
12183
|
-
|
|
12184
12358
|
//#endregion
|
|
12185
12359
|
exports.DEFAULT_HTML_TEMPLATE = DEFAULT_HTML_TEMPLATE;
|
|
12186
12360
|
exports.DefaultTheme = DefaultTheme;
|
|
@@ -12243,4 +12417,5 @@ exports.useSiteConfig = useSiteConfig;
|
|
|
12243
12417
|
exports.when = when;
|
|
12244
12418
|
exports.writeDocs = writeDocs;
|
|
12245
12419
|
exports.writeSearchIndex = writeSearchIndex;
|
|
12420
|
+
|
|
12246
12421
|
//# sourceMappingURL=index.cjs.map
|