elysia 2.0.0-exp.6 → 2.0.0-exp.8
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 +1 -1
- package/dist/adapter/constants.d.ts +1 -1
- package/dist/adapter/index.d.ts +1 -1
- package/dist/adapter/utils.d.ts +1 -1
- package/dist/adapter/utils.js +77 -75
- package/dist/adapter/utils.mjs +77 -75
- package/dist/adapter/web-standard/index.d.ts +1 -1
- package/dist/plugin/core.d.ts +15 -0
- package/dist/plugin/core.js +14 -2
- package/dist/plugin/core.mjs +14 -2
- package/dist/plugin/vite.js +3 -1
- package/dist/plugin/vite.mjs +3 -1
- package/dist/type/constants.d.ts +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import { AnyElysia } from "../../base.js";
|
|
|
6
6
|
declare function collectStaticRoutes(app: AnyElysia): readonly [Record<string, Record<string, Response>>, Promise<void>[]] | undefined;
|
|
7
7
|
declare const BunAdapter: {
|
|
8
8
|
parse: {
|
|
9
|
-
default: (context: Context, contentType: string) => string |
|
|
9
|
+
default: (context: Context, contentType: string) => string | unknown[] | ArrayBuffer | Record<string, unknown> | Promise<unknown[] | Record<string | number | symbol, undefined>> | Promise<ArrayBuffer> | Promise<Record<string, unknown>> | Promise<string> | undefined;
|
|
10
10
|
json: (context: Context) => MaybePromise<Record<keyof any, undefined> | unknown[]>;
|
|
11
11
|
text: (context: Context) => MaybePromise<string>;
|
|
12
12
|
urlencoded: (context: Context) => MaybePromise<Record<string, string | string[]>>;
|
|
@@ -5,7 +5,7 @@ import { AnyElysia } from "../base.js";
|
|
|
5
5
|
//#region src/adapter/constants.d.ts
|
|
6
6
|
declare const defaultAdapter: {
|
|
7
7
|
parse: {
|
|
8
|
-
default: (context: Context, contentType: string) => string |
|
|
8
|
+
default: (context: Context, contentType: string) => string | unknown[] | ArrayBuffer | Record<string, unknown> | Promise<unknown[] | Record<string | number | symbol, undefined>> | Promise<ArrayBuffer> | Promise<Record<string, unknown>> | Promise<string> | undefined;
|
|
9
9
|
json: (context: Context) => MaybePromise<Record<keyof any, undefined> | unknown[]>;
|
|
10
10
|
text: (context: Context) => MaybePromise<string>;
|
|
11
11
|
urlencoded: (context: Context) => MaybePromise<Record<string, string | string[]>>;
|
package/dist/adapter/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { AnyElysia } from "../base.js";
|
|
|
7
7
|
//#region src/adapter/index.d.ts
|
|
8
8
|
declare function createAdapter(adapter: ElysiaAdapterOptions): {
|
|
9
9
|
parse: {
|
|
10
|
-
default: (context: Context, contentType: string) => string |
|
|
10
|
+
default: (context: Context, contentType: string) => string | unknown[] | ArrayBuffer | Record<string, unknown> | Promise<unknown[] | Record<string | number | symbol, undefined>> | Promise<ArrayBuffer> | Promise<Record<string, unknown>> | Promise<string> | undefined;
|
|
11
11
|
json: (context: Context) => MaybePromise<Record<keyof any, undefined> | unknown[]>;
|
|
12
12
|
text: (context: Context) => MaybePromise<string>;
|
|
13
13
|
urlencoded: (context: Context) => MaybePromise<Record<string, string | string[]>>;
|
package/dist/adapter/utils.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ interface CreateHandlerParameter {
|
|
|
18
18
|
mapResponse(response: unknown, set: Context['set'], request?: Request): Response;
|
|
19
19
|
mapCompactResponse(response: unknown, request?: Request): Response;
|
|
20
20
|
}
|
|
21
|
-
declare
|
|
21
|
+
declare function createStreamHandler(_: CreateHandlerParameter): (generator: Generator | AsyncGenerator | ReadableStream, set?: Context["set"], request?: Request, skipFormat?: boolean) => Promise<Response>;
|
|
22
22
|
declare function streamResponse(response: Response): AsyncGenerator<any, void, any>;
|
|
23
23
|
declare function handleSet(set: Context['set']): void;
|
|
24
24
|
declare function mergeHeaders(responseHeaders: Headers, setHeaders: Context['set']['headers']): Headers;
|
package/dist/adapter/utils.js
CHANGED
|
@@ -121,90 +121,92 @@ function enqueueBinaryChunk(controller, chunk) {
|
|
|
121
121
|
}
|
|
122
122
|
return false;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
134
|
-
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
135
|
-
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
136
|
-
const headers = set?.headers;
|
|
137
|
-
if (headers) {
|
|
138
|
-
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
139
|
-
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
140
|
-
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
141
|
-
} else set = {
|
|
142
|
-
status: 200,
|
|
143
|
-
headers: {
|
|
144
|
-
"content-type": contentType,
|
|
145
|
-
"transfer-encoding": "chunked",
|
|
146
|
-
"cache-control": "no-cache",
|
|
147
|
-
connection: "keep-alive"
|
|
124
|
+
function createStreamHandler(_) {
|
|
125
|
+
return async (generator, set, request, skipFormat) => {
|
|
126
|
+
let init = generator.next?.();
|
|
127
|
+
if (set) handleSet(set);
|
|
128
|
+
if (init instanceof Promise) init = await init;
|
|
129
|
+
if (init?.value instanceof ReadableStream) generator = init.value;
|
|
130
|
+
else if (init && (typeof init?.done === "undefined" || init?.done)) {
|
|
131
|
+
if (set) return require_adapter_web_standard_handler.mapResponse(init.value, set, request);
|
|
132
|
+
return require_adapter_web_standard_handler.mapCompactResponse(init.value, request);
|
|
148
133
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
else if (typeof init.value === "object") try {
|
|
165
|
-
controller.enqueue(format(JSON.stringify(init.value)));
|
|
166
|
-
} catch {
|
|
167
|
-
controller.enqueue(format(init.value.toString()));
|
|
134
|
+
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
135
|
+
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
136
|
+
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
137
|
+
const headers = set?.headers;
|
|
138
|
+
if (headers) {
|
|
139
|
+
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
140
|
+
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
141
|
+
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
142
|
+
} else set = {
|
|
143
|
+
status: 200,
|
|
144
|
+
headers: {
|
|
145
|
+
"content-type": contentType,
|
|
146
|
+
"transfer-encoding": "chunked",
|
|
147
|
+
"cache-control": "no-cache",
|
|
148
|
+
connection: "keep-alive"
|
|
168
149
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
const { value: chunk, done } = await iterator.next();
|
|
180
|
-
if (done || end) {
|
|
150
|
+
};
|
|
151
|
+
const iterator = typeof generator.next === "function" ? generator : generator[Symbol.asyncIterator]();
|
|
152
|
+
let end = false;
|
|
153
|
+
return new Response(new ReadableStream({
|
|
154
|
+
start(controller) {
|
|
155
|
+
request?.signal?.addEventListener("abort", () => {
|
|
156
|
+
end = true;
|
|
157
|
+
iterator.return?.();
|
|
181
158
|
try {
|
|
182
159
|
controller.close();
|
|
183
160
|
} catch {}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
if (
|
|
188
|
-
else if (
|
|
189
|
-
|
|
190
|
-
controller.enqueue(format(JSON.stringify(chunk)));
|
|
161
|
+
});
|
|
162
|
+
if (!init || init.value instanceof ReadableStream || init.value === void 0 || init.value === null) return;
|
|
163
|
+
if (init.value.toSSE) controller.enqueue(init.value.toSSE());
|
|
164
|
+
else if (enqueueBinaryChunk(controller, init.value)) return;
|
|
165
|
+
else if (typeof init.value === "object") try {
|
|
166
|
+
controller.enqueue(format(JSON.stringify(init.value)));
|
|
191
167
|
} catch {
|
|
192
|
-
controller.enqueue(format(
|
|
168
|
+
controller.enqueue(format(init.value.toString()));
|
|
169
|
+
}
|
|
170
|
+
else controller.enqueue(format(init.value.toString()));
|
|
171
|
+
},
|
|
172
|
+
async pull(controller) {
|
|
173
|
+
if (end) {
|
|
174
|
+
try {
|
|
175
|
+
controller.close();
|
|
176
|
+
} catch {}
|
|
177
|
+
return;
|
|
193
178
|
}
|
|
194
|
-
else controller.enqueue(format(chunk.toString()));
|
|
195
|
-
} catch (error) {
|
|
196
|
-
console.warn(error);
|
|
197
179
|
try {
|
|
198
|
-
|
|
199
|
-
|
|
180
|
+
const { value: chunk, done } = await iterator.next();
|
|
181
|
+
if (done || end) {
|
|
182
|
+
try {
|
|
183
|
+
controller.close();
|
|
184
|
+
} catch {}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (chunk === void 0 || chunk === null) return;
|
|
188
|
+
if (chunk.toSSE) controller.enqueue(chunk.toSSE());
|
|
189
|
+
else if (enqueueBinaryChunk(controller, chunk)) return;
|
|
190
|
+
else if (typeof chunk === "object") try {
|
|
191
|
+
controller.enqueue(format(JSON.stringify(chunk)));
|
|
192
|
+
} catch {
|
|
193
|
+
controller.enqueue(format(chunk.toString()));
|
|
194
|
+
}
|
|
195
|
+
else controller.enqueue(format(chunk.toString()));
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.warn(error);
|
|
198
|
+
try {
|
|
199
|
+
controller.close();
|
|
200
|
+
} catch {}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
cancel() {
|
|
204
|
+
end = true;
|
|
205
|
+
iterator.return?.();
|
|
200
206
|
}
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
iterator.return?.();
|
|
205
|
-
}
|
|
206
|
-
}), set);
|
|
207
|
-
};
|
|
207
|
+
}), set);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
208
210
|
async function* streamResponse(response) {
|
|
209
211
|
const body = response.body;
|
|
210
212
|
if (body) yield* body;
|
package/dist/adapter/utils.mjs
CHANGED
|
@@ -120,90 +120,92 @@ function enqueueBinaryChunk(controller, chunk) {
|
|
|
120
120
|
}
|
|
121
121
|
return false;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
133
|
-
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
134
|
-
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
135
|
-
const headers = set?.headers;
|
|
136
|
-
if (headers) {
|
|
137
|
-
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
138
|
-
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
139
|
-
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
140
|
-
} else set = {
|
|
141
|
-
status: 200,
|
|
142
|
-
headers: {
|
|
143
|
-
"content-type": contentType,
|
|
144
|
-
"transfer-encoding": "chunked",
|
|
145
|
-
"cache-control": "no-cache",
|
|
146
|
-
connection: "keep-alive"
|
|
123
|
+
function createStreamHandler(_) {
|
|
124
|
+
return async (generator, set, request, skipFormat) => {
|
|
125
|
+
let init = generator.next?.();
|
|
126
|
+
if (set) handleSet(set);
|
|
127
|
+
if (init instanceof Promise) init = await init;
|
|
128
|
+
if (init?.value instanceof ReadableStream) generator = init.value;
|
|
129
|
+
else if (init && (typeof init?.done === "undefined" || init?.done)) {
|
|
130
|
+
if (set) return mapResponse(init.value, set, request);
|
|
131
|
+
return mapCompactResponse(init.value, request);
|
|
147
132
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
else if (typeof init.value === "object") try {
|
|
164
|
-
controller.enqueue(format(JSON.stringify(init.value)));
|
|
165
|
-
} catch {
|
|
166
|
-
controller.enqueue(format(init.value.toString()));
|
|
133
|
+
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
134
|
+
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
135
|
+
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
136
|
+
const headers = set?.headers;
|
|
137
|
+
if (headers) {
|
|
138
|
+
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
139
|
+
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
140
|
+
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
141
|
+
} else set = {
|
|
142
|
+
status: 200,
|
|
143
|
+
headers: {
|
|
144
|
+
"content-type": contentType,
|
|
145
|
+
"transfer-encoding": "chunked",
|
|
146
|
+
"cache-control": "no-cache",
|
|
147
|
+
connection: "keep-alive"
|
|
167
148
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
try {
|
|
178
|
-
const { value: chunk, done } = await iterator.next();
|
|
179
|
-
if (done || end) {
|
|
149
|
+
};
|
|
150
|
+
const iterator = typeof generator.next === "function" ? generator : generator[Symbol.asyncIterator]();
|
|
151
|
+
let end = false;
|
|
152
|
+
return new Response(new ReadableStream({
|
|
153
|
+
start(controller) {
|
|
154
|
+
request?.signal?.addEventListener("abort", () => {
|
|
155
|
+
end = true;
|
|
156
|
+
iterator.return?.();
|
|
180
157
|
try {
|
|
181
158
|
controller.close();
|
|
182
159
|
} catch {}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (
|
|
186
|
-
if (
|
|
187
|
-
else if (
|
|
188
|
-
|
|
189
|
-
controller.enqueue(format(JSON.stringify(chunk)));
|
|
160
|
+
});
|
|
161
|
+
if (!init || init.value instanceof ReadableStream || init.value === void 0 || init.value === null) return;
|
|
162
|
+
if (init.value.toSSE) controller.enqueue(init.value.toSSE());
|
|
163
|
+
else if (enqueueBinaryChunk(controller, init.value)) return;
|
|
164
|
+
else if (typeof init.value === "object") try {
|
|
165
|
+
controller.enqueue(format(JSON.stringify(init.value)));
|
|
190
166
|
} catch {
|
|
191
|
-
controller.enqueue(format(
|
|
167
|
+
controller.enqueue(format(init.value.toString()));
|
|
168
|
+
}
|
|
169
|
+
else controller.enqueue(format(init.value.toString()));
|
|
170
|
+
},
|
|
171
|
+
async pull(controller) {
|
|
172
|
+
if (end) {
|
|
173
|
+
try {
|
|
174
|
+
controller.close();
|
|
175
|
+
} catch {}
|
|
176
|
+
return;
|
|
192
177
|
}
|
|
193
|
-
else controller.enqueue(format(chunk.toString()));
|
|
194
|
-
} catch (error) {
|
|
195
|
-
console.warn(error);
|
|
196
178
|
try {
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
const { value: chunk, done } = await iterator.next();
|
|
180
|
+
if (done || end) {
|
|
181
|
+
try {
|
|
182
|
+
controller.close();
|
|
183
|
+
} catch {}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (chunk === void 0 || chunk === null) return;
|
|
187
|
+
if (chunk.toSSE) controller.enqueue(chunk.toSSE());
|
|
188
|
+
else if (enqueueBinaryChunk(controller, chunk)) return;
|
|
189
|
+
else if (typeof chunk === "object") try {
|
|
190
|
+
controller.enqueue(format(JSON.stringify(chunk)));
|
|
191
|
+
} catch {
|
|
192
|
+
controller.enqueue(format(chunk.toString()));
|
|
193
|
+
}
|
|
194
|
+
else controller.enqueue(format(chunk.toString()));
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.warn(error);
|
|
197
|
+
try {
|
|
198
|
+
controller.close();
|
|
199
|
+
} catch {}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
cancel() {
|
|
203
|
+
end = true;
|
|
204
|
+
iterator.return?.();
|
|
199
205
|
}
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
iterator.return?.();
|
|
204
|
-
}
|
|
205
|
-
}), set);
|
|
206
|
-
};
|
|
206
|
+
}), set);
|
|
207
|
+
};
|
|
208
|
+
}
|
|
207
209
|
async function* streamResponse(response) {
|
|
208
210
|
const body = response.body;
|
|
209
211
|
if (body) yield* body;
|
|
@@ -5,7 +5,7 @@ import { AnyElysia } from "../../base.js";
|
|
|
5
5
|
//#region src/adapter/web-standard/index.d.ts
|
|
6
6
|
declare const WebStandardAdapter: {
|
|
7
7
|
parse: {
|
|
8
|
-
default: (context: Context, contentType: string) => string |
|
|
8
|
+
default: (context: Context, contentType: string) => string | unknown[] | ArrayBuffer | Record<string, unknown> | Promise<unknown[] | Record<string | number | symbol, undefined>> | Promise<ArrayBuffer> | Promise<Record<string, unknown>> | Promise<string> | undefined;
|
|
9
9
|
json: (context: Context) => MaybePromise<Record<keyof any, undefined> | unknown[]>;
|
|
10
10
|
text: (context: Context) => MaybePromise<string>;
|
|
11
11
|
urlencoded: (context: Context) => MaybePromise<Record<string, string | string[]>>;
|
package/dist/plugin/core.d.ts
CHANGED
|
@@ -71,6 +71,21 @@ interface StubPlan {
|
|
|
71
71
|
* cookie config (`cc`)
|
|
72
72
|
*/
|
|
73
73
|
cookie: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Stub the trace runtime (`trace.ts` `createTracer` + recorder machinery)
|
|
76
|
+
* when no replayed handler aliases trace (`tr`). The live fetch handler keeps
|
|
77
|
+
* `createTracer` importable but only calls it when trace handlers exist, so a
|
|
78
|
+
* throwing stub is unreachable once detection proves trace is unused
|
|
79
|
+
*/
|
|
80
|
+
trace: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Stub the `memory` module's `clearSucroseCache` edge when handler JIT is
|
|
83
|
+
* stubbed. Sucrose never runs in a precompiled app, so its caches are always
|
|
84
|
+
* empty and the flush is a no-op — dropping the import lets the Sucrose
|
|
85
|
+
* analyzer tree-shake. `flushMemory`'s other clears are preserved, and the
|
|
86
|
+
* public `elysia/sucrose` module is left untouched
|
|
87
|
+
*/
|
|
88
|
+
sucrose: boolean;
|
|
74
89
|
}
|
|
75
90
|
declare const STUB_SOURCES: Record<keyof StubPlan, Array<{
|
|
76
91
|
filter: RegExp;
|
package/dist/plugin/core.js
CHANGED
|
@@ -24,7 +24,9 @@ const NO_STUB = {
|
|
|
24
24
|
jit: false,
|
|
25
25
|
ws: false,
|
|
26
26
|
reconstruct: false,
|
|
27
|
-
cookie: false
|
|
27
|
+
cookie: false,
|
|
28
|
+
trace: false,
|
|
29
|
+
sucrose: false
|
|
28
30
|
};
|
|
29
31
|
/**
|
|
30
32
|
* Resolve whether handler JIT is safe to stub for `entry`, honouring the
|
|
@@ -38,7 +40,9 @@ function planFromReport(strip, report, hasWS, aliases) {
|
|
|
38
40
|
jit,
|
|
39
41
|
ws: !hasWS,
|
|
40
42
|
reconstruct: jit && !aliases.has("va") && !aliases.has("cc") && !aliases.has("tr"),
|
|
41
|
-
cookie: jit && !aliases.has("cc")
|
|
43
|
+
cookie: jit && !aliases.has("cc"),
|
|
44
|
+
trace: jit && !aliases.has("tr"),
|
|
45
|
+
sucrose: jit
|
|
42
46
|
};
|
|
43
47
|
}
|
|
44
48
|
const STUB_SOURCES = {
|
|
@@ -60,6 +64,14 @@ const STUB_SOURCES = {
|
|
|
60
64
|
}, {
|
|
61
65
|
filter: /[\\/]cookie[\\/]config\.(m?js|ts)$/,
|
|
62
66
|
source: "const e=()=>{throw new Error(\"[elysia-aot] cookie support was stripped (strip mode) but a route used cookies. Rebuild with strip:false.\")}\nexport function compileCookieConfig(){return e()}\nexport function isCookieSigned(){return e()}\n"
|
|
67
|
+
}],
|
|
68
|
+
trace: [{
|
|
69
|
+
filter: /[\\/]elysia[\\/](dist|src)[\\/]trace\.(m?js|ts)$/,
|
|
70
|
+
source: "const e=()=>{throw new Error(\"[elysia-aot] trace support was stripped (strip mode) but a route used trace. Rebuild with strip:false.\")}\nexport function createTracer(){return e()}\n"
|
|
71
|
+
}],
|
|
72
|
+
sucrose: [{
|
|
73
|
+
filter: /[\\/]elysia[\\/](dist|src)[\\/]memory\.(m?js|ts)$/,
|
|
74
|
+
source: "import { clearContextCache } from './context'\nimport { isBun } from './universal/constants'\nimport { Validator } from './validator'\nexport function flushMemory() {\n clearContextCache()\n Validator.clear()\n if (isBun) Bun.gc()\n else if (typeof global?.gc === 'function') global.gc()\n}\n"
|
|
63
75
|
}]
|
|
64
76
|
};
|
|
65
77
|
async function generateCompiledModule(file, options) {
|
package/dist/plugin/core.mjs
CHANGED
|
@@ -22,7 +22,9 @@ const NO_STUB = {
|
|
|
22
22
|
jit: false,
|
|
23
23
|
ws: false,
|
|
24
24
|
reconstruct: false,
|
|
25
|
-
cookie: false
|
|
25
|
+
cookie: false,
|
|
26
|
+
trace: false,
|
|
27
|
+
sucrose: false
|
|
26
28
|
};
|
|
27
29
|
/**
|
|
28
30
|
* Resolve whether handler JIT is safe to stub for `entry`, honouring the
|
|
@@ -36,7 +38,9 @@ function planFromReport(strip, report, hasWS, aliases) {
|
|
|
36
38
|
jit,
|
|
37
39
|
ws: !hasWS,
|
|
38
40
|
reconstruct: jit && !aliases.has("va") && !aliases.has("cc") && !aliases.has("tr"),
|
|
39
|
-
cookie: jit && !aliases.has("cc")
|
|
41
|
+
cookie: jit && !aliases.has("cc"),
|
|
42
|
+
trace: jit && !aliases.has("tr"),
|
|
43
|
+
sucrose: jit
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
const STUB_SOURCES = {
|
|
@@ -58,6 +62,14 @@ const STUB_SOURCES = {
|
|
|
58
62
|
}, {
|
|
59
63
|
filter: /[\\/]cookie[\\/]config\.(m?js|ts)$/,
|
|
60
64
|
source: "const e=()=>{throw new Error(\"[elysia-aot] cookie support was stripped (strip mode) but a route used cookies. Rebuild with strip:false.\")}\nexport function compileCookieConfig(){return e()}\nexport function isCookieSigned(){return e()}\n"
|
|
65
|
+
}],
|
|
66
|
+
trace: [{
|
|
67
|
+
filter: /[\\/]elysia[\\/](dist|src)[\\/]trace\.(m?js|ts)$/,
|
|
68
|
+
source: "const e=()=>{throw new Error(\"[elysia-aot] trace support was stripped (strip mode) but a route used trace. Rebuild with strip:false.\")}\nexport function createTracer(){return e()}\n"
|
|
69
|
+
}],
|
|
70
|
+
sucrose: [{
|
|
71
|
+
filter: /[\\/]elysia[\\/](dist|src)[\\/]memory\.(m?js|ts)$/,
|
|
72
|
+
source: "import { clearContextCache } from './context'\nimport { isBun } from './universal/constants'\nimport { Validator } from './validator'\nexport function flushMemory() {\n clearContextCache()\n Validator.clear()\n if (isBun) Bun.gc()\n else if (typeof global?.gc === 'function') global.gc()\n}\n"
|
|
61
73
|
}]
|
|
62
74
|
};
|
|
63
75
|
async function generateCompiledModule(file, options) {
|
package/dist/plugin/vite.js
CHANGED
package/dist/plugin/vite.mjs
CHANGED
package/dist/type/constants.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const ELYSIA_TYPES: {
|
|
|
17
17
|
readonly NoValidate: 15;
|
|
18
18
|
};
|
|
19
19
|
type ELYSIA_TYPES = typeof ELYSIA_TYPES;
|
|
20
|
-
declare const primitiveElysiaTypes: Set<
|
|
20
|
+
declare const primitiveElysiaTypes: Set<3 | 1 | 2 | 6 | 10 | 11 | 13 | 14>;
|
|
21
21
|
declare const noEnumerable: {
|
|
22
22
|
readonly enumerable: false;
|
|
23
23
|
};
|