ovr 4.5.1 → 5.0.0
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/context.d.ts +58 -56
- package/dist/app/context.d.ts.map +1 -1
- package/dist/app/context.js +97 -134
- package/dist/app/helper/index.d.ts +2 -6
- package/dist/app/helper/index.d.ts.map +1 -1
- package/dist/app/helper/index.js +5 -19
- package/dist/app/index.d.ts +31 -45
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +68 -94
- package/dist/app/memo/index.d.ts +1 -1
- package/dist/app/memo/index.d.ts.map +1 -1
- package/dist/app/memo/index.js +2 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/jsx/chunk/index.d.ts +9 -0
- package/dist/jsx/chunk/index.d.ts.map +1 -1
- package/dist/jsx/chunk/index.js +11 -0
- package/dist/jsx/index.d.ts +5 -4
- package/dist/jsx/index.d.ts.map +1 -1
- package/dist/jsx/index.js +43 -45
- package/dist/jsx/merge-async-generators.d.ts.map +1 -1
- package/dist/jsx/merge-async-generators.js +9 -3
- package/dist/trie/index.d.ts +5 -0
- package/dist/trie/index.d.ts.map +1 -1
- package/dist/trie/index.js +8 -2
- package/package.json +2 -2
- package/src/app/context.ts +100 -164
- package/src/app/helper/index.ts +6 -24
- package/src/app/index.ts +111 -123
- package/src/app/memo/index.ts +2 -2
- package/src/index.ts +1 -2
- package/src/jsx/chunk/index.ts +12 -0
- package/src/jsx/index.ts +61 -74
- package/src/jsx/merge-async-generators.ts +8 -5
- package/src/trie/index.ts +9 -2
- package/src/util/hash.ts +1 -1
- package/dist/app/mw/csrf.d.ts +0 -23
- package/dist/app/mw/csrf.d.ts.map +0 -1
- package/dist/app/mw/csrf.js +0 -30
- package/src/app/mw/csrf.ts +0 -32
package/dist/app/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EACX,SAAS,EACT,kBAAkB,EAClB,aAAa,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"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"}
|
package/dist/app/index.js
CHANGED
|
@@ -2,57 +2,25 @@ import { Route, Trie } from "../trie/index.js";
|
|
|
2
2
|
import { Context } from "./context.js";
|
|
3
3
|
import { Get } from "./helper/get.js";
|
|
4
4
|
import { Post } from "./helper/post.js";
|
|
5
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
6
5
|
export class App {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
const resolved = {
|
|
8
|
+
csrf: true,
|
|
9
|
+
trailingSlash: "never",
|
|
10
|
+
};
|
|
11
|
+
Object.assign(resolved, options);
|
|
12
|
+
if (resolved.csrf === true)
|
|
13
|
+
this.#use.push(App.#csrf);
|
|
14
|
+
if (resolved.trailingSlash !== "ignore") {
|
|
15
|
+
this.#use.push(App.#trailingSlash(resolved.trailingSlash));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
7
18
|
/** Built tries per HTTP method. */
|
|
8
19
|
#trieMap = new Map();
|
|
9
20
|
/** Added routes per HTTP method. */
|
|
10
21
|
#routesMap = new Map();
|
|
11
22
|
/** Global middleware. */
|
|
12
23
|
#use = [];
|
|
13
|
-
/**
|
|
14
|
-
* - `"never"` - Not found requests with a trailing slash will be redirected to the same path without a trailing slash
|
|
15
|
-
* - `"always"` - Not found requests without a trailing slash will be redirected to the same path with a trailing slash
|
|
16
|
-
* - `"ignore"` - no redirects (not recommended, bad for SEO)
|
|
17
|
-
*
|
|
18
|
-
* [Trailing Slash for Frameworks by Bjorn Lu](https://bjornlu.com/blog/trailing-slash-for-frameworks)
|
|
19
|
-
*
|
|
20
|
-
* @default "never"
|
|
21
|
-
*/
|
|
22
|
-
trailingSlash = "never";
|
|
23
|
-
/**
|
|
24
|
-
* Base HTML to inject the `head` and `page` elements into.
|
|
25
|
-
*
|
|
26
|
-
* @default
|
|
27
|
-
*
|
|
28
|
-
* ```html
|
|
29
|
-
* <!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body></body></html>
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
base = '<!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body></body></html>';
|
|
33
|
-
/**
|
|
34
|
-
* Assign a handler to run when an `Error` is thrown.
|
|
35
|
-
*
|
|
36
|
-
* If not set, `Error` will be thrown. This might be desired
|
|
37
|
-
* if your server already includes error handling. Set in `config.start`
|
|
38
|
-
* to handle errors globally.
|
|
39
|
-
*
|
|
40
|
-
* @default null
|
|
41
|
-
*/
|
|
42
|
-
error = null;
|
|
43
|
-
/**
|
|
44
|
-
* Middleware to run when no `body` or `status` has been set on the `context`.
|
|
45
|
-
* Set to a new function to override the default.
|
|
46
|
-
*
|
|
47
|
-
* @default
|
|
48
|
-
*
|
|
49
|
-
* ```ts
|
|
50
|
-
* (c) => c.html("Not found", 404)
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
notFound = (c) => c.html("Not found", 404);
|
|
54
|
-
/** Stores context per request. */
|
|
55
|
-
static storage = new AsyncLocalStorage();
|
|
56
24
|
/**
|
|
57
25
|
* @param helpers `Helper` to add to `App`
|
|
58
26
|
* @returns `App` instance
|
|
@@ -111,58 +79,64 @@ export class App {
|
|
|
111
79
|
return this.on("POST", patternOrPatterns, ...middleware);
|
|
112
80
|
}
|
|
113
81
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
82
|
+
* Request a resource from the application.
|
|
83
|
+
*
|
|
84
|
+
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch)
|
|
85
|
+
*
|
|
86
|
+
* @param resource [Resource](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch#resource) to fetch
|
|
87
|
+
* @param options [Options](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch#options) to apply to the request
|
|
88
|
+
* @returns Promise that resolves to the [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) to the request
|
|
116
89
|
*/
|
|
117
|
-
fetch = (
|
|
118
|
-
const c = new Context(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
trie.add(route);
|
|
131
|
-
this.#trieMap.set(req.method, trie);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (trie) {
|
|
135
|
-
const match = trie.find(c.url.pathname);
|
|
136
|
-
if (match) {
|
|
137
|
-
Object.assign(c, match);
|
|
138
|
-
const middleware = [...this.#use, ...match.route.store];
|
|
139
|
-
// compose
|
|
140
|
-
let i = -1;
|
|
141
|
-
const dispatch = async (current) => {
|
|
142
|
-
if (current <= i)
|
|
143
|
-
throw new Error("next() called multiple times");
|
|
144
|
-
i = current;
|
|
145
|
-
if (middleware[current]) {
|
|
146
|
-
const result = await middleware[current](c, () => dispatch(current + 1));
|
|
147
|
-
if (result instanceof Response)
|
|
148
|
-
c.res(result.body, result);
|
|
149
|
-
else if (result instanceof ReadableStream)
|
|
150
|
-
c.body = result;
|
|
151
|
-
else if (result != null)
|
|
152
|
-
c.page(result);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
await dispatch(0);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
90
|
+
fetch = async (resource, options) => {
|
|
91
|
+
const c = new Context(new Request(resource, options));
|
|
92
|
+
// see if the method is already built
|
|
93
|
+
let trie = this.#trieMap.get(c.req.method);
|
|
94
|
+
if (!trie) {
|
|
95
|
+
// check if there are any routes with the method
|
|
96
|
+
const routes = this.#routesMap.get(c.req.method);
|
|
97
|
+
if (routes) {
|
|
98
|
+
// build trie
|
|
99
|
+
trie = new Trie();
|
|
100
|
+
for (const route of routes)
|
|
101
|
+
trie.add(route);
|
|
102
|
+
this.#trieMap.set(c.req.method, trie);
|
|
158
103
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
104
|
+
}
|
|
105
|
+
if (trie) {
|
|
106
|
+
const match = trie.find(c.url.pathname);
|
|
107
|
+
if (match) {
|
|
108
|
+
Object.assign(c, match);
|
|
109
|
+
return c.build(this.#use.concat(match.route.store));
|
|
164
110
|
}
|
|
165
|
-
|
|
166
|
-
|
|
111
|
+
}
|
|
112
|
+
// no match, just run global middleware
|
|
113
|
+
return c.build(this.#use);
|
|
167
114
|
};
|
|
115
|
+
/** Basic CSRF middleware. */
|
|
116
|
+
static async #csrf(c, next) {
|
|
117
|
+
if (c.req.method === "GET" ||
|
|
118
|
+
c.req.method === "HEAD" ||
|
|
119
|
+
c.req.headers.get("sec-fetch-site") === "same-origin" ||
|
|
120
|
+
c.req.headers.get("origin") === c.url.origin) {
|
|
121
|
+
return next();
|
|
122
|
+
}
|
|
123
|
+
c.text("Forbidden", 403);
|
|
124
|
+
}
|
|
125
|
+
/** @returns Trailing slash middleware */
|
|
126
|
+
static #trailingSlash(mode) {
|
|
127
|
+
return async (c, next) => {
|
|
128
|
+
await next();
|
|
129
|
+
if (c.status && c.status !== 404)
|
|
130
|
+
return;
|
|
131
|
+
const last = c.url.pathname.at(-1);
|
|
132
|
+
if (mode === "always" && last !== "/") {
|
|
133
|
+
c.url.pathname += "/";
|
|
134
|
+
c.redirect(c.url, 308);
|
|
135
|
+
}
|
|
136
|
+
else if (mode === "never" && c.url.pathname !== "/" && last === "/") {
|
|
137
|
+
c.url.pathname = c.url.pathname.slice(0, -1);
|
|
138
|
+
c.redirect(c.url, 308);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
168
142
|
}
|
package/dist/app/memo/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export declare class Memo {
|
|
|
7
7
|
* @param fn Function to memoize.
|
|
8
8
|
* @returns The memoized function.
|
|
9
9
|
*/
|
|
10
|
-
use
|
|
10
|
+
use<A extends any[], R>(fn: (...args: A) => R): (...args: A) => R;
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/memo/index.ts"],"names":[],"mappings":"AAAA,qBAAa,IAAI;;IAOhB;;;;;;OAMG;IACH,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/memo/index.ts"],"names":[],"mappings":"AAAA,qBAAa,IAAI;;IAOhB;;;;;;OAMG;IACH,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,aAAP,CAAC,KAAK,CAAC;CAyB7C"}
|
package/dist/app/memo/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export class Memo {
|
|
|
10
10
|
* @param fn Function to memoize.
|
|
11
11
|
* @returns The memoized function.
|
|
12
12
|
*/
|
|
13
|
-
use
|
|
13
|
+
use(fn) {
|
|
14
14
|
if (this.#memoized.has(fn))
|
|
15
15
|
return this.#memoized.get(fn);
|
|
16
16
|
// closure will GC automatically
|
|
@@ -30,5 +30,5 @@ export class Memo {
|
|
|
30
30
|
};
|
|
31
31
|
this.#memoized.set(fn, memo);
|
|
32
32
|
return memo;
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
34
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export { jsx, toGenerator, toStream, toString, type JSX } from "./jsx/index.js";
|
|
2
2
|
export { Chunk } from "./jsx/chunk/index.js";
|
|
3
3
|
export { Trie, Route } from "./trie/index.js";
|
|
4
|
-
export { App, type Middleware } from "./app/index.js";
|
|
4
|
+
export { App, type Middleware, type Next } from "./app/index.js";
|
|
5
5
|
export { Context } from "./app/context.js";
|
|
6
6
|
export { Get } from "./app/helper/get.js";
|
|
7
7
|
export { Post } from "./app/helper/post.js";
|
|
8
|
-
export { csrf } from "./app/mw/csrf.js";
|
|
9
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,15 @@ export declare class Chunk {
|
|
|
17
17
|
* @param chunks Chunks to append to the end of the chunk
|
|
18
18
|
*/
|
|
19
19
|
concat(...chunks: Chunk[]): void;
|
|
20
|
+
/**
|
|
21
|
+
* Wraps `new Chunk("html", true)`.
|
|
22
|
+
*
|
|
23
|
+
* Use to create a new `Chunk` and bypass escaping.
|
|
24
|
+
*
|
|
25
|
+
* @param html Safe string of HTML
|
|
26
|
+
* @returns New _safe_ `Chunk`
|
|
27
|
+
*/
|
|
28
|
+
static safe(html: unknown): Chunk;
|
|
20
29
|
/**
|
|
21
30
|
* Escapes strings of HTML.
|
|
22
31
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jsx/chunk/index.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;;IAIjB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;gBACS,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO;IAKzC;;OAEG;IACH,QAAQ;IAIR;;OAEG;IACH,MAAM,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE;IAIzB;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CA2B1C"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jsx/chunk/index.ts"],"names":[],"mappings":"AAAA,qBAAa,KAAK;;IAIjB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;OAKG;gBACS,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO;IAKzC;;OAEG;IACH,QAAQ;IAIR;;OAEG;IACH,MAAM,CAAC,GAAG,MAAM,EAAE,KAAK,EAAE;IAIzB;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO;IAIzB;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CA2B1C"}
|
package/dist/jsx/chunk/index.js
CHANGED
|
@@ -25,6 +25,17 @@ export class Chunk {
|
|
|
25
25
|
concat(...chunks) {
|
|
26
26
|
this.value += chunks.join("");
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Wraps `new Chunk("html", true)`.
|
|
30
|
+
*
|
|
31
|
+
* Use to create a new `Chunk` and bypass escaping.
|
|
32
|
+
*
|
|
33
|
+
* @param html Safe string of HTML
|
|
34
|
+
* @returns New _safe_ `Chunk`
|
|
35
|
+
*/
|
|
36
|
+
static safe(html) {
|
|
37
|
+
return new Chunk(html, true);
|
|
38
|
+
}
|
|
28
39
|
/**
|
|
29
40
|
* Escapes strings of HTML.
|
|
30
41
|
*
|
package/dist/jsx/index.d.ts
CHANGED
|
@@ -9,15 +9,16 @@ export declare namespace JSX {
|
|
|
9
9
|
/** ovr Element */
|
|
10
10
|
type Element = MaybeFunction<MaybePromise<string | number | bigint | boolean | object | null | undefined | Symbol | Iterable<Element> | AsyncIterable<Element>>>;
|
|
11
11
|
}
|
|
12
|
-
/** Unknown component props
|
|
12
|
+
/** Unknown component props */
|
|
13
13
|
export type Props = Record<string, JSX.Element>;
|
|
14
14
|
/**
|
|
15
15
|
* The main function of the JSX transform cycle, each time JSX is encountered
|
|
16
|
-
* it is passed into this function to be resolved.
|
|
16
|
+
* it is passed into this function to be resolved. This function doesn't need to be
|
|
17
|
+
* called recursively, JSX will be transformed into these `jsx()` function calls.
|
|
17
18
|
*
|
|
18
19
|
* @param tag string or function component
|
|
19
20
|
* @param props object containing all the properties and attributes passed to the element or component
|
|
20
|
-
* @returns
|
|
21
|
+
* @returns `AsyncGenerator` that yields `Chunk`s of HTML
|
|
21
22
|
*/
|
|
22
23
|
export declare function jsx<P extends Props = Props>(tag: ((props: P) => JSX.Element) | string, props: P): AsyncGenerator<Chunk, void, unknown>;
|
|
23
24
|
/**
|
|
@@ -31,7 +32,7 @@ export declare function Fragment(props?: {
|
|
|
31
32
|
}): AsyncGenerator<Chunk, void, unknown>;
|
|
32
33
|
/**
|
|
33
34
|
* @param element
|
|
34
|
-
* @yields `Chunk`s of HTML as the `Element` resolves
|
|
35
|
+
* @yields `Chunk`s of HTML as the `Element` resolves
|
|
35
36
|
*/
|
|
36
37
|
export declare function toGenerator(element: JSX.Element): AsyncGenerator<Chunk, void, unknown>;
|
|
37
38
|
/**
|
package/dist/jsx/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jsx/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,IAAI,EAAE,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jsx/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,IAAI,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAGvE,wBAAwB;AACxB,yBAAiB,GAAG,CAAC;IACpB,6BAA6B;IAC7B,UAAiB,iBAAkB,SAAQ,EAAE;KAAG;IAEhD,kBAAkB;IAClB,KAAY,OAAO,GAAG,aAAa,CAClC,YAAY,CACT,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,MAAM,GACN,IAAI,GACJ,SAAS,GACT,MAAM,GACN,QAAQ,CAAC,OAAO,CAAC,GACjB,aAAa,CAAC,OAAO,CAAC,CACxB,CACD,CAAC;CACF;AAED,8BAA8B;AAC9B,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AAuBhD;;;;;;;;GAQG;AACH,wBAAuB,GAAG,CAAC,CAAC,SAAS,KAAK,GAAG,KAAK,EACjD,GAAG,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAC,GAAG,MAAM,EACzC,KAAK,EAAE,CAAC,wCAsCR;AAED;;;;;GAKG;AACH,wBAAuB,QAAQ,CAAC,KAAK,GAAE;IAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CAAO,wCAErE;AAED;;;GAGG;AACH,wBAAuB,WAAW,CACjC,OAAO,EAAE,GAAG,CAAC,OAAO,GAClB,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAyEtC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GAAU,SAAS,GAAG,CAAC,OAAO,oBACI,CAAC;AAKxD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,SAAS,GAAG,CAAC,OAAO,gDAwC5C,CAAC"}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Chunk } from "./chunk/index.js";
|
|
2
2
|
import { merge } from "./merge-async-generators.js";
|
|
3
|
-
import { setImmediate } from "node:timers/promises";
|
|
4
3
|
/**
|
|
5
4
|
* These are the HTML tags that do not require a closing tag.
|
|
6
5
|
*
|
|
@@ -23,11 +22,12 @@ const voidElements = new Set([
|
|
|
23
22
|
]);
|
|
24
23
|
/**
|
|
25
24
|
* The main function of the JSX transform cycle, each time JSX is encountered
|
|
26
|
-
* it is passed into this function to be resolved.
|
|
25
|
+
* it is passed into this function to be resolved. This function doesn't need to be
|
|
26
|
+
* called recursively, JSX will be transformed into these `jsx()` function calls.
|
|
27
27
|
*
|
|
28
28
|
* @param tag string or function component
|
|
29
29
|
* @param props object containing all the properties and attributes passed to the element or component
|
|
30
|
-
* @returns
|
|
30
|
+
* @returns `AsyncGenerator` that yields `Chunk`s of HTML
|
|
31
31
|
*/
|
|
32
32
|
export async function* jsx(tag, props) {
|
|
33
33
|
if (typeof tag === "function") {
|
|
@@ -36,10 +36,13 @@ export async function* jsx(tag, props) {
|
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
// intrinsic element
|
|
39
|
-
|
|
39
|
+
// faster to concatenate attributes than to yield them as separate chunks
|
|
40
40
|
let attributes = "";
|
|
41
|
-
for (const key in
|
|
42
|
-
|
|
41
|
+
for (const key in props) {
|
|
42
|
+
// more memory efficient to skip children instead of destructuring and using ...rest
|
|
43
|
+
if (key === "children")
|
|
44
|
+
continue;
|
|
45
|
+
const value = props[key];
|
|
43
46
|
if (value === true) {
|
|
44
47
|
// just put the key without the value
|
|
45
48
|
attributes += ` ${key}`;
|
|
@@ -52,11 +55,13 @@ export async function* jsx(tag, props) {
|
|
|
52
55
|
}
|
|
53
56
|
// otherwise, don't include the attribute
|
|
54
57
|
}
|
|
55
|
-
|
|
58
|
+
if (tag === "html")
|
|
59
|
+
yield Chunk.safe("<!doctype html>");
|
|
60
|
+
yield Chunk.safe(`<${tag}${attributes}>`);
|
|
56
61
|
if (voidElements.has(tag))
|
|
57
62
|
return;
|
|
58
|
-
yield* toGenerator(children);
|
|
59
|
-
yield
|
|
63
|
+
yield* toGenerator(props.children);
|
|
64
|
+
yield Chunk.safe(`</${tag}>`);
|
|
60
65
|
}
|
|
61
66
|
/**
|
|
62
67
|
* JSX requires a `Fragment` export to resolve `<></>`
|
|
@@ -69,7 +74,7 @@ export async function* Fragment(props = {}) {
|
|
|
69
74
|
}
|
|
70
75
|
/**
|
|
71
76
|
* @param element
|
|
72
|
-
* @yields `Chunk`s of HTML as the `Element` resolves
|
|
77
|
+
* @yields `Chunk`s of HTML as the `Element` resolves
|
|
73
78
|
*/
|
|
74
79
|
export async function* toGenerator(element) {
|
|
75
80
|
// modifications
|
|
@@ -90,59 +95,38 @@ export async function* toGenerator(element) {
|
|
|
90
95
|
}
|
|
91
96
|
if (typeof element === "object") {
|
|
92
97
|
if (Symbol.asyncIterator in element) {
|
|
93
|
-
// async iterable - lazily resolve
|
|
98
|
+
// any async iterable - lazily resolve
|
|
94
99
|
for await (const children of element)
|
|
95
100
|
yield* toGenerator(children);
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
98
103
|
if (Symbol.iterator in element) {
|
|
99
104
|
// sync iterable
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
// sync generator
|
|
105
|
-
// process lazily - avoids loading all in memory
|
|
106
|
-
const yieldIterations = 150;
|
|
107
|
-
let yieldCounter = yieldIterations;
|
|
108
|
-
while (true) {
|
|
109
|
-
const result = iterator.next();
|
|
110
|
-
if (result.done)
|
|
111
|
-
break;
|
|
112
|
-
yield* toGenerator(result.value);
|
|
113
|
-
if (--yieldCounter === 0) {
|
|
114
|
-
// yields back to the event loop to send chunks
|
|
115
|
-
// or check if the request has been cancelled
|
|
116
|
-
await setImmediate();
|
|
117
|
-
yieldCounter = yieldIterations;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
105
|
+
if ("next" in element) {
|
|
106
|
+
// sync generator - lazily resolve, avoids loading all in memory
|
|
107
|
+
for (const children of element)
|
|
108
|
+
yield* toGenerator(children);
|
|
120
109
|
return;
|
|
121
110
|
}
|
|
122
111
|
// other iterable - array, set, etc.
|
|
123
112
|
// process children in parallel
|
|
124
|
-
const generators =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
break;
|
|
129
|
-
generators.push(toGenerator(result.value));
|
|
130
|
-
}
|
|
131
|
-
const queue = new Array(generators.length);
|
|
132
|
-
const complete = new Set();
|
|
113
|
+
const generators = Array.from(element, toGenerator);
|
|
114
|
+
const n = generators.length;
|
|
115
|
+
const queue = new Array(n);
|
|
116
|
+
const complete = new Uint8Array(n);
|
|
133
117
|
let current = 0;
|
|
134
118
|
for await (const m of merge(generators)) {
|
|
135
119
|
if (m.result.done) {
|
|
136
|
-
complete
|
|
120
|
+
complete[m.index] = 1;
|
|
137
121
|
if (m.index === current) {
|
|
138
|
-
while (++current <
|
|
122
|
+
while (++current < n) {
|
|
139
123
|
if (queue[current]) {
|
|
140
124
|
// yield whatever is in the next queue even if it hasn't completed yet
|
|
141
125
|
yield queue[current];
|
|
142
126
|
queue[current] = null;
|
|
143
127
|
}
|
|
144
128
|
// if it hasn't completed, stop iterating to the next
|
|
145
|
-
if (!complete
|
|
129
|
+
if (!complete[current])
|
|
146
130
|
break;
|
|
147
131
|
}
|
|
148
132
|
}
|
|
@@ -159,7 +143,7 @@ export async function* toGenerator(element) {
|
|
|
159
143
|
}
|
|
160
144
|
}
|
|
161
145
|
// clear the queue
|
|
162
|
-
yield* queue.filter(
|
|
146
|
+
yield* queue.filter((chunk) => chunk !== null);
|
|
163
147
|
return;
|
|
164
148
|
}
|
|
165
149
|
}
|
|
@@ -190,6 +174,10 @@ const encoder = new TextEncoder();
|
|
|
190
174
|
export const toStream = (element) => {
|
|
191
175
|
const gen = toGenerator(element);
|
|
192
176
|
return new ReadableStream({
|
|
177
|
+
// enables zero-copy transfer from underlying source when queue is empty
|
|
178
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_byte_streams#overview
|
|
179
|
+
type: "bytes",
|
|
180
|
+
// `pull` ensures backpressure and cancelled requests stop the generator
|
|
193
181
|
async pull(c) {
|
|
194
182
|
const result = await gen.next();
|
|
195
183
|
if (result.done) {
|
|
@@ -198,12 +186,22 @@ export const toStream = (element) => {
|
|
|
198
186
|
return;
|
|
199
187
|
}
|
|
200
188
|
c.enqueue(
|
|
201
|
-
// need to encode for Node
|
|
189
|
+
// need to encode for Node (ex: during prerendering) or it will error
|
|
190
|
+
// doesn't seem to be needed for browsers
|
|
202
191
|
// faster than piping through a `TextEncoderStream`
|
|
203
192
|
encoder.encode(result.value.value));
|
|
204
193
|
},
|
|
205
194
|
cancel() {
|
|
206
195
|
gen.return();
|
|
207
196
|
},
|
|
197
|
+
}, {
|
|
198
|
+
// `highWaterMark` defaults to 1
|
|
199
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/ReadableStream#highwatermark
|
|
200
|
+
// setting this ensures at least a small buffer is maintained if the
|
|
201
|
+
// underlying server does not have its own high water mark set
|
|
202
|
+
// https://blog.cloudflare.com/unpacking-cloudflare-workers-cpu-performance-benchmarks/#inefficient-streams-adapters
|
|
203
|
+
// in Node, the default is 16kb, so this stacks another 2kb in front
|
|
204
|
+
// https://nodejs.org/api/http.html#outgoingmessagewritablehighwatermark
|
|
205
|
+
highWaterMark: 2048,
|
|
208
206
|
});
|
|
209
207
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-async-generators.d.ts","sourceRoot":"","sources":["../../src/jsx/merge-async-generators.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAuB,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;;;
|
|
1
|
+
{"version":3,"file":"merge-async-generators.d.ts","sourceRoot":"","sources":["../../src/jsx/merge-async-generators.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAuB,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;;;kBAgCpE"}
|
|
@@ -14,7 +14,9 @@ const next = async (iterator, index) => ({
|
|
|
14
14
|
export async function* merge(generators) {
|
|
15
15
|
const iterators = generators.map((gen) => gen[Symbol.asyncIterator]());
|
|
16
16
|
const promises = new Map();
|
|
17
|
-
|
|
17
|
+
for (let i = 0; i < iterators.length; i++) {
|
|
18
|
+
promises.set(i, next(iterators[i], i));
|
|
19
|
+
}
|
|
18
20
|
let current;
|
|
19
21
|
try {
|
|
20
22
|
while (promises.size > 0) {
|
|
@@ -29,8 +31,12 @@ export async function* merge(generators) {
|
|
|
29
31
|
}
|
|
30
32
|
finally {
|
|
31
33
|
for (const iterator of iterators) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
try {
|
|
35
|
+
iterator.return();
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// could have already returned
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
}
|
package/dist/trie/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export declare class Route<Store> {
|
|
|
4
4
|
pattern: string;
|
|
5
5
|
/** Store returned when route is found */
|
|
6
6
|
store: Store;
|
|
7
|
+
/**
|
|
8
|
+
* @param pattern route pattern
|
|
9
|
+
* @param store value to store in the patterns final node
|
|
10
|
+
*/
|
|
7
11
|
constructor(pattern: string, store: Store);
|
|
8
12
|
}
|
|
9
13
|
declare class ParamNode<Store> {
|
|
@@ -16,6 +20,7 @@ declare class ParamNode<Store> {
|
|
|
16
20
|
constructor(name: string);
|
|
17
21
|
}
|
|
18
22
|
export declare class Trie<Store> {
|
|
23
|
+
#private;
|
|
19
24
|
/** Unique segment of the pattern trie */
|
|
20
25
|
segment: string;
|
|
21
26
|
/** Static child node map, key is the first character in the segment */
|
package/dist/trie/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trie/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5C,qBAAa,KAAK,CAAC,KAAK;IACvB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,yCAAyC;IACzC,KAAK,EAAE,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/trie/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE5C,qBAAa,KAAK,CAAC,KAAK;IACvB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAEhB,yCAAyC;IACzC,KAAK,EAAE,KAAK,CAAC;IAEb;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAUzC;AAED,cAAM,SAAS,CAAC,KAAK;IACpB,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IAEb,oBAAoB;IACpB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;IAElC,wBAAwB;IACxB,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;gBAE3B,IAAI,EAAE,MAAM;CAGxB;AAED,qBAAa,IAAI,CAAC,KAAK;;IACtB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAEhB,uEAAuE;IACvE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAQ;IAElD,4BAA4B;IAC5B,UAAU,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;IAE3C,oBAAoB;IACpB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;IAElC,6BAA6B;IAC7B,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,IAAI,CAAQ;IAK1C;;;OAGG;gBACS,OAAO,SAAM,EAAE,cAAc,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;IAYzD;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM;IAWrB;;;;;;;;OAQG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAavC;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM;IAMrB;;;OAGG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM;IAW1B;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IAiHvB;;;OAGG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAgFtE"}
|
package/dist/trie/index.js
CHANGED
|
@@ -3,6 +3,10 @@ export class Route {
|
|
|
3
3
|
pattern;
|
|
4
4
|
/** Store returned when route is found */
|
|
5
5
|
store;
|
|
6
|
+
/**
|
|
7
|
+
* @param pattern route pattern
|
|
8
|
+
* @param store value to store in the patterns final node
|
|
9
|
+
*/
|
|
6
10
|
constructor(pattern, store) {
|
|
7
11
|
if (pattern[0] !== "/") {
|
|
8
12
|
throw new Error(`Invalid route: ${pattern} - route pattern must begin with "/"`);
|
|
@@ -33,6 +37,8 @@ export class Trie {
|
|
|
33
37
|
route = null;
|
|
34
38
|
/** Matched wildcard route */
|
|
35
39
|
wildcardRoute = null;
|
|
40
|
+
static #paramMatch = /:.+?(?=\/|$)/g;
|
|
41
|
+
static #paramSplit = /:.+?(?=\/|$)/;
|
|
36
42
|
/**
|
|
37
43
|
* @param segment pattern segment
|
|
38
44
|
* @param staticChildren static children nodes to add to staticMap
|
|
@@ -107,8 +113,8 @@ export class Trie {
|
|
|
107
113
|
const endsWithWildcard = pattern.endsWith("*");
|
|
108
114
|
if (endsWithWildcard)
|
|
109
115
|
pattern = pattern.slice(0, -1);
|
|
110
|
-
const paramSegments = pattern.match(
|
|
111
|
-
const staticSegments = pattern.split(
|
|
116
|
+
const paramSegments = pattern.match(Trie.#paramMatch) ?? [];
|
|
117
|
+
const staticSegments = pattern.split(Trie.#paramSplit);
|
|
112
118
|
// if the last segment is a param without a trailing slash
|
|
113
119
|
// then there will be an empty string, remove
|
|
114
120
|
if (staticSegments.at(-1) === "")
|