elysia 2.0.0-beta.2 → 2.0.0-beta.3

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.
Files changed (145) hide show
  1. package/dist/adapter/utils.js +3 -3
  2. package/dist/adapter/utils.mjs +4 -4
  3. package/dist/adapter/web-standard/handler.js +5 -2
  4. package/dist/adapter/web-standard/handler.mjs +5 -2
  5. package/dist/base.d.ts +2 -2
  6. package/dist/base.js +42 -27
  7. package/dist/base.mjs +43 -28
  8. package/dist/compile/aot.d.ts +4 -4
  9. package/dist/compile/aot.js +14 -9
  10. package/dist/compile/aot.mjs +15 -9
  11. package/dist/compile/handler/descriptor.js +1 -1
  12. package/dist/compile/handler/descriptor.mjs +1 -1
  13. package/dist/compile/handler/index.d.ts +2 -2
  14. package/dist/compile/handler/index.js +6 -4
  15. package/dist/compile/handler/index.mjs +6 -4
  16. package/dist/compile/handler/utils.js +2 -2
  17. package/dist/compile/handler/utils.mjs +3 -3
  18. package/dist/context.js +3 -4
  19. package/dist/context.mjs +3 -4
  20. package/dist/cookie/config.d.ts +1 -0
  21. package/dist/cookie/config.js +3 -2
  22. package/dist/cookie/config.mjs +3 -2
  23. package/dist/cookie/cookie.d.ts +1 -0
  24. package/dist/cookie/cookie.js +6 -5
  25. package/dist/cookie/cookie.mjs +6 -5
  26. package/dist/cookie/crypto.d.ts +8 -7
  27. package/dist/cookie/crypto.js +38 -31
  28. package/dist/cookie/crypto.mjs +38 -32
  29. package/dist/cookie/error.js +1 -2
  30. package/dist/cookie/error.mjs +1 -2
  31. package/dist/cookie/lib.js +5 -1
  32. package/dist/cookie/lib.mjs +5 -1
  33. package/dist/cookie/serialize.js +1 -1
  34. package/dist/cookie/serialize.mjs +1 -1
  35. package/dist/cookie/types.d.ts +10 -0
  36. package/dist/cookie/utils.js +28 -14
  37. package/dist/cookie/utils.mjs +29 -15
  38. package/dist/handler/error.d.ts +23 -12
  39. package/dist/handler/error.js +24 -21
  40. package/dist/handler/error.mjs +20 -21
  41. package/dist/handler/fetch.js +6 -7
  42. package/dist/handler/fetch.mjs +7 -8
  43. package/dist/handler/utils.js +4 -2
  44. package/dist/handler/utils.mjs +5 -3
  45. package/dist/index.js +1 -8
  46. package/dist/package.js +1 -1
  47. package/dist/package.mjs +1 -1
  48. package/dist/plugin/aot/core.d.ts +22 -1
  49. package/dist/plugin/aot/core.js +35 -3
  50. package/dist/plugin/aot/core.mjs +35 -3
  51. package/dist/route-table.js +12 -10
  52. package/dist/route-table.mjs +12 -10
  53. package/dist/type/bridge-live.d.ts +1 -1
  54. package/dist/type/bridge-live.js +1 -1
  55. package/dist/type/bridge-live.mjs +1 -1
  56. package/dist/type/bridge.d.ts +1 -1
  57. package/dist/type/coerce-plan.js +3 -4
  58. package/dist/type/coerce-plan.mjs +1 -1
  59. package/dist/type/compat.d.ts +3 -0
  60. package/dist/type/compat.js +32 -14
  61. package/dist/type/compat.mjs +27 -8
  62. package/dist/type/elysia/array-buffer.js +2 -3
  63. package/dist/type/elysia/array-buffer.mjs +1 -1
  64. package/dist/type/elysia/array-string.js +7 -4
  65. package/dist/type/elysia/array-string.mjs +9 -5
  66. package/dist/type/elysia/boolean-string.js +2 -3
  67. package/dist/type/elysia/boolean-string.mjs +1 -1
  68. package/dist/type/elysia/boolean.js +4 -3
  69. package/dist/type/elysia/boolean.mjs +4 -2
  70. package/dist/type/elysia/cookie.js +2 -1
  71. package/dist/type/elysia/cookie.mjs +2 -1
  72. package/dist/type/elysia/date.js +7 -7
  73. package/dist/type/elysia/date.mjs +3 -2
  74. package/dist/type/elysia/file-type.d.ts +9 -2
  75. package/dist/type/elysia/file-type.js +16 -1
  76. package/dist/type/elysia/file-type.mjs +16 -2
  77. package/dist/type/elysia/file.js +8 -4
  78. package/dist/type/elysia/file.mjs +8 -3
  79. package/dist/type/elysia/files.js +6 -4
  80. package/dist/type/elysia/files.mjs +5 -2
  81. package/dist/type/elysia/form.js +2 -3
  82. package/dist/type/elysia/form.mjs +3 -3
  83. package/dist/type/elysia/integer-string.js +4 -5
  84. package/dist/type/elysia/integer-string.mjs +3 -3
  85. package/dist/type/elysia/integer.js +4 -3
  86. package/dist/type/elysia/integer.mjs +4 -2
  87. package/dist/type/elysia/maybe-empty.js +3 -4
  88. package/dist/type/elysia/maybe-empty.mjs +1 -1
  89. package/dist/type/elysia/nullable.js +2 -3
  90. package/dist/type/elysia/nullable.mjs +1 -1
  91. package/dist/type/elysia/number.js +4 -3
  92. package/dist/type/elysia/number.mjs +4 -2
  93. package/dist/type/elysia/numeric-enum.js +2 -3
  94. package/dist/type/elysia/numeric-enum.mjs +1 -1
  95. package/dist/type/elysia/numeric.js +5 -5
  96. package/dist/type/elysia/numeric.mjs +3 -2
  97. package/dist/type/elysia/object-string.js +7 -4
  98. package/dist/type/elysia/object-string.mjs +9 -5
  99. package/dist/type/elysia/string.js +4 -3
  100. package/dist/type/elysia/string.mjs +4 -2
  101. package/dist/type/elysia/uint8-array.js +2 -3
  102. package/dist/type/elysia/uint8-array.mjs +1 -1
  103. package/dist/type/elysia/union-enum.js +2 -3
  104. package/dist/type/elysia/union-enum.mjs +1 -1
  105. package/dist/type/elysia/utils.js +2 -3
  106. package/dist/type/elysia/utils.mjs +1 -1
  107. package/dist/type/exports.js +10 -1
  108. package/dist/type/exports.mjs +7 -0
  109. package/dist/type/index.d.ts +9 -1
  110. package/dist/type/index.js +41 -13
  111. package/dist/type/index.mjs +44 -9
  112. package/dist/type/typebox-type-live.d.ts +9 -0
  113. package/dist/type/typebox-type-live.js +31 -0
  114. package/dist/type/typebox-type-live.mjs +16 -0
  115. package/dist/type/typebox-type.d.ts +24 -0
  116. package/dist/type/typebox-type.js +130 -0
  117. package/dist/type/typebox-type.mjs +66 -0
  118. package/dist/type/typebox-value-live.d.ts +9 -0
  119. package/dist/type/typebox-value-live.js +27 -0
  120. package/dist/type/typebox-value-live.mjs +11 -0
  121. package/dist/type/typebox-value.d.ts +30 -0
  122. package/dist/type/typebox-value.js +147 -0
  123. package/dist/type/typebox-value.mjs +62 -0
  124. package/dist/type/validator/custom-error.js +4 -5
  125. package/dist/type/validator/custom-error.mjs +3 -3
  126. package/dist/type/validator/default-precompute.js +4 -5
  127. package/dist/type/validator/default-precompute.mjs +1 -1
  128. package/dist/type/validator/index.js +41 -35
  129. package/dist/type/validator/index.mjs +23 -16
  130. package/dist/type/validator/validator-cache.js +10 -5
  131. package/dist/type/validator/validator-cache.mjs +10 -4
  132. package/dist/universal/constants.d.ts +2 -1
  133. package/dist/universal/constants.js +3 -1
  134. package/dist/universal/constants.mjs +2 -1
  135. package/dist/utils.d.ts +10 -1
  136. package/dist/utils.js +18 -3
  137. package/dist/utils.mjs +14 -3
  138. package/dist/validator/index.js +2 -1
  139. package/dist/validator/index.mjs +2 -1
  140. package/dist/ws/context.d.ts +4 -0
  141. package/dist/ws/context.js +44 -26
  142. package/dist/ws/context.mjs +44 -26
  143. package/dist/ws/route.js +126 -23
  144. package/dist/ws/route.mjs +128 -25
  145. package/package.json +4 -2
