bun-types 1.2.6 → 1.2.7

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/jsc.d.ts CHANGED
@@ -1,243 +1,229 @@
1
1
  declare module "bun:jsc" {
2
- /**
3
- * This used to be called "describe" but it could be confused with the test runner.
4
- */
5
- function jscDescribe(value: any): string;
6
- function jscDescribeArray(args: any[]): string;
7
- function gcAndSweep(): number;
8
- function fullGC(): number;
9
- function edenGC(): number;
10
- function heapSize(): number;
11
- function heapStats(): {
12
- heapSize: number;
13
- heapCapacity: number;
14
- extraMemorySize: number;
15
- objectCount: number;
16
- protectedObjectCount: number;
17
- globalObjectCount: number;
18
- protectedGlobalObjectCount: number;
19
- objectTypeCounts: Record<string, number>;
20
- protectedObjectTypeCounts: Record<string, number>;
21
- };
22
- function memoryUsage(): {
23
- current: number;
24
- peak: number;
25
- currentCommit: number;
26
- peakCommit: number;
27
- pageFaults: number;
28
- };
29
- function getRandomSeed(): number;
30
- function setRandomSeed(value: number): void;
31
- function isRope(input: string): boolean;
32
- function callerSourceOrigin(): string;
33
- function noFTL(func: (...args: any[]) => any): (...args: any[]) => any;
34
- function noOSRExitFuzzing(
35
- func: (...args: any[]) => any,
36
- ): (...args: any[]) => any;
37
- function optimizeNextInvocation(func: (...args: any[]) => any): void;
38
- function numberOfDFGCompiles(func: (...args: any[]) => any): number;
39
- function releaseWeakRefs(): void;
40
- function totalCompileTime(func: (...args: any[]) => any): number;
41
- function reoptimizationRetryCount(func: (...args: any[]) => any): number;
42
- function drainMicrotasks(): void;
2
+ /**
3
+ * This used to be called "describe" but it could be confused with the test runner.
4
+ */
5
+ function jscDescribe(value: any): string;
6
+ function jscDescribeArray(args: any[]): string;
7
+ function gcAndSweep(): number;
8
+ function fullGC(): number;
9
+ function edenGC(): number;
10
+ function heapSize(): number;
11
+ function heapStats(): {
12
+ heapSize: number;
13
+ heapCapacity: number;
14
+ extraMemorySize: number;
15
+ objectCount: number;
16
+ protectedObjectCount: number;
17
+ globalObjectCount: number;
18
+ protectedGlobalObjectCount: number;
19
+ objectTypeCounts: Record<string, number>;
20
+ protectedObjectTypeCounts: Record<string, number>;
21
+ };
22
+ function memoryUsage(): {
23
+ current: number;
24
+ peak: number;
25
+ currentCommit: number;
26
+ peakCommit: number;
27
+ pageFaults: number;
28
+ };
29
+ function getRandomSeed(): number;
30
+ function setRandomSeed(value: number): void;
31
+ function isRope(input: string): boolean;
32
+ function callerSourceOrigin(): string;
33
+ function noFTL(func: (...args: any[]) => any): (...args: any[]) => any;
34
+ function noOSRExitFuzzing(func: (...args: any[]) => any): (...args: any[]) => any;
35
+ function optimizeNextInvocation(func: (...args: any[]) => any): void;
36
+ function numberOfDFGCompiles(func: (...args: any[]) => any): number;
37
+ function releaseWeakRefs(): void;
38
+ function totalCompileTime(func: (...args: any[]) => any): number;
39
+ function reoptimizationRetryCount(func: (...args: any[]) => any): number;
40
+ function drainMicrotasks(): void;
43
41
 
44
- /**
45
- * Convert a JavaScript value to a binary representation that can be sent to another Bun instance.
46
- *
47
- * Internally, this uses the serialization format from WebKit/Safari.
48
- *
49
- * @param value A JavaScript value, usually an object or array, to be converted.
50
- * @returns A SharedArrayBuffer that can be sent to another Bun instance.
51
- */
52
- function serialize(
53
- value: any,
54
- options?: { binaryType?: "arraybuffer" },
55
- ): SharedArrayBuffer;
42
+ /**
43
+ * Convert a JavaScript value to a binary representation that can be sent to another Bun instance.
44
+ *
45
+ * Internally, this uses the serialization format from WebKit/Safari.
46
+ *
47
+ * @param value A JavaScript value, usually an object or array, to be converted.
48
+ * @returns A SharedArrayBuffer that can be sent to another Bun instance.
49
+ */
50
+ function serialize(value: any, options?: { binaryType?: "arraybuffer" }): SharedArrayBuffer;
56
51
 
57
- /**
58
- * Convert a JavaScript value to a binary representation that can be sent to another Bun instance.
59
- *
60
- * Internally, this uses the serialization format from WebKit/Safari.
61
- *
62
- * @param value A JavaScript value, usually an object or array, to be converted.
63
- * @returns A Buffer that can be sent to another Bun instance.
64
- */
65
- function serialize(
66
- value: any,
67
- options?: { binaryType: "nodebuffer" },
68
- ): Buffer;
52
+ /**
53
+ * Convert a JavaScript value to a binary representation that can be sent to another Bun instance.
54
+ *
55
+ * Internally, this uses the serialization format from WebKit/Safari.
56
+ *
57
+ * @param value A JavaScript value, usually an object or array, to be converted.
58
+ * @returns A Buffer that can be sent to another Bun instance.
59
+ */
60
+ function serialize(value: any, options?: { binaryType: "nodebuffer" }): Buffer;
69
61
 
70
- /**
71
- * Convert an ArrayBuffer or Buffer to a JavaScript value compatible with the HTML Structured Clone Algorithm.
72
- *
73
- * @param value A serialized value, usually an ArrayBuffer or Buffer, to be converted.
74
- */
75
- function deserialize(
76
- value: ArrayBufferLike | NodeJS.TypedArray | Buffer,
77
- ): any;
62
+ /**
63
+ * Convert an ArrayBuffer or Buffer to a JavaScript value compatible with the HTML Structured Clone Algorithm.
64
+ *
65
+ * @param value A serialized value, usually an ArrayBuffer or Buffer, to be converted.
66
+ */
67
+ function deserialize(value: ArrayBufferLike | NodeJS.TypedArray | Buffer): any;
78
68
 
79
- /**
80
- * Set the timezone used by Intl, Date, etc.
81
- *
82
- * @param timeZone A string representing the time zone to use, such as "America/Los_Angeles"
83
- *
84
- * @returns The normalized time zone string
85
- *
86
- * You can also set process.env.TZ to the time zone you want to use.
87
- * You can also view the current timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone`
88
- */
89
- function setTimeZone(timeZone: string): string;
69
+ /**
70
+ * Set the timezone used by Intl, Date, etc.
71
+ *
72
+ * @param timeZone A string representing the time zone to use, such as "America/Los_Angeles"
73
+ *
74
+ * @returns The normalized time zone string
75
+ *
76
+ * You can also set process.env.TZ to the time zone you want to use.
77
+ * You can also view the current timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone`
78
+ */
79
+ function setTimeZone(timeZone: string): string;
90
80
 
91
- interface SamplingProfile {
92
- /**
93
- * A formatted summary of the top functions
94
- *
95
- * Example output:
96
- * ```js
97
- *
98
- * Sampling rate: 100.000000 microseconds. Total samples: 6858
99
- * Top functions as <numSamples 'functionName#hash:sourceID'>
100
- * 2948 '#<nil>:8'
101
- * 393 'visit#<nil>:8'
102
- * 263 'push#<nil>:8'
103
- * 164 'scan_ref_scoped#<nil>:8'
104
- * 164 'walk#<nil>:8'
105
- * 144 'pop#<nil>:8'
106
- * 107 'extract_candidates#<nil>:8'
107
- * 94 'get#<nil>:8'
108
- * 82 'Function#<nil>:4294967295'
109
- * 79 'set#<nil>:8'
110
- * 67 'forEach#<nil>:5'
111
- * 58 'collapse#<nil>:8'
112
- * ```
113
- */
114
- functions: string;
115
- /**
116
- * A formatted summary of the top bytecodes
117
- *
118
- * Example output:
119
- * ```js
120
- * Tier breakdown:
121
- * -----------------------------------
122
- * LLInt: 106 (1.545640%)
123
- * Baseline: 2355 (34.339458%)
124
- * DFG: 3290 (47.973170%)
125
- * FTL: 833 (12.146398%)
126
- * js builtin: 132 (1.924759%)
127
- * Wasm: 0 (0.000000%)
128
- * Host: 111 (1.618548%)
129
- * RegExp: 15 (0.218723%)
130
- * C/C++: 0 (0.000000%)
131
- * Unknown Executable: 148 (2.158064%)
132
- *
133
- * Hottest bytecodes as <numSamples 'functionName#hash:JITType:bytecodeIndex'>
134
- * 273 'visit#<nil>:DFG:bc#63'
135
- * 121 'walk#<nil>:DFG:bc#7'
136
- * 119 '#<nil>:Baseline:bc#1'
137
- * 82 'Function#<nil>:None:<nil>'
138
- * 66 '#<nil>:DFG:bc#11'
139
- * 65 '#<nil>:DFG:bc#33'
140
- * 58 '#<nil>:Baseline:bc#7'
141
- * 53 '#<nil>:Baseline:bc#23'
142
- * 50 'forEach#<nil>:DFG:bc#83'
143
- * 49 'pop#<nil>:FTL:bc#65'
144
- * 47 '#<nil>:DFG:bc#99'
145
- * 45 '#<nil>:DFG:bc#16'
146
- * 44 '#<nil>:DFG:bc#7'
147
- * 44 '#<nil>:Baseline:bc#30'
148
- * 44 'push#<nil>:FTL:bc#214'
149
- * 41 '#<nil>:DFG:bc#50'
150
- * 39 'get#<nil>:DFG:bc#27'
151
- * 39 '#<nil>:Baseline:bc#0'
152
- * 36 '#<nil>:DFG:bc#27'
153
- * 36 'Dictionary#<nil>:DFG:bc#41'
154
- * 36 'visit#<nil>:DFG:bc#81'
155
- * 36 'get#<nil>:FTL:bc#11'
156
- * 32 'push#<nil>:FTL:bc#49'
157
- * 31 '#<nil>:DFG:bc#76'
158
- * 31 '#<nil>:DFG:bc#10'
159
- * 31 '#<nil>:DFG:bc#73'
160
- * 29 'set#<nil>:DFG:bc#28'
161
- * 28 'in_boolean_context#<nil>:DFG:bc#104'
162
- * 28 '#<nil>:Baseline:<nil>'
163
- * 28 'regExpSplitFast#<nil>:None:<nil>'
164
- * 26 'visit#<nil>:DFG:bc#95'
165
- * 26 'pop#<nil>:FTL:bc#120'
166
- * 25 '#<nil>:DFG:bc#23'
167
- * 25 'push#<nil>:FTL:bc#152'
168
- * 24 'push#<nil>:FTL:bc#262'
169
- * 24 '#<nil>:FTL:bc#10'
170
- * 23 'is_identifier_char#<nil>:DFG:bc#22'
171
- * 23 'visit#<nil>:DFG:bc#22'
172
- * 22 '#<nil>:FTL:bc#27'
173
- * 22 'indexOf#<nil>:None:<nil>'
174
- * ```
175
- */
176
- bytecodes: string;
81
+ interface SamplingProfile {
82
+ /**
83
+ * A formatted summary of the top functions
84
+ *
85
+ * Example output:
86
+ * ```js
87
+ *
88
+ * Sampling rate: 100.000000 microseconds. Total samples: 6858
89
+ * Top functions as <numSamples 'functionName#hash:sourceID'>
90
+ * 2948 '#<nil>:8'
91
+ * 393 'visit#<nil>:8'
92
+ * 263 'push#<nil>:8'
93
+ * 164 'scan_ref_scoped#<nil>:8'
94
+ * 164 'walk#<nil>:8'
95
+ * 144 'pop#<nil>:8'
96
+ * 107 'extract_candidates#<nil>:8'
97
+ * 94 'get#<nil>:8'
98
+ * 82 'Function#<nil>:4294967295'
99
+ * 79 'set#<nil>:8'
100
+ * 67 'forEach#<nil>:5'
101
+ * 58 'collapse#<nil>:8'
102
+ * ```
103
+ */
104
+ functions: string;
105
+ /**
106
+ * A formatted summary of the top bytecodes
107
+ *
108
+ * Example output:
109
+ * ```js
110
+ * Tier breakdown:
111
+ * -----------------------------------
112
+ * LLInt: 106 (1.545640%)
113
+ * Baseline: 2355 (34.339458%)
114
+ * DFG: 3290 (47.973170%)
115
+ * FTL: 833 (12.146398%)
116
+ * js builtin: 132 (1.924759%)
117
+ * Wasm: 0 (0.000000%)
118
+ * Host: 111 (1.618548%)
119
+ * RegExp: 15 (0.218723%)
120
+ * C/C++: 0 (0.000000%)
121
+ * Unknown Executable: 148 (2.158064%)
122
+ *
123
+ * Hottest bytecodes as <numSamples 'functionName#hash:JITType:bytecodeIndex'>
124
+ * 273 'visit#<nil>:DFG:bc#63'
125
+ * 121 'walk#<nil>:DFG:bc#7'
126
+ * 119 '#<nil>:Baseline:bc#1'
127
+ * 82 'Function#<nil>:None:<nil>'
128
+ * 66 '#<nil>:DFG:bc#11'
129
+ * 65 '#<nil>:DFG:bc#33'
130
+ * 58 '#<nil>:Baseline:bc#7'
131
+ * 53 '#<nil>:Baseline:bc#23'
132
+ * 50 'forEach#<nil>:DFG:bc#83'
133
+ * 49 'pop#<nil>:FTL:bc#65'
134
+ * 47 '#<nil>:DFG:bc#99'
135
+ * 45 '#<nil>:DFG:bc#16'
136
+ * 44 '#<nil>:DFG:bc#7'
137
+ * 44 '#<nil>:Baseline:bc#30'
138
+ * 44 'push#<nil>:FTL:bc#214'
139
+ * 41 '#<nil>:DFG:bc#50'
140
+ * 39 'get#<nil>:DFG:bc#27'
141
+ * 39 '#<nil>:Baseline:bc#0'
142
+ * 36 '#<nil>:DFG:bc#27'
143
+ * 36 'Dictionary#<nil>:DFG:bc#41'
144
+ * 36 'visit#<nil>:DFG:bc#81'
145
+ * 36 'get#<nil>:FTL:bc#11'
146
+ * 32 'push#<nil>:FTL:bc#49'
147
+ * 31 '#<nil>:DFG:bc#76'
148
+ * 31 '#<nil>:DFG:bc#10'
149
+ * 31 '#<nil>:DFG:bc#73'
150
+ * 29 'set#<nil>:DFG:bc#28'
151
+ * 28 'in_boolean_context#<nil>:DFG:bc#104'
152
+ * 28 '#<nil>:Baseline:<nil>'
153
+ * 28 'regExpSplitFast#<nil>:None:<nil>'
154
+ * 26 'visit#<nil>:DFG:bc#95'
155
+ * 26 'pop#<nil>:FTL:bc#120'
156
+ * 25 '#<nil>:DFG:bc#23'
157
+ * 25 'push#<nil>:FTL:bc#152'
158
+ * 24 'push#<nil>:FTL:bc#262'
159
+ * 24 '#<nil>:FTL:bc#10'
160
+ * 23 'is_identifier_char#<nil>:DFG:bc#22'
161
+ * 23 'visit#<nil>:DFG:bc#22'
162
+ * 22 '#<nil>:FTL:bc#27'
163
+ * 22 'indexOf#<nil>:None:<nil>'
164
+ * ```
165
+ */
166
+ bytecodes: string;
177
167
 
178
- /**
179
- * Stack traces of the top functions
180
- */
181
- stackTraces: string[];
182
- }
168
+ /**
169
+ * Stack traces of the top functions
170
+ */
171
+ stackTraces: string[];
172
+ }
183
173
 
184
- /**
185
- * Run JavaScriptCore's sampling profiler for a particular function
186
- *
187
- * This is pretty low-level.
188
- *
189
- * Things to know:
190
- * - LLint means "Low Level Interpreter", which is the interpreter that runs before any JIT compilation
191
- * - Baseline is the first JIT compilation tier. It's the least optimized, but the fastest to compile
192
- * - DFG means "Data Flow Graph", which is the second JIT compilation tier. It has some optimizations, but is slower to compile
193
- * - FTL means "Faster Than Light", which is the third JIT compilation tier. It has the most optimizations, but is the slowest to compile
194
- */
195
- function profile<T extends (...args: any[]) => any>(
196
- callback: T,
197
- sampleInterval?: number,
198
- ...args: Parameters<T>
199
- ): ReturnType<T> extends Promise<infer U>
200
- ? Promise<SamplingProfile>
201
- : SamplingProfile;
174
+ /**
175
+ * Run JavaScriptCore's sampling profiler for a particular function
176
+ *
177
+ * This is pretty low-level.
178
+ *
179
+ * Things to know:
180
+ * - LLint means "Low Level Interpreter", which is the interpreter that runs before any JIT compilation
181
+ * - Baseline is the first JIT compilation tier. It's the least optimized, but the fastest to compile
182
+ * - DFG means "Data Flow Graph", which is the second JIT compilation tier. It has some optimizations, but is slower to compile
183
+ * - FTL means "Faster Than Light", which is the third JIT compilation tier. It has the most optimizations, but is the slowest to compile
184
+ */
185
+ function profile<T extends (...args: any[]) => any>(
186
+ callback: T,
187
+ sampleInterval?: number,
188
+ ...args: Parameters<T>
189
+ ): ReturnType<T> extends Promise<infer U> ? Promise<SamplingProfile> : SamplingProfile;
202
190
 
203
- /**
204
- * This returns objects which native code has explicitly protected from being
205
- * garbage collected
206
- *
207
- * By calling this function you create another reference to the object, which
208
- * will further prevent it from being garbage collected
209
- *
210
- * This function is mostly a debugging tool for bun itself.
211
- *
212
- * Warning: not all objects returned are supposed to be observable from JavaScript
213
- */
214
- function getProtectedObjects(): any[];
191
+ /**
192
+ * This returns objects which native code has explicitly protected from being
193
+ * garbage collected
194
+ *
195
+ * By calling this function you create another reference to the object, which
196
+ * will further prevent it from being garbage collected
197
+ *
198
+ * This function is mostly a debugging tool for bun itself.
199
+ *
200
+ * Warning: not all objects returned are supposed to be observable from JavaScript
201
+ */
202
+ function getProtectedObjects(): any[];
215
203
 
216
- /**
217
- * Start a remote debugging socket server on the given port.
218
- *
219
- * This exposes JavaScriptCore's built-in debugging server.
220
- *
221
- * This is untested. May not be supported yet on macOS
222
- */
223
- function startRemoteDebugger(host?: string, port?: number): void;
204
+ /**
205
+ * Start a remote debugging socket server on the given port.
206
+ *
207
+ * This exposes JavaScriptCore's built-in debugging server.
208
+ *
209
+ * This is untested. May not be supported yet on macOS
210
+ */
211
+ function startRemoteDebugger(host?: string, port?: number): void;
224
212
 
225
- /**
226
- * Run JavaScriptCore's sampling profiler
227
- */
228
- function startSamplingProfiler(optionalDirectory?: string): void;
213
+ /**
214
+ * Run JavaScriptCore's sampling profiler
215
+ */
216
+ function startSamplingProfiler(optionalDirectory?: string): void;
229
217
 
230
- /**
231
- * Non-recursively estimate the memory usage of an object, excluding the memory usage of
232
- * properties or other objects it references. For more accurate per-object
233
- * memory usage, use {@link Bun.generateHeapSnapshot}.
234
- *
235
- * This is a best-effort estimate. It may not be 100% accurate. When it's
236
- * wrong, it may mean the memory is non-contiguous (such as a large array).
237
- *
238
- * Passing a primitive type that isn't heap allocated returns 0.
239
- */
240
- function estimateShallowMemoryUsageOf(
241
- value: object | CallableFunction | bigint | symbol | string,
242
- ): number;
218
+ /**
219
+ * Non-recursively estimate the memory usage of an object, excluding the memory usage of
220
+ * properties or other objects it references. For more accurate per-object
221
+ * memory usage, use {@link Bun.generateHeapSnapshot}.
222
+ *
223
+ * This is a best-effort estimate. It may not be 100% accurate. When it's
224
+ * wrong, it may mean the memory is non-contiguous (such as a large array).
225
+ *
226
+ * Passing a primitive type that isn't heap allocated returns 0.
227
+ */
228
+ function estimateShallowMemoryUsageOf(value: object | CallableFunction | bigint | symbol | string): number;
243
229
  }
