bun-types 0.6.3 → 0.6.4
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/package.json +1 -1
- package/types.d.ts +59 -12
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Type definitions for bun 0.6.
|
|
1
|
+
// Type definitions for bun 0.6.4
|
|
2
2
|
// Project: https://github.com/oven-sh/bun
|
|
3
3
|
// Definitions by: Jarred Sumner <https://github.com/Jarred-Sumner>
|
|
4
4
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
@@ -3517,6 +3517,16 @@ declare module "bun:test" {
|
|
|
3517
3517
|
* @param hint Hint used to identify the snapshot in the snapshot file.
|
|
3518
3518
|
*/
|
|
3519
3519
|
toMatchSnapshot(propertyMatchers?: Object, hint?: string): void;
|
|
3520
|
+
/**
|
|
3521
|
+
* Asserts that a value is empty.
|
|
3522
|
+
*
|
|
3523
|
+
* @example
|
|
3524
|
+
* expect("").toBeEmpty();
|
|
3525
|
+
* expect([]).toBeEmpty();
|
|
3526
|
+
* expect({}).toBeEmpty();
|
|
3527
|
+
* expect(new Set()).toBeEmpty();
|
|
3528
|
+
*/
|
|
3529
|
+
toBeEmpty(): void;
|
|
3520
3530
|
};
|
|
3521
3531
|
}
|
|
3522
3532
|
|
|
@@ -18534,6 +18544,21 @@ interface VoidFunction {
|
|
|
18534
18544
|
declare namespace Bun {
|
|
18535
18545
|
interface Env extends Dict<string> {
|
|
18536
18546
|
NODE_ENV: string;
|
|
18547
|
+
|
|
18548
|
+
/**
|
|
18549
|
+
* The timezone used by Intl, Date, etc.
|
|
18550
|
+
*
|
|
18551
|
+
* To change the timezone, set `Bun.env.TZ` or `process.env.TZ` to the time zone you want to use.
|
|
18552
|
+
*
|
|
18553
|
+
* You can view the current timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone`
|
|
18554
|
+
*
|
|
18555
|
+
* @example
|
|
18556
|
+
* ```js
|
|
18557
|
+
* Bun.env.TZ = "America/Los_Angeles";
|
|
18558
|
+
* console.log(Intl.DateTimeFormat().resolvedOptions().timeZone); // "America/Los_Angeles"
|
|
18559
|
+
* ```
|
|
18560
|
+
*/
|
|
18561
|
+
TZ?: string;
|
|
18537
18562
|
}
|
|
18538
18563
|
}
|
|
18539
18564
|
|
|
@@ -19491,7 +19516,7 @@ declare module "bun" {
|
|
|
19491
19516
|
entry?: string;
|
|
19492
19517
|
asset?: string;
|
|
19493
19518
|
}; // | string;
|
|
19494
|
-
|
|
19519
|
+
root?: string; // project root
|
|
19495
19520
|
splitting?: boolean; // default true, enable code splitting
|
|
19496
19521
|
plugins?: BunPlugin[];
|
|
19497
19522
|
// manifest?: boolean; // whether to return manifest
|
|
@@ -20338,7 +20363,7 @@ declare module "bun" {
|
|
|
20338
20363
|
* consistently in all cases and it doesn't yet call the `error` handler
|
|
20339
20364
|
* consistently. This needs to be fixed
|
|
20340
20365
|
*/
|
|
20341
|
-
fetch(request: Request): Response | Promise<Response>;
|
|
20366
|
+
fetch(request: Request | string): Response | Promise<Response>;
|
|
20342
20367
|
|
|
20343
20368
|
/**
|
|
20344
20369
|
* Upgrade a {@link Request} to a {@link ServerWebSocket}
|
|
@@ -21275,6 +21300,7 @@ declare module "bun" {
|
|
|
21275
21300
|
* ```
|
|
21276
21301
|
*/
|
|
21277
21302
|
namespace?: string;
|
|
21303
|
+
external: boolean;
|
|
21278
21304
|
}
|
|
21279
21305
|
|
|
21280
21306
|
type OnResolveCallback = (
|
|
@@ -21667,10 +21693,10 @@ declare module "bun" {
|
|
|
21667
21693
|
*/
|
|
21668
21694
|
export function connect<Data = undefined>(
|
|
21669
21695
|
options: TCPSocketConnectOptions<Data>,
|
|
21670
|
-
): Promise<
|
|
21696
|
+
): Promise<Socket<Data>>;
|
|
21671
21697
|
export function connect<Data = undefined>(
|
|
21672
21698
|
options: UnixSocketOptions<Data>,
|
|
21673
|
-
): Promise<
|
|
21699
|
+
): Promise<Socket<Data>>;
|
|
21674
21700
|
|
|
21675
21701
|
/**
|
|
21676
21702
|
*
|
|
@@ -31454,6 +31480,18 @@ declare module "bun:jsc" {
|
|
|
31454
31480
|
export function reoptimizationRetryCount(func: Function): number;
|
|
31455
31481
|
export function drainMicrotasks(): void;
|
|
31456
31482
|
|
|
31483
|
+
/**
|
|
31484
|
+
* Set the timezone used by Intl, Date, etc.
|
|
31485
|
+
*
|
|
31486
|
+
* @param timeZone A string representing the time zone to use, such as "America/Los_Angeles"
|
|
31487
|
+
*
|
|
31488
|
+
* @returns The normalized time zone string
|
|
31489
|
+
*
|
|
31490
|
+
* You can also set process.env.TZ to the time zone you want to use.
|
|
31491
|
+
* You can also view the current timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone`
|
|
31492
|
+
*/
|
|
31493
|
+
export function setTimeZone(timeZone: string): string;
|
|
31494
|
+
|
|
31457
31495
|
/**
|
|
31458
31496
|
* Run JavaScriptCore's sampling profiler for a particular function
|
|
31459
31497
|
*
|
|
@@ -34566,7 +34604,6 @@ type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
|
|
|
34566
34604
|
* "/node_modules.server.bun".
|
|
34567
34605
|
*
|
|
34568
34606
|
* Bun may inject additional imports into your code. This usually has a `bun:` prefix.
|
|
34569
|
-
*
|
|
34570
34607
|
*/
|
|
34571
34608
|
declare var Loader: {
|
|
34572
34609
|
/**
|
|
@@ -34589,25 +34626,34 @@ declare var Loader: {
|
|
|
34589
34626
|
*
|
|
34590
34627
|
* Virtual modules and JS polyfills are embedded in bun's binary. They don't
|
|
34591
34628
|
* point to anywhere in your local filesystem.
|
|
34592
|
-
*
|
|
34593
|
-
*
|
|
34594
34629
|
*/
|
|
34595
34630
|
registry: Map<
|
|
34596
34631
|
string,
|
|
34597
34632
|
{
|
|
34633
|
+
key: string;
|
|
34598
34634
|
/**
|
|
34599
34635
|
* This refers to the state the ESM module is in
|
|
34600
34636
|
*
|
|
34601
34637
|
* TODO: make an enum for this number
|
|
34602
|
-
*
|
|
34603
|
-
*
|
|
34604
34638
|
*/
|
|
34605
34639
|
state: number;
|
|
34606
|
-
|
|
34640
|
+
fetch: Promise<any>;
|
|
34641
|
+
instantiate: Promise<any>;
|
|
34642
|
+
satisfy: Promise<any>;
|
|
34643
|
+
dependencies: Array<
|
|
34644
|
+
(typeof Loader)["registry"] extends Map<any, infer V> ? V : any
|
|
34645
|
+
>;
|
|
34607
34646
|
/**
|
|
34608
34647
|
* Your application will probably crash if you mess with this.
|
|
34609
34648
|
*/
|
|
34610
|
-
module:
|
|
34649
|
+
module: {
|
|
34650
|
+
dependenciesMap: (typeof Loader)["registry"];
|
|
34651
|
+
};
|
|
34652
|
+
linkError?: any;
|
|
34653
|
+
linkSucceeded: boolean;
|
|
34654
|
+
evaluated: boolean;
|
|
34655
|
+
then?: any;
|
|
34656
|
+
isAsync: boolean;
|
|
34611
34657
|
}
|
|
34612
34658
|
>;
|
|
34613
34659
|
/**
|
|
@@ -34731,6 +34777,7 @@ declare var ReadableStreamDefaultController: {
|
|
|
34731
34777
|
interface ReadableStreamDefaultReader<R = any>
|
|
34732
34778
|
extends ReadableStreamGenericReader {
|
|
34733
34779
|
read(): Promise<ReadableStreamDefaultReadResult<R>>;
|
|
34780
|
+
readMany(): Promise<ReadableStreamDefaultReadValueResult<R>>;
|
|
34734
34781
|
releaseLock(): void;
|
|
34735
34782
|
}
|
|
34736
34783
|
|