bun-types 1.1.21-canary.20240721T140454 → 1.1.21-canary.20240723T140524

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.
Files changed (3) hide show
  1. package/bun.d.ts +5 -1
  2. package/globals.d.ts +38 -22
  3. package/package.json +1 -1
package/bun.d.ts CHANGED
@@ -1507,7 +1507,7 @@ declare module "bun" {
1507
1507
  * ```js
1508
1508
  * const {imports, exports} = transpiler.scan(`
1509
1509
  * import {foo} from "baz";
1510
- * const hello = "hi!";
1510
+ * export const hello = "hi!";
1511
1511
  * `);
1512
1512
  *
1513
1513
  * console.log(imports); // ["baz"]
@@ -3218,6 +3218,10 @@ declare module "bun" {
3218
3218
  */
3219
3219
  function openInEditor(path: string, options?: EditorOptions): void;
3220
3220
 
3221
+ const fetch: typeof globalThis.fetch & {
3222
+ preconnect(url: string): void;
3223
+ };
3224
+
3221
3225
  interface EditorOptions {
3222
3226
  editor?: "vscode" | "subl";
3223
3227
  line?: number;
package/globals.d.ts CHANGED
@@ -988,29 +988,45 @@ declare global {
988
988
  new (): ShadowRealm;
989
989
  };
990
990
 
991
- /**
992
- * Send a HTTP(s) request
993
- *
994
- * @param request Request object
995
- * @param init A structured value that contains settings for the fetch() request.
996
- *
997
- * @returns A promise that resolves to {@link Response} object.
998
- */
991
+ interface Fetch {
992
+ /**
993
+ * Send a HTTP(s) request
994
+ *
995
+ * @param request Request object
996
+ * @param init A structured value that contains settings for the fetch() request.
997
+ *
998
+ * @returns A promise that resolves to {@link Response} object.
999
+ */
1000
+ (request: Request, init?: RequestInit): Promise<Response>;
999
1001
 
1000
- // tslint:disable-next-line:unified-signatures
1001
- function fetch(request: Request, init?: RequestInit): Promise<Response>;
1002
- /**
1003
- * Send a HTTP(s) request
1004
- *
1005
- * @param url URL string
1006
- * @param init A structured value that contains settings for the fetch() request.
1007
- *
1008
- * @returns A promise that resolves to {@link Response} object.
1009
- */
1010
- function fetch(
1011
- url: string | URL | Request,
1012
- init?: FetchRequestInit,
1013
- ): Promise<Response>;
1002
+ /**
1003
+ * Send a HTTP(s) request
1004
+ *
1005
+ * @param url URL string
1006
+ * @param init A structured value that contains settings for the fetch() request.
1007
+ *
1008
+ * @returns A promise that resolves to {@link Response} object.
1009
+ */
1010
+ (url: string | URL | Request, init?: FetchRequestInit): Promise<Response>;
1011
+
1012
+ (
1013
+ input: string | URL | globalThis.Request,
1014
+ init?: RequestInit,
1015
+ ): Promise<Response>;
1016
+
1017
+ /**
1018
+ * Start the DNS resolution, TCP connection, and TLS handshake for a request
1019
+ * before the request is actually sent.
1020
+ *
1021
+ * This can reduce the latency of a request when you know there's some
1022
+ * long-running task that will delay the request starting.
1023
+ *
1024
+ * This is a bun-specific API and is not part of the Fetch API specification.
1025
+ */
1026
+ preconnect(url: string | URL): void;
1027
+ }
1028
+
1029
+ var fetch: Fetch;
1014
1030
 
1015
1031
  function queueMicrotask(callback: (...args: any[]) => void): void;
1016
1032
  /**
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.21-canary.20240721T140454",
2
+ "version": "1.1.21-canary.20240723T140524",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "main": "",