package/overrides.d.ts CHANGED
@@ -1,74 +1,117 @@
1
1
  export {};
2
2
 
3
- import type { BunFile, Env, PathLike } from "bun";
4
-
5
3
  declare global {
6
- namespace NodeJS {
7
- interface ProcessVersions extends Dict<string> {
8
- bun: string;
9
- }
10
- interface ProcessEnv extends Env {}
11
- }
4
+ namespace NodeJS {
5
+ interface Process {
6
+ readonly version: string;
7
+ browser: boolean;
8
+
9
+ /**
10
+ * Whether you are using Bun
11
+ */
12
+ isBun: true;
13
+
14
+ /**
15
+ * The current git sha of Bun
16
+ */
17
+ revision: string;
18
+
19
+ reallyExit(code?: number): never;
20
+ dlopen(module: { exports: any }, filename: string, flags?: number): void;
21
+ _exiting: boolean;
22
+ noDeprecation: boolean;
23
+
24
+ binding(m: "constants"): {
25
+ os: typeof import("node:os").constants;
26
+ fs: typeof import("node:fs").constants;
27
+ crypto: typeof import("node:crypto").constants;
28
+ zlib: typeof import("node:zlib").constants;
29
+ trace: {
30
+ TRACE_EVENT_PHASE_BEGIN: number;
31
+ TRACE_EVENT_PHASE_END: number;
32
+ TRACE_EVENT_PHASE_COMPLETE: number;
33
+ TRACE_EVENT_PHASE_INSTANT: number;
34
+ TRACE_EVENT_PHASE_ASYNC_BEGIN: number;
35
+ TRACE_EVENT_PHASE_ASYNC_STEP_INTO: number;
36
+ TRACE_EVENT_PHASE_ASYNC_STEP_PAST: number;
37
+ TRACE_EVENT_PHASE_ASYNC_END: number;
38
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_BEGIN: number;
39
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_END: number;
40
+ TRACE_EVENT_PHASE_NESTABLE_ASYNC_INSTANT: number;
41
+ TRACE_EVENT_PHASE_FLOW_BEGIN: number;
42
+ TRACE_EVENT_PHASE_FLOW_STEP: number;
43
+ TRACE_EVENT_PHASE_FLOW_END: number;
44
+ TRACE_EVENT_PHASE_METADATA: number;
45
+ TRACE_EVENT_PHASE_COUNTER: number;
46
+ TRACE_EVENT_PHASE_SAMPLE: number;
47
+ TRACE_EVENT_PHASE_CREATE_OBJECT: number;
48
+ TRACE_EVENT_PHASE_SNAPSHOT_OBJECT: number;
49
+ TRACE_EVENT_PHASE_DELETE_OBJECT: number;
50
+ TRACE_EVENT_PHASE_MEMORY_DUMP: number;
51
+ TRACE_EVENT_PHASE_MARK: number;
52
+ TRACE_EVENT_PHASE_CLOCK_SYNC: number;
53
+ TRACE_EVENT_PHASE_ENTER_CONTEXT: number;
54
+ TRACE_EVENT_PHASE_LEAVE_CONTEXT: number;
55
+ TRACE_EVENT_PHASE_LINK_IDS: number;
56
+ };
57
+ };
58
+ binding(m: string): object;
59
+ }
60
+
61
+ interface ProcessVersions extends Dict<string> {
62
+ bun: string;
63
+ }
64
+ }
12
65
  }