@@ -0,0 +1,24 @@
1
+ import * as _$typebox_type0 from "typebox/type";
2
+ import { Codec as Codec$1, Decode as Decode$1, Evaluate as Evaluate$1, Intersect as Intersect$1, Module as Module$1, Null as Null$1, Ref as Ref$1, Refine as Refine$1, Undefined as Undefined$1, Unsafe as Unsafe$1 } from "typebox/type";
3
+ import * as _$typebox_system0 from "typebox/system";
4
+
5
+ //#region src/type/typebox-type.d.ts
6
+ interface TypeboxTypeNamespaces {
7
+ type: typeof _$typebox_type0;
8
+ system: typeof _$typebox_system0;
9
+ }
10
+ declare const loadTypeNamespace: () => TypeboxTypeNamespaces;
11
+ declare function ensureTypeSettings(): void;
12
+ declare let Codec: typeof Codec$1;
13
+ declare let Decode: typeof Decode$1;
14
+ declare let Evaluate: typeof Evaluate$1;
15
+ declare let Intersect: typeof Intersect$1;
16
+ declare let Module: typeof Module$1;
17
+ declare let Null: typeof Null$1;
18
+ declare let Ref: typeof Ref$1;
19
+ declare let Refine: typeof Refine$1;
20
+ declare let Undefined: typeof Undefined$1;
21
+ declare let Unsafe: typeof Unsafe$1;
22
+ declare function injectTypeboxType(typebox: TypeboxTypeNamespaces): void;
23
+ //#endregion
24
+ export { Codec, Decode, Evaluate, Intersect, Module, Null, Ref, Refine, TypeboxTypeNamespaces, Undefined, Unsafe, ensureTypeSettings, injectTypeboxType, loadTypeNamespace };
@@ -0,0 +1,130 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ //#region src/type/typebox-type.ts
4
+ let namespaces;
5
+ let settingsApplied = false;
6
+ /**
7
+ * Loads `typebox/type` + `typebox/system` on first use
8
+ *
9
+ * separate from `typebox-value` (type ⊂ value)
10
+ * sharing one would make a single `t.Date()` drag the whole value graph in
11
+ */
12
+ function load() {
13
+ if (namespaces) return namespaces;
14
+ injectTypeboxType(resolveNamespaces());
15
+ return namespaces;
16
+ }
17
+ function resolveNamespaces() {
18
+ const req = {}.require ?? globalThis.process?.getBuiltinModule?.("module")?.createRequire(require("url").pathToFileURL(__filename).href);
19
+ if (!req) throw new Error("TypeBox couldn't be loaded: this runtime has no synchronous module loader. Build with the AOT plugin ('elysia/plugin/aot') so TypeBox is wired statically, or register it manually with setupTypebox({ typebox: { type, system } }).");
20
+ return {
21
+ type: req("typebox/type"),
22
+ system: req("typebox/system")
23
+ };
24
+ }
25
+ function applySettings() {
26
+ if (settingsApplied || !namespaces) return;
27
+ settingsApplied = true;
28
+ namespaces.system.Settings.Set({ unionPrioritySort: false });
29
+ }
30
+ const loadTypeNamespace = () => namespaces ?? load();
31
+ function ensureTypeSettings() {
32
+ if (settingsApplied) return;
33
+ loadTypeNamespace();
34
+ applySettings();
35
+ }
36
+ function stub(get) {
37
+ return function(...args) {
38
+ load();
39
+ return get()(...args);
40
+ };
41
+ }
42
+ let Codec = stub(() => Codec);
43
+ let Decode = stub(() => Decode);
44
+ let Evaluate = stub(() => Evaluate);
45
+ let Intersect = stub(() => Intersect);
46
+ let Module = stub(() => Module);
47
+ let Null = stub(() => Null);
48
+ let Ref = stub(() => Ref);
49
+ let Refine = stub(() => Refine);
50
+ let Undefined = stub(() => Undefined);
51
+ let Unsafe = stub(() => Unsafe);
52
+ function injectTypeboxType(typebox) {
53
+ namespaces = typebox;
54
+ Codec = typebox.type.Codec;
55
+ Decode = typebox.type.Decode;
56
+ Evaluate = typebox.type.Evaluate;
57
+ Intersect = typebox.type.Intersect;
58
+ Module = typebox.type.Module;
59
+ Null = typebox.type.Null;
60
+ Ref = typebox.type.Ref;
61
+ Refine = typebox.type.Refine;
62
+ Undefined = typebox.type.Undefined;
63
+ Unsafe = typebox.type.Unsafe;
64
+ applySettings();
65
+ }
66
+
67
+ //#endregion
68
+ Object.defineProperty(exports, 'Codec', {
69
+ enumerable: true,
70
+ get: function () {
71
+ return Codec;
72
+ }
73
+ });
74
+ Object.defineProperty(exports, 'Decode', {
75
+ enumerable: true,
76
+ get: function () {
77
+ return Decode;
78
+ }
79
+ });
80
+ Object.defineProperty(exports, 'Evaluate', {
81
+ enumerable: true,
82
+ get: function () {
83
+ return Evaluate;
84
+ }
85
+ });
86
+ Object.defineProperty(exports, 'Intersect', {
87
+ enumerable: true,
88
+ get: function () {
89
+ return Intersect;
90
+ }
91
+ });
92
+ Object.defineProperty(exports, 'Module', {
93
+ enumerable: true,
94
+ get: function () {
95
+ return Module;
96
+ }
97
+ });
98
+ Object.defineProperty(exports, 'Null', {
99
+ enumerable: true,
100
+ get: function () {
101
+ return Null;
102
+ }
103
+ });
104
+ Object.defineProperty(exports, 'Ref', {
105
+ enumerable: true,
106
+ get: function () {
107
+ return Ref;
108
+ }
109
+ });
110
+ Object.defineProperty(exports, 'Refine', {
111
+ enumerable: true,
112
+ get: function () {
113
+ return Refine;
114
+ }
115
+ });
116
+ Object.defineProperty(exports, 'Undefined', {
117
+ enumerable: true,
118
+ get: function () {
119
+ return Undefined;
120
+ }
121
+ });
122
+ Object.defineProperty(exports, 'Unsafe', {
123
+ enumerable: true,
124
+ get: function () {
125
+ return Unsafe;
126
+ }
127
+ });
128
+ exports.ensureTypeSettings = ensureTypeSettings;
129
+ exports.injectTypeboxType = injectTypeboxType;
130
+ exports.loadTypeNamespace = loadTypeNamespace;
@@ -0,0 +1,66 @@
1
+ //#region src/type/typebox-type.ts
2
+ let namespaces;
3
+ let settingsApplied = false;
4
+ /**
5
+ * Loads `typebox/type` + `typebox/system` on first use
6
+ *
7
+ * separate from `typebox-value` (type ⊂ value)
8
+ * sharing one would make a single `t.Date()` drag the whole value graph in
9
+ */
10
+ function load() {
11
+ if (namespaces) return namespaces;
12
+ injectTypeboxType(resolveNamespaces());
13
+ return namespaces;
14
+ }
15
+ function resolveNamespaces() {
16
+ const req = import.meta.require ?? globalThis.process?.getBuiltinModule?.("module")?.createRequire(import.meta.url);
17
+ if (!req) throw new Error("TypeBox couldn't be loaded: this runtime has no synchronous module loader. Build with the AOT plugin ('elysia/plugin/aot') so TypeBox is wired statically, or register it manually with setupTypebox({ typebox: { type, system } }).");
18
+ return {
19
+ type: req("typebox/type"),
20
+ system: req("typebox/system")
21
+ };
22
+ }
23
+ function applySettings() {
24
+ if (settingsApplied || !namespaces) return;
25
+ settingsApplied = true;
26
+ namespaces.system.Settings.Set({ unionPrioritySort: false });
27
+ }
28
+ const loadTypeNamespace = () => namespaces ?? load();
29
+ function ensureTypeSettings() {
30
+ if (settingsApplied) return;
31
+ loadTypeNamespace();
32
+ applySettings();
33
+ }
34
+ function stub(get) {
35
+ return function(...args) {
36
+ load();
37
+ return get()(...args);
38
+ };
39
+ }
40
+ let Codec = stub(() => Codec);
41
+ let Decode = stub(() => Decode);
42
+ let Evaluate = stub(() => Evaluate);
43
+ let Intersect = stub(() => Intersect);
44
+ let Module = stub(() => Module);
45
+ let Null = stub(() => Null);
46
+ let Ref = stub(() => Ref);
47
+ let Refine = stub(() => Refine);
48
+ let Undefined = stub(() => Undefined);
49
+ let Unsafe = stub(() => Unsafe);
50
+ function injectTypeboxType(typebox) {
51
+ namespaces = typebox;
52
+ Codec = typebox.type.Codec;
53
+ Decode = typebox.type.Decode;
54
+ Evaluate = typebox.type.Evaluate;
55
+ Intersect = typebox.type.Intersect;
56
+ Module = typebox.type.Module;
57
+ Null = typebox.type.Null;
58
+ Ref = typebox.type.Ref;
59
+ Refine = typebox.type.Refine;
60
+ Undefined = typebox.type.Undefined;
61
+ Unsafe = typebox.type.Unsafe;
62
+ applySettings();
63
+ }
64
+
65
+ //#endregion
66
+ export { Codec, Decode, Evaluate, Intersect, Module, Null, Ref, Refine, Undefined, Unsafe, ensureTypeSettings, injectTypeboxType, loadTypeNamespace };
@@ -0,0 +1,9 @@
1
+ import { TypeboxNamespaces } from "./typebox-value.js";
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
+
6
+ //#region src/type/typebox-value-live.d.ts
7
+ declare function injectTypebox(_typebox?: TypeboxNamespaces): void;
8
+ //#endregion
9
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, type TypeboxNamespaces, injectTypebox };
@@ -0,0 +1,27 @@
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_system = require("typebox/system");
6
+ let typebox_schema = require("typebox/schema");
7
+
8
+ //#region src/type/typebox-value-live.ts
9
+ typebox_system.Settings.Set({ unionPrioritySort: false });
10
+ function injectTypebox(_typebox) {}
11
+
12
+ //#endregion
13
+ exports.Build = typebox_schema.Build;
14
+ exports.Check = typebox_value.Check;
15
+ exports.Clean = typebox_value.Clean;
16
+ exports.Clone = typebox_value.Clone;
17
+ exports.Compile = typebox_compile.Compile;
18
+ exports.Create = typebox_value.Create;
19
+ exports.Decode = typebox_value.Decode;
20
+ exports.DecodeUnsafe = typebox_value.DecodeUnsafe;
21
+ exports.Default = typebox_value.Default;
22
+ exports.Encode = typebox_value.Encode;
23
+ exports.EncodeUnsafe = typebox_value.EncodeUnsafe;
24
+ exports.Errors = typebox_value.Errors;
25
+ exports.HasCodec = typebox_value.HasCodec;
26
+ exports.SchemaCompile = typebox_schema.Compile;
27
+ exports.injectTypebox = injectTypebox;
@@ -0,0 +1,11 @@
1
+ import { Compile } from "typebox/compile";
2
+ import { Check, Clean, Clone, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec } from "typebox/value";
3
+ import { Settings } from "typebox/system";
4
+ import { Build, Compile as SchemaCompile } from "typebox/schema";
5
+
6
+ //#region src/type/typebox-value-live.ts
7
+ Settings.Set({ unionPrioritySort: false });
8
+ function injectTypebox(_typebox) {}
9
+
10
+ //#endregion
11
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, injectTypebox };
@@ -0,0 +1,30 @@
1
+ import * as _$typebox_compile0 from "typebox/compile";
2
+ import { Compile as Compile$1 } from "typebox/compile";
3
+ import * as _$typebox_value0 from "typebox/value";
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 _$typebox_schema0 from "typebox/schema";
6
+ import { Build as Build$1, Compile as Compile$2 } from "typebox/schema";
7
+
8
+ //#region src/type/typebox-value.d.ts
9
+ interface TypeboxNamespaces {
10
+ value: typeof _$typebox_value0;
11
+ schema: typeof _$typebox_schema0;
12
+ compile: typeof _$typebox_compile0;
13
+ }
14
+ declare let Check: typeof Check$1;
15
+ declare let Clean: typeof Clean$1;
16
+ declare let Clone: typeof Clone$1;
17
+ declare let Create: typeof Create$1;
18
+ declare let Decode: typeof Decode$1;
19
+ declare let DecodeUnsafe: typeof DecodeUnsafe$1;
20
+ declare let Default: typeof Default$1;
21
+ declare let Encode: typeof Encode$1;
22
+ declare let EncodeUnsafe: typeof EncodeUnsafe$1;
23
+ declare let Errors: typeof Errors$1;
24
+ declare let HasCodec: typeof HasCodec$1;
25
+ declare let SchemaCompile: typeof Compile$2;
26
+ declare let Build: typeof Build$1;
27
+ declare let Compile: typeof Compile$1;
28
+ declare function injectTypebox(typebox: TypeboxNamespaces): void;
29
+ //#endregion
30
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, TypeboxNamespaces, injectTypebox };
@@ -0,0 +1,147 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_type_typebox_type = require('./typebox-type.js');
3
+
4
+ //#region src/type/typebox-value.ts
5
+ let loaded = false;
6
+ /**
7
+ * Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
8
+ */
9
+ function load() {
10
+ if (loaded) return;
11
+ require_type_typebox_type.ensureTypeSettings();
12
+ injectTypebox(resolveNamespaces());
13
+ }
14
+ function resolveNamespaces() {
15
+ const req = {}.require ?? globalThis.process?.getBuiltinModule?.("module")?.createRequire(require("url").pathToFileURL(__filename).href);
16
+ if (!req) throw new Error("TypeBox couldn't be loaded: this runtime has no synchronous module loader. Build with the AOT plugin ('elysia/plugin/aot') so TypeBox is wired statically, or register it manually with setupTypebox({ typebox: { value, schema, compile, type, system } }). All five namespaces are required together — `value`/`schema`/`compile` alone still reaches the type leaf through `ensureTypeSettings()` and crashes the same way.");
17
+ return {
18
+ value: req("typebox/value"),
19
+ schema: req("typebox/schema"),
20
+ compile: req("typebox/compile")
21
+ };
22
+ }
23
+ function stub(get) {
24
+ return function(...args) {
25
+ load();
26
+ return get()(...args);
27
+ };
28
+ }
29
+ let Check = stub(() => Check);
30
+ let Clean = stub(() => Clean);
31
+ let Clone = stub(() => Clone);
32
+ let Create = stub(() => Create);
33
+ let Decode = stub(() => Decode);
34
+ let DecodeUnsafe = stub(() => DecodeUnsafe);
35
+ let Default = stub(() => Default);
36
+ let Encode = stub(() => Encode);
37
+ let EncodeUnsafe = stub(() => EncodeUnsafe);
38
+ let Errors = stub(() => Errors);
39
+ let HasCodec = stub(() => HasCodec);
40
+ let SchemaCompile = stub(() => SchemaCompile);
41
+ let Build = stub(() => Build);
42
+ let Compile = stub(() => Compile);
43
+ function injectTypebox(typebox) {
44
+ loaded = true;
45
+ require_type_typebox_type.ensureTypeSettings();
46
+ Check = typebox.value.Check;
47
+ Clean = typebox.value.Clean;
48
+ Clone = typebox.value.Clone;
49
+ Create = typebox.value.Create;
50
+ Decode = typebox.value.Decode;
51
+ DecodeUnsafe = typebox.value.DecodeUnsafe;
52
+ Default = typebox.value.Default;
53
+ Encode = typebox.value.Encode;
54
+ EncodeUnsafe = typebox.value.EncodeUnsafe;
55
+ Errors = typebox.value.Errors;
56
+ HasCodec = typebox.value.HasCodec;
57
+ SchemaCompile = typebox.schema.Compile;
58
+ Build = typebox.schema.Build;
59
+ Compile = typebox.compile.Compile;
60
+ }
61
+
62
+ //#endregion
63
+ Object.defineProperty(exports, 'Build', {
64
+ enumerable: true,
65
+ get: function () {
66
+ return Build;
67
+ }
68
+ });
69
+ Object.defineProperty(exports, 'Check', {
70
+ enumerable: true,
71
+ get: function () {
72
+ return Check;
73
+ }
74
+ });
75
+ Object.defineProperty(exports, 'Clean', {
76
+ enumerable: true,
77
+ get: function () {
78
+ return Clean;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, 'Clone', {
82
+ enumerable: true,
83
+ get: function () {
84
+ return Clone;
85
+ }
86
+ });
87
+ Object.defineProperty(exports, 'Compile', {
88
+ enumerable: true,
89
+ get: function () {
90
+ return Compile;
91
+ }
92
+ });
93
+ Object.defineProperty(exports, 'Create', {
94
+ enumerable: true,
95
+ get: function () {
96
+ return Create;
97
+ }
98
+ });
99
+ Object.defineProperty(exports, 'Decode', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return Decode;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, 'DecodeUnsafe', {
106
+ enumerable: true,
107
+ get: function () {
108
+ return DecodeUnsafe;
109
+ }
110
+ });
111
+ Object.defineProperty(exports, 'Default', {
112
+ enumerable: true,
113
+ get: function () {
114
+ return Default;
115
+ }
116
+ });
117
+ Object.defineProperty(exports, 'Encode', {
118
+ enumerable: true,
119
+ get: function () {
120
+ return Encode;
121
+ }
122
+ });
123
+ Object.defineProperty(exports, 'EncodeUnsafe', {
124
+ enumerable: true,
125
+ get: function () {
126
+ return EncodeUnsafe;
127
+ }
128
+ });
129
+ Object.defineProperty(exports, 'Errors', {
130
+ enumerable: true,
131
+ get: function () {
132
+ return Errors;
133
+ }
134
+ });
135
+ Object.defineProperty(exports, 'HasCodec', {
136
+ enumerable: true,
137
+ get: function () {
138
+ return HasCodec;
139
+ }
140
+ });
141
+ Object.defineProperty(exports, 'SchemaCompile', {
142
+ enumerable: true,
143
+ get: function () {
144
+ return SchemaCompile;
145
+ }
146
+ });
147
+ exports.injectTypebox = injectTypebox;
@@ -0,0 +1,62 @@
1
+ import { ensureTypeSettings } from "./typebox-type.mjs";
2
+
3
+ //#region src/type/typebox-value.ts
4
+ let loaded = false;
5
+ /**
6
+ * Loads `typebox/value` + `typebox/schema` + `typebox/compile` on first use
7
+ */
8
+ function load() {
9
+ if (loaded) return;
10
+ ensureTypeSettings();
11
+ injectTypebox(resolveNamespaces());
12
+ }
13
+ function resolveNamespaces() {
14
+ const req = import.meta.require ?? globalThis.process?.getBuiltinModule?.("module")?.createRequire(import.meta.url);
15
+ if (!req) throw new Error("TypeBox couldn't be loaded: this runtime has no synchronous module loader. Build with the AOT plugin ('elysia/plugin/aot') so TypeBox is wired statically, or register it manually with setupTypebox({ typebox: { value, schema, compile, type, system } }). All five namespaces are required together — `value`/`schema`/`compile` alone still reaches the type leaf through `ensureTypeSettings()` and crashes the same way.");
16
+ return {
17
+ value: req("typebox/value"),
18
+ schema: req("typebox/schema"),
19
+ compile: req("typebox/compile")
20
+ };
21
+ }
22
+ function stub(get) {
23
+ return function(...args) {
24
+ load();
25
+ return get()(...args);
26
+ };
27
+ }
28
+ let Check = stub(() => Check);
29
+ let Clean = stub(() => Clean);
30
+ let Clone = stub(() => Clone);
31
+ let Create = stub(() => Create);
32
+ let Decode = stub(() => Decode);
33
+ let DecodeUnsafe = stub(() => DecodeUnsafe);
34
+ let Default = stub(() => Default);
35
+ let Encode = stub(() => Encode);
36
+ let EncodeUnsafe = stub(() => EncodeUnsafe);
37
+ let Errors = stub(() => Errors);
38
+ let HasCodec = stub(() => HasCodec);
39
+ let SchemaCompile = stub(() => SchemaCompile);
40
+ let Build = stub(() => Build);
41
+ let Compile = stub(() => Compile);
42
+ function injectTypebox(typebox) {
43
+ loaded = true;
44
+ ensureTypeSettings();
45
+ Check = typebox.value.Check;
46
+ Clean = typebox.value.Clean;
47
+ Clone = typebox.value.Clone;
48
+ Create = typebox.value.Create;
49
+ Decode = typebox.value.Decode;
50
+ DecodeUnsafe = typebox.value.DecodeUnsafe;
51
+ Default = typebox.value.Default;
52
+ Encode = typebox.value.Encode;
53
+ EncodeUnsafe = typebox.value.EncodeUnsafe;
54
+ Errors = typebox.value.Errors;
55
+ HasCodec = typebox.value.HasCodec;
56
+ SchemaCompile = typebox.schema.Compile;
57
+ Build = typebox.schema.Build;
58
+ Compile = typebox.compile.Compile;
59
+ }
60
+
61
+ //#endregion
62
+ export { Build, Check, Clean, Clone, Compile, Create, Decode, DecodeUnsafe, Default, Encode, EncodeUnsafe, Errors, HasCodec, SchemaCompile, injectTypebox };
@@ -1,10 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.js');
3
2
  const require_utils = require('../../utils.js');
4
3
  const require_error = require('../../error.js');
5
4
  const require_compile_aot = require('../../compile/aot.js');
5
+ const require_type_typebox_value = require('../typebox-value.js');
6
6
  const require_type_validator_frozen_check = require('./frozen-check.js');
7
- let typebox_schema = require("typebox/schema");
8
7
 
9
8
  //#region src/type/validator/custom-error.ts
10
9
  function encodePointer(segments) {
@@ -85,7 +84,7 @@ function buildFindCustomError(schema, frozen) {
85
84
  const cached = unionCheckCache.get(node);
86
85
  if (cached) return cached;
87
86
  try {
88
- const uc = (0, typebox_schema.Compile)(node);
87
+ const uc = require_type_typebox_value.SchemaCompile(node);
89
88
  const fn = (v) => uc.Check(v);
90
89
  unionCheckCache.set(node, fn);
91
90
  return fn;
@@ -107,7 +106,7 @@ function buildFindCustomError(schema, frozen) {
107
106
  check = fe.c(fe.e ? require_compile_aot.reconstruct().collectExternals(node) : require_compile_aot.EMPTY_EXTERNALS);
108
107
  } catch {}
109
108
  else try {
110
- const c = (0, typebox_schema.Compile)(node);
109
+ const c = require_type_typebox_value.SchemaCompile(node);
111
110
  check = (v) => c.Check(v);
112
111
  } catch {}
113
112
  if (!check) continue;
@@ -176,7 +175,7 @@ function captureCustomErrors(schema) {
176
175
  for (const { path, node, union, each } of ceNodes) {
177
176
  if (union || each) continue;
178
177
  try {
179
- const cf = require_type_validator_frozen_check.buildFrozenCheck((0, typebox_schema.Build)(node), node);
178
+ const cf = require_type_validator_frozen_check.buildFrozenCheck(require_type_typebox_value.Build(node), node);
180
179
  if (cf) entries.push({
181
180
  path,
182
181
  ...cf
@@ -1,8 +1,8 @@
1
1
  import { nullObject } from "../../utils.mjs";
2
2
  import { subValueAt } from "../../error.mjs";
3
3
  import { EMPTY_EXTERNALS, reconstruct } from "../../compile/aot.mjs";
4
+ import { Build, SchemaCompile } from "../typebox-value.mjs";
4
5
  import { buildFrozenCheck } from "./frozen-check.mjs";
5
- import { Build, Compile } from "typebox/schema";
6
6
 
7
7
  //#region src/type/validator/custom-error.ts
8
8
  function encodePointer(segments) {
@@ -83,7 +83,7 @@ function buildFindCustomError(schema, frozen) {
83
83
  const cached = unionCheckCache.get(node);
84
84
  if (cached) return cached;
85
85
  try {
86
- const uc = Compile(node);
86
+ const uc = SchemaCompile(node);
87
87
  const fn = (v) => uc.Check(v);
88
88
  unionCheckCache.set(node, fn);
89
89
  return fn;
@@ -105,7 +105,7 @@ function buildFindCustomError(schema, frozen) {
105
105
  check = fe.c(fe.e ? reconstruct().collectExternals(node) : EMPTY_EXTERNALS);
106
106
  } catch {}
107
107
  else try {
108
- const c = Compile(node);
108
+ const c = SchemaCompile(node);
109
109
  check = (v) => c.Check(v);
110
110
  } catch {}
111
111
  if (!check) continue;
@@ -1,8 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.js');
3
2
  const require_constants = require('../../constants.js');
4
3
  const require_utils = require('../../utils.js');
5
- let typebox_value = require("typebox/value");
4
+ const require_type_typebox_value = require('../typebox-value.js');
6
5
 
7
6
  //#region src/type/validator/default-precompute.ts
8
7
  function isPrecomputeSafe(schema, depth = 0) {
@@ -291,7 +290,7 @@ function presentExpr(child, isObject, varName) {
291
290
  return isObject ? `(${varName}!==null&&typeof ${varName}==='object'&&!Array.isArray(${varName})?${child}(${varName}):${varName})` : `(Array.isArray(${varName})?${child}(${varName}):${varName})`;
292
291
  }
293
292
  function mergeExpression(schema, varName, helpers, memo) {
294
- const full = (0, typebox_value.Default)(schema, void 0);
293
+ const full = require_type_typebox_value.Default(schema, void 0);
295
294
  const child = emitMerger(schema, helpers, memo);
296
295
  if (child === void 0) return;
297
296
  const absent = full === void 0 ? void 0 : cloneExpression(full);
@@ -393,8 +392,8 @@ function verifyPreallocatableDefault(schema, validate = true) {
393
392
  let pd;
394
393
  let podRaw;
395
394
  try {
396
- pd = (0, typebox_value.Default)(schema, void 0);
397
- podRaw = (0, typebox_value.Default)(schema, require_utils.nullObject());
395
+ pd = require_type_typebox_value.Default(schema, void 0);
396
+ podRaw = require_type_typebox_value.Default(schema, require_utils.nullObject());
398
397
  } catch {
399
398
  return;
400
399
  }
@@ -1,6 +1,6 @@
1
1
  import { dangerousKeys } from "../../constants.mjs";
2
2
  import { nullObject } from "../../utils.mjs";
3
- import { Default } from "typebox/value";
3
+ import { Default } from "../typebox-value.mjs";
4
4
 
5
5
  //#region src/type/validator/default-precompute.ts
6
6
  function isPrecomputeSafe(schema, depth = 0) {