bun-types-no-globals 1.3.2-canary.20251105T140650 → 1.3.2-canary.20251108T140624

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/lib/bun.d.ts CHANGED
@@ -5289,7 +5289,12 @@ declare module "bun" {
5289
5289
  options: udp.ConnectSocketOptions<DataBinaryType>,
5290
5290
  ): Promise<udp.ConnectedSocket<DataBinaryType>>;
5291
5291
 
5292
- namespace SpawnOptions {
5292
+ /**
5293
+ * @deprecated use {@link Bun.Spawn} instead
5294
+ */
5295
+ export import SpawnOptions = Spawn;
5296
+
5297
+ namespace Spawn {
5293
5298
  /**
5294
5299
  * Option for stdout/stderr
5295
5300
  */
@@ -5320,7 +5325,12 @@ declare module "bun" {
5320
5325
  | Response
5321
5326
  | Request;
5322
5327
 
5323
- interface OptionsObject<In extends Writable, Out extends Readable, Err extends Readable> {
5328
+ /**
5329
+ * @deprecated use BaseOptions or the specific options for the specific {@link spawn} or {@link spawnSync} usage
5330
+ */
5331
+ type OptionsObject<In extends Writable, Out extends Readable, Err extends Readable> = BaseOptions<In, Out, Err>;
5332
+
5333
+ interface BaseOptions<In extends Writable, Out extends Readable, Err extends Readable> {
5324
5334
  /**
5325
5335
  * The current working directory of the process
5326
5336
  *
@@ -5328,6 +5338,22 @@ declare module "bun" {
5328
5338
  */
5329
5339
  cwd?: string;
5330
5340
 
5341
+ /**
5342
+ * Run the child in a separate process group, detached from the parent.
5343
+ *
5344
+ * - POSIX: calls `setsid()` so the child starts a new session and becomes
5345
+ * the process group leader. It can outlive the parent and receive
5346
+ * signals independently of the parent’s terminal/process group.
5347
+ * - Windows: sets `UV_PROCESS_DETACHED`, allowing the child to outlive
5348
+ * the parent and receive signals independently.
5349
+ *
5350
+ * Note: stdio may keep the parent process alive. Pass `stdio: ["ignore",
5351
+ * "ignore", "ignore"]` to the spawn constructor to prevent this.
5352
+ *
5353
+ * @default false
5354
+ */
5355
+ detached?: boolean;
5356
+
5331
5357
  /**
5332
5358
  * The environment variables of the process
5333
5359
  *
@@ -5430,6 +5456,48 @@ declare module "bun" {
5430
5456
  error?: ErrorLike,
5431
5457
  ): void | Promise<void>;
5432
5458
 
5459
+ /**
5460
+ * Called exactly once when the IPC channel between the parent and this
5461
+ * subprocess is closed. After this runs, no further IPC messages will be
5462
+ * delivered.
5463
+ *
5464
+ * When it fires:
5465
+ * - The child called `process.disconnect()` or the parent called
5466
+ * `subprocess.disconnect()`.
5467
+ * - The child exited for any reason (normal exit or due to a signal like
5468
+ * `SIGILL`, `SIGKILL`, etc.).
5469
+ * - The child replaced itself with a program that does not support Bun
5470
+ * IPC.
5471
+ *
5472
+ * Notes:
5473
+ * - This callback indicates that the pipe is closed; it is not an error
5474
+ * by itself. Use {@link onExit} or {@link Subprocess.exited} to
5475
+ * determine why the process ended.
5476
+ * - It may occur before or after {@link onExit} depending on timing; do
5477
+ * not rely on ordering. Typically, if you or the child call
5478
+ * `disconnect()` first, this fires before {@link onExit}; if the
5479
+ * process exits without an explicit disconnect, either may happen
5480
+ * first.
5481
+ * - Only runs when {@link ipc} is enabled and runs at most once per
5482
+ * subprocess.
5483
+ * - If the child becomes a zombie (exited but not yet reaped), the IPC is
5484
+ * already closed, and this callback will fire (or may already have
5485
+ * fired).
5486
+ *
5487
+ * @example
5488
+ *
5489
+ * ```ts
5490
+ * const subprocess = spawn({
5491
+ * cmd: ["echo", "hello"],
5492
+ * ipc: (message) => console.log(message),
5493
+ * onDisconnect: () => {
5494
+ * console.log("IPC channel disconnected");
5495
+ * },
5496
+ * });
5497
+ * ```
5498
+ */
5499
+ onDisconnect?(): void | Promise<void>;
5500
+
5433
5501
  /**
5434
5502
  * When specified, Bun will open an IPC channel to the subprocess. The passed callback is called for
5435
5503
  * incoming messages, and `subprocess.send` can send messages to the subprocess. Messages are serialized
@@ -5549,6 +5617,34 @@ declare module "bun" {
5549
5617
  maxBuffer?: number;
5550
5618
  }
5551
5619
 
5620
+ interface SpawnSyncOptions<In extends Writable, Out extends Readable, Err extends Readable>
5621
+ extends BaseOptions<In, Out, Err> {}
5622
+
5623
+ interface SpawnOptions<In extends Writable, Out extends Readable, Err extends Readable>
5624
+ extends BaseOptions<In, Out, Err> {
5625
+ /**
5626
+ * If true, stdout and stderr pipes will not automatically start reading
5627
+ * data. Reading will only begin when you access the `stdout` or `stderr`
5628
+ * properties.
5629
+ *
5630
+ * This can improve performance when you don't need to read output
5631
+ * immediately.
5632
+ *
5633
+ * @default false
5634
+ *
5635
+ * @example
5636
+ * ```ts
5637
+ * const subprocess = Bun.spawn({
5638
+ * cmd: ["echo", "hello"],
5639
+ * lazy: true, // Don't start reading stdout until accessed
5640
+ * });
5641
+ * // stdout reading hasn't started yet
5642
+ * await subprocess.stdout.text(); // Now reading starts
5643
+ * ```
5644
+ */
5645
+ lazy?: boolean;
5646
+ }
5647
+
5552
5648
  type ReadableToIO<X extends Readable> = X extends "pipe" | undefined
5553
5649
  ? ReadableStream<Uint8Array<ArrayBuffer>>
5554
5650
  : X extends BunFile | ArrayBufferView | number
@@ -5806,7 +5902,7 @@ declare module "bun" {
5806
5902
  const Out extends SpawnOptions.Readable = "pipe",
5807
5903
  const Err extends SpawnOptions.Readable = "inherit",
5808
5904
  >(
5809
- options: SpawnOptions.OptionsObject<In, Out, Err> & {
5905
+ options: SpawnOptions.SpawnOptions<In, Out, Err> & {
5810
5906
  /**
5811
5907
  * The command to run
5812
5908
  *
@@ -5856,7 +5952,7 @@ declare module "bun" {
5856
5952
  * ```
5857
5953
  */
5858
5954
  cmds: string[],
5859
- options?: SpawnOptions.OptionsObject<In, Out, Err>,
5955
+ options?: SpawnOptions.SpawnOptions<In, Out, Err>,
5860
5956
  ): Subprocess<In, Out, Err>;
5861
5957
 
5862
5958
  /**
@@ -5878,7 +5974,7 @@ declare module "bun" {
5878
5974
  const Out extends SpawnOptions.Readable = "pipe",
5879
5975
  const Err extends SpawnOptions.Readable = "pipe",
5880
5976
  >(
5881
- options: SpawnOptions.OptionsObject<In, Out, Err> & {
5977
+ options: SpawnOptions.SpawnSyncOptions<In, Out, Err> & {
5882
5978
  /**
5883
5979
  * The command to run
5884
5980
  *
@@ -5929,7 +6025,7 @@ declare module "bun" {
5929
6025
  * ```
5930
6026
  */
5931
6027
  cmds: string[],
5932
- options?: SpawnOptions.OptionsObject<In, Out, Err>,
6028
+ options?: SpawnOptions.SpawnSyncOptions<In, Out, Err>,
5933
6029
  ): SyncSubprocess<Out, Err>;
5934
6030
 
5935
6031
  /** Utility type for any process from {@link Bun.spawn()} with both stdout and stderr set to `"pipe"` */
package/lib/test.d.ts CHANGED
@@ -262,7 +262,7 @@ declare module "bun:test" {
262
262
  */
263
263
  each<T extends Readonly<[any, ...any[]]>>(table: readonly T[]): Describe<[...T]>;
264
264
  each<T extends any[]>(table: readonly T[]): Describe<[...T]>;
265
- each<T>(table: T[]): Describe<[T]>;
265
+ each<const T>(table: T[]): Describe<[T]>;
266
266
  }
267
267
  /**
268
268
  * Describes a group of related tests.
@@ -552,7 +552,7 @@ declare module "bun:test" {
552
552
  */
553
553
  each<T extends Readonly<[unknown, ...unknown[]]>>(table: readonly T[]): Test<T>;
554
554
  each<T extends unknown[]>(table: readonly T[]): Test<T>;
555
- each<T>(table: T[]): Test<[T]>;
555
+ each<const T>(table: T[]): Test<[T]>;
556
556
  }
557
557
  /**
558
558
  * Runs a test.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-types-no-globals",
3
- "version": "1.3.2-canary.20251105T140650",
3
+ "version": "1.3.2-canary.20251108T140624",
4
4
  "main": "./generator/index.ts",
5
5
  "types": "./lib/index.d.ts",
6
6
  "description": "TypeScript type definitions for Bun without global types pollution",