13
66
 
14
67
  declare module "fs/promises" {
15
- function exists(path: PathLike): Promise<boolean>;
68
+ function exists(path: Bun.PathLike): Promise<boolean>;
16
69
  }
17
70
 
18
71
  declare module "tls" {
19
- interface BunConnectionOptions
20
- extends Omit<ConnectionOptions, "key" | "ca" | "tls" | "cert"> {
21
- /**
22
- * Optionally override the trusted CA certificates. Default is to trust
23
- * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
24
- * replaced when CAs are explicitly specified using this option.
25
- */
26
- ca?:
27
- | string
28
- | Buffer
29
- | NodeJS.TypedArray
30
- | BunFile
31
- | Array<string | Buffer | BunFile>
32
- | undefined;
33
- /**
34
- * Cert chains in PEM format. One cert chain should be provided per
35
- * private key. Each cert chain should consist of the PEM formatted
36
- * certificate for a provided private key, followed by the PEM
37
- * formatted intermediate certificates (if any), in order, and not
38
- * including the root CA (the root CA must be pre-known to the peer,
39
- * see ca). When providing multiple cert chains, they do not have to
40
- * be in the same order as their private keys in key. If the
41
- * intermediate certificates are not provided, the peer will not be
42
- * able to validate the certificate, and the handshake will fail.
43
- */
44
- cert?:
45
- | string
46
- | Buffer
47
- | NodeJS.TypedArray
48
- | BunFile
49
- | Array<string | Buffer | NodeJS.TypedArray | BunFile>
50
- | undefined;
51
- /**
52
- * Private keys in PEM format. PEM allows the option of private keys
53
- * being encrypted. Encrypted keys will be decrypted with
54
- * options.passphrase. Multiple keys using different algorithms can be
55
- * provided either as an array of unencrypted key strings or buffers,
56
- * or an array of objects in the form {pem: <string|buffer>[,
57
- * passphrase: <string>]}. The object form can only occur in an array.
58
- * object.passphrase is optional. Encrypted keys will be decrypted with
59
- * object.passphrase if provided, or options.passphrase if it is not.
60
- */
61
- key?:
62
- | string
63
- | Buffer
64
- | BunFile
65
- | NodeJS.TypedArray
66
- | Array<string | Buffer | BunFile | NodeJS.TypedArray | KeyObject>
67
- | undefined;
68
- }
72
+ interface BunConnectionOptions extends Omit<ConnectionOptions, "key" | "ca" | "tls" | "cert"> {
73
+ /**
74
+ * Optionally override the trusted CA certificates. Default is to trust
75
+ * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
76
+ * replaced when CAs are explicitly specified using this option.
77
+ */
78
+ ca?: string | Buffer | NodeJS.TypedArray | Bun.BunFile | Array<string | Buffer | Bun.BunFile> | undefined;
79
+ /**
80
+ * Cert chains in PEM format. One cert chain should be provided per
81
+ * private key. Each cert chain should consist of the PEM formatted
82
+ * certificate for a provided private key, followed by the PEM
83
+ * formatted intermediate certificates (if any), in order, and not
84
+ * including the root CA (the root CA must be pre-known to the peer,
85
+ * see ca). When providing multiple cert chains, they do not have to
86
+ * be in the same order as their private keys in key. If the
87
+ * intermediate certificates are not provided, the peer will not be
88
+ * able to validate the certificate, and the handshake will fail.
89
+ */
90
+ cert?:
91
+ | string
92
+ | Buffer
93
+ | NodeJS.TypedArray
94
+ | Bun.BunFile
95
+ | Array<string | Buffer | NodeJS.TypedArray | Bun.BunFile>
96
+ | undefined;
97
+ /**
98
+ * Private keys in PEM format. PEM allows the option of private keys
99
+ * being encrypted. Encrypted keys will be decrypted with
100
+ * options.passphrase. Multiple keys using different algorithms can be
101
+ * provided either as an array of unencrypted key strings or buffers,
102
+ * or an array of objects in the form {pem: <string|buffer>[,
103
+ * passphrase: <string>]}. The object form can only occur in an array.
104
+ * object.passphrase is optional. Encrypted keys will be decrypted with
105
+ * object.passphrase if provided, or options.passphrase if it is not.
106
+ */
107
+ key?:
108
+ | string
109
+ | Buffer
110
+ | Bun.BunFile
111
+ | NodeJS.TypedArray
112
+ | Array<string | Buffer | Bun.BunFile | NodeJS.TypedArray | KeyObject>
113
+ | undefined;
114
+ }
69
115
 
70
- function connect(
71
- options: BunConnectionOptions,
72
- secureConnectListener?: () => void,
73
- ): TLSSocket;
116
+ function connect(options: BunConnectionOptions, secureConnectListener?: () => void): TLSSocket;
74
117
  }