@teyik0/furin 0.4.0-alpha.2 → 0.5.0-alpha.1
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/build/compile-entry.d.ts +2 -1
- package/dist/build/compile-entry.ts +17 -13
- package/dist/build/elysia-aot.d.ts +9 -0
- package/dist/build/entry-template.d.ts +5 -1
- package/dist/build/entry-template.ts +24 -5
- package/dist/build/index.js +753 -453
- package/dist/build/server-app-entry.d.ts +12 -0
- package/dist/cache.d.ts +1 -0
- package/dist/cache.js +185 -0
- package/dist/cli/index.js +766 -466
- package/dist/client/internal/runtime-types.d.ts +8 -1
- package/dist/client/link.js +221 -11
- package/dist/client/sync.d.ts +1 -0
- package/dist/config.d.ts +22 -21
- package/dist/config.js +1 -1
- package/dist/define-route.d.ts +273 -1009
- package/dist/furin.d.ts +20 -5
- package/dist/furin.js +6222 -5383
- package/dist/plugin/routes.d.ts +6 -0
- package/dist/server/assets/production.d.ts +3 -0
- package/dist/server/auto-invalidate/plugin.d.ts +8 -24
- package/dist/server/auto-invalidate/runtime.d.ts +2 -2
- package/dist/server/cache/invalidation.d.ts +1 -1
- package/dist/server/cache/page-cache-state.d.ts +5 -0
- package/dist/server/cache/page-cache.d.ts +53 -0
- package/dist/server/cache/redis/index.d.ts +39 -0
- package/dist/server/cache/redis/index.js +396 -0
- package/dist/server/cache/redis/scripts.d.ts +6 -0
- package/dist/server/context-logger.d.ts +2 -2
- package/dist/server/dev/runtime.production.d.ts +1 -0
- package/dist/server/dev-page-plugin.d.ts +7 -0
- package/dist/server/evlog.d.ts +14 -0
- package/dist/server/internal.d.ts +6 -0
- package/dist/server/internal.js +2537 -0
- package/dist/server/render/not-found.d.ts +1 -1
- package/dist/server/render/ssg.d.ts +5 -0
- package/dist/server/render/static-params.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +1 -1
- package/dist/server/router/schemas.d.ts +1 -0
- package/dist/server/sync/index.js +794 -116
- package/dist/server/sync/plugin.d.ts +31 -158
- package/dist/server/sync/stream.d.ts +34 -49
- package/dist/shared/elysia-contract.d.ts +8 -14
- package/package.json +13 -7
- package/src/adapter/README.md +9 -2
- package/src/adapter/bun.ts +73 -27
- package/src/adapter/package.ts +6 -2
- package/src/adapter/runtime-build.ts +11 -4
- package/src/adapter/static.ts +8 -6
- package/src/adapter/vercel.ts +49 -30
- package/src/build/client.ts +18 -1
- package/src/build/compile-entry.ts +17 -13
- package/src/build/elysia-aot.ts +102 -0
- package/src/build/entry-template.ts +24 -5
- package/src/build/index.ts +0 -5
- package/src/build/production-instrumentation.ts +2 -2
- package/src/build/server-app-entry.ts +60 -0
- package/src/build/shared.ts +3 -1
- package/src/build/ssg-cache.ts +5 -10
- package/src/build/virtual-entry.ts +5 -4
- package/src/cache.ts +12 -0
- package/src/cli/config.ts +3 -3
- package/src/cli/index.ts +5 -2
- package/src/client/internal/runtime-types.ts +10 -1
- package/src/client/sync.ts +1 -0
- package/src/config.ts +3 -2
- package/src/define-route.ts +266 -128
- package/src/furin.ts +138 -149
- package/src/plugin/route-config-autofix.ts +11 -2
- package/src/plugin/routes.ts +85 -29
- package/src/server/assets/production.ts +99 -0
- package/src/server/auto-invalidate/plugin.ts +4 -4
- package/src/server/auto-invalidate/runtime.ts +74 -42
- package/src/server/browser-events/plugin.ts +6 -1
- package/src/server/cache/invalidation.ts +61 -20
- package/src/server/cache/page-cache-state.ts +22 -0
- package/src/server/cache/page-cache.ts +300 -0
- package/src/server/cache/redis/index.ts +350 -0
- package/src/server/cache/redis/scripts.ts +160 -0
- package/src/server/context-logger.ts +5 -5
- package/src/server/dev/runtime.production.ts +4 -0
- package/src/server/dev-page-plugin.ts +54 -10
- package/src/server/evlog.ts +99 -0
- package/src/server/internal.ts +7 -0
- package/src/server/render/isr.ts +480 -132
- package/src/server/render/loaders.ts +18 -12
- package/src/server/render/not-found.ts +4 -4
- package/src/server/render/ppr-document.ts +2 -2
- package/src/server/render/ppr-route.ts +193 -7
- package/src/server/render/ssg.ts +148 -4
- package/src/server/render/ssr.ts +4 -6
- package/src/server/render/static-params.ts +174 -0
- package/src/server/router/defined-route.ts +2 -1
- package/src/server/router/hmr.ts +2 -0
- package/src/server/router/plugin.ts +44 -35
- package/src/server/router/schema-merge.ts +1 -1
- package/src/server/router/schemas.ts +174 -61
- package/src/server/sync/plugin.ts +14 -10
- package/src/server/sync/response.ts +3 -3
- package/src/shared/elysia-contract.ts +23 -25
|
@@ -6,180 +6,53 @@ export type SyncRouteOption = false | InvalidationInput | {
|
|
|
6
6
|
};
|
|
7
7
|
/** @deprecated Use SyncRouteOption. */
|
|
8
8
|
export type SyncInput = Exclude<SyncRouteOption, false>;
|
|
9
|
-
export declare function furinSync(options: SyncRuntimeOptions): Elysia<"", {
|
|
10
|
-
decorator: {};
|
|
11
|
-
store: {};
|
|
12
|
-
derive: {};
|
|
13
|
-
resolve: {};
|
|
14
|
-
}, {
|
|
9
|
+
export declare function furinSync(options: SyncRuntimeOptions): Elysia<"", "local", import("elysia").DefaultSingleton, {
|
|
15
10
|
typebox: {};
|
|
16
|
-
error:
|
|
11
|
+
error: [];
|
|
17
12
|
}, {
|
|
18
13
|
schema: {};
|
|
19
|
-
|
|
14
|
+
schemas: {};
|
|
20
15
|
macro: Partial<{
|
|
21
16
|
readonly sync: SyncRouteOption;
|
|
22
17
|
}>;
|
|
23
18
|
macroFn: {
|
|
24
19
|
readonly sync: (input: SyncRouteOption) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
query: Record<string, string>;
|
|
28
|
-
params: {};
|
|
29
|
-
headers: Record<string, string | undefined>;
|
|
30
|
-
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
31
|
-
server: import("elysia/universal/server").Server | null;
|
|
20
|
+
transform({ request }: {
|
|
21
|
+
server: import("elysia").Server | null;
|
|
32
22
|
redirect: import("elysia").redirect;
|
|
33
23
|
set: {
|
|
34
24
|
headers: import("elysia").HTTPHeaders;
|
|
35
25
|
status?: number | keyof import("elysia").StatusMap;
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
27
|
+
redirect?: never;
|
|
38
28
|
};
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = import("elysia").StatusResponse<Code>>(code: Code, response?: T) => import("elysia").ElysiaStatus<Code, T, import("elysia").NumericStatus<Code>>;
|
|
30
|
+
problem: typeof import("elysia").problem;
|
|
31
|
+
defer: (fn: import("elysia/types").AfterResponseHandler<import("elysia/types").IntersectIfObjectSchema<import("elysia/types").UnwrapMacroSchema<{
|
|
32
|
+
body: undefined;
|
|
33
|
+
headers: undefined;
|
|
34
|
+
query: undefined;
|
|
35
|
+
params: undefined;
|
|
36
|
+
cookie: undefined;
|
|
37
|
+
response: undefined;
|
|
38
|
+
}, {}>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, import("elysia").DefaultSingleton & {
|
|
39
|
+
derive: Partial<{}>;
|
|
40
|
+
} & {
|
|
41
|
+
derive: Partial<{}>;
|
|
42
|
+
}>) => import("elysia/types").MaybePromise<void>;
|
|
43
|
+
readonly path: string;
|
|
44
|
+
route?: string;
|
|
45
|
+
rid?: string;
|
|
41
46
|
request: Request;
|
|
42
47
|
store: {};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
readonly 201: "Created";
|
|
50
|
-
readonly 202: "Accepted";
|
|
51
|
-
readonly 203: "Non-Authoritative Information";
|
|
52
|
-
readonly 204: "No Content";
|
|
53
|
-
readonly 205: "Reset Content";
|
|
54
|
-
readonly 206: "Partial Content";
|
|
55
|
-
readonly 207: "Multi-Status";
|
|
56
|
-
readonly 208: "Already Reported";
|
|
57
|
-
readonly 300: "Multiple Choices";
|
|
58
|
-
readonly 301: "Moved Permanently";
|
|
59
|
-
readonly 302: "Found";
|
|
60
|
-
readonly 303: "See Other";
|
|
61
|
-
readonly 304: "Not Modified";
|
|
62
|
-
readonly 307: "Temporary Redirect";
|
|
63
|
-
readonly 308: "Permanent Redirect";
|
|
64
|
-
readonly 400: "Bad Request";
|
|
65
|
-
readonly 401: "Unauthorized";
|
|
66
|
-
readonly 402: "Payment Required";
|
|
67
|
-
readonly 403: "Forbidden";
|
|
68
|
-
readonly 404: "Not Found";
|
|
69
|
-
readonly 405: "Method Not Allowed";
|
|
70
|
-
readonly 406: "Not Acceptable";
|
|
71
|
-
readonly 407: "Proxy Authentication Required";
|
|
72
|
-
readonly 408: "Request Timeout";
|
|
73
|
-
readonly 409: "Conflict";
|
|
74
|
-
readonly 410: "Gone";
|
|
75
|
-
readonly 411: "Length Required";
|
|
76
|
-
readonly 412: "Precondition Failed";
|
|
77
|
-
readonly 413: "Payload Too Large";
|
|
78
|
-
readonly 414: "URI Too Long";
|
|
79
|
-
readonly 415: "Unsupported Media Type";
|
|
80
|
-
readonly 416: "Range Not Satisfiable";
|
|
81
|
-
readonly 417: "Expectation Failed";
|
|
82
|
-
readonly 418: "I'm a teapot";
|
|
83
|
-
readonly 420: "Enhance Your Calm";
|
|
84
|
-
readonly 421: "Misdirected Request";
|
|
85
|
-
readonly 422: "Unprocessable Content";
|
|
86
|
-
readonly 423: "Locked";
|
|
87
|
-
readonly 424: "Failed Dependency";
|
|
88
|
-
readonly 425: "Too Early";
|
|
89
|
-
readonly 426: "Upgrade Required";
|
|
90
|
-
readonly 428: "Precondition Required";
|
|
91
|
-
readonly 429: "Too Many Requests";
|
|
92
|
-
readonly 431: "Request Header Fields Too Large";
|
|
93
|
-
readonly 451: "Unavailable For Legal Reasons";
|
|
94
|
-
readonly 500: "Internal Server Error";
|
|
95
|
-
readonly 501: "Not Implemented";
|
|
96
|
-
readonly 502: "Bad Gateway";
|
|
97
|
-
readonly 503: "Service Unavailable";
|
|
98
|
-
readonly 504: "Gateway Timeout";
|
|
99
|
-
readonly 505: "HTTP Version Not Supported";
|
|
100
|
-
readonly 506: "Variant Also Negotiates";
|
|
101
|
-
readonly 507: "Insufficient Storage";
|
|
102
|
-
readonly 508: "Loop Detected";
|
|
103
|
-
readonly 510: "Not Extended";
|
|
104
|
-
readonly 511: "Network Authentication Required";
|
|
105
|
-
}[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
106
|
-
readonly Continue: 100;
|
|
107
|
-
readonly 'Switching Protocols': 101;
|
|
108
|
-
readonly Processing: 102;
|
|
109
|
-
readonly 'Early Hints': 103;
|
|
110
|
-
readonly OK: 200;
|
|
111
|
-
readonly Created: 201;
|
|
112
|
-
readonly Accepted: 202;
|
|
113
|
-
readonly 'Non-Authoritative Information': 203;
|
|
114
|
-
readonly 'No Content': 204;
|
|
115
|
-
readonly 'Reset Content': 205;
|
|
116
|
-
readonly 'Partial Content': 206;
|
|
117
|
-
readonly 'Multi-Status': 207;
|
|
118
|
-
readonly 'Already Reported': 208;
|
|
119
|
-
readonly 'Multiple Choices': 300;
|
|
120
|
-
readonly 'Moved Permanently': 301;
|
|
121
|
-
readonly Found: 302;
|
|
122
|
-
readonly 'See Other': 303;
|
|
123
|
-
readonly 'Not Modified': 304;
|
|
124
|
-
readonly 'Temporary Redirect': 307;
|
|
125
|
-
readonly 'Permanent Redirect': 308;
|
|
126
|
-
readonly 'Bad Request': 400;
|
|
127
|
-
readonly Unauthorized: 401;
|
|
128
|
-
readonly 'Payment Required': 402;
|
|
129
|
-
readonly Forbidden: 403;
|
|
130
|
-
readonly 'Not Found': 404;
|
|
131
|
-
readonly 'Method Not Allowed': 405;
|
|
132
|
-
readonly 'Not Acceptable': 406;
|
|
133
|
-
readonly 'Proxy Authentication Required': 407;
|
|
134
|
-
readonly 'Request Timeout': 408;
|
|
135
|
-
readonly Conflict: 409;
|
|
136
|
-
readonly Gone: 410;
|
|
137
|
-
readonly 'Length Required': 411;
|
|
138
|
-
readonly 'Precondition Failed': 412;
|
|
139
|
-
readonly 'Payload Too Large': 413;
|
|
140
|
-
readonly 'URI Too Long': 414;
|
|
141
|
-
readonly 'Unsupported Media Type': 415;
|
|
142
|
-
readonly 'Range Not Satisfiable': 416;
|
|
143
|
-
readonly 'Expectation Failed': 417;
|
|
144
|
-
readonly "I'm a teapot": 418;
|
|
145
|
-
readonly 'Enhance Your Calm': 420;
|
|
146
|
-
readonly 'Misdirected Request': 421;
|
|
147
|
-
readonly 'Unprocessable Content': 422;
|
|
148
|
-
readonly Locked: 423;
|
|
149
|
-
readonly 'Failed Dependency': 424;
|
|
150
|
-
readonly 'Too Early': 425;
|
|
151
|
-
readonly 'Upgrade Required': 426;
|
|
152
|
-
readonly 'Precondition Required': 428;
|
|
153
|
-
readonly 'Too Many Requests': 429;
|
|
154
|
-
readonly 'Request Header Fields Too Large': 431;
|
|
155
|
-
readonly 'Unavailable For Legal Reasons': 451;
|
|
156
|
-
readonly 'Internal Server Error': 500;
|
|
157
|
-
readonly 'Not Implemented': 501;
|
|
158
|
-
readonly 'Bad Gateway': 502;
|
|
159
|
-
readonly 'Service Unavailable': 503;
|
|
160
|
-
readonly 'Gateway Timeout': 504;
|
|
161
|
-
readonly 'HTTP Version Not Supported': 505;
|
|
162
|
-
readonly 'Variant Also Negotiates': 506;
|
|
163
|
-
readonly 'Insufficient Storage': 507;
|
|
164
|
-
readonly 'Loop Detected': 508;
|
|
165
|
-
readonly 'Not Extended': 510;
|
|
166
|
-
readonly 'Network Authentication Required': 511;
|
|
167
|
-
}[Code] : Code>;
|
|
168
|
-
}) => void;
|
|
48
|
+
body: unknown;
|
|
49
|
+
query: Record<string, string | undefined>;
|
|
50
|
+
params: Record<string, string>;
|
|
51
|
+
headers: Record<string, string | undefined>;
|
|
52
|
+
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
53
|
+
}): void;
|
|
169
54
|
};
|
|
170
55
|
};
|
|
171
56
|
parser: {};
|
|
172
57
|
response: {};
|
|
173
|
-
}, {},
|
|
174
|
-
derive: {};
|
|
175
|
-
resolve: {};
|
|
176
|
-
schema: {};
|
|
177
|
-
standaloneSchema: {};
|
|
178
|
-
response: {};
|
|
179
|
-
}, {
|
|
180
|
-
derive: {};
|
|
181
|
-
resolve: {};
|
|
182
|
-
schema: {};
|
|
183
|
-
standaloneSchema: {};
|
|
184
|
-
response: {};
|
|
185
|
-
}>;
|
|
58
|
+
}, {}, import("elysia").DefaultEphemeral, import("elysia").DefaultEphemeral>;
|
|
@@ -1,58 +1,43 @@
|
|
|
1
|
-
import { Elysia } from "elysia";
|
|
2
1
|
import type { FurinSyncOptions } from "./config.ts";
|
|
3
2
|
export type { ChangePage as SyncChangePage, SyncChange } from "./adapter.ts";
|
|
4
3
|
export declare function subscribeSyncCursor(options: FurinSyncOptions, listener: (cursor: string) => void): Promise<{
|
|
5
4
|
unsubscribe: () => void;
|
|
6
5
|
}>;
|
|
7
|
-
export declare function createSyncChangesPlugin(options: FurinSyncOptions):
|
|
8
|
-
decorator: {};
|
|
9
|
-
store: {};
|
|
10
|
-
derive: {};
|
|
11
|
-
resolve: {};
|
|
12
|
-
}, {
|
|
6
|
+
export declare function createSyncChangesPlugin(options: FurinSyncOptions): import("elysia/types").AddRoute<"", "local", import("elysia").DefaultSingleton, {
|
|
13
7
|
typebox: {};
|
|
14
|
-
error:
|
|
15
|
-
}, {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[x: string]: {
|
|
24
|
-
changes: {
|
|
25
|
-
get: {
|
|
26
|
-
body: unknown;
|
|
27
|
-
params: {};
|
|
28
|
-
query: unknown;
|
|
29
|
-
headers: unknown;
|
|
30
|
-
response: {
|
|
31
|
-
200: Response | {
|
|
32
|
-
cursor: string;
|
|
33
|
-
hasMore: boolean;
|
|
34
|
-
reset: boolean;
|
|
35
|
-
changes: {
|
|
36
|
-
cursor: string;
|
|
37
|
-
invalidations: string[];
|
|
38
|
-
}[];
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
8
|
+
error: [];
|
|
9
|
+
}, import("elysia").DefaultMetadata, {}, import("elysia").DefaultEphemeral, import("elysia").DefaultEphemeral, "get", `${string}/changes`, import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{}, {}, `/${string}/changes`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>, {}, ({ request, set }: {
|
|
10
|
+
server: import("elysia").Server | null;
|
|
11
|
+
redirect: import("elysia").redirect;
|
|
12
|
+
set: {
|
|
13
|
+
headers: import("elysia").HTTPHeaders;
|
|
14
|
+
status?: number | keyof import("elysia").StatusMap;
|
|
15
|
+
cookie?: Record<string, import("elysia").BaseCookie>;
|
|
16
|
+
redirect?: never;
|
|
43
17
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
18
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = import("elysia").StatusResponse<Code>>(code: Code, response?: T) => import("elysia").ElysiaStatus<Code, T, import("elysia").NumericStatus<Code>>;
|
|
19
|
+
problem: typeof import("elysia").problem;
|
|
20
|
+
defer: (fn: import("elysia/types").AfterResponseHandler<NoInfer<import("elysia/types").IntersectIfObjectSchema<import("elysia").UnwrapRoute<{}, {}, `/${string}/changes`>, import("elysia/types").MergeScopedSchemas<{}, {}, {}>>>, NoInfer<import("elysia").DefaultSingleton & {
|
|
21
|
+
derive: {};
|
|
22
|
+
}>>) => import("elysia/types").MaybePromise<void>;
|
|
23
|
+
readonly path: string;
|
|
24
|
+
route?: string;
|
|
25
|
+
rid?: string;
|
|
26
|
+
request: Request;
|
|
27
|
+
store: {};
|
|
28
|
+
body: unknown;
|
|
29
|
+
query: Record<string, string | undefined>;
|
|
30
|
+
params: {};
|
|
31
|
+
headers: Record<string, string | undefined>;
|
|
32
|
+
cookie: Record<string, import("elysia").Cookie<unknown>>;
|
|
33
|
+
}) => Promise<Response | {
|
|
34
|
+
cursor: string;
|
|
35
|
+
hasMore: boolean;
|
|
36
|
+
reset: boolean;
|
|
37
|
+
changes: {
|
|
38
|
+
cursor: string;
|
|
39
|
+
invalidations: string[];
|
|
40
|
+
}[];
|
|
41
|
+
}>>;
|
|
57
42
|
/** @internal — closes process-local stream state between tests. */
|
|
58
43
|
export declare function __resetSyncState(): void;
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TypeCompiler as ElysiaTypeCompiler } from "elysia/type-system";
|
|
3
|
-
import type { AnySchema, UnwrapSchema } from "elysia/types";
|
|
4
|
-
export declare const parseQueryFromURL: typeof elysiaParseQueryFromURL;
|
|
5
|
-
export declare const parseQueryStandardSchema: typeof elysiaParseQueryStandardSchema;
|
|
6
|
-
export declare const TypeCompiler: typeof ElysiaTypeCompiler;
|
|
1
|
+
import { type AnySchema, type UnwrapSchema } from "elysia";
|
|
7
2
|
interface SchemaObject {
|
|
8
3
|
[key: string]: unknown;
|
|
9
4
|
}
|
|
5
|
+
interface TypeBoxObjectSchema extends SchemaObject {
|
|
6
|
+
properties: SchemaObject;
|
|
7
|
+
}
|
|
10
8
|
/**
|
|
11
9
|
* Central compatibility boundary for Elysia types used by Furin's public DX.
|
|
12
10
|
* Contract tests must fail before changes to these projections reach callers.
|
|
13
11
|
*/
|
|
14
12
|
export type FurinSchema = AnySchema;
|
|
15
13
|
interface FurinSchemaValidator {
|
|
16
|
-
Check: (value: unknown) =>
|
|
14
|
+
Check: (value: unknown) => boolean;
|
|
17
15
|
Errors: (value: unknown) => Iterable<unknown>;
|
|
18
|
-
parse: (value: unknown) => unknown
|
|
19
|
-
}
|
|
20
|
-
interface FurinSchemaValidatorOptions {
|
|
21
|
-
coerce?: boolean;
|
|
22
|
-
dynamic?: boolean;
|
|
16
|
+
parse: (value: unknown, type: "params" | "query") => Promise<unknown>;
|
|
23
17
|
}
|
|
24
|
-
export declare function getSchemaValidator(schema: FurinSchema
|
|
18
|
+
export declare function getSchemaValidator(schema: FurinSchema): FurinSchemaValidator | undefined;
|
|
25
19
|
export type FurinUnwrap<Schema extends FurinSchema | undefined> = UnwrapSchema<Schema>;
|
|
26
20
|
export type ElysiaRoutes<App extends {
|
|
27
21
|
"~Routes": unknown;
|
|
@@ -37,5 +31,5 @@ export type ElysiaRouteParams<Leaf> = Leaf extends {
|
|
|
37
31
|
export type ElysiaRouteQuery<Leaf> = Leaf extends {
|
|
38
32
|
query: infer Query;
|
|
39
33
|
} ? Query : never;
|
|
40
|
-
export declare function isTypeBoxObjectSchema(schema: unknown): schema is
|
|
34
|
+
export declare function isTypeBoxObjectSchema(schema: unknown): schema is TypeBoxObjectSchema;
|
|
41
35
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teyik0/furin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-alpha.1",
|
|
4
4
|
"description": "React meta-framework powered by Elysia and Bun with file-based routing, SSR, SSG, and ISR.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
"bun": "./src/cache.ts",
|
|
42
42
|
"import": "./dist/cache.js"
|
|
43
43
|
},
|
|
44
|
+
"./cache/redis": {
|
|
45
|
+
"types": "./dist/server/cache/redis/index.d.ts",
|
|
46
|
+
"bun": "./src/server/cache/redis/index.ts",
|
|
47
|
+
"import": "./dist/server/cache/redis/index.js"
|
|
48
|
+
},
|
|
44
49
|
"./routes": {
|
|
45
50
|
"types": "./dist/routes.d.ts",
|
|
46
51
|
"bun": "./src/routes.ts",
|
|
@@ -137,21 +142,22 @@
|
|
|
137
142
|
"benchmark:rsc": "bun scripts/benchmark-rsc-transport.ts",
|
|
138
143
|
"build": "bun run build.ts",
|
|
139
144
|
"fix": "ultracite fix",
|
|
140
|
-
"test": "bun test --parallel --isolate --max-concurrency
|
|
141
|
-
"test:dev": "bun test --changed --parallel --isolate --max-concurrency
|
|
145
|
+
"test": "bun test --parallel=2 --isolate --max-concurrency 4 --bail --timeout 15000",
|
|
146
|
+
"test:dev": "bun test --changed --parallel --isolate --max-concurrency 4 --bail --timeout 15000",
|
|
142
147
|
"test:hmr:soak": "FURIN_WEBVIEW_TESTS=1 FURIN_HMR_SOAK_TESTS=1 bun test tests/browser/hmr-conformance.webview.test.ts -t 'tracks memory' --timeout 3600000",
|
|
143
148
|
"test:webview": "FURIN_WEBVIEW_TESTS=1 bun test tests/browser/hmr-conformance.webview.test.ts --timeout 60000",
|
|
144
149
|
"tscheck": "tsc --noEmit"
|
|
145
150
|
},
|
|
146
151
|
"dependencies": {
|
|
147
|
-
"@
|
|
152
|
+
"@elysia/static": "2.0.0-beta.2",
|
|
148
153
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
149
|
-
"@sinclair/typebox": "0.34.52",
|
|
150
154
|
"@vercel/functions": "^3.9.7",
|
|
151
155
|
"@yuku-toolchain/types": "0.9.5",
|
|
156
|
+
"exact-mirror": "1.2.6",
|
|
152
157
|
"magic-string": "^1.2.3",
|
|
153
158
|
"react-server-dom-webpack": "19.2.8",
|
|
154
159
|
"seroval": "^1.6.7",
|
|
160
|
+
"typebox": "1.3.34",
|
|
155
161
|
"yuku-ast": "0.9.5",
|
|
156
162
|
"yuku-parser": "0.9.5"
|
|
157
163
|
},
|
|
@@ -161,8 +167,8 @@
|
|
|
161
167
|
"expect-type": "^1.4.0"
|
|
162
168
|
},
|
|
163
169
|
"peerDependencies": {
|
|
164
|
-
"elysia": "
|
|
165
|
-
"evlog": "^2.
|
|
170
|
+
"elysia": "2.0.0-beta.19",
|
|
171
|
+
"evlog": "^2.29.0",
|
|
166
172
|
"react": "19.2.8",
|
|
167
173
|
"react-dom": "19.2.8"
|
|
168
174
|
},
|
package/src/adapter/README.md
CHANGED
|
@@ -8,7 +8,10 @@ Goal is having 3 modes:
|
|
|
8
8
|
|
|
9
9
|
All should be portable.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Server bundles and executables run Elysia 2's build-time AOT plugin against a
|
|
12
|
+
real generated application entry. The listener lives in a separate boot entry,
|
|
13
|
+
so AOT capture never opens a port. `strip` remains disabled while the Kiana beta
|
|
14
|
+
WebSocket capability imports helpers omitted by its automatic WS stub.
|
|
12
15
|
|
|
13
16
|
## Vercel adapter
|
|
14
17
|
|
|
@@ -27,6 +30,10 @@ The Vercel target emits Build Output API v3 directly to `.vercel/output`:
|
|
|
27
30
|
The generated handler connects Furin cache invalidation to Vercel cache tags
|
|
28
31
|
and keeps background ISR work alive with `waitUntil`.
|
|
29
32
|
|
|
33
|
+
The Function bundle uses the same Elysia AOT capture path with the Bun target.
|
|
34
|
+
No custom Elysia runtime adapter is needed: Vercel invokes the application's
|
|
35
|
+
Web-standard `handle(Request)` API inside its Bun runtime.
|
|
36
|
+
|
|
30
37
|
Vercel Prerender Function invocations bypass Furin's process-local SSG/ISR
|
|
31
38
|
cache. The CDN owns freshness and each regeneration returns newly rendered
|
|
32
39
|
HTML; the in-memory cache remains exclusive to development and Bun targets.
|
|
@@ -35,7 +42,7 @@ The generated handler also installs Vercel Runtime Cache as the provider behind
|
|
|
35
42
|
`@teyik0/furin/cache`. Application code keeps one portable cache API while
|
|
36
43
|
development and Bun targets fall back to the in-memory provider.
|
|
37
44
|
|
|
38
|
-
Application `@
|
|
45
|
+
Application `@elysia/static` mounts are rejected during Vercel builds: their
|
|
39
46
|
runtime filesystem mappings are not deployable CDN mappings. Place static files
|
|
40
47
|
under `public/` instead. PPR pages produce a cached public HTML shell, postponed
|
|
41
48
|
React state and public loader snapshot atomically. Vercel's native `chain`
|
package/src/adapter/bun.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { existsSync, rmSync } from "node:fs";
|
|
1
|
+
import { existsSync, readFileSync, rmSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { runBunBuild } from "../build/bun-build.ts";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { prepareCompileEntryApps } from "../build/compile-entry.ts";
|
|
5
|
+
import { elysiaAot } from "../build/elysia-aot.ts";
|
|
6
|
+
import type { BuildEntryOptions } from "../build/entry-template.ts";
|
|
6
7
|
import { productionInstrumentationPlugin } from "../build/production-instrumentation.ts";
|
|
8
|
+
import { materializeServerAppEntry, serverBootSource } from "../build/server-app-entry.ts";
|
|
7
9
|
import { buildTargetManifest, copyDirRecursive, ensureDir, toPosixPath } from "../build/shared.ts";
|
|
8
10
|
import type { BuildAppOptions, TargetBuildManifest } from "../build/types.ts";
|
|
9
11
|
import { createVirtualBuildEntry, type VirtualBuildEntry } from "../build/virtual-entry.ts";
|
|
@@ -18,15 +20,14 @@ import {
|
|
|
18
20
|
type RuntimeTargetApp,
|
|
19
21
|
} from "./runtime-build.ts";
|
|
20
22
|
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return createVirtualBuildEntry(entryPath, source, "ts");
|
|
23
|
+
function generateBootEntry(
|
|
24
|
+
appEntry: string,
|
|
25
|
+
outDir: string,
|
|
26
|
+
filename: "_compile-entry.ts" | "server.ts"
|
|
27
|
+
): VirtualBuildEntry {
|
|
28
|
+
ensureDir(outDir);
|
|
29
|
+
const entryPath = join(outDir, filename);
|
|
30
|
+
return createVirtualBuildEntry(entryPath, serverBootSource(appEntry), "ts");
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function collectEmbeddedAssets(
|
|
@@ -44,6 +45,48 @@ function collectEmbeddedAssets(
|
|
|
44
45
|
return assets;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
function compiledServerFilename(platform: NodeJS.Platform): string {
|
|
49
|
+
return platform === "win32" ? "server.exe" : "server";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function createBunAppEntry(
|
|
53
|
+
apps: RuntimeTargetApp[],
|
|
54
|
+
entryApps: BuildEntryOptions["apps"],
|
|
55
|
+
options: BuildAppOptions,
|
|
56
|
+
publicDir: string | undefined,
|
|
57
|
+
serverEntry: string | null,
|
|
58
|
+
targetDir: string
|
|
59
|
+
): Promise<string | undefined> {
|
|
60
|
+
if (!serverEntry) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const contexts = options.compile
|
|
64
|
+
? prepareCompileEntryApps({
|
|
65
|
+
apps: entryApps,
|
|
66
|
+
outDir: targetDir,
|
|
67
|
+
publicDir,
|
|
68
|
+
serverEntry,
|
|
69
|
+
})
|
|
70
|
+
: entryApps.map(({ embed: _embed, ...context }) => ({
|
|
71
|
+
...context,
|
|
72
|
+
extraContext: [
|
|
73
|
+
...(context.extraContext ?? []),
|
|
74
|
+
` clientDir: import.meta.dir + ${JSON.stringify(`/${clientDirNameForPrefix(context.prefix ?? "")}`)},`,
|
|
75
|
+
],
|
|
76
|
+
templateHtml: readFileSync(
|
|
77
|
+
join(targetDir, clientDirNameForPrefix(context.prefix ?? ""), "index.html"),
|
|
78
|
+
"utf8"
|
|
79
|
+
),
|
|
80
|
+
}));
|
|
81
|
+
return await materializeServerAppEntry({
|
|
82
|
+
apps: contexts,
|
|
83
|
+
headerComment: "// Auto-generated by furin build - do not edit",
|
|
84
|
+
instances: apps,
|
|
85
|
+
outDir: targetDir,
|
|
86
|
+
serverEntry,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
47
90
|
export async function buildBunTarget(
|
|
48
91
|
apps: RuntimeTargetApp[],
|
|
49
92
|
rootDir: string,
|
|
@@ -89,15 +132,20 @@ export async function buildBunTarget(
|
|
|
89
132
|
copyDirRecursive(publicDir, targetPublicDir);
|
|
90
133
|
}
|
|
91
134
|
|
|
92
|
-
|
|
93
|
-
|
|
135
|
+
const appEntry = await createBunAppEntry(
|
|
136
|
+
apps,
|
|
137
|
+
entryApps,
|
|
138
|
+
options,
|
|
139
|
+
publicDir,
|
|
140
|
+
serverEntry,
|
|
141
|
+
targetDir
|
|
142
|
+
);
|
|
94
143
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
});
|
|
144
|
+
if (options.compile && serverEntry && appEntry) {
|
|
145
|
+
const serverFilename = compiledServerFilename(process.platform);
|
|
146
|
+
const outfile = join(targetDir, serverFilename);
|
|
147
|
+
|
|
148
|
+
const entry = generateBootEntry(appEntry, targetDir, "_compile-entry.ts");
|
|
101
149
|
const embeddedAssets = collectEmbeddedAssets(entryApps, publicDir, options.compile);
|
|
102
150
|
|
|
103
151
|
await runBunBuild({
|
|
@@ -116,6 +164,7 @@ export async function buildBunTarget(
|
|
|
116
164
|
createRoutesPlugin({ instances: apps, target: "server" }),
|
|
117
165
|
isomorphicTransformPlugin("server"),
|
|
118
166
|
environmentGuardPlugin("ssr"),
|
|
167
|
+
elysiaAot(appEntry),
|
|
119
168
|
],
|
|
120
169
|
sourcemap: "none",
|
|
121
170
|
splitting: true,
|
|
@@ -124,7 +173,7 @@ export async function buildBunTarget(
|
|
|
124
173
|
|
|
125
174
|
console.log(`[furin] Server binary: ${outfile}`);
|
|
126
175
|
|
|
127
|
-
targetManifest.serverPath = toPosixPath(join(targetManifest.targetDir,
|
|
176
|
+
targetManifest.serverPath = toPosixPath(join(targetManifest.targetDir, serverFilename));
|
|
128
177
|
|
|
129
178
|
// Embed mode: assets are in the binary — clean up client dirs too.
|
|
130
179
|
if (options.compile === "embed") {
|
|
@@ -137,13 +186,9 @@ export async function buildBunTarget(
|
|
|
137
186
|
targetManifest.clientDir = null;
|
|
138
187
|
targetManifest.templatePath = null;
|
|
139
188
|
}
|
|
140
|
-
} else if (serverEntry) {
|
|
189
|
+
} else if (serverEntry && appEntry) {
|
|
141
190
|
// Disk mode: generate server.ts then bundle it into self-contained server.js
|
|
142
|
-
const entry =
|
|
143
|
-
apps: entryApps,
|
|
144
|
-
outDir: targetDir,
|
|
145
|
-
serverEntry,
|
|
146
|
-
});
|
|
191
|
+
const entry = generateBootEntry(appEntry, targetDir, "server.ts");
|
|
147
192
|
|
|
148
193
|
await runBunBuild({
|
|
149
194
|
entrypoints: [entry.entrypoint],
|
|
@@ -159,6 +204,7 @@ export async function buildBunTarget(
|
|
|
159
204
|
createRoutesPlugin({ instances: apps, target: "server" }),
|
|
160
205
|
isomorphicTransformPlugin("server"),
|
|
161
206
|
environmentGuardPlugin("ssr"),
|
|
207
|
+
elysiaAot(appEntry),
|
|
162
208
|
],
|
|
163
209
|
sourcemap: "none",
|
|
164
210
|
target: "bun",
|
package/src/adapter/package.ts
CHANGED
|
@@ -8,7 +8,11 @@ import { copyDirRecursive, ensureDir, toPosixPath } from "../build/shared.ts";
|
|
|
8
8
|
import { buildSSGCacheSnapshot } from "../build/ssg-cache.ts";
|
|
9
9
|
import type { BuildAppOptions, PackageTargetBuildManifest } from "../build/types.ts";
|
|
10
10
|
import { createVirtualBuildEntry } from "../build/virtual-entry.ts";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
composableRouteModuleSpecifier,
|
|
13
|
+
createRoutesPlugin,
|
|
14
|
+
routeSourcePaths,
|
|
15
|
+
} from "../plugin/routes.ts";
|
|
12
16
|
import { ssgRouteCache } from "../server/cache/ssg.ts";
|
|
13
17
|
import { generateProdIndexHtml } from "../server/render/shell.ts";
|
|
14
18
|
import { setProductionTemplateContent } from "../server/render/template.ts";
|
|
@@ -132,7 +136,7 @@ export async function buildPackageTarget(
|
|
|
132
136
|
buildId,
|
|
133
137
|
clientLogging: options.clientLogging ?? false,
|
|
134
138
|
modulePaths,
|
|
135
|
-
nativeRoutes:
|
|
139
|
+
nativeRoutes: composableRouteModuleSpecifier(app),
|
|
136
140
|
prefix,
|
|
137
141
|
rootConventions,
|
|
138
142
|
rootPath: root.path,
|