revojs 0.1.24 → 0.1.25
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-B3x9-FYe.js → app-DOdfHYPa.js} +3 -2
- package/dist/{index-NJXRiTAn.d.ts → index-xe4wwpuC.d.ts} +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/kit/index.d.ts +1 -1
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +31 -25
- package/package.json +1 -1
|
@@ -429,7 +429,7 @@ var App = class extends Hookable {
|
|
|
429
429
|
development: { middlewares: [] },
|
|
430
430
|
build: {
|
|
431
431
|
externals: [],
|
|
432
|
-
types: {},
|
|
432
|
+
types: { "revojs.d.ts": () => `import "revojs/types"` },
|
|
433
433
|
virtuals: {},
|
|
434
434
|
alias: {}
|
|
435
435
|
}
|
|
@@ -439,6 +439,7 @@ var App = class extends Hookable {
|
|
|
439
439
|
};
|
|
440
440
|
const SERVER = "ssr";
|
|
441
441
|
const CLIENT = "client";
|
|
442
|
+
const CLOSE_HOOK = defineHook("CLOSE_HOOK");
|
|
442
443
|
|
|
443
444
|
//#endregion
|
|
444
|
-
export {
|
|
445
|
+
export { isClient as A, setCookie as B, WILDCARD as C, defineRoute as D, defineMiddleware as E, sendHtml as F, useRouter as G, useCookies as H, sendJson as I, useUrl as J, useServer as K, sendRedirect as L, mimeType as M, mimeTypes as N, getState as O, sendBadRequest as P, sendText as R, STATES as S, createServer as T, useHeaders as U, setState as V, useQuery as W, withQuery as Y, PARAMETER_MATCH as _, Hookable as a, Router as b, defineHook as c, parseSchema as d, OPTIONAL_PARAMETER as f, PARAMETER as g, OPTIONAL_WILDCARD_MATCH as h, SERVER as i, isServer as j, invoke as k, isFailure as l, OPTIONAL_WILDCARD as m, CLIENT as n, Scope as o, OPTIONAL_PARAMETER_MATCH as p, useSetCookies as q, CLOSE_HOOK as r, defineContext as s, App as t, mergeObjects as u, ROUTER_CONTEXT as v, WILDCARD_MATCH as w, SERVER_CONTEXT as x, Radix as y, sendUnauthorized as z };
|
|
@@ -212,8 +212,9 @@ declare class App extends Hookable {
|
|
|
212
212
|
}
|
|
213
213
|
declare const SERVER = "ssr";
|
|
214
214
|
declare const CLIENT = "client";
|
|
215
|
+
declare const CLOSE_HOOK: Descriptor<() => void>;
|
|
215
216
|
//#endregion
|
|
216
217
|
//#region src/client/index.d.ts
|
|
217
218
|
declare function $fetch<T>(scope: Scope, input: string | URL, options?: RequestInit): Promise<T>;
|
|
218
219
|
//#endregion
|
|
219
|
-
export {
|
|
220
|
+
export { invoke as $, PARAMETER_MATCH as A, Schema as At, SERVER_CONTEXT as B, OPTIONAL_PARAMETER as C, Hookable as Ct, OptionalParameterNode as D, Issue as Dt, OPTIONAL_WILDCARD_MATCH as E, Invoke as Et, ResponseConfig as F, isFailure as Ft, StatusCode as G, Server as H, Result as I, mergeObjects as It, WildcardNode as J, WILDCARD as K, Route as L, parseSchema as Lt, PathNode as M, Success as Mt, ROUTER_CONTEXT as N, defineContext as Nt, OptionalWildcardNode as O, Mergeable as Ot, Radix as P, defineHook as Pt, getState as Q, Router as R, Node as S, Failure as St, OPTIONAL_WILDCARD as T, InferOutput as Tt, ServerContext as U, STATES as V, States as W, defineMiddleware as X, createServer as Y, defineRoute as Z, CookieSameSite as _, useSetCookies as _t, CLOSE_HOOK as a, sendHtml as at, Middleware as b, Context as bt, DevelopmentConfig as c, sendText as ct, SERVER as d, setState as dt, isClient as et, Source as f, useCookies as ft, CookiePriority as g, useServer as gt, CookieOptions as h, useRouter as ht, CLIENT as i, sendBadRequest as it, ParameterNode as j, Scope as jt, PARAMETER as k, Output as kt, Environment as l, sendUnauthorized as lt, Virtual as m, useQuery as mt, App as n, mimeType as nt, Config as o, sendJson as ot, Template as p, useHeaders as pt, WILDCARD_MATCH as q, BuildConfig as r, mimeTypes as rt, Content as s, sendRedirect as st, $fetch as t, isServer as tt, Module as u, setCookie as ut, Encoding as v, useUrl as vt, OPTIONAL_PARAMETER_MATCH as w, InferInput as wt, MimeType as x, Descriptor as xt, HttpMethod as y, withQuery as yt, RouterContext as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { $fetch, App, BuildConfig, CLIENT, 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, sendRedirect, sendText, sendUnauthorized, setCookie, setState, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
|
1
|
+
import { $ as invoke, A as PARAMETER_MATCH, At as Schema, B as SERVER_CONTEXT, C as OPTIONAL_PARAMETER, Ct as Hookable, D as OptionalParameterNode, Dt as Issue, E as OPTIONAL_WILDCARD_MATCH, Et as Invoke, F as ResponseConfig, Ft as isFailure, G as StatusCode, H as Server, I as Result, It as mergeObjects, J as WildcardNode, K as WILDCARD, L as Route, Lt as parseSchema, M as PathNode, Mt as Success, N as ROUTER_CONTEXT, Nt as defineContext, O as OptionalWildcardNode, Ot as Mergeable, P as Radix, Pt as defineHook, Q as getState, R as Router, S as Node, St as Failure, T as OPTIONAL_WILDCARD, Tt as InferOutput, U as ServerContext, V as STATES, W as States, X as defineMiddleware, Y as createServer, Z as defineRoute, _ as CookieSameSite, _t as useSetCookies, a as CLOSE_HOOK, at as sendHtml, b as Middleware, bt as Context, c as DevelopmentConfig, ct as sendText, d as SERVER, dt as setState, et as isClient, f as Source, ft as useCookies, g as CookiePriority, gt as useServer, h as CookieOptions, ht as useRouter, i as CLIENT, it as sendBadRequest, j as ParameterNode, jt as Scope, k as PARAMETER, kt as Output, l as Environment, lt as sendUnauthorized, m as Virtual, mt as useQuery, n as App, nt as mimeType, o as Config, ot as sendJson, p as Template, pt as useHeaders, q as WILDCARD_MATCH, r as BuildConfig, rt as mimeTypes, s as Content, st as sendRedirect, t as $fetch, tt as isServer, u as Module, ut as setCookie, v as Encoding, vt as useUrl, w as OPTIONAL_PARAMETER_MATCH, wt as InferInput, x as MimeType, xt as Descriptor, y as HttpMethod, yt as withQuery, z as RouterContext } from "./index-xe4wwpuC.js";
|
|
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, sendRedirect, sendText, sendUnauthorized, setCookie, setState, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as isClient, B as setCookie, C as WILDCARD, D as defineRoute, E as defineMiddleware, F as sendHtml, G as useRouter, H as useCookies, I as sendJson, J as useUrl, K as useServer, L as sendRedirect, M as mimeType, N as mimeTypes, O as getState, P as sendBadRequest, R as sendText, S as STATES, T as createServer, U as useHeaders, V as setState, W as useQuery, Y as withQuery, _ as PARAMETER_MATCH, a as Hookable, b as Router, c as defineHook, d as parseSchema, f as OPTIONAL_PARAMETER, g as PARAMETER, h as OPTIONAL_WILDCARD_MATCH, i as SERVER, j as isServer, k as invoke, l as isFailure, m as OPTIONAL_WILDCARD, n as CLIENT, o as Scope, p as OPTIONAL_PARAMETER_MATCH, q as useSetCookies, r as CLOSE_HOOK, s as defineContext, t as App, u as mergeObjects, v as ROUTER_CONTEXT, w as WILDCARD_MATCH, x as SERVER_CONTEXT, y as Radix, z as sendUnauthorized } from "./app-DOdfHYPa.js";
|
|
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, 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, 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, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
package/dist/kit/index.d.ts
CHANGED
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as useKit, i as addVirtual } from "../kit-BQv19une.js";
|
|
1
|
+
import { i as SERVER, k as invoke, n as CLIENT, o as Scope, r as CLOSE_HOOK, t as App, x as SERVER_CONTEXT } from "../app-DOdfHYPa.js";
|
|
2
|
+
import { a as useKit, i as addVirtual, r as addTypes } from "../kit-BQv19une.js";
|
|
3
3
|
import { basename, isAbsolute, join, posix, resolve, win32 } from "path";
|
|
4
4
|
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
5
5
|
import { cwd } from "process";
|
|
@@ -10,7 +10,7 @@ import { Readable, Stream } from "stream";
|
|
|
10
10
|
|
|
11
11
|
//#region package.json
|
|
12
12
|
var name = "revojs";
|
|
13
|
-
var version = "0.1.
|
|
13
|
+
var version = "0.1.25";
|
|
14
14
|
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/vite/node/index.ts
|
|
@@ -263,6 +263,7 @@ function revojs(config) {
|
|
|
263
263
|
addVirtual(app, "server", () => {
|
|
264
264
|
if (app.config.server) return `import { createServer } from "revojs"; export default await createServer()`;
|
|
265
265
|
});
|
|
266
|
+
addTypes(app, "vite.d.ts", () => `import "vite/client"`);
|
|
266
267
|
for (const name$1 in app.config.sources) {
|
|
267
268
|
const source = app.config.sources[name$1];
|
|
268
269
|
addVirtual(app, name$1, () => {
|
|
@@ -276,16 +277,18 @@ function revojs(config) {
|
|
|
276
277
|
})}}`;
|
|
277
278
|
});
|
|
278
279
|
}
|
|
279
|
-
const
|
|
280
|
-
rmSync(
|
|
280
|
+
const metaPath = resolve(".revojs");
|
|
281
|
+
rmSync(metaPath, {
|
|
281
282
|
recursive: true,
|
|
282
283
|
force: true
|
|
283
284
|
});
|
|
284
|
-
mkdirSync(
|
|
285
|
+
mkdirSync(metaPath, { recursive: true });
|
|
286
|
+
let types = "";
|
|
285
287
|
for (const type in app.config.build.types) {
|
|
286
288
|
const content = app.config.build.types[type];
|
|
287
|
-
|
|
289
|
+
types += content() + "\n";
|
|
288
290
|
}
|
|
291
|
+
writeFileSync(join(metaPath, "index.d.ts"), types);
|
|
289
292
|
return {
|
|
290
293
|
appType: "custom",
|
|
291
294
|
optimizeDeps: { exclude: ["revojs"] },
|
|
@@ -360,24 +363,27 @@ function revojs(config) {
|
|
|
360
363
|
},
|
|
361
364
|
async configureServer(devServer) {
|
|
362
365
|
const target = devServer.environments[SERVER];
|
|
363
|
-
if (isRunnableDevEnvironment(target))
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
366
|
+
if (isRunnableDevEnvironment(target)) {
|
|
367
|
+
process.on("exit", () => app.dispatchHook(CLOSE_HOOK));
|
|
368
|
+
return () => {
|
|
369
|
+
devServer.middlewares.use(async (request, response, next) => {
|
|
370
|
+
const server = await target.runner.import("#virtual/server").then((module) => module.default);
|
|
371
|
+
if (server) {
|
|
372
|
+
request.url = request.originalUrl;
|
|
373
|
+
const scope = new Scope();
|
|
374
|
+
scope.setContext(SERVER_CONTEXT, {
|
|
375
|
+
states: {},
|
|
376
|
+
request: fromNodeRequest(request, response),
|
|
377
|
+
response: { headers: new Headers() },
|
|
378
|
+
variables: process.env
|
|
379
|
+
});
|
|
380
|
+
var result = await invoke(scope, app.config.development.middlewares.concat({ fetch: server.fetch }));
|
|
381
|
+
if (result) await toNodeRequest(result, response);
|
|
382
|
+
}
|
|
383
|
+
next();
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
}
|
|
381
387
|
}
|
|
382
388
|
},
|
|
383
389
|
virtuals(app.config.build.virtuals),
|