@hawkeyexl/manni 4.16.0 → 4.18.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/README.md +1 -1
- package/dist/{batch-L5W4JS7A.js → batch-5TPNK5BQ.js} +14 -14
- package/dist/{build-GNZUVDZX.js → build-GGKCRWKH.js} +15 -14
- package/dist/{calibrate-2LYIDN6U.js → calibrate-OGOLLGXY.js} +15 -15
- package/dist/{capture-OEDMFU5Z.js → capture-CNHRHTA7.js} +14 -14
- package/dist/{check-NLLFHNWG.js → check-BAMOJMOJ.js} +16 -15
- package/dist/{check-Z5VGDSDT.js → check-XLIS5A7G.js} +13 -14
- package/dist/check-XYGABPXI.js +47 -0
- package/dist/{check-JR2TYL2Y.js → check-ZFI7H7LS.js} +15 -15
- package/dist/{cli-THEU2QG2.js → chunk-245W2Q7C.js} +133 -365
- package/dist/chunk-245W2Q7C.js.map +1 -0
- package/dist/{chunk-OJ7FEM2G.js → chunk-27FP4KKD.js} +47 -10
- package/dist/chunk-27FP4KKD.js.map +1 -0
- package/dist/{chunk-GQQ2AX63.js → chunk-2QZCPPVE.js} +38 -432
- package/dist/chunk-2QZCPPVE.js.map +1 -0
- package/dist/{chunk-BMYCLTFK.js → chunk-327CWO33.js} +3 -3
- package/dist/{chunk-WT3AATHC.js → chunk-33FIOHJ4.js} +252 -425
- package/dist/chunk-33FIOHJ4.js.map +1 -0
- package/dist/{chunk-ZJZQPOJO.js → chunk-3COYAAR7.js} +2 -2
- package/dist/{chunk-6ANTGYNT.js → chunk-3LZ6AYB4.js} +2 -2
- package/dist/{chunk-2AUULNIJ.js → chunk-4A445ALG.js} +3 -3
- package/dist/{chunk-L3YGGYBG.js → chunk-4KY2RUXQ.js} +3 -3
- package/dist/{chunk-NDBISART.js → chunk-5VA3ZOB7.js} +3 -3
- package/dist/{chunk-4LLYPDNG.js → chunk-6E6Z6UQL.js} +7 -7
- package/dist/{chunk-CSLJMML4.js → chunk-6ZYXK3JT.js} +4 -4
- package/dist/chunk-7RZQAMA2.js +314 -0
- package/dist/chunk-7RZQAMA2.js.map +1 -0
- package/dist/{chunk-NH6B6DDI.js → chunk-CWVL7XZR.js} +4 -4
- package/dist/{chunk-DTG6S2UG.js → chunk-E3YXGLEU.js} +2 -2
- package/dist/{chunk-5PO2BWZF.js → chunk-E76WPNYO.js} +2 -2
- package/dist/{chunk-F4GXZMEO.js → chunk-EITEHOSX.js} +12 -7
- package/dist/{chunk-F4GXZMEO.js.map → chunk-EITEHOSX.js.map} +1 -1
- package/dist/{chunk-DSTRT6YD.js → chunk-EU5QLSNN.js} +3 -3
- package/dist/{chunk-F6B2TNXU.js → chunk-F7GYY373.js} +6 -6
- package/dist/{chunk-6NTNLKNQ.js → chunk-FE3US7FR.js} +6 -5
- package/dist/{chunk-6NTNLKNQ.js.map → chunk-FE3US7FR.js.map} +1 -1
- package/dist/{chunk-IL62WATF.js → chunk-FNQE3RAW.js} +2 -2
- package/dist/chunk-FO6MNXOF.js +580 -0
- package/dist/chunk-FO6MNXOF.js.map +1 -0
- package/dist/{chunk-5D24C6WM.js → chunk-GMOAW2EG.js} +6 -2
- package/dist/chunk-GMOAW2EG.js.map +1 -0
- package/dist/chunk-GNZKLUZW.js +459 -0
- package/dist/chunk-GNZKLUZW.js.map +1 -0
- package/dist/{chunk-LEOQO3S6.js → chunk-ICRYIYMJ.js} +7 -7
- package/dist/{chunk-GR6QQ7GM.js → chunk-IIBVQCCR.js} +4 -4
- package/dist/{chunk-O6YTTBSN.js → chunk-JFB45L7D.js} +2 -2
- package/dist/chunk-JFPCDIES.js +1338 -0
- package/dist/chunk-JFPCDIES.js.map +1 -0
- package/dist/{chunk-2XRET3ZG.js → chunk-JHUEACRT.js} +31 -47
- package/dist/chunk-JHUEACRT.js.map +1 -0
- package/dist/{chunk-7UC55CAU.js → chunk-JS5NCZYC.js} +187 -159
- package/dist/chunk-JS5NCZYC.js.map +1 -0
- package/dist/{chunk-63GILHR5.js → chunk-KRQTN5KE.js} +4 -4
- package/dist/{chunk-WDENIUC7.js → chunk-MDZXRHIJ.js} +1 -1
- package/dist/chunk-MDZXRHIJ.js.map +1 -0
- package/dist/{chunk-3GLDB7MZ.js → chunk-MH5MX4B3.js} +1311 -18
- package/dist/chunk-MH5MX4B3.js.map +1 -0
- package/dist/{chunk-IGRXQC3H.js → chunk-N25KDXOV.js} +2 -2
- package/dist/{chunk-DW22KCLN.js → chunk-NPZWOPOH.js} +3 -3
- package/dist/{chunk-4L3JBAW4.js → chunk-NUAVQQMC.js} +2 -2
- package/dist/{chunk-PBZZUNDV.js → chunk-O2TE5X25.js} +7 -7
- package/dist/{chunk-EOSQENQF.js → chunk-OVQDZOMU.js} +2 -2
- package/dist/{chunk-WD33LE5A.js → chunk-OZWV27SE.js} +1313 -127
- package/dist/chunk-OZWV27SE.js.map +1 -0
- package/dist/{chunk-5OOQ3HQ3.js → chunk-PCTJ7P6U.js} +11 -2
- package/dist/chunk-PCTJ7P6U.js.map +1 -0
- package/dist/{chunk-EZCJPF72.js → chunk-PLN2LJDM.js} +3 -3
- package/dist/{chunk-D4ANAOY7.js → chunk-QGJA43DX.js} +20 -6
- package/dist/chunk-QGJA43DX.js.map +1 -0
- package/dist/{chunk-6YFEV7CM.js → chunk-QWYE3S3U.js} +5 -5
- package/dist/{chunk-GC47NBGO.js → chunk-QXTL5MGT.js} +4 -4
- package/dist/{chunk-AWAXAJ6R.js → chunk-RCWP63XT.js} +2 -2
- package/dist/{chunk-IM67NRUW.js → chunk-RMKMJ43W.js} +2 -2
- package/dist/{chunk-EA5KKIFG.js → chunk-RVSUMNCR.js} +3 -3
- package/dist/{chunk-NFJGIBES.js → chunk-SVB45M54.js} +82 -238
- package/dist/chunk-SVB45M54.js.map +1 -0
- package/dist/{chunk-4HEEXPVX.js → chunk-T3VFO2LO.js} +6 -6
- package/dist/{chunk-FU3OCYYH.js → chunk-TFTGMYDR.js} +2 -2
- package/dist/chunk-UP6NBQ62.js +2 -0
- package/dist/{chunk-LPBVWUKS.js → chunk-V2IP2ZMD.js} +2 -2
- package/dist/{chunk-PHNAQ4QX.js → chunk-V5QTIP2M.js} +182 -94
- package/dist/chunk-V5QTIP2M.js.map +1 -0
- package/dist/{chunk-B3XXCDYW.js → chunk-VV4YM6VM.js} +2385 -2061
- package/dist/chunk-VV4YM6VM.js.map +1 -0
- package/dist/{chunk-7GB3KEEM.js → chunk-XKZZRG3Z.js} +24 -460
- package/dist/chunk-XKZZRG3Z.js.map +1 -0
- package/dist/{chunk-ZT5NUSZA.js → chunk-XTQTA262.js} +146 -27
- package/dist/chunk-XTQTA262.js.map +1 -0
- package/dist/chunk-YLU4H2H3.js +545 -0
- package/dist/chunk-YLU4H2H3.js.map +1 -0
- package/dist/{chunk-YF6IZXAC.js → chunk-ZLOLC6WD.js} +7 -7
- package/dist/{cli-RWRYV5FB.js → cli-6UQ3QV2G.js} +9 -9
- package/dist/{cli-LZW6Z33F.js → cli-GH42HLFK.js} +42 -24
- package/dist/cli-GH42HLFK.js.map +1 -0
- package/dist/{cli-5QTSTGTX.js → cli-GND6TVRG.js} +18 -18
- package/dist/{cli-4Y2XY52B.js → cli-JHULEOH2.js} +2 -2
- package/dist/cli-LVHZCC2O.js +379 -0
- package/dist/cli-LVHZCC2O.js.map +1 -0
- package/dist/{cli-2EKRURBU.js → cli-NWU77YRZ.js} +15 -15
- package/dist/{cli-2SDBEUER.js → cli-PUO75R3L.js} +21 -21
- package/dist/{cli-TZ2OHF3H.js → cli-Q2RJMCVE.js} +28 -20
- package/dist/cli-Q2RJMCVE.js.map +1 -0
- package/dist/{cli-DBMPGGOV.js → cli-RUNYBUIV.js} +38 -38
- package/dist/{cli-BXUZ3KEQ.js → cli-T7UJF3BF.js} +634 -36
- package/dist/cli-T7UJF3BF.js.map +1 -0
- package/dist/{cli-KAUXC7EZ.js → cli-WUFQGIUG.js} +9 -9
- package/dist/cli.js +14 -14
- package/dist/docmeta.js +8 -8
- package/dist/{github-UR6LMUMW.js → github-BV42LSW2.js} +13 -14
- package/dist/github-XZ7OLATY.js +35 -0
- package/dist/graph/runtime.d.ts +633 -217
- package/dist/graph/runtime.js +1001 -370
- package/dist/graph/runtime.js.map +1 -1
- package/dist/index.d.ts +2734 -1977
- package/dist/index.js +109 -65
- package/dist/index.js.map +1 -1
- package/dist/{json-QTYN2JQB.js → json-LEEXKSGP.js} +13 -14
- package/dist/{json-5EQCGVCV.js → json-YTKUFNO3.js} +2 -2
- package/dist/{labels-UM2AFR5S.js → labels-E256WRAI.js} +12 -13
- package/dist/{labels-UM2AFR5S.js.map → labels-E256WRAI.js.map} +1 -1
- package/dist/{lint-LOFNZZPR.js → lint-W4CM3EIO.js} +13 -13
- package/dist/{list-GU7S6KEX.js → list-TB4R6AP4.js} +13 -14
- package/dist/{list-EPMHOU7T.js → list-UDDGL2OI.js} +15 -15
- package/dist/{page-25CN3AFY.js → page-L64NO57W.js} +13 -14
- package/dist/{prepare-5GYMBF4P.js → prepare-GFTAYDTP.js} +13 -13
- package/dist/{pretty-52Z74O6F.js → pretty-HYCYKYHB.js} +14 -15
- package/dist/{pretty-QW6OSYRS.js → pretty-Q43TCD6D.js} +13 -14
- package/dist/{reporters-WT53GD4P.js → reporters-4HRBSMUF.js} +4 -4
- package/dist/{reporters-FSXJ42EB.js → reporters-6TEJDXXO.js} +4 -4
- package/dist/{reporters-3FXX2W4X.js → reporters-E3FUVBQ6.js} +12 -12
- package/dist/{run-H7XJMUWK.js → run-UDX2C54M.js} +16 -16
- package/dist/{sarif-C427U3NA.js → sarif-WL353VTA.js} +11 -11
- package/dist/sarif-XZFJ5VIJ.js +36 -0
- package/dist/site/rehype.d.ts +33 -0
- package/dist/site/rehype.js +49 -0
- package/dist/site/rehype.js.map +1 -0
- package/dist/{term-VG65JRNR.js → term-OZ7ZR5KB.js} +18 -19
- package/dist/{term-VG65JRNR.js.map → term-OZ7ZR5KB.js.map} +1 -1
- package/dist/{types-VMOT7RAL.js → types-7N7ETP3W.js} +2 -2
- package/dist/{validate-K36F54UB.js → validate-CR3TI7GP.js} +5 -5
- package/package.json +10 -1
- package/plugin/manni/.claude-plugin/plugin.json +1 -1
- package/shapes/graph/shapes-1.2.0.ttl +1161 -0
- package/dist/check-LVO4HZ3F.js +0 -36
- package/dist/chunk-2XRET3ZG.js.map +0 -1
- package/dist/chunk-3GLDB7MZ.js.map +0 -1
- package/dist/chunk-3WZQ2FR3.js +0 -236
- package/dist/chunk-3WZQ2FR3.js.map +0 -1
- package/dist/chunk-5D24C6WM.js.map +0 -1
- package/dist/chunk-5OOQ3HQ3.js.map +0 -1
- package/dist/chunk-7GB3KEEM.js.map +0 -1
- package/dist/chunk-7UC55CAU.js.map +0 -1
- package/dist/chunk-B3XXCDYW.js.map +0 -1
- package/dist/chunk-D4ANAOY7.js.map +0 -1
- package/dist/chunk-GQQ2AX63.js.map +0 -1
- package/dist/chunk-IKEWBMCN.js +0 -98
- package/dist/chunk-IKEWBMCN.js.map +0 -1
- package/dist/chunk-NFJGIBES.js.map +0 -1
- package/dist/chunk-OJ7FEM2G.js.map +0 -1
- package/dist/chunk-PHNAQ4QX.js.map +0 -1
- package/dist/chunk-WD33LE5A.js.map +0 -1
- package/dist/chunk-WDENIUC7.js.map +0 -1
- package/dist/chunk-WT3AATHC.js.map +0 -1
- package/dist/chunk-YUTVAMWW.js +0 -2
- package/dist/chunk-ZT5NUSZA.js.map +0 -1
- package/dist/cli-BXUZ3KEQ.js.map +0 -1
- package/dist/cli-LZW6Z33F.js.map +0 -1
- package/dist/cli-THEU2QG2.js.map +0 -1
- package/dist/cli-TZ2OHF3H.js.map +0 -1
- package/dist/github-ICZ5UDGX.js +0 -36
- package/dist/sarif-UVAFWZKS.js +0 -37
- /package/dist/{batch-L5W4JS7A.js.map → batch-5TPNK5BQ.js.map} +0 -0
- /package/dist/{build-GNZUVDZX.js.map → build-GGKCRWKH.js.map} +0 -0
- /package/dist/{calibrate-2LYIDN6U.js.map → calibrate-OGOLLGXY.js.map} +0 -0
- /package/dist/{capture-OEDMFU5Z.js.map → capture-CNHRHTA7.js.map} +0 -0
- /package/dist/{check-LVO4HZ3F.js.map → check-BAMOJMOJ.js.map} +0 -0
- /package/dist/{check-NLLFHNWG.js.map → check-XLIS5A7G.js.map} +0 -0
- /package/dist/{check-Z5VGDSDT.js.map → check-XYGABPXI.js.map} +0 -0
- /package/dist/{check-JR2TYL2Y.js.map → check-ZFI7H7LS.js.map} +0 -0
- /package/dist/{chunk-BMYCLTFK.js.map → chunk-327CWO33.js.map} +0 -0
- /package/dist/{chunk-ZJZQPOJO.js.map → chunk-3COYAAR7.js.map} +0 -0
- /package/dist/{chunk-6ANTGYNT.js.map → chunk-3LZ6AYB4.js.map} +0 -0
- /package/dist/{chunk-2AUULNIJ.js.map → chunk-4A445ALG.js.map} +0 -0
- /package/dist/{chunk-L3YGGYBG.js.map → chunk-4KY2RUXQ.js.map} +0 -0
- /package/dist/{chunk-NDBISART.js.map → chunk-5VA3ZOB7.js.map} +0 -0
- /package/dist/{chunk-4LLYPDNG.js.map → chunk-6E6Z6UQL.js.map} +0 -0
- /package/dist/{chunk-CSLJMML4.js.map → chunk-6ZYXK3JT.js.map} +0 -0
- /package/dist/{chunk-NH6B6DDI.js.map → chunk-CWVL7XZR.js.map} +0 -0
- /package/dist/{chunk-DTG6S2UG.js.map → chunk-E3YXGLEU.js.map} +0 -0
- /package/dist/{chunk-5PO2BWZF.js.map → chunk-E76WPNYO.js.map} +0 -0
- /package/dist/{chunk-DSTRT6YD.js.map → chunk-EU5QLSNN.js.map} +0 -0
- /package/dist/{chunk-F6B2TNXU.js.map → chunk-F7GYY373.js.map} +0 -0
- /package/dist/{chunk-IL62WATF.js.map → chunk-FNQE3RAW.js.map} +0 -0
- /package/dist/{chunk-LEOQO3S6.js.map → chunk-ICRYIYMJ.js.map} +0 -0
- /package/dist/{chunk-GR6QQ7GM.js.map → chunk-IIBVQCCR.js.map} +0 -0
- /package/dist/{chunk-O6YTTBSN.js.map → chunk-JFB45L7D.js.map} +0 -0
- /package/dist/{chunk-63GILHR5.js.map → chunk-KRQTN5KE.js.map} +0 -0
- /package/dist/{chunk-IGRXQC3H.js.map → chunk-N25KDXOV.js.map} +0 -0
- /package/dist/{chunk-DW22KCLN.js.map → chunk-NPZWOPOH.js.map} +0 -0
- /package/dist/{chunk-4L3JBAW4.js.map → chunk-NUAVQQMC.js.map} +0 -0
- /package/dist/{chunk-PBZZUNDV.js.map → chunk-O2TE5X25.js.map} +0 -0
- /package/dist/{chunk-EOSQENQF.js.map → chunk-OVQDZOMU.js.map} +0 -0
- /package/dist/{chunk-EZCJPF72.js.map → chunk-PLN2LJDM.js.map} +0 -0
- /package/dist/{chunk-6YFEV7CM.js.map → chunk-QWYE3S3U.js.map} +0 -0
- /package/dist/{chunk-GC47NBGO.js.map → chunk-QXTL5MGT.js.map} +0 -0
- /package/dist/{chunk-AWAXAJ6R.js.map → chunk-RCWP63XT.js.map} +0 -0
- /package/dist/{chunk-IM67NRUW.js.map → chunk-RMKMJ43W.js.map} +0 -0
- /package/dist/{chunk-EA5KKIFG.js.map → chunk-RVSUMNCR.js.map} +0 -0
- /package/dist/{chunk-4HEEXPVX.js.map → chunk-T3VFO2LO.js.map} +0 -0
- /package/dist/{chunk-FU3OCYYH.js.map → chunk-TFTGMYDR.js.map} +0 -0
- /package/dist/{chunk-YUTVAMWW.js.map → chunk-UP6NBQ62.js.map} +0 -0
- /package/dist/{chunk-LPBVWUKS.js.map → chunk-V2IP2ZMD.js.map} +0 -0
- /package/dist/{chunk-YF6IZXAC.js.map → chunk-ZLOLC6WD.js.map} +0 -0
- /package/dist/{cli-RWRYV5FB.js.map → cli-6UQ3QV2G.js.map} +0 -0
- /package/dist/{cli-5QTSTGTX.js.map → cli-GND6TVRG.js.map} +0 -0
- /package/dist/{cli-4Y2XY52B.js.map → cli-JHULEOH2.js.map} +0 -0
- /package/dist/{cli-2EKRURBU.js.map → cli-NWU77YRZ.js.map} +0 -0
- /package/dist/{cli-2SDBEUER.js.map → cli-PUO75R3L.js.map} +0 -0
- /package/dist/{cli-DBMPGGOV.js.map → cli-RUNYBUIV.js.map} +0 -0
- /package/dist/{cli-KAUXC7EZ.js.map → cli-WUFQGIUG.js.map} +0 -0
- /package/dist/{github-ICZ5UDGX.js.map → github-BV42LSW2.js.map} +0 -0
- /package/dist/{github-UR6LMUMW.js.map → github-XZ7OLATY.js.map} +0 -0
- /package/dist/{json-5EQCGVCV.js.map → json-LEEXKSGP.js.map} +0 -0
- /package/dist/{json-QTYN2JQB.js.map → json-YTKUFNO3.js.map} +0 -0
- /package/dist/{lint-LOFNZZPR.js.map → lint-W4CM3EIO.js.map} +0 -0
- /package/dist/{list-EPMHOU7T.js.map → list-TB4R6AP4.js.map} +0 -0
- /package/dist/{list-GU7S6KEX.js.map → list-UDDGL2OI.js.map} +0 -0
- /package/dist/{page-25CN3AFY.js.map → page-L64NO57W.js.map} +0 -0
- /package/dist/{prepare-5GYMBF4P.js.map → prepare-GFTAYDTP.js.map} +0 -0
- /package/dist/{pretty-52Z74O6F.js.map → pretty-HYCYKYHB.js.map} +0 -0
- /package/dist/{pretty-QW6OSYRS.js.map → pretty-Q43TCD6D.js.map} +0 -0
- /package/dist/{reporters-3FXX2W4X.js.map → reporters-4HRBSMUF.js.map} +0 -0
- /package/dist/{reporters-FSXJ42EB.js.map → reporters-6TEJDXXO.js.map} +0 -0
- /package/dist/{reporters-WT53GD4P.js.map → reporters-E3FUVBQ6.js.map} +0 -0
- /package/dist/{run-H7XJMUWK.js.map → run-UDX2C54M.js.map} +0 -0
- /package/dist/{sarif-C427U3NA.js.map → sarif-WL353VTA.js.map} +0 -0
- /package/dist/{sarif-UVAFWZKS.js.map → sarif-XZFJ5VIJ.js.map} +0 -0
- /package/dist/{types-VMOT7RAL.js.map → types-7N7ETP3W.js.map} +0 -0
- /package/dist/{validate-K36F54UB.js.map → validate-CR3TI7GP.js.map} +0 -0
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
launcherCommandLine
|
|
4
|
-
} from "./chunk-ZMECS2IJ.js";
|
|
5
|
-
import {
|
|
6
|
-
fail
|
|
7
|
-
} from "./chunk-YEUYKR62.js";
|
|
8
2
|
import {
|
|
9
3
|
FAMILY_CONFIG_NAMES,
|
|
10
4
|
findConfigFileSync,
|
|
@@ -12,26 +6,11 @@ import {
|
|
|
12
6
|
searchPath
|
|
13
7
|
} from "./chunk-B2242FYO.js";
|
|
14
8
|
import {
|
|
15
|
-
notice,
|
|
16
9
|
warn
|
|
17
10
|
} from "./chunk-HX44GB4Z.js";
|
|
18
|
-
import "./chunk-VM7VAFJW.js";
|
|
19
11
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-5OOQ3HQ3.js";
|
|
22
|
-
import "./chunk-OWBRDNRZ.js";
|
|
23
|
-
import {
|
|
24
|
-
ToolError,
|
|
25
|
-
errorMessage
|
|
12
|
+
ToolError
|
|
26
13
|
} from "./chunk-G3T47CFV.js";
|
|
27
|
-
import "./chunk-2H7UOFLK.js";
|
|
28
|
-
|
|
29
|
-
// src/site/cli.ts
|
|
30
|
-
import { Command } from "commander";
|
|
31
|
-
|
|
32
|
-
// src/site/core/detect.ts
|
|
33
|
-
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
34
|
-
import { dirname, join, posix, relative, resolve as resolve2 } from "node:path";
|
|
35
14
|
|
|
36
15
|
// src/site/errors.ts
|
|
37
16
|
var SiteError = class extends ToolError {
|
|
@@ -41,10 +20,15 @@ var SiteError = class extends ToolError {
|
|
|
41
20
|
}
|
|
42
21
|
};
|
|
43
22
|
|
|
23
|
+
// src/site/core/detect.ts
|
|
24
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
25
|
+
import { dirname, join, posix, relative, resolve as resolve2 } from "node:path";
|
|
26
|
+
|
|
44
27
|
// src/site/core/config.ts
|
|
45
28
|
import { resolve } from "node:path";
|
|
46
29
|
var SECTION = "site";
|
|
47
|
-
var CONFIG_KEYS = ["dir", "commands"];
|
|
30
|
+
var CONFIG_KEYS = ["dir", "commands", "out", "annotate"];
|
|
31
|
+
var ANNOTATE_KEYS = ["after-build"];
|
|
48
32
|
var COMMAND_KEYS = ["start", "build", "preview"];
|
|
49
33
|
var CONFIG_FILE = {
|
|
50
34
|
section: SECTION,
|
|
@@ -53,7 +37,7 @@ var CONFIG_FILE = {
|
|
|
53
37
|
};
|
|
54
38
|
function loadSiteConfig(cwd, configPath) {
|
|
55
39
|
const file = configPath === void 0 ? findConfigFileSync(cwd, CONFIG_FILE) : readConfigFileSync(configPath, cwd, CONFIG_FILE);
|
|
56
|
-
if (file === null) return { commands: {}, collections: [], configDir: null };
|
|
40
|
+
if (file === null) return { commands: {}, afterBuild: false, collections: [], configDir: null };
|
|
57
41
|
return {
|
|
58
42
|
...parseSiteConfig(file.value, file.source, file.dir),
|
|
59
43
|
collections: file.collections,
|
|
@@ -62,10 +46,23 @@ function loadSiteConfig(cwd, configPath) {
|
|
|
62
46
|
}
|
|
63
47
|
function parseSiteConfig(value, source, configDir) {
|
|
64
48
|
const obj = asMapping(value, SECTION, CONFIG_KEYS, source);
|
|
65
|
-
const config = { commands: {} };
|
|
49
|
+
const config = { commands: {}, afterBuild: false };
|
|
66
50
|
if (obj.dir !== void 0) {
|
|
67
51
|
config.dir = resolve(configDir, asString(obj.dir, "dir", source));
|
|
68
52
|
}
|
|
53
|
+
if (obj.out !== void 0) {
|
|
54
|
+
const out = asString(obj.out, "out", source);
|
|
55
|
+
if (out.trim() === "") throw new SiteError(`${source}: ${SECTION}.out must not be empty.`);
|
|
56
|
+
config.out = out;
|
|
57
|
+
}
|
|
58
|
+
const annotate = asMapping(obj.annotate, `${SECTION}.annotate`, ANNOTATE_KEYS, source);
|
|
59
|
+
const afterBuild = annotate["after-build"];
|
|
60
|
+
if (afterBuild !== void 0) {
|
|
61
|
+
if (typeof afterBuild !== "boolean") {
|
|
62
|
+
throw new SiteError(`${source}: ${SECTION}.annotate.after-build must be a boolean.`);
|
|
63
|
+
}
|
|
64
|
+
config.afterBuild = afterBuild;
|
|
65
|
+
}
|
|
69
66
|
const commands = asMapping(obj.commands, `${SECTION}.commands`, COMMAND_KEYS, source);
|
|
70
67
|
for (const verb of COMMAND_KEYS) {
|
|
71
68
|
const command = commands[verb];
|
|
@@ -154,6 +151,7 @@ function zensicalMarker(s) {
|
|
|
154
151
|
return files.some((f) => /\bzensical\b/.test(read(join(s.dir, f)))) ? "mkdocs.yml" : null;
|
|
155
152
|
}
|
|
156
153
|
var sphinxSource = (s) => has(s.dir, "conf.py") ? "." : "source";
|
|
154
|
+
var vitepressRoot = (s) => has(s.dir, ".vitepress") || !has(s.dir, "docs", ".vitepress") ? "." : "docs";
|
|
157
155
|
var FRAMEWORKS = [
|
|
158
156
|
{
|
|
159
157
|
name: "Mintlify",
|
|
@@ -177,6 +175,7 @@ var FRAMEWORKS = [
|
|
|
177
175
|
runner: "node",
|
|
178
176
|
pkg: () => "astro",
|
|
179
177
|
commands: () => node("astro", "dev", "build", "preview"),
|
|
178
|
+
layout: () => ({ out: "dist", content: "src/content/docs", route: "dir", unified: true }),
|
|
180
179
|
hostFlag: "--host",
|
|
181
180
|
defaultPort: 4321
|
|
182
181
|
},
|
|
@@ -190,6 +189,7 @@ var FRAMEWORKS = [
|
|
|
190
189
|
build: { script: "build", argv: ["docusaurus", "build"] },
|
|
191
190
|
preview: { script: "serve", argv: ["docusaurus", "serve"] }
|
|
192
191
|
}),
|
|
192
|
+
layout: () => ({ out: "build", content: "docs", route: "dir", prefix: "docs/", unified: true }),
|
|
193
193
|
hostFlag: "--host",
|
|
194
194
|
defaultPort: 3e3
|
|
195
195
|
},
|
|
@@ -198,7 +198,11 @@ var FRAMEWORKS = [
|
|
|
198
198
|
marker: dep("vitepress"),
|
|
199
199
|
runner: "node",
|
|
200
200
|
pkg: () => "vitepress",
|
|
201
|
-
commands: (s) => node("vitepress", "docs:dev", "docs:build", "docs:preview",
|
|
201
|
+
commands: (s) => node("vitepress", "docs:dev", "docs:build", "docs:preview", vitepressRoot(s) === "." ? [] : ["docs"]),
|
|
202
|
+
layout: (s) => {
|
|
203
|
+
const src = vitepressRoot(s);
|
|
204
|
+
return { out: posix.join(src, ".vitepress", "dist"), content: src, route: "html" };
|
|
205
|
+
},
|
|
202
206
|
hostFlag: "--host",
|
|
203
207
|
defaultPort: 5173
|
|
204
208
|
},
|
|
@@ -208,6 +212,7 @@ var FRAMEWORKS = [
|
|
|
208
212
|
runner: "node",
|
|
209
213
|
pkg: () => "next",
|
|
210
214
|
commands: next,
|
|
215
|
+
layout: () => ({ out: "out", content: "pages", route: "html", unified: true }),
|
|
211
216
|
hostFlag: "--hostname",
|
|
212
217
|
defaultPort: 3e3
|
|
213
218
|
},
|
|
@@ -217,6 +222,7 @@ var FRAMEWORKS = [
|
|
|
217
222
|
runner: "node",
|
|
218
223
|
pkg: () => "next",
|
|
219
224
|
commands: next,
|
|
225
|
+
layout: () => ({ out: "out", content: "content/docs", route: "html", prefix: "docs/", unified: true }),
|
|
220
226
|
hostFlag: "--hostname",
|
|
221
227
|
defaultPort: 3e3
|
|
222
228
|
},
|
|
@@ -226,6 +232,7 @@ var FRAMEWORKS = [
|
|
|
226
232
|
runner: "node",
|
|
227
233
|
pkg: (s) => s.deps.has("rspress") ? "rspress" : "@rspress/core",
|
|
228
234
|
commands: () => node("rspress", "dev", "build", "preview"),
|
|
235
|
+
layout: () => ({ out: "doc_build", content: "docs", route: "html", unified: true }),
|
|
229
236
|
hostFlag: "--host",
|
|
230
237
|
defaultPort: 3e3
|
|
231
238
|
},
|
|
@@ -234,6 +241,7 @@ var FRAMEWORKS = [
|
|
|
234
241
|
marker: (s) => has(s.dir, "mkdocs.yml") && zensical(s) === null ? "mkdocs.yml" : null,
|
|
235
242
|
runner: "python",
|
|
236
243
|
commands: () => ({ start: { argv: ["mkdocs", "serve"] }, build: { argv: ["mkdocs", "build"] }, out: "site" }),
|
|
244
|
+
layout: () => ({ out: "site", content: "docs", route: "dir" }),
|
|
237
245
|
hostFlag: "-a",
|
|
238
246
|
defaultPort: 8e3
|
|
239
247
|
},
|
|
@@ -242,6 +250,7 @@ var FRAMEWORKS = [
|
|
|
242
250
|
marker: zensical,
|
|
243
251
|
runner: "python",
|
|
244
252
|
commands: () => ({ start: { argv: ["zensical", "serve"] }, build: { argv: ["zensical", "build"] }, out: "site" }),
|
|
253
|
+
layout: () => ({ out: "site", content: "docs", route: "dir" }),
|
|
245
254
|
hostFlag: "-a",
|
|
246
255
|
defaultPort: 8e3
|
|
247
256
|
},
|
|
@@ -257,6 +266,7 @@ var FRAMEWORKS = [
|
|
|
257
266
|
out: posix.join(src, "_build", "html")
|
|
258
267
|
};
|
|
259
268
|
},
|
|
269
|
+
layout: (s) => ({ out: posix.join(sphinxSource(s), "_build", "html"), content: sphinxSource(s), route: "html" }),
|
|
260
270
|
hostFlag: "--host",
|
|
261
271
|
defaultPort: 8e3
|
|
262
272
|
},
|
|
@@ -265,6 +275,7 @@ var FRAMEWORKS = [
|
|
|
265
275
|
marker: (s) => ["hugo.toml", "hugo.yaml", "hugo.json"].find((f) => has(s.dir, f)) ?? null,
|
|
266
276
|
runner: "path",
|
|
267
277
|
commands: () => ({ start: { argv: ["hugo", "server"] }, build: { argv: ["hugo"] }, out: "public" }),
|
|
278
|
+
layout: () => ({ out: "public", content: "content", route: "dir" }),
|
|
268
279
|
hostFlag: "--bind",
|
|
269
280
|
defaultPort: 1313
|
|
270
281
|
},
|
|
@@ -273,6 +284,7 @@ var FRAMEWORKS = [
|
|
|
273
284
|
marker: (s) => has(s.dir, "_config.yml") && /\b(jekyll|github-pages)\b/.test(read(join(s.dir, "Gemfile"))) ? "_config.yml" : null,
|
|
274
285
|
runner: "ruby",
|
|
275
286
|
commands: () => ({ start: { argv: ["jekyll", "serve"] }, build: { argv: ["jekyll", "build"] }, out: "_site" }),
|
|
287
|
+
layout: () => ({ out: "_site", content: ".", route: "html" }),
|
|
276
288
|
hostFlag: "--host",
|
|
277
289
|
defaultPort: 4e3
|
|
278
290
|
}
|
|
@@ -393,12 +405,69 @@ function addressArgs(fw, host, port) {
|
|
|
393
405
|
...port !== void 0 ? ["--port", String(port)] : []
|
|
394
406
|
];
|
|
395
407
|
}
|
|
408
|
+
function detectFramework(base) {
|
|
409
|
+
for (const dir of [base, join(base, "docs"), join(base, "website"), join(base, "site")]) {
|
|
410
|
+
if (!isDirectory(dir)) continue;
|
|
411
|
+
const site = siteAt(dir);
|
|
412
|
+
const names = FRAMEWORKS.filter((fw) => fw.marker(site) !== null).map((fw) => fw.name);
|
|
413
|
+
if (names.length > 0) return names.length === 1 ? names[0] ?? null : null;
|
|
414
|
+
}
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
function findSite(config, cwd, dir, shown) {
|
|
418
|
+
const base = config.configDir ?? resolve2(cwd);
|
|
419
|
+
const explicit = dir !== void 0 ? resolve2(cwd, dir) : config.dir;
|
|
420
|
+
if (explicit !== void 0) {
|
|
421
|
+
if (!isDirectory(explicit)) throw new SiteError(`${shown(explicit)} does not exist.`);
|
|
422
|
+
const at = has(explicit, "fern.config.json") && !has(explicit, "fern", "fern.config.json") ? dirname(explicit) : explicit;
|
|
423
|
+
return { site: siteAt(at), base, notFound: "" };
|
|
424
|
+
}
|
|
425
|
+
const candidates = [base, join(base, "docs"), join(base, "website"), join(base, "site")];
|
|
426
|
+
for (const candidate of candidates) {
|
|
427
|
+
if (!isDirectory(candidate)) continue;
|
|
428
|
+
const site = siteAt(candidate);
|
|
429
|
+
if (FRAMEWORKS.some((fw) => fw.marker(site) !== null)) return { site, base, notFound: "" };
|
|
430
|
+
}
|
|
431
|
+
const names = candidates.map(shown);
|
|
432
|
+
return { site: null, base, notFound: `no docs site found in ${names.slice(0, -1).join(", ")} or ${names.at(-1) ?? ""}.` };
|
|
433
|
+
}
|
|
434
|
+
function matchesOf(site) {
|
|
435
|
+
return FRAMEWORKS.flatMap((fw) => {
|
|
436
|
+
const marker = fw.marker(site);
|
|
437
|
+
return marker === null ? [] : [{ fw, marker }];
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
var shownFrom = (cwd) => (dir) => {
|
|
441
|
+
const rel = relative(cwd, dir).replace(/\\/g, "/");
|
|
442
|
+
return rel === "" ? "./" : `${rel}/`;
|
|
443
|
+
};
|
|
444
|
+
function resolveAnnotateSite(opts) {
|
|
445
|
+
const config = loadSiteConfig(opts.cwd, opts.configPath);
|
|
446
|
+
const shown = shownFrom(opts.cwd);
|
|
447
|
+
const outGiven = (opts.out ?? config.out) !== void 0;
|
|
448
|
+
const located = findSite(config, opts.cwd, opts.dir, shown);
|
|
449
|
+
if (located.site === null && !outGiven) {
|
|
450
|
+
throw new SiteError(`${located.notFound} Pass the site's directory, or pass --out.`);
|
|
451
|
+
}
|
|
452
|
+
const site = located.site ?? siteAt(located.base);
|
|
453
|
+
const where = shown(site.dir);
|
|
454
|
+
const matches = matchesOf(site);
|
|
455
|
+
if (matches.length > 1 && !outGiven) {
|
|
456
|
+
const list = matches.map((m) => `${m.fw.name} (${m.marker})`).join(", ");
|
|
457
|
+
throw new SiteError(`${where} holds more than one docs site: ${list}. Pass --out, or set site.out in ${CONFIG_NAME}.`);
|
|
458
|
+
}
|
|
459
|
+
const fw = matches.length === 1 ? matches[0]?.fw : void 0;
|
|
460
|
+
if (fw !== void 0 && fw.layout === void 0) {
|
|
461
|
+
throw new SiteError(`${fw.name} builds on its own host, so there is no local site to annotate.`);
|
|
462
|
+
}
|
|
463
|
+
if (fw === void 0 && !outGiven) {
|
|
464
|
+
throw new SiteError(`no docs framework detected in ${where}. Pass --out, or set site.out in ${CONFIG_NAME}.`);
|
|
465
|
+
}
|
|
466
|
+
return { dir: site.dir, where, framework: fw?.name ?? null, layout: fw?.layout?.(site) ?? null, config };
|
|
467
|
+
}
|
|
396
468
|
function resolvePlan(verb, opts) {
|
|
397
469
|
const config = loadSiteConfig(opts.cwd, opts.configPath);
|
|
398
|
-
const shown = (
|
|
399
|
-
const rel = relative(opts.cwd, dir).replace(/\\/g, "/");
|
|
400
|
-
return rel === "" ? "./" : `${rel}/`;
|
|
401
|
-
};
|
|
470
|
+
const shown = shownFrom(opts.cwd);
|
|
402
471
|
const serving = verb === "build" ? null : verb;
|
|
403
472
|
const flagPort = serving !== null && opts.port !== void 0 ? parsePort(opts.port) : void 0;
|
|
404
473
|
const flagHost = serving !== null ? opts.host : void 0;
|
|
@@ -414,39 +483,13 @@ function resolvePlan(verb, opts) {
|
|
|
414
483
|
const missing = needed.find((v) => config.commands[v] === void 0);
|
|
415
484
|
const key = `site.commands.${missing ?? verb} in ${CONFIG_NAME}`;
|
|
416
485
|
const setIt = `Set ${key}.`;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
if (!isDirectory(explicit)) throw new SiteError(`${shown(explicit)} does not exist.`);
|
|
421
|
-
const dir = has(explicit, "fern.config.json") && !has(explicit, "fern", "fern.config.json") ? dirname(explicit) : explicit;
|
|
422
|
-
site = siteAt(dir);
|
|
423
|
-
} else {
|
|
424
|
-
const base = config.configDir ?? resolve2(opts.cwd);
|
|
425
|
-
const candidates = [base, join(base, "docs"), join(base, "website"), join(base, "site")];
|
|
426
|
-
for (const dir of candidates) {
|
|
427
|
-
if (!isDirectory(dir)) continue;
|
|
428
|
-
const candidate = siteAt(dir);
|
|
429
|
-
if (FRAMEWORKS.some((fw2) => fw2.marker(candidate) !== null)) {
|
|
430
|
-
site = candidate;
|
|
431
|
-
break;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
if (site === void 0) {
|
|
435
|
-
if (missing !== void 0) {
|
|
436
|
-
const names = candidates.map(shown);
|
|
437
|
-
throw new SiteError(
|
|
438
|
-
`no docs site found in ${names.slice(0, -1).join(", ")} or ${names.at(-1) ?? ""}. Pass the site's directory, or set ${key}.`
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
site = siteAt(base);
|
|
442
|
-
}
|
|
486
|
+
const located = findSite(config, opts.cwd, opts.dir, shown);
|
|
487
|
+
if (located.site === null && missing !== void 0) {
|
|
488
|
+
throw new SiteError(`${located.notFound} Pass the site's directory, or set ${key}.`);
|
|
443
489
|
}
|
|
444
|
-
const
|
|
445
|
-
const
|
|
446
|
-
const matches =
|
|
447
|
-
const marker = fw2.marker(found);
|
|
448
|
-
return marker === null ? [] : [{ fw: fw2, marker }];
|
|
449
|
-
});
|
|
490
|
+
const found = located.site ?? siteAt(located.base);
|
|
491
|
+
const where = shown(found.dir);
|
|
492
|
+
const matches = matchesOf(found);
|
|
450
493
|
let fw;
|
|
451
494
|
if (missing !== void 0) {
|
|
452
495
|
if (matches.length === 0) throw new SiteError(`no docs framework detected in ${where}. ${setIt}`);
|
|
@@ -456,7 +499,26 @@ function resolvePlan(verb, opts) {
|
|
|
456
499
|
}
|
|
457
500
|
fw = matches[0]?.fw;
|
|
458
501
|
}
|
|
459
|
-
const steps = needed.
|
|
502
|
+
const steps = needed.flatMap((v) => {
|
|
503
|
+
const step = planStep(v);
|
|
504
|
+
if (v !== "build" || !config.afterBuild) return [step];
|
|
505
|
+
return [
|
|
506
|
+
step,
|
|
507
|
+
{
|
|
508
|
+
announce: "",
|
|
509
|
+
display: "manni site annotate",
|
|
510
|
+
notFound: "",
|
|
511
|
+
step: {
|
|
512
|
+
kind: "annotate",
|
|
513
|
+
cwd: opts.cwd,
|
|
514
|
+
dir: found.dir,
|
|
515
|
+
...opts.configPath === void 0 ? {} : { configPath: opts.configPath }
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
];
|
|
519
|
+
});
|
|
520
|
+
return { steps };
|
|
521
|
+
function planStep(v) {
|
|
460
522
|
const override = config.commands[v];
|
|
461
523
|
const isServe = v === serving;
|
|
462
524
|
const extra = v === verb ? opts.passthrough : [];
|
|
@@ -496,7 +558,7 @@ function resolvePlan(verb, opts) {
|
|
|
496
558
|
notFound: "",
|
|
497
559
|
step: {
|
|
498
560
|
kind: "static",
|
|
499
|
-
root: join(found.dir, cmds.out),
|
|
561
|
+
root: join(found.dir, config.out ?? cmds.out),
|
|
500
562
|
host: address.host ?? STATIC_HOST,
|
|
501
563
|
port: address.port ?? fw.defaultPort,
|
|
502
564
|
base: address.base
|
|
@@ -522,8 +584,7 @@ function resolvePlan(verb, opts) {
|
|
|
522
584
|
notFound: `${bin} not found on PATH. Install ${install}, or set site.commands.${v}.`,
|
|
523
585
|
step: { kind: "exec", argv, cwd: found.dir }
|
|
524
586
|
};
|
|
525
|
-
}
|
|
526
|
-
return { steps };
|
|
587
|
+
}
|
|
527
588
|
}
|
|
528
589
|
function requireInstalled(fw, site, pm, where) {
|
|
529
590
|
const pkg = fw.pkg?.(site);
|
|
@@ -536,304 +597,11 @@ function requireInstalled(fw, site, pm, where) {
|
|
|
536
597
|
throw new SiteError(`${pkg} is not installed for ${where}. Run ${install} in ${where} first.`);
|
|
537
598
|
}
|
|
538
599
|
|
|
539
|
-
// src/site/core/run.ts
|
|
540
|
-
import { spawn } from "node:child_process";
|
|
541
|
-
import { accessSync, constants, statSync as statSync2 } from "node:fs";
|
|
542
|
-
import { delimiter, resolve as resolve4 } from "node:path";
|
|
543
|
-
|
|
544
|
-
// src/site/core/static-server.ts
|
|
545
|
-
import { createReadStream } from "node:fs";
|
|
546
|
-
import { stat } from "node:fs/promises";
|
|
547
|
-
import { createServer } from "node:http";
|
|
548
|
-
import { extname, join as join2, relative as relative2, resolve as resolve3, sep } from "node:path";
|
|
549
|
-
var MIME = {
|
|
550
|
-
".html": "text/html; charset=utf-8",
|
|
551
|
-
".css": "text/css; charset=utf-8",
|
|
552
|
-
".js": "text/javascript; charset=utf-8",
|
|
553
|
-
".mjs": "text/javascript; charset=utf-8",
|
|
554
|
-
".json": "application/json; charset=utf-8",
|
|
555
|
-
".map": "application/json; charset=utf-8",
|
|
556
|
-
".txt": "text/plain; charset=utf-8",
|
|
557
|
-
".xml": "application/xml; charset=utf-8",
|
|
558
|
-
".svg": "image/svg+xml",
|
|
559
|
-
".png": "image/png",
|
|
560
|
-
".jpg": "image/jpeg",
|
|
561
|
-
".jpeg": "image/jpeg",
|
|
562
|
-
".gif": "image/gif",
|
|
563
|
-
".webp": "image/webp",
|
|
564
|
-
".avif": "image/avif",
|
|
565
|
-
".ico": "image/x-icon",
|
|
566
|
-
".woff": "font/woff",
|
|
567
|
-
".woff2": "font/woff2",
|
|
568
|
-
".ttf": "font/ttf",
|
|
569
|
-
".wasm": "application/wasm",
|
|
570
|
-
".pdf": "application/pdf",
|
|
571
|
-
".webmanifest": "application/manifest+json"
|
|
572
|
-
};
|
|
573
|
-
function normalizeBase(base) {
|
|
574
|
-
const trimmed = base.replace(/^\/+|\/+$/g, "");
|
|
575
|
-
return trimmed === "" ? "/" : `/${trimmed}/`;
|
|
576
|
-
}
|
|
577
|
-
async function kindOf(path) {
|
|
578
|
-
try {
|
|
579
|
-
const s = await stat(path);
|
|
580
|
-
if (s.isDirectory()) return "dir";
|
|
581
|
-
return s.isFile() ? "file" : void 0;
|
|
582
|
-
} catch {
|
|
583
|
-
return void 0;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
function sendFile(req, res, path, status = 200) {
|
|
587
|
-
res.writeHead(status, {
|
|
588
|
-
"content-type": MIME[extname(path).toLowerCase()] ?? "application/octet-stream"
|
|
589
|
-
});
|
|
590
|
-
if (req.method === "HEAD") {
|
|
591
|
-
res.end();
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
createReadStream(path).on("error", () => res.destroy()).pipe(res);
|
|
595
|
-
}
|
|
596
|
-
function redirect(res, status, location) {
|
|
597
|
-
res.writeHead(status, { location });
|
|
598
|
-
res.end();
|
|
599
|
-
}
|
|
600
|
-
function inside(root, rest) {
|
|
601
|
-
let decoded;
|
|
602
|
-
try {
|
|
603
|
-
decoded = decodeURIComponent(rest);
|
|
604
|
-
} catch {
|
|
605
|
-
return void 0;
|
|
606
|
-
}
|
|
607
|
-
if (decoded.includes("\0") || decoded.split(/[\\/]/).includes("..")) return void 0;
|
|
608
|
-
const path = resolve3(root, `.${sep}${decoded}`);
|
|
609
|
-
return path === root || path.startsWith(root + sep) ? path : void 0;
|
|
610
|
-
}
|
|
611
|
-
function handler(root, base) {
|
|
612
|
-
const notFound = join2(root, "404.html");
|
|
613
|
-
return async (req, res) => {
|
|
614
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
615
|
-
res.writeHead(405, { allow: "GET, HEAD" });
|
|
616
|
-
res.end();
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
const url = new URL(req.url ?? "/", "http://localhost");
|
|
620
|
-
const { pathname } = url;
|
|
621
|
-
if (base !== "/" && (pathname === "/" || pathname === base.slice(0, -1))) {
|
|
622
|
-
redirect(res, pathname === "/" ? 302 : 301, `${base}${url.search}`);
|
|
623
|
-
return;
|
|
624
|
-
}
|
|
625
|
-
const path = pathname.startsWith(base) ? inside(root, pathname.slice(base.length)) : void 0;
|
|
626
|
-
const kind = path === void 0 ? void 0 : await kindOf(path);
|
|
627
|
-
if (path !== void 0 && kind === "dir" && !pathname.endsWith("/")) {
|
|
628
|
-
redirect(res, 301, `${pathname}/${url.search}`);
|
|
629
|
-
return;
|
|
630
|
-
}
|
|
631
|
-
const file = path !== void 0 && kind === "dir" ? join2(path, "index.html") : path;
|
|
632
|
-
if (file !== void 0 && await kindOf(file) === "file") {
|
|
633
|
-
sendFile(req, res, file);
|
|
634
|
-
} else if (await kindOf(notFound) === "file") {
|
|
635
|
-
sendFile(req, res, notFound, 404);
|
|
636
|
-
} else {
|
|
637
|
-
res.writeHead(404, { "content-type": "text/plain; charset=utf-8" });
|
|
638
|
-
res.end("Not found\n");
|
|
639
|
-
}
|
|
640
|
-
};
|
|
641
|
-
}
|
|
642
|
-
function urlOf(host, port, base) {
|
|
643
|
-
const shown = host.includes(":") ? `[${host}]` : host;
|
|
644
|
-
return `http://${shown}:${String(port)}${base}`;
|
|
645
|
-
}
|
|
646
|
-
async function startStaticServer(opts) {
|
|
647
|
-
const root = resolve3(opts.root);
|
|
648
|
-
if (await kindOf(root) !== "dir") {
|
|
649
|
-
const shown = relative2(process.cwd(), root).split(sep).join("/") || ".";
|
|
650
|
-
throw new SiteError(`${shown}/ does not exist.`);
|
|
651
|
-
}
|
|
652
|
-
const base = normalizeBase(opts.base);
|
|
653
|
-
const handle = handler(root, base);
|
|
654
|
-
const server = createServer((req, res) => {
|
|
655
|
-
handle(req, res).catch(() => res.destroy());
|
|
656
|
-
});
|
|
657
|
-
await new Promise((settle, reject) => {
|
|
658
|
-
server.once("error", (err) => {
|
|
659
|
-
reject(
|
|
660
|
-
new SiteError(
|
|
661
|
-
err.code === "EADDRINUSE" ? `port ${String(opts.port)} is in use. Pass --port, or stop the process holding it.` : `cannot listen on ${urlOf(opts.host, opts.port, "")}: ${errorMessage(err)}`
|
|
662
|
-
)
|
|
663
|
-
);
|
|
664
|
-
});
|
|
665
|
-
server.listen(opts.port, opts.host, settle);
|
|
666
|
-
});
|
|
667
|
-
const { port } = server.address();
|
|
668
|
-
process.stdout.write(`${urlOf(opts.host, port, base)}
|
|
669
|
-
`);
|
|
670
|
-
return server;
|
|
671
|
-
}
|
|
672
|
-
async function serveStatic(opts) {
|
|
673
|
-
const server = await startStaticServer(opts);
|
|
674
|
-
await new Promise((settle) => {
|
|
675
|
-
const stop = () => {
|
|
676
|
-
process.off("SIGINT", stop);
|
|
677
|
-
process.off("SIGTERM", stop);
|
|
678
|
-
server.close(() => {
|
|
679
|
-
settle();
|
|
680
|
-
});
|
|
681
|
-
server.closeAllConnections();
|
|
682
|
-
};
|
|
683
|
-
process.on("SIGINT", stop);
|
|
684
|
-
process.on("SIGTERM", stop);
|
|
685
|
-
});
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// src/site/core/run.ts
|
|
689
|
-
function isExecutable(path) {
|
|
690
|
-
try {
|
|
691
|
-
if (!statSync2(path).isFile()) return false;
|
|
692
|
-
if (process.platform !== "win32") accessSync(path, constants.X_OK);
|
|
693
|
-
return true;
|
|
694
|
-
} catch {
|
|
695
|
-
return false;
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
function findOnPath(name, cwd) {
|
|
699
|
-
const win = process.platform === "win32";
|
|
700
|
-
const exts = win ? (process.env["PATHEXT"] ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((e) => e !== "") : [];
|
|
701
|
-
const lower = name.toLowerCase();
|
|
702
|
-
const names = win && !exts.some((e) => lower.endsWith(e.toLowerCase())) ? exts.map((e) => name + e) : [name];
|
|
703
|
-
const dirs = /[\\/]/.test(name) ? [cwd] : (process.env["PATH"] ?? "").split(delimiter).filter((d) => d !== "");
|
|
704
|
-
for (const dir of dirs) {
|
|
705
|
-
for (const candidate of names) {
|
|
706
|
-
const path = resolve4(dir, candidate);
|
|
707
|
-
if (isExecutable(path)) return path;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
return void 0;
|
|
711
|
-
}
|
|
712
|
-
function startExec(planned, step) {
|
|
713
|
-
const [name, ...args] = step.argv;
|
|
714
|
-
const binary = name === void 0 ? void 0 : findOnPath(name, step.cwd);
|
|
715
|
-
if (binary === void 0) throw new SiteError(planned.notFound);
|
|
716
|
-
const line = launcherCommandLine(
|
|
717
|
-
binary,
|
|
718
|
-
args,
|
|
719
|
-
(value) => new SiteError(`${planned.display} cannot be given an argument containing a quote: ${value}`)
|
|
720
|
-
);
|
|
721
|
-
return spawn(line.command, line.argv, {
|
|
722
|
-
cwd: step.cwd,
|
|
723
|
-
stdio: "inherit",
|
|
724
|
-
windowsVerbatimArguments: line.verbatim
|
|
725
|
-
});
|
|
726
|
-
}
|
|
727
|
-
function exitOf(planned, child) {
|
|
728
|
-
return new Promise((settle, reject) => {
|
|
729
|
-
child.once("error", (err) => {
|
|
730
|
-
reject(
|
|
731
|
-
err.code === "ENOENT" ? new SiteError(planned.notFound) : new SiteError(`${planned.display} could not start: ${err.message}`)
|
|
732
|
-
);
|
|
733
|
-
});
|
|
734
|
-
child.once("exit", (code, signal) => {
|
|
735
|
-
settle({ code, signal });
|
|
736
|
-
});
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
async function runStep(planned) {
|
|
740
|
-
const { step } = planned;
|
|
741
|
-
if (step.kind === "static") {
|
|
742
|
-
await serveStatic(step);
|
|
743
|
-
return true;
|
|
744
|
-
}
|
|
745
|
-
const child = step.kind === "exec" ? startExec(planned, step) : spawn(step.command, { cwd: step.cwd, stdio: "inherit", shell: true });
|
|
746
|
-
const signal = { received: false };
|
|
747
|
-
const onInt = () => {
|
|
748
|
-
signal.received = true;
|
|
749
|
-
};
|
|
750
|
-
const onTerm = () => {
|
|
751
|
-
signal.received = true;
|
|
752
|
-
child.kill("SIGTERM");
|
|
753
|
-
};
|
|
754
|
-
process.on("SIGINT", onInt);
|
|
755
|
-
process.on("SIGTERM", onTerm);
|
|
756
|
-
try {
|
|
757
|
-
const exit = await exitOf(planned, child);
|
|
758
|
-
if (signal.received) return true;
|
|
759
|
-
if (exit.code === 0) return false;
|
|
760
|
-
throw new SiteError(
|
|
761
|
-
exit.code === null ? `${planned.display} was stopped by ${String(exit.signal)}.` : `${planned.display} exited with code ${String(exit.code)}.`
|
|
762
|
-
);
|
|
763
|
-
} finally {
|
|
764
|
-
process.off("SIGINT", onInt);
|
|
765
|
-
process.off("SIGTERM", onTerm);
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
async function runPlan(plan) {
|
|
769
|
-
for (const planned of plan.steps) {
|
|
770
|
-
if (planned.announce !== "") notice(planned.announce);
|
|
771
|
-
if (await runStep(planned)) break;
|
|
772
|
-
}
|
|
773
|
-
return 0;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
// src/site/commands/run.ts
|
|
777
|
-
async function runSite(verb, opts) {
|
|
778
|
-
return runPlan(resolvePlan(verb, opts));
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
// src/site/cli.ts
|
|
782
|
-
function splitOperands(args) {
|
|
783
|
-
const at = process.argv.indexOf("--");
|
|
784
|
-
const tail = at === -1 ? [] : process.argv.slice(at + 1);
|
|
785
|
-
const start = args.length - tail.length;
|
|
786
|
-
const passthrough = start >= 0 && tail.every((arg, i) => args[start + i] === arg) ? tail : [];
|
|
787
|
-
const before = args.slice(0, args.length - passthrough.length);
|
|
788
|
-
return { dir: before[0], passthrough, extra: before.length };
|
|
789
|
-
}
|
|
790
|
-
function buildProgram() {
|
|
791
|
-
const program = new Command();
|
|
792
|
-
program.name("site").description("Start, build and preview the docs site").version(package_default.version, "-V, --version").showHelpAfterError("(add --help for usage)").exitOverride();
|
|
793
|
-
const verb = (name, description, serves) => {
|
|
794
|
-
const cmd = program.command(name).description(description).argument("[dir]", "the site's directory (default: site.dir, else found by search)").allowExcessArguments();
|
|
795
|
-
if (serves) {
|
|
796
|
-
cmd.option("--port <n>", "port, an integer from 1 to 65535 (default: a local collection url, else the framework's)").option("--host <host>", "host to bind (default: a local collection url, else the framework's)");
|
|
797
|
-
}
|
|
798
|
-
cmd.option("-c, --config <file>", "path to a manni config file").action(async (_dir, options, self) => {
|
|
799
|
-
const { dir, passthrough, extra } = splitOperands(self.args);
|
|
800
|
-
if (extra > 1) {
|
|
801
|
-
self.error(
|
|
802
|
-
`error: too many arguments for '${name}'. Expected 1 argument but got ${String(extra)}.`,
|
|
803
|
-
{ code: "commander.excessArguments" }
|
|
804
|
-
);
|
|
805
|
-
}
|
|
806
|
-
try {
|
|
807
|
-
process.exitCode = await runSite(name, {
|
|
808
|
-
cwd: process.cwd(),
|
|
809
|
-
dir,
|
|
810
|
-
configPath: options.config,
|
|
811
|
-
port: options.port,
|
|
812
|
-
host: options.host,
|
|
813
|
-
passthrough
|
|
814
|
-
});
|
|
815
|
-
} catch (err) {
|
|
816
|
-
fail(err);
|
|
817
|
-
}
|
|
818
|
-
});
|
|
819
|
-
};
|
|
820
|
-
verb("start", "Run the docs framework's dev server", true);
|
|
821
|
-
verb("build", "Build the docs site", false);
|
|
822
|
-
verb("preview", "Build the docs site, then serve the output", true);
|
|
823
|
-
program.addHelpText(
|
|
824
|
-
"after",
|
|
825
|
-
[
|
|
826
|
-
"",
|
|
827
|
-
"Examples:",
|
|
828
|
-
" manni site start # detect the framework, run its dev server",
|
|
829
|
-
" manni site build",
|
|
830
|
-
" manni site preview --port 4000 # build, then serve the output",
|
|
831
|
-
" manni site start website -- --open # arguments after -- go to the framework"
|
|
832
|
-
].join("\n")
|
|
833
|
-
);
|
|
834
|
-
return program;
|
|
835
|
-
}
|
|
836
600
|
export {
|
|
837
|
-
|
|
601
|
+
SiteError,
|
|
602
|
+
loadSiteConfig,
|
|
603
|
+
detectFramework,
|
|
604
|
+
resolveAnnotateSite,
|
|
605
|
+
resolvePlan
|
|
838
606
|
};
|
|
839
|
-
//# sourceMappingURL=
|
|
607
|
+
//# sourceMappingURL=chunk-245W2Q7C.js.map
|