@san-siva/blogkit-md-cli 0.1.26 → 0.1.29

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.
Files changed (35) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/fallback-build-manifest.json +3 -3
  7. package/.next/prerender-manifest.json +3 -3
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/middleware-build-manifest.js +3 -3
  24. package/.next/server/pages/404.html +1 -1
  25. package/.next/server/pages/500.html +1 -1
  26. package/.next/server/server-reference-manifest.js +1 -1
  27. package/.next/server/server-reference-manifest.json +1 -1
  28. package/.next/trace +1 -1
  29. package/.next/trace-build +1 -1
  30. package/README.md +38 -17
  31. package/bin/blogkit-md.js +165 -110
  32. package/package.json +1 -1
  33. /package/.next/static/{Pez3tIqAK0d29mrIsZTJI → WtnY2j8isFkz6RmAQ9Olt}/_buildManifest.js +0 -0
  34. /package/.next/static/{Pez3tIqAK0d29mrIsZTJI → WtnY2j8isFkz6RmAQ9Olt}/_clientMiddlewareManifest.js +0 -0
  35. /package/.next/static/{Pez3tIqAK0d29mrIsZTJI → WtnY2j8isFkz6RmAQ9Olt}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- <!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/061qfr813n13i.js"/><script src="/_next/static/chunks/022i5lxiq4.fw.js" async=""></script><script src="/_next/static/chunks/0s7gefbu__9bz.js" async=""></script><script src="/_next/static/chunks/0s_h50.6-5q6r.js" async=""></script><script src="/_next/static/chunks/turbopack-067_~051wvak1.js" async=""></script><script src="/_next/static/chunks/01xlw8hd842-c.js" async=""></script><script src="/_next/static/chunks/0n4z.7yu76je-.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/061qfr813n13i.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[39756,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"default\"]\n3:I[37457,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"default\"]\n4:I[97367,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[97367,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"ViewportBoundary\"]\na:I[97367,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"MetadataBoundary\"]\nc:I[68027,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"Pez3tIqAK0d29mrIsZTJI\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
1
+ <!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/061qfr813n13i.js"/><script src="/_next/static/chunks/022i5lxiq4.fw.js" async=""></script><script src="/_next/static/chunks/0s7gefbu__9bz.js" async=""></script><script src="/_next/static/chunks/0s_h50.6-5q6r.js" async=""></script><script src="/_next/static/chunks/turbopack-067_~051wvak1.js" async=""></script><script src="/_next/static/chunks/01xlw8hd842-c.js" async=""></script><script src="/_next/static/chunks/0n4z.7yu76je-.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/03~yq9q893hmn.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/061qfr813n13i.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[39756,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"default\"]\n3:I[37457,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"default\"]\n4:I[97367,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[97367,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"ViewportBoundary\"]\na:I[97367,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"MetadataBoundary\"]\nc:I[68027,[\"/_next/static/chunks/01xlw8hd842-c.js\",\"/_next/static/chunks/0n4z.7yu76je-.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"WtnY2j8isFkz6RmAQ9Olt\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
@@ -1 +1 @@
1
- self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"kdfUg0GDnB9X4cYK5K5M5Cm2SY47YD5upY3bXpLUZP0=\"\n}"
1
+ self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"LZ40/n6ee2BH0h60gVyKgZLssok9AaPtYq41xf5YkWI=\"\n}"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "kdfUg0GDnB9X4cYK5K5M5Cm2SY47YD5upY3bXpLUZP0="
4
+ "encryptionKey": "LZ40/n6ee2BH0h60gVyKgZLssok9AaPtYq41xf5YkWI="
5
5
  }
package/.next/trace CHANGED
@@ -1 +1 @@
1
- [{"name":"generate-buildid","duration":111,"timestamp":88594046727,"id":4,"parentId":1,"tags":{},"startTime":1781085297291,"traceId":"a1535ce3fa11820d"},{"name":"load-custom-routes","duration":164,"timestamp":88594046884,"id":5,"parentId":1,"tags":{},"startTime":1781085297291,"traceId":"a1535ce3fa11820d"},{"name":"create-dist-dir","duration":330,"timestamp":88594047059,"id":6,"parentId":1,"tags":{},"startTime":1781085297291,"traceId":"a1535ce3fa11820d"},{"name":"clean","duration":257,"timestamp":88594048125,"id":7,"parentId":1,"tags":{},"startTime":1781085297292,"traceId":"a1535ce3fa11820d"},{"name":"discover-routes","duration":1933,"timestamp":88594058667,"id":8,"parentId":1,"tags":{},"startTime":1781085297303,"traceId":"a1535ce3fa11820d"},{"name":"create-root-mapping","duration":37,"timestamp":88594060636,"id":9,"parentId":1,"tags":{},"startTime":1781085297305,"traceId":"a1535ce3fa11820d"},{"name":"generate-route-types","duration":11125,"timestamp":88594061383,"id":10,"parentId":1,"tags":{},"startTime":1781085297305,"traceId":"a1535ce3fa11820d"},{"name":"public-dir-conflict-check","duration":49,"timestamp":88594072544,"id":11,"parentId":1,"tags":{},"startTime":1781085297316,"traceId":"a1535ce3fa11820d"},{"name":"generate-routes-manifest","duration":1122,"timestamp":88594072648,"id":12,"parentId":1,"tags":{},"startTime":1781085297317,"traceId":"a1535ce3fa11820d"},{"name":"run-turbopack","duration":4266590,"timestamp":88594075675,"id":14,"parentId":1,"tags":{},"startTime":1781085297320,"traceId":"a1535ce3fa11820d"},{"name":"turbopack-build-events","duration":27,"timestamp":88594160688,"id":15,"parentId":1,"tags":{},"startTime":1781085297405,"traceId":"a1535ce3fa11820d"},{"name":"run-typescript","duration":757227,"timestamp":88598361446,"id":16,"parentId":1,"tags":{},"startTime":1781085301606,"traceId":"a1535ce3fa11820d"},{"name":"generate-required-server-files","duration":373,"timestamp":88599119520,"id":18,"parentId":1,"tags":{},"startTime":1781085302364,"traceId":"a1535ce3fa11820d"},{"name":"check-static-error-page","duration":2824,"timestamp":88599124397,"id":20,"parentId":19,"tags":{},"startTime":1781085302369,"traceId":"a1535ce3fa11820d"},{"name":"is-page-static","duration":107219,"timestamp":88599127395,"id":27,"parentId":22,"tags":{},"startTime":1781085302372,"traceId":"a1535ce3fa11820d"},{"name":"check-page","duration":109148,"timestamp":88599125508,"id":22,"parentId":19,"tags":{"page":"/_global-error"},"startTime":1781085302370,"traceId":"a1535ce3fa11820d"},{"name":"is-page-static","duration":127115,"timestamp":88599127290,"id":26,"parentId":21,"tags":{},"startTime":1781085302371,"traceId":"a1535ce3fa11820d"},{"name":"check-page","duration":129642,"timestamp":88599124794,"id":21,"parentId":19,"tags":{"page":"/_not-found"},"startTime":1781085302369,"traceId":"a1535ce3fa11820d"},{"name":"is-page-static","duration":128962,"timestamp":88599128740,"id":28,"parentId":24,"tags":{},"startTime":1781085302373,"traceId":"a1535ce3fa11820d"},{"name":"check-page","duration":130724,"timestamp":88599127001,"id":24,"parentId":19,"tags":{"page":"/api/sse"},"startTime":1781085302371,"traceId":"a1535ce3fa11820d"},{"name":"is-page-static","duration":147269,"timestamp":88599129333,"id":30,"parentId":25,"tags":{},"startTime":1781085302373,"traceId":"a1535ce3fa11820d"},{"name":"check-page","duration":149488,"timestamp":88599127137,"id":25,"parentId":19,"tags":{"page":"/"},"startTime":1781085302371,"traceId":"a1535ce3fa11820d"},{"name":"is-page-static","duration":147931,"timestamp":88599129288,"id":29,"parentId":23,"tags":{},"startTime":1781085302373,"traceId":"a1535ce3fa11820d"},{"name":"check-page","duration":151570,"timestamp":88599125659,"id":23,"parentId":19,"tags":{"page":"/[...slug]"},"startTime":1781085302370,"traceId":"a1535ce3fa11820d"},{"name":"static-check","duration":153070,"timestamp":88599124169,"id":19,"parentId":1,"tags":{},"startTime":1781085302368,"traceId":"a1535ce3fa11820d"},{"name":"write-routes-manifest","duration":474,"timestamp":88599278917,"id":32,"parentId":1,"tags":{},"startTime":1781085302523,"traceId":"a1535ce3fa11820d"},{"name":"load-dotenv","duration":11,"timestamp":88599284815,"id":35,"parentId":34,"tags":{},"startTime":1781085302529,"traceId":"a1535ce3fa11820d"},{"name":"run-export-path-map","duration":123,"timestamp":88599285671,"id":36,"parentId":34,"tags":{},"startTime":1781085302530,"traceId":"a1535ce3fa11820d"},{"name":"next-export","duration":129247,"timestamp":88599284429,"id":34,"parentId":1,"tags":{},"startTime":1781085302529,"traceId":"a1535ce3fa11820d"},{"name":"move-exported-app-not-found-","duration":328,"timestamp":88599414135,"id":37,"parentId":33,"tags":{},"startTime":1781085302658,"traceId":"a1535ce3fa11820d"},{"name":"move-exported-app-global-error-","duration":239,"timestamp":88599414487,"id":38,"parentId":33,"tags":{},"startTime":1781085302659,"traceId":"a1535ce3fa11820d"},{"name":"static-generation","duration":133961,"timestamp":88599281494,"id":33,"parentId":1,"tags":{},"startTime":1781085302526,"traceId":"a1535ce3fa11820d"},{"name":"write-routes-manifest","duration":125,"timestamp":88599415509,"id":39,"parentId":1,"tags":{},"startTime":1781085302660,"traceId":"a1535ce3fa11820d"},{"name":"print-tree-view","duration":804,"timestamp":88599418378,"id":40,"parentId":1,"tags":{},"startTime":1781085302663,"traceId":"a1535ce3fa11820d"},{"name":"write-route-bundle-stats","duration":2699,"timestamp":88599419195,"id":41,"parentId":1,"tags":{},"startTime":1781085302663,"traceId":"a1535ce3fa11820d"},{"name":"telemetry-flush","duration":495122,"timestamp":88599421904,"id":42,"parentId":1,"tags":{},"startTime":1781085302666,"traceId":"a1535ce3fa11820d"},{"name":"next-build","duration":7040633,"timestamp":88592876438,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781085296120,"traceId":"a1535ce3fa11820d"}]
1
+ [{"name":"generate-buildid","duration":119,"timestamp":181146385479,"id":4,"parentId":1,"tags":{},"startTime":1781177849465,"traceId":"832e3379ce149059"},{"name":"load-custom-routes","duration":171,"timestamp":181146385649,"id":5,"parentId":1,"tags":{},"startTime":1781177849465,"traceId":"832e3379ce149059"},{"name":"create-dist-dir","duration":226,"timestamp":181146385832,"id":6,"parentId":1,"tags":{},"startTime":1781177849465,"traceId":"832e3379ce149059"},{"name":"clean","duration":156,"timestamp":181146386578,"id":7,"parentId":1,"tags":{},"startTime":1781177849466,"traceId":"832e3379ce149059"},{"name":"discover-routes","duration":1588,"timestamp":181146394148,"id":8,"parentId":1,"tags":{},"startTime":1781177849473,"traceId":"832e3379ce149059"},{"name":"create-root-mapping","duration":24,"timestamp":181146395755,"id":9,"parentId":1,"tags":{},"startTime":1781177849475,"traceId":"832e3379ce149059"},{"name":"generate-route-types","duration":8473,"timestamp":181146396185,"id":10,"parentId":1,"tags":{},"startTime":1781177849475,"traceId":"832e3379ce149059"},{"name":"public-dir-conflict-check","duration":33,"timestamp":181146404688,"id":11,"parentId":1,"tags":{},"startTime":1781177849484,"traceId":"832e3379ce149059"},{"name":"generate-routes-manifest","duration":780,"timestamp":181146404756,"id":12,"parentId":1,"tags":{},"startTime":1781177849484,"traceId":"832e3379ce149059"},{"name":"run-turbopack","duration":4029479,"timestamp":181146406975,"id":14,"parentId":1,"tags":{},"startTime":1781177849486,"traceId":"832e3379ce149059"},{"name":"turbopack-build-events","duration":34,"timestamp":181146491391,"id":15,"parentId":1,"tags":{},"startTime":1781177849570,"traceId":"832e3379ce149059"},{"name":"run-typescript","duration":817226,"timestamp":181150455313,"id":16,"parentId":1,"tags":{},"startTime":1781177853534,"traceId":"832e3379ce149059"},{"name":"generate-required-server-files","duration":394,"timestamp":181151273360,"id":18,"parentId":1,"tags":{},"startTime":1781177854352,"traceId":"832e3379ce149059"},{"name":"check-static-error-page","duration":3166,"timestamp":181151278753,"id":20,"parentId":19,"tags":{},"startTime":1781177854358,"traceId":"832e3379ce149059"},{"name":"is-page-static","duration":105817,"timestamp":181151282078,"id":27,"parentId":22,"tags":{},"startTime":1781177854361,"traceId":"832e3379ce149059"},{"name":"check-page","duration":107998,"timestamp":181151279945,"id":22,"parentId":19,"tags":{"page":"/_global-error"},"startTime":1781177854359,"traceId":"832e3379ce149059"},{"name":"is-page-static","duration":129672,"timestamp":181151281982,"id":26,"parentId":21,"tags":{},"startTime":1781177854361,"traceId":"832e3379ce149059"},{"name":"check-page","duration":132520,"timestamp":181151279171,"id":21,"parentId":19,"tags":{"page":"/_not-found"},"startTime":1781177854358,"traceId":"832e3379ce149059"},{"name":"is-page-static","duration":131357,"timestamp":181151282972,"id":28,"parentId":24,"tags":{},"startTime":1781177854362,"traceId":"832e3379ce149059"},{"name":"check-page","duration":132630,"timestamp":181151281723,"id":24,"parentId":19,"tags":{"page":"/api/sse"},"startTime":1781177854361,"traceId":"832e3379ce149059"},{"name":"is-page-static","duration":149836,"timestamp":181151283769,"id":30,"parentId":25,"tags":{},"startTime":1781177854363,"traceId":"832e3379ce149059"},{"name":"check-page","duration":151791,"timestamp":181151281847,"id":25,"parentId":19,"tags":{"page":"/"},"startTime":1781177854361,"traceId":"832e3379ce149059"},{"name":"is-page-static","duration":151011,"timestamp":181151283735,"id":29,"parentId":23,"tags":{},"startTime":1781177854363,"traceId":"832e3379ce149059"},{"name":"check-page","duration":154654,"timestamp":181151280113,"id":23,"parentId":19,"tags":{"page":"/[...slug]"},"startTime":1781177854359,"traceId":"832e3379ce149059"},{"name":"static-check","duration":156283,"timestamp":181151278497,"id":19,"parentId":1,"tags":{},"startTime":1781177854358,"traceId":"832e3379ce149059"},{"name":"write-routes-manifest","duration":575,"timestamp":181151435557,"id":32,"parentId":1,"tags":{},"startTime":1781177854515,"traceId":"832e3379ce149059"},{"name":"load-dotenv","duration":11,"timestamp":181151443518,"id":35,"parentId":34,"tags":{},"startTime":1781177854523,"traceId":"832e3379ce149059"},{"name":"run-export-path-map","duration":142,"timestamp":181151444536,"id":36,"parentId":34,"tags":{},"startTime":1781177854524,"traceId":"832e3379ce149059"},{"name":"next-export","duration":137214,"timestamp":181151443102,"id":34,"parentId":1,"tags":{},"startTime":1781177854522,"traceId":"832e3379ce149059"},{"name":"move-exported-app-not-found-","duration":358,"timestamp":181151580805,"id":37,"parentId":33,"tags":{},"startTime":1781177854660,"traceId":"832e3379ce149059"},{"name":"move-exported-app-global-error-","duration":279,"timestamp":181151581182,"id":38,"parentId":33,"tags":{},"startTime":1781177854660,"traceId":"832e3379ce149059"},{"name":"static-generation","duration":144238,"timestamp":181151437833,"id":33,"parentId":1,"tags":{},"startTime":1781177854517,"traceId":"832e3379ce149059"},{"name":"write-routes-manifest","duration":132,"timestamp":181151582110,"id":39,"parentId":1,"tags":{},"startTime":1781177854661,"traceId":"832e3379ce149059"},{"name":"print-tree-view","duration":789,"timestamp":181151584501,"id":40,"parentId":1,"tags":{},"startTime":1781177854664,"traceId":"832e3379ce149059"},{"name":"write-route-bundle-stats","duration":2238,"timestamp":181151585300,"id":41,"parentId":1,"tags":{},"startTime":1781177854664,"traceId":"832e3379ce149059"},{"name":"telemetry-flush","duration":496383,"timestamp":181151587549,"id":42,"parentId":1,"tags":{},"startTime":1781177854667,"traceId":"832e3379ce149059"},{"name":"next-build","duration":6841632,"timestamp":181145242331,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781177848321,"traceId":"832e3379ce149059"}]
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-turbopack","duration":4266590,"timestamp":88594075675,"id":14,"parentId":1,"tags":{},"startTime":1781085297320,"traceId":"a1535ce3fa11820d"},{"name":"turbopack-build-events","duration":27,"timestamp":88594160688,"id":15,"parentId":1,"tags":{},"startTime":1781085297405,"traceId":"a1535ce3fa11820d"},{"name":"run-typescript","duration":757227,"timestamp":88598361446,"id":16,"parentId":1,"tags":{},"startTime":1781085301606,"traceId":"a1535ce3fa11820d"},{"name":"static-check","duration":153070,"timestamp":88599124169,"id":19,"parentId":1,"tags":{},"startTime":1781085302368,"traceId":"a1535ce3fa11820d"},{"name":"static-generation","duration":133961,"timestamp":88599281494,"id":33,"parentId":1,"tags":{},"startTime":1781085302526,"traceId":"a1535ce3fa11820d"},{"name":"telemetry-flush","duration":495122,"timestamp":88599421904,"id":42,"parentId":1,"tags":{},"startTime":1781085302666,"traceId":"a1535ce3fa11820d"},{"name":"next-build","duration":7040633,"timestamp":88592876438,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781085296120,"traceId":"a1535ce3fa11820d"}]
1
+ [{"name":"run-turbopack","duration":4029479,"timestamp":181146406975,"id":14,"parentId":1,"tags":{},"startTime":1781177849486,"traceId":"832e3379ce149059"},{"name":"turbopack-build-events","duration":34,"timestamp":181146491391,"id":15,"parentId":1,"tags":{},"startTime":1781177849570,"traceId":"832e3379ce149059"},{"name":"run-typescript","duration":817226,"timestamp":181150455313,"id":16,"parentId":1,"tags":{},"startTime":1781177853534,"traceId":"832e3379ce149059"},{"name":"static-check","duration":156283,"timestamp":181151278497,"id":19,"parentId":1,"tags":{},"startTime":1781177854358,"traceId":"832e3379ce149059"},{"name":"static-generation","duration":144238,"timestamp":181151437833,"id":33,"parentId":1,"tags":{},"startTime":1781177854517,"traceId":"832e3379ce149059"},{"name":"telemetry-flush","duration":496383,"timestamp":181151587549,"id":42,"parentId":1,"tags":{},"startTime":1781177854667,"traceId":"832e3379ce149059"},{"name":"next-build","duration":6841632,"timestamp":181145242331,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781177848321,"traceId":"832e3379ce149059"}]
package/README.md CHANGED
@@ -27,16 +27,31 @@ blogkit-md <path-to-markdown-file-or-directory> [options]
27
27
 
28
28
  ### Options
29
29
 
30
- | Option | Description |
31
- | ---------------------- | ---------------------------------------------------------------------------------------- |
32
- | `--port=<port>` | Port to run the preview server on (default: random free port) |
33
- | `-b`, `--background` | Run the preview server detached in the background |
34
- | `-r`, `--reuse` | If this path is already being served, just open it in the browser instead of starting |
35
- | `-l`, `--list` | Interactively list running instances and stop any of them |
36
- | `-h`, `--help` | Show help |
37
-
38
- If you try to preview a path that already has a running instance, you'll be
39
- prompted to stop the existing one (or pass `--reuse` to just open it).
30
+ The preview server always runs detached in the background; use `--list` or
31
+ `--stop` to manage running instances.
32
+
33
+ | Option | Description |
34
+ | ------------------- | ------------------------------------------------------------- |
35
+ | `--port=<port>` | Port to run the preview server on (default: random free port) |
36
+ | `-t`, `--tear` | Stop the instance already serving this path, then start fresh |
37
+ | `-s`, `--stop` | Stop the instance serving the given path, then exit |
38
+ | `-l`, `--list` | Interactively list running instances and stop any of them |
39
+ | `--non-interactive` | With `-l`, print a plain `<port>\t<path>` list and exit |
40
+ | `-n`, `--no-open` | Start the server without opening it in the browser |
41
+ | `-h`, `--help` | Show help |
42
+
43
+ ### Reusing running instances
44
+
45
+ The CLI avoids spinning up redundant servers for the same markdown tree:
46
+
47
+ - **Path already served** — running it again just reopens it in the browser.
48
+ Pass `--tear` to stop the running instance and start fresh instead.
49
+ - **File inside a served folder** — if a directory is already being served and
50
+ you open a markdown file under it, the existing server's port is reused and
51
+ the file's URL opens directly (no second server).
52
+ - **Folder over narrower instances** — serving a whole directory stops any
53
+ narrower instances (e.g. a single file) already running inside it, so the
54
+ directory server owns the tree.
40
55
 
41
56
  ### Examples
42
57
 
@@ -50,17 +65,23 @@ blogkit-md ./posts
50
65
  # Preview on a specific port
51
66
  blogkit-md ./posts/my-post.md --port=3001
52
67
 
53
- # Run detached in the background
54
- blogkit-md ./posts --background
68
+ # Start the server without opening the browser
69
+ blogkit-md ./posts --no-open
70
+
71
+ # Restart the instance serving a path from scratch
72
+ blogkit-md ./posts --tear
55
73
 
56
- # Re-open a path that's already being served
57
- blogkit-md ./posts --reuse
74
+ # Stop the instance serving a given path
75
+ blogkit-md ./posts --stop
58
76
 
59
77
  # List running instances and stop one interactively
60
78
  blogkit-md --list
79
+
80
+ # Print a plain "<port>\t<path>" list for scripting
81
+ blogkit-md --list --non-interactive
61
82
  ```
62
83
 
63
- The browser will open automatically once the server is ready. The preview reloads whenever you save changes to the markdown file (or any markdown file under the directory).
84
+ The browser will open automatically once the server is ready (unless you pass `--no-open`). The preview reloads whenever you save changes to the markdown file (or any markdown file under the directory).
64
85
 
65
86
  ### Managing background instances
66
87
 
@@ -73,10 +94,10 @@ and select an instance to stop it:
73
94
 
74
95
  ❯ localhost:3001 📁 ~/posts pid 12345 · 4m bg
75
96
 
76
- ↑/↓ move ⏎ open in Chrome k stop q quit
97
+ ↑/↓ j/k move ⏎ open in Chrome x stop q quit
77
98
  ```
78
99
 
79
- `⏎` opens the selected instance in Chrome; `k` stops it.
100
+ `⏎` opens the selected instance in Chrome; `x` stops it. For scripting, `blogkit-md --list --non-interactive` prints one `<port>\t<path>` line per instance with no banner or colors.
80
101
 
81
102
  ## Requirements
82
103
 
package/bin/blogkit-md.js CHANGED
@@ -117,6 +117,26 @@ function removeInstance(pid) {
117
117
  function findByDir(dir) {
118
118
  return pruneRegistry().find((index) => index.dir === dir);
119
119
  }
120
+ function findContainingDir(filePath) {
121
+ const contains = (dir) => {
122
+ const relative = import_node_path.default.relative(dir, filePath);
123
+ return relative !== "" && !relative.startsWith("..") && !import_node_path.default.isAbsolute(relative);
124
+ };
125
+ return pruneRegistry().filter((index) => index.isDirectory && contains(index.dir)).toSorted((a, b) => b.dir.length - a.dir.length)[0];
126
+ }
127
+ function findInstancesUnder(dir) {
128
+ return pruneRegistry().filter((index) => {
129
+ const relative = import_node_path.default.relative(dir, index.dir);
130
+ if (relative === "") return false;
131
+ if (relative.startsWith("..")) return false;
132
+ if (import_node_path.default.isAbsolute(relative)) return false;
133
+ return true;
134
+ });
135
+ }
136
+ function fileUrlPath(dir, filePath) {
137
+ const relative = import_node_path.default.relative(dir, filePath);
138
+ return "/" + relative.replace(/\.md$/, "").split(import_node_path.default.sep).map(encodeURIComponent).join("/");
139
+ }
120
140
  function killInstance(inst) {
121
141
  try {
122
142
  process.kill(inst.pid, "SIGTERM");
@@ -241,7 +261,6 @@ function parseArgs(argv) {
241
261
  return {
242
262
  inputArg: inputArgument,
243
263
  requestedPort,
244
- wantBackground: flagNames.has("--background") || flagNames.has("-b"),
245
264
  wantList: flagNames.has("--list") || flagNames.has("-l") || flagNames.has("--list-instances"),
246
265
  // legacy alias
247
266
  wantTear: flagNames.has("--tear") || flagNames.has("-t"),
@@ -262,9 +281,6 @@ function printHelp() {
262
281
  tree(
263
282
  `${c.green("--port=<port>")} run on a specific port (default: random free port)`
264
283
  );
265
- tree(
266
- `${c.green("-b, --background")} run the preview server detached in the background`
267
- );
268
284
  tree(
269
285
  `${c.green("-t, --tear")} stop the instance already serving this path, then start fresh`
270
286
  );
@@ -287,7 +303,145 @@ function printHelp() {
287
303
  "If a path is already being served, running it again just reopens it."
288
304
  )
289
305
  );
306
+ line(
307
+ c.gray("A file inside a served folder reuses that server; serving a folder")
308
+ );
309
+ line(c.gray("replaces any narrower instances already running inside it."));
310
+ line();
311
+ line(
312
+ c.gray("The server always runs in the background; stop it with ") + c.blue("--stop") + c.gray(" or ") + c.blue("--list") + c.gray(".")
313
+ );
314
+ line();
315
+ }
316
+ function stopAndExit(inputPath) {
317
+ banner();
318
+ const existing = findByDir(inputPath);
319
+ if (existing) {
320
+ killInstance(existing);
321
+ line(c.green(`\u2713 Stopped localhost:${existing.port}`));
322
+ tree(c.dim(tilde(existing.dir)));
323
+ } else {
324
+ line(c.yellow("No running instance for that path"));
325
+ tree(c.dim(tilde(inputPath)));
326
+ }
290
327
  line();
328
+ process.exit(0);
329
+ }
330
+ function statInput(inputPath) {
331
+ try {
332
+ return (0, import_node_fs.statSync)(inputPath).isDirectory();
333
+ } catch {
334
+ banner();
335
+ line(c.red("\u2717 Path does not exist"));
336
+ tree(c.dim(inputPath));
337
+ line();
338
+ process.exit(1);
339
+ }
340
+ }
341
+ async function tearDownInstance(existing) {
342
+ banner();
343
+ line(c.yellow("Tearing down the running instance"));
344
+ tree(
345
+ `${c.green("localhost:" + existing.port)} ${c.gray("pid " + existing.pid)} ${existing.background ? c.magenta("background") : c.gray("foreground")}`
346
+ );
347
+ killInstance(existing);
348
+ line(c.green(`\u2713 Stopped localhost:${existing.port}`));
349
+ line();
350
+ await new Promise((r) => setTimeout(r, 400));
351
+ }
352
+ function reopenInstance(existing, parsed) {
353
+ const url = `http://localhost:${existing.port}`;
354
+ banner();
355
+ line(c.green("Already running \u2014 opening it in the browser"));
356
+ tree(`${c.bold("URL")} ${c.blue(url)}`);
357
+ tree(`${c.bold("Path")} ${c.dim(tilde(existing.dir))}`);
358
+ line();
359
+ line(
360
+ c.gray("Restart it with ") + c.blue("--tear") + c.gray(", or list with ") + c.blue("--list")
361
+ );
362
+ line();
363
+ openBrowser(url, parsed.wantNoOpen);
364
+ process.exit(0);
365
+ }
366
+ function reuseContainingDir(inputPath, isDirectory, parsed) {
367
+ const parent = findContainingDir(inputPath);
368
+ if (!parent) return;
369
+ const url = isDirectory ? `http://localhost:${parent.port}` : `http://localhost:${parent.port}${fileUrlPath(parent.dir, inputPath)}`;
370
+ banner();
371
+ line(
372
+ c.green(
373
+ isDirectory ? "Already serving a parent folder \u2014 opening it" : "Already serving this folder \u2014 opening the file"
374
+ )
375
+ );
376
+ tree(`${c.bold("URL")} ${c.blue(url)}`);
377
+ tree(`${c.bold(isDirectory ? "Folder" : "File")} ${c.dim(tilde(inputPath))}`);
378
+ tree(`${c.bold("Parent")} ${c.dim(tilde(parent.dir))}`);
379
+ line();
380
+ openBrowser(url, parsed.wantNoOpen);
381
+ process.exit(0);
382
+ }
383
+ async function supersedeNarrowerInstances(dir) {
384
+ const contained = findInstancesUnder(dir);
385
+ if (contained.length === 0) return void 0;
386
+ banner();
387
+ line(c.yellow("Stopping narrower instances inside this folder"));
388
+ for (const inst of contained) {
389
+ killInstance(inst);
390
+ tree(`${c.green("localhost:" + inst.port)} ${c.dim(tilde(inst.dir))}`);
391
+ }
392
+ const reusedPort = contained[0].port;
393
+ line(c.gray(`Reusing port ${reusedPort} for ${tilde(dir)}`));
394
+ line();
395
+ await new Promise((r) => setTimeout(r, 400));
396
+ return reusedPort;
397
+ }
398
+ async function reconcileInstances(inputPath, isDirectory, parsed) {
399
+ const existing = findByDir(inputPath);
400
+ if (existing) {
401
+ if (parsed.wantTear) {
402
+ await tearDownInstance(existing);
403
+ } else {
404
+ reopenInstance(existing, parsed);
405
+ }
406
+ }
407
+ if (!parsed.wantTear && (isDirectory || inputPath.endsWith(".md"))) {
408
+ reuseContainingDir(inputPath, isDirectory, parsed);
409
+ }
410
+ if (isDirectory) {
411
+ return supersedeNarrowerInstances(inputPath);
412
+ }
413
+ return void 0;
414
+ }
415
+ async function launchInBackground(inputPath, parsed, scriptPath, reclaimedPort) {
416
+ try {
417
+ const port = parsed.requestedPort || reclaimedPort || await getFreePort();
418
+ (0, import_node_fs.mkdirSync)(logDir(), { recursive: true });
419
+ const logFile = import_node_path.default.join(logDir(), `${port}.log`);
420
+ const out = (0, import_node_fs.openSync)(logFile, "a");
421
+ const childArgs = [scriptPath, inputPath, `--port=${port}`, "--__detached"];
422
+ if (parsed.wantNoOpen) childArgs.push("--no-open");
423
+ const child = (0, import_node_child_process.spawn)(process.execPath, childArgs, {
424
+ detached: true,
425
+ stdio: ["ignore", out, out]
426
+ });
427
+ child.unref();
428
+ banner();
429
+ line(c.green("Started in the background"));
430
+ tree(`${c.bold("URL")} ${c.blue("http://localhost:" + port)}`);
431
+ tree(`${c.bold("Path")} ${c.dim(tilde(inputPath))}`);
432
+ tree(`${c.bold("PID")} ${c.dim(String(child.pid))}`);
433
+ tree(`${c.bold("Log")} ${c.dim(tilde(logFile))}`);
434
+ line();
435
+ line(c.gray("Stop it with: ") + c.blue("blogkit-md --list"));
436
+ line();
437
+ } catch (error) {
438
+ banner();
439
+ line(c.red("\u2717 Failed to start in the background"));
440
+ tree(c.dim(String(error)));
441
+ line();
442
+ process.exit(1);
443
+ }
444
+ process.exit(0);
291
445
  }
292
446
  async function run(argv) {
293
447
  const parsed = parseArgs(argv);
@@ -300,103 +454,19 @@ async function run(argv) {
300
454
  process.exit(0);
301
455
  }
302
456
  if (!parsed.inputArg) {
303
- if (parsed.wantStop) {
304
- banner();
305
- line(c.red("\u2717 --stop needs a path"));
306
- tree(c.dim("blogkit-md --stop <file-or-directory>"));
307
- line();
308
- process.exit(1);
309
- }
457
+ line(c.red("\u2717 Missing path"));
310
458
  printHelp();
311
459
  process.exit(1);
312
460
  }
313
461
  const inputPath = import_node_path.default.resolve(process.cwd(), parsed.inputArg);
314
- if (parsed.wantStop) {
315
- const existing = findByDir(inputPath);
316
- banner();
317
- if (existing) {
318
- killInstance(existing);
319
- line(c.green(`\u2713 Stopped localhost:${existing.port}`));
320
- tree(c.dim(tilde(existing.dir)));
321
- } else {
322
- line(c.yellow("No running instance for that path"));
323
- tree(c.dim(tilde(inputPath)));
324
- }
325
- line();
326
- process.exit(0);
327
- }
328
- let inputStat;
329
- try {
330
- inputStat = (0, import_node_fs.statSync)(inputPath);
331
- } catch {
332
- banner();
333
- line(c.red("\u2717 Path does not exist"));
334
- tree(c.dim(inputPath));
335
- line();
336
- process.exit(1);
337
- }
338
- const isDirectory = inputStat.isDirectory();
339
- if (!parsed.isDetachedChild) {
340
- const existing = findByDir(inputPath);
341
- if (existing) {
342
- if (parsed.wantTear) {
343
- banner();
344
- line(c.yellow("Tearing down the running instance"));
345
- tree(
346
- `${c.green("localhost:" + existing.port)} ${c.gray("pid " + existing.pid)} ${existing.background ? c.magenta("background") : c.gray("foreground")}`
347
- );
348
- killInstance(existing);
349
- line(c.green(`\u2713 Stopped localhost:${existing.port}`));
350
- line();
351
- await new Promise((r) => setTimeout(r, 400));
352
- } else {
353
- const url = `http://localhost:${existing.port}`;
354
- banner();
355
- line(c.green("Already running \u2014 opening it in the browser"));
356
- tree(`${c.bold("URL")} ${c.blue(url)}`);
357
- tree(`${c.bold("Path")} ${c.dim(tilde(existing.dir))}`);
358
- line();
359
- line(
360
- c.gray("Restart it with ") + c.blue("--tear") + c.gray(", or list with ") + c.blue("--list")
361
- );
362
- line();
363
- openBrowser(url, parsed.wantNoOpen);
364
- process.exit(0);
365
- }
366
- }
367
- }
462
+ if (parsed.wantStop) stopAndExit(inputPath);
463
+ const isDirectory = statInput(inputPath);
464
+ const reclaimedPort = await reconcileInstances(inputPath, isDirectory, parsed);
368
465
  const scriptPath = process.argv[1];
369
466
  const packageRoot = import_node_path.default.dirname(import_node_path.default.dirname(scriptPath));
370
467
  const nextBin = import_node_path.default.join(packageRoot, "node_modules/.bin/next");
371
- if (parsed.wantBackground && !parsed.isDetachedChild) {
372
- try {
373
- const port = parsed.requestedPort || await getFreePort();
374
- (0, import_node_fs.mkdirSync)(logDir(), { recursive: true });
375
- const logFile = import_node_path.default.join(logDir(), `${port}.log`);
376
- const out = (0, import_node_fs.openSync)(logFile, "a");
377
- const child = (0, import_node_child_process.spawn)(
378
- process.execPath,
379
- [scriptPath, inputPath, `--port=${port}`, "--__detached"],
380
- { detached: true, stdio: ["ignore", out, out] }
381
- );
382
- child.unref();
383
- banner();
384
- line(c.green("Started in the background"));
385
- tree(`${c.bold("URL")} ${c.blue("http://localhost:" + port)}`);
386
- tree(`${c.bold("Path")} ${c.dim(tilde(inputPath))}`);
387
- tree(`${c.bold("PID")} ${c.dim(String(child.pid))}`);
388
- tree(`${c.bold("Log")} ${c.dim(tilde(logFile))}`);
389
- line();
390
- line(c.gray("Stop it with: ") + c.blue("blogkit-md --list"));
391
- line();
392
- } catch (error) {
393
- banner();
394
- line(c.red("\u2717 Failed to start in the background"));
395
- tree(c.dim(String(error)));
396
- line();
397
- process.exit(1);
398
- }
399
- process.exit(0);
468
+ if (!parsed.isDetachedChild) {
469
+ await launchInBackground(inputPath, parsed, scriptPath, reclaimedPort);
400
470
  }
401
471
  await startServer(inputPath, isDirectory, parsed, { nextBin, packageRoot });
402
472
  }
@@ -450,16 +520,10 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
450
520
  ssePort,
451
521
  dir: inputPath,
452
522
  isDirectory,
453
- background: parsed.isDetachedChild,
523
+ background: true,
454
524
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
455
525
  };
456
526
  addInstance(me);
457
- if (!parsed.isDetachedChild) {
458
- banner();
459
- line(
460
- c.gray("starting preview server for ") + c.blue(tilde(inputPath)) + c.gray(" \u2026")
461
- );
462
- }
463
527
  const child = (0, import_node_child_process.spawn)(paths.nextBin, ["start", "--port", String(nextPort)], {
464
528
  cwd: paths.packageRoot,
465
529
  env: nextEnvironment,
@@ -486,15 +550,6 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
486
550
  if (match) {
487
551
  ready = true;
488
552
  const url = `http://localhost:${nextPort}`;
489
- if (!parsed.isDetachedChild) {
490
- line();
491
- line(c.green("\u2713 Ready"));
492
- tree(`${c.bold("URL")} ${c.blue(url)}`);
493
- tree(`${c.bold("Path")} ${c.dim(tilde(inputPath))}`);
494
- line();
495
- line(c.gray("live reload on save \xB7 Ctrl-C to stop"));
496
- line();
497
- }
498
553
  openBrowser(url, parsed.wantNoOpen);
499
554
  }
500
555
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@san-siva/blogkit-md-cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.29",
4
4
  "description": "CLI tool to preview markdown files as blogkit-md blog posts",
5
5
  "bin": {
6
6
  "blogkit-md": "./bin/blogkit-md"