bun-types 1.1.30-canary.20240926T140505 → 1.1.30-canary.20240927T140542
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 +108 -1
- 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`.
|
|
@@ -4810,6 +4891,32 @@ declare module "bun" {
|
|
|
4810
4891
|
* @default cmds[0]
|
|
4811
4892
|
*/
|
|
4812
4893
|
argv0?: string;
|
|
4894
|
+
|
|
4895
|
+
/**
|
|
4896
|
+
* An {@link AbortSignal} that can be used to abort the subprocess.
|
|
4897
|
+
*
|
|
4898
|
+
* This is useful for aborting a subprocess when some other part of the
|
|
4899
|
+
* program is aborted, such as a `fetch` response.
|
|
4900
|
+
*
|
|
4901
|
+
* Internally, this works by calling `subprocess.kill(1)`.
|
|
4902
|
+
*
|
|
4903
|
+
* @example
|
|
4904
|
+
* ```ts
|
|
4905
|
+
* const controller = new AbortController();
|
|
4906
|
+
* const { signal } = controller;
|
|
4907
|
+
* const start = performance.now();
|
|
4908
|
+
* const subprocess = Bun.spawn({
|
|
4909
|
+
* cmd: ["sleep", "100"],
|
|
4910
|
+
* signal,
|
|
4911
|
+
* });
|
|
4912
|
+
* await Bun.sleep(1);
|
|
4913
|
+
* controller.abort();
|
|
4914
|
+
* await subprocess.exited;
|
|
4915
|
+
* const end = performance.now();
|
|
4916
|
+
* console.log(end - start); // 1ms instead of 101ms
|
|
4917
|
+
* ```
|
|
4918
|
+
*/
|
|
4919
|
+
signal?: AbortSignal;
|
|
4813
4920
|
}
|
|
4814
4921
|
|
|
4815
4922
|
type OptionsToSubprocess<Opts extends OptionsObject> =
|
package/package.json
CHANGED