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
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { BaseCookie, CookieOptions } from "./cookie/types.js";
|
|
2
|
-
import { Cookie } from "./cookie/cookie.js";
|
|
3
|
-
import { ElysiaFile, file } from "./universal/file.js";
|
|
4
|
-
import { StatusMap, StatusMapBack } from "./constants.js";
|
|
5
|
-
import { env } from "./universal/env.js";
|
|
6
|
-
import { Server } from "./universal/server.js";
|
|
7
|
-
import { bytes, form, prefix, redirect, sse } from "./utils.js";
|
|
8
|
-
import { HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, RouteSchema, SSEPayload, UnwrapRoute, UnwrapSchema } from "./types.js";
|
|
9
|
-
import { ElysiaError, ElysiaStatus, HTTPError, InternalServerError, NotFound, ParseError, Problem, SelectiveStatus, TaggedHTTPError, ValidationError, problem, status, validationDetail } from "./error.js";
|
|
10
|
-
import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
|
|
11
|
-
import { InvalidCookie } from "./cookie/error.js";
|
|
12
2
|
import { AnySchema, BaseSchema, StandardJSONSchemaV1Like, StandardSchemaV1Like } from "./type/types.js";
|
|
13
3
|
import { TCookieField, TCookieObject } from "./type/elysia/cookie.js";
|
|
14
|
-
import { FileTypeDetector, fileType, setFileTypeDetector } from "./type/elysia/file-type.js";
|
|
15
4
|
import { TFiles } from "./type/elysia/files.js";
|
|
5
|
+
import { StatusMap, StatusMapBack } from "./constants.js";
|
|
6
|
+
import { ElysiaError, ElysiaStatus, HTTPError, InternalServerError, NotFound, NumericStatus, ParseError, Problem, SelectiveProblem, SelectiveStatus, StatusResponse, TaggedHTTPError, ValidationError, ValidationErrorResponse, problem, status, validationDetail } from "./error.js";
|
|
7
|
+
import { bytes, form, prefix, redirect, sse } from "./utils.js";
|
|
8
|
+
import { Server } from "./universal/server.js";
|
|
9
|
+
import { Cookie } from "./cookie/cookie.js";
|
|
10
|
+
import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
|
|
11
|
+
import { ElysiaFile, file } from "./universal/file.js";
|
|
12
|
+
import { env } from "./universal/env.js";
|
|
13
|
+
import { DefaultEphemeral, DefaultMetadata, DefaultSingleton, HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, MacroTypeLambda, RouteSchema, SSEPayload, UnwrapModels, UnwrapRoute, UnwrapSchema } from "./types.js";
|
|
16
14
|
import { setupTypebox } from "./type/compat.js";
|
|
15
|
+
import { FileTypeDetector, fileType, setFileTypeDetector } from "./type/elysia/file-type.js";
|
|
17
16
|
import { MultiValidator, StandardValidator, Validator } from "./validator/index.js";
|
|
18
17
|
import { TypeBoxValidator } from "./type/validator/index.js";
|
|
19
18
|
import { TypeSystem, t } from "./type/index.js";
|
|
20
19
|
import { AotFingerprint, Capture, Compiled, CompilerSession, ProgramId } from "./compile/aot.js";
|
|
21
20
|
import { AnyElysia, Elysia } from "./base.js";
|
|
22
21
|
import { borrow } from "./adapter/response-ownership.js";
|
|
23
|
-
|
|
22
|
+
import { InvalidCookie } from "./cookie/error.js";
|
|
23
|
+
export { AnyElysia, type AnySchema, type AotFingerprint, type BaseCookie, type BaseSchema, Compiled, type CompilerSession, type Context, type Cookie, type CookieOptions, type DefaultEphemeral, type DefaultMetadata, type DefaultSingleton, Elysia, Elysia as default, ElysiaError, ElysiaFile, ElysiaStatus, type ErrorContext, type FileTypeDetector, HTTPError, type HTTPHeaders, type InputSchema, InternalServerError, InvalidCookie, type Macro, type MacroToContext, type MacroToProperty, type MacroTypeLambda, Capture as Manifest, MultiValidator, NotFound, type NumericStatus, ParseError, type Problem, type ProgramId, type RouteSchema, type SSEPayload, type SelectiveProblem, type SelectiveStatus, type Server, type StandardJSONSchemaV1Like, type StandardSchemaV1Like, StandardValidator, StatusMap, StatusMapBack, type StatusResponse, type TCookieField, type TCookieObject, type TFiles, type TaggedHTTPError, TypeBoxValidator, TypeSystem, type UnwrapModels, type UnwrapRoute, type UnwrapSchema, ValidationError, type ValidationErrorResponse, Validator, borrow, bytes, createBaseContext, createContext, env, file, fileType, form, prefix, problem, redirect, setFileTypeDetector, setupTypebox, sse, status, t, validationDetail };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.js');
|
|
3
2
|
const require_constants = require('./constants.js');
|
|
4
3
|
const require_universal_file = require('./universal/file.js');
|
|
5
4
|
const require_utils = require('./utils.js');
|
|
@@ -8,14 +7,13 @@ const require_error = require('./error.js');
|
|
|
8
7
|
const require_cookie_error = require('./cookie/error.js');
|
|
9
8
|
const require_adapter_response_ownership = require('./adapter/response-ownership.js');
|
|
10
9
|
const require_compile_aot = require('./compile/aot.js');
|
|
11
|
-
const require_type_elysia_file_type = require('./type/elysia/file-type.js');
|
|
12
10
|
const require_validator_index = require('./validator/index.js');
|
|
13
11
|
const require_context = require('./context.js');
|
|
14
12
|
const require_base = require('./base.js');
|
|
13
|
+
const require_type_elysia_file_type = require('./type/elysia/file-type.js');
|
|
15
14
|
const require_type_validator_index = require('./type/validator/index.js');
|
|
16
15
|
const require_type_compat = require('./type/compat.js');
|
|
17
16
|
const require_type_index = require('./type/index.js');
|
|
18
|
-
let typebox_system = require("typebox/system");
|
|
19
17
|
|
|
20
18
|
//#region src/index.ts
|
|
21
19
|
var src_default = require_base.Elysia;
|
|
@@ -37,12 +35,7 @@ exports.StandardValidator = require_validator_index.StandardValidator;
|
|
|
37
35
|
exports.StatusMap = require_constants.StatusMap;
|
|
38
36
|
exports.StatusMapBack = require_constants.StatusMapBack;
|
|
39
37
|
exports.TypeBoxValidator = require_type_validator_index.TypeBoxValidator;
|
|
40
|
-
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () {
|
|
43
|
-
return typebox_system.System;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
38
|
+
exports.TypeSystem = require_type_index.TypeSystem;
|
|
46
39
|
exports.ValidationError = require_error.ValidationError;
|
|
47
40
|
exports.Validator = require_validator_index.Validator;
|
|
48
41
|
exports.borrow = require_adapter_response_ownership.borrow;
|
package/dist/index.mjs
CHANGED
|
@@ -6,10 +6,10 @@ import { ElysiaError, ElysiaStatus, HTTPError, InternalServerError, NotFound, Pa
|
|
|
6
6
|
import { InvalidCookie } from "./cookie/error.mjs";
|
|
7
7
|
import { borrow } from "./adapter/response-ownership.mjs";
|
|
8
8
|
import { Capture, Compiled } from "./compile/aot.mjs";
|
|
9
|
-
import { fileType, setFileTypeDetector } from "./type/elysia/file-type.mjs";
|
|
10
9
|
import { MultiValidator, StandardValidator, Validator } from "./validator/index.mjs";
|
|
11
10
|
import { createBaseContext, createContext } from "./context.mjs";
|
|
12
11
|
import { Elysia } from "./base.mjs";
|
|
12
|
+
import { fileType, setFileTypeDetector } from "./type/elysia/file-type.mjs";
|
|
13
13
|
import { TypeBoxValidator } from "./type/validator/index.mjs";
|
|
14
14
|
import { setupTypebox } from "./type/compat.mjs";
|
|
15
15
|
import { TypeSystem, t } from "./type/index.mjs";
|
package/dist/memory.js
CHANGED
|
@@ -6,7 +6,7 @@ const require_context = require('./context.js');
|
|
|
6
6
|
|
|
7
7
|
//#region src/memory.ts
|
|
8
8
|
function flushMemory() {
|
|
9
|
-
require_sucrose.clearSucroseCache(
|
|
9
|
+
require_sucrose.clearSucroseCache();
|
|
10
10
|
require_context.clearContextCache();
|
|
11
11
|
require_validator_index.Validator.clear();
|
|
12
12
|
if (require_universal_constants.isBun) Bun.gc();
|
package/dist/memory.mjs
CHANGED
package/dist/package.js
CHANGED
package/dist/package.mjs
CHANGED
package/dist/plugin/aot/bun.d.ts
CHANGED
|
@@ -20,7 +20,14 @@ import { BunPlugin } from "bun";
|
|
|
20
20
|
*
|
|
21
21
|
* process.exit(0)
|
|
22
22
|
* ```
|
|
23
|
+
*
|
|
24
|
+
* Skip precompilation and only wire TypeBox statically for a faster plain bundle.
|
|
25
|
+
* `TypeSystem.Locale` stays opt-in, as in a plain bundle.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* plugins: [aot()]
|
|
29
|
+
* ```
|
|
23
30
|
*/
|
|
24
|
-
declare const aot: (entry
|
|
31
|
+
declare const aot: (entry?: string, options?: ElysiaAotOptions) => BunPlugin;
|
|
25
32
|
//#endregion
|
|
26
33
|
export { aot };
|
package/dist/plugin/aot/bun.js
CHANGED
|
@@ -20,16 +20,23 @@ const require_plugin_aot_hooks = require('./hooks.js');
|
|
|
20
20
|
*
|
|
21
21
|
* process.exit(0)
|
|
22
22
|
* ```
|
|
23
|
+
*
|
|
24
|
+
* Skip precompilation and only wire TypeBox statically for a faster plain bundle.
|
|
25
|
+
* `TypeSystem.Locale` stays opt-in, as in a plain bundle.
|
|
26
|
+
*
|
|
27
|
+
* ```ts
|
|
28
|
+
* plugins: [aot()]
|
|
29
|
+
* ```
|
|
23
30
|
*/
|
|
24
|
-
const aot = (entry, options) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
31
|
+
const aot = (entry, options) => {
|
|
32
|
+
if (entry === void 0 && options !== void 0) throw new Error("[elysia-aot] options require an entry");
|
|
33
|
+
return {
|
|
34
|
+
name: "elysia-aot",
|
|
35
|
+
async setup(build) {
|
|
36
|
+
await require_plugin_aot_hooks.setupAotOnLoad(build, entry === void 0 ? require_plugin_aot_hooks.createTypeboxWiringHooks() : require_plugin_aot_hooks.createAotPluginHooks(entry, options), (path) => Bun.file(path).text());
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
33
40
|
|
|
34
41
|
//#endregion
|
|
35
42
|
exports.aot = aot;
|
package/dist/plugin/aot/bun.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createAotPluginHooks, setupAotOnLoad } from "./hooks.mjs";
|
|
1
|
+
import { createAotPluginHooks, createTypeboxWiringHooks, setupAotOnLoad } from "./hooks.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugin/aot/bun.ts
|
|
4
4
|
/**
|
|
@@ -19,16 +19,23 @@ import { createAotPluginHooks, setupAotOnLoad } from "./hooks.mjs";
|
|
|
19
19
|
*
|
|
20
20
|
* process.exit(0)
|
|
21
21
|
* ```
|
|
22
|
+
*
|
|
23
|
+
* Skip precompilation and only wire TypeBox statically for a faster plain bundle.
|
|
24
|
+
* `TypeSystem.Locale` stays opt-in, as in a plain bundle.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* plugins: [aot()]
|
|
28
|
+
* ```
|
|
22
29
|
*/
|
|
23
|
-
const aot = (entry, options) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
30
|
+
const aot = (entry, options) => {
|
|
31
|
+
if (entry === void 0 && options !== void 0) throw new Error("[elysia-aot] options require an entry");
|
|
32
|
+
return {
|
|
33
|
+
name: "elysia-aot",
|
|
34
|
+
async setup(build) {
|
|
35
|
+
await setupAotOnLoad(build, entry === void 0 ? createTypeboxWiringHooks() : createAotPluginHooks(entry, options), (path) => Bun.file(path).text());
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
};
|
|
32
39
|
|
|
33
40
|
//#endregion
|
|
34
41
|
export { aot };
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { CapturedValidator } from "../../compile/aot.js";
|
|
1
2
|
import { JITProbeResult } from "../../compile/jit-probe.js";
|
|
2
|
-
import { AotTarget } from "./source.js";
|
|
3
|
+
import { AotModuleCondition, AotTarget } from "./source.js";
|
|
3
4
|
|
|
4
5
|
//#region src/plugin/aot/core.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A route that differs from the build compiles live with a warning, or fails
|
|
8
|
+
* when the JIT is stripped. A conditional hook must change the hook list
|
|
9
|
+
* (`isProd ? [auth] : []`), not swap functions. Keep `async` native
|
|
10
|
+
*/
|
|
5
11
|
interface ElysiaAotOptions {
|
|
6
12
|
/**
|
|
7
13
|
* Specifier the generated module imports `Compiled` from
|
|
@@ -93,10 +99,14 @@ interface ElysiaAotOptions {
|
|
|
93
99
|
verbose?: boolean;
|
|
94
100
|
}
|
|
95
101
|
declare const resolveEntry: (entry: string) => string;
|
|
102
|
+
/** @internal Resolve the package condition used to evaluate an AOT entry. */
|
|
103
|
+
declare const resolveEntryModuleKind: (entry: string) => "esm" | "cjs";
|
|
96
104
|
/** Runtime handler-JIT module a strip build can replace with a throwing stub. */
|
|
97
105
|
interface StubPlan {
|
|
98
106
|
/** Stub the internal handler codegen module. */
|
|
99
107
|
jit: boolean;
|
|
108
|
+
/** Omit the static-clone resolver when no captured handler aliases scl. */
|
|
109
|
+
staticClone: boolean;
|
|
100
110
|
/** Stub internal WS route builders when the app declares no WS routes. */
|
|
101
111
|
ws: boolean;
|
|
102
112
|
/**
|
|
@@ -118,18 +128,8 @@ interface StubPlan {
|
|
|
118
128
|
* codegen, frozen reconstruct) only calls in when trace handlers exist, so
|
|
119
129
|
* a throwing stub is unreachable once detection proves trace is unused
|
|
120
130
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* is registered and `dist/trace.mjs` IS in the bundle graph via
|
|
124
|
-
* `dist/plugin/trace.mjs`) but never attaches `.trace(fn)` (no trace
|
|
125
|
-
* hooks, so `tr` is unaliased and `mayTrace` is false). Under the frozen
|
|
126
|
-
* path (`jit`) this flag is still `true`, so the stub replaces the real
|
|
127
|
-
* trace module with the non-throwing `unionTracePhases(){return new Set()}`
|
|
128
|
-
* fallback (+ throwing `createTracer`, unreachable with zero hooks).
|
|
129
|
-
* Measured saving for that shape: ~18KB severing trace also tree-shakes
|
|
130
|
-
* sucrose's `separateFunction`, which trace is the sole importer of. A
|
|
131
|
-
* traceless app that never imports the capability (Fixture B) has no
|
|
132
|
-
* trace module in the graph, so the stub is a no-op there.
|
|
131
|
+
* Also applies when `.use(trace())` is registered but no `.trace(fn)`
|
|
132
|
+
* exists: `unionTracePhases` stays a non-throwing `new Set()`
|
|
133
133
|
*/
|
|
134
134
|
trace: boolean;
|
|
135
135
|
/**
|
|
@@ -137,7 +137,7 @@ interface StubPlan {
|
|
|
137
137
|
* stubbed. Sucrose never runs in a precompiled app, so its caches are always
|
|
138
138
|
* empty and the flush is a no-op. Dropping the import lets the Sucrose
|
|
139
139
|
* analyzer tree-shake. `flushMemory`'s other clears are preserved, and the
|
|
140
|
-
*
|
|
140
|
+
* `sucrose` module itself is not stubbed
|
|
141
141
|
*/
|
|
142
142
|
sucrose: boolean;
|
|
143
143
|
/**
|
|
@@ -156,6 +156,23 @@ interface StubPlan {
|
|
|
156
156
|
* least one validator that is not bridge-free, so the bridge is still needed
|
|
157
157
|
*/
|
|
158
158
|
bridge: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Re-route `type/typebox-value` -> its statically-imported `-live` mirror
|
|
161
|
+
* (bundlers can't follow the runtime `require`)
|
|
162
|
+
* Every mode except sealed, there the unresolvable `require` is what lets TypeBox collapse
|
|
163
|
+
*/
|
|
164
|
+
typeboxValue: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Re-route `type/validator/exact-mirror` -> its statically-imported `-live`
|
|
167
|
+
* mirror so the bundler embeds `exact-mirror` instead of leaving the runtime
|
|
168
|
+
* `require('exact-mirror')` unresolvable, which is what breaks normalization
|
|
169
|
+
* and sanitize inside a compiled binary
|
|
170
|
+
*
|
|
171
|
+
* Set whenever `exact-mirror` resolves at build time, except in sealed mode:
|
|
172
|
+
* there every mirror is emitted into the manifest, so wiring it would only
|
|
173
|
+
* add ~15KB of dead code to the bundle the mode exists to shrink
|
|
174
|
+
*/
|
|
175
|
+
exactMirror: boolean;
|
|
159
176
|
/**
|
|
160
177
|
* Replace `adapter/constants` with a target-specific stub that hard-selects
|
|
161
178
|
* either `BunAdapter` or `WebStandardAdapter`, letting the bundler DCE the
|
|
@@ -202,52 +219,29 @@ declare const NO_STUB: StubPlan;
|
|
|
202
219
|
* is not active, so the bridge must stay wired the ordinary way. No compat
|
|
203
220
|
* stub, no reroute.
|
|
204
221
|
*/
|
|
205
|
-
declare function planFromReport(strip: boolean | 'auto', report: JITProbeResult, hasWS: boolean, mayTrace: boolean, aliases: Set<string>, allBridgeFree: boolean, zeroCapture: boolean, adapterStub?: 'bun' | 'web-standard' | false, productionStub?: boolean
|
|
222
|
+
declare function planFromReport(strip: boolean | 'auto', report: JITProbeResult, hasWS: boolean, mayTrace: boolean, aliases: Set<string>, allBridgeFree: boolean, zeroCapture: boolean, adapterStub?: 'bun' | 'web-standard' | false, productionStub?: boolean,
|
|
223
|
+
/**
|
|
224
|
+
* A WS route declares a `cookie` schema. Its upgrade path handles cookies
|
|
225
|
+
* outside the handler JIT, so it emits no `cc` alias — stubbing on that
|
|
226
|
+
* alias alone would hand `src/ws/route.ts` a throwing `parseCookieRaw`
|
|
227
|
+
*/
|
|
228
|
+
wsCookie?: boolean, /** `exact-mirror` resolves from the elysia package at build time. */exactMirror?: boolean): {
|
|
206
229
|
plan: StubPlan;
|
|
207
230
|
mode: BridgeMode;
|
|
208
231
|
};
|
|
209
232
|
declare function adapterConstantsSource(target: 'bun' | 'web-standard'): string;
|
|
210
|
-
/** Filter matching elysia's own `adapter/constants` module (src + dist). */
|
|
211
233
|
declare const ADAPTER_CONSTANTS_FILTER: RegExp;
|
|
212
234
|
declare const ADAPTER_BUN_FILTER: RegExp;
|
|
213
235
|
declare const IS_PRODUCTION_FILTER: RegExp;
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
* monorepos, linked installs). Used by esbuild as a broad pre-filter
|
|
219
|
-
*
|
|
220
|
-
* The caller must further check that the path is under the resolved elysia package root
|
|
221
|
-
* to avoid matching user code in a directory that happens to be named "elysia"
|
|
222
|
-
*
|
|
223
|
-
* @internal
|
|
224
|
-
*/
|
|
236
|
+
declare const TYPEBOX_TYPE_FILTER: RegExp;
|
|
237
|
+
declare const TYPEBOX_SYSTEM_LITE_FILTER: RegExp;
|
|
238
|
+
declare const TYPEBOX_REQUIRE_FILTER: RegExp;
|
|
239
|
+
declare const EXACT_MIRROR_REQUIRE_FILTER: RegExp;
|
|
225
240
|
declare const ELYSIA_MODULE_FILTER: RegExp;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
* resolved elysia package root (i.e. actually elysia's own files).
|
|
229
|
-
*
|
|
230
|
-
* Anchoring to the real package root prevents user projects rooted in a
|
|
231
|
-
* directory named `elysia` (like this repo itself) from having their code
|
|
232
|
-
* rewritten.
|
|
233
|
-
*
|
|
234
|
-
* Pass the result to both the esbuild `filter` (convert to RegExp via
|
|
235
|
-
* `makeElysiaModuleFilterRegex`) and the Vite transform (`isElysiaModule`).
|
|
236
|
-
*/
|
|
237
|
-
declare function resolveElysiaRoot(from?: string): string;
|
|
238
|
-
/**
|
|
239
|
-
* Returns a predicate that is `true` only when the given module path is under
|
|
240
|
-
* the resolved elysia package root AND matches the broad module filter.
|
|
241
|
-
*/
|
|
241
|
+
declare function resolveElysiaRoot(from: string): string;
|
|
242
|
+
declare function resolveExactMirror(from: string): boolean;
|
|
242
243
|
declare function makeIsElysiaModule(elysiaRoot: string): (path: string) => boolean;
|
|
243
|
-
|
|
244
|
-
* Build an esbuild-compatible RegExp that anchors to the resolved elysia root
|
|
245
|
-
* so the `onLoad` pre-filter is as tight as possible. esbuild uses this as an
|
|
246
|
-
* initial path filter before calling the callback, so we still double-check
|
|
247
|
-
* with `makeIsElysiaModule` inside the callback.
|
|
248
|
-
*/
|
|
249
|
-
declare function makeElysiaModuleFilterRegex(elysiaRoot: string): RegExp;
|
|
250
|
-
declare function rewriteIsProductionCalls(code: string): string;
|
|
244
|
+
declare const rewriteIsProductionCalls: (code: string) => string;
|
|
251
245
|
declare const bunAdapterStubSource: string;
|
|
252
246
|
declare const STUB_SOURCES: Record<Exclude<keyof StubPlan, 'adapter' | 'isProduction'>, Array<{
|
|
253
247
|
filter: RegExp;
|
|
@@ -258,7 +252,7 @@ declare const OVERRIDE_MAP: Record<string, {
|
|
|
258
252
|
leaf: string;
|
|
259
253
|
export: string;
|
|
260
254
|
}>;
|
|
261
|
-
declare function generateVirtualType(
|
|
255
|
+
declare function generateVirtualType(moduleCondition?: AotModuleCondition): Promise<string>;
|
|
262
256
|
interface CompiledArtifacts {
|
|
263
257
|
source: string;
|
|
264
258
|
/** Handler-JIT modules detection proved safe to stub for this app. */
|
|
@@ -272,11 +266,6 @@ interface CompiledArtifacts {
|
|
|
272
266
|
*/
|
|
273
267
|
virtualType?: string;
|
|
274
268
|
}
|
|
275
|
-
/** @internal Test diagnostic for deterministic worker cleanup. */
|
|
276
|
-
declare const getAotWorkerDiagnostics: () => {
|
|
277
|
-
activeWorkers: number;
|
|
278
|
-
lastExit: Promise<number> | undefined;
|
|
279
|
-
};
|
|
280
269
|
/**
|
|
281
270
|
* Extension mirroring the running module's own build output, so a sibling
|
|
282
271
|
* source file can be resolved from `import.meta.url` in `.mjs`/`.js`/`.ts`
|
|
@@ -284,9 +273,12 @@ declare const getAotWorkerDiagnostics: () => {
|
|
|
284
273
|
*/
|
|
285
274
|
declare function siblingModuleExt(moduleUrl: string): '.mjs' | '.js' | '.ts';
|
|
286
275
|
/** @internal Re-evaluate an entry in a disposable worker for watch rebuilds. */
|
|
287
|
-
declare function generateCompiledArtifactsIsolated(file: string, options?: ElysiaAotOptions): Promise<CompiledArtifacts>;
|
|
288
|
-
|
|
276
|
+
declare function generateCompiledArtifactsIsolated(file: string, options?: ElysiaAotOptions, moduleCondition?: string): Promise<CompiledArtifacts>;
|
|
277
|
+
type ValidatorSlotIdentity = Pick<CapturedValidator, 'method' | 'path' | 'slot'>;
|
|
278
|
+
/** @internal Exact logical-slot gate used by AOT mode selection. */
|
|
279
|
+
declare function validatorSlotSetsMatch(expected: readonly ValidatorSlotIdentity[], captured: readonly ValidatorSlotIdentity[]): boolean;
|
|
280
|
+
declare function generateCompiledArtifacts(file: string, options?: ElysiaAotOptions, moduleCondition?: string): Promise<CompiledArtifacts>;
|
|
289
281
|
declare const SOURCE_REGEX: RegExp;
|
|
290
282
|
declare const realPath: (path: string) => string;
|
|
291
283
|
//#endregion
|
|
292
|
-
export { ADAPTER_BUN_FILTER, ADAPTER_CONSTANTS_FILTER, BridgeMode, CompiledArtifacts, ELYSIA_MODULE_FILTER, ElysiaAotOptions, IS_PRODUCTION_FILTER, NO_STUB, OVERRIDE_MAP, SOURCE_REGEX, STUB_SOURCES, StubPlan, adapterConstantsSource, alignStubExtensions, bunAdapterStubSource, generateCompiledArtifacts, generateCompiledArtifactsIsolated, generateVirtualType,
|
|
284
|
+
export { ADAPTER_BUN_FILTER, ADAPTER_CONSTANTS_FILTER, BridgeMode, CompiledArtifacts, ELYSIA_MODULE_FILTER, EXACT_MIRROR_REQUIRE_FILTER, ElysiaAotOptions, IS_PRODUCTION_FILTER, NO_STUB, OVERRIDE_MAP, SOURCE_REGEX, STUB_SOURCES, StubPlan, TYPEBOX_REQUIRE_FILTER, TYPEBOX_SYSTEM_LITE_FILTER, TYPEBOX_TYPE_FILTER, adapterConstantsSource, alignStubExtensions, bunAdapterStubSource, generateCompiledArtifacts, generateCompiledArtifactsIsolated, generateVirtualType, makeIsElysiaModule, planFromReport, realPath, resolveElysiaRoot, resolveEntry, resolveEntryModuleKind, resolveExactMirror, rewriteIsProductionCalls, siblingModuleExt, validatorSlotSetsMatch };
|