@san-siva/blogkit-md-cli 0.1.27 → 0.1.30

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 +151 -144
  32. package/package.json +1 -1
  33. /package/.next/static/{TR9szE1OBV4WnCY3N0LVf → SHLULiIufAuCJx3zYGmFT}/_buildManifest.js +0 -0
  34. /package/.next/static/{TR9szE1OBV4WnCY3N0LVf → SHLULiIufAuCJx3zYGmFT}/_clientMiddlewareManifest.js +0 -0
  35. /package/.next/static/{TR9szE1OBV4WnCY3N0LVf → SHLULiIufAuCJx3zYGmFT}/_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\":\"TR9szE1OBV4WnCY3N0LVf\"}\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\":\"SHLULiIufAuCJx3zYGmFT\"}\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\": \"l+RAT3oMi/K7/l+6dP2QepZ5sGNZcc7FBXaEGY3l3OE=\"\n}"
1
+ self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"NiemY7PaRXTUftvTWyoJ1HQ9a0pNy8/1roelTB/laWA=\"\n}"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "l+RAT3oMi/K7/l+6dP2QepZ5sGNZcc7FBXaEGY3l3OE="
4
+ "encryptionKey": "NiemY7PaRXTUftvTWyoJ1HQ9a0pNy8/1roelTB/laWA="
5
5
  }
