bun-types 1.1.30-canary.20240926T140505 → 1.1.30-canary.20240928T140503
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/bun.d.ts +113 -2
- package/package.json +1 -1
package/bun.d.ts
CHANGED
|
@@ -2367,7 +2367,7 @@ declare module "bun" {
|
|
|
2367
2367
|
|
|
2368
2368
|
error?: (
|
|
2369
2369
|
this: Server,
|
|
2370
|
-
|
|
2370
|
+
error: ErrorLike,
|
|
2371
2371
|
) => Response | Promise<Response> | undefined | Promise<undefined>;
|
|
2372
2372
|
|
|
2373
2373
|
/**
|
|
@@ -3147,6 +3147,87 @@ declare module "bun" {
|
|
|
3147
3147
|
|
|
3148
3148
|
type StringLike = string | { toString(): string };
|
|
3149
3149
|
|
|
3150
|
+
type ColorInput =
|
|
3151
|
+
| { r: number; g: number; b: number; a?: number }
|
|
3152
|
+
| [number, number, number]
|
|
3153
|
+
| [number, number, number, number]
|
|
3154
|
+
| Uint8Array
|
|
3155
|
+
| Uint8ClampedArray
|
|
3156
|
+
| Float32Array
|
|
3157
|
+
| Float64Array
|
|
3158
|
+
| string
|
|
3159
|
+
| number
|
|
3160
|
+
| { toString(): string };
|
|
3161
|
+
|
|
3162
|
+
function color(
|
|
3163
|
+
input: ColorInput,
|
|
3164
|
+
outputFormat?: /**
|
|
3165
|
+
* True color ANSI color string, for use in terminals
|
|
3166
|
+
* @example \x1b[38;2;100;200;200m
|
|
3167
|
+
*/
|
|
3168
|
+
| "ansi"
|
|
3169
|
+
/**
|
|
3170
|
+
* 256 color ANSI color string, for use in terminals which don't support true color
|
|
3171
|
+
*
|
|
3172
|
+
* Tries to match closest 24-bit color to 256 color palette
|
|
3173
|
+
*/
|
|
3174
|
+
| "ansi256"
|
|
3175
|
+
/**
|
|
3176
|
+
* Lowercase hex color string without alpha
|
|
3177
|
+
* @example #aabb11
|
|
3178
|
+
*/
|
|
3179
|
+
| "hex"
|
|
3180
|
+
/**
|
|
3181
|
+
* RGB color string without alpha
|
|
3182
|
+
* rgb(100, 200, 200)
|
|
3183
|
+
*/
|
|
3184
|
+
| "rgb"
|
|
3185
|
+
/**
|
|
3186
|
+
* RGB color string with alpha
|
|
3187
|
+
* rgba(100, 200, 200, 0.5)
|
|
3188
|
+
*/
|
|
3189
|
+
| "rgba"
|
|
3190
|
+
| "hsl"
|
|
3191
|
+
| "lab"
|
|
3192
|
+
| "css"
|
|
3193
|
+
| "lab"
|
|
3194
|
+
| "HEX",
|
|
3195
|
+
): string | null;
|
|
3196
|
+
|
|
3197
|
+
function color(
|
|
3198
|
+
input: ColorInput,
|
|
3199
|
+
/**
|
|
3200
|
+
* An array of numbers representing the RGB color
|
|
3201
|
+
* @example [100, 200, 200]
|
|
3202
|
+
*/
|
|
3203
|
+
outputFormat: "[rgb]",
|
|
3204
|
+
): [number, number, number] | null;
|
|
3205
|
+
function color(
|
|
3206
|
+
input: ColorInput,
|
|
3207
|
+
/**
|
|
3208
|
+
* An array of numbers representing the RGBA color
|
|
3209
|
+
* @example [100, 200, 200, 255]
|
|
3210
|
+
*/
|
|
3211
|
+
outputFormat: "[rgba]",
|
|
3212
|
+
): [number, number, number, number] | null;
|
|
3213
|
+
function color(
|
|
3214
|
+
input: ColorInput,
|
|
3215
|
+
/**
|
|
3216
|
+
* An object representing the RGB color
|
|
3217
|
+
* @example { r: 100, g: 200, b: 200 }
|
|
3218
|
+
*/
|
|
3219
|
+
outputFormat: "{rgb}",
|
|
3220
|
+
): { r: number; g: number; b: number } | null;
|
|
3221
|
+
function color(
|
|
3222
|
+
input: ColorInput,
|
|
3223
|
+
/**
|
|
3224
|
+
* An object representing the RGBA color
|
|
3225
|
+
* @example { r: 100, g: 200, b: 200, a: 0.5 }
|
|
3226
|
+
*/
|
|
3227
|
+
outputFormat: "{rgba}",
|
|
3228
|
+
): { r: number; g: number; b: number; a: number } | null;
|
|
3229
|
+
function color(input: ColorInput, outputFormat: "number"): number | null;
|
|
3230
|
+
|
|
3150
3231
|
interface Semver {
|
|
3151
3232
|
/**
|
|
3152
3233
|
* Test if the version satisfies the range. Stringifies both arguments. Returns `true` or `false`.
|
|
@@ -3388,8 +3469,12 @@ declare module "bun" {
|
|
|
3388
3469
|
* Create a new hasher
|
|
3389
3470
|
*
|
|
3390
3471
|
* @param algorithm The algorithm to use. See {@link algorithms} for a list of supported algorithms
|
|
3472
|
+
* @param hmacKey Optional key for HMAC. Must be a string or `TypedArray`. If not provided, the hasher will be a non-HMAC hasher.
|
|
3391
3473
|
*/
|
|
3392
|
-
constructor(
|
|
3474
|
+
constructor(
|
|
3475
|
+
algorithm: SupportedCryptoAlgorithms,
|
|
3476
|
+
hmacKey?: string | NodeJS.TypedArray,
|
|
3477
|
+
);
|
|
3393
3478
|
|
|
3394
3479
|
/**
|
|
3395
3480
|
* Update the hash with data
|
|
@@ -4810,6 +4895,32 @@ declare module "bun" {
|
|
|
4810
4895
|
* @default cmds[0]
|
|
4811
4896
|
*/
|
|
4812
4897
|
argv0?: string;
|
|
4898
|
+
|
|
4899
|
+
/**
|
|
4900
|
+
* An {@link AbortSignal} that can be used to abort the subprocess.
|
|
4901
|
+
*
|
|
4902
|
+
* This is useful for aborting a subprocess when some other part of the
|
|
4903
|
+
* program is aborted, such as a `fetch` response.
|
|
4904
|
+
*
|
|
4905
|
+
* Internally, this works by calling `subprocess.kill(1)`.
|
|
4906
|
+
*
|
|
4907
|
+
* @example
|
|
4908
|
+
* ```ts
|
|
4909
|
+
* const controller = new AbortController();
|
|
4910
|
+
* const { signal } = controller;
|
|
4911
|
+
* const start = performance.now();
|
|
4912
|
+
* const subprocess = Bun.spawn({
|
|
4913
|
+
* cmd: ["sleep", "100"],
|
|
4914
|
+
* signal,
|
|
4915
|
+
* });
|
|
4916
|
+
* await Bun.sleep(1);
|
|
4917
|
+
* controller.abort();
|
|
4918
|
+
* await subprocess.exited;
|
|
4919
|
+
* const end = performance.now();
|
|
4920
|
+
* console.log(end - start); // 1ms instead of 101ms
|
|
4921
|
+
* ```
|
|
4922
|
+
*/
|
|
4923
|
+
signal?: AbortSignal;
|
|
4813
4924
|
}
|
|
4814
4925
|
|
|
4815
4926
|
type OptionsToSubprocess<Opts extends OptionsObject> =
|
package/package.json
CHANGED