@fungi.computer/oyster 0.19.13 → 0.19.14

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.
@@ -80,4 +80,14 @@ export type TryEffects = Readonly<{
80
80
  export type Manager = "npm" | "pnpm";
81
81
  /** pnpm when it ran this command (`pnpm dlx`), otherwise npm. */
82
82
  export declare function detectManager(userAgent: string | undefined): "pnpm" | "npm";
83
+ /**
84
+ * `wrangler dev` for one local Oyster. The devtools inspector takes a port the
85
+ * kernel assigns (0): wrangler's default probes 9229 upward and binds it later,
86
+ * so two Oysters (or any wrangler dev) starting together could both pick the
87
+ * same port and one failed with "Address already in use".
88
+ */
89
+ export declare function wranglerDevArguments(input: {
90
+ port: number;
91
+ key: string;
92
+ }): readonly string[];
83
93
  export declare function tryOyster(args: readonly string[], effects?: TryEffects, ui?: Cli, callerSignal?: AbortSignal): Promise<void>;
@@ -388,6 +388,32 @@ async function waitUntilReady(url, child, timeoutMs, signal) {
388
388
  }
389
389
  return signal.aborted ? "exited" : "timeout";
390
390
  }
391
+ /**
392
+ * `wrangler dev` for one local Oyster. The devtools inspector takes a port the
393
+ * kernel assigns (0): wrangler's default probes 9229 upward and binds it later,
394
+ * so two Oysters (or any wrangler dev) starting together could both pick the
395
+ * same port and one failed with "Address already in use".
396
+ */
397
+ export function wranglerDevArguments(input) {
398
+ const url = `http://127.0.0.1:${String(input.port)}`;
399
+ return [
400
+ "dev",
401
+ "--local",
402
+ "--enable-containers=false",
403
+ "--ip",
404
+ "127.0.0.1",
405
+ "--port",
406
+ String(input.port),
407
+ "--inspector-port",
408
+ "0",
409
+ "--var",
410
+ `OYSTER_OWNER_KEY:${input.key}`,
411
+ "--var",
412
+ `OYSTER_ORIGIN:${url}`,
413
+ "--var",
414
+ "OYSTER_COMPUTER_BACKEND:local",
415
+ ];
416
+ }
391
417
  function startWrangler(input) {
392
418
  return (async () => {
393
419
  input.signal.throwIfAborted();
@@ -400,22 +426,7 @@ function startWrangler(input) {
400
426
  const logStream = createWriteStream(log);
401
427
  const logClosed = Promise.allSettled([finished(logStream)]);
402
428
  const url = `http://127.0.0.1:${String(input.port)}`;
403
- const child = spawn(process.execPath, [
404
- wrangler,
405
- "dev",
406
- "--local",
407
- "--enable-containers=false",
408
- "--ip",
409
- "127.0.0.1",
410
- "--port",
411
- String(input.port),
412
- "--var",
413
- `OYSTER_OWNER_KEY:${input.key}`,
414
- "--var",
415
- `OYSTER_ORIGIN:${url}`,
416
- "--var",
417
- "OYSTER_COMPUTER_BACKEND:local",
418
- ], {
429
+ const child = spawn(process.execPath, [wrangler, ...wranglerDevArguments({ port: input.port, key: input.key })], {
419
430
  cwd: input.directory,
420
431
  detached: process.platform !== "win32",
421
432
  signal: input.signal,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/oyster",
3
- "version": "0.19.13",
3
+ "version": "0.19.14",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Run your own Apps on Cloudflare Workers or celld: installable App Releases, each with its own Durable Object, SQLite database and declared bindings",
6
6
  "type": "module",