elysia 2.0.0-beta.2 → 2.0.0-beta.21
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/dist/adapter/bun/index.d.ts +18 -2
- package/dist/adapter/bun/index.js +467 -110
- package/dist/adapter/bun/index.mjs +467 -112
- package/dist/adapter/types.d.ts +2 -21
- package/dist/adapter/utils.d.ts +14 -3
- package/dist/adapter/utils.js +146 -87
- package/dist/adapter/utils.mjs +148 -90
- package/dist/adapter/web-standard/handler.d.ts +1 -1
- package/dist/adapter/web-standard/handler.js +47 -36
- package/dist/adapter/web-standard/handler.mjs +48 -37
- package/dist/adapter/web-standard/index.js +2 -30
- package/dist/adapter/web-standard/index.mjs +2 -30
- package/dist/adapter/web-standard/utils.js +5 -18
- package/dist/adapter/web-standard/utils.mjs +5 -18
- package/dist/base.d.ts +99 -67
- package/dist/base.js +678 -510
- package/dist/base.mjs +682 -514
- package/dist/compile/aot-capture.d.ts +2 -13
- package/dist/compile/aot-capture.js +26 -69
- package/dist/compile/aot-capture.mjs +28 -67
- package/dist/compile/aot-emit.d.ts +9 -7
- package/dist/compile/aot-emit.js +42 -19
- package/dist/compile/aot-emit.mjs +42 -20
- package/dist/compile/aot.d.ts +17 -19
- package/dist/compile/aot.js +41 -51
- package/dist/compile/aot.mjs +39 -49
- package/dist/compile/handler/descriptor.d.ts +9 -12
- package/dist/compile/handler/descriptor.js +19 -44
- package/dist/compile/handler/descriptor.mjs +20 -42
- package/dist/compile/handler/frozen-validator.d.ts +5 -10
- package/dist/compile/handler/frozen-validator.js +55 -105
- package/dist/compile/handler/frozen-validator.mjs +53 -105
- package/dist/compile/handler/index.d.ts +7 -5
- package/dist/compile/handler/index.js +270 -111
- package/dist/compile/handler/index.mjs +270 -113
- package/dist/compile/handler/jit.d.ts +19 -17
- package/dist/compile/handler/jit.js +222 -149
- package/dist/compile/handler/jit.mjs +224 -152
- package/dist/compile/handler/params.d.ts +1 -4
- package/dist/compile/handler/params.js +10 -5
- package/dist/compile/handler/params.mjs +14 -8
- package/dist/compile/handler/reconstruct.d.ts +2 -2
- package/dist/compile/handler/reconstruct.js +6 -4
- package/dist/compile/handler/reconstruct.mjs +6 -4
- package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
- package/dist/compile/handler/static-clone-resolver.js +8 -0
- package/dist/compile/handler/static-clone-resolver.mjs +7 -0
- package/dist/compile/handler/utils.d.ts +22 -11
- package/dist/compile/handler/utils.js +159 -253
- package/dist/compile/handler/utils.mjs +155 -252
- package/dist/compile/jit-probe.d.ts +2 -2
- package/dist/compile/jit-probe.js +2 -3
- package/dist/compile/jit-probe.mjs +2 -3
- package/dist/compile/lexer.d.ts +7 -4
- package/dist/compile/lexer.js +268 -6
- package/dist/compile/lexer.mjs +268 -4
- package/dist/compile/utils.js +7 -4
- package/dist/compile/utils.mjs +7 -4
- package/dist/compiled.d.ts +0 -1
- package/dist/compiled.js +0 -1
- package/dist/compiled.mjs +0 -1
- package/dist/context.d.ts +14 -4
- package/dist/context.js +17 -32
- package/dist/context.mjs +19 -34
- package/dist/cookie/config.d.ts +7 -2
- package/dist/cookie/config.js +76 -16
- package/dist/cookie/config.mjs +77 -18
- package/dist/cookie/cookie.d.ts +1 -1
- package/dist/cookie/cookie.js +8 -10
- package/dist/cookie/cookie.mjs +8 -10
- package/dist/cookie/crypto.d.ts +8 -7
- package/dist/cookie/crypto.js +51 -40
- package/dist/cookie/crypto.mjs +51 -41
- package/dist/cookie/error.d.ts +1 -2
- package/dist/cookie/error.js +6 -4
- package/dist/cookie/error.mjs +6 -4
- package/dist/cookie/lib.js +7 -2
- package/dist/cookie/lib.mjs +7 -2
- package/dist/cookie/serialize.js +1 -1
- package/dist/cookie/serialize.mjs +1 -1
- package/dist/cookie/types.d.ts +10 -0
- package/dist/cookie/utils.d.ts +4 -8
- package/dist/cookie/utils.js +86 -52
- package/dist/cookie/utils.mjs +89 -54
- package/dist/error.d.ts +113 -103
- package/dist/error.js +181 -117
- package/dist/error.mjs +179 -118
- package/dist/generation.d.ts +2 -2
- package/dist/handler/error.d.ts +26 -15
- package/dist/handler/error.js +77 -96
- package/dist/handler/error.mjs +74 -97
- package/dist/handler/fetch.js +87 -108
- package/dist/handler/fetch.mjs +89 -110
- package/dist/handler/utils.d.ts +12 -6
- package/dist/handler/utils.js +84 -28
- package/dist/handler/utils.mjs +80 -28
- package/dist/index.d.ts +12 -12
- package/dist/index.js +2 -9
- package/dist/index.mjs +1 -1
- package/dist/memory.js +1 -1
- package/dist/memory.mjs +1 -1
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin/aot/bun.d.ts +8 -1
- package/dist/plugin/aot/bun.js +16 -9
- package/dist/plugin/aot/bun.mjs +17 -10
- package/dist/plugin/aot/core.d.ts +52 -60
- package/dist/plugin/aot/core.js +208 -109
- package/dist/plugin/aot/core.mjs +205 -111
- package/dist/plugin/aot/esbuild.js +8 -5
- package/dist/plugin/aot/esbuild.mjs +9 -6
- package/dist/plugin/aot/hooks.d.ts +6 -17
- package/dist/plugin/aot/hooks.js +36 -14
- package/dist/plugin/aot/hooks.mjs +37 -16
- package/dist/plugin/aot/rspack-loader.d.ts +1 -5
- package/dist/plugin/aot/rspack-loader.js +1 -10
- package/dist/plugin/aot/rspack-loader.mjs +1 -10
- package/dist/plugin/aot/rspack.js +2 -5
- package/dist/plugin/aot/rspack.mjs +3 -6
- package/dist/plugin/aot/source.d.ts +6 -42
- package/dist/plugin/aot/source.js +71 -71
- package/dist/plugin/aot/source.mjs +72 -72
- package/dist/plugin/aot/treeshake.js +2 -6
- package/dist/plugin/aot/treeshake.mjs +2 -6
- package/dist/plugin/aot/unplugin.d.ts +1 -4
- package/dist/plugin/aot/unplugin.js +4 -13
- package/dist/plugin/aot/unplugin.mjs +4 -13
- package/dist/plugin/aot/vite.d.ts +2 -6
- package/dist/plugin/aot/worker.js +2 -2
- package/dist/plugin/aot/worker.mjs +2 -2
- package/dist/plugin/auto-head.js +1 -10
- package/dist/plugin/auto-head.mjs +1 -10
- package/dist/plugin/trace.d.ts +2 -1
- package/dist/route-table.d.ts +3 -0
- package/dist/route-table.js +16 -11
- package/dist/route-table.mjs +16 -11
- package/dist/schema-snapshot.d.ts +0 -4
- package/dist/schema-snapshot.js +32 -49
- package/dist/schema-snapshot.mjs +32 -49
- package/dist/sucrose.d.ts +6 -55
- package/dist/sucrose.js +103 -731
- package/dist/sucrose.mjs +102 -724
- package/dist/trace.d.ts +5 -8
- package/dist/trace.js +23 -134
- package/dist/trace.mjs +24 -135
- package/dist/type/bridge-live.d.ts +4 -2
- package/dist/type/bridge-live.js +6 -3
- package/dist/type/bridge-live.mjs +4 -2
- package/dist/type/bridge.d.ts +6 -4
- package/dist/type/bridge.js +17 -9
- package/dist/type/bridge.mjs +5 -3
- package/dist/type/coerce-plan.d.ts +5 -5
- package/dist/type/coerce-plan.js +41 -39
- package/dist/type/coerce-plan.mjs +43 -39
- package/dist/type/coerce.d.ts +3 -7
- package/dist/type/coerce.js +18 -75
- package/dist/type/coerce.mjs +19 -76
- package/dist/type/compat.d.ts +3 -0
- package/dist/type/compat.js +23 -14
- package/dist/type/compat.mjs +20 -10
- package/dist/type/elysia/array-buffer.d.ts +4 -1
- package/dist/type/elysia/array-buffer.js +17 -17
- package/dist/type/elysia/array-buffer.mjs +17 -17
- package/dist/type/elysia/array-string.js +2 -40
- package/dist/type/elysia/array-string.mjs +2 -39
- package/dist/type/elysia/array.js +5 -9
- package/dist/type/elysia/array.mjs +5 -9
- package/dist/type/elysia/boolean-string.js +2 -3
- package/dist/type/elysia/boolean-string.mjs +1 -1
- package/dist/type/elysia/boolean.js +3 -12
- package/dist/type/elysia/boolean.mjs +3 -11
- package/dist/type/elysia/cookie.d.ts +3 -4
- package/dist/type/elysia/cookie.js +5 -15
- package/dist/type/elysia/cookie.mjs +5 -15
- package/dist/type/elysia/date.js +13 -20
- package/dist/type/elysia/date.mjs +10 -16
- package/dist/type/elysia/file-type.d.ts +11 -4
- package/dist/type/elysia/file-type.js +17 -2
- package/dist/type/elysia/file-type.mjs +17 -3
- package/dist/type/elysia/file.d.ts +1 -3
- package/dist/type/elysia/file.js +11 -27
- package/dist/type/elysia/file.mjs +11 -12
- package/dist/type/elysia/files.js +7 -11
- package/dist/type/elysia/files.mjs +7 -10
- package/dist/type/elysia/form.js +2 -3
- package/dist/type/elysia/form.mjs +3 -3
- package/dist/type/elysia/integer-string.d.ts +1 -1
- package/dist/type/elysia/integer-string.js +4 -30
- package/dist/type/elysia/integer-string.mjs +5 -30
- package/dist/type/elysia/integer.js +3 -12
- package/dist/type/elysia/integer.mjs +3 -11
- package/dist/type/elysia/intersect.js +0 -5
- package/dist/type/elysia/intersect.mjs +0 -5
- package/dist/type/elysia/json-string.d.ts +7 -0
- package/dist/type/elysia/json-string.js +47 -0
- package/dist/type/elysia/json-string.mjs +46 -0
- package/dist/type/elysia/keep-config.d.ts +14 -0
- package/dist/type/elysia/keep-config.js +62 -0
- package/dist/type/elysia/keep-config.mjs +53 -0
- package/dist/type/elysia/maybe-empty.js +3 -4
- package/dist/type/elysia/maybe-empty.mjs +1 -1
- package/dist/type/elysia/nullable.js +2 -3
- package/dist/type/elysia/nullable.mjs +1 -1
- package/dist/type/elysia/number.d.ts +2 -1
- package/dist/type/elysia/number.js +19 -11
- package/dist/type/elysia/number.mjs +18 -10
- package/dist/type/elysia/numeric-enum.d.ts +1 -1
- package/dist/type/elysia/numeric-enum.js +4 -5
- package/dist/type/elysia/numeric-enum.mjs +3 -3
- package/dist/type/elysia/numeric.d.ts +4 -2
- package/dist/type/elysia/numeric.js +20 -17
- package/dist/type/elysia/numeric.mjs +19 -16
- package/dist/type/elysia/object-string.js +2 -37
- package/dist/type/elysia/object-string.mjs +2 -36
- package/dist/type/elysia/object.js +5 -9
- package/dist/type/elysia/object.mjs +5 -9
- package/dist/type/elysia/optional.js +8 -8
- package/dist/type/elysia/optional.mjs +7 -7
- package/dist/type/elysia/problem.d.ts +20 -0
- package/dist/type/elysia/problem.js +25 -0
- package/dist/type/elysia/problem.mjs +24 -0
- package/dist/type/elysia/string.js +4 -3
- package/dist/type/elysia/string.mjs +4 -2
- package/dist/type/elysia/uint8-array.d.ts +1 -1
- package/dist/type/elysia/uint8-array.js +5 -20
- package/dist/type/elysia/uint8-array.mjs +5 -19
- package/dist/type/elysia/union-enum.js +7 -8
- package/dist/type/elysia/union-enum.mjs +6 -6
- package/dist/type/elysia/union.js +0 -5
- package/dist/type/elysia/union.mjs +0 -5
- package/dist/type/elysia/utils.d.ts +2 -4
- package/dist/type/elysia/utils.js +10 -21
- package/dist/type/elysia/utils.mjs +7 -15
- package/dist/type/exports.d.ts +4 -2
- package/dist/type/exports.js +23 -2
- package/dist/type/exports.mjs +11 -2
- package/dist/type/index.d.ts +10 -2
- package/dist/type/index.js +62 -15
- package/dist/type/index.mjs +65 -11
- package/dist/type/shared.d.ts +3 -9
- package/dist/type/shared.js +44 -97
- package/dist/type/shared.mjs +43 -97
- package/dist/type/sync-require.d.ts +11 -0
- package/dist/type/sync-require.js +14 -0
- package/dist/type/sync-require.mjs +12 -0
- package/dist/type/typebox-system-lite.d.ts +2 -0
- package/dist/type/typebox-system-lite.js +34 -0
- package/dist/type/typebox-system-lite.mjs +3 -0
- package/dist/type/typebox-system-require.d.ts +7 -0
- package/dist/type/typebox-system-require.js +24 -0
- package/dist/type/typebox-system-require.mjs +23 -0
- package/dist/type/typebox-type-live.d.ts +11 -0
- package/dist/type/typebox-type-live.js +45 -0
- package/dist/type/typebox-type-live.mjs +20 -0
- package/dist/type/typebox-type.d.ts +34 -0
- package/dist/type/typebox-type.js +199 -0
- package/dist/type/typebox-type.mjs +86 -0
- package/dist/type/typebox-value-live.d.ts +11 -0
- package/dist/type/typebox-value-live.js +31 -0
- package/dist/type/typebox-value-live.mjs +13 -0
- package/dist/type/typebox-value-ops.d.ts +4 -0
- package/dist/type/typebox-value-ops.js +90 -0
- package/dist/type/typebox-value-ops.mjs +5 -0
- package/dist/type/typebox-value-require.d.ts +8 -0
- package/dist/type/typebox-value-require.js +28 -0
- package/dist/type/typebox-value-require.mjs +25 -0
- package/dist/type/typebox-value.d.ts +35 -0
- package/dist/type/typebox-value.js +161 -0
- package/dist/type/typebox-value.mjs +74 -0
- package/dist/type/utils.js +1 -10
- package/dist/type/utils.mjs +1 -10
- package/dist/type/validator/clean-safe.d.ts +2 -4
- package/dist/type/validator/clean-safe.js +15 -11
- package/dist/type/validator/clean-safe.mjs +16 -10
- package/dist/type/validator/custom-error.js +12 -16
- package/dist/type/validator/custom-error.mjs +11 -14
- package/dist/type/validator/default-precompute.d.ts +9 -1
- package/dist/type/validator/default-precompute.js +40 -77
- package/dist/type/validator/default-precompute.mjs +37 -74
- package/dist/type/validator/exact-mirror-live.d.ts +8 -0
- package/dist/type/validator/exact-mirror-live.js +22 -0
- package/dist/type/validator/exact-mirror-live.mjs +17 -0
- package/dist/type/validator/exact-mirror-require.d.ts +4 -0
- package/dist/type/validator/exact-mirror-require.js +11 -0
- package/dist/type/validator/exact-mirror-require.mjs +9 -0
- package/dist/type/validator/exact-mirror.js +8 -8
- package/dist/type/validator/exact-mirror.mjs +9 -8
- package/dist/type/validator/frozen-check.js +5 -6
- package/dist/type/validator/frozen-check.mjs +6 -7
- package/dist/type/validator/index.d.ts +1 -0
- package/dist/type/validator/index.js +169 -166
- package/dist/type/validator/index.mjs +162 -158
- package/dist/type/validator/string-codec-aot.d.ts +2 -1
- package/dist/type/validator/string-codec-aot.js +8 -2
- package/dist/type/validator/string-codec-aot.mjs +7 -2
- package/dist/type/validator/validator-cache.d.ts +5 -4
- package/dist/type/validator/validator-cache.js +41 -24
- package/dist/type/validator/validator-cache.mjs +40 -22
- package/dist/types.d.ts +263 -95
- package/dist/universal/constants.d.ts +2 -1
- package/dist/universal/constants.js +3 -1
- package/dist/universal/constants.mjs +2 -1
- package/dist/universal/env.js +2 -3
- package/dist/universal/env.mjs +2 -3
- package/dist/universal/file.d.ts +6 -4
- package/dist/universal/file.js +11 -16
- package/dist/universal/file.mjs +12 -16
- package/dist/universal/index.d.ts +2 -2
- package/dist/universal/is-production.d.ts +1 -2
- package/dist/universal/is-production.js +1 -3
- package/dist/universal/is-production.mjs +2 -3
- package/dist/universal/server.d.ts +0 -272
- package/dist/utils.d.ts +43 -7
- package/dist/utils.js +181 -126
- package/dist/utils.mjs +168 -126
- package/dist/validator/index.d.ts +1 -1
- package/dist/validator/index.js +17 -30
- package/dist/validator/index.mjs +18 -31
- package/dist/validator/route.js +2 -1
- package/dist/validator/route.mjs +2 -1
- package/dist/ws/context.d.ts +8 -1
- package/dist/ws/context.js +68 -44
- package/dist/ws/context.mjs +67 -44
- package/dist/ws/parser.js +10 -20
- package/dist/ws/parser.mjs +10 -20
- package/dist/ws/route.d.ts +2 -2
- package/dist/ws/route.js +249 -141
- package/dist/ws/route.mjs +254 -146
- package/dist/ws/types.d.ts +2 -2
- package/package.json +23 -49
- package/dist/compile/analysis-cache.d.ts +0 -6
- package/dist/compile/analysis-cache.js +0 -12
- package/dist/compile/analysis-cache.mjs +0 -11
- package/dist/cookie/index.d.ts +0 -7
- package/dist/cookie/index.js +0 -13
- package/dist/cookie/index.mjs +0 -7
- package/dist/handler/index.d.ts +0 -2
- package/dist/handler/index.js +0 -5
- package/dist/handler/index.mjs +0 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/universal/constants.d.ts
|
|
2
2
|
declare const isBun: boolean;
|
|
3
|
+
declare const isFastly: boolean;
|
|
3
4
|
declare const isCloudflareWorker: boolean;
|
|
4
5
|
declare const hasHeaderShorthand: boolean;
|
|
5
6
|
//#endregion
|
|
6
|
-
export { hasHeaderShorthand, isBun, isCloudflareWorker };
|
|
7
|
+
export { hasHeaderShorthand, isBun, isCloudflareWorker, isFastly };
|
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
|
|
3
3
|
//#region src/universal/constants.ts
|
|
4
4
|
const isBun = typeof Bun !== "undefined";
|
|
5
|
+
const isFastly = typeof fastly !== "undefined";
|
|
5
6
|
const isCloudflareWorker = (() => {
|
|
6
7
|
try {
|
|
7
8
|
if (typeof caches !== "undefined" && typeof caches.default !== "undefined") return true;
|
|
@@ -16,4 +17,5 @@ const hasHeaderShorthand = isBun ? "toJSON" in new Headers() : false;
|
|
|
16
17
|
//#endregion
|
|
17
18
|
exports.hasHeaderShorthand = hasHeaderShorthand;
|
|
18
19
|
exports.isBun = isBun;
|
|
19
|
-
exports.isCloudflareWorker = isCloudflareWorker;
|
|
20
|
+
exports.isCloudflareWorker = isCloudflareWorker;
|
|
21
|
+
exports.isFastly = isFastly;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
//#region src/universal/constants.ts
|
|
2
2
|
const isBun = typeof Bun !== "undefined";
|
|
3
|
+
const isFastly = typeof fastly !== "undefined";
|
|
3
4
|
const isCloudflareWorker = (() => {
|
|
4
5
|
try {
|
|
5
6
|
if (typeof caches !== "undefined" && typeof caches.default !== "undefined") return true;
|
|
@@ -12,4 +13,4 @@ const isCloudflareWorker = (() => {
|
|
|
12
13
|
const hasHeaderShorthand = isBun ? "toJSON" in new Headers() : false;
|
|
13
14
|
|
|
14
15
|
//#endregion
|
|
15
|
-
export { hasHeaderShorthand, isBun, isCloudflareWorker };
|
|
16
|
+
export { hasHeaderShorthand, isBun, isCloudflareWorker, isFastly };
|
package/dist/universal/env.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_universal_constants = require('./constants.js');
|
|
3
2
|
const require_utils = require('../utils.js');
|
|
4
3
|
|
|
5
4
|
//#region src/universal/env.ts
|
|
6
5
|
const nodeEnv = typeof process !== "undefined" && process?.env ? process.env : void 0;
|
|
7
|
-
const env =
|
|
8
|
-
const hasReadableEnv =
|
|
6
|
+
const env = nodeEnv ?? require_utils.nullObject();
|
|
7
|
+
const hasReadableEnv = nodeEnv !== void 0;
|
|
9
8
|
|
|
10
9
|
//#endregion
|
|
11
10
|
exports.env = env;
|
package/dist/universal/env.mjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { isBun } from "./constants.mjs";
|
|
2
1
|
import { nullObject } from "../utils.mjs";
|
|
3
2
|
|
|
4
3
|
//#region src/universal/env.ts
|
|
5
4
|
const nodeEnv = typeof process !== "undefined" && process?.env ? process.env : void 0;
|
|
6
|
-
const env =
|
|
7
|
-
const hasReadableEnv =
|
|
5
|
+
const env = nodeEnv ?? nullObject();
|
|
6
|
+
const hasReadableEnv = nodeEnv !== void 0;
|
|
8
7
|
|
|
9
8
|
//#endregion
|
|
10
9
|
export { env, hasReadableEnv };
|
package/dist/universal/file.d.ts
CHANGED
|
@@ -37,8 +37,6 @@ declare const mime: {
|
|
|
37
37
|
readonly ppt: "application/vnd.ms-powerpoint";
|
|
38
38
|
readonly pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
39
39
|
};
|
|
40
|
-
/** @internal exported for test/universal/file-extension.test.ts */
|
|
41
|
-
declare function getFileExtension(path: string): string;
|
|
42
40
|
/**
|
|
43
41
|
* Serve a file from a path as the response.
|
|
44
42
|
*/
|
|
@@ -47,11 +45,15 @@ declare class ElysiaFile {
|
|
|
47
45
|
#private;
|
|
48
46
|
path: string;
|
|
49
47
|
constructor(path: string);
|
|
48
|
+
/**
|
|
49
|
+
* Brand check on the private field: true for subclasses, and unlike
|
|
50
|
+
* `instanceof` it never walks the prototype chain, so no user trap runs
|
|
51
|
+
*/
|
|
52
|
+
static isElysiaFile(value: unknown): value is ElysiaFile;
|
|
50
53
|
get stats(): Promise<_$node_fs0.Stats> | undefined;
|
|
51
54
|
get value(): BunFile | _$node_fs0.ReadStream | undefined;
|
|
52
55
|
slice(start: number, end: number): BunFile | _$node_fs0.ReadStream | undefined;
|
|
53
56
|
get type(): any;
|
|
54
|
-
get length(): number | Promise<number>;
|
|
55
57
|
}
|
|
56
58
|
//#endregion
|
|
57
|
-
export { ElysiaFile, file,
|
|
59
|
+
export { ElysiaFile, file, mime };
|
package/dist/universal/file.js
CHANGED
|
@@ -41,20 +41,14 @@ const mime = {
|
|
|
41
41
|
ppt: `${application}vnd.ms-powerpoint`,
|
|
42
42
|
pptx: `${msft365}presentationml.presentation`
|
|
43
43
|
};
|
|
44
|
-
/** @internal exported for test/universal/file-extension.test.ts */
|
|
45
|
-
function getFileExtension(path) {
|
|
46
|
-
const index = path.lastIndexOf(".");
|
|
47
|
-
if (index === -1) return "";
|
|
48
|
-
return path.slice(index + 1).toLowerCase();
|
|
49
|
-
}
|
|
50
44
|
/**
|
|
51
45
|
* Serve a file from a path as the response.
|
|
52
46
|
*/
|
|
53
47
|
const file = (path) => new ElysiaFile(path);
|
|
54
48
|
let createReadStream;
|
|
55
49
|
let stat;
|
|
56
|
-
function warnMissing(
|
|
57
|
-
console.warn(/* @__PURE__ */ new Error(
|
|
50
|
+
function warnMissing() {
|
|
51
|
+
console.warn(/* @__PURE__ */ new Error("[Elysia] `file` require `fs` which is not available in this environment"));
|
|
58
52
|
}
|
|
59
53
|
var ElysiaFile = class {
|
|
60
54
|
#value;
|
|
@@ -79,6 +73,13 @@ var ElysiaFile = class {
|
|
|
79
73
|
stat = fs.promises.stat;
|
|
80
74
|
}
|
|
81
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Brand check on the private field: true for subclasses, and unlike
|
|
78
|
+
* `instanceof` it never walks the prototype chain, so no user trap runs
|
|
79
|
+
*/
|
|
80
|
+
static isElysiaFile(value) {
|
|
81
|
+
return typeof value === "object" && value !== null && #value in value;
|
|
82
|
+
}
|
|
82
83
|
get stats() {
|
|
83
84
|
if (require_universal_constants.isBun || !stat) return;
|
|
84
85
|
const value = stat(this.path);
|
|
@@ -101,13 +102,8 @@ var ElysiaFile = class {
|
|
|
101
102
|
return stream;
|
|
102
103
|
}
|
|
103
104
|
get type() {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
get length() {
|
|
107
|
-
if (require_universal_constants.isBun) return this.#value.size;
|
|
108
|
-
const value = this.stats?.then((x) => x.size);
|
|
109
|
-
value?.catch(() => {});
|
|
110
|
-
return value ?? 0;
|
|
105
|
+
const index = this.path.lastIndexOf(".");
|
|
106
|
+
return mime[index === -1 ? "" : this.path.slice(index + 1).toLowerCase()] || "application/octet-stream";
|
|
111
107
|
}
|
|
112
108
|
};
|
|
113
109
|
Object.defineProperty(ElysiaFile, "name", { value: "ElysiaFile" });
|
|
@@ -115,5 +111,4 @@ Object.defineProperty(ElysiaFile, "name", { value: "ElysiaFile" });
|
|
|
115
111
|
//#endregion
|
|
116
112
|
exports.ElysiaFile = ElysiaFile;
|
|
117
113
|
exports.file = file;
|
|
118
|
-
exports.getFileExtension = getFileExtension;
|
|
119
114
|
exports.mime = mime;
|
package/dist/universal/file.mjs
CHANGED
|
@@ -40,20 +40,14 @@ const mime = {
|
|
|
40
40
|
ppt: `${application}vnd.ms-powerpoint`,
|
|
41
41
|
pptx: `${msft365}presentationml.presentation`
|
|
42
42
|
};
|
|
43
|
-
/** @internal exported for test/universal/file-extension.test.ts */
|
|
44
|
-
function getFileExtension(path) {
|
|
45
|
-
const index = path.lastIndexOf(".");
|
|
46
|
-
if (index === -1) return "";
|
|
47
|
-
return path.slice(index + 1).toLowerCase();
|
|
48
|
-
}
|
|
49
43
|
/**
|
|
50
44
|
* Serve a file from a path as the response.
|
|
51
45
|
*/
|
|
52
46
|
const file = (path) => new ElysiaFile(path);
|
|
53
47
|
let createReadStream;
|
|
54
48
|
let stat;
|
|
55
|
-
function warnMissing(
|
|
56
|
-
console.warn(/* @__PURE__ */ new Error(
|
|
49
|
+
function warnMissing() {
|
|
50
|
+
console.warn(/* @__PURE__ */ new Error("[Elysia] `file` require `fs` which is not available in this environment"));
|
|
57
51
|
}
|
|
58
52
|
var ElysiaFile = class {
|
|
59
53
|
#value;
|
|
@@ -78,6 +72,13 @@ var ElysiaFile = class {
|
|
|
78
72
|
stat = fs.promises.stat;
|
|
79
73
|
}
|
|
80
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Brand check on the private field: true for subclasses, and unlike
|
|
77
|
+
* `instanceof` it never walks the prototype chain, so no user trap runs
|
|
78
|
+
*/
|
|
79
|
+
static isElysiaFile(value) {
|
|
80
|
+
return typeof value === "object" && value !== null && #value in value;
|
|
81
|
+
}
|
|
81
82
|
get stats() {
|
|
82
83
|
if (isBun || !stat) return;
|
|
83
84
|
const value = stat(this.path);
|
|
@@ -100,16 +101,11 @@ var ElysiaFile = class {
|
|
|
100
101
|
return stream;
|
|
101
102
|
}
|
|
102
103
|
get type() {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
get length() {
|
|
106
|
-
if (isBun) return this.#value.size;
|
|
107
|
-
const value = this.stats?.then((x) => x.size);
|
|
108
|
-
value?.catch(() => {});
|
|
109
|
-
return value ?? 0;
|
|
104
|
+
const index = this.path.lastIndexOf(".");
|
|
105
|
+
return mime[index === -1 ? "" : this.path.slice(index + 1).toLowerCase()] || "application/octet-stream";
|
|
110
106
|
}
|
|
111
107
|
};
|
|
112
108
|
Object.defineProperty(ElysiaFile, "name", { value: "ElysiaFile" });
|
|
113
109
|
|
|
114
110
|
//#endregion
|
|
115
|
-
export { ElysiaFile, file,
|
|
111
|
+
export { ElysiaFile, file, mime };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { isProduction } from "./is-production.js";
|
|
2
|
+
import { ErrorLike, GenericServeOptions, ListenCallback, Serve, ServeOptions, Server, ServerWebSocketSendStatus, SocketAddress } from "./server.js";
|
|
1
3
|
import { file } from "./file.js";
|
|
2
4
|
import { env } from "./env.js";
|
|
3
|
-
import { ErrorLike, GenericServeOptions, ListenCallback, Serve, ServeOptions, Server, ServerWebSocketSendStatus, SocketAddress } from "./server.js";
|
|
4
|
-
import { isProduction } from "./is-production.js";
|
|
5
5
|
export { type ErrorLike, type GenericServeOptions, type ListenCallback, type Serve, type ServeOptions, type Server, type ServerWebSocketSendStatus, type SocketAddress, env, file, isProduction };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
//#region src/universal/is-production.d.ts
|
|
2
|
-
declare const computeIsProduction: (readable: boolean, nodeEnv?: string, elysiaEnv?: string) => boolean;
|
|
3
2
|
declare const isProduction: () => boolean;
|
|
4
3
|
//#endregion
|
|
5
|
-
export {
|
|
4
|
+
export { isProduction };
|
|
@@ -2,9 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_universal_env = require('./env.js');
|
|
3
3
|
|
|
4
4
|
//#region src/universal/is-production.ts
|
|
5
|
-
const
|
|
6
|
-
const isProduction = () => computeIsProduction(require_universal_env.hasReadableEnv, require_universal_env.env.NODE_ENV, require_universal_env.env.ENV);
|
|
5
|
+
const isProduction = () => !require_universal_env.hasReadableEnv || (require_universal_env.env.NODE_ENV ?? require_universal_env.env.ENV) === "production";
|
|
7
6
|
|
|
8
7
|
//#endregion
|
|
9
|
-
exports.computeIsProduction = computeIsProduction;
|
|
10
8
|
exports.isProduction = isProduction;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { env, hasReadableEnv } from "./env.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/universal/is-production.ts
|
|
4
|
-
const
|
|
5
|
-
const isProduction = () => computeIsProduction(hasReadableEnv, env.NODE_ENV, env.ENV);
|
|
4
|
+
const isProduction = () => !hasReadableEnv || (env.NODE_ENV ?? env.ENV) === "production";
|
|
6
5
|
|
|
7
6
|
//#endregion
|
|
8
|
-
export {
|
|
7
|
+
export { isProduction };
|
|
@@ -8,96 +8,16 @@ interface ErrorLike extends Error {
|
|
|
8
8
|
syscall?: string;
|
|
9
9
|
}
|
|
10
10
|
interface GenericServeOptions {
|
|
11
|
-
/**
|
|
12
|
-
* What URI should be used to make {@link Request.url} absolute?
|
|
13
|
-
*
|
|
14
|
-
* By default, looks at {@link hostname}, {@link port}, and whether or not SSL is enabled to generate one
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```js
|
|
18
|
-
* "http://my-app.com"
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```js
|
|
23
|
-
* "https://wongmjane.com/"
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* This should be the public, absolute URL – include the protocol and {@link hostname}. If the port isn't 80 or 443, then include the {@link port} too.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* "http://localhost:3000"
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* What is the maximum size of a request body? (in bytes)
|
|
33
|
-
*
|
|
34
|
-
* @default 1024 * 1024 * 128 // 128MB
|
|
35
|
-
*/
|
|
36
11
|
maxRequestBodySize?: number;
|
|
37
|
-
/**
|
|
38
|
-
* Render contextual errors? This enables bun's error page
|
|
39
|
-
* @default process.env.NODE_ENV !== 'production'
|
|
40
|
-
*/
|
|
41
12
|
development?: boolean;
|
|
42
13
|
error?: (this: Server, request: ErrorLike) => Response | Promise<Response> | undefined | Promise<undefined>;
|
|
43
|
-
/**
|
|
44
|
-
* Uniquely identify a server instance with an ID
|
|
45
|
-
*
|
|
46
|
-
* ### When bun is started with the `--hot` flag
|
|
47
|
-
*
|
|
48
|
-
* This string will be used to hot reload the server without interrupting
|
|
49
|
-
* pending requests or websockets. If not provided, a value will be
|
|
50
|
-
* generated. To disable hot reloading, set this value to `null`.
|
|
51
|
-
*
|
|
52
|
-
* ### When bun is not started with the `--hot` flag
|
|
53
|
-
*
|
|
54
|
-
* This string will currently do nothing. But in the future it could be useful for logs or metrics.
|
|
55
|
-
*/
|
|
56
14
|
id?: string | null;
|
|
57
15
|
}
|
|
58
16
|
interface ServeOptions extends GenericServeOptions {
|
|
59
|
-
/**
|
|
60
|
-
* What port should the server listen on?
|
|
61
|
-
* @default process.env.PORT || "3000"
|
|
62
|
-
*/
|
|
63
17
|
port?: string | number;
|
|
64
|
-
/**
|
|
65
|
-
* If the `SO_REUSEPORT` flag should be set.
|
|
66
|
-
*
|
|
67
|
-
* This allows multiple processes to bind to the same port, which is useful for load balancing.
|
|
68
|
-
*
|
|
69
|
-
* @default false
|
|
70
|
-
*/
|
|
71
18
|
reusePort?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* What hostname should the server listen on?
|
|
74
|
-
*
|
|
75
|
-
* @default
|
|
76
|
-
* ```js
|
|
77
|
-
* "0.0.0.0" // listen on all interfaces
|
|
78
|
-
* ```
|
|
79
|
-
* @example
|
|
80
|
-
* ```js
|
|
81
|
-
* "127.0.0.1" // Only listen locally
|
|
82
|
-
* ```
|
|
83
|
-
* @example
|
|
84
|
-
* ```js
|
|
85
|
-
* "remix.run" // Only listen on remix.run
|
|
86
|
-
* ````
|
|
87
|
-
*
|
|
88
|
-
* note: hostname should not include a {@link port}
|
|
89
|
-
*/
|
|
90
19
|
hostname?: string;
|
|
91
|
-
/**
|
|
92
|
-
* If set, the HTTP server will listen on a unix socket instead of a port.
|
|
93
|
-
* (Cannot be used with hostname+port)
|
|
94
|
-
*/
|
|
95
20
|
unix?: never;
|
|
96
|
-
/**
|
|
97
|
-
* Handle HTTP requests
|
|
98
|
-
*
|
|
99
|
-
* Respond to {@link Request} objects with a {@link Response} object.
|
|
100
|
-
*/
|
|
101
21
|
fetch(this: Server, request: Request, server: Server): Response | Promise<Response>;
|
|
102
22
|
routes: Record<string, Function | Response | Record<string, Function | Response>>;
|
|
103
23
|
}
|
|
@@ -105,221 +25,29 @@ type Serve = Equal<Serve$1.Options<unknown>, unknown> extends false ? Serve$1.Op
|
|
|
105
25
|
type Server = Equal<Server$1<unknown>, unknown> extends false ? Server$1<unknown> : ServerOptions;
|
|
106
26
|
type ServerWebSocketSendStatus = number;
|
|
107
27
|
interface SocketAddress {
|
|
108
|
-
/**
|
|
109
|
-
* The IP address of the client.
|
|
110
|
-
*/
|
|
111
28
|
address: string;
|
|
112
|
-
/**
|
|
113
|
-
* The port of the client.
|
|
114
|
-
*/
|
|
115
29
|
port: number;
|
|
116
|
-
/**
|
|
117
|
-
* The IP family ("IPv4" or "IPv6").
|
|
118
|
-
*/
|
|
119
30
|
family: 'IPv4' | 'IPv6';
|
|
120
31
|
}
|
|
121
32
|
interface ServerOptions extends Disposable {
|
|
122
|
-
/**
|
|
123
|
-
* Stop listening to prevent new connections from being accepted.
|
|
124
|
-
*
|
|
125
|
-
* By default, it does not cancel in-flight requests or websockets. That means it may take some time before all network activity stops.
|
|
126
|
-
*
|
|
127
|
-
* @param closeActiveConnections Immediately terminate in-flight requests, websockets, and stop accepting new connections.
|
|
128
|
-
* @default false
|
|
129
|
-
*/
|
|
130
33
|
stop(closeActiveConnections?: boolean): void;
|
|
131
|
-
/**
|
|
132
|
-
* Update the `fetch` and `error` handlers without restarting the server.
|
|
133
|
-
*
|
|
134
|
-
* This is useful if you want to change the behavior of your server without
|
|
135
|
-
* restarting it or for hot reloading.
|
|
136
|
-
*
|
|
137
|
-
* @example
|
|
138
|
-
*
|
|
139
|
-
* ```js
|
|
140
|
-
* // create the server
|
|
141
|
-
* const server = Bun.serve({
|
|
142
|
-
* fetch(request) {
|
|
143
|
-
* return new Response("Hello World v1")
|
|
144
|
-
* }
|
|
145
|
-
* });
|
|
146
|
-
*
|
|
147
|
-
* // Update the server to return a different response
|
|
148
|
-
* server.reload({
|
|
149
|
-
* fetch(request) {
|
|
150
|
-
* return new Response("Hello World v2")
|
|
151
|
-
* }
|
|
152
|
-
* });
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* Passing other options such as `port` or `hostname` won't do anything.
|
|
156
|
-
*/
|
|
157
34
|
reload(options: Serve): void;
|
|
158
|
-
/**
|
|
159
|
-
* Mock the fetch handler for a running server.
|
|
160
|
-
*
|
|
161
|
-
* This feature is not fully implemented yet. It doesn't normalize URLs
|
|
162
|
-
* consistently in all cases and it doesn't yet call the `error` handler
|
|
163
|
-
* consistently. This needs to be fixed
|
|
164
|
-
*/
|
|
165
35
|
fetch(request: Request | string): Response | Promise<Response>;
|
|
166
|
-
/**
|
|
167
|
-
* Upgrade a {@link Request} to a {@link ServerWebSocket}
|
|
168
|
-
*
|
|
169
|
-
* @param request The {@link Request} to upgrade
|
|
170
|
-
* @param options Pass headers or attach data to the {@link ServerWebSocket}
|
|
171
|
-
*
|
|
172
|
-
* @returns `true` if the upgrade was successful and `false` if it failed
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* ```js
|
|
176
|
-
* import { serve } from "bun";
|
|
177
|
-
* serve({
|
|
178
|
-
* websocket: {
|
|
179
|
-
* open: (ws) => {
|
|
180
|
-
* console.log("Client connected");
|
|
181
|
-
* },
|
|
182
|
-
* message: (ws, message) => {
|
|
183
|
-
* console.log("Client sent message", message);
|
|
184
|
-
* },
|
|
185
|
-
* close: (ws) => {
|
|
186
|
-
* console.log("Client disconnected");
|
|
187
|
-
* },
|
|
188
|
-
* },
|
|
189
|
-
* fetch(req, server) {
|
|
190
|
-
* const url = new URL(req.url);
|
|
191
|
-
* if (url.pathname === "/chat") {
|
|
192
|
-
* const upgraded = server.upgrade(req);
|
|
193
|
-
* if (!upgraded) {
|
|
194
|
-
* return new Response("Upgrade failed", { status: 400 });
|
|
195
|
-
* }
|
|
196
|
-
* }
|
|
197
|
-
* return new Response("Hello World");
|
|
198
|
-
* },
|
|
199
|
-
* });
|
|
200
|
-
* ```
|
|
201
|
-
* What you pass to `data` is available on the {@link ServerWebSocket.data} property
|
|
202
|
-
*/
|
|
203
36
|
upgrade<T = undefined>(request: Request, options?: {
|
|
204
|
-
/**
|
|
205
|
-
* Send any additional headers while upgrading, like cookies
|
|
206
|
-
*/
|
|
207
37
|
headers?: Bun.HeadersInit;
|
|
208
|
-
/**
|
|
209
|
-
* This value is passed to the {@link ServerWebSocket.data} property
|
|
210
|
-
*/
|
|
211
38
|
data?: T;
|
|
212
39
|
}): boolean;
|
|
213
|
-
/**
|
|
214
|
-
* Send a message to all connected {@link ServerWebSocket} subscribed to a topic
|
|
215
|
-
*
|
|
216
|
-
* @param topic The topic to publish to
|
|
217
|
-
* @param data The data to send
|
|
218
|
-
* @param compress Should the data be compressed? Ignored if the client does not support compression.
|
|
219
|
-
*
|
|
220
|
-
* @returns 0 if the message was dropped, -1 if backpressure was applied, or the number of bytes sent.
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
*
|
|
224
|
-
* ```js
|
|
225
|
-
* server.publish("chat", "Hello World");
|
|
226
|
-
* ```
|
|
227
|
-
*
|
|
228
|
-
* @example
|
|
229
|
-
* ```js
|
|
230
|
-
* server.publish("chat", new Uint8Array([1, 2, 3, 4]));
|
|
231
|
-
* ```
|
|
232
|
-
*
|
|
233
|
-
* @example
|
|
234
|
-
* ```js
|
|
235
|
-
* server.publish("chat", new ArrayBuffer(4), true);
|
|
236
|
-
* ```
|
|
237
|
-
*
|
|
238
|
-
* @example
|
|
239
|
-
* ```js
|
|
240
|
-
* server.publish("chat", new DataView(new ArrayBuffer(4)));
|
|
241
|
-
* ```
|
|
242
|
-
*/
|
|
243
40
|
publish(topic: string, data: string | ArrayBufferView | ArrayBuffer | SharedArrayBuffer, compress?: boolean): ServerWebSocketSendStatus;
|
|
244
|
-
/**
|
|
245
|
-
* Returns the client IP address and port of the given Request. If the request was closed or is a unix socket, returns null.
|
|
246
|
-
*
|
|
247
|
-
* @example
|
|
248
|
-
* ```js
|
|
249
|
-
* export default {
|
|
250
|
-
* async fetch(request, server) {
|
|
251
|
-
* return new Response(server.requestIP(request));
|
|
252
|
-
* }
|
|
253
|
-
* }
|
|
254
|
-
* ```
|
|
255
|
-
*/
|
|
256
41
|
requestIP(request: Request): SocketAddress | null;
|
|
257
|
-
/**
|
|
258
|
-
* Reset the idleTimeout of the given Request to the number in seconds. 0 means no timeout.
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* ```js
|
|
262
|
-
* export default {
|
|
263
|
-
* async fetch(request, server) {
|
|
264
|
-
* server.timeout(request, 60);
|
|
265
|
-
* await Bun.sleep(30000);
|
|
266
|
-
* return new Response("30 seconds have passed");
|
|
267
|
-
* }
|
|
268
|
-
* }
|
|
269
|
-
* ```
|
|
270
|
-
*/
|
|
271
42
|
timeout(request: Request, seconds: number): void;
|
|
272
|
-
/**
|
|
273
|
-
* Undo a call to {@link Server.unref}
|
|
274
|
-
*
|
|
275
|
-
* If the Server has already been stopped, this does nothing.
|
|
276
|
-
*
|
|
277
|
-
* If {@link Server.ref} is called multiple times, this does nothing. Think of it as a boolean toggle.
|
|
278
|
-
*/
|
|
279
43
|
ref(): void;
|
|
280
|
-
/**
|
|
281
|
-
* Don't keep the process alive if this server is the only thing left.
|
|
282
|
-
* Active connections may continue to keep the process alive.
|
|
283
|
-
*
|
|
284
|
-
* By default, the server is ref'd.
|
|
285
|
-
*
|
|
286
|
-
* To prevent new connections from being accepted, use {@link Server.stop}
|
|
287
|
-
*/
|
|
288
44
|
unref(): void;
|
|
289
|
-
/**
|
|
290
|
-
* How many requests are in-flight right now?
|
|
291
|
-
*/
|
|
292
45
|
readonly pendingRequests: number;
|
|
293
|
-
/**
|
|
294
|
-
* How many {@link ServerWebSocket}s are in-flight right now?
|
|
295
|
-
*/
|
|
296
46
|
readonly pendingWebSockets: number;
|
|
297
47
|
readonly url: URL;
|
|
298
48
|
readonly port: number;
|
|
299
|
-
/**
|
|
300
|
-
* The hostname the server is listening on. Does not include the port
|
|
301
|
-
* @example
|
|
302
|
-
* ```js
|
|
303
|
-
* "localhost"
|
|
304
|
-
* ```
|
|
305
|
-
*/
|
|
306
49
|
readonly hostname: string;
|
|
307
|
-
/**
|
|
308
|
-
* Is the server running in development mode?
|
|
309
|
-
*
|
|
310
|
-
* In development mode, `Bun.serve()` returns rendered error messages with
|
|
311
|
-
* stack traces instead of a generic 500 error. This makes debugging easier,
|
|
312
|
-
* but development mode shouldn't be used in production or you will risk
|
|
313
|
-
* leaking sensitive information.
|
|
314
|
-
*/
|
|
315
50
|
readonly development: boolean;
|
|
316
|
-
/**
|
|
317
|
-
* An identifier of the server instance
|
|
318
|
-
*
|
|
319
|
-
* When bun is started with the `--hot` flag, this ID is used to hot reload the server without interrupting pending requests or websockets.
|
|
320
|
-
*
|
|
321
|
-
* When bun is not started with the `--hot` flag, this ID is currently unused.
|
|
322
|
-
*/
|
|
323
51
|
readonly id: string;
|
|
324
52
|
}
|
|
325
53
|
type ListenCallback = (server: Server) => MaybePromise<void>;
|