markshelf 0.1.5 → 0.2.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/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +3 -3
- package/.next/standalone/.next/routes-manifest.json +6 -0
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/asset/route/app-paths-manifest.json +3 -0
- package/.next/standalone/.next/server/app/api/asset/route/build-manifest.json +9 -0
- package/.next/standalone/.next/server/app/api/asset/route/server-reference-manifest.json +4 -0
- package/.next/standalone/.next/server/app/api/asset/route.js +7 -0
- package/.next/standalone/.next/server/app/api/asset/route.js.map +5 -0
- package/.next/standalone/.next/server/app/api/asset/route.js.nft.json +1 -0
- package/.next/standalone/.next/server/app/api/asset/route_client-reference-manifest.js +3 -0
- package/.next/standalone/.next/server/app/api/diff/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/graph/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/timeline/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/tree/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0-_k816._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__01e7zo7._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__04mxfkc._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__053gm34._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0d.-s5p._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0nr71d2._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0rwylex._.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__13vatcq._.js +1 -1
- package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_asset_route_actions_03nkw38.js +3 -0
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09qrkq5._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__11e9~iq._.js → [root-of-the-server]__0u7hi3-._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_08z1b9i._.js → node_modules_035nqw0._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_0u-.0s2._.js → node_modules_0_lpyzd._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_0vqo_80._.js → node_modules_0d0g.gp._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_0~k33bz._.js → node_modules_0m258l0._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_10a06qi._.js → node_modules_0sxu8tl._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_0xmn29o._.js → node_modules_0ub-k6d._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_0f-9xhq._.js → node_modules_0uebmgu._.js} +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{node_modules_02chd8n._.js → node_modules_0~vmgv6._.js} +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/static/chunks/{0wy.nfhujao0b.js → 0.z3b.-~oogkw.js} +3 -3
- package/.next/standalone/.next/static/chunks/{0b42--.p9znhl.css → 13tjphiswda64.css} +1 -1
- package/.next/standalone/Dockerfile +54 -0
- package/.next/standalone/LICENSE +21 -0
- package/.next/standalone/README.md +71 -21
- package/.next/standalone/docker/README.md +65 -0
- package/.next/standalone/docker-entrypoint.sh +40 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC1-CLI/README.md +6 -1
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC1-CLI/SPEC1.2-Dockerfile.md +18 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC1-CLI/SPEC1.3-basePath.md +11 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC1-CLI/SPEC1.4-/347/222/260/345/242/203/345/244/211/346/225/260.md +14 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC2-/343/202/260/343/203/251/343/203/225/346/217/217/347/224/273/SPEC2.3-/343/203/252/343/203/263/343/202/257/350/247/243/346/236/220.md +32 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/README.md +10 -1
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.3-TableOfContents.md +11 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.4-DetailPanel/343/202/277/343/203/226.md +13 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.5-Markdown/343/203/254/343/203/263/343/203/200/343/203/252/343/203/263/343/202/260.md +22 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.6-SearchBar.md +15 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.7-/343/203/221/343/203/215/343/203/253/343/203/252/343/202/265/343/202/244/343/202/266/343/203/274.md +11 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC3-UI/343/202/263/343/203/263/343/203/235/343/203/274/343/203/215/343/203/263/343/203/210/SPEC3.8-/347/224/273/345/203/217/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274.md +11 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/README.md +12 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.1-tree.md +23 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.2-file.md +14 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.3-search.md +23 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.4-watch.md +17 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.5-history.md +22 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.6-timeline.md +26 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.7-diff.md +13 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC4-API/SPEC4.8-asset.md +22 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC5-/346/260/270/347/266/232/345/214/226/README.md +8 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC5-/346/260/270/347/266/232/345/214/226/SPEC5.1-localStorage.md +20 -0
- package/.next/standalone/docs//344/273/225/346/247/230/SPEC5-/346/260/270/347/266/232/345/214/226/SPEC5.2-URL/343/202/257/343/202/250/343/203/252.md +17 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ1-/343/203/223/343/203/245/343/203/274/343/202/242/350/265/267/345/213/225/README.md +3 -1
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ1-/343/203/223/343/203/245/343/203/274/343/202/242/350/265/267/345/213/225/REQ1.2-Docker/350/265/267/345/213/225.md +14 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ1-/343/203/223/343/203/245/343/203/274/343/202/242/350/265/267/345/213/225/REQ1.3-BASE_PATH/351/205/215/344/277/241.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ3-/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274/343/201/250/343/203/204/343/203/252/343/203/274/README.md +2 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ3-/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274/343/201/250/343/203/204/343/203/252/343/203/274/REQ3.3-/347/233/256/346/254/241.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ3-/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274/343/201/250/343/203/204/343/203/252/343/203/274/REQ3.4-/343/203/221/343/203/215/343/203/253/343/203/252/343/202/265/343/202/244/343/202/266/343/203/274.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ3-/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274/343/201/250/343/203/204/343/203/252/343/203/274/REQ3.5-/343/202/277/343/203/226/343/202/267/343/202/271/343/203/206/343/203/240.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ3-/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274/343/201/250/343/203/204/343/203/252/343/203/274/REQ3.6-/347/224/273/345/203/217/343/203/227/343/203/254/343/203/223/343/203/245/343/203/274.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ4-/343/203/212/343/203/223/343/202/262/343/203/274/343/202/267/343/203/247/343/203/263/README.md +1 -1
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ4-/343/203/212/343/203/223/343/202/262/343/203/274/343/202/267/343/203/247/343/203/263/REQ4.2-/345/205/261/346/234/211/345/217/257/350/203/275URL.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ5-/343/203/225/343/202/241/343/202/244/343/203/253/346/244/234/347/264/242/README.md +3 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ5-/343/203/225/343/202/241/343/202/244/343/203/253/346/244/234/347/264/242/REQ5.1-/343/203/225/343/202/241/343/202/244/343/203/253/345/220/215/346/244/234/347/264/242.md +11 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ6-/343/203/225/343/202/241/343/202/244/343/203/253/347/233/243/350/246/226/README.md +3 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ6-/343/203/225/343/202/241/343/202/244/343/203/253/347/233/243/350/246/226/REQ6.1-SSE/345/244/211/346/233/264/351/200/232/347/237/245.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ7-/345/244/211/346/233/264/345/261/245/346/255/264/README.md +3 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ7-/345/244/211/346/233/264/345/261/245/346/255/264/REQ7.1-/343/203/225/343/202/241/343/202/244/343/203/253/345/244/211/346/233/264/345/261/245/346/255/264.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ7-/345/244/211/346/233/264/345/261/245/346/255/264/REQ7.2-/343/202/277/343/202/244/343/203/240/343/203/251/343/202/244/343/203/263.md +10 -0
- package/.next/standalone/docs//350/246/201/344/273/266/345/256/232/347/276/251/REQ7-/345/244/211/346/233/264/345/261/245/346/255/264/REQ7.3-diff/350/241/250/347/244/272.md +10 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R1-/343/203/211/343/202/255/343/203/245/343/203/241/343/203/263/343/203/210/351/226/262/350/246/247/346/200/247/R1.4-/344/277/235/345/255/230/345/215/263/345/217/215/346/230/240.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R1-/343/203/211/343/202/255/343/203/245/343/203/241/343/203/263/343/203/210/351/226/262/350/246/247/346/200/247/R1.5-/345/205/261/346/234/211/345/217/257/350/203/275URL.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R4-/345/244/211/346/233/264/345/261/245/346/255/264/343/201/256/346/212/212/346/217/241/R4.1-/345/244/211/346/233/264/345/206/205/345/256/271/343/201/256/350/277/275/350/267/241.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R4-/345/244/211/346/233/264/345/261/245/346/255/264/343/201/256/346/212/212/346/217/241/R4.2-/345/275/261/351/237/277/347/257/204/345/233/262/343/201/256/344/277/257/347/236/260.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R4-/345/244/211/346/233/264/345/261/245/346/255/264/343/201/256/346/212/212/346/217/241/README.md +7 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R5-/343/203/211/343/202/255/343/203/245/343/203/241/343/203/263/343/203/210/346/216/242/347/264/242/346/200/247/R5.1-/343/203/225/343/202/241/343/202/244/343/203/253/345/220/215/346/244/234/347/264/242.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R5-/343/203/211/343/202/255/343/203/245/343/203/241/343/203/263/343/203/210/346/216/242/347/264/242/346/200/247/README.md +7 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R6-/343/203/207/343/203/227/343/203/255/343/202/244/346/237/224/350/273/237/346/200/247/R6.1-Docker/351/205/215/344/277/241.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R6-/343/203/207/343/203/227/343/203/255/343/202/244/346/237/224/350/273/237/346/200/247/R6.2-/343/202/265/343/203/226/343/203/221/343/202/271/351/205/215/344/277/241.md +9 -0
- package/.next/standalone/docs//350/246/201/346/261/202/345/256/232/347/276/251/R6-/343/203/207/343/203/227/343/203/255/343/202/244/346/237/224/350/273/237/346/200/247/README.md +7 -0
- package/.next/standalone/next.config.ts +7 -0
- package/.next/standalone/package.json +23 -1
- package/.next/standalone/scripts/docker-run.mjs +24 -0
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/src/app/api/asset/route.ts +40 -0
- package/.next/standalone/src/app/page.tsx +31 -1
- package/.next/standalone/src/components/DetailPanel.tsx +2 -1
- package/.next/standalone/src/components/DiffView.tsx +2 -1
- package/.next/standalone/src/components/HistoryPanel.tsx +2 -1
- package/.next/standalone/src/components/LinkGraph.tsx +2 -1
- package/.next/standalone/src/components/Markdown.tsx +68 -3
- package/.next/standalone/src/components/PreviewPopup.tsx +2 -1
- package/.next/standalone/src/components/SearchBar.tsx +2 -1
- package/.next/standalone/src/components/TimelinePanel.tsx +2 -1
- package/.next/standalone/src/lib/basePath.ts +8 -0
- package/.next/standalone/src/lib/docs.ts +12 -0
- package/.next/standalone/src/lib/useRefreshTick.ts +2 -1
- package/.next/standalone/tsconfig.tsbuildinfo +1 -1
- package/.next/static/chunks/{0wy.nfhujao0b.js → 0.z3b.-~oogkw.js} +3 -3
- package/.next/static/chunks/{0b42--.p9znhl.css → 13tjphiswda64.css} +1 -1
- package/LICENSE +21 -0
- package/README.md +71 -21
- package/package.json +23 -1
- /package/.next/standalone/.next/static/{pOQs5i4GMjDH6W5XDSjRs → JZXBFyFBzt6ffFpnmO9cB}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{pOQs5i4GMjDH6W5XDSjRs → JZXBFyFBzt6ffFpnmO9cB}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{pOQs5i4GMjDH6W5XDSjRs → JZXBFyFBzt6ffFpnmO9cB}/_ssgManifest.js +0 -0
- /package/.next/static/{pOQs5i4GMjDH6W5XDSjRs → JZXBFyFBzt6ffFpnmO9cB}/_buildManifest.js +0 -0
- /package/.next/static/{pOQs5i4GMjDH6W5XDSjRs → JZXBFyFBzt6ffFpnmO9cB}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{pOQs5i4GMjDH6W5XDSjRs → JZXBFyFBzt6ffFpnmO9cB}/_ssgManifest.js +0 -0
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { NextConfig } from "next";
|
|
2
2
|
|
|
3
|
+
const rawBasePath = process.env.NEXT_PUBLIC_BASE_PATH?.trim();
|
|
4
|
+
const basePath =
|
|
5
|
+
rawBasePath && rawBasePath !== "/" && rawBasePath !== ""
|
|
6
|
+
? rawBasePath.replace(/\/$/, "")
|
|
7
|
+
: undefined;
|
|
8
|
+
|
|
3
9
|
const nextConfig: NextConfig = {
|
|
4
10
|
output: "standalone",
|
|
11
|
+
...(basePath ? { basePath } : {}),
|
|
5
12
|
};
|
|
6
13
|
|
|
7
14
|
export default nextConfig;
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markshelf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Structured markdown viewer for git repositories",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": "sksp.work",
|
|
7
|
+
"homepage": "https://github.com/skspwork/markshelf#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/skspwork/markshelf.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/skspwork/markshelf/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"markdown",
|
|
17
|
+
"viewer",
|
|
18
|
+
"docs",
|
|
19
|
+
"documentation",
|
|
20
|
+
"git",
|
|
21
|
+
"nextjs",
|
|
22
|
+
"graph",
|
|
23
|
+
"knowledge-base",
|
|
24
|
+
"oss"
|
|
25
|
+
],
|
|
6
26
|
"bin": {
|
|
7
27
|
"markshelf": "./bin/cli.mjs"
|
|
8
28
|
},
|
|
@@ -16,6 +36,8 @@
|
|
|
16
36
|
"dev": "next dev --hostname 0.0.0.0",
|
|
17
37
|
"build": "next build && node scripts/pack-static.mjs",
|
|
18
38
|
"start": "next start",
|
|
39
|
+
"docker:build": "docker build -t markshelf-base .",
|
|
40
|
+
"docker:run": "node scripts/docker-run.mjs",
|
|
19
41
|
"prepublishOnly": "npm run build"
|
|
20
42
|
},
|
|
21
43
|
"dependencies": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Cross-platform wrapper for `docker run` so $PWD / %cd% differences don't bite us.
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
const docsPath = path.resolve(process.cwd(), "docs");
|
|
7
|
+
|
|
8
|
+
const args = [
|
|
9
|
+
"run",
|
|
10
|
+
"--rm",
|
|
11
|
+
"-p",
|
|
12
|
+
"3000:3000",
|
|
13
|
+
"-v",
|
|
14
|
+
`${docsPath}:/docs`,
|
|
15
|
+
...process.argv.slice(2),
|
|
16
|
+
"markshelf-base",
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const child = spawn("docker", args, { stdio: "inherit" });
|
|
20
|
+
child.on("exit", (code) => process.exit(code ?? 1));
|
|
21
|
+
child.on("error", (err) => {
|
|
22
|
+
console.error("[docker-run] failed to spawn docker:", err.message);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
});
|
|
@@ -9,7 +9,7 @@ const currentPort = parseInt(process.env.PORT, 10) || 3000
|
|
|
9
9
|
const hostname = process.env.HOSTNAME || '0.0.0.0'
|
|
10
10
|
|
|
11
11
|
let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10)
|
|
12
|
-
const nextConfig = {"env":{},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.ts","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":false,"customCacheHandler":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{"serverFunctions":true,"browserToTerminal":"warn"},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"C:\\sksp\\
|
|
12
|
+
const nextConfig = {"env":{},"webpack":null,"typescript":{"ignoreBuildErrors":false},"typedRoutes":false,"distDir":"./.next","cleanDistDir":true,"assetPrefix":"","cacheMaxMemorySize":52428800,"configOrigin":"next.config.ts","useFileSystemPublicRoutes":true,"generateEtags":true,"pageExtensions":["tsx","ts","jsx","js"],"poweredByHeader":true,"compress":true,"images":{"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","loaderFile":"","domains":[],"disableStaticImages":false,"minimumCacheTTL":14400,"formats":["image/webp"],"maximumRedirects":3,"maximumResponseBody":50000000,"dangerouslyAllowLocalIP":false,"dangerouslyAllowSVG":false,"contentSecurityPolicy":"script-src 'none'; frame-src 'none'; sandbox;","contentDispositionType":"attachment","localPatterns":[{"pathname":"**","search":""}],"remotePatterns":[],"qualities":[75],"unoptimized":false,"customCacheHandler":false},"devIndicators":{"position":"bottom-left"},"onDemandEntries":{"maxInactiveAge":60000,"pagesBufferLength":5},"basePath":"","sassOptions":{},"trailingSlash":false,"i18n":null,"productionBrowserSourceMaps":false,"excludeDefaultMomentLocales":true,"reactProductionProfiling":false,"reactStrictMode":null,"reactMaxHeadersLength":6000,"httpAgentOptions":{"keepAlive":true},"logging":{"serverFunctions":true,"browserToTerminal":"warn"},"compiler":{},"expireTime":31536000,"staticPageGenerationTimeout":60,"output":"standalone","modularizeImports":{"@mui/icons-material":{"transform":"@mui/icons-material/{{member}}"},"lodash":{"transform":"lodash/{{member}}"}},"outputFileTracingRoot":"C:\\sksp\\markshelf","cacheComponents":false,"cacheLife":{"default":{"stale":300,"revalidate":900,"expire":4294967294},"seconds":{"stale":30,"revalidate":1,"expire":60},"minutes":{"stale":300,"revalidate":60,"expire":3600},"hours":{"stale":300,"revalidate":3600,"expire":86400},"days":{"stale":300,"revalidate":86400,"expire":604800},"weeks":{"stale":300,"revalidate":604800,"expire":2592000},"max":{"stale":300,"revalidate":2592000,"expire":31536000}},"cacheHandlers":{},"experimental":{"appNewScrollHandler":false,"useSkewCookie":false,"cssChunking":true,"multiZoneDraftMode":false,"appNavFailHandling":false,"prerenderEarlyExit":true,"serverMinification":true,"linkNoTouchStart":false,"caseSensitiveRoutes":false,"cachedNavigations":false,"partialFallbacks":false,"dynamicOnHover":false,"varyParams":false,"prefetchInlining":false,"preloadEntriesOnStart":true,"clientRouterFilter":true,"clientRouterFilterRedirects":false,"fetchCacheKeyPrefix":"","proxyPrefetch":"flexible","optimisticClientCache":true,"manualClientBasePath":false,"cpus":7,"memoryBasedWorkersCount":false,"imgOptConcurrency":null,"imgOptTimeoutInSeconds":7,"imgOptMaxInputPixels":268402689,"imgOptSequentialRead":null,"imgOptSkipMetadata":null,"isrFlushToDisk":true,"workerThreads":false,"optimizeCss":false,"nextScriptWorkers":false,"scrollRestoration":false,"externalDir":false,"disableOptimizedLoading":false,"gzipSize":true,"craCompat":false,"esmExternals":true,"fullySpecified":false,"swcTraceProfiling":false,"forceSwcTransforms":false,"largePageDataBytes":128000,"typedEnv":false,"parallelServerCompiles":false,"parallelServerBuildTraces":false,"ppr":false,"authInterrupts":false,"webpackMemoryOptimizations":false,"optimizeServerReact":true,"strictRouteTypes":false,"viewTransition":false,"removeUncaughtErrorAndRejectionListeners":false,"validateRSCRequestHeaders":false,"staleTimes":{"dynamic":0,"static":300},"reactDebugChannel":true,"serverComponentsHmrCache":true,"staticGenerationMaxConcurrency":8,"staticGenerationMinPagesPerWorker":25,"transitionIndicator":false,"gestureTransition":false,"inlineCss":false,"useCache":false,"globalNotFound":false,"browserDebugInfoInTerminal":"warn","lockDistDir":true,"proxyClientMaxBodySize":10485760,"hideLogsAfterAbort":false,"mcpServer":true,"turbopackFileSystemCacheForDev":true,"turbopackFileSystemCacheForBuild":false,"turbopackInferModuleSideEffects":true,"turbopackPluginRuntimeStrategy":"childProcesses","optimizePackageImports":["lucide-react","date-fns","lodash-es","ramda","antd","react-bootstrap","ahooks","@ant-design/icons","@headlessui/react","@headlessui-float/react","@heroicons/react/20/solid","@heroicons/react/24/solid","@heroicons/react/24/outline","@visx/visx","@tremor/react","rxjs","@mui/material","@mui/icons-material","recharts","react-use","effect","@effect/schema","@effect/platform","@effect/platform-node","@effect/platform-browser","@effect/platform-bun","@effect/sql","@effect/sql-mssql","@effect/sql-mysql2","@effect/sql-pg","@effect/sql-sqlite-node","@effect/sql-sqlite-bun","@effect/sql-sqlite-wasm","@effect/sql-sqlite-react-native","@effect/rpc","@effect/rpc-http","@effect/typeclass","@effect/experimental","@effect/opentelemetry","@material-ui/core","@material-ui/icons","@tabler/icons-react","mui-core","react-icons/ai","react-icons/bi","react-icons/bs","react-icons/cg","react-icons/ci","react-icons/di","react-icons/fa","react-icons/fa6","react-icons/fc","react-icons/fi","react-icons/gi","react-icons/go","react-icons/gr","react-icons/hi","react-icons/hi2","react-icons/im","react-icons/io","react-icons/io5","react-icons/lia","react-icons/lib","react-icons/lu","react-icons/md","react-icons/pi","react-icons/ri","react-icons/rx","react-icons/si","react-icons/sl","react-icons/tb","react-icons/tfi","react-icons/ti","react-icons/vsc","react-icons/wi"],"trustHostHeader":false,"isExperimentalCompile":false},"htmlLimitedBots":"[\\w-]+-Google|Google-[\\w-]+|Chrome-Lighthouse|Slurp|DuckDuckBot|baiduspider|yandex|sogou|bitlybot|tumblr|vkShare|quora link preview|redditbot|ia_archiver|Bingbot|BingPreview|applebot|facebookexternalhit|facebookcatalog|Twitterbot|LinkedInBot|Slackbot|Discordbot|WhatsApp|SkypeUriPreview|Yeti|googleweblight","bundlePagesRouterDependencies":false,"configFileName":"next.config.ts","turbopack":{"root":"C:\\sksp\\markshelf"},"distDirRoot":".next"}
|
|
13
13
|
|
|
14
14
|
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(nextConfig)
|
|
15
15
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
2
|
+
import { readAsset } from "@/lib/docs";
|
|
3
|
+
|
|
4
|
+
const MIME: Record<string, string> = {
|
|
5
|
+
".png": "image/png",
|
|
6
|
+
".jpg": "image/jpeg",
|
|
7
|
+
".jpeg": "image/jpeg",
|
|
8
|
+
".gif": "image/gif",
|
|
9
|
+
".svg": "image/svg+xml",
|
|
10
|
+
".webp": "image/webp",
|
|
11
|
+
".avif": "image/avif",
|
|
12
|
+
".ico": "image/x-icon",
|
|
13
|
+
".bmp": "image/bmp",
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export async function GET(req: NextRequest) {
|
|
17
|
+
const filePath = req.nextUrl.searchParams.get("path");
|
|
18
|
+
if (!filePath) {
|
|
19
|
+
return NextResponse.json({ error: "path required" }, { status: 400 });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const dot = filePath.lastIndexOf(".");
|
|
23
|
+
const ext = dot >= 0 ? filePath.slice(dot).toLowerCase() : "";
|
|
24
|
+
const contentType = MIME[ext];
|
|
25
|
+
if (!contentType) {
|
|
26
|
+
return NextResponse.json({ error: "unsupported media type" }, { status: 415 });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const data = readAsset(filePath);
|
|
30
|
+
if (!data) {
|
|
31
|
+
return NextResponse.json({ error: "not found" }, { status: 404 });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return new NextResponse(new Uint8Array(data), {
|
|
35
|
+
headers: {
|
|
36
|
+
"Content-Type": contentType,
|
|
37
|
+
"Cache-Control": "no-cache",
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
@@ -6,6 +6,7 @@ import { DetailPanel } from "@/components/DetailPanel";
|
|
|
6
6
|
import { SearchBar } from "@/components/SearchBar";
|
|
7
7
|
import { TimelinePanel } from "@/components/TimelinePanel";
|
|
8
8
|
import { useRefreshTick } from "@/lib/useRefreshTick";
|
|
9
|
+
import { withBasePath } from "@/lib/basePath";
|
|
9
10
|
import { Clock } from "lucide-react";
|
|
10
11
|
|
|
11
12
|
interface TreeEntry {
|
|
@@ -17,6 +18,14 @@ interface TreeEntry {
|
|
|
17
18
|
hasReadme?: boolean;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
const FILE_QUERY_KEY = "file";
|
|
22
|
+
|
|
23
|
+
function readFileFromUrl(): string | null {
|
|
24
|
+
if (typeof window === "undefined") return null;
|
|
25
|
+
const v = new URL(window.location.href).searchParams.get(FILE_QUERY_KEY);
|
|
26
|
+
return v ? decodeURIComponent(v) : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
20
29
|
export default function Home() {
|
|
21
30
|
const [tree, setTree] = useState<TreeEntry[]>([]);
|
|
22
31
|
const [root, setRoot] = useState<string>("");
|
|
@@ -26,6 +35,27 @@ export default function Home() {
|
|
|
26
35
|
const [backStack, setBackStack] = useState<string[]>([]);
|
|
27
36
|
const [forwardStack, setForwardStack] = useState<string[]>([]);
|
|
28
37
|
|
|
38
|
+
// Initial hydration from URL (?file=...)
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const fromUrl = readFileFromUrl();
|
|
41
|
+
if (fromUrl) setSelectedPath(fromUrl);
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
// Keep URL in sync with selectedPath (shareable links)
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
if (typeof window === "undefined") return;
|
|
47
|
+
const url = new URL(window.location.href);
|
|
48
|
+
if (selectedPath) {
|
|
49
|
+
url.searchParams.set(FILE_QUERY_KEY, selectedPath);
|
|
50
|
+
} else {
|
|
51
|
+
url.searchParams.delete(FILE_QUERY_KEY);
|
|
52
|
+
}
|
|
53
|
+
const next = url.pathname + (url.search ? url.search : "") + url.hash;
|
|
54
|
+
if (next !== window.location.pathname + window.location.search + window.location.hash) {
|
|
55
|
+
window.history.replaceState(null, "", next);
|
|
56
|
+
}
|
|
57
|
+
}, [selectedPath]);
|
|
58
|
+
|
|
29
59
|
const navigateTo = useCallback((path: string | null) => {
|
|
30
60
|
if (selectedPath && path !== selectedPath) {
|
|
31
61
|
setBackStack((s) => [...s, selectedPath]);
|
|
@@ -55,7 +85,7 @@ export default function Home() {
|
|
|
55
85
|
const refreshTick = useRefreshTick();
|
|
56
86
|
|
|
57
87
|
useEffect(() => {
|
|
58
|
-
fetch("/api/tree")
|
|
88
|
+
fetch(withBasePath("/api/tree"))
|
|
59
89
|
.then((r) => r.json())
|
|
60
90
|
.then((data) => {
|
|
61
91
|
setTree(data.tree ?? []);
|
|
@@ -7,6 +7,7 @@ import { TableOfContents, HeadingInfo } from "./TableOfContents";
|
|
|
7
7
|
import { PreviewPopup } from "./PreviewPopup";
|
|
8
8
|
import { LinkGraph } from "./LinkGraph";
|
|
9
9
|
import { useRefreshTick } from "@/lib/useRefreshTick";
|
|
10
|
+
import { withBasePath } from "@/lib/basePath";
|
|
10
11
|
import { FileText, History, Network, ArrowLeft, ArrowRight } from "lucide-react";
|
|
11
12
|
|
|
12
13
|
interface FolderInfo {
|
|
@@ -57,7 +58,7 @@ export function DetailPanel({ filePath, fileRefs, folders, onNavigate, onGoBack,
|
|
|
57
58
|
}, [filePath]);
|
|
58
59
|
|
|
59
60
|
useEffect(() => {
|
|
60
|
-
fetch(`/api/file?path=${encodeURIComponent(filePath)}`)
|
|
61
|
+
fetch(withBasePath(`/api/file?path=${encodeURIComponent(filePath)}`))
|
|
61
62
|
.then((r) => r.json())
|
|
62
63
|
.then((data) => setContent(data.content ?? null))
|
|
63
64
|
.catch(() => setContent(null));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
+
import { withBasePath } from "@/lib/basePath";
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
filePath: string;
|
|
@@ -12,7 +13,7 @@ export function DiffView({ filePath, hash }: Props) {
|
|
|
12
13
|
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
setDiff(null);
|
|
15
|
-
fetch(`/api/diff?path=${encodeURIComponent(filePath)}&hash=${hash}`)
|
|
16
|
+
fetch(withBasePath(`/api/diff?path=${encodeURIComponent(filePath)}&hash=${hash}`))
|
|
16
17
|
.then((r) => r.json())
|
|
17
18
|
.then((data) => setDiff(data.diff))
|
|
18
19
|
.catch(() => setDiff("(差分を取得できませんでした)"));
|
|
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
|
|
|
4
4
|
import { GitCommit, ChevronDown, ChevronRight } from "lucide-react";
|
|
5
5
|
import { DiffView } from "./DiffView";
|
|
6
6
|
import { useRefreshTick } from "@/lib/useRefreshTick";
|
|
7
|
+
import { withBasePath } from "@/lib/basePath";
|
|
7
8
|
|
|
8
9
|
interface CommitEntry {
|
|
9
10
|
hash: string;
|
|
@@ -26,7 +27,7 @@ export function HistoryPanel({ filePath }: Props) {
|
|
|
26
27
|
useEffect(() => {
|
|
27
28
|
setLoading(true);
|
|
28
29
|
setExpandedHash(null);
|
|
29
|
-
fetch(`/api/history?path=${encodeURIComponent(filePath)}`)
|
|
30
|
+
fetch(withBasePath(`/api/history?path=${encodeURIComponent(filePath)}`))
|
|
30
31
|
.then((r) => r.json())
|
|
31
32
|
.then((data) => {
|
|
32
33
|
setHistory(data);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import cytoscape from "cytoscape";
|
|
5
5
|
import { useRefreshTick } from "@/lib/useRefreshTick";
|
|
6
|
+
import { withBasePath } from "@/lib/basePath";
|
|
6
7
|
import { Filter } from "lucide-react";
|
|
7
8
|
|
|
8
9
|
interface GraphNode {
|
|
@@ -124,7 +125,7 @@ export function LinkGraph({ currentPath, folders, onNavigate, onPreviewShow, onP
|
|
|
124
125
|
setEmpty(false);
|
|
125
126
|
setReady(false);
|
|
126
127
|
|
|
127
|
-
fetch("/api/graph")
|
|
128
|
+
fetch(withBasePath("/api/graph"))
|
|
128
129
|
.then((r) => r.json())
|
|
129
130
|
.then((data: { nodes: GraphNode[]; edges: GraphEdge[] }) => {
|
|
130
131
|
if (cancelled || !containerRef.current) return;
|
|
@@ -5,6 +5,7 @@ import ReactMarkdown, { Components } from "react-markdown";
|
|
|
5
5
|
import remarkGfm from "remark-gfm";
|
|
6
6
|
import type { HeadingInfo } from "./TableOfContents";
|
|
7
7
|
import { MermaidBlock } from "./MermaidBlock";
|
|
8
|
+
import { withBasePath } from "@/lib/basePath";
|
|
8
9
|
|
|
9
10
|
export interface FileRef {
|
|
10
11
|
displayName: string;
|
|
@@ -34,9 +35,25 @@ function slugify(text: string): string {
|
|
|
34
35
|
function parseHeadings(markdown: string): HeadingInfo[] {
|
|
35
36
|
const headings: HeadingInfo[] = [];
|
|
36
37
|
const seen = new Map<string, number>();
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const headingRe = /^(#{1,4})\s+(.+)$/;
|
|
39
|
+
const fenceRe = /^[ \t]*(`{3,}|~{3,})/;
|
|
40
|
+
let fence: string | null = null;
|
|
41
|
+
for (const line of markdown.split("\n")) {
|
|
42
|
+
const fenceMatch = fenceRe.exec(line);
|
|
43
|
+
if (fenceMatch) {
|
|
44
|
+
const marker = fenceMatch[1][0];
|
|
45
|
+
if (fence === null) {
|
|
46
|
+
fence = marker;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (fenceMatch[1].startsWith(fence)) {
|
|
50
|
+
fence = null;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (fence !== null) continue;
|
|
55
|
+
const m = headingRe.exec(line);
|
|
56
|
+
if (!m) continue;
|
|
40
57
|
const level = m[1].length;
|
|
41
58
|
const text = m[2].replace(/[#*_`[\]]/g, "").trim();
|
|
42
59
|
const base = slugify(text) || "heading";
|
|
@@ -147,6 +164,43 @@ export function Markdown({
|
|
|
147
164
|
return null;
|
|
148
165
|
}
|
|
149
166
|
|
|
167
|
+
function resolveAssetPath(src: string): string | null {
|
|
168
|
+
const cleanUrl = src.split("#")[0].split("?")[0].trim();
|
|
169
|
+
if (!cleanUrl) return null;
|
|
170
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(cleanUrl)) return null;
|
|
171
|
+
if (cleanUrl.startsWith("//")) return null;
|
|
172
|
+
|
|
173
|
+
let decoded: string;
|
|
174
|
+
try {
|
|
175
|
+
decoded = decodeURI(cleanUrl);
|
|
176
|
+
} catch {
|
|
177
|
+
decoded = cleanUrl;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const currentDir =
|
|
181
|
+
currentPath && currentPath.includes("/")
|
|
182
|
+
? currentPath.slice(0, currentPath.lastIndexOf("/"))
|
|
183
|
+
: "";
|
|
184
|
+
const joined = decoded.startsWith("/")
|
|
185
|
+
? decoded.slice(1)
|
|
186
|
+
: currentDir
|
|
187
|
+
? currentDir + "/" + decoded
|
|
188
|
+
: decoded;
|
|
189
|
+
|
|
190
|
+
const parts = joined.split("/");
|
|
191
|
+
const normalized: string[] = [];
|
|
192
|
+
for (const p of parts) {
|
|
193
|
+
if (p === "" || p === ".") continue;
|
|
194
|
+
if (p === "..") {
|
|
195
|
+
normalized.pop();
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
normalized.push(p);
|
|
199
|
+
}
|
|
200
|
+
const resolved = normalized.join("/");
|
|
201
|
+
return resolved || null;
|
|
202
|
+
}
|
|
203
|
+
|
|
150
204
|
function getIdForHeading(text: string): string {
|
|
151
205
|
const ids = headingIdMap.get(text);
|
|
152
206
|
if (!ids) return slugify(text) || "heading";
|
|
@@ -232,6 +286,17 @@ export function Markdown({
|
|
|
232
286
|
}
|
|
233
287
|
return <a href={href} {...rest}>{linkChildren}</a>;
|
|
234
288
|
},
|
|
289
|
+
// Images: rewrite relative src to the asset API so files under DOCS_ROOT
|
|
290
|
+
// are reachable; leave absolute, data:, and protocol-relative URLs alone.
|
|
291
|
+
img: ({ src, alt, ...rest }) => {
|
|
292
|
+
if (typeof src !== "string") {
|
|
293
|
+
return <img src={src as string | undefined} alt={alt} {...rest} />;
|
|
294
|
+
}
|
|
295
|
+
const resolved = resolveAssetPath(src);
|
|
296
|
+
if (!resolved) return <img src={src} alt={alt} {...rest} />;
|
|
297
|
+
const apiSrc = withBasePath(`/api/asset?path=${encodeURIComponent(resolved)}`);
|
|
298
|
+
return <img src={apiSrc} alt={alt} {...rest} />;
|
|
299
|
+
},
|
|
235
300
|
// Inject auto-links into text content
|
|
236
301
|
p: ({ children: pChildren, ...rest }) => {
|
|
237
302
|
return <p {...rest}>{processAutolinks(pChildren)}</p>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useEffect, useState, useRef, useCallback } from "react";
|
|
4
4
|
import { Markdown, FileRef } from "./Markdown";
|
|
5
5
|
import { useRefreshTick } from "@/lib/useRefreshTick";
|
|
6
|
+
import { withBasePath } from "@/lib/basePath";
|
|
6
7
|
import { ExternalLink } from "lucide-react";
|
|
7
8
|
|
|
8
9
|
interface Props {
|
|
@@ -45,7 +46,7 @@ export function PreviewPopup({ path, position, onNavigate, onMouseEnter, onMouse
|
|
|
45
46
|
setContent(null);
|
|
46
47
|
setNestedPath(null);
|
|
47
48
|
setNestedPos(null);
|
|
48
|
-
fetch(`/api/file?path=${encodeURIComponent(path)}`)
|
|
49
|
+
fetch(withBasePath(`/api/file?path=${encodeURIComponent(path)}`))
|
|
49
50
|
.then((r) => r.json())
|
|
50
51
|
.then((data) => setContent(data.content ?? null))
|
|
51
52
|
.catch(() => setContent(null))
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
4
4
|
import { Search, X } from "lucide-react";
|
|
5
|
+
import { withBasePath } from "@/lib/basePath";
|
|
5
6
|
|
|
6
7
|
interface SearchMatch {
|
|
7
8
|
line: number;
|
|
@@ -34,7 +35,7 @@ export function SearchBar({ onSelect }: Props) {
|
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
setIsSearching(true);
|
|
37
|
-
fetch(`/api/search?q=${encodeURIComponent(q.trim())}`)
|
|
38
|
+
fetch(withBasePath(`/api/search?q=${encodeURIComponent(q.trim())}`))
|
|
38
39
|
.then((r) => r.json())
|
|
39
40
|
.then((data) => {
|
|
40
41
|
setResults(data.results ?? []);
|
|
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
|
|
|
4
4
|
import { GitCommit, FileText, ChevronDown, ChevronRight, X, Clock } from "lucide-react";
|
|
5
5
|
import { DiffView } from "./DiffView";
|
|
6
6
|
import { useRefreshTick } from "@/lib/useRefreshTick";
|
|
7
|
+
import { withBasePath } from "@/lib/basePath";
|
|
7
8
|
|
|
8
9
|
interface TimelineEntry {
|
|
9
10
|
hash: string;
|
|
@@ -49,7 +50,7 @@ export function TimelinePanel({ onNavigate, onClose }: Props) {
|
|
|
49
50
|
|
|
50
51
|
useEffect(() => {
|
|
51
52
|
setLoading(true);
|
|
52
|
-
fetch("/api/timeline")
|
|
53
|
+
fetch(withBasePath("/api/timeline"))
|
|
53
54
|
.then((r) => r.json())
|
|
54
55
|
.then((data) => {
|
|
55
56
|
setEntries(data.entries ?? []);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const raw = process.env.NEXT_PUBLIC_BASE_PATH?.trim();
|
|
2
|
+
const basePath =
|
|
3
|
+
raw && raw !== "/" && raw !== "" ? raw.replace(/\/$/, "") : "";
|
|
4
|
+
|
|
5
|
+
export function withBasePath(path: string): string {
|
|
6
|
+
if (!path.startsWith("/")) return path;
|
|
7
|
+
return basePath + path;
|
|
8
|
+
}
|
|
@@ -105,6 +105,18 @@ export function readFile(relPath: string): string | null {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
export function readAsset(relPath: string): Buffer | null {
|
|
109
|
+
const fullPath = path.resolve(DOCS_ROOT, relPath);
|
|
110
|
+
if (!fullPath.startsWith(path.resolve(DOCS_ROOT))) return null;
|
|
111
|
+
try {
|
|
112
|
+
const stat = fs.statSync(fullPath);
|
|
113
|
+
if (!stat.isFile()) return null;
|
|
114
|
+
return fs.readFileSync(fullPath);
|
|
115
|
+
} catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
108
120
|
export function statFile(relPath: string): number | null {
|
|
109
121
|
const fullPath = path.resolve(DOCS_ROOT, relPath);
|
|
110
122
|
if (!fullPath.startsWith(path.resolve(DOCS_ROOT))) return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
+
import { withBasePath } from "@/lib/basePath";
|
|
4
5
|
|
|
5
6
|
type Listener = (tick: number) => void;
|
|
6
7
|
|
|
@@ -17,7 +18,7 @@ function bump() {
|
|
|
17
18
|
function ensureConnected() {
|
|
18
19
|
if (eventSource || typeof window === "undefined") return;
|
|
19
20
|
try {
|
|
20
|
-
eventSource = new EventSource("/api/watch");
|
|
21
|
+
eventSource = new EventSource(withBasePath("/api/watch"));
|
|
21
22
|
} catch {
|
|
22
23
|
return;
|
|
23
24
|
}
|