revojs 0.0.69 → 0.0.71
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
CHANGED
|
@@ -5,7 +5,10 @@ export type NestedPartial<T> = T extends any[] ? T : T extends Record<string, an
|
|
|
5
5
|
export type Environment = typeof CLIENT | typeof SERVER;
|
|
6
6
|
export type Virtual = (environment: Environment) => void | string;
|
|
7
7
|
export type ClientEntry = "index.html" | (string & {});
|
|
8
|
-
export type ServerEntry = "revojs/presets/node" | "revojs/presets/deno" | "revojs/presets/bun" |
|
|
8
|
+
export type ServerEntry = "revojs/presets/node" | "revojs/presets/deno" | "revojs/presets/bun" | (string & {});
|
|
9
|
+
export type Module = {
|
|
10
|
+
setup: (app: App) => void | Promise<void>;
|
|
11
|
+
};
|
|
9
12
|
export type ClientConfig = {
|
|
10
13
|
entry: ClientEntry;
|
|
11
14
|
};
|
|
@@ -16,8 +19,9 @@ export type DevelopmentConfig = {
|
|
|
16
19
|
middleware: Array<Middleware>;
|
|
17
20
|
};
|
|
18
21
|
export type Config = {
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
modules: Array<Module>;
|
|
23
|
+
client: ClientConfig;
|
|
24
|
+
server: ServerConfig;
|
|
21
25
|
dev: DevelopmentConfig;
|
|
22
26
|
};
|
|
23
27
|
export type App = {
|
package/dist/http/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Scope } from "../signals";
|
|
2
|
+
export type CookiePriority = "Low" | "Medium" | "High";
|
|
3
|
+
export type CookieSameSite = "Lax" | "Strict" | "None";
|
|
2
4
|
export type CookieOptions = {
|
|
3
5
|
domain?: string;
|
|
4
6
|
expires?: Date;
|
|
5
7
|
httpOnly?: boolean;
|
|
6
8
|
maxAge?: number;
|
|
7
9
|
path?: string;
|
|
8
|
-
priority?:
|
|
9
|
-
sameSite?:
|
|
10
|
+
priority?: CookiePriority;
|
|
11
|
+
sameSite?: CookieSameSite;
|
|
10
12
|
secure?: boolean;
|
|
11
13
|
};
|
|
12
14
|
export type HttpMethod = "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE";
|
package/dist/index.js
CHANGED
|
@@ -129,6 +129,7 @@ const targets = /* @__PURE__ */ new WeakMap();
|
|
|
129
129
|
function createApp(config) {
|
|
130
130
|
return {
|
|
131
131
|
config: mergeObjects(config, {
|
|
132
|
+
modules: [],
|
|
132
133
|
client: { entry: "./index.html" },
|
|
133
134
|
server: { entry: "revojs/presets/node" },
|
|
134
135
|
dev: { middleware: [] }
|
|
@@ -840,7 +841,7 @@ function provideRouterContext(scope, options) {
|
|
|
840
841
|
navigator.dispatchEvent(new AfterNavigateEvent());
|
|
841
842
|
}
|
|
842
843
|
};
|
|
843
|
-
if (isClient()) useEvent(scope, window, "popstate",
|
|
844
|
+
if (isClient()) useEvent(scope, window, "popstate", fetch$1);
|
|
844
845
|
scope.setContext(ROUTE_CONTEXT, { inputs: createState() });
|
|
845
846
|
scope.setContext(ROUTER_CONTEXT, {
|
|
846
847
|
options,
|
|
@@ -850,7 +851,7 @@ function provideRouterContext(scope, options) {
|
|
|
850
851
|
route
|
|
851
852
|
});
|
|
852
853
|
fetch$1();
|
|
853
|
-
useEvent(scope, navigator, "navigate",
|
|
854
|
+
useEvent(scope, navigator, "navigate", () => startViewTransition(fetch$1));
|
|
854
855
|
return useRouter(scope);
|
|
855
856
|
}
|
|
856
857
|
function useRouter(scope, context) {
|
package/dist/presets/bun.js
CHANGED
|
@@ -1,7 +1,53 @@
|
|
|
1
|
-
import { RUNTIME_CONTEXT, Scope } from "./runtime-Daz6s680.js";
|
|
2
1
|
import { serve } from "bun";
|
|
3
2
|
import { runtime } from "#virtual/runtime";
|
|
4
3
|
|
|
4
|
+
//#region src/signals/index.ts
|
|
5
|
+
var StopEvent = class extends Event {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("stop");
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var Scope = class extends EventTarget {
|
|
11
|
+
parentScope;
|
|
12
|
+
context;
|
|
13
|
+
constructor(parentScope) {
|
|
14
|
+
super();
|
|
15
|
+
this.parentScope = parentScope;
|
|
16
|
+
this.parentScope?.onStop(() => this.stop());
|
|
17
|
+
this.context = /* @__PURE__ */ new Map();
|
|
18
|
+
}
|
|
19
|
+
getContext(input) {
|
|
20
|
+
let scope = this;
|
|
21
|
+
while (scope) {
|
|
22
|
+
if (scope.context.has(input)) return scope.context.get(input);
|
|
23
|
+
scope = scope.parentScope;
|
|
24
|
+
}
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
setContext(input, value) {
|
|
28
|
+
this.context.set(input, value);
|
|
29
|
+
}
|
|
30
|
+
onStop(input) {
|
|
31
|
+
this.addEventListener("stop", input, { once: true });
|
|
32
|
+
}
|
|
33
|
+
stop() {
|
|
34
|
+
return this.dispatchEvent(new StopEvent());
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function defineContext(key) {
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/html/index.ts
|
|
43
|
+
const HOST_CONTEXT = defineContext("HOST_CONTEXT");
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/runtime/index.ts
|
|
47
|
+
const RUNTIME_CONTEXT = defineContext("RUNTIME_CONTEXT");
|
|
48
|
+
const ROUTE_CONTEXT = defineContext("ROUTE_CONTEXT");
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
5
51
|
//#region src/presets/bun.ts
|
|
6
52
|
serve({ fetch: async (request) => {
|
|
7
53
|
const scope = new Scope();
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RUNTIME_CONTEXT, Scope } from "./runtime-Daz6s680.js";
|
|
2
|
-
import { runtime } from "#virtual/runtime";
|
|
3
|
-
|
|
4
|
-
//#region src/presets/cloudflare.ts
|
|
5
|
-
var cloudflare_default = { fetch: async (request, variables) => {
|
|
6
|
-
const scope = new Scope();
|
|
7
|
-
scope.setContext(RUNTIME_CONTEXT, {
|
|
8
|
-
tasks: new Array(),
|
|
9
|
-
request,
|
|
10
|
-
response: { headers: new Headers() },
|
|
11
|
-
variables
|
|
12
|
-
});
|
|
13
|
-
return await runtime.fetch(scope).finally(() => scope.stop());
|
|
14
|
-
} };
|
|
15
|
-
|
|
16
|
-
//#endregion
|
|
17
|
-
export { cloudflare_default as default };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
//#region src/signals/index.ts
|
|
2
|
-
var StopEvent = class extends Event {
|
|
3
|
-
constructor() {
|
|
4
|
-
super("stop");
|
|
5
|
-
}
|
|
6
|
-
};
|
|
7
|
-
var Scope = class extends EventTarget {
|
|
8
|
-
parentScope;
|
|
9
|
-
context;
|
|
10
|
-
constructor(parentScope) {
|
|
11
|
-
super();
|
|
12
|
-
this.parentScope = parentScope;
|
|
13
|
-
this.parentScope?.onStop(() => this.stop());
|
|
14
|
-
this.context = /* @__PURE__ */ new Map();
|
|
15
|
-
}
|
|
16
|
-
getContext(input) {
|
|
17
|
-
let scope = this;
|
|
18
|
-
while (scope) {
|
|
19
|
-
if (scope.context.has(input)) return scope.context.get(input);
|
|
20
|
-
scope = scope.parentScope;
|
|
21
|
-
}
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
setContext(input, value) {
|
|
25
|
-
this.context.set(input, value);
|
|
26
|
-
}
|
|
27
|
-
onStop(input) {
|
|
28
|
-
this.addEventListener("stop", input, { once: true });
|
|
29
|
-
}
|
|
30
|
-
stop() {
|
|
31
|
-
return this.dispatchEvent(new StopEvent());
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
function defineContext(key) {
|
|
35
|
-
return key;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/html/index.ts
|
|
40
|
-
const HOST_CONTEXT = defineContext("HOST_CONTEXT");
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/runtime/index.ts
|
|
44
|
-
const RUNTIME_CONTEXT = defineContext("RUNTIME_CONTEXT");
|
|
45
|
-
const ROUTE_CONTEXT = defineContext("ROUTE_CONTEXT");
|
|
46
|
-
|
|
47
|
-
//#endregion
|
|
48
|
-
export { RUNTIME_CONTEXT, Scope };
|