@abide/abide 0.33.0 → 0.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # abide
2
2
 
3
+ ## 0.33.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e9fb88f`](https://github.com/briancray/abide/commit/e9fb88f517d9c7eac24044a6b65f473263525a6e) - keep a wedged dev orchestrator from orphaning the server on the port ([`a29800d`](https://github.com/briancray/abide/commit/a29800d76300ff4d1c99a4d27dc790562a4af57b))
8
+
3
9
  ## 0.33.0
4
10
 
5
11
  ### Minor Changes
package/bin/abide.ts CHANGED
@@ -36,8 +36,11 @@ handler the parent's default action kills it instantly — abandoning the
36
36
  `await child.exited` and orphaning the child, which (for a server) can then
37
37
  linger holding the port. Forwarding the signal and awaiting the child's exit
38
38
  (with a SIGKILL watchdog for a wedged child) guarantees the child is reaped
39
- before the parent leaves. Mirrors the child's exit code so callers and CI see
40
- the real result.
39
+ before the parent leaves. SIGHUP (terminal close) is forwarded too: if Bun
40
+ spawns the child in its own process group the kernel's terminal-close signal
41
+ never reaches it, so the child only learns to shut down by this relay — without
42
+ it a closed terminal orphans the child on the port. Mirrors the child's exit
43
+ code so callers and CI see the real result.
41
44
  */
42
45
  async function runChild(cmd: string[]): Promise<never> {
43
46
  const child = Bun.spawn({ cmd, cwd, stdio: ['inherit', 'inherit', 'inherit'] })
@@ -47,6 +50,7 @@ async function runChild(cmd: string[]): Promise<never> {
47
50
  }
48
51
  process.on('SIGINT', () => forward('SIGINT'))
49
52
  process.on('SIGTERM', () => forward('SIGTERM'))
53
+ process.on('SIGHUP', () => forward('SIGHUP'))
50
54
  process.exit(await child.exited)
51
55
  }
52
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abide/abide",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Isomorphic multimodal HTTP framework built for humans and machines in a single Bun runtime",
package/src/devEntry.ts CHANGED
@@ -81,7 +81,18 @@ function spawnWorker(port: number): { proc: Subprocess; ready: Promise<void> } {
81
81
  const proc = Bun.spawn({
82
82
  cmd: ['bun', '--preload', PRELOAD, SERVER_ENTRY],
83
83
  cwd,
84
- env: { ...process.env, PORT: String(port), ABIDE_DEV: '1' },
84
+ /*
85
+ ABIDE_PARENT_PID activates serverEntry's exitWithParent watchdog: the
86
+ worker polls this orchestrator and self-exits if it dies abruptly
87
+ (kill -9, OOM) without running its shutdown handlers, so a wedged
88
+ orchestrator can't leave the worker orphaned holding the dev port.
89
+ */
90
+ env: {
91
+ ...process.env,
92
+ PORT: String(port),
93
+ ABIDE_DEV: '1',
94
+ ABIDE_PARENT_PID: String(process.pid),
95
+ },
85
96
  stdio: ['inherit', 'inherit', 'inherit'],
86
97
  // The child's POST /__abide/reload route signals a rebuild over IPC, so the
87
98
  // trigger rides the app's own port instead of a side channel.
@@ -1,12 +1,12 @@
1
1
  /*
2
- Tie the embedded server's lifetime to the bundle launcher's.
2
+ Tie this server's lifetime to its launcher's.
3
3
 
4
- The launcher spawns this server with ABIDE_PARENT_PID set to its own pid. On a
5
- clean window close the launcher reaps the child directly, but a force-quit (or
6
- crash) of the launcher can't run that cleanup, which would leave the server
7
- orphaned and holding its port. So when that env var is present, poll the parent
8
- and exit once it's gone. A no-op when the var is absent (standalone `abide
9
- start`), so it only ever activates inside a bundle.
4
+ The launcher (a bundle, or the dev orchestrator) spawns this server with
5
+ ABIDE_PARENT_PID set to its own pid. On a clean shutdown the launcher reaps the
6
+ child directly, but a force-quit or crash of the launcher can't run that
7
+ cleanup, which would leave the server orphaned and holding its port. So when
8
+ that env var is present, poll the parent and exit once it's gone. A no-op when
9
+ the var is absent (standalone `abide start`).
10
10
  */
11
11
  export function exitWithParent(): void {
12
12
  const parent = process.env.ABIDE_PARENT_PID