elysia 2.0.0-exp.19 → 2.0.0-exp.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.
@@ -13,11 +13,11 @@ function collectStaticRoutes(app) {
13
13
  if (!source) return;
14
14
  const ready = require_utils.nullObject();
15
15
  const pending = [];
16
- for (const rawPath in source) {
17
- const path = require_constants.needEncodeRegex.test(rawPath) ? encodeURI(rawPath) : rawPath;
18
- const methods = source[rawPath];
19
- for (const method in methods) {
20
- const value = methods[method];
16
+ for (const method in source) {
17
+ const paths = source[method];
18
+ for (let path in paths) {
19
+ const value = paths[path];
20
+ if (require_constants.needEncodeRegex.test(path)) path = encodeURI(path);
21
21
  if (value instanceof Promise) pending.push(value.then((resolved) => {
22
22
  if (resolved instanceof Response) (ready[path] ??= require_utils.nullObject())[method] = resolved;
23
23
  }, (err) => {
@@ -12,11 +12,11 @@ function collectStaticRoutes(app) {
12
12
  if (!source) return;
13
13
  const ready = nullObject();
14
14
  const pending = [];
15
- for (const rawPath in source) {
16
- const path = needEncodeRegex.test(rawPath) ? encodeURI(rawPath) : rawPath;
17
- const methods = source[rawPath];
18
- for (const method in methods) {
19
- const value = methods[method];
15
+ for (const method in source) {
16
+ const paths = source[method];
17
+ for (let path in paths) {
18
+ const value = paths[path];
19
+ if (needEncodeRegex.test(path)) path = encodeURI(path);
20
20
  if (value instanceof Promise) pending.push(value.then((resolved) => {
21
21
  if (resolved instanceof Response) (ready[path] ??= nullObject())[method] = resolved;
22
22
  }, (err) => {
package/dist/base.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { ElysiaStatus } from "./error.js";
2
2
  import { TraceHandler } from "./trace.js";
3
- import { AnySchema } from "./type/types.js";
4
3
  import { ListenCallback, Serve, Server } from "./universal/server.js";
5
4
  import { AddRoute, AddWSRoute, AfterHandler, AfterResponseHandler, AnyErrorConstructor, AnyLocalHook, BodyHandler, CompiledHandler, CreateEden, DefaultEphemeral, DefaultMetadata, DefaultSingleton, DefinitionBase, DocumentDecoration, ElysiaConfig, ElysiaHandlerToResponseSchemaAmbiguous, EphemeralType, ErrorDefinitionEntry, ErrorHandler, EventScope, ExcludeElysiaResponse, ExtractErrorFromHandle, GracefulHandler, GuardLocalHook, HTTPMethod, InlineHandler, InlineHandlerNonMacro, InputSchema, InputSchemaKey, InternalRoute, IntersectIfObjectSchema, JoinPath, LocalHook, Macro, MacroSchemaChannel, MacroToContext, MacroToProperty, MapResponse, MaybeArray, MaybePromise, MergeElysiaInstances, MergeSchema, MergeScopedSchemas, MetadataBase, NonResolvableMacroKey, ObjectMacroDefs, OptionalHandler, PreHandler, Prettify, PublicRoute, ResolveRouteErrors, RouteBase, SingletonBase, TransformHandler, UnionResponseStatus, UnwrapRoute, WrapFn } from "./types.js";
5
+ import { AnySchema } from "./type/types.js";
6
6
  import { ChainNode } from "./utils.js";
7
7
  import { Context, ErrorContext, LifecycleContext } from "./context.js";
8
8
  import { WSHandlerResponse, WSLocalHook, WSMessageHandler } from "./ws/types.js";
@@ -48,8 +48,8 @@ declare class Elysia<const in out BasePath extends string = '', const in out Sco
48
48
  } | undefined;
49
49
  };
50
50
  '~staticResponse'?: {
51
- [path: string]: {
52
- [method: string]: Response | Promise<Response>;
51
+ [method: string]: {
52
+ [path: string]: Response | Promise<Response>;
53
53
  };
54
54
  };
55
55
  '~hasWS'?: boolean;
package/dist/base.js CHANGED
@@ -38,6 +38,7 @@ var Elysia = class Elysia {
38
38
  }
39
39
  #compiled;
40
40
  #cachedRoutes;
41
+ #hasMapResponse;
41
42
  constructor(config) {
42
43
  this["~config"] = config;
43
44
  this["~Prefix"] = config?.prefix;
@@ -212,6 +213,7 @@ var Elysia = class Elysia {
212
213
  return this.#onBranch("afterHandle", scopeOrFn, fn);
213
214
  }
214
215
  mapResponse(scopeOrFn, fn) {
216
+ this.#hasMapResponse = true;
215
217
  return this.#onBranch("mapResponse", scopeOrFn, fn);
216
218
  }
217
219
  afterResponse(scopeOrFn, fn) {
@@ -532,6 +534,7 @@ var Elysia = class Elysia {
532
534
  }
533
535
  }
534
536
  const hookChain = app["~hookChain"];
537
+ if (!this.#hasMapResponse && app.#hasMapResponse) this.#hasMapResponse = true;
535
538
  if (app["~ext"]) {
536
539
  const { decorator, store, headers, models, parser, macro, error, hoc, setup, cleanup } = app["~ext"];
537
540
  const ext = this["~ext"] ??= require_utils.nullObject();
@@ -899,11 +902,9 @@ var Elysia = class Elysia {
899
902
  for (let i = 0; i < length; i++) if (require_utils.mapMethodBack(this.#history[i][0]) === "HEAD") (explicitHead ??= /* @__PURE__ */ new Set()).add(this.#history[i][1]);
900
903
  }
901
904
  const wrapHeadHandler = Elysia.#wrapHeadHandler;
902
- const strict = !!this["~config"]?.strictPath;
903
- const routerOptions = strict ? void 0 : { loosePath: true };
904
- const getRouter = () => this["~router"] ??= new memoirist.default(routerOptions);
905
+ const preferLoosePath = this["~config"]?.strictPath !== true;
905
906
  let explicitPaths;
906
- if (!strict && this["~config"]?.distinctPath) {
907
+ if (preferLoosePath && this["~config"]?.distinctPath) {
907
908
  explicitPaths = /* @__PURE__ */ new Map();
908
909
  for (let i = 0; i < length; i++) {
909
910
  const route = this.#history[i];
@@ -926,7 +927,7 @@ var Elysia = class Elysia {
926
927
  const ws = require_ws_route.buildWSRoute(route, this);
927
928
  const handler = ws[0];
928
929
  const options = ws[1];
929
- if (require_constants.isDynamicRegex.test(path)) getRouter().add("WS", path, handler, false);
930
+ if (require_constants.isDynamicRegex.test(path)) (this["~router"] ??= new memoirist.default({ loosePath: preferLoosePath })).add("WS", path, handler, false);
930
931
  else {
931
932
  this.#initMap();
932
933
  const wsMap = this["~map"]["WS"] ??= require_utils.nullObject();
@@ -953,7 +954,7 @@ var Elysia = class Elysia {
953
954
  let staticResponse;
954
955
  const maybeStatic = buildStatic && typeof route[2] !== "function";
955
956
  if (maybeStatic) {
956
- staticResponse = require_compile_handler_index.buildNativeStaticResponse(route, this);
957
+ staticResponse = require_compile_handler_index.buildNativeStaticResponse(route, this, this.#hasMapResponse);
957
958
  if (staticResponse) {
958
959
  const target = this["~staticResponse"] ??= {
959
960
  GET: void 0,
@@ -964,17 +965,17 @@ var Elysia = class Elysia {
964
965
  HEAD: void 0,
965
966
  OPTIONS: void 0
966
967
  };
967
- (target[path] ??= require_utils.nullObject())[method] = staticResponse;
968
+ (target[method] ??= require_utils.nullObject())[path] = staticResponse;
968
969
  if (!this["~config"]?.strictPath) {
969
970
  const loose = require_utils.getLoosePath(path);
970
- if (!explicitPaths?.get(method)?.has(loose)) (target[loose] ??= require_utils.nullObject())[method] = staticResponse;
971
+ if (!explicitPaths?.get(method)?.has(loose)) (target[method] ??= require_utils.nullObject())[loose] = staticResponse;
971
972
  }
972
973
  }
973
974
  }
974
975
  const sharedStatic = maybeStatic && staticResponse instanceof Response ? staticResponse : void 0;
975
976
  const autoHead = enableAutoHead && method === "GET" && !explicitHead?.has(path);
976
977
  const isDynamic = require_constants.isDynamicRegex.test(path);
977
- const registerLoose = !isDynamic && !strict && (path.length === 0 || path.charCodeAt(path.length - 1) === 47);
978
+ const registerLoose = !isDynamic && preferLoosePath && (path.length === 0 || path.charCodeAt(path.length - 1) === 47);
978
979
  const explicitMain = registerLoose ? explicitPaths?.get(method) : void 0;
979
980
  if (!isDynamic && !require_constants.needEncodeRegex.test(path) && !registerLoose) {
980
981
  const map = methods[method] ??= require_utils.nullObject();
@@ -1001,7 +1002,7 @@ var Elysia = class Elysia {
1001
1002
  }
1002
1003
  }
1003
1004
  if (isDynamic) {
1004
- const router = getRouter();
1005
+ const router = this["~router"] ??= new memoirist.default({ loosePath: preferLoosePath });
1005
1006
  const handler = this.handler(i, precompile, void 0, sharedStatic);
1006
1007
  const headHandler = autoHead ? wrapHeadHandler(handler) : void 0;
1007
1008
  for (let p = 0; p < paths.length; p++) {
package/dist/base.mjs CHANGED
@@ -35,6 +35,7 @@ var Elysia = class Elysia {
35
35
  }
36
36
  #compiled;
37
37
  #cachedRoutes;
38
+ #hasMapResponse;
38
39
  constructor(config) {
39
40
  this["~config"] = config;
40
41
  this["~Prefix"] = config?.prefix;
@@ -209,6 +210,7 @@ var Elysia = class Elysia {
209
210
  return this.#onBranch("afterHandle", scopeOrFn, fn);
210
211
  }
211
212
  mapResponse(scopeOrFn, fn) {
213
+ this.#hasMapResponse = true;
212
214
  return this.#onBranch("mapResponse", scopeOrFn, fn);
213
215
  }
214
216
  afterResponse(scopeOrFn, fn) {
@@ -529,6 +531,7 @@ var Elysia = class Elysia {
529
531
  }
530
532
  }
531
533
  const hookChain = app["~hookChain"];
534
+ if (!this.#hasMapResponse && app.#hasMapResponse) this.#hasMapResponse = true;
532
535
  if (app["~ext"]) {
533
536
  const { decorator, store, headers, models, parser, macro, error, hoc, setup, cleanup } = app["~ext"];
534
537
  const ext = this["~ext"] ??= nullObject();
@@ -896,11 +899,9 @@ var Elysia = class Elysia {
896
899
  for (let i = 0; i < length; i++) if (mapMethodBack(this.#history[i][0]) === "HEAD") (explicitHead ??= /* @__PURE__ */ new Set()).add(this.#history[i][1]);
897
900
  }
898
901
  const wrapHeadHandler = Elysia.#wrapHeadHandler;
899
- const strict = !!this["~config"]?.strictPath;
900
- const routerOptions = strict ? void 0 : { loosePath: true };
901
- const getRouter = () => this["~router"] ??= new Memoirist(routerOptions);
902
+ const preferLoosePath = this["~config"]?.strictPath !== true;
902
903
  let explicitPaths;
903
- if (!strict && this["~config"]?.distinctPath) {
904
+ if (preferLoosePath && this["~config"]?.distinctPath) {
904
905
  explicitPaths = /* @__PURE__ */ new Map();
905
906
  for (let i = 0; i < length; i++) {
906
907
  const route = this.#history[i];
@@ -923,7 +924,7 @@ var Elysia = class Elysia {
923
924
  const ws = buildWSRoute(route, this);
924
925
  const handler = ws[0];
925
926
  const options = ws[1];
926
- if (isDynamicRegex.test(path)) getRouter().add("WS", path, handler, false);
927
+ if (isDynamicRegex.test(path)) (this["~router"] ??= new Memoirist({ loosePath: preferLoosePath })).add("WS", path, handler, false);
927
928
  else {
928
929
  this.#initMap();
929
930
  const wsMap = this["~map"]["WS"] ??= nullObject();
@@ -950,7 +951,7 @@ var Elysia = class Elysia {
950
951
  let staticResponse;
951
952
  const maybeStatic = buildStatic && typeof route[2] !== "function";
952
953
  if (maybeStatic) {
953
- staticResponse = buildNativeStaticResponse(route, this);
954
+ staticResponse = buildNativeStaticResponse(route, this, this.#hasMapResponse);
954
955
  if (staticResponse) {
955
956
  const target = this["~staticResponse"] ??= {
956
957
  GET: void 0,
@@ -961,17 +962,17 @@ var Elysia = class Elysia {
961
962
  HEAD: void 0,
962
963
  OPTIONS: void 0
963
964
  };
964
- (target[path] ??= nullObject())[method] = staticResponse;
965
+ (target[method] ??= nullObject())[path] = staticResponse;
965
966
  if (!this["~config"]?.strictPath) {
966
967
  const loose = getLoosePath(path);
967
- if (!explicitPaths?.get(method)?.has(loose)) (target[loose] ??= nullObject())[method] = staticResponse;
968
+ if (!explicitPaths?.get(method)?.has(loose)) (target[method] ??= nullObject())[loose] = staticResponse;
968
969
  }
969
970
  }
970
971
  }
971
972
  const sharedStatic = maybeStatic && staticResponse instanceof Response ? staticResponse : void 0;
972
973
  const autoHead = enableAutoHead && method === "GET" && !explicitHead?.has(path);
973
974
  const isDynamic = isDynamicRegex.test(path);
974
- const registerLoose = !isDynamic && !strict && (path.length === 0 || path.charCodeAt(path.length - 1) === 47);
975
+ const registerLoose = !isDynamic && preferLoosePath && (path.length === 0 || path.charCodeAt(path.length - 1) === 47);
975
976
  const explicitMain = registerLoose ? explicitPaths?.get(method) : void 0;
976
977
  if (!isDynamic && !needEncodeRegex.test(path) && !registerLoose) {
977
978
  const map = methods[method] ??= nullObject();
@@ -998,7 +999,7 @@ var Elysia = class Elysia {
998
999
  }
999
1000
  }
1000
1001
  if (isDynamic) {
1001
- const router = getRouter();
1002
+ const router = this["~router"] ??= new Memoirist({ loosePath: preferLoosePath });
1002
1003
  const handler = this.handler(i, precompile, void 0, sharedStatic);
1003
1004
  const headHandler = autoHead ? wrapHeadHandler(handler) : void 0;
1004
1005
  for (let p = 0; p < paths.length; p++) {
@@ -4,7 +4,7 @@ import { AnyElysia } from "../../base.js";
4
4
  import { setCaptureHeaderShorthand } from "./jit.js";
5
5
 
6
6
  //#region src/compile/handler/index.d.ts
7
- declare function buildNativeStaticResponse([,, handler, instance, localHook, appHook, inheritedChain]: InternalRoute, root: AnyElysia): Response | Promise<Response> | undefined;
7
+ declare function buildNativeStaticResponse([,, handler, instance, localHook, appHook, inheritedChain]: InternalRoute, root: AnyElysia, hasMapResponse?: boolean): Response | Promise<Response> | undefined;
8
8
  declare function composeRouteHook(instance: AnyElysia, localHook: Partial<AnyLocalHook> | undefined, appHook: ChainNode | undefined, inheritedChain: ChainNode | undefined, root: AnyElysia): AnyLocalHook | undefined;
9
9
  declare function compileHandler([_method, path, handler, instance, localHook, appHook, inheritedChain]: InternalRoute, root: AnyElysia, precomputedStatic?: Response): CompiledHandler;
10
10
  //#endregion
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_utils = require('../../utils.js');
3
+ const require_context = require('../../context.js');
3
4
  const require_compile_aot = require('../aot.js');
4
5
  const require_compile_handler_params = require('./params.js');
5
6
  const require_compile_handler_jit = require('./jit.js');
@@ -111,17 +112,25 @@ function composeRootHook(root, inheritedChain) {
111
112
  if (!locals) return inherited;
112
113
  return require_utils.mergeHook(inherited, locals);
113
114
  }
114
- function buildNativeStaticResponse([, , handler, instance, localHook, appHook, inheritedChain], root) {
115
- if (typeof handler === "function") return;
116
- if (handler instanceof Error) return;
115
+ function buildNativeStaticResponse([, , handler, instance, localHook, appHook, inheritedChain], root, hasMapResponse) {
116
+ if (typeof handler === "function" || handler instanceof Error) return;
117
117
  const adapter = root["~config"]?.adapter ?? require_adapter_constants.defaultAdapter;
118
- if (localHook) root["~applyMacro"](localHook);
119
- resolveChainMacros(root, appHook);
120
- if (inheritedChain) resolveChainMacros(root, inheritedChain);
121
- const hook = applyHook(localHook, require_utils.flattenChainMemo(root, appHook), instance !== root ? composeRootHook(root, inheritedChain) : void 0, true);
122
- const has = (v) => Array.isArray(v) ? v.length > 0 : !!v;
123
- if (has(hook?.parse) || has(hook?.transform) || has(hook?.beforeHandle) || has(hook?.afterHandle) || has(hook?.mapResponse) || has(hook?.afterResponse) || has(hook?.trace)) return;
124
- if (hook?.body || hook?.query || hook?.params || hook?.headers || hook?.cookie || (hook?.schemas)?.length) return;
118
+ if (hasMapResponse) {
119
+ if (localHook) root["~applyMacro"](localHook);
120
+ resolveChainMacros(root, appHook);
121
+ if (inheritedChain) resolveChainMacros(root, inheritedChain);
122
+ const hook = applyHook(localHook, require_utils.flattenChainMemo(root, appHook), instance !== root ? composeRootHook(root, inheritedChain) : void 0, true);
123
+ if (hook?.mapResponse) {
124
+ const context = new (require_context.createContext(root))(new Request("http://e.ly"));
125
+ context.responseValue = handler;
126
+ for (let i = 0; i < hook.mapResponse.length; i++) {
127
+ const fn = hook.mapResponse[i];
128
+ if (typeof fn !== "function") continue;
129
+ const mapped = fn(context);
130
+ if (mapped instanceof Response || mapped instanceof Promise) return mapped;
131
+ }
132
+ }
133
+ }
125
134
  const rootHeaders = root["~ext"]?.headers;
126
135
  const buildSet = () => ({ headers: rootHeaders ? Object.assign(require_utils.nullObject(), rootHeaders) : require_utils.nullObject() });
127
136
  if (handler instanceof Promise) return handler.then((resolved) => {
@@ -131,8 +140,7 @@ function buildNativeStaticResponse([, , handler, instance, localHook, appHook, i
131
140
  });
132
141
  if (handler instanceof Response && !rootHeaders) return handler;
133
142
  const mapped = adapter.response.map(handler, buildSet());
134
- if (mapped instanceof Response) return mapped;
135
- if (mapped instanceof Promise) return mapped;
143
+ if (mapped instanceof Response || mapped instanceof Promise) return mapped;
136
144
  }
137
145
  function toArray(name, hook) {
138
146
  if (typeof hook[name] === "function") hook[name] = [hook[name]];
@@ -1,4 +1,5 @@
1
1
  import { cloneHook, eventProperties, flattenChain, flattenChainMemo, fnOrigin, isLocalScope, mapMethodBack, mergeHook, nullObject } from "../../utils.mjs";
2
+ import { createContext } from "../../context.mjs";
2
3
  import { Compiled } from "../aot.mjs";
3
4
  import { resolveHandlerParams } from "./params.mjs";
4
5
  import { compileHandlerJit, setCaptureHeaderShorthand } from "./jit.mjs";
@@ -110,17 +111,25 @@ function composeRootHook(root, inheritedChain) {
110
111
  if (!locals) return inherited;
111
112
  return mergeHook(inherited, locals);
112
113
  }
113
- function buildNativeStaticResponse([, , handler, instance, localHook, appHook, inheritedChain], root) {
114
- if (typeof handler === "function") return;
115
- if (handler instanceof Error) return;
114
+ function buildNativeStaticResponse([, , handler, instance, localHook, appHook, inheritedChain], root, hasMapResponse) {
115
+ if (typeof handler === "function" || handler instanceof Error) return;
116
116
  const adapter = root["~config"]?.adapter ?? defaultAdapter;
117
- if (localHook) root["~applyMacro"](localHook);
118
- resolveChainMacros(root, appHook);
119
- if (inheritedChain) resolveChainMacros(root, inheritedChain);
120
- const hook = applyHook(localHook, flattenChainMemo(root, appHook), instance !== root ? composeRootHook(root, inheritedChain) : void 0, true);
121
- const has = (v) => Array.isArray(v) ? v.length > 0 : !!v;
122
- if (has(hook?.parse) || has(hook?.transform) || has(hook?.beforeHandle) || has(hook?.afterHandle) || has(hook?.mapResponse) || has(hook?.afterResponse) || has(hook?.trace)) return;
123
- if (hook?.body || hook?.query || hook?.params || hook?.headers || hook?.cookie || (hook?.schemas)?.length) return;
117
+ if (hasMapResponse) {
118
+ if (localHook) root["~applyMacro"](localHook);
119
+ resolveChainMacros(root, appHook);
120
+ if (inheritedChain) resolveChainMacros(root, inheritedChain);
121
+ const hook = applyHook(localHook, flattenChainMemo(root, appHook), instance !== root ? composeRootHook(root, inheritedChain) : void 0, true);
122
+ if (hook?.mapResponse) {
123
+ const context = new (createContext(root))(new Request("http://e.ly"));
124
+ context.responseValue = handler;
125
+ for (let i = 0; i < hook.mapResponse.length; i++) {
126
+ const fn = hook.mapResponse[i];
127
+ if (typeof fn !== "function") continue;
128
+ const mapped = fn(context);
129
+ if (mapped instanceof Response || mapped instanceof Promise) return mapped;
130
+ }
131
+ }
132
+ }
124
133
  const rootHeaders = root["~ext"]?.headers;
125
134
  const buildSet = () => ({ headers: rootHeaders ? Object.assign(nullObject(), rootHeaders) : nullObject() });
126
135
  if (handler instanceof Promise) return handler.then((resolved) => {
@@ -130,8 +139,7 @@ function buildNativeStaticResponse([, , handler, instance, localHook, appHook, i
130
139
  });
131
140
  if (handler instanceof Response && !rootHeaders) return handler;
132
141
  const mapped = adapter.response.map(handler, buildSet());
133
- if (mapped instanceof Response) return mapped;
134
- if (mapped instanceof Promise) return mapped;
142
+ if (mapped instanceof Response || mapped instanceof Promise) return mapped;
135
143
  }
136
144
  function toArray(name, hook) {
137
145
  if (typeof hook[name] === "function") hook[name] = [hook[name]];
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import { StatusMap, StatusMapBack } from "./constants.js";
2
2
  import { ElysiaError, ElysiaStatus, InternalServerError, InvalidCookieSignature, NotFound, ParseError, SelectiveStatus, ValidationError, status, validationDetail } from "./error.js";
3
- import { ElysiaFile, file } from "./universal/file.js";
4
3
  import { BaseCookie, CookieOptions } from "./cookie/types.js";
5
4
  import { Cookie } from "./cookie/cookie.js";
5
+ import { ElysiaFile, file } from "./universal/file.js";
6
+ import { env } from "./universal/env.js";
7
+ import { Server } from "./universal/server.js";
8
+ import { HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, RouteSchema, SSEPayload, UnwrapRoute, UnwrapSchema } from "./types.js";
6
9
  import { AnySchema, BaseSchema, StandardJSONSchemaV1Like, StandardSchemaV1Like } from "./type/types.js";
7
10
  import { TCookieField, TCookieObject } from "./type/elysia/cookie.js";
8
11
  import { FileTypeDetector, fileType, setFileTypeDetector } from "./type/elysia/file-type.js";
@@ -12,9 +15,6 @@ import { Capture, Compiled } from "./compile/aot.js";
12
15
  import { MultiValidator, StandardValidator, Validator } from "./validator/index.js";
13
16
  import { TypeBoxValidator } from "./type/validator/index.js";
14
17
  import { TypeSystem, t } from "./type/index.js";
15
- import { env } from "./universal/env.js";
16
- import { Server } from "./universal/server.js";
17
- import { HTTPHeaders, InputSchema, Macro, MacroToContext, MacroToProperty, RouteSchema, SSEPayload, UnwrapRoute, UnwrapSchema } from "./types.js";
18
18
  import { form, prefix, redirect, sse } from "./utils.js";
19
19
  import { Context, ErrorContext, createBaseContext, createContext } from "./context.js";
20
20
  import { Elysia } from "./base.js";
@@ -1,16 +1,16 @@
1
- import { Intersect as Intersect$2 } from "./elysia/intersect.js";
1
+ import { Intersect as Intersect$1 } from "./elysia/intersect.js";
2
2
  import { applyCoercions as applyCoercions$1, coerceBody as coerceBody$1, coerceFormData as coerceFormData$1, coerceQuery as coerceQuery$1, coerceRoot as coerceRoot$1, coerceStringToStructure as coerceStringToStructure$1 } from "./coerce.js";
3
3
  import { hasTypes as hasTypes$1 } from "./utils.js";
4
4
  import { TypeBoxValidatorCache as TypeBoxValidatorCache$1 } from "./validator/validator-cache.js";
5
5
  import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
6
- import { Compile as Compile$1 } from "typebox/compile";
7
6
  import { Ref as Ref$1, TAny, TSchema } from "typebox/type";
8
- import { Decode as Decode$2, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
7
+ import { Compile as Compile$1 } from "typebox/compile";
8
+ import { Decode as Decode$1, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
9
9
 
10
10
  //#region src/type/bridge.d.ts
11
11
  interface TypeboxModule {
12
12
  Compile: typeof Compile$1;
13
- Decode: typeof Decode$2;
13
+ Decode: typeof Decode$1;
14
14
  applyCoercions: typeof applyCoercions$1;
15
15
  TypeBoxValidator: TypeBoxValidator$1;
16
16
  TypeBoxValidatorCache: TypeBoxValidatorCache$1;
@@ -21,12 +21,12 @@ interface TypeboxModule {
21
21
  coerceBody: typeof coerceBody$1;
22
22
  hasTypes: typeof hasTypes$1;
23
23
  HasCodec: typeof HasCodec$1;
24
- Intersect: typeof Intersect$2;
24
+ Intersect: typeof Intersect$1;
25
25
  Default: typeof Default$1;
26
26
  Ref: typeof Ref$1;
27
27
  }
28
28
  declare let Compile: typeof Compile$1;
29
- declare let Decode: typeof Decode$2;
29
+ declare let Decode: typeof Decode$1;
30
30
  declare let applyCoercions: typeof applyCoercions$1;
31
31
  declare let TypeBoxValidator: TypeBoxValidator$1;
32
32
  type TypeBoxValidator<T extends TSchema = TAny> = TypeBoxValidator$1<T>;
@@ -39,7 +39,7 @@ declare let coerceStringToStructure: typeof coerceStringToStructure$1;
39
39
  declare let coerceBody: typeof coerceBody$1;
40
40
  declare let hasTypes: typeof hasTypes$1;
41
41
  declare let HasCodec: typeof HasCodec$1;
42
- declare let Intersect: typeof Intersect$2;
42
+ declare let Intersect: typeof Intersect$1;
43
43
  declare let Default: typeof Default$1;
44
44
  declare let Ref: typeof Ref$1;
45
45
  declare function useTypebox(mod: TypeboxModule): void;
@@ -1,5 +1,5 @@
1
- import { FileType, FileUnit } from "../types.js";
2
1
  import { MaybeArray, MaybePromise } from "../../types.js";
2
+ import { FileType, FileUnit } from "../types.js";
3
3
 
4
4
  //#region src/type/elysia/file-type.d.ts
5
5
  type FileTypeDetector = (file: File) => MaybePromise<string | {
@@ -1,9 +1,9 @@
1
1
  import { ELYSIA_TYPES } from "./constants.js";
2
2
  import { CookieOptions } from "../cookie/types.js";
3
3
  import { MaybeArray } from "../types.js";
4
- import { Validator } from "typebox/schema";
5
4
  import { TObjectOptions, TSchemaOptions } from "typebox";
6
5
  import { TLocalizedValidationError } from "typebox/error";
6
+ import { Validator } from "typebox/schema";
7
7
 
8
8
  //#region src/type/types.d.ts
9
9
  type FileUnit = number | `${number}${'k' | 'm'}`;
@@ -1,9 +1,9 @@
1
+ import { MaybePromise } from "../../types.js";
1
2
  import { Validator as Validator$1, ValidatorOptions } from "../../validator/index.js";
2
3
  import { TypeBoxValidatorCache } from "./validator-cache.js";
3
- import { MaybePromise } from "../../types.js";
4
4
  import { Static, StaticDecode, StaticEncode, TAny, TSchema } from "typebox/type";
5
- import { Validator } from "typebox/schema";
6
5
  import { TLocalizedValidationError } from "typebox/error";
6
+ import { Validator } from "typebox/schema";
7
7
 
8
8
  //#region src/type/validator/index.d.ts
9
9
  declare function shallowMergeObjects(members: any[]): TSchema | null;
package/dist/types.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  import { MethodMap, StatusMapBack } from "./constants.js";
2
2
  import { ElysiaError, ElysiaStatus } from "./error.js";
3
+ import { CookieOptions } from "./cookie/types.js";
3
4
  import { ElysiaFile } from "./universal/file.js";
4
5
  import { TraceEvent, TraceListener } from "./trace.js";
5
- import { CookieOptions } from "./cookie/types.js";
6
- import { AnySchema, StandardSchemaV1Like, TypeBoxSchema } from "./type/types.js";
7
6
  import { Serve } from "./universal/server.js";
7
+ import { AnySchema, StandardSchemaV1Like, TypeBoxSchema } from "./type/types.js";
8
8
  import { ChainNode } from "./utils.js";
9
9
  import { Context, ErrorContext, LifecycleContext, PreContext } from "./context.js";
10
10
  import { WebSocketHandler } from "./ws/types.js";
11
11
  import { AnyElysia, Elysia } from "./base.js";
12
12
  import { ElysiaAdapter } from "./adapter/index.js";
13
- import { Instruction } from "exact-mirror";
14
13
  import { Static, StaticDecode, StaticEncode, TIntersect, TObject, TSchema } from "typebox";
14
+ import { Instruction } from "exact-mirror";
15
15
  import { OpenAPIV3 } from "openapi-types";
16
16
 
17
17
  //#region src/types.d.ts
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MethodMap } from "./constants.js";
2
- import { AnySchema, StandardSchemaV1Like } from "./type/types.js";
3
2
  import { AnyLocalHook, AppHook, ElysiaFormData, EventFn, EventScope, GuardSchemaType, InputSchema, Macro, MaybeArray, Prettify, SSEPayload } from "./types.js";
3
+ import { AnySchema, StandardSchemaV1Like } from "./type/types.js";
4
4
  import { Context } from "./context.js";
5
5
 
6
6
  //#region src/utils.d.ts
@@ -1,8 +1,8 @@
1
+ import { ElysiaConfig, MaybePromise } from "../types.js";
1
2
  import { AnySchema, StandardSchemaV1Like } from "../type/types.js";
2
3
  import { CoerceOption } from "../type/coerce.js";
3
4
  import { ValidatorSlot } from "../compile/aot.js";
4
5
  import { TypeBoxValidator } from "../type/bridge.js";
5
- import { ElysiaConfig, MaybePromise } from "../types.js";
6
6
  import { TSchema } from "typebox/type";
7
7
  import { TLocalizedValidationError } from "typebox/error";
8
8
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elysia",
3
3
  "description": "Ergonomic Framework for Human",
4
- "version": "2.0.0-exp.19",
4
+ "version": "2.0.0-exp.21",
5
5
  "author": {
6
6
  "name": "saltyAom",
7
7
  "url": "https://github.com/SaltyAom",