@san-siva/blogkit-md-cli 0.1.31 → 0.1.32

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 (140) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +5 -6
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +11 -14
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/[...slug]/page/build-manifest.json +2 -3
  10. package/.next/server/app/[...slug]/page.js +1 -1
  11. package/.next/server/app/[...slug]/page.js.nft.json +1 -1
  12. package/.next/server/app/[...slug]/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/_global-error/page/build-manifest.json +2 -3
  14. package/.next/server/app/_global-error.html +1 -1
  15. package/.next/server/app/_global-error.rsc +1 -1
  16. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  17. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  21. package/.next/server/app/_not-found/page/build-manifest.json +2 -3
  22. package/.next/server/app/_not-found.html +1 -1
  23. package/.next/server/app/_not-found.rsc +1 -1
  24. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  25. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  26. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  27. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  28. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  29. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/app/page/build-manifest.json +2 -3
  31. package/.next/server/app/page.js +2 -2
  32. package/.next/server/app/page.js.nft.json +1 -1
  33. package/.next/server/app/page_client-reference-manifest.js +1 -1
  34. package/.next/server/chunks/ssr/[root-of-the-server]__0.5ozv4._.js +29 -0
  35. package/.next/server/chunks/ssr/[root-of-the-server]__0.5ozv4._.js.map +1 -0
  36. package/.next/server/chunks/ssr/[root-of-the-server]__0zbye~u._.js +3 -0
  37. package/.next/server/chunks/ssr/[root-of-the-server]__0zbye~u._.js.map +1 -0
  38. package/.next/server/chunks/ssr/_0snb9u6._.js +1 -1
  39. package/.next/server/chunks/ssr/_0snb9u6._.js.map +1 -1
  40. package/.next/server/chunks/ssr/_10ngw_7._.js +6 -0
  41. package/.next/server/chunks/ssr/_10ngw_7._.js.map +1 -0
  42. package/.next/server/chunks/ssr/{node_modules_0yngs2q._.js → node_modules_022-q.a._.js} +2 -2
  43. package/.next/server/chunks/ssr/{node_modules_0t-k8i4._.js → node_modules_02e_kdt._.js} +2 -2
  44. package/.next/server/chunks/ssr/{node_modules_0db~o89._.js → node_modules_06n37ht._.js} +2 -2
  45. package/.next/server/chunks/ssr/{node_modules_0cdd-yr._.js → node_modules_08as~8-._.js} +2 -2
  46. package/.next/server/chunks/ssr/{node_modules_0kjv604._.js → node_modules_08po9k3._.js} +2 -2
  47. package/.next/server/chunks/ssr/{node_modules_0o3pkfu._.js → node_modules_0b5d9y9._.js} +2 -2
  48. package/.next/server/chunks/ssr/{node_modules_0fhhakx._.js → node_modules_0d-68zh._.js} +2 -2
  49. package/.next/server/chunks/ssr/{node_modules_08kbt4g._.js → node_modules_0d22nsb._.js} +2 -2
  50. package/.next/server/chunks/ssr/{node_modules_0p2z0dy._.js → node_modules_0dfwf7c._.js} +2 -2
  51. package/.next/server/chunks/ssr/{node_modules_0.dkr44._.js → node_modules_0fqqe.w._.js} +2 -2
  52. package/.next/server/chunks/ssr/{node_modules_112dugp._.js → node_modules_0g-gmvy._.js} +2 -2
  53. package/.next/server/chunks/ssr/{node_modules_04octt_._.js → node_modules_0g1528k._.js} +2 -2
  54. package/.next/server/chunks/ssr/{node_modules_0-ca471._.js → node_modules_0ijq66-._.js} +2 -2
  55. package/.next/server/chunks/ssr/{node_modules_0v7w1cr._.js → node_modules_0k.sf-w._.js} +2 -2
  56. package/.next/server/chunks/ssr/{node_modules_0pd0s3v._.js → node_modules_0qjv57.._.js} +2 -2
  57. package/.next/server/chunks/ssr/{node_modules_0x0lxgc._.js → node_modules_11on5fr._.js} +2 -2
  58. package/.next/server/chunks/ssr/{node_modules_@san-siva_blogkit_dist_esm_025fiap._.js → node_modules_@san-siva_blogkit_dist_esm_0nwh6le._.js} +2 -2
  59. package/.next/server/chunks/ssr/node_modules_next_dist_0h9llsw._.js +2 -2
  60. package/.next/server/middleware-build-manifest.js +5 -6
  61. package/.next/server/pages/404.html +1 -1
  62. package/.next/server/pages/500.html +1 -1
  63. package/.next/server/server-reference-manifest.js +1 -1
  64. package/.next/server/server-reference-manifest.json +1 -1
  65. package/.next/static/chunks/0f37zeuqu83fh.js +1 -0
  66. package/.next/static/chunks/1020z.ts_43yy.js +5 -0
  67. package/.next/static/chunks/turbopack-0uqp-h9xd51tq.js +1 -0
  68. package/.next/trace +1 -1
  69. package/.next/trace-build +1 -1
  70. package/bin/blogkit-md.js +303 -169
  71. package/package.json +3 -2
  72. package/.next/server/chunks/ssr/[root-of-the-server]__03je6ay._.js +0 -29
  73. package/.next/server/chunks/ssr/[root-of-the-server]__03je6ay._.js.map +0 -1
  74. package/.next/server/chunks/ssr/[root-of-the-server]__0x9.wg7._.js +0 -3
  75. package/.next/server/chunks/ssr/[root-of-the-server]__0x9.wg7._.js.map +0 -1
  76. package/.next/server/chunks/ssr/_0lv77ha._.js +0 -6
  77. package/.next/server/chunks/ssr/_0lv77ha._.js.map +0 -1
  78. package/.next/server/chunks/ssr/_0z4n825._.js +0 -6
  79. package/.next/server/chunks/ssr/_0z4n825._.js.map +0 -1
  80. package/.next/server/chunks/ssr/node_modules_00ku15~._.js +0 -3
  81. package/.next/server/chunks/ssr/node_modules_018k-zk._.js +0 -3
  82. package/.next/server/chunks/ssr/node_modules_04i0-ke._.js +0 -3
  83. package/.next/server/chunks/ssr/node_modules_04i0-ke._.js.map +0 -1
  84. package/.next/server/chunks/ssr/node_modules_04octt_._.js.map +0 -1
  85. package/.next/server/chunks/ssr/node_modules_0c078.q._.js +0 -3
  86. package/.next/server/chunks/ssr/node_modules_0cgrknt._.js +0 -3
  87. package/.next/server/chunks/ssr/node_modules_0e_79zm._.js +0 -3
  88. package/.next/server/chunks/ssr/node_modules_0ivb19g._.js +0 -3
  89. package/.next/server/chunks/ssr/node_modules_0ivb19g._.js.map +0 -1
  90. package/.next/server/chunks/ssr/node_modules_0m92vm.._.js +0 -3
  91. package/.next/server/chunks/ssr/node_modules_0pd0s3v._.js.map +0 -1
  92. package/.next/server/chunks/ssr/node_modules_0q8kj8z._.js +0 -3
  93. package/.next/server/chunks/ssr/node_modules_0q8kj8z._.js.map +0 -1
  94. package/.next/server/chunks/ssr/node_modules_0r4wa9n._.js +0 -3
  95. package/.next/server/chunks/ssr/node_modules_0r4wa9n._.js.map +0 -1
  96. package/.next/server/chunks/ssr/node_modules_0rbhlja._.js +0 -3
  97. package/.next/server/chunks/ssr/node_modules_0rbhlja._.js.map +0 -1
  98. package/.next/server/chunks/ssr/node_modules_0t-k8i4._.js.map +0 -1
  99. package/.next/server/chunks/ssr/node_modules_0tz~a15._.js +0 -3
  100. package/.next/server/chunks/ssr/node_modules_0tz~a15._.js.map +0 -1
  101. package/.next/server/chunks/ssr/node_modules_0v7w1cr._.js.map +0 -1
  102. package/.next/server/chunks/ssr/node_modules_0vd0ir0._.js +0 -3
  103. package/.next/server/chunks/ssr/node_modules_0vd0ir0._.js.map +0 -1
  104. package/.next/server/chunks/ssr/node_modules_0yngs2q._.js.map +0 -1
  105. package/.next/server/chunks/ssr/node_modules_0~b36w5._.js +0 -5
  106. package/.next/server/chunks/ssr/node_modules_0~b36w5._.js.map +0 -1
  107. package/.next/server/chunks/ssr/node_modules_112dugp._.js.map +0 -1
  108. package/.next/server/chunks/ssr/node_modules_11kh5-v._.js +0 -3
  109. package/.next/server/chunks/ssr/node_modules_11kh5-v._.js.map +0 -1
  110. package/.next/server/chunks/ssr/node_modules_133itrd._.js +0 -3
  111. package/.next/server/chunks/ssr/node_modules_133itrd._.js.map +0 -1
  112. package/.next/server/chunks/ssr/node_modules_@san-siva_blogkit_dist_esm_0ry~31p._.js +0 -3
  113. package/.next/server/chunks/ssr/node_modules_@san-siva_blogkit_dist_esm_0ry~31p._.js.map +0 -1
  114. package/.next/server/chunks/ssr/node_modules_next_dist_0t-hj0x._.js +0 -3
  115. package/.next/server/chunks/ssr/node_modules_next_dist_0t-hj0x._.js.map +0 -1
  116. package/.next/static/chunks/022i5lxiq4.fw.js +0 -4
  117. package/.next/static/chunks/0bgomtoptb4q7.js +0 -1
  118. package/.next/static/chunks/0s_h50.6-5q6r.js +0 -2
  119. package/.next/static/chunks/10t4l336soqlc.js +0 -1
  120. package/.next/static/chunks/turbopack-067_~051wvak1.js +0 -1
  121. /package/.next/server/chunks/ssr/{node_modules_018k-zk._.js.map → node_modules_022-q.a._.js.map} +0 -0
  122. /package/.next/server/chunks/ssr/{node_modules_0cgrknt._.js.map → node_modules_02e_kdt._.js.map} +0 -0
  123. /package/.next/server/chunks/ssr/{node_modules_0db~o89._.js.map → node_modules_06n37ht._.js.map} +0 -0
  124. /package/.next/server/chunks/ssr/{node_modules_0cdd-yr._.js.map → node_modules_08as~8-._.js.map} +0 -0
  125. /package/.next/server/chunks/ssr/{node_modules_0kjv604._.js.map → node_modules_08po9k3._.js.map} +0 -0
  126. /package/.next/server/chunks/ssr/{node_modules_0o3pkfu._.js.map → node_modules_0b5d9y9._.js.map} +0 -0
  127. /package/.next/server/chunks/ssr/{node_modules_0fhhakx._.js.map → node_modules_0d-68zh._.js.map} +0 -0
  128. /package/.next/server/chunks/ssr/{node_modules_08kbt4g._.js.map → node_modules_0d22nsb._.js.map} +0 -0
  129. /package/.next/server/chunks/ssr/{node_modules_0p2z0dy._.js.map → node_modules_0dfwf7c._.js.map} +0 -0
  130. /package/.next/server/chunks/ssr/{node_modules_0.dkr44._.js.map → node_modules_0fqqe.w._.js.map} +0 -0
  131. /package/.next/server/chunks/ssr/{node_modules_0e_79zm._.js.map → node_modules_0g-gmvy._.js.map} +0 -0
  132. /package/.next/server/chunks/ssr/{node_modules_00ku15~._.js.map → node_modules_0g1528k._.js.map} +0 -0
  133. /package/.next/server/chunks/ssr/{node_modules_0-ca471._.js.map → node_modules_0ijq66-._.js.map} +0 -0
  134. /package/.next/server/chunks/ssr/{node_modules_0c078.q._.js.map → node_modules_0k.sf-w._.js.map} +0 -0
  135. /package/.next/server/chunks/ssr/{node_modules_0m92vm.._.js.map → node_modules_0qjv57.._.js.map} +0 -0
  136. /package/.next/server/chunks/ssr/{node_modules_0x0lxgc._.js.map → node_modules_11on5fr._.js.map} +0 -0
  137. /package/.next/server/chunks/ssr/{node_modules_@san-siva_blogkit_dist_esm_025fiap._.js.map → node_modules_@san-siva_blogkit_dist_esm_0nwh6le._.js.map} +0 -0
  138. /package/.next/static/{hT9Ca9kXa0cCpH9PU5hdY → N7SAnV-SSIT9O4UxCw7Bf}/_buildManifest.js +0 -0
  139. /package/.next/static/{hT9Ca9kXa0cCpH9PU5hdY → N7SAnV-SSIT9O4UxCw7Bf}/_clientMiddlewareManifest.js +0 -0
  140. /package/.next/static/{hT9Ca9kXa0cCpH9PU5hdY → N7SAnV-SSIT9O4UxCw7Bf}/_ssgManifest.js +0 -0