package/.next/trace CHANGED
@@ -1 +1 @@
1
- [{"name":"generate-buildid","duration":242,"timestamp":89704448912,"id":4,"parentId":1,"tags":{},"startTime":1781086407708,"traceId":"0c0032e241b5a64e"},{"name":"load-custom-routes","duration":407,"timestamp":89704449265,"id":5,"parentId":1,"tags":{},"startTime":1781086407708,"traceId":"0c0032e241b5a64e"},{"name":"create-dist-dir","duration":325,"timestamp":89704449702,"id":6,"parentId":1,"tags":{},"startTime":1781086407709,"traceId":"0c0032e241b5a64e"},{"name":"clean","duration":220,"timestamp":89704450982,"id":7,"parentId":1,"tags":{},"startTime":1781086407710,"traceId":"0c0032e241b5a64e"},{"name":"discover-routes","duration":1957,"timestamp":89704460711,"id":8,"parentId":1,"tags":{},"startTime":1781086407720,"traceId":"0c0032e241b5a64e"},{"name":"create-root-mapping","duration":22,"timestamp":89704462685,"id":9,"parentId":1,"tags":{},"startTime":1781086407722,"traceId":"0c0032e241b5a64e"},{"name":"generate-route-types","duration":11809,"timestamp":89704463117,"id":10,"parentId":1,"tags":{},"startTime":1781086407722,"traceId":"0c0032e241b5a64e"},{"name":"public-dir-conflict-check","duration":39,"timestamp":89704474956,"id":11,"parentId":1,"tags":{},"startTime":1781086407734,"traceId":"0c0032e241b5a64e"},{"name":"generate-routes-manifest","duration":1129,"timestamp":89704475038,"id":12,"parentId":1,"tags":{},"startTime":1781086407734,"traceId":"0c0032e241b5a64e"},{"name":"run-turbopack","duration":3531820,"timestamp":89704478021,"id":14,"parentId":1,"tags":{},"startTime":1781086407737,"traceId":"0c0032e241b5a64e"},{"name":"turbopack-build-events","duration":28,"timestamp":89704560468,"id":15,"parentId":1,"tags":{},"startTime":1781086407820,"traceId":"0c0032e241b5a64e"},{"name":"run-typescript","duration":727260,"timestamp":89708026315,"id":16,"parentId":1,"tags":{},"startTime":1781086411285,"traceId":"0c0032e241b5a64e"},{"name":"generate-required-server-files","duration":373,"timestamp":89708754395,"id":18,"parentId":1,"tags":{},"startTime":1781086412014,"traceId":"0c0032e241b5a64e"},{"name":"check-static-error-page","duration":2824,"timestamp":89708759182,"id":20,"parentId":19,"tags":{},"startTime":1781086412018,"traceId":"0c0032e241b5a64e"},{"name":"is-page-static","duration":107497,"timestamp":89708762352,"id":27,"parentId":22,"tags":{},"startTime":1781086412021,"traceId":"0c0032e241b5a64e"},{"name":"check-page","duration":109741,"timestamp":89708760155,"id":22,"parentId":19,"tags":{"page":"/_global-error"},"startTime":1781086412019,"traceId":"0c0032e241b5a64e"},{"name":"is-page-static","duration":126402,"timestamp":89708763775,"id":28,"parentId":24,"tags":{},"startTime":1781086412023,"traceId":"0c0032e241b5a64e"},{"name":"check-page","duration":128511,"timestamp":89708761691,"id":24,"parentId":19,"tags":{"page":"/api/sse"},"startTime":1781086412021,"traceId":"0c0032e241b5a64e"},{"name":"is-page-static","duration":131274,"timestamp":89708762123,"id":26,"parentId":21,"tags":{},"startTime":1781086412021,"traceId":"0c0032e241b5a64e"},{"name":"check-page","duration":133885,"timestamp":89708759534,"id":21,"parentId":19,"tags":{"page":"/_not-found"},"startTime":1781086412019,"traceId":"0c0032e241b5a64e"},{"name":"is-page-static","duration":140899,"timestamp":89708764647,"id":29,"parentId":25,"tags":{},"startTime":1781086412024,"traceId":"0c0032e241b5a64e"},{"name":"check-page","duration":143651,"timestamp":89708761920,"id":25,"parentId":19,"tags":{"page":"/"},"startTime":1781086412021,"traceId":"0c0032e241b5a64e"},{"name":"is-page-static","duration":144179,"timestamp":89708764685,"id":30,"parentId":23,"tags":{},"startTime":1781086412024,"traceId":"0c0032e241b5a64e"},{"name":"check-page","duration":148596,"timestamp":89708760290,"id":23,"parentId":19,"tags":{"page":"/[...slug]"},"startTime":1781086412019,"traceId":"0c0032e241b5a64e"},{"name":"static-check","duration":149915,"timestamp":89708758985,"id":19,"parentId":1,"tags":{},"startTime":1781086412018,"traceId":"0c0032e241b5a64e"},{"name":"write-routes-manifest","duration":209,"timestamp":89708909605,"id":32,"parentId":1,"tags":{},"startTime":1781086412169,"traceId":"0c0032e241b5a64e"},{"name":"load-dotenv","duration":12,"timestamp":89708913847,"id":35,"parentId":34,"tags":{},"startTime":1781086412173,"traceId":"0c0032e241b5a64e"},{"name":"run-export-path-map","duration":135,"timestamp":89708914931,"id":36,"parentId":34,"tags":{},"startTime":1781086412174,"traceId":"0c0032e241b5a64e"},{"name":"next-export","duration":141200,"timestamp":89708913486,"id":34,"parentId":1,"tags":{},"startTime":1781086412173,"traceId":"0c0032e241b5a64e"},{"name":"move-exported-app-not-found-","duration":374,"timestamp":89709055106,"id":37,"parentId":33,"tags":{},"startTime":1781086412314,"traceId":"0c0032e241b5a64e"},{"name":"move-exported-app-global-error-","duration":252,"timestamp":89709055501,"id":38,"parentId":33,"tags":{},"startTime":1781086412315,"traceId":"0c0032e241b5a64e"},{"name":"static-generation","duration":145689,"timestamp":89708910704,"id":33,"parentId":1,"tags":{},"startTime":1781086412170,"traceId":"0c0032e241b5a64e"},{"name":"write-routes-manifest","duration":130,"timestamp":89709056438,"id":39,"parentId":1,"tags":{},"startTime":1781086412316,"traceId":"0c0032e241b5a64e"},{"name":"print-tree-view","duration":708,"timestamp":89709058632,"id":40,"parentId":1,"tags":{},"startTime":1781086412318,"traceId":"0c0032e241b5a64e"},{"name":"write-route-bundle-stats","duration":1715,"timestamp":89709059347,"id":41,"parentId":1,"tags":{},"startTime":1781086412318,"traceId":"0c0032e241b5a64e"},{"name":"telemetry-flush","duration":497708,"timestamp":89709061072,"id":42,"parentId":1,"tags":{},"startTime":1781086412320,"traceId":"0c0032e241b5a64e"},{"name":"next-build","duration":6213416,"timestamp":89703345432,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781086406605,"traceId":"0c0032e241b5a64e"}]
1
+ [{"name":"generate-buildid","duration":287,"timestamp":182280785530,"id":4,"parentId":1,"tags":{},"startTime":1781178983891,"traceId":"120613faee572585"},{"name":"load-custom-routes","duration":412,"timestamp":182280785932,"id":5,"parentId":1,"tags":{},"startTime":1781178983891,"traceId":"120613faee572585"},{"name":"create-dist-dir","duration":331,"timestamp":182280786383,"id":6,"parentId":1,"tags":{},"startTime":1781178983891,"traceId":"120613faee572585"},{"name":"clean","duration":458,"timestamp":182280792301,"id":7,"parentId":1,"tags":{},"startTime":1781178983897,"traceId":"120613faee572585"},{"name":"discover-routes","duration":1652,"timestamp":182280804382,"id":8,"parentId":1,"tags":{},"startTime":1781178983909,"traceId":"120613faee572585"},{"name":"create-root-mapping","duration":24,"timestamp":182280806055,"id":9,"parentId":1,"tags":{},"startTime":1781178983911,"traceId":"120613faee572585"},{"name":"generate-route-types","duration":19237,"timestamp":182280806508,"id":10,"parentId":1,"tags":{},"startTime":1781178983911,"traceId":"120613faee572585"},{"name":"public-dir-conflict-check","duration":47,"timestamp":182280825785,"id":11,"parentId":1,"tags":{},"startTime":1781178983931,"traceId":"120613faee572585"},{"name":"generate-routes-manifest","duration":824,"timestamp":182280825872,"id":12,"parentId":1,"tags":{},"startTime":1781178983931,"traceId":"120613faee572585"},{"name":"run-turbopack","duration":4158829,"timestamp":182280828064,"id":14,"parentId":1,"tags":{},"startTime":1781178983933,"traceId":"120613faee572585"},{"name":"turbopack-build-events","duration":32,"timestamp":182280921296,"id":15,"parentId":1,"tags":{},"startTime":1781178984026,"traceId":"120613faee572585"},{"name":"run-typescript","duration":753082,"timestamp":182285004490,"id":16,"parentId":1,"tags":{},"startTime":1781178988109,"traceId":"120613faee572585"},{"name":"generate-required-server-files","duration":407,"timestamp":182285758339,"id":18,"parentId":1,"tags":{},"startTime":1781178988863,"traceId":"120613faee572585"},{"name":"check-static-error-page","duration":2277,"timestamp":182285763686,"id":20,"parentId":19,"tags":{},"startTime":1781178988869,"traceId":"120613faee572585"},{"name":"is-page-static","duration":127772,"timestamp":182285766136,"id":27,"parentId":22,"tags":{},"startTime":1781178988871,"traceId":"120613faee572585"},{"name":"check-page","duration":129357,"timestamp":182285764605,"id":22,"parentId":19,"tags":{"page":"/_global-error"},"startTime":1781178988870,"traceId":"120613faee572585"},{"name":"is-page-static","duration":148851,"timestamp":182285767030,"id":28,"parentId":24,"tags":{},"startTime":1781178988872,"traceId":"120613faee572585"},{"name":"check-page","duration":150156,"timestamp":182285765755,"id":24,"parentId":19,"tags":{"page":"/api/sse"},"startTime":1781178988871,"traceId":"120613faee572585"},{"name":"is-page-static","duration":149898,"timestamp":182285766039,"id":26,"parentId":21,"tags":{},"startTime":1781178988871,"traceId":"120613faee572585"},{"name":"check-page","duration":151857,"timestamp":182285764090,"id":21,"parentId":19,"tags":{"page":"/_not-found"},"startTime":1781178988869,"traceId":"120613faee572585"},{"name":"is-page-static","duration":169456,"timestamp":182285767739,"id":29,"parentId":23,"tags":{},"startTime":1781178988873,"traceId":"120613faee572585"},{"name":"check-page","duration":172487,"timestamp":182285764740,"id":23,"parentId":19,"tags":{"page":"/[...slug]"},"startTime":1781178988870,"traceId":"120613faee572585"},{"name":"is-page-static","duration":171604,"timestamp":182285767763,"id":30,"parentId":25,"tags":{},"startTime":1781178988873,"traceId":"120613faee572585"},{"name":"check-page","duration":173508,"timestamp":182285765885,"id":25,"parentId":19,"tags":{"page":"/"},"startTime":1781178988871,"traceId":"120613faee572585"},{"name":"static-check","duration":175959,"timestamp":182285763448,"id":19,"parentId":1,"tags":{},"startTime":1781178988868,"traceId":"120613faee572585"},{"name":"write-routes-manifest","duration":291,"timestamp":182285940438,"id":32,"parentId":1,"tags":{},"startTime":1781178989045,"traceId":"120613faee572585"},{"name":"load-dotenv","duration":10,"timestamp":182285944526,"id":35,"parentId":34,"tags":{},"startTime":1781178989049,"traceId":"120613faee572585"},{"name":"run-export-path-map","duration":127,"timestamp":182285945557,"id":36,"parentId":34,"tags":{},"startTime":1781178989051,"traceId":"120613faee572585"},{"name":"next-export","duration":133383,"timestamp":182285944128,"id":34,"parentId":1,"tags":{},"startTime":1781178989049,"traceId":"120613faee572585"},{"name":"move-exported-app-not-found-","duration":390,"timestamp":182286077974,"id":37,"parentId":33,"tags":{},"startTime":1781178989183,"traceId":"120613faee572585"},{"name":"move-exported-app-global-error-","duration":265,"timestamp":182286078384,"id":38,"parentId":33,"tags":{},"startTime":1781178989183,"traceId":"120613faee572585"},{"name":"static-generation","duration":137255,"timestamp":182285942049,"id":33,"parentId":1,"tags":{},"startTime":1781178989047,"traceId":"120613faee572585"},{"name":"write-routes-manifest","duration":122,"timestamp":182286079350,"id":39,"parentId":1,"tags":{},"startTime":1781178989184,"traceId":"120613faee572585"},{"name":"print-tree-view","duration":795,"timestamp":182286081649,"id":40,"parentId":1,"tags":{},"startTime":1781178989187,"traceId":"120613faee572585"},{"name":"write-route-bundle-stats","duration":2458,"timestamp":182286082454,"id":41,"parentId":1,"tags":{},"startTime":1781178989187,"traceId":"120613faee572585"},{"name":"telemetry-flush","duration":497023,"timestamp":182286084925,"id":42,"parentId":1,"tags":{},"startTime":1781178989190,"traceId":"120613faee572585"},{"name":"next-build","duration":6934758,"timestamp":182279647229,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781178982752,"traceId":"120613faee572585"}]
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-turbopack","duration":3531820,"timestamp":89704478021,"id":14,"parentId":1,"tags":{},"startTime":1781086407737,"traceId":"0c0032e241b5a64e"},{"name":"turbopack-build-events","duration":28,"timestamp":89704560468,"id":15,"parentId":1,"tags":{},"startTime":1781086407820,"traceId":"0c0032e241b5a64e"},{"name":"run-typescript","duration":727260,"timestamp":89708026315,"id":16,"parentId":1,"tags":{},"startTime":1781086411285,"traceId":"0c0032e241b5a64e"},{"name":"static-check","duration":149915,"timestamp":89708758985,"id":19,"parentId":1,"tags":{},"startTime":1781086412018,"traceId":"0c0032e241b5a64e"},{"name":"static-generation","duration":145689,"timestamp":89708910704,"id":33,"parentId":1,"tags":{},"startTime":1781086412170,"traceId":"0c0032e241b5a64e"},{"name":"telemetry-flush","duration":497708,"timestamp":89709061072,"id":42,"parentId":1,"tags":{},"startTime":1781086412320,"traceId":"0c0032e241b5a64e"},{"name":"next-build","duration":6213416,"timestamp":89703345432,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781086406605,"traceId":"0c0032e241b5a64e"}]
1
+ [{"name":"run-turbopack","duration":4158829,"timestamp":182280828064,"id":14,"parentId":1,"tags":{},"startTime":1781178983933,"traceId":"120613faee572585"},{"name":"turbopack-build-events","duration":32,"timestamp":182280921296,"id":15,"parentId":1,"tags":{},"startTime":1781178984026,"traceId":"120613faee572585"},{"name":"run-typescript","duration":753082,"timestamp":182285004490,"id":16,"parentId":1,"tags":{},"startTime":1781178988109,"traceId":"120613faee572585"},{"name":"static-check","duration":175959,"timestamp":182285763448,"id":19,"parentId":1,"tags":{},"startTime":1781178988868,"traceId":"120613faee572585"},{"name":"static-generation","duration":137255,"timestamp":182285942049,"id":33,"parentId":1,"tags":{},"startTime":1781178989047,"traceId":"120613faee572585"},{"name":"telemetry-flush","duration":497023,"timestamp":182286084925,"id":42,"parentId":1,"tags":{},"startTime":1781178989190,"traceId":"120613faee572585"},{"name":"next-build","duration":6934758,"timestamp":182279647229,"id":1,"tags":{"buildMode":"default","version":"16.2.1","bundler":"turbopack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1781178982752,"traceId":"120613faee572585"}]
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
@@ -127,7 +127,10 @@ function findContainingDir(filePath) {
127
127
  function findInstancesUnder(dir) {
128
128
  return pruneRegistry().filter((index) => {
129
129
  const relative = import_node_path.default.relative(dir, index.dir);
130
- return relative !== "" && !relative.startsWith("..") && !import_node_path.default.isAbsolute(relative);
130
+ if (relative === "") return false;
131
+ if (relative.startsWith("..")) return false;
132
+ if (import_node_path.default.isAbsolute(relative)) return false;
133
+ return true;
131
134
  });
132
135
  }
133
136
  function fileUrlPath(dir, filePath) {
@@ -258,7 +261,6 @@ function parseArgs(argv) {
258
261
  return {
259
262
  inputArg: inputArgument,
260
263
  requestedPort,
261
- wantBackground: flagNames.has("--background") || flagNames.has("-b"),
262
264
  wantList: flagNames.has("--list") || flagNames.has("-l") || flagNames.has("--list-instances"),
263
265
  // legacy alias
264
266
  wantTear: flagNames.has("--tear") || flagNames.has("-t"),
@@ -267,6 +269,8 @@ function parseArgs(argv) {
267
269
  wantNonInteractive: flagNames.has("--non-interactive"),
268
270
  isDetachedChild: flagNames.has("--__detached"),
269
271
  // internal use only
272
+ isPortReused: flagNames.has("--__port-reused"),
273
+ // internal use only
270
274
  wantHelp: flagNames.has("--help") || flagNames.has("-h")
271
275
  };
272
276
  }
@@ -279,9 +283,6 @@ function printHelp() {
279
283
  tree(
280
284
  `${c.green("--port=<port>")} run on a specific port (default: random free port)`
281
285
  );
282
- tree(
283
- `${c.green("-b, --background")} run the preview server detached in the background`
284
- );
285
286
  tree(
286
287
  `${c.green("-t, --tear")} stop the instance already serving this path, then start fresh`
287
288
  );
@@ -305,12 +306,146 @@ function printHelp() {
305
306
  )
306
307
  );
307
308
  line(
308
- c.gray(
309
- "A file inside a served folder reuses that server; serving a folder"
310
- )
309
+ c.gray("A file inside a served folder reuses that server; serving a folder")
311
310
  );
312
311
  line(c.gray("replaces any narrower instances already running inside it."));
313
312
  line();
313
+ line(
314
+ c.gray("The server always runs in the background; stop it with ") + c.blue("--stop") + c.gray(" or ") + c.blue("--list") + c.gray(".")
315
+ );
316
+ line();
317
+ }
318
+ function stopAndExit(inputPath) {
319
+ banner();
320
+ const existing = findByDir(inputPath);
321
+ if (existing) {
322
+ killInstance(existing);
323
+ line(c.green(`\u2713 Stopped localhost:${existing.port}`));
324
+ tree(c.dim(tilde(existing.dir)));
325
+ } else {
326
+ line(c.yellow("No running instance for that path"));
327
+ tree(c.dim(tilde(inputPath)));
328
+ }
329
+ line();
330
+ process.exit(0);
331
+ }
332
+ function statInput(inputPath) {
333
+ try {
334
+ return (0, import_node_fs.statSync)(inputPath).isDirectory();
335
+ } catch {
336
+ banner();
337
+ line(c.red("\u2717 Path does not exist"));
338
+ tree(c.dim(inputPath));
339
+ line();
340
+ process.exit(1);
341
+ }
342
+ }
343
+ async function tearDownInstance(existing) {
344
+ banner();
345
+ line(c.yellow("Tearing down the running instance"));
346
+ tree(
347
+ `${c.green("localhost:" + existing.port)} ${c.gray("pid " + existing.pid)} ${existing.background ? c.magenta("background") : c.gray("foreground")}`
348
+ );
349
+ killInstance(existing);
350
+ line(c.green(`\u2713 Stopped localhost:${existing.port}`));
351
+ line();
352
+ await new Promise((r) => setTimeout(r, 400));
353
+ }
354
+ function reopenInstance(existing, parsed) {
355
+ const url = `http://localhost:${existing.port}`;
356
+ banner();
357
+ line(c.green("Already running \u2014 opening it in the browser"));
358
+ tree(`${c.bold("URL")} ${c.blue(url)}`);
359
+ tree(`${c.bold("Path")} ${c.dim(tilde(existing.dir))}`);
360
+ line();
361
+ line(
362
+ c.gray("Restart it with ") + c.blue("--tear") + c.gray(", or list with ") + c.blue("--list")
363
+ );
364
+ line();
365
+ openBrowser(url, parsed.wantNoOpen);
366
+ process.exit(0);
367
+ }
368
+ function reuseContainingDir(inputPath, isDirectory, parsed) {
369
+ const parent = findContainingDir(inputPath);
370
+ if (!parent) return;
371
+ const subPath = import_node_path.default.relative(parent.dir, inputPath).split(import_node_path.default.sep).map(encodeURIComponent).join("/");
372
+ const url = isDirectory ? `http://localhost:${parent.port}/${subPath}` : `http://localhost:${parent.port}${fileUrlPath(parent.dir, inputPath)}`;
373
+ banner();
374
+ line(
375
+ c.green(
376
+ isDirectory ? "Already serving a parent folder \u2014 opening it" : "Already serving this folder \u2014 opening the file"
377
+ )
378
+ );
379
+ tree(`${c.bold("URL")} ${c.blue(url)}`);
380
+ tree(`${c.bold(isDirectory ? "Folder" : "File")} ${c.dim(tilde(inputPath))}`);
381
+ tree(`${c.bold("Parent")} ${c.dim(tilde(parent.dir))}`);
382
+ line();
383
+ openBrowser(url, parsed.wantNoOpen);
384
+ process.exit(0);
385
+ }
386
+ async function supersedeNarrowerInstances(dir) {
387
+ const contained = findInstancesUnder(dir);
388
+ if (contained.length === 0) return void 0;
389
+ banner();
390
+ line(c.yellow("Stopping narrower instances inside this folder"));
391
+ for (const inst of contained) {
392
+ killInstance(inst);
393
+ tree(`${c.green("localhost:" + inst.port)} ${c.dim(tilde(inst.dir))}`);
394
+ }
395
+ const reusedPort = contained[0].port;
396
+ line(c.gray(`Reusing port ${reusedPort} for ${tilde(dir)}`));
397
+ line();
398
+ await new Promise((r) => setTimeout(r, 400));
399
+ return reusedPort;
400
+ }
401
+ async function reconcileInstances(inputPath, isDirectory, parsed) {
402
+ const existing = findByDir(inputPath);
403
+ if (existing) {
404
+ if (parsed.wantTear) {
405
+ await tearDownInstance(existing);
406
+ } else {
407
+ reopenInstance(existing, parsed);
408
+ }
409
+ }
410
+ if (!parsed.wantTear && (isDirectory || inputPath.endsWith(".md"))) {
411
+ reuseContainingDir(inputPath, isDirectory, parsed);
412
+ }
413
+ if (isDirectory) {
414
+ return supersedeNarrowerInstances(inputPath);
415
+ }
416
+ return void 0;
417
+ }
418
+ async function launchInBackground(inputPath, parsed, scriptPath, reclaimedPort) {
419
+ try {
420
+ const port = parsed.requestedPort || reclaimedPort || await getFreePort();
421
+ (0, import_node_fs.mkdirSync)(logDir(), { recursive: true });
422
+ const logFile = import_node_path.default.join(logDir(), `${port}.log`);
423
+ const out = (0, import_node_fs.openSync)(logFile, "a");
424
+ const childArgs = [scriptPath, inputPath, `--port=${port}`, "--__detached"];
425
+ if (parsed.wantNoOpen) childArgs.push("--no-open");
426
+ if (reclaimedPort) childArgs.push("--__port-reused");
427
+ const child = (0, import_node_child_process.spawn)(process.execPath, childArgs, {
428
+ detached: true,
429
+ stdio: ["ignore", out, out]
430
+ });
431
+ child.unref();
432
+ banner();
433
+ line(c.green("Started in the background"));
434
+ tree(`${c.bold("URL")} ${c.blue("http://localhost:" + port)}`);
435
+ tree(`${c.bold("Path")} ${c.dim(tilde(inputPath))}`);
436
+ tree(`${c.bold("PID")} ${c.dim(String(child.pid))}`);
437
+ tree(`${c.bold("Log")} ${c.dim(tilde(logFile))}`);
438
+ line();
439
+ line(c.gray("Stop it with: ") + c.blue("blogkit-md --list"));
440
+ line();
441
+ } catch (error) {
442
+ banner();
443
+ line(c.red("\u2717 Failed to start in the background"));
444
+ tree(c.dim(String(error)));
445
+ line();
446
+ process.exit(1);
447
+ }
448
+ process.exit(0);
314
449
  }
315
450
  async function run(argv) {
316
451
  const parsed = parseArgs(argv);
@@ -323,132 +458,19 @@ async function run(argv) {
323
458
  process.exit(0);
324
459
  }
325
460
  if (!parsed.inputArg) {
326
- if (parsed.wantStop) {
327
- banner();
328
- line(c.red("\u2717 --stop needs a path"));
329
- tree(c.dim("blogkit-md --stop <file-or-directory>"));
330
- line();
331
- process.exit(1);
332
- }
461
+ line(c.red("\u2717 Missing path"));
333
462
  printHelp();
334
463
  process.exit(1);
335
464
  }
336
465
  const inputPath = import_node_path.default.resolve(process.cwd(), parsed.inputArg);
337
- if (parsed.wantStop) {
338
- const existing = findByDir(inputPath);
339
- banner();
340
- if (existing) {
341
- killInstance(existing);
342
- line(c.green(`\u2713 Stopped localhost:${existing.port}`));
343
- tree(c.dim(tilde(existing.dir)));
344
- } else {
345
- line(c.yellow("No running instance for that path"));
346
- tree(c.dim(tilde(inputPath)));
347
- }
348
- line();
349
- process.exit(0);
350
- }
351
- let inputStat;
352
- try {
353
- inputStat = (0, import_node_fs.statSync)(inputPath);
354
- } catch {
355
- banner();
356
- line(c.red("\u2717 Path does not exist"));
357
- tree(c.dim(inputPath));
358
- line();
359
- process.exit(1);
360
- }
361
- const isDirectory = inputStat.isDirectory();
362
- if (!parsed.isDetachedChild) {
363
- const existing = findByDir(inputPath);
364
- if (existing) {
365
- if (parsed.wantTear) {
366
- banner();
367
- line(c.yellow("Tearing down the running instance"));
368
- tree(
369
- `${c.green("localhost:" + existing.port)} ${c.gray("pid " + existing.pid)} ${existing.background ? c.magenta("background") : c.gray("foreground")}`
370
- );
371
- killInstance(existing);
372
- line(c.green(`\u2713 Stopped localhost:${existing.port}`));
373
- line();
374
- await new Promise((r) => setTimeout(r, 400));
375
- } else {
376
- const url = `http://localhost:${existing.port}`;
377
- banner();
378
- line(c.green("Already running \u2014 opening it in the browser"));
379
- tree(`${c.bold("URL")} ${c.blue(url)}`);
380
- tree(`${c.bold("Path")} ${c.dim(tilde(existing.dir))}`);
381
- line();
382
- line(
383
- c.gray("Restart it with ") + c.blue("--tear") + c.gray(", or list with ") + c.blue("--list")
384
- );
385
- line();
386
- openBrowser(url, parsed.wantNoOpen);
387
- process.exit(0);
388
- }
389
- }
390
- if (!isDirectory && !parsed.wantTear && inputPath.endsWith(".md")) {
391
- const parent = findContainingDir(inputPath);
392
- if (parent) {
393
- const url = `http://localhost:${parent.port}${fileUrlPath(parent.dir, inputPath)}`;
394
- banner();
395
- line(c.green("Already serving this folder \u2014 opening the file"));
396
- tree(`${c.bold("URL")} ${c.blue(url)}`);
397
- tree(`${c.bold("File")} ${c.dim(tilde(inputPath))}`);
398
- tree(`${c.bold("Folder")} ${c.dim(tilde(parent.dir))}`);
399
- line();
400
- openBrowser(url, parsed.wantNoOpen);
401
- process.exit(0);
402
- }
403
- }
404
- if (isDirectory) {
405
- const contained = findInstancesUnder(inputPath);
406
- if (contained.length > 0) {
407
- banner();
408
- line(c.yellow("Stopping narrower instances inside this folder"));
409
- for (const inst of contained) {
410
- killInstance(inst);
411
- tree(
412
- `${c.green("localhost:" + inst.port)} ${c.dim(tilde(inst.dir))}`
413
- );
414
- }
415
- line();
416
- await new Promise((r) => setTimeout(r, 400));
417
- }
418
- }
419
- }
466
+ if (parsed.wantStop) stopAndExit(inputPath);
467
+ const isDirectory = statInput(inputPath);
468
+ const reclaimedPort = await reconcileInstances(inputPath, isDirectory, parsed);
420
469
  const scriptPath = process.argv[1];
421
470
  const packageRoot = import_node_path.default.dirname(import_node_path.default.dirname(scriptPath));
422
471
  const nextBin = import_node_path.default.join(packageRoot, "node_modules/.bin/next");
423
- if (parsed.wantBackground && !parsed.isDetachedChild) {
424
- try {
425
- const port = parsed.requestedPort || await getFreePort();
426
- (0, import_node_fs.mkdirSync)(logDir(), { recursive: true });
427
- const logFile = import_node_path.default.join(logDir(), `${port}.log`);
428
- const out = (0, import_node_fs.openSync)(logFile, "a");
429
- const child = (0, import_node_child_process.spawn)(
430
- process.execPath,
431
- [scriptPath, inputPath, `--port=${port}`, "--__detached"],
432
- { detached: true, stdio: ["ignore", out, out] }
433
- );
434
- child.unref();
435
- banner();
436
- line(c.green("Started in the background"));
437
- tree(`${c.bold("URL")} ${c.blue("http://localhost:" + port)}`);
438
- tree(`${c.bold("Path")} ${c.dim(tilde(inputPath))}`);
439
- tree(`${c.bold("PID")} ${c.dim(String(child.pid))}`);
440
- tree(`${c.bold("Log")} ${c.dim(tilde(logFile))}`);
441
- line();
442
- line(c.gray("Stop it with: ") + c.blue("blogkit-md --list"));
443
- line();
444
- } catch (error) {
445
- banner();
446
- line(c.red("\u2717 Failed to start in the background"));
447
- tree(c.dim(String(error)));
448
- line();
449
- process.exit(1);
450
- }
451
- process.exit(0);
472
+ if (!parsed.isDetachedChild) {
473
+ await launchInBackground(inputPath, parsed, scriptPath, reclaimedPort);
452
474
  }
453
475
  await startServer(inputPath, isDirectory, parsed, { nextBin, packageRoot });
454
476
  }
@@ -502,16 +524,10 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
502
524
  ssePort,
503
525
  dir: inputPath,
504
526
  isDirectory,
505
- background: parsed.isDetachedChild,
527
+ background: true,
506
528
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
507
529
  };
508
530
  addInstance(me);
509
- if (!parsed.isDetachedChild) {
510
- banner();
511
- line(
512
- c.gray("starting preview server for ") + c.blue(tilde(inputPath)) + c.gray(" \u2026")
513
- );
514
- }
515
531
  const child = (0, import_node_child_process.spawn)(paths.nextBin, ["start", "--port", String(nextPort)], {
516
532
  cwd: paths.packageRoot,
517
533
  env: nextEnvironment,
@@ -537,16 +553,7 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
537
553
  const match = chunk.toString().match(/http:\/\/localhost:\d+/);
538
554
  if (match) {
539
555
  ready = true;
540
- const url = `http://localhost:${nextPort}`;
541
- if (!parsed.isDetachedChild) {
542
- line();
543
- line(c.green("\u2713 Ready"));
544
- tree(`${c.bold("URL")} ${c.blue(url)}`);
545
- tree(`${c.bold("Path")} ${c.dim(tilde(inputPath))}`);
546
- line();
547
- line(c.gray("live reload on save \xB7 Ctrl-C to stop"));
548
- line();
549
- }
556
+ const url = parsed.isPortReused ? `http://localhost:${nextPort}/?_=${Date.now()}` : `http://localhost:${nextPort}`;
550
557
  openBrowser(url, parsed.wantNoOpen);
551
558
  }
552
559
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@san-siva/blogkit-md-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.30",
4
4
  "description": "CLI tool to preview markdown files as blogkit-md blog posts",
5
5
  "bin": {
6
6
  "blogkit-md": "./bin/blogkit-md"