revojs 0.1.35 → 0.1.36
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/{app-BCLT8o3Z.mjs → app-CrssMYJz.mjs} +171 -46
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +19 -0
- package/dist/{index--59PGeW2.d.mts → index-CAIDdBVr.d.mts} +21 -11
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/kit/index.d.mts +1 -1
- package/dist/package-DRX23rU2.mjs +6 -0
- package/dist/vite/index.d.mts +1 -1
- package/dist/vite/index.mjs +3 -6
- package/package.json +15 -11
|
@@ -137,9 +137,14 @@ function useUrl(scope, base) {
|
|
|
137
137
|
const { request } = useServer(scope);
|
|
138
138
|
return new URL(request?.url ?? window?.location.href, base);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function useParameters(scope, schema) {
|
|
141
|
+
const { parameters } = useRouter(scope);
|
|
142
|
+
return schema ? parseSchema(scope, schema, parameters) : parameters;
|
|
143
|
+
}
|
|
144
|
+
function useHeaders(scope, schema) {
|
|
141
145
|
const { request } = useServer(scope);
|
|
142
|
-
|
|
146
|
+
const entries = Object.fromEntries(request?.headers);
|
|
147
|
+
return schema ? parseSchema(scope, schema, entries) : entries;
|
|
143
148
|
}
|
|
144
149
|
function useQuery(scope, schema) {
|
|
145
150
|
const { searchParams } = useUrl(scope);
|
|
@@ -151,6 +156,17 @@ function withQuery(scope, input, query) {
|
|
|
151
156
|
for (const name in query) url.searchParams.set(name, query[name]);
|
|
152
157
|
return url.href;
|
|
153
158
|
}
|
|
159
|
+
async function useBody(scope, schema) {
|
|
160
|
+
const { request } = useServer(scope);
|
|
161
|
+
let entries = {};
|
|
162
|
+
const contentType = request.headers.get("Content-Type");
|
|
163
|
+
if (contentType?.includes("application/json")) entries = await request.json();
|
|
164
|
+
else if (contentType?.includes("multipart/form-data") || contentType?.includes("application/x-www-form-urlencoded")) entries = Array.from(await request.formData()).reduce((result, [name, value]) => ({
|
|
165
|
+
...result,
|
|
166
|
+
[name]: value
|
|
167
|
+
}), {});
|
|
168
|
+
return schema ? parseSchema(scope, schema, entries) : entries;
|
|
169
|
+
}
|
|
154
170
|
function useCookies(scope, schema) {
|
|
155
171
|
const { request } = useServer(scope);
|
|
156
172
|
const entries = (isClient ? document.cookie : request.headers.get("Cookie") ?? "").split("; ").reduce((result, cookie) => {
|
|
@@ -257,7 +273,7 @@ async function createServer() {
|
|
|
257
273
|
const segments = path.split("/");
|
|
258
274
|
for (const attribute of segments.pop()?.split(".") ?? []) {
|
|
259
275
|
if (attribute === "js" || attribute === "ts") continue;
|
|
260
|
-
if (attribute
|
|
276
|
+
if (httpMethods.includes(attribute.toUpperCase())) segments.unshift(attribute);
|
|
261
277
|
else segments.push(attribute);
|
|
262
278
|
}
|
|
263
279
|
router.use(segments, route);
|
|
@@ -289,50 +305,159 @@ const PARAMETER_MATCH = /\[(.*?)\]/;
|
|
|
289
305
|
const OPTIONAL_PARAMETER_MATCH = /\[\[(.*?)\]\]/;
|
|
290
306
|
const isServer = import.meta.SERVER ?? globalThis?.import?.meta?.SERVER;
|
|
291
307
|
const isClient = import.meta.CLIENT ?? globalThis?.import?.meta?.CLIENT;
|
|
308
|
+
const cookiePriorities = [
|
|
309
|
+
"Low",
|
|
310
|
+
"Medium",
|
|
311
|
+
"High"
|
|
312
|
+
];
|
|
313
|
+
const cookieSameSites = [
|
|
314
|
+
"Lax",
|
|
315
|
+
"Strict",
|
|
316
|
+
"None"
|
|
317
|
+
];
|
|
318
|
+
const httpMethods = [
|
|
319
|
+
"GET",
|
|
320
|
+
"HEAD",
|
|
321
|
+
"PATCH",
|
|
322
|
+
"POST",
|
|
323
|
+
"PUT",
|
|
324
|
+
"DELETE",
|
|
325
|
+
"CONNECT",
|
|
326
|
+
"OPTIONS",
|
|
327
|
+
"TRACE"
|
|
328
|
+
];
|
|
329
|
+
const encodings = [
|
|
330
|
+
"ascii",
|
|
331
|
+
"utf8",
|
|
332
|
+
"utf-8",
|
|
333
|
+
"utf16le",
|
|
334
|
+
"ucs2",
|
|
335
|
+
"ucs-2",
|
|
336
|
+
"base64",
|
|
337
|
+
"latin1",
|
|
338
|
+
"binary",
|
|
339
|
+
"hex"
|
|
340
|
+
];
|
|
341
|
+
const statusCodes = [
|
|
342
|
+
100,
|
|
343
|
+
101,
|
|
344
|
+
102,
|
|
345
|
+
103,
|
|
346
|
+
200,
|
|
347
|
+
201,
|
|
348
|
+
202,
|
|
349
|
+
203,
|
|
350
|
+
204,
|
|
351
|
+
205,
|
|
352
|
+
206,
|
|
353
|
+
207,
|
|
354
|
+
208,
|
|
355
|
+
226,
|
|
356
|
+
300,
|
|
357
|
+
301,
|
|
358
|
+
302,
|
|
359
|
+
303,
|
|
360
|
+
304,
|
|
361
|
+
305,
|
|
362
|
+
307,
|
|
363
|
+
308,
|
|
364
|
+
400,
|
|
365
|
+
401,
|
|
366
|
+
402,
|
|
367
|
+
403,
|
|
368
|
+
404,
|
|
369
|
+
405,
|
|
370
|
+
406,
|
|
371
|
+
407,
|
|
372
|
+
408,
|
|
373
|
+
409,
|
|
374
|
+
410,
|
|
375
|
+
411,
|
|
376
|
+
412,
|
|
377
|
+
413,
|
|
378
|
+
414,
|
|
379
|
+
415,
|
|
380
|
+
416,
|
|
381
|
+
417,
|
|
382
|
+
418,
|
|
383
|
+
420,
|
|
384
|
+
421,
|
|
385
|
+
422,
|
|
386
|
+
423,
|
|
387
|
+
424,
|
|
388
|
+
425,
|
|
389
|
+
426,
|
|
390
|
+
428,
|
|
391
|
+
429,
|
|
392
|
+
431,
|
|
393
|
+
444,
|
|
394
|
+
450,
|
|
395
|
+
451,
|
|
396
|
+
497,
|
|
397
|
+
498,
|
|
398
|
+
499,
|
|
399
|
+
500,
|
|
400
|
+
501,
|
|
401
|
+
502,
|
|
402
|
+
503,
|
|
403
|
+
504,
|
|
404
|
+
506,
|
|
405
|
+
507,
|
|
406
|
+
508,
|
|
407
|
+
509,
|
|
408
|
+
510,
|
|
409
|
+
511,
|
|
410
|
+
521,
|
|
411
|
+
522,
|
|
412
|
+
523,
|
|
413
|
+
525,
|
|
414
|
+
530,
|
|
415
|
+
599
|
|
416
|
+
];
|
|
292
417
|
const mimeTypes = {
|
|
293
|
-
txt: "text/plain",
|
|
294
|
-
css: "text/css",
|
|
295
|
-
html: "text/html",
|
|
296
|
-
htm: "text/html",
|
|
297
|
-
js: "text/javascript",
|
|
298
|
-
json: "application/json",
|
|
299
|
-
xml: "application/xml",
|
|
300
|
-
csv: "text/csv",
|
|
301
|
-
jpg: "image/jpeg",
|
|
302
|
-
jpeg: "image/jpeg",
|
|
303
|
-
png: "image/png",
|
|
304
|
-
gif: "image/gif",
|
|
305
|
-
webp: "image/webp",
|
|
306
|
-
svg: "image/svg+xml",
|
|
307
|
-
bmp: "image/bmp",
|
|
308
|
-
ico: "image/x-icon",
|
|
309
|
-
ttf: "font/ttf",
|
|
310
|
-
otf: "font/otf",
|
|
311
|
-
woff: "font/woff",
|
|
312
|
-
woff2: "font/woff2",
|
|
313
|
-
mp3: "audio/mpeg",
|
|
314
|
-
wav: "audio/wav",
|
|
315
|
-
ogg: "audio/ogg",
|
|
316
|
-
m4a: "audio/mp4",
|
|
317
|
-
mp4: "video/mp4",
|
|
318
|
-
webm: "video/webm",
|
|
319
|
-
ogv: "video/ogg",
|
|
320
|
-
mov: "video/quicktime",
|
|
321
|
-
avi: "video/x-msvideo",
|
|
322
|
-
zip: "application/zip",
|
|
323
|
-
rar: "application/vnd.rar",
|
|
324
|
-
tar: "application/x-tar",
|
|
325
|
-
gz: "application/gzip",
|
|
418
|
+
"txt": "text/plain",
|
|
419
|
+
"css": "text/css",
|
|
420
|
+
"html": "text/html",
|
|
421
|
+
"htm": "text/html",
|
|
422
|
+
"js": "text/javascript",
|
|
423
|
+
"json": "application/json",
|
|
424
|
+
"xml": "application/xml",
|
|
425
|
+
"csv": "text/csv",
|
|
426
|
+
"jpg": "image/jpeg",
|
|
427
|
+
"jpeg": "image/jpeg",
|
|
428
|
+
"png": "image/png",
|
|
429
|
+
"gif": "image/gif",
|
|
430
|
+
"webp": "image/webp",
|
|
431
|
+
"svg": "image/svg+xml",
|
|
432
|
+
"bmp": "image/bmp",
|
|
433
|
+
"ico": "image/x-icon",
|
|
434
|
+
"ttf": "font/ttf",
|
|
435
|
+
"otf": "font/otf",
|
|
436
|
+
"woff": "font/woff",
|
|
437
|
+
"woff2": "font/woff2",
|
|
438
|
+
"mp3": "audio/mpeg",
|
|
439
|
+
"wav": "audio/wav",
|
|
440
|
+
"ogg": "audio/ogg",
|
|
441
|
+
"m4a": "audio/mp4",
|
|
442
|
+
"mp4": "video/mp4",
|
|
443
|
+
"webm": "video/webm",
|
|
444
|
+
"ogv": "video/ogg",
|
|
445
|
+
"mov": "video/quicktime",
|
|
446
|
+
"avi": "video/x-msvideo",
|
|
447
|
+
"zip": "application/zip",
|
|
448
|
+
"rar": "application/vnd.rar",
|
|
449
|
+
"tar": "application/x-tar",
|
|
450
|
+
"gz": "application/gzip",
|
|
326
451
|
"7z": "application/x-7z-compressed",
|
|
327
|
-
pdf: "application/pdf",
|
|
328
|
-
doc: "application/msword",
|
|
329
|
-
docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
330
|
-
xls: "application/vnd.ms-excel",
|
|
331
|
-
xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
332
|
-
ppt: "application/vnd.ms-powerpoint",
|
|
333
|
-
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
334
|
-
exe: "application/vnd.microsoft.portable-executable",
|
|
335
|
-
apk: "application/vnd.android.package-archive"
|
|
452
|
+
"pdf": "application/pdf",
|
|
453
|
+
"doc": "application/msword",
|
|
454
|
+
"docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
455
|
+
"xls": "application/vnd.ms-excel",
|
|
456
|
+
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
457
|
+
"ppt": "application/vnd.ms-powerpoint",
|
|
458
|
+
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
459
|
+
"exe": "application/vnd.microsoft.portable-executable",
|
|
460
|
+
"apk": "application/vnd.android.package-archive"
|
|
336
461
|
};
|
|
337
462
|
|
|
338
463
|
//#endregion
|
|
@@ -448,4 +573,4 @@ const CLIENT = "client";
|
|
|
448
573
|
const CLOSE_HOOK = defineHook("CLOSE_HOOK");
|
|
449
574
|
|
|
450
575
|
//#endregion
|
|
451
|
-
export {
|
|
576
|
+
export { useRouter as $, encodings as A, sendJson as B, WILDCARD as C, createServer as D, cookieSameSites as E, isServer as F, setCookie as G, sendRedirect as H, mimeType as I, useBody as J, setState as K, mimeTypes as L, httpMethods as M, invoke as N, defineMiddleware as O, isClient as P, useQuery as Q, sendBadRequest as R, STATES as S, cookiePriorities as T, sendText as U, sendNotFound as V, sendUnauthorized as W, useHeaders as X, useCookies as Y, useParameters as Z, PARAMETER_MATCH as _, Hookable as a, Router as b, defineHook as c, parseSchema as d, useServer as et, OPTIONAL_PARAMETER as f, PARAMETER as g, OPTIONAL_WILDCARD_MATCH as h, SERVER as i, getState as j, defineRoute as k, isFailure as l, OPTIONAL_WILDCARD as m, CLIENT as n, useUrl as nt, Scope as o, OPTIONAL_PARAMETER_MATCH as p, statusCodes as q, CLOSE_HOOK as r, withQuery as rt, defineContext as s, App as t, useSetCookies as tt, mergeObjects as u, ROUTER_CONTEXT as v, WILDCARD_MATCH as w, SERVER_CONTEXT as x, Radix as y, sendHtml as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { n as version, t as name } from "../package-DRX23rU2.mjs";
|
|
3
|
+
import { defineCommand, runMain } from "citty";
|
|
4
|
+
|
|
5
|
+
//#region src/cli/commands/run/index.ts
|
|
6
|
+
var run_default = defineCommand({ setup() {} });
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/cli/index.ts
|
|
10
|
+
runMain(defineCommand({
|
|
11
|
+
meta: {
|
|
12
|
+
name,
|
|
13
|
+
version
|
|
14
|
+
},
|
|
15
|
+
subCommands: { run: run_default }
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { };
|
|
@@ -47,12 +47,12 @@ declare function mergeObjects<TBase, TInput>(base: TBase, input: TInput): TBase
|
|
|
47
47
|
declare const descriptor: unique symbol;
|
|
48
48
|
//#endregion
|
|
49
49
|
//#region src/server/index.d.ts
|
|
50
|
-
type CookiePriority =
|
|
51
|
-
type CookieSameSite =
|
|
52
|
-
type HttpMethod =
|
|
53
|
-
type Encoding =
|
|
54
|
-
type StatusCode =
|
|
55
|
-
type MimeType =
|
|
50
|
+
type CookiePriority = (typeof cookiePriorities)[number];
|
|
51
|
+
type CookieSameSite = (typeof cookieSameSites)[number];
|
|
52
|
+
type HttpMethod = (typeof httpMethods)[number];
|
|
53
|
+
type Encoding = (typeof encodings)[number];
|
|
54
|
+
type StatusCode = (typeof statusCodes)[number];
|
|
55
|
+
type MimeType = (typeof mimeTypes)[keyof typeof mimeTypes];
|
|
56
56
|
type Result = void | Response | Promise<void | Response>;
|
|
57
57
|
type Node<T> = OptionalWildcardNode<T> | WildcardNode<T> | OptionalParameterNode<T> | ParameterNode<T> | PathNode<T>;
|
|
58
58
|
type States = Record<string, unknown>;
|
|
@@ -135,10 +135,15 @@ declare function defineMiddleware<T extends Middleware>(middleware: T): T;
|
|
|
135
135
|
declare function useRouter(scope: Scope): RouterContext;
|
|
136
136
|
declare function useServer<T extends Context>(scope: Scope): ServerContext<T>;
|
|
137
137
|
declare function useUrl(scope: Scope, base?: string): URL;
|
|
138
|
-
declare function
|
|
138
|
+
declare function useParameters(scope: Scope): Record<string, string>;
|
|
139
|
+
declare function useParameters<T extends Schema>(scope: Scope, schema: T): InferOutput<T>;
|
|
140
|
+
declare function useHeaders(scope: Scope): Record<string, string>;
|
|
141
|
+
declare function useHeaders<T extends Schema>(scope: Scope, schema: T): InferOutput<T>;
|
|
139
142
|
declare function useQuery(scope: Scope): Record<string, string>;
|
|
140
143
|
declare function useQuery<T extends Schema>(scope: Scope, schema: T): InferOutput<T>;
|
|
141
144
|
declare function withQuery(scope: Scope, input: string, query: Record<string, string>): string;
|
|
145
|
+
declare function useBody(scope: Scope): Promise<Record<string, unknown>>;
|
|
146
|
+
declare function useBody<T extends Schema>(scope: Scope, schema: T): Promise<InferOutput<T>>;
|
|
142
147
|
declare function useCookies(scope: Scope): Record<string, string>;
|
|
143
148
|
declare function useCookies<T extends Schema>(scope: Scope, schema: T): InferOutput<T>;
|
|
144
149
|
declare function useSetCookies(scope: Scope): Record<string, string>;
|
|
@@ -167,9 +172,14 @@ declare const WILDCARD_MATCH: RegExp;
|
|
|
167
172
|
declare const OPTIONAL_WILDCARD_MATCH: RegExp;
|
|
168
173
|
declare const PARAMETER_MATCH: RegExp;
|
|
169
174
|
declare const OPTIONAL_PARAMETER_MATCH: RegExp;
|
|
170
|
-
declare const isServer:
|
|
171
|
-
declare const isClient:
|
|
172
|
-
declare const
|
|
175
|
+
declare const isServer: boolean;
|
|
176
|
+
declare const isClient: boolean;
|
|
177
|
+
declare const cookiePriorities: readonly ["Low", "Medium", "High"];
|
|
178
|
+
declare const cookieSameSites: readonly ["Lax", "Strict", "None"];
|
|
179
|
+
declare const httpMethods: readonly ["GET", "HEAD", "PATCH", "POST", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE"];
|
|
180
|
+
declare const encodings: readonly ["ascii", "utf8", "utf-8", "utf16le", "ucs2", "ucs-2", "base64", "latin1", "binary", "hex"];
|
|
181
|
+
declare const statusCodes: readonly [100, 101, 102, 103, 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 307, 308, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 420, 421, 422, 423, 424, 425, 426, 428, 429, 431, 444, 450, 451, 497, 498, 499, 500, 501, 502, 503, 504, 506, 507, 508, 509, 510, 511, 521, 522, 523, 525, 530, 599];
|
|
182
|
+
declare const mimeTypes: Record<string, string>;
|
|
173
183
|
//#endregion
|
|
174
184
|
//#region src/app/index.d.ts
|
|
175
185
|
type Environment = typeof CLIENT | typeof SERVER;
|
|
@@ -219,4 +229,4 @@ declare const CLOSE_HOOK: Descriptor<() => void>;
|
|
|
219
229
|
//#region src/client/index.d.ts
|
|
220
230
|
declare function $fetch<T>(scope: Scope, input: string | URL, options?: RequestInit): Promise<T>;
|
|
221
231
|
//#endregion
|
|
222
|
-
export {
|
|
232
|
+
export { defineRoute as $, PARAMETER_MATCH as A, Failure as At, SERVER_CONTEXT as B, Success as Bt, OPTIONAL_PARAMETER as C, useRouter as Ct, OptionalParameterNode as D, withQuery as Dt, OPTIONAL_WILDCARD_MATCH as E, useUrl as Et, ResponseConfig as F, Issue as Ft, StatusCode as G, parseSchema as Gt, Server as H, defineHook as Ht, Result as I, Mergeable as It, WildcardNode as J, WILDCARD as K, Route as L, Output as Lt, PathNode as M, InferInput as Mt, ROUTER_CONTEXT as N, InferOutput as Nt, OptionalWildcardNode as O, Context as Ot, Radix as P, Invoke as Pt, defineMiddleware as Q, Router as R, Schema as Rt, Node as S, useQuery as St, OPTIONAL_WILDCARD as T, useSetCookies as Tt, ServerContext as U, isFailure as Ut, STATES as V, defineContext as Vt, States as W, mergeObjects as Wt, cookieSameSites as X, cookiePriorities as Y, createServer as Z, CookieSameSite as _, statusCodes as _t, CLOSE_HOOK as a, isServer as at, Middleware as b, useHeaders as bt, DevelopmentConfig as c, sendBadRequest as ct, SERVER as d, sendNotFound as dt, encodings as et, Source as f, sendRedirect as ft, CookiePriority as g, setState as gt, CookieOptions as h, setCookie as ht, CLIENT as i, isClient as it, ParameterNode as j, Hookable as jt, PARAMETER as k, Descriptor as kt, Environment as l, sendHtml as lt, Virtual as m, sendUnauthorized as mt, App as n, httpMethods as nt, Config as o, mimeType as ot, Template as p, sendText as pt, WILDCARD_MATCH as q, BuildConfig as r, invoke as rt, Content as s, mimeTypes as st, $fetch as t, getState as tt, Module as u, sendJson as ut, Encoding as v, useBody as vt, OPTIONAL_PARAMETER_MATCH as w, useServer as wt, MimeType as x, useParameters as xt, HttpMethod as y, useCookies as yt, RouterContext as z, Scope as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { $fetch, App, BuildConfig, CLIENT, CLOSE_HOOK, Config, Content, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, Hookable, HttpMethod, InferInput, InferOutput, Invoke, Issue, Mergeable, Middleware, MimeType, Module, Node, OPTIONAL_PARAMETER, OPTIONAL_PARAMETER_MATCH, OPTIONAL_WILDCARD, OPTIONAL_WILDCARD_MATCH, OptionalParameterNode, OptionalWildcardNode, Output, PARAMETER, PARAMETER_MATCH, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, Success, Template, Virtual, WILDCARD, WILDCARD_MATCH, WildcardNode, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendNotFound, sendRedirect, sendText, sendUnauthorized, setCookie, setState, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
|
1
|
+
import { $ as defineRoute, A as PARAMETER_MATCH, At as Failure, B as SERVER_CONTEXT, Bt as Success, C as OPTIONAL_PARAMETER, Ct as useRouter, D as OptionalParameterNode, Dt as withQuery, E as OPTIONAL_WILDCARD_MATCH, Et as useUrl, F as ResponseConfig, Ft as Issue, G as StatusCode, Gt as parseSchema, H as Server, Ht as defineHook, I as Result, It as Mergeable, J as WildcardNode, K as WILDCARD, L as Route, Lt as Output, M as PathNode, Mt as InferInput, N as ROUTER_CONTEXT, Nt as InferOutput, O as OptionalWildcardNode, Ot as Context, P as Radix, Pt as Invoke, Q as defineMiddleware, R as Router, Rt as Schema, S as Node, St as useQuery, T as OPTIONAL_WILDCARD, Tt as useSetCookies, U as ServerContext, Ut as isFailure, V as STATES, Vt as defineContext, W as States, Wt as mergeObjects, X as cookieSameSites, Y as cookiePriorities, Z as createServer, _ as CookieSameSite, _t as statusCodes, a as CLOSE_HOOK, at as isServer, b as Middleware, bt as useHeaders, c as DevelopmentConfig, ct as sendBadRequest, d as SERVER, dt as sendNotFound, et as encodings, f as Source, ft as sendRedirect, g as CookiePriority, gt as setState, h as CookieOptions, ht as setCookie, i as CLIENT, it as isClient, j as ParameterNode, jt as Hookable, k as PARAMETER, kt as Descriptor, l as Environment, lt as sendHtml, m as Virtual, mt as sendUnauthorized, n as App, nt as httpMethods, o as Config, ot as mimeType, p as Template, pt as sendText, q as WILDCARD_MATCH, r as BuildConfig, rt as invoke, s as Content, st as mimeTypes, t as $fetch, tt as getState, u as Module, ut as sendJson, v as Encoding, vt as useBody, w as OPTIONAL_PARAMETER_MATCH, wt as useServer, x as MimeType, xt as useParameters, y as HttpMethod, yt as useCookies, z as RouterContext, zt as Scope } from "./index-CAIDdBVr.mjs";
|
|
2
|
+
export { $fetch, App, BuildConfig, CLIENT, CLOSE_HOOK, Config, Content, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, Hookable, HttpMethod, InferInput, InferOutput, Invoke, Issue, Mergeable, Middleware, MimeType, Module, Node, OPTIONAL_PARAMETER, OPTIONAL_PARAMETER_MATCH, OPTIONAL_WILDCARD, OPTIONAL_WILDCARD_MATCH, OptionalParameterNode, OptionalWildcardNode, Output, PARAMETER, PARAMETER_MATCH, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, Success, Template, Virtual, WILDCARD, WILDCARD_MATCH, WildcardNode, cookiePriorities, cookieSameSites, createServer, defineContext, defineHook, defineMiddleware, defineRoute, encodings, getState, httpMethods, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendNotFound, sendRedirect, sendText, sendUnauthorized, setCookie, setState, statusCodes, useBody, useCookies, useHeaders, useParameters, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { $ as useRouter, A as encodings, B as sendJson, C as WILDCARD, D as createServer, E as cookieSameSites, F as isServer, G as setCookie, H as sendRedirect, I as mimeType, J as useBody, K as setState, L as mimeTypes, M as httpMethods, N as invoke, O as defineMiddleware, P as isClient, Q as useQuery, R as sendBadRequest, S as STATES, T as cookiePriorities, U as sendText, V as sendNotFound, W as sendUnauthorized, X as useHeaders, Y as useCookies, Z as useParameters, _ as PARAMETER_MATCH, a as Hookable, b as Router, c as defineHook, d as parseSchema, et as useServer, f as OPTIONAL_PARAMETER, g as PARAMETER, h as OPTIONAL_WILDCARD_MATCH, i as SERVER, j as getState, k as defineRoute, l as isFailure, m as OPTIONAL_WILDCARD, n as CLIENT, nt as useUrl, o as Scope, p as OPTIONAL_PARAMETER_MATCH, q as statusCodes, r as CLOSE_HOOK, rt as withQuery, s as defineContext, t as App, tt as useSetCookies, u as mergeObjects, v as ROUTER_CONTEXT, w as WILDCARD_MATCH, x as SERVER_CONTEXT, y as Radix, z as sendHtml } from "./app-CrssMYJz.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/client/index.ts
|
|
4
4
|
async function $fetch(scope, input, options) {
|
|
@@ -25,4 +25,4 @@ async function $fetch(scope, input, options) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
export { $fetch, App, CLIENT, CLOSE_HOOK, Hookable, OPTIONAL_PARAMETER, OPTIONAL_PARAMETER_MATCH, OPTIONAL_WILDCARD, OPTIONAL_WILDCARD_MATCH, PARAMETER, PARAMETER_MATCH, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, WILDCARD, WILDCARD_MATCH, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendNotFound, sendRedirect, sendText, sendUnauthorized, setCookie, setState, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
|
28
|
+
export { $fetch, App, CLIENT, CLOSE_HOOK, Hookable, OPTIONAL_PARAMETER, OPTIONAL_PARAMETER_MATCH, OPTIONAL_WILDCARD, OPTIONAL_WILDCARD_MATCH, PARAMETER, PARAMETER_MATCH, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, WILDCARD, WILDCARD_MATCH, cookiePriorities, cookieSameSites, createServer, defineContext, defineHook, defineMiddleware, defineRoute, encodings, getState, httpMethods, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendNotFound, sendRedirect, sendText, sendUnauthorized, setCookie, setState, statusCodes, useBody, useCookies, useHeaders, useParameters, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
package/dist/kit/index.d.mts
CHANGED
package/dist/vite/index.d.mts
CHANGED
package/dist/vite/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as invoke, i as SERVER, n as CLIENT, o as Scope, r as CLOSE_HOOK, t as App, x as SERVER_CONTEXT } from "../app-CrssMYJz.mjs";
|
|
2
|
+
import { n as version, t as name } from "../package-DRX23rU2.mjs";
|
|
2
3
|
import { addTemplate, addTypes, addVirtual, useKit } from "../kit/index.mjs";
|
|
3
4
|
import { basename, dirname, isAbsolute, join, posix, resolve, win32 } from "path";
|
|
4
5
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
@@ -8,11 +9,6 @@ import { isRunnableDevEnvironment } from "vite";
|
|
|
8
9
|
import { once } from "events";
|
|
9
10
|
import { Readable, Stream } from "stream";
|
|
10
11
|
|
|
11
|
-
//#region package.json
|
|
12
|
-
var name = "revojs";
|
|
13
|
-
var version = "0.1.35";
|
|
14
|
-
|
|
15
|
-
//#endregion
|
|
16
12
|
//#region src/vite/node/index.ts
|
|
17
13
|
function splitSetCookieString(cookiesString) {
|
|
18
14
|
if (Array.isArray(cookiesString)) return cookiesString.flatMap((c) => splitSetCookieString(c));
|
|
@@ -255,6 +251,7 @@ function revojs(config) {
|
|
|
255
251
|
name,
|
|
256
252
|
version,
|
|
257
253
|
sharedDuringBuild: true,
|
|
254
|
+
api: { [name]: app },
|
|
258
255
|
async config() {
|
|
259
256
|
const { fromModule } = useKit(cwd());
|
|
260
257
|
for (const module of app.config.modules) await module.setup?.(app);
|
package/package.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "revojs",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"repository": "coverbase/revojs",
|
|
3
|
+
"version": "0.1.36",
|
|
6
4
|
"license": "MIT",
|
|
5
|
+
"repository": "coverbase/revojs",
|
|
6
|
+
"bin": {
|
|
7
|
+
"revojs": "./dist/cli/index.mjs"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"src/types"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.mjs",
|
|
15
|
+
"module": "./dist/index.mjs",
|
|
16
|
+
"types": "./dist/index.d.mts",
|
|
7
17
|
"exports": {
|
|
8
18
|
".": {
|
|
9
19
|
"types": "./dist/index.d.mts",
|
|
@@ -18,21 +28,15 @@
|
|
|
18
28
|
"import": "./dist/vite/index.mjs"
|
|
19
29
|
},
|
|
20
30
|
"./types": {
|
|
21
|
-
"types": "./src/types/index.d.
|
|
31
|
+
"types": "./src/types/index.d.ts"
|
|
22
32
|
}
|
|
23
33
|
},
|
|
24
|
-
"types": "./dist/index.d.mts",
|
|
25
|
-
"module": "./dist/index.mjs",
|
|
26
|
-
"main": "./dist/index.mjs",
|
|
27
|
-
"files": [
|
|
28
|
-
"dist",
|
|
29
|
-
"src/types"
|
|
30
|
-
],
|
|
31
34
|
"scripts": {
|
|
32
35
|
"build": "tsdown",
|
|
33
36
|
"watch": "tsdown -w"
|
|
34
37
|
},
|
|
35
38
|
"dependencies": {
|
|
39
|
+
"citty": "^0.2.1",
|
|
36
40
|
"tinyglobby": "^0.2.15",
|
|
37
41
|
"vite": "^7.3.1"
|
|
38
42
|
},
|