package/bin/blogkit-md.js CHANGED
@@ -23,12 +23,16 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  ));
24
24
 
25
25
  // scripts/cli.ts
26
- var import_node_child_process = require("child_process");
27
- var import_node_fs = require("fs");
26
+ var import_node_child_process2 = require("child_process");
27
+ var import_node_fs2 = require("fs");
28
28
  var import_node_http = require("http");
29
- var import_node_os = __toESM(require("os"));
30
- var import_node_path = __toESM(require("path"));
29
+ var import_node_os3 = __toESM(require("os"));
30
+ var import_node_path2 = __toESM(require("path"));
31
31
  var import_node_readline = __toESM(require("readline"));
32
+
33
+ // scripts/cli/output.ts
34
+ var import_node_child_process = require("child_process");
35
+ var import_node_os = __toESM(require("os"));
32
36
  var useColor = process.stdout.isTTY && !process.env.NO_COLOR;
33
37
  var paint = (code) => (s) => useColor ? `\x1B[${code}m${s}\x1B[0m` : s;
34
38
  var c = {
@@ -45,6 +49,10 @@ var c = {
45
49
  var INDENT = " ".repeat(3);
46
50
  var line = (s = "") => console.log(INDENT + s);
47
51
  var tree = (s = "") => console.log(c.gray(INDENT + "\u2502 ") + s);
52
+ var tilde = (p) => {
53
+ const home = import_node_os.default.homedir();
54
+ return p.startsWith(home) ? "~" + p.slice(home.length) : p;
55
+ };
48
56
  var bannerShown = false;
49
57
  function banner() {
50
58
  if (bannerShown) return;
@@ -54,8 +62,115 @@ function banner() {
54
62
  line(c.gray("preview markdown as blogkit blog posts"));
55
63
  line();
56
64
  }
57
- var tilde = (p) => {
58
- const home = import_node_os.default.homedir();
65
+
66
+ // scripts/cli/registry.ts
67
+ var import_node_fs = require("fs");
68
+ var import_node_os2 = __toESM(require("os"));
69
+ var import_node_path = __toESM(require("path"));
70
+ var registryDir = () => process.env.BLOGKIT_MD_DIR || import_node_path.default.join(import_node_os2.default.homedir(), ".blogkit-md");
71
+ var registryFile = () => import_node_path.default.join(registryDir(), "instances.json");
72
+ var isAlive = (pid) => {
73
+ try {
74
+ process.kill(pid, 0);
75
+ return true;
76
+ } catch {
77
+ return false;
78
+ }
79
+ };
80
+ function readRegistry() {
81
+ try {
82
+ const raw = JSON.parse((0, import_node_fs.readFileSync)(registryFile(), "utf8"));
83
+ return Array.isArray(raw) ? raw : [];
84
+ } catch {
85
+ return [];
86
+ }
87
+ }
88
+ function writeRegistry(list) {
89
+ try {
90
+ (0, import_node_fs.mkdirSync)(registryDir(), { recursive: true });
91
+ (0, import_node_fs.writeFileSync)(registryFile(), JSON.stringify(list, null, 2));
92
+ } catch {
93
+ }
94
+ }
95
+ function pruneRegistry() {
96
+ const all = readRegistry();
97
+ const live = all.filter((i) => isAlive(i.pid));
98
+ if (live.length !== all.length) writeRegistry(live);
99
+ return live;
100
+ }
101
+ function removeInstance(pid) {
102
+ writeRegistry(readRegistry().filter((i) => i.pid !== pid));
103
+ }
104
+ function findByDir(dir) {
105
+ return pruneRegistry().find((i) => i.dir === dir);
106
+ }
107
+ function killInstance(inst) {
108
+ try {
109
+ process.kill(inst.pid, "SIGTERM");
110
+ } catch {
111
+ }
112
+ removeInstance(inst.pid);
113
+ }
114
+
115
+ // scripts/cli/stop.ts
116
+ function stopAllAndExit() {
117
+ banner();
118
+ const instances = pruneRegistry();
119
+ if (instances.length === 0) {
120
+ line(c.yellow("No running instances"));
121
+ } else {
122
+ for (const inst of instances) {
123
+ killInstance(inst);
124
+ line(c.green(`\u2713 Stopped localhost:${inst.port}`));
125
+ tree(c.dim(tilde(inst.dir)));
126
+ }
127
+ }
128
+ line();
129
+ process.exit(0);
130
+ }
131
+ function stopAndExit(inputPath) {
132
+ banner();
133
+ const existing = findByDir(inputPath);
134
+ if (existing) {
135
+ killInstance(existing);
136
+ line(c.green(`\u2713 Stopped localhost:${existing.port}`));
137
+ tree(c.dim(tilde(existing.dir)));
138
+ } else {
139
+ line(c.yellow("No running instance for that path"));
140
+ tree(c.dim(tilde(inputPath)));
141
+ }
142
+ line();
143
+ process.exit(0);
144
+ }
145
+
146
+ // scripts/cli.ts
147
+ var useColor2 = process.stdout.isTTY && !process.env.NO_COLOR;
148
+ var paint2 = (code) => (s) => useColor2 ? `\x1B[${code}m${s}\x1B[0m` : s;
149
+ var c2 = {
150
+ bold: paint2("1"),
151
+ dim: paint2("2"),
152
+ red: paint2("31"),
153
+ green: paint2("32"),
154
+ yellow: paint2("33"),
155
+ blue: paint2("34"),
156
+ magenta: paint2("35"),
157
+ cyan: paint2("36"),
158
+ gray: paint2("90")
159
+ };
160
+ var INDENT2 = " ".repeat(3);
161
+ var line2 = (s = "") => console.log(INDENT2 + s);
162
+ var tree2 = (s = "") => console.log(c2.gray(INDENT2 + "\u2502 ") + s);
163
+ var bannerShown2 = false;
164
+ function banner2() {
165
+ if (bannerShown2) return;
166
+ bannerShown2 = true;
167
+ line2();
168
+ line2(c2.bold(c2.blue("blogkit-md")));
169
+ line2(c2.gray("preview markdown as blogkit blog posts"));
170
+ line2();
171
+ }
172
+ var tilde2 = (p) => {
173
+ const home = import_node_os3.default.homedir();
59
174
  return p.startsWith(home) ? "~" + p.slice(home.length) : p;
60
175
  };
61
176
  function humanAge(iso) {
@@ -67,17 +182,23 @@ function humanAge(iso) {
67
182
  if (secs < 86400) return `${Math.floor(secs / 3600)}h`;
68
183
  return `${Math.floor(secs / 86400)}d`;
69
184
  }
70
- function openBrowser(url, skip = false) {
185
+ function openBrowser(url, skip = false, forceNewTab = false) {
71
186
  if (skip || process.env.BLOGKIT_MD_NO_OPEN) return;
72
187
  try {
73
- (0, import_node_child_process.exec)(`open -a "Google Chrome" ${url} || open ${url}`);
188
+ if (forceNewTab) {
189
+ (0, import_node_child_process2.exec)(
190
+ `osascript -e 'tell app "Google Chrome" to open location "${url}"' 2>/dev/null || open -a "Google Chrome" "${url}" || open "${url}"`
191
+ );
192
+ } else {
193
+ (0, import_node_child_process2.exec)(`open -a "Google Chrome" "${url}" || open "${url}"`);
194
+ }
74
195
  } catch {
75
196
  }
76
197
  }
77
- var registryDir = () => process.env.BLOGKIT_MD_DIR || import_node_path.default.join(import_node_os.default.homedir(), ".blogkit-md");
78
- var registryFile = () => import_node_path.default.join(registryDir(), "instances.json");
79
- var logDir = () => import_node_path.default.join(registryDir(), "logs");
80
- var isAlive = (pid) => {
198
+ var registryDir2 = () => process.env.BLOGKIT_MD_DIR || import_node_path2.default.join(import_node_os3.default.homedir(), ".blogkit-md");
199
+ var registryFile2 = () => import_node_path2.default.join(registryDir2(), "instances.json");
200
+ var logDir = () => import_node_path2.default.join(registryDir2(), "logs");
201
+ var isAlive2 = (pid) => {
81
202
  try {
82
203
  process.kill(pid, 0);
83
204
  return true;
@@ -85,75 +206,69 @@ var isAlive = (pid) => {
85
206
  return false;
86
207
  }
87
208
  };
88
- function readRegistry() {
209
+ function readRegistry2() {
89
210
  try {
90
- const raw = JSON.parse((0, import_node_fs.readFileSync)(registryFile(), "utf8"));
211
+ const raw = JSON.parse((0, import_node_fs2.readFileSync)(registryFile2(), "utf8"));
91
212
  return Array.isArray(raw) ? raw : [];
92
213
  } catch {
93
214
  return [];
94
215
  }
95
216
  }
96
- function writeRegistry(list) {
217
+ function writeRegistry2(list) {
97
218
  try {
98
- (0, import_node_fs.mkdirSync)(registryDir(), { recursive: true });
99
- (0, import_node_fs.writeFileSync)(registryFile(), JSON.stringify(list, null, 2));
219
+ (0, import_node_fs2.mkdirSync)(registryDir2(), { recursive: true });
220
+ (0, import_node_fs2.writeFileSync)(registryFile2(), JSON.stringify(list, null, 2));
100
221
  } catch {
101
222
  }
102
223
  }
103
- function pruneRegistry() {
104
- const all = readRegistry();
105
- const live = all.filter((index) => isAlive(index.pid));
106
- if (live.length !== all.length) writeRegistry(live);
224
+ function pruneRegistry2() {
225
+ const all = readRegistry2();
226
+ const live = all.filter((index) => isAlive2(index.pid));
227
+ if (live.length !== all.length) writeRegistry2(live);
107
228
  return live;
108
229
  }
109
230
  function addInstance(inst) {
110
- const list = pruneRegistry().filter((index) => index.pid !== inst.pid);
231
+ const list = pruneRegistry2().filter((index) => index.pid !== inst.pid);
111
232
  list.push(inst);
112
- writeRegistry(list);
233
+ writeRegistry2(list);
113
234
  }
114
- function removeInstance(pid) {
115
- writeRegistry(readRegistry().filter((index) => index.pid !== pid));
235
+ function removeInstance2(pid) {
236
+ writeRegistry2(readRegistry2().filter((index) => index.pid !== pid));
116
237
  }
117
- function findByDir(dir) {
118
- return pruneRegistry().find((index) => index.dir === dir);
238
+ function findByDir2(dir) {
239
+ return pruneRegistry2().find((index) => index.dir === dir);
119
240
  }
241
+ var isInside = (parent, child) => {
242
+ const relative = import_node_path2.default.relative(parent, child);
243
+ return relative !== "" && relative !== ".." && !relative.startsWith(".." + import_node_path2.default.sep) && !import_node_path2.default.isAbsolute(relative);
244
+ };
120
245
  function findContainingDir(filePath) {
121
- const contains = (dir) => {
122
- const relative = import_node_path.default.relative(dir, filePath);
123
- return relative !== "" && !relative.startsWith("..") && !import_node_path.default.isAbsolute(relative);
124
- };
125
- return pruneRegistry().filter((index) => index.isDirectory && contains(index.dir)).toSorted((a, b) => b.dir.length - a.dir.length)[0];
246
+ return pruneRegistry2().filter((index) => index.isDirectory && isInside(index.dir, filePath)).toSorted((a, b) => b.dir.length - a.dir.length)[0];
126
247
  }
127
248
  function findInstancesUnder(dir) {
128
- return pruneRegistry().filter((index) => {
129
- const relative = import_node_path.default.relative(dir, index.dir);
130
- if (relative === "") return false;
131
- if (relative.startsWith("..")) return false;
132
- if (import_node_path.default.isAbsolute(relative)) return false;
133
- return true;
134
- });
249
+ return pruneRegistry2().filter((index) => isInside(dir, index.dir));
135
250
  }
136
251
  function fileUrlPath(dir, filePath) {
137
- const relative = import_node_path.default.relative(dir, filePath);
138
- return "/" + relative.replace(/\.md$/, "").split(import_node_path.default.sep).map(encodeURIComponent).join("/");
252
+ const relative = import_node_path2.default.relative(dir, filePath);
253
+ return "/" + relative.replace(/\.md$/, "").split(import_node_path2.default.sep).map(encodeURIComponent).join("/");
139
254
  }
140
- function killInstance(inst) {
255
+ function killInstance2(inst) {
141
256
  try {
142
257
  process.kill(inst.pid, "SIGTERM");
143
258
  } catch {
144
259
  }
145
- removeInstance(inst.pid);
260
+ removeInstance2(inst.pid);
146
261
  }
147
262
  function instanceLabel(inst) {
148
263
  const kind = inst.isDirectory ? "\u{1F4C1}" : "\u{1F4C4}";
149
- const mode = inst.background ? c.magenta("bg") : c.gray("fg");
150
- return `${c.green("localhost:" + inst.port)} ${kind} ${tilde(inst.dir)} ${c.gray("pid " + inst.pid)} ${c.gray("\xB7 " + humanAge(inst.startedAt))} ${mode}`;
264
+ const mode = inst.background ? c2.magenta("bg") : c2.gray("fg");
265
+ return `${c2.green("localhost:" + inst.port)} ${kind} ${tilde2(inst.dir)} ${c2.gray("pid " + inst.pid)} ${c2.gray("\xB7 " + humanAge(inst.startedAt))} ${mode}`;
151
266
  }
152
267
  function printPlainList(instances) {
153
- banner();
154
- line(c.bold("Running instances"));
155
- instances.forEach((index) => tree(instanceLabel(index)));
156
- line();
268
+ banner2();
269
+ line2(c2.bold("Running instances"));
270
+ instances.forEach((index) => tree2(instanceLabel(index)));
271
+ line2();
157
272
  }
158
273
  function printScriptList(instances) {
159
274
  for (const inst of instances) {
@@ -162,15 +277,15 @@ function printScriptList(instances) {
162
277
  }
163
278
  }
164
279
  async function listInstancesInteractive(nonInteractive = false) {
165
- let instances = pruneRegistry();
280
+ let instances = pruneRegistry2();
166
281
  if (nonInteractive) {
167
282
  printScriptList(instances);
168
283
  return;
169
284
  }
170
285
  if (instances.length === 0) {
171
- banner();
172
- line(c.yellow("No running blogkit-md instances."));
173
- line();
286
+ banner2();
287
+ line2(c2.yellow("No running blogkit-md instances."));
288
+ line2();
174
289
  return;
175
290
  }
176
291
  if (!process.stdin.isTTY) {
@@ -192,16 +307,16 @@ async function listInstancesInteractive(nonInteractive = false) {
192
307
  const render = (footer) => {
193
308
  const out = [
194
309
  "",
195
- INDENT + c.bold(c.blue("blogkit-md")) + c.gray(" \xB7 running instances"),
310
+ INDENT2 + c2.bold(c2.blue("blogkit-md")) + c2.gray(" \xB7 running instances"),
196
311
  "",
197
312
  ...instances.map((inst, rowIndex) => {
198
313
  const selected = rowIndex === index;
199
- const pointer = selected ? c.blue("\u276F ") : " ";
200
- const label = selected ? instanceLabel(inst) : c.dim(instanceLabel(inst));
201
- return INDENT + pointer + label;
314
+ const pointer = selected ? c2.blue("\u276F ") : " ";
315
+ const label = selected ? instanceLabel(inst) : c2.dim(instanceLabel(inst));
316
+ return INDENT2 + pointer + label;
202
317
  }),
203
318
  "",
204
- footer ?? c.gray(INDENT + "\u2191/\u2193 j/k move \u23CE open in Chrome x stop q quit"),
319
+ footer ?? c2.gray(INDENT2 + "\u2191/\u2193 j/k move \u23CE open in Chrome x stop q quit"),
205
320
  ""
206
321
  ];
207
322
  process.stdout.write("\x1B[2J\x1B[H" + out.join("\n") + "\n");
@@ -230,19 +345,19 @@ async function listInstancesInteractive(nonInteractive = false) {
230
345
  }
231
346
  case "return": {
232
347
  openBrowser(`http://localhost:${target.port}`);
233
- render(c.green(INDENT + `Opened localhost:${target.port} in Chrome`));
348
+ render(c2.green(INDENT2 + `Opened localhost:${target.port} in Chrome`));
234
349
  finish();
235
350
  return;
236
351
  }
237
352
  case "x": {
238
- killInstance(target);
239
- render(c.green(INDENT + `Stopped localhost:${target.port}.`));
353
+ killInstance2(target);
354
+ render(c2.green(INDENT2 + `Stopped localhost:${target.port}.`));
240
355
  finish();
241
356
  return;
242
357
  }
243
358
  default: {
244
359
  if (key.name === "q" || key.name === "escape" || key.ctrl && key.name === "c") {
245
- render(c.gray(INDENT + "Ciao \u{1F44B}"));
360
+ render(c2.gray(INDENT2 + "Ciao \u{1F44B}"));
246
361
  finish();
247
362
  }
248
363
  }
@@ -252,6 +367,26 @@ async function listInstancesInteractive(nonInteractive = false) {
252
367
  render();
253
368
  });
254
369
  }
370
+ var KNOWN_FLAGS = /* @__PURE__ */ new Set([
371
+ "--port",
372
+ "--tear",
373
+ "-t",
374
+ "--list",
375
+ "-l",
376
+ "--list-instances",
377
+ "--no-open",
378
+ "-n",
379
+ "--stop",
380
+ "-s",
381
+ "--stop-all",
382
+ "-S",
383
+ "--non-interactive",
384
+ "--help",
385
+ "-h",
386
+ "--__detached",
387
+ "--__port-reused"
388
+ // internal
389
+ ]);
255
390
  function parseArgs(argv) {
256
391
  const isFlag = (a) => a.startsWith("-");
257
392
  const flagNames = new Set(argv.filter(isFlag).map((a) => a.split("=", 1)[0]));
@@ -266,140 +401,129 @@ function parseArgs(argv) {
266
401
  wantTear: flagNames.has("--tear") || flagNames.has("-t"),
267
402
  wantNoOpen: flagNames.has("--no-open") || flagNames.has("-n"),
268
403
  wantStop: flagNames.has("--stop") || flagNames.has("-s"),
404
+ wantStopAll: flagNames.has("--stop-all") || flagNames.has("-S"),
269
405
  wantNonInteractive: flagNames.has("--non-interactive"),
270
406
  isDetachedChild: flagNames.has("--__detached"),
271
407
  // internal use only
272
408
  isPortReused: flagNames.has("--__port-reused"),
273
409
  // internal use only
274
- wantHelp: flagNames.has("--help") || flagNames.has("-h")
410
+ wantHelp: flagNames.has("--help") || flagNames.has("-h"),
411
+ unknownFlags: [...flagNames].filter((f) => !KNOWN_FLAGS.has(f))
275
412
  };
276
413
  }
277
414
  function printHelp() {
278
- banner();
279
- line(c.bold("Usage"));
280
- tree("blogkit-md <file-or-directory> [options]");
281
- line();
282
- line(c.bold("Options"));
283
- tree(
284
- `${c.green("--port=<port>")} run on a specific port (default: random free port)`
415
+ banner2();
416
+ line2(c2.bold("Usage"));
417
+ tree2("blogkit-md <file-or-directory> [options]");
418
+ line2();
419
+ line2(c2.bold("Options"));
420
+ tree2(
421
+ `${c2.green("--port=<port>")} run on a specific port (default: random free port)`
285
422
  );
286
- tree(
287
- `${c.green("-t, --tear")} stop the instance already serving this path, then start fresh`
423
+ tree2(
424
+ `${c2.green("-t, --tear")} stop the instance already serving this path, then start fresh`
288
425
  );
289
- tree(
290
- `${c.green("-l, --list")} interactively list & stop running instances`
426
+ tree2(
427
+ `${c2.green("-l, --list")} interactively list & stop running instances`
291
428
  );
292
- tree(
293
- `${c.green("--non-interactive")} with -l, print a plain "<port>\\t<path>" list and exit`
429
+ tree2(
430
+ `${c2.green("--non-interactive")} with -l, print a plain "<port>\\t<path>" list and exit`
294
431
  );
295
- tree(
296
- `${c.green("-s, --stop")} stop the instance serving the given path, then exit`
432
+ tree2(
433
+ `${c2.green("-s, --stop")} stop the instance serving the given path, then exit`
297
434
  );
298
- tree(
299
- `${c.green("-n, --no-open")} start the server without opening it in the browser`
435
+ tree2(`${c2.green("-S, --stop-all")} stop all running instances, then exit`);
436
+ tree2(
437
+ `${c2.green("-n, --no-open")} start the server without opening it in the browser`
300
438
  );
301
- tree(`${c.green("-h, --help")} show this help`);
302
- line();
303
- line(
304
- c.gray(
439
+ tree2(`${c2.green("-h, --help")} show this help`);
440
+ line2();
441
+ line2(
442
+ c2.gray(
305
443
  "If a path is already being served, running it again just reopens it."
306
444
  )
307
445
  );
308
- line(
309
- c.gray("A file inside a served folder reuses that server; serving a folder")
446
+ line2(
447
+ c2.gray("A file inside a served folder reuses that server; serving a folder")
310
448
  );
311
- line(c.gray("replaces any narrower instances already running inside it."));
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(".")
449
+ line2(c2.gray("replaces any narrower instances already running inside it."));
450
+ line2();
451
+ line2(
452
+ c2.gray("The server always runs in the background; stop it with ") + c2.blue("--stop") + c2.gray(" or ") + c2.blue("--list") + c2.gray(".")
315
453
  );
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);
454
+ line2();
331
455
  }
332
456
  function statInput(inputPath) {
333
457
  try {
334
- return (0, import_node_fs.statSync)(inputPath).isDirectory();
458
+ return (0, import_node_fs2.statSync)(inputPath).isDirectory();
335
459
  } catch {
336
- banner();
337
- line(c.red("\u2717 Path does not exist"));
338
- tree(c.dim(inputPath));
339
- line();
460
+ banner2();
461
+ line2(c2.red("\u2717 Path does not exist"));
462
+ tree2(c2.dim(inputPath));
463
+ line2();
340
464
  process.exit(1);
341
465
  }
342
466
  }
343
467
  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")}`
468
+ banner2();
469
+ line2(c2.yellow("Tearing down the running instance"));
470
+ tree2(
471
+ `${c2.green("localhost:" + existing.port)} ${c2.gray("pid " + existing.pid)} ${existing.background ? c2.magenta("background") : c2.gray("foreground")}`
348
472
  );
349
- killInstance(existing);
350
- line(c.green(`\u2713 Stopped localhost:${existing.port}`));
351
- line();
473
+ killInstance2(existing);
474
+ line2(c2.green(`\u2713 Stopped localhost:${existing.port}`));
475
+ line2();
352
476
  await new Promise((r) => setTimeout(r, 400));
353
477
  }
354
478
  function reopenInstance(existing, parsed) {
355
479
  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")
480
+ banner2();
481
+ line2(c2.green("Already running \u2014 opening it in the browser"));
482
+ tree2(`${c2.bold("URL")} ${c2.blue(url)}`);
483
+ tree2(`${c2.bold("Path")} ${c2.dim(tilde2(existing.dir))}`);
484
+ line2();
485
+ line2(
486
+ c2.gray("Restart it with ") + c2.blue("--tear") + c2.gray(", or list with ") + c2.blue("--list")
363
487
  );
364
- line();
488
+ line2();
365
489
  openBrowser(url, parsed.wantNoOpen);
366
490
  process.exit(0);
367
491
  }
368
492
  function reuseContainingDir(inputPath, isDirectory, parsed) {
369
493
  const parent = findContainingDir(inputPath);
370
494
  if (!parent) return;
371
- const subPath = import_node_path.default.relative(parent.dir, inputPath).split(import_node_path.default.sep).map(encodeURIComponent).join("/");
495
+ const subPath = import_node_path2.default.relative(parent.dir, inputPath).split(import_node_path2.default.sep).map(encodeURIComponent).join("/");
372
496
  const url = isDirectory ? `http://localhost:${parent.port}/${subPath}/` : `http://localhost:${parent.port}${fileUrlPath(parent.dir, inputPath)}`;
373
- banner();
374
- line(
375
- c.green(
497
+ banner2();
498
+ line2(
499
+ c2.green(
376
500
  isDirectory ? "Already serving a parent folder \u2014 opening it" : "Already serving this folder \u2014 opening the file"
377
501
  )
378
502
  );
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();
503
+ tree2(`${c2.bold("URL")} ${c2.blue(url)}`);
504
+ tree2(`${c2.bold(isDirectory ? "Folder" : "File")} ${c2.dim(tilde2(inputPath))}`);
505
+ tree2(`${c2.bold("Parent")} ${c2.dim(tilde2(parent.dir))}`);
506
+ line2();
383
507
  openBrowser(url, parsed.wantNoOpen);
384
508
  process.exit(0);
385
509
  }
386
510
  async function supersedeNarrowerInstances(dir) {
387
511
  const contained = findInstancesUnder(dir);
388
512
  if (contained.length === 0) return void 0;
389
- banner();
390
- line(c.yellow("Stopping narrower instances inside this folder"));
513
+ banner2();
514
+ line2(c2.yellow("Stopping narrower instances inside this folder"));
391
515
  for (const inst of contained) {
392
- killInstance(inst);
393
- tree(`${c.green("localhost:" + inst.port)} ${c.dim(tilde(inst.dir))}`);
516
+ killInstance2(inst);
517
+ tree2(`${c2.green("localhost:" + inst.port)} ${c2.dim(tilde2(inst.dir))}`);
394
518
  }
395
519
  const reusedPort = contained[0].port;
396
- line(c.gray(`Reusing port ${reusedPort} for ${tilde(dir)}`));
397
- line();
520
+ line2(c2.gray(`Reusing port ${reusedPort} for ${tilde2(dir)}`));
521
+ line2();
398
522
  await new Promise((r) => setTimeout(r, 400));
399
523
  return reusedPort;
400
524
  }
401
525
  async function reconcileInstances(inputPath, isDirectory, parsed) {
402
- const existing = findByDir(inputPath);
526
+ const existing = findByDir2(inputPath);
403
527
  if (existing) {
404
528
  if (parsed.wantTear) {
405
529
  await tearDownInstance(existing);
@@ -418,57 +542,67 @@ async function reconcileInstances(inputPath, isDirectory, parsed) {
418
542
  async function launchInBackground(inputPath, parsed, scriptPath, reclaimedPort) {
419
543
  try {
420
544
  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");
545
+ (0, import_node_fs2.mkdirSync)(logDir(), { recursive: true });
546
+ const logFile = import_node_path2.default.join(logDir(), `${port}.log`);
547
+ const out = (0, import_node_fs2.openSync)(logFile, "a");
424
548
  const childArgs = [scriptPath, inputPath, `--port=${port}`, "--__detached"];
425
549
  if (parsed.wantNoOpen) childArgs.push("--no-open");
426
550
  if (reclaimedPort) childArgs.push("--__port-reused");
427
- const child = (0, import_node_child_process.spawn)(process.execPath, childArgs, {
551
+ const child = (0, import_node_child_process2.spawn)(process.execPath, childArgs, {
428
552
  detached: true,
429
553
  stdio: ["ignore", out, out]
430
554
  });
431
555
  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();
556
+ banner2();
557
+ line2(c2.green("Started in the background"));
558
+ tree2(`${c2.bold("URL")} ${c2.blue("http://localhost:" + port)}`);
559
+ tree2(`${c2.bold("Path")} ${c2.dim(tilde2(inputPath))}`);
560
+ tree2(`${c2.bold("PID")} ${c2.dim(String(child.pid))}`);
561
+ tree2(`${c2.bold("Log")} ${c2.dim(tilde2(logFile))}`);
562
+ line2();
563
+ line2(c2.gray("Stop it with: ") + c2.blue("blogkit-md --list"));
564
+ line2();
441
565
  } catch (error) {
442
- banner();
443
- line(c.red("\u2717 Failed to start in the background"));
444
- tree(c.dim(String(error)));
445
- line();
566
+ banner2();
567
+ line2(c2.red("\u2717 Failed to start in the background"));
568
+ tree2(c2.dim(String(error)));
569
+ line2();
446
570
  process.exit(1);
447
571
  }
448
572
  process.exit(0);
449
573
  }
450
574
  async function run(argv) {
451
575
  const parsed = parseArgs(argv);
576
+ if (parsed.unknownFlags.length > 0) {
577
+ banner2();
578
+ for (const flag of parsed.unknownFlags) {
579
+ line2(c2.red(`\u2717 Unknown flag: ${flag}`));
580
+ }
581
+ line2();
582
+ printHelp();
583
+ process.exit(1);
584
+ }
452
585
  if (parsed.wantHelp) {
453
586
  printHelp();
454
587
  process.exit(0);
455
588
  }
589
+ if (parsed.wantStopAll) stopAllAndExit();
456
590
  if (parsed.wantList) {
457
591
  await listInstancesInteractive(parsed.wantNonInteractive);
458
592
  process.exit(0);
459
593
  }
460
594
  if (!parsed.inputArg) {
461
- line(c.red("\u2717 Missing path"));
595
+ line2(c2.red("\u2717 Missing path"));
462
596
  printHelp();
463
597
  process.exit(1);
464
598
  }
465
- const inputPath = import_node_path.default.resolve(process.cwd(), parsed.inputArg);
599
+ const inputPath = import_node_path2.default.resolve(process.cwd(), parsed.inputArg);
466
600
  if (parsed.wantStop) stopAndExit(inputPath);
467
601
  const isDirectory = statInput(inputPath);
468
602
  const reclaimedPort = await reconcileInstances(inputPath, isDirectory, parsed);
469
603
  const scriptPath = process.argv[1];
470
- const packageRoot = import_node_path.default.dirname(import_node_path.default.dirname(scriptPath));
471
- const nextBin = import_node_path.default.join(packageRoot, "node_modules/.bin/next");
604
+ const packageRoot = import_node_path2.default.dirname(import_node_path2.default.dirname(scriptPath));
605
+ const nextBin = import_node_path2.default.join(packageRoot, "node_modules/.bin/next");
472
606
  if (!parsed.isDetachedChild) {
473
607
  await launchInBackground(inputPath, parsed, scriptPath, reclaimedPort);
474
608
  }
@@ -509,12 +643,12 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
509
643
  for (const client of clients) client.write("data: reload\n\n");
510
644
  };
511
645
  if (isDirectory) {
512
- (0, import_node_fs.watch)(inputPath, { recursive: true }, (_, filename) => {
646
+ (0, import_node_fs2.watch)(inputPath, { recursive: true }, (_, filename) => {
513
647
  if (filename && filename.endsWith(".md")) broadcastReload();
514
648
  });
515
649
  } else {
516
- const markdownFilename = import_node_path.default.basename(inputPath);
517
- (0, import_node_fs.watch)(import_node_path.default.dirname(inputPath), (_, filename) => {
650
+ const markdownFilename = import_node_path2.default.basename(inputPath);
651
+ (0, import_node_fs2.watch)(import_node_path2.default.dirname(inputPath), (_, filename) => {
518
652
  if (filename === markdownFilename) broadcastReload();
519
653
  });
520
654
  }
@@ -528,7 +662,7 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
528
662
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
529
663
  };
530
664
  addInstance(me);
531
- const child = (0, import_node_child_process.spawn)(paths.nextBin, ["start", "--port", String(nextPort)], {
665
+ const child = (0, import_node_child_process2.spawn)(paths.nextBin, ["start", "--port", String(nextPort)], {
532
666
  cwd: paths.packageRoot,
533
667
  env: nextEnvironment,
534
668
  stdio: ["inherit", "pipe", "inherit"]
@@ -542,7 +676,7 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
542
676
  sseServer.close();
543
677
  } catch {
544
678
  }
545
- removeInstance(process.pid);
679
+ removeInstance2(process.pid);
546
680
  };
547
681
  process.on("exit", shutdown);
548
682
  process.on("SIGINT", () => process.exit(0));
@@ -553,8 +687,8 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
553
687
  const match = chunk.toString().match(/http:\/\/localhost:\d+/);
554
688
  if (match) {
555
689
  ready = true;
556
- const url = parsed.isPortReused ? `http://localhost:${nextPort}/?_=${Date.now()}` : `http://localhost:${nextPort}`;
557
- openBrowser(url, parsed.wantNoOpen);
690
+ const url = `http://localhost:${nextPort}`;
691
+ openBrowser(url, parsed.wantNoOpen, parsed.isPortReused);
558
692
  }
559
693
  }
560
694
  });
@@ -563,7 +697,7 @@ async function startServer(inputPath, isDirectory, parsed, paths) {
563
697
  sseServer.close();
564
698
  } catch {
565
699
  }
566
- removeInstance(process.pid);
700
+ removeInstance2(process.pid);
567
701
  process.exit(code ?? 0);
568
702
  });
569
703
  }