@hono/node-server 1.19.7 → 1.19.9
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/README.md +17 -0
- package/dist/globals.d.mts +1 -1
- package/dist/globals.d.ts +1 -1
- package/dist/globals.js +0 -10
- package/dist/globals.mjs +0 -10
- package/dist/index.js +0 -10
- package/dist/index.mjs +0 -10
- package/dist/listener.js +0 -10
- package/dist/listener.mjs +0 -10
- package/dist/request.d.mts +1 -1
- package/dist/request.d.ts +1 -1
- package/dist/response.d.mts +1 -1
- package/dist/response.d.ts +1 -1
- package/dist/serve-static.d.mts +1 -1
- package/dist/serve-static.d.ts +1 -1
- package/dist/serve-static.js +10 -0
- package/dist/serve-static.mjs +10 -0
- package/dist/server.js +0 -10
- package/dist/server.mjs +0 -10
- package/dist/types.d.mts +3 -3
- package/dist/types.d.ts +3 -3
- package/dist/utils.d.mts +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/vercel.js +0 -10
- package/dist/vercel.mjs +0 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -326,6 +326,23 @@ app.get('/', (c) => {
|
|
|
326
326
|
serve(app)
|
|
327
327
|
```
|
|
328
328
|
|
|
329
|
+
## Listen to a UNIX domain socket
|
|
330
|
+
|
|
331
|
+
You can configure the HTTP server to listen to a UNIX domain socket instead of a TCP port.
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
import { createAdaptorServer } from '@hono/node-server'
|
|
335
|
+
|
|
336
|
+
// ...
|
|
337
|
+
|
|
338
|
+
const socketPath ='/tmp/example.sock'
|
|
339
|
+
|
|
340
|
+
const server = createAdaptorServer(app)
|
|
341
|
+
server.listen(socketPath, () => {
|
|
342
|
+
console.log(`Listening on ${socketPath}`)
|
|
343
|
+
})
|
|
344
|
+
```
|
|
345
|
+
|
|
329
346
|
## Related projects
|
|
330
347
|
|
|
331
348
|
- Hono - <https://hono.dev>
|
package/dist/globals.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { }
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export {
|
|
2
|
+
export { }
|
package/dist/globals.js
CHANGED
|
@@ -24,16 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
|
|
25
25
|
// src/globals.ts
|
|
26
26
|
var import_node_crypto = __toESM(require("crypto"));
|
|
27
|
-
var webFetch = global.fetch;
|
|
28
27
|
if (typeof global.crypto === "undefined") {
|
|
29
28
|
global.crypto = import_node_crypto.default;
|
|
30
29
|
}
|
|
31
|
-
global.fetch = (info, init) => {
|
|
32
|
-
init = {
|
|
33
|
-
// Disable compression handling so people can return the result of a fetch
|
|
34
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
35
|
-
compress: false,
|
|
36
|
-
...init
|
|
37
|
-
};
|
|
38
|
-
return webFetch(info, init);
|
|
39
|
-
};
|
package/dist/globals.mjs
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
// src/globals.ts
|
|
2
2
|
import crypto from "crypto";
|
|
3
|
-
var webFetch = global.fetch;
|
|
4
3
|
if (typeof global.crypto === "undefined") {
|
|
5
4
|
global.crypto = crypto;
|
|
6
5
|
}
|
|
7
|
-
global.fetch = (info, init) => {
|
|
8
|
-
init = {
|
|
9
|
-
// Disable compression handling so people can return the result of a fetch
|
|
10
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
11
|
-
compress: false,
|
|
12
|
-
...init
|
|
13
|
-
};
|
|
14
|
-
return webFetch(info, init);
|
|
15
|
-
};
|
package/dist/index.js
CHANGED
|
@@ -368,19 +368,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
368
368
|
|
|
369
369
|
// src/globals.ts
|
|
370
370
|
var import_node_crypto = __toESM(require("crypto"));
|
|
371
|
-
var webFetch = global.fetch;
|
|
372
371
|
if (typeof global.crypto === "undefined") {
|
|
373
372
|
global.crypto = import_node_crypto.default;
|
|
374
373
|
}
|
|
375
|
-
global.fetch = (info, init) => {
|
|
376
|
-
init = {
|
|
377
|
-
// Disable compression handling so people can return the result of a fetch
|
|
378
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
379
|
-
compress: false,
|
|
380
|
-
...init
|
|
381
|
-
};
|
|
382
|
-
return webFetch(info, init);
|
|
383
|
-
};
|
|
384
374
|
|
|
385
375
|
// src/listener.ts
|
|
386
376
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/index.mjs
CHANGED
|
@@ -329,19 +329,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
329
329
|
|
|
330
330
|
// src/globals.ts
|
|
331
331
|
import crypto from "crypto";
|
|
332
|
-
var webFetch = global.fetch;
|
|
333
332
|
if (typeof global.crypto === "undefined") {
|
|
334
333
|
global.crypto = crypto;
|
|
335
334
|
}
|
|
336
|
-
global.fetch = (info, init) => {
|
|
337
|
-
init = {
|
|
338
|
-
// Disable compression handling so people can return the result of a fetch
|
|
339
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
340
|
-
compress: false,
|
|
341
|
-
...init
|
|
342
|
-
};
|
|
343
|
-
return webFetch(info, init);
|
|
344
|
-
};
|
|
345
335
|
|
|
346
336
|
// src/listener.ts
|
|
347
337
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/listener.js
CHANGED
|
@@ -360,19 +360,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
360
360
|
|
|
361
361
|
// src/globals.ts
|
|
362
362
|
var import_node_crypto = __toESM(require("crypto"));
|
|
363
|
-
var webFetch = global.fetch;
|
|
364
363
|
if (typeof global.crypto === "undefined") {
|
|
365
364
|
global.crypto = import_node_crypto.default;
|
|
366
365
|
}
|
|
367
|
-
global.fetch = (info, init) => {
|
|
368
|
-
init = {
|
|
369
|
-
// Disable compression handling so people can return the result of a fetch
|
|
370
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
371
|
-
compress: false,
|
|
372
|
-
...init
|
|
373
|
-
};
|
|
374
|
-
return webFetch(info, init);
|
|
375
|
-
};
|
|
376
366
|
|
|
377
367
|
// src/listener.ts
|
|
378
368
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/listener.mjs
CHANGED
|
@@ -326,19 +326,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
326
326
|
|
|
327
327
|
// src/globals.ts
|
|
328
328
|
import crypto from "crypto";
|
|
329
|
-
var webFetch = global.fetch;
|
|
330
329
|
if (typeof global.crypto === "undefined") {
|
|
331
330
|
global.crypto = crypto;
|
|
332
331
|
}
|
|
333
|
-
global.fetch = (info, init) => {
|
|
334
|
-
init = {
|
|
335
|
-
// Disable compression handling so people can return the result of a fetch
|
|
336
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
337
|
-
compress: false,
|
|
338
|
-
...init
|
|
339
|
-
};
|
|
340
|
-
return webFetch(info, init);
|
|
341
|
-
};
|
|
342
332
|
|
|
343
333
|
// src/listener.ts
|
|
344
334
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/request.d.mts
CHANGED
|
@@ -22,4 +22,4 @@ declare const abortControllerKey: unique symbol;
|
|
|
22
22
|
declare const getAbortController: unique symbol;
|
|
23
23
|
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
|
24
24
|
|
|
25
|
-
export { GlobalRequest,
|
|
25
|
+
export { GlobalRequest, IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
package/dist/request.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ declare const abortControllerKey: unique symbol;
|
|
|
22
22
|
declare const getAbortController: unique symbol;
|
|
23
23
|
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
|
24
24
|
|
|
25
|
-
export { GlobalRequest,
|
|
25
|
+
export { GlobalRequest, IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
package/dist/response.d.mts
CHANGED
package/dist/response.d.ts
CHANGED
package/dist/serve-static.d.mts
CHANGED
package/dist/serve-static.d.ts
CHANGED
package/dist/serve-static.js
CHANGED
|
@@ -26,6 +26,8 @@ module.exports = __toCommonJS(serve_static_exports);
|
|
|
26
26
|
var import_mime = require("hono/utils/mime");
|
|
27
27
|
var import_node_fs = require("fs");
|
|
28
28
|
var import_node_path = require("path");
|
|
29
|
+
var import_node_process = require("process");
|
|
30
|
+
var import_node_stream = require("stream");
|
|
29
31
|
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
30
32
|
var ENCODINGS = {
|
|
31
33
|
br: ".br",
|
|
@@ -33,7 +35,15 @@ var ENCODINGS = {
|
|
|
33
35
|
gzip: ".gz"
|
|
34
36
|
};
|
|
35
37
|
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
38
|
+
var pr54206Applied = () => {
|
|
39
|
+
const [major, minor] = import_node_process.versions.node.split(".").map((component) => parseInt(component));
|
|
40
|
+
return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
|
|
41
|
+
};
|
|
42
|
+
var useReadableToWeb = pr54206Applied();
|
|
36
43
|
var createStreamBody = (stream) => {
|
|
44
|
+
if (useReadableToWeb) {
|
|
45
|
+
return import_node_stream.Readable.toWeb(stream);
|
|
46
|
+
}
|
|
37
47
|
const body = new ReadableStream({
|
|
38
48
|
start(controller) {
|
|
39
49
|
stream.on("data", (chunk) => {
|
package/dist/serve-static.mjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { getMimeType } from "hono/utils/mime";
|
|
3
3
|
import { createReadStream, statSync, existsSync } from "fs";
|
|
4
4
|
import { join } from "path";
|
|
5
|
+
import { versions } from "process";
|
|
6
|
+
import { Readable } from "stream";
|
|
5
7
|
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
|
6
8
|
var ENCODINGS = {
|
|
7
9
|
br: ".br",
|
|
@@ -9,7 +11,15 @@ var ENCODINGS = {
|
|
|
9
11
|
gzip: ".gz"
|
|
10
12
|
};
|
|
11
13
|
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
|
14
|
+
var pr54206Applied = () => {
|
|
15
|
+
const [major, minor] = versions.node.split(".").map((component) => parseInt(component));
|
|
16
|
+
return major >= 23 || major === 22 && minor >= 7 || major === 20 && minor >= 18;
|
|
17
|
+
};
|
|
18
|
+
var useReadableToWeb = pr54206Applied();
|
|
12
19
|
var createStreamBody = (stream) => {
|
|
20
|
+
if (useReadableToWeb) {
|
|
21
|
+
return Readable.toWeb(stream);
|
|
22
|
+
}
|
|
13
23
|
const body = new ReadableStream({
|
|
14
24
|
start(controller) {
|
|
15
25
|
stream.on("data", (chunk) => {
|
package/dist/server.js
CHANGED
|
@@ -364,19 +364,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
364
364
|
|
|
365
365
|
// src/globals.ts
|
|
366
366
|
var import_node_crypto = __toESM(require("crypto"));
|
|
367
|
-
var webFetch = global.fetch;
|
|
368
367
|
if (typeof global.crypto === "undefined") {
|
|
369
368
|
global.crypto = import_node_crypto.default;
|
|
370
369
|
}
|
|
371
|
-
global.fetch = (info, init) => {
|
|
372
|
-
init = {
|
|
373
|
-
// Disable compression handling so people can return the result of a fetch
|
|
374
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
375
|
-
compress: false,
|
|
376
|
-
...init
|
|
377
|
-
};
|
|
378
|
-
return webFetch(info, init);
|
|
379
|
-
};
|
|
380
370
|
|
|
381
371
|
// src/listener.ts
|
|
382
372
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/server.mjs
CHANGED
|
@@ -329,19 +329,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
329
329
|
|
|
330
330
|
// src/globals.ts
|
|
331
331
|
import crypto from "crypto";
|
|
332
|
-
var webFetch = global.fetch;
|
|
333
332
|
if (typeof global.crypto === "undefined") {
|
|
334
333
|
global.crypto = crypto;
|
|
335
334
|
}
|
|
336
|
-
global.fetch = (info, init) => {
|
|
337
|
-
init = {
|
|
338
|
-
// Disable compression handling so people can return the result of a fetch
|
|
339
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
340
|
-
compress: false,
|
|
341
|
-
...init
|
|
342
|
-
};
|
|
343
|
-
return webFetch(info, init);
|
|
344
|
-
};
|
|
345
335
|
|
|
346
336
|
// src/listener.ts
|
|
347
337
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer
|
|
2
|
-
import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer
|
|
1
|
+
import { IncomingMessage, ServerResponse, Server, ServerOptions as ServerOptions$1, createServer } from 'node:http';
|
|
2
|
+
import { Http2ServerRequest, Http2ServerResponse, Http2Server, Http2SecureServer, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer } from 'node:http2';
|
|
3
3
|
import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
|
|
4
4
|
|
|
5
5
|
type HttpBindings = {
|
|
@@ -41,4 +41,4 @@ type Options = {
|
|
|
41
41
|
} & ServerOptions;
|
|
42
42
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
43
43
|
|
|
44
|
-
export
|
|
44
|
+
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer
|
|
2
|
-
import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer
|
|
1
|
+
import { IncomingMessage, ServerResponse, Server, ServerOptions as ServerOptions$1, createServer } from 'node:http';
|
|
2
|
+
import { Http2ServerRequest, Http2ServerResponse, Http2Server, Http2SecureServer, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer } from 'node:http2';
|
|
3
3
|
import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
|
|
4
4
|
|
|
5
5
|
type HttpBindings = {
|
|
@@ -41,4 +41,4 @@ type Options = {
|
|
|
41
41
|
} & ServerOptions;
|
|
42
42
|
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
|
43
43
|
|
|
44
|
-
export
|
|
44
|
+
export { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
package/dist/utils.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { OutgoingHttpHeaders } from 'node:http';
|
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
declare function readWithoutBlocking(readPromise: Promise<ReadableStreamReadResult<Uint8Array>>): Promise<ReadableStreamReadResult<Uint8Array> | undefined>;
|
|
5
|
-
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<
|
|
6
|
-
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<
|
|
5
|
+
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<void>;
|
|
6
|
+
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<void> | undefined;
|
|
7
7
|
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
|
8
8
|
|
|
9
9
|
export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader };
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { OutgoingHttpHeaders } from 'node:http';
|
|
|
2
2
|
import { Writable } from 'node:stream';
|
|
3
3
|
|
|
4
4
|
declare function readWithoutBlocking(readPromise: Promise<ReadableStreamReadResult<Uint8Array>>): Promise<ReadableStreamReadResult<Uint8Array> | undefined>;
|
|
5
|
-
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<
|
|
6
|
-
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<
|
|
5
|
+
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<void>;
|
|
6
|
+
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<void> | undefined;
|
|
7
7
|
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
|
8
8
|
|
|
9
9
|
export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader };
|
package/dist/vercel.js
CHANGED
|
@@ -362,19 +362,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
362
362
|
|
|
363
363
|
// src/globals.ts
|
|
364
364
|
var import_node_crypto = __toESM(require("crypto"));
|
|
365
|
-
var webFetch = global.fetch;
|
|
366
365
|
if (typeof global.crypto === "undefined") {
|
|
367
366
|
global.crypto = import_node_crypto.default;
|
|
368
367
|
}
|
|
369
|
-
global.fetch = (info, init) => {
|
|
370
|
-
init = {
|
|
371
|
-
// Disable compression handling so people can return the result of a fetch
|
|
372
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
373
|
-
compress: false,
|
|
374
|
-
...init
|
|
375
|
-
};
|
|
376
|
-
return webFetch(info, init);
|
|
377
|
-
};
|
|
378
368
|
|
|
379
369
|
// src/listener.ts
|
|
380
370
|
var outgoingEnded = Symbol("outgoingEnded");
|
package/dist/vercel.mjs
CHANGED
|
@@ -326,19 +326,9 @@ var X_ALREADY_SENT = "x-hono-already-sent";
|
|
|
326
326
|
|
|
327
327
|
// src/globals.ts
|
|
328
328
|
import crypto from "crypto";
|
|
329
|
-
var webFetch = global.fetch;
|
|
330
329
|
if (typeof global.crypto === "undefined") {
|
|
331
330
|
global.crypto = crypto;
|
|
332
331
|
}
|
|
333
|
-
global.fetch = (info, init) => {
|
|
334
|
-
init = {
|
|
335
|
-
// Disable compression handling so people can return the result of a fetch
|
|
336
|
-
// directly in the loader without messing with the Content-Encoding header.
|
|
337
|
-
compress: false,
|
|
338
|
-
...init
|
|
339
|
-
};
|
|
340
|
-
return webFetch(info, init);
|
|
341
|
-
};
|
|
342
332
|
|
|
343
333
|
// src/listener.ts
|
|
344
334
|
var outgoingEnded = Symbol("outgoingEnded");
|