elysia 2.0.0-beta.28 → 2.0.0-beta.29
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/utils.d.ts +1 -1
- package/dist/base.d.ts +2 -2
- package/dist/compile/aot-capture.js +1 -1
- package/dist/compile/aot-capture.mjs +1 -1
- package/dist/compile/handler/index.js +1 -2
- package/dist/compile/handler/index.mjs +2 -3
- package/dist/compile/handler/jit.d.ts +2 -1
- package/dist/compile/handler/jit.js +4 -2
- package/dist/compile/handler/jit.mjs +3 -2
- package/dist/context.d.ts +1 -1
- package/dist/generation.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin/aot/core.d.ts +1 -1
- package/dist/plugin/aot/core.js +2 -2
- package/dist/plugin/aot/core.mjs +2 -2
- package/dist/plugin/aot/source.d.ts +1 -1
- package/dist/plugin/aot/source.js +3 -1
- package/dist/plugin/aot/source.mjs +3 -1
- package/dist/type/bridge-live.d.ts +1 -1
- package/dist/type/bridge-live.js +1 -1
- package/dist/type/bridge-live.mjs +1 -1
- package/dist/type/bridge.d.ts +1 -1
- package/dist/type/typebox-value-live.d.ts +2 -2
- package/dist/type/typebox-value-live.js +2 -2
- package/dist/type/typebox-value-live.mjs +2 -2
- package/dist/type/typebox-value-ops.d.ts +2 -2
- package/dist/type/typebox-value-ops.js +2 -2
- package/dist/type/typebox-value-ops.mjs +2 -2
- package/dist/type/typebox-value.d.ts +6 -6
- package/dist/type/types.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/package.json +1 -1
package/dist/adapter/utils.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare function responseToSetHeaders(response: Response, set?: Context['set']):
|
|
|
15
15
|
redirect?: never;
|
|
16
16
|
} | {
|
|
17
17
|
headers: any;
|
|
18
|
-
status: number | "
|
|
18
|
+
status: number | "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required";
|
|
19
19
|
};
|
|
20
20
|
interface CreateHandlerParameter {
|
|
21
21
|
mapResponse(response: unknown, set: Context['set'], request?: Request, owned?: boolean): Response;
|
package/dist/base.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ElysiaStatus } from "./error.js";
|
|
2
|
-
import { AnySchema } from "./type/types.js";
|
|
3
|
-
import { AotFingerprint, CompilerSession, ProgramId } from "./compile/aot.js";
|
|
4
2
|
import { ChainNode } from "./utils.js";
|
|
5
3
|
import { ListenCallback, Serve, Server } from "./universal/server.js";
|
|
6
4
|
import { Context, ErrorContext, LifecycleContext } from "./context.js";
|
|
7
5
|
import { TraceCapability, TraceHandler } from "./trace.js";
|
|
6
|
+
import { AnySchema } from "./type/types.js";
|
|
7
|
+
import { AotFingerprint, CompilerSession, ProgramId } from "./compile/aot.js";
|
|
8
8
|
import { AddRoute, AddWSRoute, AfterHandler, AfterResponseHandler, AnyErrorConstructor, AnyLocalHook, BodyHandler, CompiledHandler, CreateEden, DefaultEphemeral, DefaultMetadata, DefaultSingleton, DefinitionBase, ElysiaConfig, ElysiaHandlerToResponseSchemaAmbiguous, EphemeralType, ErrorDefinitionEntry, ErrorHandler, EventScope, ExcludeElysiaResponse, ExtractErrorFromHandle, GlobalHookReturn, GracefulHandler, GuardHookSingleton, GuardLocalHook, HTTPMethod, HistoryEntry, HookContextSchema, HookContextSingleton, InlineHandler, InlineHandlerNonMacro, InputSchema, InputSchemaKey, InternalRoute, IntersectIfObjectSchema, JoinPath, LocalHook, LocalHookReturn, Macro, MacroOptionContext, MacroToContext, MacroToProperty, MapResponse, MaybeArray, MaybePromise, MergeElysiaInstances, MergeSchema, MergeScopedSchemas, MetadataBase, ObjectMacroDefs, OptionalHandler, ParentResponse, PluginHookReturn, PreHandler, Prettify, PublicRoute, ResolveUsedRouteErrors, RouteBase, ScopedHookReturn, ScopedMapDeriveReturn, SingletonBase, StaticMapAliases, TransformHandler, UnionResponseStatus, UnwrapRoute, WrapFn } from "./types.js";
|
|
9
9
|
import { RouteErrorHooks } from "./handler/utils.js";
|
|
10
10
|
import { WSCapability, WSHandlerResponse, WSLocalHook, WSMessageHandler, WSOptions, WSOptionsEntry } from "./ws/types.js";
|
|
@@ -13,8 +13,8 @@ const require_type_validator_frozen_check = require('../type/validator/frozen-ch
|
|
|
13
13
|
const require_type_validator_custom_error = require('../type/validator/custom-error.js');
|
|
14
14
|
const require_type_validator_exact_mirror = require('../type/validator/exact-mirror.js');
|
|
15
15
|
const require_type_validator_string_codec_aot = require('../type/validator/string-codec-aot.js');
|
|
16
|
-
let typebox_schema = require("typebox/schema");
|
|
17
16
|
let typebox_value = require("typebox/value");
|
|
17
|
+
let typebox_schema = require("typebox/schema");
|
|
18
18
|
|
|
19
19
|
//#region src/compile/aot-capture.ts
|
|
20
20
|
function emptyContainers(node, depth) {
|
|
@@ -12,8 +12,8 @@ import { buildFrozenCheck } from "../type/validator/frozen-check.mjs";
|
|
|
12
12
|
import { captureCustomErrors } from "../type/validator/custom-error.mjs";
|
|
13
13
|
import { getExactMirror } from "../type/validator/exact-mirror.mjs";
|
|
14
14
|
import { captureStringCodecEntries, compileWithBuild } from "../type/validator/string-codec-aot.mjs";
|
|
15
|
-
import { Build, Compile } from "typebox/schema";
|
|
16
15
|
import { Default } from "typebox/value";
|
|
16
|
+
import { Build, Compile } from "typebox/schema";
|
|
17
17
|
|
|
18
18
|
//#region src/compile/aot-capture.ts
|
|
19
19
|
function emptyContainers(node, depth) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_universal_constants = require('../../universal/constants.js');
|
|
3
2
|
const require_universal_file = require('../../universal/file.js');
|
|
4
3
|
const require_utils = require('../../utils.js');
|
|
5
4
|
const require_error = require('../../error.js');
|
|
@@ -412,7 +411,7 @@ function compileHandler(route, root, liveOnly = false) {
|
|
|
412
411
|
if (wrappers && typeof handler === "function") for (let i = wrappers.length - 1; i >= 0; i--) handler = wrappers[i](handler);
|
|
413
412
|
const declaresResponse = !!hook && (hook.response != null || !!hook.schemas?.some((schema) => schema?.response));
|
|
414
413
|
const isHandleFunction = typeof handler === "function";
|
|
415
|
-
if (!isHandleFunction && !(handler instanceof Promise) && !(!
|
|
414
|
+
if (!isHandleFunction && !(handler instanceof Promise) && !(!require_compile_handler_jit.targetsBun() && handler instanceof require_universal_file.ElysiaFile) && !declaresResponse) {
|
|
416
415
|
const rootHeaders = frozenRoot["~ext"]?.headers;
|
|
417
416
|
const set = { headers: rootHeaders ? Object.assign(require_utils.nullObject(), rootHeaders) : require_utils.nullObject() };
|
|
418
417
|
const response = adapter.response;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import { isBun } from "../../universal/constants.mjs";
|
|
3
2
|
import { ElysiaFile } from "../../universal/file.mjs";
|
|
4
3
|
import { cloneHook, compactBeforeHandleConflicts, compactBeforeHandlePrefix, compositionKeys, flattenChain, flattenChainInfo, flattenChainMemo, flattenChainMemoReadonly, fnv1a, isCompactBeforeHandleOnly, isHTMLBundle, isNotEmpty, isRecordNumber, macroEpoch, mergeHook, nullObject, refTargets, replaceUrlPath } from "../../utils.mjs";
|
|
5
4
|
import { ElysiaStatus } from "../../error.mjs";
|
|
@@ -13,7 +12,7 @@ import { isResponseParam, resolveHandlerParams } from "./params.mjs";
|
|
|
13
12
|
import { originalFunction } from "../../type/shared.mjs";
|
|
14
13
|
import { isResponseMap } from "./frozen-validator.mjs";
|
|
15
14
|
import { Reconstruct } from "./reconstruct.mjs";
|
|
16
|
-
import { compileHandlerJit, createInlineHandler, setCaptureHeaderShorthand } from "./jit.mjs";
|
|
15
|
+
import { compileHandlerJit, createInlineHandler, setCaptureHeaderShorthand, targetsBun } from "./jit.mjs";
|
|
17
16
|
import { describeRoute, releaseAnalysisCaches } from "./descriptor.mjs";
|
|
18
17
|
import { defaultAdapter } from "../../adapter/constants.mjs";
|
|
19
18
|
|
|
@@ -412,7 +411,7 @@ function compileHandler(route, root, liveOnly = false) {
|
|
|
412
411
|
if (wrappers && typeof handler === "function") for (let i = wrappers.length - 1; i >= 0; i--) handler = wrappers[i](handler);
|
|
413
412
|
const declaresResponse = !!hook && (hook.response != null || !!hook.schemas?.some((schema) => schema?.response));
|
|
414
413
|
const isHandleFunction = typeof handler === "function";
|
|
415
|
-
if (!isHandleFunction && !(handler instanceof Promise) && !(!
|
|
414
|
+
if (!isHandleFunction && !(handler instanceof Promise) && !(!targetsBun() && handler instanceof ElysiaFile) && !declaresResponse) {
|
|
416
415
|
const rootHeaders = frozenRoot["~ext"]?.headers;
|
|
417
416
|
const set = { headers: rootHeaders ? Object.assign(nullObject(), rootHeaders) : nullObject() };
|
|
418
417
|
const response = adapter.response;
|
|
@@ -25,6 +25,7 @@ declare let onEmit: ((code: string) => void) | undefined;
|
|
|
25
25
|
declare const setOnEmit: (fn: typeof onEmit) => void;
|
|
26
26
|
declare const setAsyncTail: (on: boolean | undefined) => void;
|
|
27
27
|
declare const setCaptureHeaderShorthand: (value: boolean | undefined) => void;
|
|
28
|
+
declare const targetsBun: () => boolean;
|
|
28
29
|
declare const createInlineHandler: (map: (value: unknown, ...rest: unknown[]) => unknown, h: (context: Context) => unknown) => CompiledHandler;
|
|
29
30
|
interface CompileHandlerJitOptions {
|
|
30
31
|
method: string;
|
|
@@ -46,4 +47,4 @@ interface CompileHandlerJitOptions {
|
|
|
46
47
|
}
|
|
47
48
|
declare function compileHandlerJit(options: CompileHandlerJitOptions, tailPass?: TailMode): CompiledHandler;
|
|
48
49
|
//#endregion
|
|
49
|
-
export { CompileHandlerJitOptions, FACTORY_CACHE_LIMIT, compileHandlerJit, createInlineHandler, factoryCache, setAsyncTail, setCaptureHeaderShorthand, setOnEmit };
|
|
50
|
+
export { CompileHandlerJitOptions, FACTORY_CACHE_LIMIT, compileHandlerJit, createInlineHandler, factoryCache, setAsyncTail, setCaptureHeaderShorthand, setOnEmit, targetsBun };
|
|
@@ -31,6 +31,7 @@ const setAsyncTail = (on) => {
|
|
|
31
31
|
const setCaptureHeaderShorthand = (value) => {
|
|
32
32
|
captureHeaderShorthand = value;
|
|
33
33
|
};
|
|
34
|
+
const targetsBun = () => captureHeaderShorthand ?? require_universal_constants.isBun;
|
|
34
35
|
function builtinParser(adapter, parse, link, arm) {
|
|
35
36
|
switch (parse) {
|
|
36
37
|
case "formdata":
|
|
@@ -167,7 +168,7 @@ function compileHandlerJit(options, tailPass) {
|
|
|
167
168
|
const hasDeriveDispose = !!hook?.["~deriveEntries"]?.length;
|
|
168
169
|
const hasDynamicAfterResponse = !!inference.afterResponse || hasDeriveDispose;
|
|
169
170
|
const hasStl = (hasAfterResponse || hasTrace || hasDeriveDispose) && !syncAfterResponse;
|
|
170
|
-
const tail = tailRoute && (asyncTailOn ??
|
|
171
|
+
const tail = tailRoute && (asyncTailOn ?? targetsBun());
|
|
171
172
|
const asyncMode = tail ? tailPass ?? {
|
|
172
173
|
async: false,
|
|
173
174
|
n: 0,
|
|
@@ -601,4 +602,5 @@ exports.createInlineHandler = createInlineHandler;
|
|
|
601
602
|
exports.factoryCache = factoryCache;
|
|
602
603
|
exports.setAsyncTail = setAsyncTail;
|
|
603
604
|
exports.setCaptureHeaderShorthand = setCaptureHeaderShorthand;
|
|
604
|
-
exports.setOnEmit = setOnEmit;
|
|
605
|
+
exports.setOnEmit = setOnEmit;
|
|
606
|
+
exports.targetsBun = targetsBun;
|
|
@@ -31,6 +31,7 @@ const setAsyncTail = (on) => {
|
|
|
31
31
|
const setCaptureHeaderShorthand = (value) => {
|
|
32
32
|
captureHeaderShorthand = value;
|
|
33
33
|
};
|
|
34
|
+
const targetsBun = () => captureHeaderShorthand ?? isBun;
|
|
34
35
|
function builtinParser(adapter, parse, link, arm) {
|
|
35
36
|
switch (parse) {
|
|
36
37
|
case "formdata":
|
|
@@ -167,7 +168,7 @@ function compileHandlerJit(options, tailPass) {
|
|
|
167
168
|
const hasDeriveDispose = !!hook?.["~deriveEntries"]?.length;
|
|
168
169
|
const hasDynamicAfterResponse = !!inference.afterResponse || hasDeriveDispose;
|
|
169
170
|
const hasStl = (hasAfterResponse || hasTrace || hasDeriveDispose) && !syncAfterResponse;
|
|
170
|
-
const tail = tailRoute && (asyncTailOn ??
|
|
171
|
+
const tail = tailRoute && (asyncTailOn ?? targetsBun());
|
|
171
172
|
const asyncMode = tail ? tailPass ?? {
|
|
172
173
|
async: false,
|
|
173
174
|
n: 0,
|
|
@@ -595,4 +596,4 @@ function compileHandlerJit(options, tailPass) {
|
|
|
595
596
|
}
|
|
596
597
|
|
|
597
598
|
//#endregion
|
|
598
|
-
export { FACTORY_CACHE_LIMIT, compileHandlerJit, createInlineHandler, factoryCache, setAsyncTail, setCaptureHeaderShorthand, setOnEmit };
|
|
599
|
+
export { FACTORY_CACHE_LIMIT, compileHandlerJit, createInlineHandler, factoryCache, setAsyncTail, setCaptureHeaderShorthand, setOnEmit, targetsBun };
|
package/dist/context.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StatusMap } from "./constants.js";
|
|
2
2
|
import { SelectiveProblem, SelectiveStatus, problem, status } from "./error.js";
|
|
3
|
-
import { BaseCookie } from "./cookie/types.js";
|
|
4
3
|
import { redirect } from "./utils.js";
|
|
5
4
|
import { Server } from "./universal/server.js";
|
|
5
|
+
import { BaseCookie } from "./cookie/types.js";
|
|
6
6
|
import { Cookie } from "./cookie/cookie.js";
|
|
7
7
|
import { AfterResponseHandler, DefaultSingleton, HTTPHeaders, InputSchema, MaybePromise, Prettify, ResolvePath, RouteSchema, SingletonBase } from "./types.js";
|
|
8
8
|
import { AnyElysia } from "./base.js";
|
package/dist/generation.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ProgramId } from "./compile/aot.js";
|
|
2
1
|
import { ChainNode } from "./utils.js";
|
|
3
2
|
import { TraceCapability } from "./trace.js";
|
|
3
|
+
import { ProgramId } from "./compile/aot.js";
|
|
4
4
|
import { WSCapability, WSOptions } from "./ws/types.js";
|
|
5
5
|
import { RouteTable } from "./route-table.js";
|
|
6
6
|
import { AnyElysia } from "./base.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StatusMap, StatusMapBack } from "./constants.js";
|
|
2
2
|
import { ElysiaError, ElysiaStatus, HTTPError, InternalServerError, NotFound, NumericStatus, ParseError, Problem, SelectiveProblem, SelectiveStatus, StatusResponse, TaggedHTTPError, ValidationError, ValidationErrorResponse, problem, status, validationDetail } from "./error.js";
|
|
3
|
+
import { bytes, form, macroType, prefix, redirect, sse } from "./utils.js";
|
|
4
|
+
import { Server } from "./universal/server.js";
|
|
3
5
|
import { BaseCookie, CookieOptions } from "./cookie/types.js";
|
|
6
|
+
import { Cookie } from "./cookie/cookie.js";
|
|
7
|
+
import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
|
|
8
|
+
import { ElysiaFile, file } from "./universal/file.js";
|
|
4
9
|
import { AnySchema, BaseSchema, StandardJSONSchemaV1Like, StandardSchemaV1Like } from "./type/types.js";
|
|
5
10
|
import { TCookieField, TCookieObject } from "./type/elysia/cookie.js";
|
|
6
11
|
import { TFiles } from "./type/elysia/files.js";
|
|
@@ -10,11 +15,6 @@ import { AotFingerprint, Capture, Compiled, CompilerSession, ProgramId } from ".
|
|
|
10
15
|
import { MultiValidator, StandardValidator, Validator } from "./validator/index.js";
|
|
11
16
|
import { TypeBoxValidator } from "./type/validator/index.js";
|
|
12
17
|
import { TypeSystem, t } from "./type/index.js";
|
|
13
|
-
import { bytes, form, macroType, prefix, redirect, sse } from "./utils.js";
|
|
14
|
-
import { Server } from "./universal/server.js";
|
|
15
|
-
import { Cookie } from "./cookie/cookie.js";
|
|
16
|
-
import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
|
|
17
|
-
import { ElysiaFile, file } from "./universal/file.js";
|
|
18
18
|
import { env } from "./universal/env.js";
|
|
19
19
|
import { DefaultEphemeral, DefaultMetadata, DefaultSingleton, HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, MacroTypeLambda, RouteSchema, SSEPayload, UnwrapModels, UnwrapRoute, UnwrapSchema } from "./types.js";
|
|
20
20
|
import { AnyElysia, Elysia } from "./base.js";
|
package/dist/package.js
CHANGED
package/dist/package.mjs
CHANGED
|
@@ -100,7 +100,7 @@ interface ElysiaAotOptions {
|
|
|
100
100
|
}
|
|
101
101
|
declare const resolveEntry: (entry: string) => string;
|
|
102
102
|
/** @internal Resolve the package condition used to evaluate an AOT entry. */
|
|
103
|
-
declare const resolveEntryModuleKind: (entry: string) => "
|
|
103
|
+
declare const resolveEntryModuleKind: (entry: string) => "esm" | "cjs";
|
|
104
104
|
/** Runtime handler-JIT module a strip build can replace with a throwing stub. */
|
|
105
105
|
interface StubPlan {
|
|
106
106
|
/** Stub the internal handler codegen module. */
|
package/dist/plugin/aot/core.js
CHANGED
|
@@ -122,7 +122,7 @@ const STUB_SOURCES = {
|
|
|
122
122
|
}],
|
|
123
123
|
jit: [{
|
|
124
124
|
filter: /[\\/]elysia[\\/](dist|src)[\\/]compile[\\/]handler[\\/]jit\.(m?js|ts)$/,
|
|
125
|
-
source: "const e=()=>{throw new Error(\"[elysia-aot] handler compiler JIT was stripped (strip mode) but a route needed runtime compilation. Rebuild with strip:false.\")}\nexport function compileHandlerJit(){return e()}\nexport function createInlineHandler(){return e()}\nexport function setCaptureHeaderShorthand(){}\n"
|
|
125
|
+
source: "const e=()=>{throw new Error(\"[elysia-aot] handler compiler JIT was stripped (strip mode) but a route needed runtime compilation. Rebuild with strip:false.\")}\nexport function compileHandlerJit(){return e()}\nexport function createInlineHandler(){return e()}\nexport function setCaptureHeaderShorthand(){}\nexport const targetsBun=()=>typeof Bun!==\"undefined\"\n"
|
|
126
126
|
}, {
|
|
127
127
|
filter: /[\\/]elysia[\\/](dist|src)[\\/]compile[\\/]handler[\\/]descriptor\.(m?js|ts)$/,
|
|
128
128
|
source: "const e=()=>{throw new Error(\"[elysia-aot] handler compiler JIT was stripped (strip mode) but a route needed runtime compilation. Rebuild with strip:false.\")}\nexport function describeRoute(){return e()}\nexport function releaseAnalysisCaches(){}\n"
|
|
@@ -464,7 +464,7 @@ async function generateCompiledArtifacts(file, options, moduleCondition = resolv
|
|
|
464
464
|
mode: "off"
|
|
465
465
|
};
|
|
466
466
|
const artifacts = await require_plugin_aot_source.captureArtifacts(typedApp, sourceOptions);
|
|
467
|
-
const report = require_plugin_aot_source.replayStubbability(typedApp, artifacts.handlers);
|
|
467
|
+
const report = require_plugin_aot_source.replayStubbability(typedApp, artifacts.handlers, options?.target);
|
|
468
468
|
const aliases = /* @__PURE__ */ new Set();
|
|
469
469
|
for (const handler of artifacts.handlers) if (handler.alias) for (const name of handler.alias.split(",")) aliases.add(require_compile_handler_params.isResponseParam(name) ? "va" : name);
|
|
470
470
|
const history = typedApp["~routes"];
|
package/dist/plugin/aot/core.mjs
CHANGED
|
@@ -120,7 +120,7 @@ const STUB_SOURCES = {
|
|
|
120
120
|
}],
|
|
121
121
|
jit: [{
|
|
122
122
|
filter: /[\\/]elysia[\\/](dist|src)[\\/]compile[\\/]handler[\\/]jit\.(m?js|ts)$/,
|
|
123
|
-
source: "const e=()=>{throw new Error(\"[elysia-aot] handler compiler JIT was stripped (strip mode) but a route needed runtime compilation. Rebuild with strip:false.\")}\nexport function compileHandlerJit(){return e()}\nexport function createInlineHandler(){return e()}\nexport function setCaptureHeaderShorthand(){}\n"
|
|
123
|
+
source: "const e=()=>{throw new Error(\"[elysia-aot] handler compiler JIT was stripped (strip mode) but a route needed runtime compilation. Rebuild with strip:false.\")}\nexport function compileHandlerJit(){return e()}\nexport function createInlineHandler(){return e()}\nexport function setCaptureHeaderShorthand(){}\nexport const targetsBun=()=>typeof Bun!==\"undefined\"\n"
|
|
124
124
|
}, {
|
|
125
125
|
filter: /[\\/]elysia[\\/](dist|src)[\\/]compile[\\/]handler[\\/]descriptor\.(m?js|ts)$/,
|
|
126
126
|
source: "const e=()=>{throw new Error(\"[elysia-aot] handler compiler JIT was stripped (strip mode) but a route needed runtime compilation. Rebuild with strip:false.\")}\nexport function describeRoute(){return e()}\nexport function releaseAnalysisCaches(){}\n"
|
|
@@ -462,7 +462,7 @@ async function generateCompiledArtifacts(file, options, moduleCondition = resolv
|
|
|
462
462
|
mode: "off"
|
|
463
463
|
};
|
|
464
464
|
const artifacts = await captureArtifacts(typedApp, sourceOptions);
|
|
465
|
-
const report = replayStubbability(typedApp, artifacts.handlers);
|
|
465
|
+
const report = replayStubbability(typedApp, artifacts.handlers, options?.target);
|
|
466
466
|
const aliases = /* @__PURE__ */ new Set();
|
|
467
467
|
for (const handler of artifacts.handlers) if (handler.alias) for (const name of handler.alias.split(",")) aliases.add(isResponseParam(name) ? "va" : name);
|
|
468
468
|
const history = typedApp["~routes"];
|
|
@@ -19,6 +19,6 @@ interface CapturedArtifacts {
|
|
|
19
19
|
fingerprint: AotFingerprint;
|
|
20
20
|
}
|
|
21
21
|
declare function captureArtifacts(app: AnyElysia, options?: CompileToSourceOptions): Promise<CapturedArtifacts>;
|
|
22
|
-
declare function replayStubbability(app: AnyElysia, handlers: CapturedHandler[]): JITProbeResult;
|
|
22
|
+
declare function replayStubbability(app: AnyElysia, handlers: CapturedHandler[], target?: AotTarget): JITProbeResult;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { AotModuleCondition, AotTarget, CapturedArtifacts, CompileToSourceOptions, autoGroupSize, captureArtifacts, compileToSource, replayStubbability };
|
|
@@ -50,11 +50,12 @@ const materialiseHandlersForReplay = (captured) => {
|
|
|
50
50
|
}
|
|
51
51
|
return manifest;
|
|
52
52
|
};
|
|
53
|
-
function replayStubbability(app, handlers) {
|
|
53
|
+
function replayStubbability(app, handlers, target) {
|
|
54
54
|
const previousCompiled = require_compile_aot_capture.snapshotCompiled();
|
|
55
55
|
const previousAotBuild = require_universal_env.env.ELYSIA_AOT_BUILD;
|
|
56
56
|
if (previousAotBuild !== void 0) delete require_universal_env.env.ELYSIA_AOT_BUILD;
|
|
57
57
|
try {
|
|
58
|
+
if (target !== void 0) require_compile_handler_jit.setCaptureHeaderShorthand(target === "bun");
|
|
58
59
|
require_compile_aot.Compiled.clear();
|
|
59
60
|
const fingerprint = require_compile_aot.createAotFingerprint();
|
|
60
61
|
require_compile_aot.Compiled.register({
|
|
@@ -81,6 +82,7 @@ function replayStubbability(app, handlers) {
|
|
|
81
82
|
}
|
|
82
83
|
return require_compile_jit_probe.JITProbe.end();
|
|
83
84
|
} finally {
|
|
85
|
+
require_compile_handler_jit.setCaptureHeaderShorthand(void 0);
|
|
84
86
|
require_compile_aot_capture.restoreCompiled(previousCompiled);
|
|
85
87
|
require_validator_index.Validator.clear();
|
|
86
88
|
if (previousAotBuild !== void 0) require_universal_env.env.ELYSIA_AOT_BUILD = previousAotBuild;
|
|
@@ -49,11 +49,12 @@ const materialiseHandlersForReplay = (captured) => {
|
|
|
49
49
|
}
|
|
50
50
|
return manifest;
|
|
51
51
|
};
|
|
52
|
-
function replayStubbability(app, handlers) {
|
|
52
|
+
function replayStubbability(app, handlers, target) {
|
|
53
53
|
const previousCompiled = snapshotCompiled();
|
|
54
54
|
const previousAotBuild = env.ELYSIA_AOT_BUILD;
|
|
55
55
|
if (previousAotBuild !== void 0) delete env.ELYSIA_AOT_BUILD;
|
|
56
56
|
try {
|
|
57
|
+
if (target !== void 0) setCaptureHeaderShorthand(target === "bun");
|
|
57
58
|
Compiled.clear();
|
|
58
59
|
const fingerprint = createAotFingerprint();
|
|
59
60
|
Compiled.register({
|
|
@@ -80,6 +81,7 @@ function replayStubbability(app, handlers) {
|
|
|
80
81
|
}
|
|
81
82
|
return JITProbe.end();
|
|
82
83
|
} finally {
|
|
84
|
+
setCaptureHeaderShorthand(void 0);
|
|
83
85
|
restoreCompiled(previousCompiled);
|
|
84
86
|
Validator.clear();
|
|
85
87
|
if (previousAotBuild !== void 0) env.ELYSIA_AOT_BUILD = previousAotBuild;
|
|
@@ -5,8 +5,8 @@ import { useTypebox as useTypebox$1 } from "./bridge.js";
|
|
|
5
5
|
import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-cache.js";
|
|
6
6
|
import { TypeBoxValidator } from "./validator/index.js";
|
|
7
7
|
import { Ref } from "typebox/type";
|
|
8
|
-
import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
|
|
9
8
|
import { Compile } from "typebox/compile";
|
|
9
|
+
import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
|
|
10
10
|
|
|
11
11
|
//#region src/type/bridge-live.d.ts
|
|
12
12
|
declare function useTypebox(_mod?: Parameters<typeof useTypebox$1>[0]): void;
|
package/dist/type/bridge-live.js
CHANGED
|
@@ -6,8 +6,8 @@ const require_type_validator_validator_cache = require('./validator/validator-ca
|
|
|
6
6
|
const require_type_validator_index = require('./validator/index.js');
|
|
7
7
|
const require_type_elysia_intersect = require('./elysia/intersect.js');
|
|
8
8
|
let typebox_type = require("typebox/type");
|
|
9
|
-
let typebox_value = require("typebox/value");
|
|
10
9
|
let typebox_compile = require("typebox/compile");
|
|
10
|
+
let typebox_value = require("typebox/value");
|
|
11
11
|
let typebox_system = require("typebox/system");
|
|
12
12
|
|
|
13
13
|
//#region src/type/bridge-live.ts
|
|
@@ -5,8 +5,8 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
|
|
|
5
5
|
import { TypeBoxValidator } from "./validator/index.mjs";
|
|
6
6
|
import { Intersect } from "./elysia/intersect.mjs";
|
|
7
7
|
import { Ref } from "typebox/type";
|
|
8
|
-
import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
|
|
9
8
|
import { Compile } from "typebox/compile";
|
|
9
|
+
import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
|
|
10
10
|
import { Settings } from "typebox/system";
|
|
11
11
|
|
|
12
12
|
//#region src/type/bridge-live.ts
|
package/dist/type/bridge.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { hasTypes as hasTypes$1 } from "./utils.js";
|
|
|
4
4
|
import { TypeBoxValidatorCache as TypeBoxValidatorCache$1, mayHaveFileType as mayHaveFileType$1 } from "./validator/validator-cache.js";
|
|
5
5
|
import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
|
|
6
6
|
import { Ref as Ref$1, TAny, TSchema } from "typebox/type";
|
|
7
|
-
import { Check as Check$1, Clone as Clone$1, Create as Create$1, Decode as Decode$2, HasCodec as HasCodec$1 } from "typebox/value";
|
|
8
7
|
import { Compile as Compile$1 } from "typebox/compile";
|
|
8
|
+
import { Check as Check$1, Clone as Clone$1, Create as Create$1, Decode as Decode$2, HasCodec as HasCodec$1 } from "typebox/value";
|
|
9
9
|
|
|
10
10
|
//#region src/type/bridge.d.ts
|
|
11
11
|
interface TypeboxModule {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TypeboxNamespaces } from "./typebox-value.js";
|
|
2
|
-
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
3
|
-
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
4
2
|
import { Compile } from "typebox/compile";
|
|
3
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
4
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
5
5
|
|
|
6
6
|
//#region src/type/typebox-value-live.d.ts
|
|
7
7
|
declare function injectTypebox(_typebox?: TypeboxNamespaces): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
|
-
let typebox_schema = require("typebox/schema");
|
|
4
|
-
let typebox_value = require("typebox/value");
|
|
5
3
|
let typebox_compile = require("typebox/compile");
|
|
4
|
+
let typebox_value = require("typebox/value");
|
|
6
5
|
let typebox_system = require("typebox/system");
|
|
6
|
+
let typebox_schema = require("typebox/schema");
|
|
7
7
|
|
|
8
8
|
//#region src/type/typebox-value-live.ts
|
|
9
9
|
typebox_system.Settings.Set({ unionPrioritySort: false });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
3
|
-
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
4
2
|
import { Compile } from "typebox/compile";
|
|
3
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
5
4
|
import { Settings } from "typebox/system";
|
|
5
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
6
6
|
|
|
7
7
|
//#region src/type/typebox-value-live.ts
|
|
8
8
|
Settings.Set({ unionPrioritySort: false });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
2
|
-
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
3
1
|
import { Compile } from "typebox/compile";
|
|
2
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
3
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
4
4
|
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.js');
|
|
3
|
-
let typebox_schema = require("typebox/schema");
|
|
4
|
-
let typebox_value = require("typebox/value");
|
|
5
3
|
let typebox_compile = require("typebox/compile");
|
|
4
|
+
let typebox_value = require("typebox/value");
|
|
5
|
+
let typebox_schema = require("typebox/schema");
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, 'Build', {
|
|
8
8
|
enumerable: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
3
|
-
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
4
2
|
import { Compile } from "typebox/compile";
|
|
3
|
+
import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
|
|
4
|
+
import { Build, Compile as SchemaCompile } from "typebox/schema";
|
|
5
5
|
|
|
6
6
|
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as _$
|
|
2
|
-
import {
|
|
1
|
+
import * as _$typebox_compile0 from "typebox/compile";
|
|
2
|
+
import { Compile as Compile$1 } from "typebox/compile";
|
|
3
3
|
import * as _$typebox_value0 from "typebox/value";
|
|
4
4
|
import { Check as Check$1, Clean as Clean$1, Clone as Clone$1, Create as Create$1, Decode as Decode$1, DecodeUnsafe as DecodeUnsafe$1, Default as Default$1, Encode as Encode$1, EncodeUnsafe as EncodeUnsafe$1, Errors as Errors$1, HasCodec as HasCodec$1 } from "typebox/value";
|
|
5
|
-
import * as _$
|
|
6
|
-
import { Compile as Compile$2 } from "typebox/
|
|
5
|
+
import * as _$typebox_schema0 from "typebox/schema";
|
|
6
|
+
import { Build as Build$1, Compile as Compile$2 } from "typebox/schema";
|
|
7
7
|
|
|
8
8
|
//#region src/type/typebox-value.d.ts
|
|
9
9
|
interface TypeboxNamespaces {
|
|
@@ -27,9 +27,9 @@ declare let Encode: typeof Encode$1;
|
|
|
27
27
|
declare let EncodeUnsafe: typeof EncodeUnsafe$1;
|
|
28
28
|
declare let Errors: typeof Errors$1;
|
|
29
29
|
declare let HasCodec: typeof HasCodec$1;
|
|
30
|
-
declare let SchemaCompile: typeof Compile$
|
|
30
|
+
declare let SchemaCompile: typeof Compile$2;
|
|
31
31
|
declare let Build: typeof Build$1;
|
|
32
|
-
declare let Compile: typeof Compile$
|
|
32
|
+
declare let Compile: typeof Compile$1;
|
|
33
33
|
declare function injectTypebox(typebox: TypeboxNamespaces): void;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, TypeboxNamespaces, injectTypebox, preloadTypebox, load as warmTypebox };
|
package/dist/type/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ELYSIA_TYPES } from "./constants.js";
|
|
2
1
|
import { CookieOptions } from "../cookie/types.js";
|
|
2
|
+
import { ELYSIA_TYPES } from "./constants.js";
|
|
3
3
|
import { TObjectOptions, TSchemaOptions } from "typebox";
|
|
4
4
|
import { TLocalizedValidationError } from "typebox/error";
|
|
5
5
|
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StatusMap, StatusMapBack } from "./constants.js";
|
|
2
2
|
import { ElysiaError, ElysiaStatus, ProblemResponseBody, ValidationErrorResponse } from "./error.js";
|
|
3
|
-
import { CookieOptions } from "./cookie/types.js";
|
|
4
|
-
import { AnySchema, StandardSchemaV1Like, TypeBoxSchema } from "./type/types.js";
|
|
5
3
|
import { ChainNode } from "./utils.js";
|
|
6
4
|
import { Serve } from "./universal/server.js";
|
|
5
|
+
import { CookieOptions } from "./cookie/types.js";
|
|
7
6
|
import { Context, ErrorContext, LifecycleContext, PreContext } from "./context.js";
|
|
8
7
|
import { TraceHandler } from "./trace.js";
|
|
9
8
|
import { ElysiaFile } from "./universal/file.js";
|
|
9
|
+
import { AnySchema, StandardSchemaV1Like, TypeBoxSchema } from "./type/types.js";
|
|
10
10
|
import { AnyElysia, Elysia } from "./base.js";
|
|
11
11
|
import { ElysiaAdapter } from "./adapter/index.js";
|
|
12
12
|
import { OpenAPIV3 } from "openapi-types";
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnySchema, StandardSchemaV1Like } from "./type/types.js";
|
|
2
1
|
import { Context } from "./context.js";
|
|
2
|
+
import { AnySchema, StandardSchemaV1Like } from "./type/types.js";
|
|
3
3
|
import { AnyLocalHook, AppHook, BunHTMLBundlelike, ElysiaFormData, EventFn, EventScope, GuardSchemaType, InputSchema, Macro, MacroTypeLambda, MaybeArray, Prettify, SSEPayload } from "./types.js";
|
|
4
4
|
|
|
5
5
|
//#region src/utils.d.ts
|