bun-types-no-globals 1.3.4 → 1.3.5
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 +237 -18
- package/lib/bundle.d.ts +74 -0
- package/lib/globals.d.ts +7 -2
- package/lib/index.d.ts +1 -0
- package/lib/overrides.d.ts +16 -2
- package/lib/s3.d.ts +18 -0
- package/lib/test.d.ts +10 -8
- package/package.json +1 -1
package/lib/bun.d.ts
CHANGED
|
@@ -1740,9 +1740,9 @@ declare module "bun" {
|
|
|
1740
1740
|
* @default "esm"
|
|
1741
1741
|
*/
|
|
1742
1742
|
format?: /**
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1743
|
+
* ECMAScript Module format
|
|
1744
|
+
*/
|
|
1745
|
+
| "esm"
|
|
1746
1746
|
/**
|
|
1747
1747
|
* CommonJS format
|
|
1748
1748
|
* **Experimental**
|
|
@@ -1891,6 +1891,24 @@ declare module "bun" {
|
|
|
1891
1891
|
*/
|
|
1892
1892
|
drop?: string[];
|
|
1893
1893
|
|
|
1894
|
+
/**
|
|
1895
|
+
* Enable feature flags for dead-code elimination via `import { feature } from "bun:bundle"`.
|
|
1896
|
+
*
|
|
1897
|
+
* When `feature("FLAG_NAME")` is called, it returns `true` if FLAG_NAME is in this array,
|
|
1898
|
+
* or `false` otherwise. This enables static dead-code elimination at bundle time.
|
|
1899
|
+
*
|
|
1900
|
+
* Equivalent to the CLI `--feature` flag.
|
|
1901
|
+
*
|
|
1902
|
+
* @example
|
|
1903
|
+
* ```ts
|
|
1904
|
+
* await Bun.build({
|
|
1905
|
+
* entrypoints: ['./src/index.ts'],
|
|
1906
|
+
* features: ['FEATURE_A', 'FEATURE_B'],
|
|
1907
|
+
* });
|
|
1908
|
+
* ```
|
|
1909
|
+
*/
|
|
1910
|
+
features?: string[];
|
|
1911
|
+
|
|
1894
1912
|
/**
|
|
1895
1913
|
* - When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
|
|
1896
1914
|
* - When set to `false`, returns a {@link BuildOutput} with `{success: false}`
|
|
@@ -3316,10 +3334,10 @@ declare module "bun" {
|
|
|
3316
3334
|
function color(
|
|
3317
3335
|
input: ColorInput,
|
|
3318
3336
|
outputFormat?: /**
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3337
|
+
* True color ANSI color string, for use in terminals
|
|
3338
|
+
* @example \x1b[38;2;100;200;200m
|
|
3339
|
+
*/
|
|
3340
|
+
| "ansi"
|
|
3323
3341
|
| "ansi-16"
|
|
3324
3342
|
| "ansi-16m"
|
|
3325
3343
|
/**
|
|
@@ -3887,6 +3905,9 @@ declare module "bun" {
|
|
|
3887
3905
|
static readonly byteLength: 32;
|
|
3888
3906
|
}
|
|
3889
3907
|
|
|
3908
|
+
/** Extends the standard web formats with `brotli` and `zstd` support. */
|
|
3909
|
+
type CompressionFormat = "gzip" | "deflate" | "deflate-raw" | "brotli" | "zstd";
|
|
3910
|
+
|
|
3890
3911
|
/** Compression options for `Bun.deflateSync` and `Bun.gzipSync` */
|
|
3891
3912
|
interface ZlibCompressionOptions {
|
|
3892
3913
|
/**
|
|
@@ -5650,17 +5671,11 @@ declare module "bun" {
|
|
|
5650
5671
|
maxBuffer?: number;
|
|
5651
5672
|
}
|
|
5652
5673
|
|
|
5653
|
-
interface SpawnSyncOptions<In extends Writable, Out extends Readable, Err extends Readable>
|
|
5654
|
-
In,
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
interface SpawnOptions<In extends Writable, Out extends Readable, Err extends Readable> extends BaseOptions<
|
|
5660
|
-
In,
|
|
5661
|
-
Out,
|
|
5662
|
-
Err
|
|
5663
|
-
> {
|
|
5674
|
+
interface SpawnSyncOptions<In extends Writable, Out extends Readable, Err extends Readable>
|
|
5675
|
+
extends BaseOptions<In, Out, Err> {}
|
|
5676
|
+
|
|
5677
|
+
interface SpawnOptions<In extends Writable, Out extends Readable, Err extends Readable>
|
|
5678
|
+
extends BaseOptions<In, Out, Err> {
|
|
5664
5679
|
/**
|
|
5665
5680
|
* If true, stdout and stderr pipes will not automatically start reading
|
|
5666
5681
|
* data. Reading will only begin when you access the `stdout` or `stderr`
|
|
@@ -5682,6 +5697,44 @@ declare module "bun" {
|
|
|
5682
5697
|
* ```
|
|
5683
5698
|
*/
|
|
5684
5699
|
lazy?: boolean;
|
|
5700
|
+
|
|
5701
|
+
/**
|
|
5702
|
+
* Spawn the subprocess with a pseudo-terminal (PTY) attached.
|
|
5703
|
+
*
|
|
5704
|
+
* When this option is provided:
|
|
5705
|
+
* - `stdin`, `stdout`, and `stderr` are all connected to the terminal
|
|
5706
|
+
* - The subprocess sees itself running in a real terminal (`isTTY = true`)
|
|
5707
|
+
* - Access the terminal via `subprocess.terminal`
|
|
5708
|
+
* - `subprocess.stdin`, `subprocess.stdout`, `subprocess.stderr` return `null`
|
|
5709
|
+
*
|
|
5710
|
+
* Only available on POSIX systems (Linux, macOS).
|
|
5711
|
+
*
|
|
5712
|
+
* @example
|
|
5713
|
+
* ```ts
|
|
5714
|
+
* const proc = Bun.spawn(["bash"], {
|
|
5715
|
+
* terminal: {
|
|
5716
|
+
* cols: 80,
|
|
5717
|
+
* rows: 24,
|
|
5718
|
+
* data: (term, data) => console.log(data.toString()),
|
|
5719
|
+
* },
|
|
5720
|
+
* });
|
|
5721
|
+
*
|
|
5722
|
+
* proc.terminal.write("echo hello\n");
|
|
5723
|
+
* await proc.exited;
|
|
5724
|
+
* proc.terminal.close();
|
|
5725
|
+
* ```
|
|
5726
|
+
*
|
|
5727
|
+
* You can also pass an existing `Terminal` object for reuse across multiple spawns:
|
|
5728
|
+
* ```ts
|
|
5729
|
+
* const terminal = new Bun.Terminal({ ... });
|
|
5730
|
+
* const proc1 = Bun.spawn(["echo", "first"], { terminal });
|
|
5731
|
+
* await proc1.exited;
|
|
5732
|
+
* const proc2 = Bun.spawn(["echo", "second"], { terminal });
|
|
5733
|
+
* await proc2.exited;
|
|
5734
|
+
* terminal.close();
|
|
5735
|
+
* ```
|
|
5736
|
+
*/
|
|
5737
|
+
terminal?: TerminalOptions | Terminal;
|
|
5685
5738
|
}
|
|
5686
5739
|
|
|
5687
5740
|
type ReadableToIO<X extends Readable> = X extends "pipe" | undefined
|
|
@@ -5796,6 +5849,24 @@ declare module "bun" {
|
|
|
5796
5849
|
readonly stdout: SpawnOptions.ReadableToIO<Out>;
|
|
5797
5850
|
readonly stderr: SpawnOptions.ReadableToIO<Err>;
|
|
5798
5851
|
|
|
5852
|
+
/**
|
|
5853
|
+
* The terminal attached to this subprocess, if spawned with the `terminal` option.
|
|
5854
|
+
* Returns `undefined` if no terminal was attached.
|
|
5855
|
+
*
|
|
5856
|
+
* When a terminal is attached, `stdin`, `stdout`, and `stderr` return `null`.
|
|
5857
|
+
* Use `terminal.write()` and the `data` callback instead.
|
|
5858
|
+
*
|
|
5859
|
+
* @example
|
|
5860
|
+
* ```ts
|
|
5861
|
+
* const proc = Bun.spawn(["bash"], {
|
|
5862
|
+
* terminal: { data: (term, data) => console.log(data.toString()) },
|
|
5863
|
+
* });
|
|
5864
|
+
*
|
|
5865
|
+
* proc.terminal?.write("echo hello\n");
|
|
5866
|
+
* ```
|
|
5867
|
+
*/
|
|
5868
|
+
readonly terminal: Terminal | undefined;
|
|
5869
|
+
|
|
5799
5870
|
/**
|
|
5800
5871
|
* Access extra file descriptors passed to the `stdio` option in the options object.
|
|
5801
5872
|
*/
|
|
@@ -6087,6 +6158,154 @@ declare module "bun" {
|
|
|
6087
6158
|
"ignore" | "inherit" | null | undefined
|
|
6088
6159
|
>;
|
|
6089
6160
|
|
|
6161
|
+
/**
|
|
6162
|
+
* Options for creating a pseudo-terminal (PTY).
|
|
6163
|
+
*/
|
|
6164
|
+
interface TerminalOptions {
|
|
6165
|
+
/**
|
|
6166
|
+
* Number of columns for the terminal.
|
|
6167
|
+
* @default 80
|
|
6168
|
+
*/
|
|
6169
|
+
cols?: number;
|
|
6170
|
+
/**
|
|
6171
|
+
* Number of rows for the terminal.
|
|
6172
|
+
* @default 24
|
|
6173
|
+
*/
|
|
6174
|
+
rows?: number;
|
|
6175
|
+
/**
|
|
6176
|
+
* Terminal name (e.g., "xterm-256color").
|
|
6177
|
+
* @default "xterm-256color"
|
|
6178
|
+
*/
|
|
6179
|
+
name?: string;
|
|
6180
|
+
/**
|
|
6181
|
+
* Callback invoked when data is received from the terminal.
|
|
6182
|
+
* @param terminal The terminal instance
|
|
6183
|
+
* @param data The data received as a Uint8Array
|
|
6184
|
+
*/
|
|
6185
|
+
data?: (terminal: Terminal, data: Uint8Array<ArrayBuffer>) => void;
|
|
6186
|
+
/**
|
|
6187
|
+
* Callback invoked when the PTY stream closes (EOF or read error).
|
|
6188
|
+
* Note: exitCode is a PTY lifecycle status (0=clean EOF, 1=error), NOT the subprocess exit code.
|
|
6189
|
+
* Use Subprocess.exited or onExit callback for actual process exit information.
|
|
6190
|
+
* @param terminal The terminal instance
|
|
6191
|
+
* @param exitCode PTY lifecycle status (0 for EOF, 1 for error)
|
|
6192
|
+
* @param signal Reserved for future signal reporting, currently null
|
|
6193
|
+
*/
|
|
6194
|
+
exit?: (terminal: Terminal, exitCode: number, signal: string | null) => void;
|
|
6195
|
+
/**
|
|
6196
|
+
* Callback invoked when the terminal is ready to receive more data.
|
|
6197
|
+
* @param terminal The terminal instance
|
|
6198
|
+
*/
|
|
6199
|
+
drain?: (terminal: Terminal) => void;
|
|
6200
|
+
}
|
|
6201
|
+
|
|
6202
|
+
/**
|
|
6203
|
+
* A pseudo-terminal (PTY) that can be used to spawn interactive terminal programs.
|
|
6204
|
+
*
|
|
6205
|
+
* @example
|
|
6206
|
+
* ```ts
|
|
6207
|
+
* await using terminal = new Bun.Terminal({
|
|
6208
|
+
* cols: 80,
|
|
6209
|
+
* rows: 24,
|
|
6210
|
+
* data(term, data) {
|
|
6211
|
+
* console.log("Received:", new TextDecoder().decode(data));
|
|
6212
|
+
* },
|
|
6213
|
+
* });
|
|
6214
|
+
*
|
|
6215
|
+
* // Spawn a shell connected to the PTY
|
|
6216
|
+
* const proc = Bun.spawn(["bash"], { terminal });
|
|
6217
|
+
*
|
|
6218
|
+
* // Write to the terminal
|
|
6219
|
+
* terminal.write("echo hello\n");
|
|
6220
|
+
*
|
|
6221
|
+
* // Wait for process to exit
|
|
6222
|
+
* await proc.exited;
|
|
6223
|
+
*
|
|
6224
|
+
* // Terminal is closed automatically by `await using`
|
|
6225
|
+
* ```
|
|
6226
|
+
*/
|
|
6227
|
+
class Terminal implements AsyncDisposable {
|
|
6228
|
+
constructor(options: TerminalOptions);
|
|
6229
|
+
|
|
6230
|
+
/**
|
|
6231
|
+
* Whether the terminal is closed.
|
|
6232
|
+
*/
|
|
6233
|
+
readonly closed: boolean;
|
|
6234
|
+
|
|
6235
|
+
/**
|
|
6236
|
+
* Write data to the terminal.
|
|
6237
|
+
* @param data The data to write (string or BufferSource)
|
|
6238
|
+
* @returns The number of bytes written
|
|
6239
|
+
*/
|
|
6240
|
+
write(data: string | BufferSource): number;
|
|
6241
|
+
|
|
6242
|
+
/**
|
|
6243
|
+
* Resize the terminal.
|
|
6244
|
+
* @param cols New number of columns
|
|
6245
|
+
* @param rows New number of rows
|
|
6246
|
+
*/
|
|
6247
|
+
resize(cols: number, rows: number): void;
|
|
6248
|
+
|
|
6249
|
+
/**
|
|
6250
|
+
* Set raw mode on the terminal.
|
|
6251
|
+
* In raw mode, input is passed directly without processing.
|
|
6252
|
+
* @param enabled Whether to enable raw mode
|
|
6253
|
+
*/
|
|
6254
|
+
setRawMode(enabled: boolean): void;
|
|
6255
|
+
|
|
6256
|
+
/**
|
|
6257
|
+
* Reference the terminal to keep the event loop alive.
|
|
6258
|
+
*/
|
|
6259
|
+
ref(): void;
|
|
6260
|
+
|
|
6261
|
+
/**
|
|
6262
|
+
* Unreference the terminal to allow the event loop to exit.
|
|
6263
|
+
*/
|
|
6264
|
+
unref(): void;
|
|
6265
|
+
|
|
6266
|
+
/**
|
|
6267
|
+
* Close the terminal.
|
|
6268
|
+
*/
|
|
6269
|
+
close(): void;
|
|
6270
|
+
|
|
6271
|
+
/**
|
|
6272
|
+
* Async dispose for use with `await using`.
|
|
6273
|
+
*/
|
|
6274
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
6275
|
+
|
|
6276
|
+
/**
|
|
6277
|
+
* Terminal input flags (c_iflag from termios).
|
|
6278
|
+
* Controls input processing behavior like ICRNL, IXON, etc.
|
|
6279
|
+
* Returns 0 if terminal is closed.
|
|
6280
|
+
* Setting returns true on success, false on failure.
|
|
6281
|
+
*/
|
|
6282
|
+
inputFlags: number;
|
|
6283
|
+
|
|
6284
|
+
/**
|
|
6285
|
+
* Terminal output flags (c_oflag from termios).
|
|
6286
|
+
* Controls output processing behavior like OPOST, ONLCR, etc.
|
|
6287
|
+
* Returns 0 if terminal is closed.
|
|
6288
|
+
* Setting returns true on success, false on failure.
|
|
6289
|
+
*/
|
|
6290
|
+
outputFlags: number;
|
|
6291
|
+
|
|
6292
|
+
/**
|
|
6293
|
+
* Terminal local flags (c_lflag from termios).
|
|
6294
|
+
* Controls local processing like ICANON, ECHO, ISIG, etc.
|
|
6295
|
+
* Returns 0 if terminal is closed.
|
|
6296
|
+
* Setting returns true on success, false on failure.
|
|
6297
|
+
*/
|
|
6298
|
+
localFlags: number;
|
|
6299
|
+
|
|
6300
|
+
/**
|
|
6301
|
+
* Terminal control flags (c_cflag from termios).
|
|
6302
|
+
* Controls hardware characteristics like CSIZE, PARENB, etc.
|
|
6303
|
+
* Returns 0 if terminal is closed.
|
|
6304
|
+
* Setting returns true on success, false on failure.
|
|
6305
|
+
*/
|
|
6306
|
+
controlFlags: number;
|
|
6307
|
+
}
|
|
6308
|
+
|
|
6090
6309
|
// Blocked on https://github.com/oven-sh/bun/issues/8329
|
|
6091
6310
|
// /**
|
|
6092
6311
|
// *
|
package/lib/bundle.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `bun:bundle` module provides compile-time utilities for dead-code elimination.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { feature } from "bun:bundle";
|
|
7
|
+
*
|
|
8
|
+
* if (feature("SUPER_SECRET")) {
|
|
9
|
+
* console.log("Secret feature enabled!");
|
|
10
|
+
* } else {
|
|
11
|
+
* console.log("Normal mode");
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Enable feature flags via CLI:
|
|
16
|
+
* ```bash
|
|
17
|
+
* # During build
|
|
18
|
+
* bun build --feature=SUPER_SECRET index.ts
|
|
19
|
+
*
|
|
20
|
+
* # At runtime
|
|
21
|
+
* bun run --feature=SUPER_SECRET index.ts
|
|
22
|
+
*
|
|
23
|
+
* # In tests
|
|
24
|
+
* bun test --feature=SUPER_SECRET
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @module bun:bundle
|
|
28
|
+
*/
|
|
29
|
+
declare module "bun:bundle" {
|
|
30
|
+
/**
|
|
31
|
+
* Registry for type-safe feature flags.
|
|
32
|
+
*
|
|
33
|
+
* Augment this interface to get autocomplete and type checking for your feature flags:
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // env.d.ts
|
|
38
|
+
* declare module "bun:bundle" {
|
|
39
|
+
* interface Registry {
|
|
40
|
+
* features: "DEBUG" | "PREMIUM" | "BETA";
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* Now `feature()` only accepts `"DEBUG"`, `"PREMIUM"`, or `"BETA"`:
|
|
46
|
+
* ```ts
|
|
47
|
+
* feature("DEBUG"); // OK
|
|
48
|
+
* feature("TYPO"); // Type error
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
interface Registry {}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Check if a feature flag is enabled at compile time.
|
|
55
|
+
*
|
|
56
|
+
* This function is replaced with a boolean literal (`true` or `false`) at bundle time,
|
|
57
|
+
* enabling dead-code elimination. The bundler will remove unreachable branches.
|
|
58
|
+
*
|
|
59
|
+
* @param flag - The name of the feature flag to check
|
|
60
|
+
* @returns `true` if the flag was passed via `--feature=FLAG`, `false` otherwise
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { feature } from "bun:bundle";
|
|
65
|
+
*
|
|
66
|
+
* // With --feature=DEBUG, this becomes: if (true) { ... }
|
|
67
|
+
* // Without --feature=DEBUG, this becomes: if (false) { ... }
|
|
68
|
+
* if (feature("DEBUG")) {
|
|
69
|
+
* console.log("Debug mode enabled");
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
function feature(flag: Registry extends { features: infer Features extends string } ? Features : string): boolean;
|
|
74
|
+
}
|
package/lib/globals.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
declare module "bun" {
|
|
2
2
|
namespace __internal {
|
|
3
|
-
type NodeCryptoWebcryptoSubtleCrypto = import("crypto").webcrypto.SubtleCrypto;
|
|
4
3
|
type NodeCryptoWebcryptoCryptoKey = import("crypto").webcrypto.CryptoKey;
|
|
5
4
|
type NodeCryptoWebcryptoCryptoKeyPair = import("crypto").webcrypto.CryptoKeyPair;
|
|
6
5
|
|
|
6
|
+
type LibEmptyOrNodeCryptoWebcryptoSubtleCrypto = LibDomIsLoaded extends true
|
|
7
|
+
? {}
|
|
8
|
+
: import("crypto").webcrypto.SubtleCrypto;
|
|
9
|
+
|
|
7
10
|
type LibWorkerOrBunWorker = LibDomIsLoaded extends true ? {} : Bun.Worker;
|
|
8
11
|
type LibEmptyOrBunWebSocket = LibDomIsLoaded extends true ? {} : Bun.WebSocket;
|
|
9
12
|
|
|
@@ -14,7 +17,9 @@ declare module "bun" {
|
|
|
14
17
|
? {}
|
|
15
18
|
: import("node:stream/web").DecompressionStream;
|
|
16
19
|
|
|
17
|
-
type LibPerformanceOrNodePerfHooksPerformance = LibDomIsLoaded extends true
|
|
20
|
+
type LibPerformanceOrNodePerfHooksPerformance = LibDomIsLoaded extends true
|
|
21
|
+
? {}
|
|
22
|
+
: import("node:perf_hooks").Performance;
|
|
18
23
|
type LibEmptyOrPerformanceEntry = LibDomIsLoaded extends true ? {} : import("node:perf_hooks").PerformanceEntry;
|
|
19
24
|
type LibEmptyOrPerformanceMark = LibDomIsLoaded extends true ? {} : import("node:perf_hooks").PerformanceMark;
|
|
20
25
|
type LibEmptyOrPerformanceMeasure = LibDomIsLoaded extends true ? {} : import("node:perf_hooks").PerformanceMeasure;
|
package/lib/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
/// <reference path="./serve.d.ts" />
|
|
21
21
|
/// <reference path="./sql.d.ts" />
|
|
22
22
|
/// <reference path="./security.d.ts" />
|
|
23
|
+
/// <reference path="./bundle.d.ts" />
|
|
23
24
|
/// <reference path="./bun.ns.d.ts" />
|
|
24
25
|
// Must disable this so it doesn't conflict with the DOM onmessage type, but still
|
|
25
26
|
// allows us to declare our own globals that Node's types can "see" and not conflict with
|
package/lib/overrides.d.ts
CHANGED
|
@@ -36,10 +36,10 @@ declare module "url" {
|
|
|
36
36
|
toJSON(): Record<string, string>;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
declare module "fs/promises" {
|
|
39
|
+
declare module "node:fs/promises" {
|
|
40
40
|
function exists(path: Bun.PathLike): Promise<boolean>;
|
|
41
41
|
}
|
|
42
|
-
declare module "tls" {
|
|
42
|
+
declare module "node:tls" {
|
|
43
43
|
interface BunConnectionOptions extends Omit<ConnectionOptions, "key" | "ca" | "tls" | "cert"> {
|
|
44
44
|
/**
|
|
45
45
|
* Optionally override the trusted CA certificates. Default is to trust
|
|
@@ -85,4 +85,18 @@ declare module "tls" {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
function connect(options: BunConnectionOptions, secureConnectListener?: () => void): TLSSocket;
|
|
88
|
+
}
|
|
89
|
+
declare module "console" {
|
|
90
|
+
interface Console {
|
|
91
|
+
/**
|
|
92
|
+
* Asynchronously read lines from standard input (fd 0)
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* for await (const line of console) {
|
|
96
|
+
* console.log(line);
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string>;
|
|
101
|
+
}
|
|
88
102
|
}
|
package/lib/s3.d.ts
CHANGED
|
@@ -281,6 +281,24 @@ declare module "bun" {
|
|
|
281
281
|
*/
|
|
282
282
|
type?: string;
|
|
283
283
|
|
|
284
|
+
/**
|
|
285
|
+
* The Content-Disposition header value.
|
|
286
|
+
* Controls how the file is presented when downloaded.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* // Setting attachment disposition with filename
|
|
290
|
+
* const file = s3.file("report.pdf", {
|
|
291
|
+
* contentDisposition: "attachment; filename=\"quarterly-report.pdf\""
|
|
292
|
+
* });
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* // Setting inline disposition
|
|
296
|
+
* await s3.write("image.png", imageData, {
|
|
297
|
+
* contentDisposition: "inline"
|
|
298
|
+
* });
|
|
299
|
+
*/
|
|
300
|
+
contentDisposition?: string | undefined;
|
|
301
|
+
|
|
284
302
|
/**
|
|
285
303
|
* By default, Amazon S3 uses the STANDARD Storage Class to store newly created objects.
|
|
286
304
|
*
|
package/lib/test.d.ts
CHANGED
|
@@ -428,6 +428,8 @@ declare module "bun:test" {
|
|
|
428
428
|
}
|
|
429
429
|
|
|
430
430
|
namespace __internal {
|
|
431
|
+
type IfNeverThenElse<T, Else> = [T] extends [never] ? Else : T;
|
|
432
|
+
|
|
431
433
|
type IsTuple<T> = T extends readonly unknown[]
|
|
432
434
|
? number extends T["length"]
|
|
433
435
|
? false // It's an array with unknown length, not a tuple
|
|
@@ -1097,8 +1099,8 @@ declare module "bun:test" {
|
|
|
1097
1099
|
*
|
|
1098
1100
|
* @param expected the expected value
|
|
1099
1101
|
*/
|
|
1100
|
-
toContainKey(expected: keyof T): void;
|
|
1101
|
-
toContainKey<X = T>(expected: NoInfer<keyof X>): void;
|
|
1102
|
+
toContainKey(expected: __internal.IfNeverThenElse<keyof T, PropertyKey>): void;
|
|
1103
|
+
toContainKey<X = T>(expected: __internal.IfNeverThenElse<NoInfer<keyof X>, PropertyKey>): void;
|
|
1102
1104
|
|
|
1103
1105
|
/**
|
|
1104
1106
|
* Asserts that an `object` contains all the provided keys.
|
|
@@ -1114,8 +1116,8 @@ declare module "bun:test" {
|
|
|
1114
1116
|
*
|
|
1115
1117
|
* @param expected the expected value
|
|
1116
1118
|
*/
|
|
1117
|
-
toContainAllKeys(expected: Array<keyof T
|
|
1118
|
-
toContainAllKeys<X = T>(expected: NoInfer<
|
|
1119
|
+
toContainAllKeys(expected: Array<__internal.IfNeverThenElse<keyof T, PropertyKey>>): void;
|
|
1120
|
+
toContainAllKeys<X = T>(expected: Array<__internal.IfNeverThenElse<NoInfer<keyof X>, PropertyKey>>): void;
|
|
1119
1121
|
|
|
1120
1122
|
/**
|
|
1121
1123
|
* Asserts that an `object` contains at least one of the provided keys.
|
|
@@ -1131,8 +1133,8 @@ declare module "bun:test" {
|
|
|
1131
1133
|
*
|
|
1132
1134
|
* @param expected the expected value
|
|
1133
1135
|
*/
|
|
1134
|
-
toContainAnyKeys(expected: Array<keyof T
|
|
1135
|
-
toContainAnyKeys<X = T>(expected: NoInfer<
|
|
1136
|
+
toContainAnyKeys(expected: Array<__internal.IfNeverThenElse<keyof T, PropertyKey>>): void;
|
|
1137
|
+
toContainAnyKeys<X = T>(expected: Array<__internal.IfNeverThenElse<NoInfer<keyof X>, PropertyKey>>): void;
|
|
1136
1138
|
|
|
1137
1139
|
/**
|
|
1138
1140
|
* Asserts that an `object` contain the provided value.
|
|
@@ -1224,8 +1226,8 @@ declare module "bun:test" {
|
|
|
1224
1226
|
*
|
|
1225
1227
|
* @param expected the expected value
|
|
1226
1228
|
*/
|
|
1227
|
-
toContainKeys(expected: Array<keyof T
|
|
1228
|
-
toContainKeys<X = T>(expected: NoInfer<
|
|
1229
|
+
toContainKeys(expected: Array<__internal.IfNeverThenElse<keyof T, PropertyKey>>): void;
|
|
1230
|
+
toContainKeys<X = T>(expected: Array<__internal.IfNeverThenElse<NoInfer<keyof X>, PropertyKey>>): void;
|
|
1229
1231
|
|
|
1230
1232
|
/**
|
|
1231
1233
|
* Asserts that a value contains and equals what is expected.
|