@san-siva/blogkit-md-cli 0.1.27 → 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 +146 -143
  32. package/package.json +1 -1
  33. /package/.next/static/{TR9szE1OBV4WnCY3N0LVf → WtnY2j8isFkz6RmAQ9Olt}/_buildManifest.js +0 -0
  34. /package/.next/static/{TR9szE1OBV4WnCY3N0LVf → WtnY2j8isFkz6RmAQ9Olt}/_clientMiddlewareManifest.js +0 -0
  35. /package/.next/static/{TR9szE1OBV4WnCY3N0LVf → 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\":\"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\":\"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\": \"l+RAT3oMi/K7/l+6dP2QepZ5sGNZcc7FBXaEGY3l3OE=\"\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": "l+RAT3oMi/K7/l+6dP2QepZ5sGNZcc7FBXaEGY3l3OE="
4
+ "encryptionKey": "LZ40/n6ee2BH0h60gVyKgZLssok9AaPtYq41xf5YkWI="
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":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":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":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
@@ -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"),
@@ -279,9 +281,6 @@ function printHelp() {
279
281
  tree(
280
282
  `${c.green("--port=<port>")} run on a specific port (default: random free port)`
281
283
  );
282
- tree(
283
- `${c.green("-b, --background")} run the preview server detached in the background`
284
- );
285
284
  tree(
286
285
  `${c.green("-t, --tear")} stop the instance already serving this path, then start fresh`
287
286
  );
@@ -305,12 +304,144 @@ function printHelp() {
305
304
  )
306
305
  );
307
306
  line(
308
- c.gray(
309
- "A file inside a served folder reuses that server; serving a folder"
310
- )
307
+ c.gray("A file inside a served folder reuses that server; serving a folder")
311
308
  );
312
309
  line(c.gray("replaces any narrower instances already running inside it."));
313
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
+ }
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);
314
445
  }
315
446
  async function run(argv) {
316
447
  const parsed = parseArgs(argv);
@@ -323,132 +454,19 @@ async function run(argv) {
323
454
  process.exit(0);
324
455
  }
325
456
  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
- }
457
+ line(c.red("\u2717 Missing path"));
333
458
  printHelp();
334
459
  process.exit(1);
335
460
  }
336
461
  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
- }
462
+ if (parsed.wantStop) stopAndExit(inputPath);
463
+ const isDirectory = statInput(inputPath);
464
+ const reclaimedPort = await reconcileInstances(inputPath, isDirectory, parsed);
420
465
  const scriptPath = process.argv[1];
421
466
  const packageRoot = import_node_path.default.dirname(import_node_path.default.dirname(scriptPath));
422
467
  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);
468
+ if (!parsed.isDetachedChild) {
469
+ await launchInBackground(inputPath, parsed, scriptPath, reclaimedPort);
452
470
  }
453
471
  await startServer(inputPath, isDirectory, parsed, { nextBin, packageRoot });
454
472
  }
@@ -502,16 +520,10 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
502
520
  ssePort,
503
521
  dir: inputPath,
504
522
  isDirectory,
505
- background: parsed.isDetachedChild,
523
+ background: true,
506
524
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
507
525
  };
508
526
  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
527
  const child = (0, import_node_child_process.spawn)(paths.nextBin, ["start", "--port", String(nextPort)], {
516
528
  cwd: paths.packageRoot,
517
529
  env: nextEnvironment,
@@ -538,15 +550,6 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
538
550
  if (match) {
539
551
  ready = true;
540
552
  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
- }
550
553
  openBrowser(url, parsed.wantNoOpen);
551
554
  }
552
555
  }
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.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"