elysia 2.0.0-beta.17 → 2.0.0-beta.19

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/package.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region package.json
3
- var version = "2.0.0-beta.17";
3
+ var version = "2.0.0-beta.19";
4
4
 
5
5
  //#endregion
6
6
  Object.defineProperty(exports, 'version', {
package/dist/package.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "2.0.0-beta.17";
2
+ var version = "2.0.0-beta.19";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -95,7 +95,7 @@ interface ElysiaAotOptions {
95
95
  }
96
96
  declare const resolveEntry: (entry: string) => string;
97
97
  /** @internal Resolve the package condition used to evaluate an AOT entry. */
98
- declare const resolveEntryModuleKind: (entry: string) => "esm" | "cjs";
98
+ declare const resolveEntryModuleKind: (entry: string) => "cjs" | "esm";
99
99
  /** Runtime handler-JIT module a strip build can replace with a throwing stub. */
100
100
  interface StubPlan {
101
101
  /** Stub the internal handler codegen module. */
@@ -52,7 +52,7 @@ const createAotPluginHooks = (entry, options, moduleCondition = require_plugin_a
52
52
  if (key === "staticClone" && (!isElysiaModule(cleanId) || !/^(dist|src)\/compile\/handler\/static-clone-resolver\.(m?js|ts)$/.test(toPosix(cleanId).slice(packageRoot.length + 1)))) continue;
53
53
  for (const { filter, source: stubSource } of require_plugin_aot_core.STUB_SOURCES[key]) if (filter.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(stubSource, cleanId);
54
54
  }
55
- if (require_plugin_aot_core.TYPEBOX_REQUIRE_FILTER.test(cleanId)) return `export const requireTypebox = () => undefined\n`;
55
+ if (require_plugin_aot_core.TYPEBOX_REQUIRE_FILTER.test(cleanId)) return `export const requireTypebox = () => undefined\nexport const importTypebox = () => undefined\n`;
56
56
  if (require_plugin_aot_core.EXACT_MIRROR_REQUIRE_FILTER.test(cleanId)) return `export const requireExactMirror = () => undefined\n`;
57
57
  if (require_plugin_aot_core.TYPEBOX_TYPE_FILTER.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(`export * from './typebox-type-live'\n`, cleanId);
58
58
  if (stub.adapter !== false && require_plugin_aot_core.ADAPTER_CONSTANTS_FILTER.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(require_plugin_aot_core.adapterConstantsSource(stub.adapter), cleanId);
@@ -51,7 +51,7 @@ const createAotPluginHooks = (entry, options, moduleCondition = resolveEntryModu
51
51
  if (key === "staticClone" && (!isElysiaModule(cleanId) || !/^(dist|src)\/compile\/handler\/static-clone-resolver\.(m?js|ts)$/.test(toPosix(cleanId).slice(packageRoot.length + 1)))) continue;
52
52
  for (const { filter, source: stubSource } of STUB_SOURCES[key]) if (filter.test(cleanId)) return alignStubExtensions(stubSource, cleanId);
53
53
  }
54
- if (TYPEBOX_REQUIRE_FILTER.test(cleanId)) return `export const requireTypebox = () => undefined\n`;
54
+ if (TYPEBOX_REQUIRE_FILTER.test(cleanId)) return `export const requireTypebox = () => undefined\nexport const importTypebox = () => undefined\n`;
55
55
  if (EXACT_MIRROR_REQUIRE_FILTER.test(cleanId)) return `export const requireExactMirror = () => undefined\n`;
56
56
  if (TYPEBOX_TYPE_FILTER.test(cleanId)) return alignStubExtensions(`export * from './typebox-type-live'\n`, cleanId);
57
57
  if (stub.adapter !== false && ADAPTER_CONSTANTS_FILTER.test(cleanId)) return alignStubExtensions(adapterConstantsSource(stub.adapter), cleanId);
@@ -5,8 +5,8 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
5
5
  import { TypeBoxValidator } from "./validator/index.js";
6
6
  import { applyCoercions, coerceBody, coerceFormData, coerceQuery, coerceRoot, coerceStringToStructure } from "./coerce.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;
@@ -6,9 +6,9 @@ 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_system = require("typebox/system");
10
- let typebox_value = require("typebox/value");
11
9
  let typebox_compile = require("typebox/compile");
10
+ let typebox_value = require("typebox/value");
11
+ let typebox_system = require("typebox/system");
12
12
 
13
13
  //#region src/type/bridge-live.ts
14
14
  typebox_system.Settings.Set({ unionPrioritySort: false });
@@ -4,9 +4,9 @@ import { TypeBoxValidatorCache, mayHaveFileType } from "./validator/validator-ca
4
4
  import { TypeBoxValidator } from "./validator/index.mjs";
5
5
  import { Intersect } from "./elysia/intersect.mjs";
6
6
  import { Ref } from "typebox/type";
7
- import { Settings } from "typebox/system";
8
- import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
9
7
  import { Compile } from "typebox/compile";
8
+ import { Check, Clone, Create, Decode, HasCodec } from "typebox/value";
9
+ import { Settings } from "typebox/system";
10
10
 
11
11
  //#region src/type/bridge-live.ts
12
12
  Settings.Set({ unionPrioritySort: false });
@@ -4,8 +4,8 @@ import { TypeBoxValidatorCache as TypeBoxValidatorCache$1, mayHaveFileType as ma
4
4
  import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
5
5
  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";
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 {
@@ -16,6 +16,7 @@ const require_type_elysia_integer_string = require('./elysia/integer-string.js')
16
16
  const require_type_validator_index = require('./validator/index.js');
17
17
  const require_type_elysia_intersect = require('./elysia/intersect.js');
18
18
  const require_type_compat = require('./compat.js');
19
+ const require_type_typebox_system_require = require('./typebox-system-require.js');
19
20
  const require_type_elysia_accelerate = require('./elysia/accelerate.js');
20
21
  const require_type_elysia_array_buffer = require('./elysia/array-buffer.js');
21
22
  const require_type_elysia_cookie = require('./elysia/cookie.js');
@@ -53,6 +54,12 @@ const lazyNamespace = (resolve, overrides, onRead) => new Proxy(overrides, {
53
54
  if (Object.hasOwn(target, key)) return Reflect.getOwnPropertyDescriptor(target, key);
54
55
  const ns = resolve();
55
56
  if (!Object.hasOwn(ns, key)) return;
57
+ const get = Reflect.getOwnPropertyDescriptor(ns, key).get;
58
+ if (get) return {
59
+ get,
60
+ enumerable: true,
61
+ configurable: true
62
+ };
56
63
  return {
57
64
  value: ns[key],
58
65
  enumerable: true,
@@ -100,7 +107,7 @@ const t = lazyNamespace(() => require_type_typebox_type.loadTypeNamespace().type
100
107
  * handed out, keeping a user's explicit `TypeSystem.Settings.Set(...)` last —
101
108
  * the ordering the eager `setupTypebox()` used to provide
102
109
  */
103
- const TypeSystem = lazyNamespace(() => require_type_typebox_type.loadTypeNamespace().system.System, Object.create(null));
110
+ const TypeSystem = lazyNamespace(() => require_type_typebox_system_require.typeSystem(require_type_typebox_type.loadTypeNamespace().system), Object.create(null));
104
111
 
105
112
  //#endregion
106
113
  exports.TypeBoxValidator = require_type_validator_index.TypeBoxValidator;
@@ -15,6 +15,7 @@ import { IntegerString } from "./elysia/integer-string.mjs";
15
15
  import { TypeBoxValidator } from "./validator/index.mjs";
16
16
  import { Intersect } from "./elysia/intersect.mjs";
17
17
  import { setupTypebox } from "./compat.mjs";
18
+ import { typeSystem } from "./typebox-system-require.mjs";
18
19
  import { Accelerate } from "./elysia/accelerate.mjs";
19
20
  import { ArrayBufferType } from "./elysia/array-buffer.mjs";
20
21
  import { Cookie } from "./elysia/cookie.mjs";
@@ -52,6 +53,12 @@ const lazyNamespace = (resolve, overrides, onRead) => new Proxy(overrides, {
52
53
  if (Object.hasOwn(target, key)) return Reflect.getOwnPropertyDescriptor(target, key);
53
54
  const ns = resolve();
54
55
  if (!Object.hasOwn(ns, key)) return;
56
+ const get = Reflect.getOwnPropertyDescriptor(ns, key).get;
57
+ if (get) return {
58
+ get,
59
+ enumerable: true,
60
+ configurable: true
61
+ };
55
62
  return {
56
63
  value: ns[key],
57
64
  enumerable: true,
@@ -99,7 +106,7 @@ const t = lazyNamespace(() => loadTypeNamespace().type, {
99
106
  * handed out, keeping a user's explicit `TypeSystem.Settings.Set(...)` last —
100
107
  * the ordering the eager `setupTypebox()` used to provide
101
108
  */
102
- const TypeSystem = lazyNamespace(() => loadTypeNamespace().system.System, Object.create(null));
109
+ const TypeSystem = lazyNamespace(() => typeSystem(loadTypeNamespace().system), Object.create(null));
103
110
 
104
111
  //#endregion
105
112
  export { TypeBoxValidator, TypeSystem, fileType, setFileTypeDetector, setupTypebox, t };
@@ -0,0 +1,2 @@
1
+ import { Arguments, Environment, Hashing, Memory, Settings } from "typebox/system";
2
+ export { Arguments, Environment, Hashing, Memory, Settings };
@@ -0,0 +1,34 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.js');
3
+ let typebox_system = require("typebox/system");
4
+
5
+ Object.defineProperty(exports, 'Arguments', {
6
+ enumerable: true,
7
+ get: function () {
8
+ return typebox_system.Arguments;
9
+ }
10
+ });
11
+ Object.defineProperty(exports, 'Environment', {
12
+ enumerable: true,
13
+ get: function () {
14
+ return typebox_system.Environment;
15
+ }
16
+ });
17
+ Object.defineProperty(exports, 'Hashing', {
18
+ enumerable: true,
19
+ get: function () {
20
+ return typebox_system.Hashing;
21
+ }
22
+ });
23
+ Object.defineProperty(exports, 'Memory', {
24
+ enumerable: true,
25
+ get: function () {
26
+ return typebox_system.Memory;
27
+ }
28
+ });
29
+ Object.defineProperty(exports, 'Settings', {
30
+ enumerable: true,
31
+ get: function () {
32
+ return typebox_system.Settings;
33
+ }
34
+ });
@@ -0,0 +1,3 @@
1
+ import { Arguments, Environment, Hashing, Memory, Settings } from "typebox/system";
2
+
3
+ export { Arguments, Environment, Hashing, Memory, Settings };
@@ -0,0 +1,7 @@
1
+ import { TypeboxTypeNamespaces } from "./typebox-type.js";
2
+ import { System } from "typebox/system";
3
+
4
+ //#region src/type/typebox-system-require.d.ts
5
+ declare const typeSystem: (system: TypeboxTypeNamespaces["system"]) => typeof System;
6
+ //#endregion
7
+ export { typeSystem };
@@ -0,0 +1,24 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_type_sync_require = require('./sync-require.js');
3
+
4
+ //#region src/type/typebox-system-require.ts
5
+ const requireLocale = () => {
6
+ try {
7
+ const req = require_type_sync_require.syncRequire({}, require("url").pathToFileURL(__filename).href);
8
+ if (req) return req("typebox/system").System.Locale;
9
+ } catch {}
10
+ throw new Error("TypeSystem.Locale isn't bundled: it carries every locale table. Register it with setupTypebox({ typebox: { type, system } }) using `import * as system from 'typebox/system'`, or build with the AOT plugin.");
11
+ };
12
+ const typeSystem = (system) => system.System ?? Object.defineProperty({
13
+ Arguments: system.Arguments,
14
+ Environment: system.Environment,
15
+ Hashing: system.Hashing,
16
+ Memory: system.Memory,
17
+ Settings: system.Settings
18
+ }, "Locale", {
19
+ get: requireLocale,
20
+ enumerable: true
21
+ });
22
+
23
+ //#endregion
24
+ exports.typeSystem = typeSystem;
@@ -0,0 +1,23 @@
1
+ import { syncRequire } from "./sync-require.mjs";
2
+
3
+ //#region src/type/typebox-system-require.ts
4
+ const requireLocale = () => {
5
+ try {
6
+ const req = syncRequire(import.meta, import.meta.url);
7
+ if (req) return req("typebox/system").System.Locale;
8
+ } catch {}
9
+ throw new Error("TypeSystem.Locale isn't bundled: it carries every locale table. Register it with setupTypebox({ typebox: { type, system } }) using `import * as system from 'typebox/system'`, or build with the AOT plugin.");
10
+ };
11
+ const typeSystem = (system) => system.System ?? Object.defineProperty({
12
+ Arguments: system.Arguments,
13
+ Environment: system.Environment,
14
+ Hashing: system.Hashing,
15
+ Memory: system.Memory,
16
+ Settings: system.Settings
17
+ }, "Locale", {
18
+ get: requireLocale,
19
+ enumerable: true
20
+ });
21
+
22
+ //#endregion
23
+ export { typeSystem };
@@ -5,7 +5,7 @@ import * as _$typebox_system0 from "typebox/system";
5
5
  //#region src/type/typebox-type.d.ts
6
6
  interface TypeboxTypeNamespaces {
7
7
  type: typeof _$typebox_type0;
8
- system: typeof _$typebox_system0;
8
+ system: Pick<typeof _$typebox_system0, 'Arguments' | 'Environment' | 'Hashing' | 'Memory' | 'Settings'> & Partial<Pick<typeof _$typebox_system0, 'System'>>;
9
9
  }
10
10
  declare const loadTypeNamespace: () => TypeboxTypeNamespaces;
11
11
  declare const markTypeUsed: () => void;
@@ -18,7 +18,7 @@ function resolveNamespaces() {
18
18
  if (typeof require === "function") try {
19
19
  return {
20
20
  type: require("typebox/type"),
21
- system: require("typebox/system")
21
+ system: require("./typebox-system-lite.mjs")
22
22
  };
23
23
  } catch {}
24
24
  const req = require_type_sync_require.syncRequire({}, require("url").pathToFileURL(__filename).href);
@@ -17,7 +17,7 @@ function resolveNamespaces() {
17
17
  if (typeof require === "function") try {
18
18
  return {
19
19
  type: require("typebox/type"),
20
- system: require("typebox/system")
20
+ system: require("./typebox-system-lite.mjs")
21
21
  };
22
22
  } catch {}
23
23
  const req = syncRequire(import.meta, import.meta.url);
@@ -1,7 +1,7 @@
1
1
  import { TypeboxNamespaces } from "./typebox-value.js";
2
+ import { Compile } from "typebox/compile";
2
3
  import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
3
4
  import { Build, Compile as SchemaCompile } from "typebox/schema";
4
- import { Compile } from "typebox/compile";
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_system = require("typebox/system");
3
+ let typebox_compile = require("typebox/compile");
4
4
  let typebox_value = require("typebox/value");
5
+ let typebox_system = require("typebox/system");
5
6
  let typebox_schema = require("typebox/schema");
6
- let typebox_compile = require("typebox/compile");
7
7
 
8
8
  //#region src/type/typebox-value-live.ts
9
9
  typebox_system.Settings.Set({ unionPrioritySort: false });
@@ -1,7 +1,7 @@
1
- import { Settings } from "typebox/system";
1
+ import { Compile } from "typebox/compile";
2
2
  import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
3
+ import { Settings } from "typebox/system";
3
4
  import { Build, Compile as SchemaCompile } from "typebox/schema";
4
- import { Compile } from "typebox/compile";
5
5
 
6
6
  //#region src/type/typebox-value-live.ts
7
7
  Settings.Set({ unionPrioritySort: false });
@@ -0,0 +1,4 @@
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
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile };
@@ -0,0 +1,90 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.js');
3
+ let typebox_compile = require("typebox/compile");
4
+ let typebox_value = require("typebox/value");
5
+ let typebox_schema = require("typebox/schema");
6
+
7
+ Object.defineProperty(exports, 'Build', {
8
+ enumerable: true,
9
+ get: function () {
10
+ return typebox_schema.Build;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, 'Check', {
14
+ enumerable: true,
15
+ get: function () {
16
+ return typebox_value.Check;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, 'Clean', {
20
+ enumerable: true,
21
+ get: function () {
22
+ return typebox_value.Clean;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, 'Clone', {
26
+ enumerable: true,
27
+ get: function () {
28
+ return typebox_value.Clone;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, 'Compile', {
32
+ enumerable: true,
33
+ get: function () {
34
+ return typebox_compile.Compile;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, 'Create', {
38
+ enumerable: true,
39
+ get: function () {
40
+ return typebox_value.Create;
41
+ }
42
+ });
43
+ Object.defineProperty(exports, 'Decode', {
44
+ enumerable: true,
45
+ get: function () {
46
+ return typebox_value.Decode;
47
+ }
48
+ });
49
+ Object.defineProperty(exports, 'DecodeUnsafe', {
50
+ enumerable: true,
51
+ get: function () {
52
+ return typebox_value.DecodeUnsafe;
53
+ }
54
+ });
55
+ Object.defineProperty(exports, 'Default', {
56
+ enumerable: true,
57
+ get: function () {
58
+ return typebox_value.Default;
59
+ }
60
+ });
61
+ Object.defineProperty(exports, 'Encode', {
62
+ enumerable: true,
63
+ get: function () {
64
+ return typebox_value.Encode;
65
+ }
66
+ });
67
+ Object.defineProperty(exports, 'EncodeUnsafe', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return typebox_value.EncodeUnsafe;
71
+ }
72
+ });
73
+ Object.defineProperty(exports, 'Errors', {
74
+ enumerable: true,
75
+ get: function () {
76
+ return typebox_value.Errors;
77
+ }
78
+ });
79
+ Object.defineProperty(exports, 'HasCodec', {
80
+ enumerable: true,
81
+ get: function () {
82
+ return typebox_value.HasCodec;
83
+ }
84
+ });
85
+ Object.defineProperty(exports, 'SchemaCompile', {
86
+ enumerable: true,
87
+ get: function () {
88
+ return typebox_schema.Compile;
89
+ }
90
+ });
@@ -0,0 +1,5 @@
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
+
5
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile };
@@ -1,12 +1,8 @@
1
+ import { TypeboxTypeNamespaces } from "./typebox-type.js";
1
2
  import { TypeboxNamespaces } from "./typebox-value.js";
2
3
 
3
4
  //#region src/type/typebox-value-require.d.ts
4
- /**
5
- * Literal `require` so bundlers embed TypeBox (still evaluated lazily)
6
- *
7
- * The AOT build plugin always stubs this module to `() => undefined`: sealed
8
- * builds must keep TypeBox out, other modes re-route `typebox-value` to `-live`
9
- */
10
5
  declare const requireTypebox: () => TypeboxNamespaces | undefined;
6
+ declare const importTypebox: () => Promise<[TypeboxTypeNamespaces, TypeboxNamespaces]> | undefined;
11
7
  //#endregion
12
- export { requireTypebox };
8
+ export { importTypebox, requireTypebox };
@@ -1,21 +1,28 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  //#region src/type/typebox-value-require.ts
4
- /**
5
- * Literal `require` so bundlers embed TypeBox (still evaluated lazily)
6
- *
7
- * The AOT build plugin always stubs this module to `() => undefined`: sealed
8
- * builds must keep TypeBox out, other modes re-route `typebox-value` to `-live`
9
- */
4
+ const fromOps = (ops) => ({
5
+ value: ops,
6
+ schema: {
7
+ Compile: ops.SchemaCompile,
8
+ Build: ops.Build
9
+ },
10
+ compile: { Compile: ops.Compile }
11
+ });
10
12
  const requireTypebox = () => {
11
13
  if (typeof require === "function") try {
12
- return {
13
- value: require("typebox/value"),
14
- schema: require("typebox/schema"),
15
- compile: require("typebox/compile")
16
- };
14
+ return fromOps(require("./typebox-value-ops.mjs"));
17
15
  } catch {}
18
16
  };
17
+ const importTypebox = () => Promise.all([
18
+ import("typebox/type"),
19
+ import("./typebox-system-lite.mjs"),
20
+ import("./typebox-value-ops.mjs")
21
+ ]).then(([type, system, ops]) => [{
22
+ type,
23
+ system
24
+ }, fromOps(ops)]);
19
25
 
20
26
  //#endregion
27
+ exports.importTypebox = importTypebox;
21
28
  exports.requireTypebox = requireTypebox;
@@ -1,19 +1,25 @@
1
1
  //#region src/type/typebox-value-require.ts
2
- /**
3
- * Literal `require` so bundlers embed TypeBox (still evaluated lazily)
4
- *
5
- * The AOT build plugin always stubs this module to `() => undefined`: sealed
6
- * builds must keep TypeBox out, other modes re-route `typebox-value` to `-live`
7
- */
2
+ const fromOps = (ops) => ({
3
+ value: ops,
4
+ schema: {
5
+ Compile: ops.SchemaCompile,
6
+ Build: ops.Build
7
+ },
8
+ compile: { Compile: ops.Compile }
9
+ });
8
10
  const requireTypebox = () => {
9
11
  if (typeof require === "function") try {
10
- return {
11
- value: require("typebox/value"),
12
- schema: require("typebox/schema"),
13
- compile: require("typebox/compile")
14
- };
12
+ return fromOps(require("./typebox-value-ops.mjs"));
15
13
  } catch {}
16
14
  };
15
+ const importTypebox = () => Promise.all([
16
+ import("typebox/type"),
17
+ import("./typebox-system-lite.mjs"),
18
+ import("./typebox-value-ops.mjs")
19
+ ]).then(([type, system, ops]) => [{
20
+ type,
21
+ system
22
+ }, fromOps(ops)]);
17
23
 
18
24
  //#endregion
19
- export { requireTypebox };
25
+ export { importTypebox, requireTypebox };
@@ -1,15 +1,15 @@
1
+ import * as _$typebox_compile0 from "typebox/compile";
2
+ import { Compile as Compile$1 } from "typebox/compile";
1
3
  import * as _$typebox_value0 from "typebox/value";
2
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";
3
5
  import * as _$typebox_schema0 from "typebox/schema";
4
- import { Build as Build$1, Compile as Compile$1 } from "typebox/schema";
5
- import * as _$typebox_compile0 from "typebox/compile";
6
- import { Compile as Compile$2 } from "typebox/compile";
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 {
10
- value: typeof _$typebox_value0;
11
- schema: typeof _$typebox_schema0;
12
- compile: typeof _$typebox_compile0;
10
+ value: Pick<typeof _$typebox_value0, 'Check' | 'Clean' | 'Clone' | 'Create' | 'Decode' | 'DecodeUnsafe' | 'Default' | 'Encode' | 'EncodeUnsafe' | 'Errors' | 'HasCodec'>;
11
+ schema: Pick<typeof _$typebox_schema0, 'Compile' | 'Build'>;
12
+ compile: Pick<typeof _$typebox_compile0, 'Compile'>;
13
13
  }
14
14
  /**
15
15
  * Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
@@ -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$1;
30
+ declare let SchemaCompile: typeof Compile$2;
31
31
  declare let Build: typeof Build$1;
32
- declare let Compile: typeof Compile$2;
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 };
@@ -15,28 +15,10 @@ function load() {
15
15
  }
16
16
  function preloadTypebox() {
17
17
  if (loaded || !require_type_typebox_type.isTypeUsed()) return;
18
- const load = (name) => import(
19
- /* webpackIgnore: true */
20
- /* @vite-ignore */
21
- "typebox/" + name
22
- );
23
- return Promise.all([
24
- load("type"),
25
- load("system"),
26
- load("value"),
27
- load("schema"),
28
- load("compile")
29
- ]).then(([type, system, value, schema, compile]) => {
18
+ return require_type_typebox_value_require.importTypebox()?.then(([typeSide, valueSide]) => {
30
19
  if (loaded) return;
31
- if (!require_type_typebox_type.isTypeNamespaceLoaded()) require_type_typebox_type.injectTypeboxType({
32
- type,
33
- system
34
- });
35
- injectTypebox({
36
- value,
37
- schema,
38
- compile
39
- });
20
+ if (!require_type_typebox_type.isTypeNamespaceLoaded()) require_type_typebox_type.injectTypeboxType(typeSide);
21
+ injectTypebox(valueSide);
40
22
  }, () => {});
41
23
  }
42
24
  function resolveNamespaces() {
@@ -1,6 +1,6 @@
1
1
  import { syncRequire } from "./sync-require.mjs";
2
2
  import { injectTypeboxType, isTypeNamespaceLoaded, isTypeUsed, loadTypeNamespace } from "./typebox-type.mjs";
3
- import { requireTypebox } from "./typebox-value-require.mjs";
3
+ import { importTypebox, requireTypebox } from "./typebox-value-require.mjs";
4
4
 
5
5
  //#region src/type/typebox-value.ts
6
6
  let loaded = false;
@@ -14,28 +14,10 @@ function load() {
14
14
  }
15
15
  function preloadTypebox() {
16
16
  if (loaded || !isTypeUsed()) return;
17
- const load = (name) => import(
18
- /* webpackIgnore: true */
19
- /* @vite-ignore */
20
- "typebox/" + name
21
- );
22
- return Promise.all([
23
- load("type"),
24
- load("system"),
25
- load("value"),
26
- load("schema"),
27
- load("compile")
28
- ]).then(([type, system, value, schema, compile]) => {
17
+ return importTypebox()?.then(([typeSide, valueSide]) => {
29
18
  if (loaded) return;
30
- if (!isTypeNamespaceLoaded()) injectTypeboxType({
31
- type,
32
- system
33
- });
34
- injectTypebox({
35
- value,
36
- schema,
37
- compile
38
- });
19
+ if (!isTypeNamespaceLoaded()) injectTypeboxType(typeSide);
20
+ injectTypebox(valueSide);
39
21
  }, () => {});
40
22
  }
41
23
  function resolveNamespaces() {
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-beta.17",
4
+ "version": "2.0.0-beta.19",
5
5
  "author": {
6
6
  "name": "saltyAom",
7
7
  "url": "https://github.com/SaltyAom",