elysia 2.0.0-beta.2 → 2.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/bun/index.d.ts +18 -2
- package/dist/adapter/bun/index.js +467 -110
- package/dist/adapter/bun/index.mjs +467 -112
- package/dist/adapter/types.d.ts +2 -21
- package/dist/adapter/utils.d.ts +14 -3
- package/dist/adapter/utils.js +146 -87
- package/dist/adapter/utils.mjs +148 -90
- package/dist/adapter/web-standard/handler.d.ts +1 -1
- package/dist/adapter/web-standard/handler.js +47 -36
- package/dist/adapter/web-standard/handler.mjs +48 -37
- package/dist/adapter/web-standard/index.js +2 -30
- package/dist/adapter/web-standard/index.mjs +2 -30
- package/dist/adapter/web-standard/utils.js +5 -18
- package/dist/adapter/web-standard/utils.mjs +5 -18
- package/dist/base.d.ts +99 -67
- package/dist/base.js +678 -510
- package/dist/base.mjs +682 -514
- package/dist/compile/aot-capture.d.ts +2 -13
- package/dist/compile/aot-capture.js +26 -69
- package/dist/compile/aot-capture.mjs +28 -67
- package/dist/compile/aot-emit.d.ts +9 -7
- package/dist/compile/aot-emit.js +42 -19
- package/dist/compile/aot-emit.mjs +42 -20
- package/dist/compile/aot.d.ts +17 -19
- package/dist/compile/aot.js +41 -51
- package/dist/compile/aot.mjs +39 -49
- package/dist/compile/handler/descriptor.d.ts +9 -12
- package/dist/compile/handler/descriptor.js +19 -44
- package/dist/compile/handler/descriptor.mjs +20 -42
- package/dist/compile/handler/frozen-validator.d.ts +5 -10
- package/dist/compile/handler/frozen-validator.js +55 -105
- package/dist/compile/handler/frozen-validator.mjs +53 -105
- package/dist/compile/handler/index.d.ts +7 -5
- package/dist/compile/handler/index.js +270 -111
- package/dist/compile/handler/index.mjs +270 -113
- package/dist/compile/handler/jit.d.ts +19 -17
- package/dist/compile/handler/jit.js +222 -149
- package/dist/compile/handler/jit.mjs +224 -152
- package/dist/compile/handler/params.d.ts +1 -4
- package/dist/compile/handler/params.js +10 -5
- package/dist/compile/handler/params.mjs +14 -8
- package/dist/compile/handler/reconstruct.d.ts +2 -2
- package/dist/compile/handler/reconstruct.js +6 -4
- package/dist/compile/handler/reconstruct.mjs +6 -4
- package/dist/compile/handler/static-clone-resolver.d.ts +6 -0
- package/dist/compile/handler/static-clone-resolver.js +8 -0
- package/dist/compile/handler/static-clone-resolver.mjs +7 -0
- package/dist/compile/handler/utils.d.ts +22 -11
- package/dist/compile/handler/utils.js +159 -253
- package/dist/compile/handler/utils.mjs +155 -252
- package/dist/compile/jit-probe.d.ts +2 -2
- package/dist/compile/jit-probe.js +2 -3
- package/dist/compile/jit-probe.mjs +2 -3
- package/dist/compile/lexer.d.ts +7 -4
- package/dist/compile/lexer.js +268 -6
- package/dist/compile/lexer.mjs +268 -4
- package/dist/compile/utils.js +7 -4
- package/dist/compile/utils.mjs +7 -4
- package/dist/compiled.d.ts +0 -1
- package/dist/compiled.js +0 -1
- package/dist/compiled.mjs +0 -1
- package/dist/context.d.ts +14 -4
- package/dist/context.js +17 -32
- package/dist/context.mjs +19 -34
- package/dist/cookie/config.d.ts +7 -2
- package/dist/cookie/config.js +76 -16
- package/dist/cookie/config.mjs +77 -18
- package/dist/cookie/cookie.d.ts +1 -1
- package/dist/cookie/cookie.js +8 -10
- package/dist/cookie/cookie.mjs +8 -10
- package/dist/cookie/crypto.d.ts +8 -7
- package/dist/cookie/crypto.js +51 -40
- package/dist/cookie/crypto.mjs +51 -41
- package/dist/cookie/error.d.ts +1 -2
- package/dist/cookie/error.js +6 -4
- package/dist/cookie/error.mjs +6 -4
- package/dist/cookie/lib.js +7 -2
- package/dist/cookie/lib.mjs +7 -2
- package/dist/cookie/serialize.js +1 -1
- package/dist/cookie/serialize.mjs +1 -1
- package/dist/cookie/types.d.ts +10 -0
- package/dist/cookie/utils.d.ts +4 -8
- package/dist/cookie/utils.js +86 -52
- package/dist/cookie/utils.mjs +89 -54
- package/dist/error.d.ts +113 -103
- package/dist/error.js +181 -117
- package/dist/error.mjs +179 -118
- package/dist/generation.d.ts +2 -2
- package/dist/handler/error.d.ts +26 -15
- package/dist/handler/error.js +77 -96
- package/dist/handler/error.mjs +74 -97
- package/dist/handler/fetch.js +87 -108
- package/dist/handler/fetch.mjs +89 -110
- package/dist/handler/utils.d.ts +12 -6
- package/dist/handler/utils.js +84 -28
- package/dist/handler/utils.mjs +80 -28
- package/dist/index.d.ts +12 -12
- package/dist/index.js +2 -9
- package/dist/index.mjs +1 -1
- package/dist/memory.js +1 -1
- package/dist/memory.mjs +1 -1
- package/dist/package.js +1 -1
- package/dist/package.mjs +1 -1
- package/dist/plugin/aot/bun.d.ts +8 -1
- package/dist/plugin/aot/bun.js +16 -9
- package/dist/plugin/aot/bun.mjs +17 -10
- package/dist/plugin/aot/core.d.ts +52 -60
- package/dist/plugin/aot/core.js +208 -109
- package/dist/plugin/aot/core.mjs +205 -111
- package/dist/plugin/aot/esbuild.js +8 -5
- package/dist/plugin/aot/esbuild.mjs +9 -6
- package/dist/plugin/aot/hooks.d.ts +6 -17
- package/dist/plugin/aot/hooks.js +36 -14
- package/dist/plugin/aot/hooks.mjs +37 -16
- package/dist/plugin/aot/rspack-loader.d.ts +1 -5
- package/dist/plugin/aot/rspack-loader.js +1 -10
- package/dist/plugin/aot/rspack-loader.mjs +1 -10
- package/dist/plugin/aot/rspack.js +2 -5
- package/dist/plugin/aot/rspack.mjs +3 -6
- package/dist/plugin/aot/source.d.ts +6 -42
- package/dist/plugin/aot/source.js +71 -71
- package/dist/plugin/aot/source.mjs +72 -72
- package/dist/plugin/aot/treeshake.js +2 -6
- package/dist/plugin/aot/treeshake.mjs +2 -6
- package/dist/plugin/aot/unplugin.d.ts +1 -4
- package/dist/plugin/aot/unplugin.js +4 -13
- package/dist/plugin/aot/unplugin.mjs +4 -13
- package/dist/plugin/aot/vite.d.ts +2 -6
- package/dist/plugin/aot/worker.js +2 -2
- package/dist/plugin/aot/worker.mjs +2 -2
- package/dist/plugin/auto-head.js +1 -10
- package/dist/plugin/auto-head.mjs +1 -10
- package/dist/plugin/trace.d.ts +2 -1
- package/dist/route-table.d.ts +3 -0
- package/dist/route-table.js +16 -11
- package/dist/route-table.mjs +16 -11
- package/dist/schema-snapshot.d.ts +0 -4
- package/dist/schema-snapshot.js +32 -49
- package/dist/schema-snapshot.mjs +32 -49
- package/dist/sucrose.d.ts +6 -55
- package/dist/sucrose.js +103 -731
- package/dist/sucrose.mjs +102 -724
- package/dist/trace.d.ts +5 -8
- package/dist/trace.js +23 -134
- package/dist/trace.mjs +24 -135
- package/dist/type/bridge-live.d.ts +4 -2
- package/dist/type/bridge-live.js +6 -3
- package/dist/type/bridge-live.mjs +4 -2
- package/dist/type/bridge.d.ts +6 -4
- package/dist/type/bridge.js +17 -9
- package/dist/type/bridge.mjs +5 -3
- package/dist/type/coerce-plan.d.ts +5 -5
- package/dist/type/coerce-plan.js +41 -39
- package/dist/type/coerce-plan.mjs +43 -39
- package/dist/type/coerce.d.ts +3 -7
- package/dist/type/coerce.js +18 -75
- package/dist/type/coerce.mjs +19 -76
- package/dist/type/compat.d.ts +3 -0
- package/dist/type/compat.js +23 -14
- package/dist/type/compat.mjs +20 -10
- package/dist/type/elysia/array-buffer.d.ts +4 -1
- package/dist/type/elysia/array-buffer.js +17 -17
- package/dist/type/elysia/array-buffer.mjs +17 -17
- package/dist/type/elysia/array-string.js +2 -40
- package/dist/type/elysia/array-string.mjs +2 -39
- package/dist/type/elysia/array.js +5 -9
- package/dist/type/elysia/array.mjs +5 -9
- package/dist/type/elysia/boolean-string.js +2 -3
- package/dist/type/elysia/boolean-string.mjs +1 -1
- package/dist/type/elysia/boolean.js +3 -12
- package/dist/type/elysia/boolean.mjs +3 -11
- package/dist/type/elysia/cookie.d.ts +3 -4
- package/dist/type/elysia/cookie.js +5 -15
- package/dist/type/elysia/cookie.mjs +5 -15
- package/dist/type/elysia/date.js +13 -20
- package/dist/type/elysia/date.mjs +10 -16
- package/dist/type/elysia/file-type.d.ts +11 -4
- package/dist/type/elysia/file-type.js +17 -2
- package/dist/type/elysia/file-type.mjs +17 -3
- package/dist/type/elysia/file.d.ts +1 -3
- package/dist/type/elysia/file.js +11 -27
- package/dist/type/elysia/file.mjs +11 -12
- package/dist/type/elysia/files.js +7 -11
- package/dist/type/elysia/files.mjs +7 -10
- package/dist/type/elysia/form.js +2 -3
- package/dist/type/elysia/form.mjs +3 -3
- package/dist/type/elysia/integer-string.d.ts +1 -1
- package/dist/type/elysia/integer-string.js +4 -30
- package/dist/type/elysia/integer-string.mjs +5 -30
- package/dist/type/elysia/integer.js +3 -12
- package/dist/type/elysia/integer.mjs +3 -11
- package/dist/type/elysia/intersect.js +0 -5
- package/dist/type/elysia/intersect.mjs +0 -5
- package/dist/type/elysia/json-string.d.ts +7 -0
- package/dist/type/elysia/json-string.js +47 -0
- package/dist/type/elysia/json-string.mjs +46 -0
- package/dist/type/elysia/keep-config.d.ts +14 -0
- package/dist/type/elysia/keep-config.js +62 -0
- package/dist/type/elysia/keep-config.mjs +53 -0
- package/dist/type/elysia/maybe-empty.js +3 -4
- package/dist/type/elysia/maybe-empty.mjs +1 -1
- package/dist/type/elysia/nullable.js +2 -3
- package/dist/type/elysia/nullable.mjs +1 -1
- package/dist/type/elysia/number.d.ts +2 -1
- package/dist/type/elysia/number.js +19 -11
- package/dist/type/elysia/number.mjs +18 -10
- package/dist/type/elysia/numeric-enum.d.ts +1 -1
- package/dist/type/elysia/numeric-enum.js +4 -5
- package/dist/type/elysia/numeric-enum.mjs +3 -3
- package/dist/type/elysia/numeric.d.ts +4 -2
- package/dist/type/elysia/numeric.js +20 -17
- package/dist/type/elysia/numeric.mjs +19 -16
- package/dist/type/elysia/object-string.js +2 -37
- package/dist/type/elysia/object-string.mjs +2 -36
- package/dist/type/elysia/object.js +5 -9
- package/dist/type/elysia/object.mjs +5 -9
- package/dist/type/elysia/optional.js +8 -8
- package/dist/type/elysia/optional.mjs +7 -7
- package/dist/type/elysia/problem.d.ts +20 -0
- package/dist/type/elysia/problem.js +25 -0
- package/dist/type/elysia/problem.mjs +24 -0
- package/dist/type/elysia/string.js +4 -3
- package/dist/type/elysia/string.mjs +4 -2
- package/dist/type/elysia/uint8-array.d.ts +1 -1
- package/dist/type/elysia/uint8-array.js +5 -20
- package/dist/type/elysia/uint8-array.mjs +5 -19
- package/dist/type/elysia/union-enum.js +7 -8
- package/dist/type/elysia/union-enum.mjs +6 -6
- package/dist/type/elysia/union.js +0 -5
- package/dist/type/elysia/union.mjs +0 -5
- package/dist/type/elysia/utils.d.ts +2 -4
- package/dist/type/elysia/utils.js +10 -21
- package/dist/type/elysia/utils.mjs +7 -15
- package/dist/type/exports.d.ts +4 -2
- package/dist/type/exports.js +23 -2
- package/dist/type/exports.mjs +11 -2
- package/dist/type/index.d.ts +10 -2
- package/dist/type/index.js +62 -15
- package/dist/type/index.mjs +65 -11
- package/dist/type/shared.d.ts +3 -9
- package/dist/type/shared.js +44 -97
- package/dist/type/shared.mjs +43 -97
- package/dist/type/sync-require.d.ts +11 -0
- package/dist/type/sync-require.js +14 -0
- package/dist/type/sync-require.mjs +12 -0
- package/dist/type/typebox-system-lite.d.ts +2 -0
- package/dist/type/typebox-system-lite.js +34 -0
- package/dist/type/typebox-system-lite.mjs +3 -0
- package/dist/type/typebox-system-require.d.ts +7 -0
- package/dist/type/typebox-system-require.js +24 -0
- package/dist/type/typebox-system-require.mjs +23 -0
- package/dist/type/typebox-type-live.d.ts +11 -0
- package/dist/type/typebox-type-live.js +45 -0
- package/dist/type/typebox-type-live.mjs +20 -0
- package/dist/type/typebox-type.d.ts +34 -0
- package/dist/type/typebox-type.js +199 -0
- package/dist/type/typebox-type.mjs +86 -0
- package/dist/type/typebox-value-live.d.ts +11 -0
- package/dist/type/typebox-value-live.js +31 -0
- package/dist/type/typebox-value-live.mjs +13 -0
- package/dist/type/typebox-value-ops.d.ts +4 -0
- package/dist/type/typebox-value-ops.js +90 -0
- package/dist/type/typebox-value-ops.mjs +5 -0
- package/dist/type/typebox-value-require.d.ts +8 -0
- package/dist/type/typebox-value-require.js +28 -0
- package/dist/type/typebox-value-require.mjs +25 -0
- package/dist/type/typebox-value.d.ts +35 -0
- package/dist/type/typebox-value.js +161 -0
- package/dist/type/typebox-value.mjs +74 -0
- package/dist/type/utils.js +1 -10
- package/dist/type/utils.mjs +1 -10
- package/dist/type/validator/clean-safe.d.ts +2 -4
- package/dist/type/validator/clean-safe.js +15 -11
- package/dist/type/validator/clean-safe.mjs +16 -10
- package/dist/type/validator/custom-error.js +12 -16
- package/dist/type/validator/custom-error.mjs +11 -14
- package/dist/type/validator/default-precompute.d.ts +9 -1
- package/dist/type/validator/default-precompute.js +40 -77
- package/dist/type/validator/default-precompute.mjs +37 -74
- package/dist/type/validator/exact-mirror-live.d.ts +8 -0
- package/dist/type/validator/exact-mirror-live.js +22 -0
- package/dist/type/validator/exact-mirror-live.mjs +17 -0
- package/dist/type/validator/exact-mirror-require.d.ts +4 -0
- package/dist/type/validator/exact-mirror-require.js +11 -0
- package/dist/type/validator/exact-mirror-require.mjs +9 -0
- package/dist/type/validator/exact-mirror.js +8 -8
- package/dist/type/validator/exact-mirror.mjs +9 -8
- package/dist/type/validator/frozen-check.js +5 -6
- package/dist/type/validator/frozen-check.mjs +6 -7
- package/dist/type/validator/index.d.ts +1 -0
- package/dist/type/validator/index.js +169 -166
- package/dist/type/validator/index.mjs +162 -158
- package/dist/type/validator/string-codec-aot.d.ts +2 -1
- package/dist/type/validator/string-codec-aot.js +8 -2
- package/dist/type/validator/string-codec-aot.mjs +7 -2
- package/dist/type/validator/validator-cache.d.ts +5 -4
- package/dist/type/validator/validator-cache.js +41 -24
- package/dist/type/validator/validator-cache.mjs +40 -22
- package/dist/types.d.ts +263 -95
- package/dist/universal/constants.d.ts +2 -1
- package/dist/universal/constants.js +3 -1
- package/dist/universal/constants.mjs +2 -1
- package/dist/universal/env.js +2 -3
- package/dist/universal/env.mjs +2 -3
- package/dist/universal/file.d.ts +6 -4
- package/dist/universal/file.js +11 -16
- package/dist/universal/file.mjs +12 -16
- package/dist/universal/index.d.ts +2 -2
- package/dist/universal/is-production.d.ts +1 -2
- package/dist/universal/is-production.js +1 -3
- package/dist/universal/is-production.mjs +2 -3
- package/dist/universal/server.d.ts +0 -272
- package/dist/utils.d.ts +43 -7
- package/dist/utils.js +181 -126
- package/dist/utils.mjs +168 -126
- package/dist/validator/index.d.ts +1 -1
- package/dist/validator/index.js +17 -30
- package/dist/validator/index.mjs +18 -31
- package/dist/validator/route.js +2 -1
- package/dist/validator/route.mjs +2 -1
- package/dist/ws/context.d.ts +8 -1
- package/dist/ws/context.js +68 -44
- package/dist/ws/context.mjs +67 -44
- package/dist/ws/parser.js +10 -20
- package/dist/ws/parser.mjs +10 -20
- package/dist/ws/route.d.ts +2 -2
- package/dist/ws/route.js +249 -141
- package/dist/ws/route.mjs +254 -146
- package/dist/ws/types.d.ts +2 -2
- package/package.json +23 -49
- package/dist/compile/analysis-cache.d.ts +0 -6
- package/dist/compile/analysis-cache.js +0 -12
- package/dist/compile/analysis-cache.mjs +0 -11
- package/dist/cookie/index.d.ts +0 -7
- package/dist/cookie/index.js +0 -13
- package/dist/cookie/index.mjs +0 -7
- package/dist/handler/index.d.ts +0 -2
- package/dist/handler/index.js +0 -5
- package/dist/handler/index.mjs +0 -3
package/dist/plugin/aot/hooks.js
CHANGED
|
@@ -6,7 +6,7 @@ const require_plugin_aot_treeshake = require('./treeshake.js');
|
|
|
6
6
|
const toPosix = (path) => path.replace(/\\/g, "/");
|
|
7
7
|
const VIRTUAL = "\0elysia/compiled";
|
|
8
8
|
const VIRTUAL_TYPE = "\0elysia/type";
|
|
9
|
-
const createAotPluginHooks = (entry, options) => {
|
|
9
|
+
const createAotPluginHooks = (entry, options, moduleCondition = require_plugin_aot_core.resolveEntryModuleKind(entry)) => {
|
|
10
10
|
const entryPath = require_plugin_aot_core.resolveEntry(entry);
|
|
11
11
|
const entryPosix = toPosix(entryPath);
|
|
12
12
|
const entryRealPosix = toPosix(require_plugin_aot_core.realPath(entryPath));
|
|
@@ -22,14 +22,17 @@ const createAotPluginHooks = (entry, options) => {
|
|
|
22
22
|
let virtualType;
|
|
23
23
|
let stub = { ...require_plugin_aot_core.NO_STUB };
|
|
24
24
|
let isElysiaModule = (_path) => false;
|
|
25
|
+
let packageRoot = "";
|
|
25
26
|
return {
|
|
26
27
|
async buildStart() {
|
|
27
|
-
const generated = initial ? await require_plugin_aot_core.generateCompiledArtifacts(entry, options) : await require_plugin_aot_core.generateCompiledArtifactsIsolated(entry, options);
|
|
28
|
+
const generated = initial ? await require_plugin_aot_core.generateCompiledArtifacts(entry, options, moduleCondition) : await require_plugin_aot_core.generateCompiledArtifactsIsolated(entry, options, moduleCondition);
|
|
28
29
|
initial = false;
|
|
29
30
|
source = generated.source;
|
|
30
31
|
stub = generated.stub;
|
|
31
32
|
virtualType = generated.virtualType;
|
|
32
|
-
|
|
33
|
+
const pkgRoot = require_plugin_aot_core.resolveElysiaRoot(entryPath);
|
|
34
|
+
isElysiaModule = require_plugin_aot_core.makeIsElysiaModule(pkgRoot);
|
|
35
|
+
packageRoot = toPosix(pkgRoot);
|
|
33
36
|
},
|
|
34
37
|
buildEnd() {
|
|
35
38
|
if (!entryMatched) throw new Error(`[elysia-aot] entry "${entry}" never appeared in the Vite module graph. Compiled manifest was not injected. Check that the plugin entry matches a build input.`);
|
|
@@ -42,12 +45,17 @@ const createAotPluginHooks = (entry, options) => {
|
|
|
42
45
|
if (id === VIRTUAL) return source;
|
|
43
46
|
if (id === VIRTUAL_TYPE) return virtualType;
|
|
44
47
|
},
|
|
45
|
-
|
|
48
|
+
transform(code, id) {
|
|
46
49
|
const cleanId = id.split("?", 1)[0];
|
|
47
50
|
for (const key of Object.keys(require_plugin_aot_core.STUB_SOURCES)) {
|
|
48
51
|
if (!stub[key]) continue;
|
|
52
|
+
if (key === "staticClone" && (!isElysiaModule(cleanId) || !/^(dist|src)\/compile\/handler\/static-clone-resolver\.(m?js|ts)$/.test(toPosix(cleanId).slice(packageRoot.length + 1)))) continue;
|
|
49
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);
|
|
50
54
|
}
|
|
55
|
+
if (require_plugin_aot_core.TYPEBOX_REQUIRE_FILTER.test(cleanId)) return `export const requireTypebox = () => undefined\nexport const importTypebox = () => undefined\n`;
|
|
56
|
+
if (require_plugin_aot_core.EXACT_MIRROR_REQUIRE_FILTER.test(cleanId)) return `export const requireExactMirror = () => undefined\n`;
|
|
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
|
+
if (require_plugin_aot_core.TYPEBOX_SYSTEM_LITE_FILTER.test(cleanId)) return `export * from 'typebox/system'\n`;
|
|
51
59
|
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);
|
|
52
60
|
if (stub.adapter === "web-standard" && require_plugin_aot_core.ADAPTER_BUN_FILTER.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(require_plugin_aot_core.bunAdapterStubSource, cleanId);
|
|
53
61
|
if (stub.isProduction && require_plugin_aot_core.IS_PRODUCTION_FILTER.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(`export const isProduction = () => true\n`, cleanId);
|
|
@@ -56,17 +64,30 @@ const createAotPluginHooks = (entry, options) => {
|
|
|
56
64
|
if (stub.isProduction && isElysiaModule(cleanId)) out = require_plugin_aot_core.rewriteIsProductionCalls(out);
|
|
57
65
|
if (isEntry(cleanId)) {
|
|
58
66
|
entryMatched = true;
|
|
59
|
-
out = `import 'elysia/compiled'\n
|
|
67
|
+
out = (moduleCondition === "cjs" ? `require('elysia/compiled')\n` : `import 'elysia/compiled'\n`) + out;
|
|
60
68
|
}
|
|
61
69
|
return out === code ? void 0 : out;
|
|
62
70
|
},
|
|
63
71
|
isTransformCandidate(id) {
|
|
64
72
|
const cleanId = id.split("?", 1)[0];
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
return isEntry(cleanId) || require_plugin_aot_core.ELYSIA_MODULE_FILTER.test(cleanId) || require_plugin_aot_core.SOURCE_REGEX.test(cleanId) && !cleanId.includes("node_modules");
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const createTypeboxWiringHooks = () => {
|
|
78
|
+
return {
|
|
79
|
+
async buildStart() {},
|
|
80
|
+
buildEnd() {},
|
|
81
|
+
resolveId() {},
|
|
82
|
+
load() {},
|
|
83
|
+
transform(_code, id) {
|
|
84
|
+
const cleanId = id.split("?", 1)[0];
|
|
85
|
+
if (cleanId.endsWith(".js")) return void 0;
|
|
86
|
+
if (require_plugin_aot_core.TYPEBOX_TYPE_FILTER.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(`export * from './typebox-type-live'\n`, cleanId);
|
|
87
|
+
for (const { filter, source } of require_plugin_aot_core.STUB_SOURCES.typeboxValue) if (filter.test(cleanId)) return require_plugin_aot_core.alignStubExtensions(source, cleanId);
|
|
88
|
+
},
|
|
89
|
+
isTransformCandidate(id) {
|
|
90
|
+
return require_plugin_aot_core.ELYSIA_MODULE_FILTER.test(id.split("?", 1)[0]);
|
|
70
91
|
}
|
|
71
92
|
};
|
|
72
93
|
};
|
|
@@ -74,17 +95,17 @@ const resolveLoader = (path) => {
|
|
|
74
95
|
const ext = path.slice(path.lastIndexOf("."));
|
|
75
96
|
return ext === ".js" || ext === ".mjs" || ext === ".cjs" ? "js" : ext === ".jsx" ? "jsx" : ext === ".tsx" ? "tsx" : "ts";
|
|
76
97
|
};
|
|
77
|
-
async function setupAotOnLoad(build, hooks,
|
|
98
|
+
async function setupAotOnLoad(build, hooks, readText, resolveDir) {
|
|
78
99
|
await hooks.buildStart();
|
|
79
100
|
const virtualLoad = (id) => () => ({
|
|
80
101
|
contents: hooks.load(id),
|
|
81
102
|
loader: "js",
|
|
82
103
|
...resolveDir !== void 0 ? { resolveDir } : {}
|
|
83
104
|
});
|
|
84
|
-
build.onResolve({ filter: /^elysia\/compiled$/ }, () => ({
|
|
105
|
+
build.onResolve({ filter: /^elysia\/compiled$/ }, () => hooks.resolveId("elysia/compiled") !== void 0 ? {
|
|
85
106
|
path: "manifest",
|
|
86
107
|
namespace: "elysia-aot"
|
|
87
|
-
})
|
|
108
|
+
} : void 0);
|
|
88
109
|
build.onLoad({
|
|
89
110
|
filter: /.*/,
|
|
90
111
|
namespace: "elysia-aot"
|
|
@@ -100,7 +121,7 @@ async function setupAotOnLoad(build, hooks, { readText, resolveDir }) {
|
|
|
100
121
|
build.onLoad({ filter: require_plugin_aot_core.SOURCE_REGEX }, async (args) => {
|
|
101
122
|
if (!hooks.isTransformCandidate(args.path)) return void 0;
|
|
102
123
|
const original = await readText(args.path);
|
|
103
|
-
const contents =
|
|
124
|
+
const contents = hooks.transform(original, args.path);
|
|
104
125
|
if (contents === void 0) return void 0;
|
|
105
126
|
return {
|
|
106
127
|
contents,
|
|
@@ -111,4 +132,5 @@ async function setupAotOnLoad(build, hooks, { readText, resolveDir }) {
|
|
|
111
132
|
|
|
112
133
|
//#endregion
|
|
113
134
|
exports.createAotPluginHooks = createAotPluginHooks;
|
|
135
|
+
exports.createTypeboxWiringHooks = createTypeboxWiringHooks;
|
|
114
136
|
exports.setupAotOnLoad = setupAotOnLoad;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ADAPTER_BUN_FILTER, ADAPTER_CONSTANTS_FILTER, ELYSIA_MODULE_FILTER, IS_PRODUCTION_FILTER, NO_STUB, SOURCE_REGEX, STUB_SOURCES, adapterConstantsSource, alignStubExtensions, bunAdapterStubSource, generateCompiledArtifacts, generateCompiledArtifactsIsolated, makeIsElysiaModule, realPath, resolveElysiaRoot, resolveEntry, rewriteIsProductionCalls } from "./core.mjs";
|
|
1
|
+
import { ADAPTER_BUN_FILTER, ADAPTER_CONSTANTS_FILTER, ELYSIA_MODULE_FILTER, EXACT_MIRROR_REQUIRE_FILTER, IS_PRODUCTION_FILTER, NO_STUB, SOURCE_REGEX, STUB_SOURCES, TYPEBOX_REQUIRE_FILTER, TYPEBOX_SYSTEM_LITE_FILTER, TYPEBOX_TYPE_FILTER, adapterConstantsSource, alignStubExtensions, bunAdapterStubSource, generateCompiledArtifacts, generateCompiledArtifactsIsolated, makeIsElysiaModule, realPath, resolveElysiaRoot, resolveEntry, resolveEntryModuleKind, rewriteIsProductionCalls } from "./core.mjs";
|
|
2
2
|
import { rewriteTypeImport } from "./treeshake.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin/aot/hooks.ts
|
|
5
5
|
const toPosix = (path) => path.replace(/\\/g, "/");
|
|
6
6
|
const VIRTUAL = "\0elysia/compiled";
|
|
7
7
|
const VIRTUAL_TYPE = "\0elysia/type";
|
|
8
|
-
const createAotPluginHooks = (entry, options) => {
|
|
8
|
+
const createAotPluginHooks = (entry, options, moduleCondition = resolveEntryModuleKind(entry)) => {
|
|
9
9
|
const entryPath = resolveEntry(entry);
|
|
10
10
|
const entryPosix = toPosix(entryPath);
|
|
11
11
|
const entryRealPosix = toPosix(realPath(entryPath));
|
|
@@ -21,14 +21,17 @@ const createAotPluginHooks = (entry, options) => {
|
|
|
21
21
|
let virtualType;
|
|
22
22
|
let stub = { ...NO_STUB };
|
|
23
23
|
let isElysiaModule = (_path) => false;
|
|
24
|
+
let packageRoot = "";
|
|
24
25
|
return {
|
|
25
26
|
async buildStart() {
|
|
26
|
-
const generated = initial ? await generateCompiledArtifacts(entry, options) : await generateCompiledArtifactsIsolated(entry, options);
|
|
27
|
+
const generated = initial ? await generateCompiledArtifacts(entry, options, moduleCondition) : await generateCompiledArtifactsIsolated(entry, options, moduleCondition);
|
|
27
28
|
initial = false;
|
|
28
29
|
source = generated.source;
|
|
29
30
|
stub = generated.stub;
|
|
30
31
|
virtualType = generated.virtualType;
|
|
31
|
-
|
|
32
|
+
const pkgRoot = resolveElysiaRoot(entryPath);
|
|
33
|
+
isElysiaModule = makeIsElysiaModule(pkgRoot);
|
|
34
|
+
packageRoot = toPosix(pkgRoot);
|
|
32
35
|
},
|
|
33
36
|
buildEnd() {
|
|
34
37
|
if (!entryMatched) throw new Error(`[elysia-aot] entry "${entry}" never appeared in the Vite module graph. Compiled manifest was not injected. Check that the plugin entry matches a build input.`);
|
|
@@ -41,12 +44,17 @@ const createAotPluginHooks = (entry, options) => {
|
|
|
41
44
|
if (id === VIRTUAL) return source;
|
|
42
45
|
if (id === VIRTUAL_TYPE) return virtualType;
|
|
43
46
|
},
|
|
44
|
-
|
|
47
|
+
transform(code, id) {
|
|
45
48
|
const cleanId = id.split("?", 1)[0];
|
|
46
49
|
for (const key of Object.keys(STUB_SOURCES)) {
|
|
47
50
|
if (!stub[key]) continue;
|
|
51
|
+
if (key === "staticClone" && (!isElysiaModule(cleanId) || !/^(dist|src)\/compile\/handler\/static-clone-resolver\.(m?js|ts)$/.test(toPosix(cleanId).slice(packageRoot.length + 1)))) continue;
|
|
48
52
|
for (const { filter, source: stubSource } of STUB_SOURCES[key]) if (filter.test(cleanId)) return alignStubExtensions(stubSource, cleanId);
|
|
49
53
|
}
|
|
54
|
+
if (TYPEBOX_REQUIRE_FILTER.test(cleanId)) return `export const requireTypebox = () => undefined\nexport const importTypebox = () => undefined\n`;
|
|
55
|
+
if (EXACT_MIRROR_REQUIRE_FILTER.test(cleanId)) return `export const requireExactMirror = () => undefined\n`;
|
|
56
|
+
if (TYPEBOX_TYPE_FILTER.test(cleanId)) return alignStubExtensions(`export * from './typebox-type-live'\n`, cleanId);
|
|
57
|
+
if (TYPEBOX_SYSTEM_LITE_FILTER.test(cleanId)) return `export * from 'typebox/system'\n`;
|
|
50
58
|
if (stub.adapter !== false && ADAPTER_CONSTANTS_FILTER.test(cleanId)) return alignStubExtensions(adapterConstantsSource(stub.adapter), cleanId);
|
|
51
59
|
if (stub.adapter === "web-standard" && ADAPTER_BUN_FILTER.test(cleanId)) return alignStubExtensions(bunAdapterStubSource, cleanId);
|
|
52
60
|
if (stub.isProduction && IS_PRODUCTION_FILTER.test(cleanId)) return alignStubExtensions(`export const isProduction = () => true\n`, cleanId);
|
|
@@ -55,17 +63,30 @@ const createAotPluginHooks = (entry, options) => {
|
|
|
55
63
|
if (stub.isProduction && isElysiaModule(cleanId)) out = rewriteIsProductionCalls(out);
|
|
56
64
|
if (isEntry(cleanId)) {
|
|
57
65
|
entryMatched = true;
|
|
58
|
-
out = `import 'elysia/compiled'\n
|
|
66
|
+
out = (moduleCondition === "cjs" ? `require('elysia/compiled')\n` : `import 'elysia/compiled'\n`) + out;
|
|
59
67
|
}
|
|
60
68
|
return out === code ? void 0 : out;
|
|
61
69
|
},
|
|
62
70
|
isTransformCandidate(id) {
|
|
63
71
|
const cleanId = id.split("?", 1)[0];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
return isEntry(cleanId) || ELYSIA_MODULE_FILTER.test(cleanId) || SOURCE_REGEX.test(cleanId) && !cleanId.includes("node_modules");
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const createTypeboxWiringHooks = () => {
|
|
77
|
+
return {
|
|
78
|
+
async buildStart() {},
|
|
79
|
+
buildEnd() {},
|
|
80
|
+
resolveId() {},
|
|
81
|
+
load() {},
|
|
82
|
+
transform(_code, id) {
|
|
83
|
+
const cleanId = id.split("?", 1)[0];
|
|
84
|
+
if (cleanId.endsWith(".js")) return void 0;
|
|
85
|
+
if (TYPEBOX_TYPE_FILTER.test(cleanId)) return alignStubExtensions(`export * from './typebox-type-live'\n`, cleanId);
|
|
86
|
+
for (const { filter, source } of STUB_SOURCES.typeboxValue) if (filter.test(cleanId)) return alignStubExtensions(source, cleanId);
|
|
87
|
+
},
|
|
88
|
+
isTransformCandidate(id) {
|
|
89
|
+
return ELYSIA_MODULE_FILTER.test(id.split("?", 1)[0]);
|
|
69
90
|
}
|
|
70
91
|
};
|
|
71
92
|
};
|
|
@@ -73,17 +94,17 @@ const resolveLoader = (path) => {
|
|
|
73
94
|
const ext = path.slice(path.lastIndexOf("."));
|
|
74
95
|
return ext === ".js" || ext === ".mjs" || ext === ".cjs" ? "js" : ext === ".jsx" ? "jsx" : ext === ".tsx" ? "tsx" : "ts";
|
|
75
96
|
};
|
|
76
|
-
async function setupAotOnLoad(build, hooks,
|
|
97
|
+
async function setupAotOnLoad(build, hooks, readText, resolveDir) {
|
|
77
98
|
await hooks.buildStart();
|
|
78
99
|
const virtualLoad = (id) => () => ({
|
|
79
100
|
contents: hooks.load(id),
|
|
80
101
|
loader: "js",
|
|
81
102
|
...resolveDir !== void 0 ? { resolveDir } : {}
|
|
82
103
|
});
|
|
83
|
-
build.onResolve({ filter: /^elysia\/compiled$/ }, () => ({
|
|
104
|
+
build.onResolve({ filter: /^elysia\/compiled$/ }, () => hooks.resolveId("elysia/compiled") !== void 0 ? {
|
|
84
105
|
path: "manifest",
|
|
85
106
|
namespace: "elysia-aot"
|
|
86
|
-
})
|
|
107
|
+
} : void 0);
|
|
87
108
|
build.onLoad({
|
|
88
109
|
filter: /.*/,
|
|
89
110
|
namespace: "elysia-aot"
|
|
@@ -99,7 +120,7 @@ async function setupAotOnLoad(build, hooks, { readText, resolveDir }) {
|
|
|
99
120
|
build.onLoad({ filter: SOURCE_REGEX }, async (args) => {
|
|
100
121
|
if (!hooks.isTransformCandidate(args.path)) return void 0;
|
|
101
122
|
const original = await readText(args.path);
|
|
102
|
-
const contents =
|
|
123
|
+
const contents = hooks.transform(original, args.path);
|
|
103
124
|
if (contents === void 0) return void 0;
|
|
104
125
|
return {
|
|
105
126
|
contents,
|
|
@@ -109,4 +130,4 @@ async function setupAotOnLoad(build, hooks, { readText, resolveDir }) {
|
|
|
109
130
|
}
|
|
110
131
|
|
|
111
132
|
//#endregion
|
|
112
|
-
export { createAotPluginHooks, setupAotOnLoad };
|
|
133
|
+
export { createAotPluginHooks, createTypeboxWiringHooks, setupAotOnLoad };
|
|
@@ -8,16 +8,12 @@ interface AotLoaderContext {
|
|
|
8
8
|
getOptions(): {
|
|
9
9
|
token?: string;
|
|
10
10
|
} | undefined;
|
|
11
|
-
async(): (err: Error | null | undefined, content?: string, sourceMap?: unknown) => void;
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
13
|
* webpack/rspack-style JS loader. Delegates to `hooks.transform`, which returns
|
|
15
14
|
* `undefined` for any module it doesn't rewrite so the loader passes the source through unchanged.
|
|
16
15
|
* `enforce: 'pre'` runs this before the swc/babel loaders, mirroring unplugin's `enforce: 'pre'`.
|
|
17
|
-
*
|
|
18
|
-
* Uses `this.async()` because `hooks.transform` can be async (isolated
|
|
19
|
-
* regeneration in watch flows).
|
|
20
16
|
*/
|
|
21
|
-
declare function elysiaAotLoader(this: AotLoaderContext, source: string):
|
|
17
|
+
declare function elysiaAotLoader(this: AotLoaderContext, source: string): string;
|
|
22
18
|
//#endregion
|
|
23
19
|
export { elysiaAotLoader as default, registerAotHooks, unregisterAotHooks };
|
|
@@ -23,19 +23,10 @@ function unregisterAotHooks(token) {
|
|
|
23
23
|
* webpack/rspack-style JS loader. Delegates to `hooks.transform`, which returns
|
|
24
24
|
* `undefined` for any module it doesn't rewrite so the loader passes the source through unchanged.
|
|
25
25
|
* `enforce: 'pre'` runs this before the swc/babel loaders, mirroring unplugin's `enforce: 'pre'`.
|
|
26
|
-
*
|
|
27
|
-
* Uses `this.async()` because `hooks.transform` can be async (isolated
|
|
28
|
-
* regeneration in watch flows).
|
|
29
26
|
*/
|
|
30
27
|
function elysiaAotLoader(source) {
|
|
31
|
-
const callback = this.async();
|
|
32
28
|
const token = this.getOptions()?.token;
|
|
33
|
-
|
|
34
|
-
if (!hooks) {
|
|
35
|
-
callback(null, source);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
Promise.resolve(hooks.transform(source, this.resourcePath)).then((out) => callback(null, out === void 0 ? source : out), (error) => callback(error));
|
|
29
|
+
return (token ? registry.get(token) : void 0)?.transform(source, this.resourcePath) ?? source;
|
|
39
30
|
}
|
|
40
31
|
|
|
41
32
|
//#endregion
|
|
@@ -21,19 +21,10 @@ function unregisterAotHooks(token) {
|
|
|
21
21
|
* webpack/rspack-style JS loader. Delegates to `hooks.transform`, which returns
|
|
22
22
|
* `undefined` for any module it doesn't rewrite so the loader passes the source through unchanged.
|
|
23
23
|
* `enforce: 'pre'` runs this before the swc/babel loaders, mirroring unplugin's `enforce: 'pre'`.
|
|
24
|
-
*
|
|
25
|
-
* Uses `this.async()` because `hooks.transform` can be async (isolated
|
|
26
|
-
* regeneration in watch flows).
|
|
27
24
|
*/
|
|
28
25
|
function elysiaAotLoader(source) {
|
|
29
|
-
const callback = this.async();
|
|
30
26
|
const token = this.getOptions()?.token;
|
|
31
|
-
|
|
32
|
-
if (!hooks) {
|
|
33
|
-
callback(null, source);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
Promise.resolve(hooks.transform(source, this.resourcePath)).then((out) => callback(null, out === void 0 ? source : out), (error) => callback(error));
|
|
27
|
+
return (token ? registry.get(token) : void 0)?.transform(source, this.resourcePath) ?? source;
|
|
37
28
|
}
|
|
38
29
|
|
|
39
30
|
//#endregion
|
|
@@ -11,10 +11,7 @@ let node_crypto = require("node:crypto");
|
|
|
11
11
|
//#region src/plugin/aot/rspack.ts
|
|
12
12
|
const PLUGIN = "elysia-aot";
|
|
13
13
|
let tokenCounter = 0;
|
|
14
|
-
|
|
15
|
-
const moduleUrl = require("url").pathToFileURL(__filename).href;
|
|
16
|
-
return (0, node_path.resolve)((0, node_path.dirname)((0, node_url.fileURLToPath)(moduleUrl)), "rspack-loader" + require_plugin_aot_core.siblingModuleExt(moduleUrl));
|
|
17
|
-
}
|
|
14
|
+
const loaderPath = () => (0, node_url.fileURLToPath)(new URL("./rspack-loader" + require_plugin_aot_core.siblingModuleExt(require("url").pathToFileURL(__filename).href), require("url").pathToFileURL(__filename).href));
|
|
18
15
|
/**
|
|
19
16
|
* Elysia AOT build plugin
|
|
20
17
|
*
|
|
@@ -39,7 +36,7 @@ const aot = (entry, options) => {
|
|
|
39
36
|
const apply = (rawCompiler) => {
|
|
40
37
|
const compiler = rawCompiler;
|
|
41
38
|
compiler.options.module.rules.push({
|
|
42
|
-
test:
|
|
39
|
+
test: hooks.isTransformCandidate,
|
|
43
40
|
enforce: "pre",
|
|
44
41
|
use: [{
|
|
45
42
|
loader: loaderPath(),
|
|
@@ -2,17 +2,14 @@ import { resolveEntry, siblingModuleExt } from "./core.mjs";
|
|
|
2
2
|
import { createAotPluginHooks } from "./hooks.mjs";
|
|
3
3
|
import { registerAotHooks, unregisterAotHooks } from "./rspack-loader.mjs";
|
|
4
4
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
5
|
-
import {
|
|
5
|
+
import { join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
|
|
9
9
|
//#region src/plugin/aot/rspack.ts
|
|
10
10
|
const PLUGIN = "elysia-aot";
|
|
11
11
|
let tokenCounter = 0;
|
|
12
|
-
|
|
13
|
-
const moduleUrl = import.meta.url;
|
|
14
|
-
return resolve(dirname(fileURLToPath(moduleUrl)), "rspack-loader" + siblingModuleExt(moduleUrl));
|
|
15
|
-
}
|
|
12
|
+
const loaderPath = () => fileURLToPath(new URL("./rspack-loader" + siblingModuleExt(import.meta.url), import.meta.url));
|
|
16
13
|
/**
|
|
17
14
|
* Elysia AOT build plugin
|
|
18
15
|
*
|
|
@@ -37,7 +34,7 @@ const aot = (entry, options) => {
|
|
|
37
34
|
const apply = (rawCompiler) => {
|
|
38
35
|
const compiler = rawCompiler;
|
|
39
36
|
compiler.options.module.rules.push({
|
|
40
|
-
test:
|
|
37
|
+
test: hooks.isTransformCandidate,
|
|
41
38
|
enforce: "pre",
|
|
42
39
|
use: [{
|
|
43
40
|
loader: loaderPath(),
|
|
@@ -1,50 +1,14 @@
|
|
|
1
1
|
import { AotFingerprint, CapturedHandler, CapturedValidator } from "../../compile/aot.js";
|
|
2
2
|
import { AnyElysia } from "../../base.js";
|
|
3
3
|
import { JITProbeResult } from "../../compile/jit-probe.js";
|
|
4
|
+
import { ElysiaAotOptions } from "./core.js";
|
|
4
5
|
|
|
5
6
|
//#region src/plugin/aot/source.d.ts
|
|
6
7
|
type AotTarget = 'bun' | 'node' | 'workerd';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Deploy target for build-time-baked codegen consts. Lets you build on one
|
|
12
|
-
* runtime and deploy to another e.g. build under Bun with
|
|
13
|
-
* `target: 'workerd'` so the manifest bakes `Object.fromEntries(...)` instead
|
|
14
|
-
* of the Bun-only `Headers.toJSON()`. Removes the need to generate the
|
|
15
|
-
* manifest under Node for a workerd deploy.
|
|
16
|
-
*
|
|
17
|
-
* @default the build runtime
|
|
18
|
-
*/
|
|
19
|
-
target?: AotTarget;
|
|
20
|
-
/**
|
|
21
|
-
* Split the emitted validator manifest into lazily-materialized groups
|
|
22
|
-
*
|
|
23
|
-
* Validator entries are registered as grouped thunks: a group's
|
|
24
|
-
* validators are constructed on the first request to any route in that
|
|
25
|
-
* group, trading first-request latency in unbuilt groups for lower
|
|
26
|
-
* startup cost. Handlers are always eager. Only validator construction
|
|
27
|
-
* is deferred. Pass a number to set the group size explicitly.
|
|
28
|
-
*
|
|
29
|
-
* @default decided by Elysia based on route batch scale
|
|
30
|
-
*/
|
|
31
|
-
lazy?: boolean | number;
|
|
32
|
-
/**
|
|
33
|
-
* Specifier the generated module imports `Compiled` from
|
|
34
|
-
* Must resolve to the same `elysia` instance the app runs
|
|
35
|
-
*
|
|
36
|
-
* @default 'elysia'
|
|
37
|
-
*/
|
|
38
|
-
registerFrom?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Specifier the generated module imports the `Reconstruct` table from,
|
|
41
|
-
* only emitted when the manifest carries validators. The table is pure,
|
|
42
|
-
* so unlike `registerFrom` it may resolve to any elysia copy the
|
|
43
|
-
* registration itself goes through `Compiled` (from `registerFrom`)
|
|
44
|
-
*
|
|
45
|
-
* @default 'elysia/reconstruct'
|
|
46
|
-
*/
|
|
47
|
-
reconstructFrom?: string;
|
|
8
|
+
type AotModuleCondition = 'esm' | 'cjs';
|
|
9
|
+
interface CompileToSourceOptions extends Pick<ElysiaAotOptions, 'registerFrom' | 'reconstructFrom' | 'lazy' | 'target'> {
|
|
10
|
+
/** @internal Package condition used by the entry that owns this manifest. */
|
|
11
|
+
moduleCondition?: AotModuleCondition;
|
|
48
12
|
}
|
|
49
13
|
declare const autoGroupSize: (routes: number) => number;
|
|
50
14
|
declare function compileToSource(app: AnyElysia, options?: CompileToSourceOptions): Promise<string>;
|
|
@@ -57,4 +21,4 @@ interface CapturedArtifacts {
|
|
|
57
21
|
declare function captureArtifacts(app: AnyElysia, options?: CompileToSourceOptions): Promise<CapturedArtifacts>;
|
|
58
22
|
declare function replayStubbability(app: AnyElysia, handlers: CapturedHandler[]): JITProbeResult;
|
|
59
23
|
//#endregion
|
|
60
|
-
export { AotTarget, CapturedArtifacts, CompileToSourceOptions, autoGroupSize, captureArtifacts, compileToSource, replayStubbability };
|
|
24
|
+
export { AotModuleCondition, AotTarget, CapturedArtifacts, CompileToSourceOptions, autoGroupSize, captureArtifacts, compileToSource, replayStubbability };
|