revojs 0.0.42 → 0.0.44
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/index.d.ts +3 -3
- package/dist/index.js +5 -9
- package/package.json +1 -1
- package/src/types/index.d.ts +2 -2
package/dist/app/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Middleware } from "../http";
|
|
|
3
3
|
export type NestedPartial<T> = T extends any[] ? T : T extends Record<string, any> ? {
|
|
4
4
|
[P in keyof T]?: NestedPartial<T[P]>;
|
|
5
5
|
} : T;
|
|
6
|
-
export type Environment =
|
|
6
|
+
export type Environment = typeof CLIENT | typeof SERVER;
|
|
7
7
|
export type ServerEntry = "revojs/presets/node" | "revojs/presets/deno" | "revojs/presets/bun" | "revojs/presets/cloudflare" | (string & {});
|
|
8
8
|
export type ClientConfig = {
|
|
9
9
|
entry: string;
|
|
@@ -24,6 +24,6 @@ export type App<T> = {
|
|
|
24
24
|
config: Config<T>;
|
|
25
25
|
virtuals: Record<string, (environment: Environment) => string>;
|
|
26
26
|
};
|
|
27
|
-
export declare const getRoutes: <T>() => Promise<Record<string, () => Promise<T>>>;
|
|
28
|
-
export declare const getAssets: <T>() => Promise<Record<string, () => Promise<T>>>;
|
|
29
27
|
export declare const createApp: <T>(config?: NestedPartial<Config<T>>) => App<T>;
|
|
28
|
+
export declare const SERVER = "ssr";
|
|
29
|
+
export declare const CLIENT = "client";
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,6 @@ import { defu } from "defu";
|
|
|
2
2
|
import { h } from "revojs/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/app/index.ts
|
|
5
|
-
const getRoutes = async () => {
|
|
6
|
-
return await import("#virtual/routes").then((module) => module.routes);
|
|
7
|
-
};
|
|
8
|
-
const getAssets = async () => {
|
|
9
|
-
return await import("#virtual/assets").then((module) => module.assets);
|
|
10
|
-
};
|
|
11
5
|
const createApp = (config) => {
|
|
12
6
|
return {
|
|
13
7
|
config: defu(config, {
|
|
@@ -19,6 +13,8 @@ const createApp = (config) => {
|
|
|
19
13
|
virtuals: {}
|
|
20
14
|
};
|
|
21
15
|
};
|
|
16
|
+
const SERVER = "ssr";
|
|
17
|
+
const CLIENT = "client";
|
|
22
18
|
|
|
23
19
|
//#endregion
|
|
24
20
|
//#region src/jsx/index.ts
|
|
@@ -631,7 +627,7 @@ const getVariables = (event) => {
|
|
|
631
627
|
const createRuntime = async () => {
|
|
632
628
|
const radix = new Radix();
|
|
633
629
|
const middlewares = new Array();
|
|
634
|
-
const routes = await
|
|
630
|
+
const routes = await import("#virtual/routes").then((module) => module.routes);
|
|
635
631
|
for (const path in routes) {
|
|
636
632
|
const [name, method] = toPath(path);
|
|
637
633
|
radix.insert((method ?? "GET").toUpperCase() + name, defineRoute({ fetch: async (event) => {
|
|
@@ -648,7 +644,7 @@ const createRuntime = async () => {
|
|
|
648
644
|
}
|
|
649
645
|
} }));
|
|
650
646
|
}
|
|
651
|
-
const assets = await
|
|
647
|
+
const assets = await import("#virtual/assets").then((module) => module.assets);
|
|
652
648
|
for (const path in assets) radix.insert("GET/" + path, defineRoute({ fetch: async (event) => {
|
|
653
649
|
event.response.headers.set("Content-Type", getMimeType(path));
|
|
654
650
|
return new Response(await assets[path]?.(), event.response);
|
|
@@ -898,4 +894,4 @@ const markdownToSlot = (input, options) => {
|
|
|
898
894
|
};
|
|
899
895
|
|
|
900
896
|
//#endregion
|
|
901
|
-
export { $fetch, Compute, HOST_CONTEXT, Handler, LOCALE_CONTEXT, MountedEvent, NavigateEvent, Page, ROUTER_CONTEXT, RUNTIME_CONTEXT, Radix, Scope, StopEvent, activeCompute, components, createApp, createCompute, createElement, createEvent, createLocale, createMemo, createRouter, createRuntime, createState, defineComponent, defineContext, defineRoute, fileName, fromValue,
|
|
897
|
+
export { $fetch, CLIENT, Compute, HOST_CONTEXT, Handler, LOCALE_CONTEXT, MountedEvent, NavigateEvent, Page, ROUTER_CONTEXT, RUNTIME_CONTEXT, Radix, SERVER, Scope, StopEvent, activeCompute, components, createApp, createCompute, createElement, createEvent, createLocale, createMemo, createRouter, createRuntime, createState, defineComponent, defineContext, defineRoute, fileName, fromValue, getCookies, getCustomElement, getMimeType, getRequestUrl, getSetCookies, getVariables, hydrate, isClient, isServer, isTemplate, markdownToSlot, preventDefault, registerComponent, renderToString, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, stopImmediatePropagation, stopPropagation, targets, toArray, toCustomElement, toFragment, toPath, toRange, toString, useEvent, useHost, useLocale, useRouter, useRuntime };
|
package/package.json
CHANGED
package/src/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ declare module "#virtual/locales" {
|
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
declare module "#virtual/assets" {
|
|
6
|
-
export const assets: Record<string, () => Promise<
|
|
6
|
+
export const assets: Record<string, () => Promise<string>>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
declare module "#virtual/client" {
|
|
@@ -13,7 +13,7 @@ declare module "#virtual/client" {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
declare module "#virtual/routes" {
|
|
16
|
-
export const routes: Record<string, () => Promise<T
|
|
16
|
+
export const routes: Record<string, () => Promise<Route<T> | ComponentConstructor<Events, Attributes>>>;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
declare module "#virtual/runtime" {
|