ovr 5.0.0 → 6.0.1
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/LICENSE.md +26 -0
- package/dist/app/index.d.ts +49 -83
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +40 -92
- package/dist/context/index.d.ts +138 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +218 -0
- package/dist/cookie/index.d.ts +121 -0
- package/dist/cookie/index.d.ts.map +1 -0
- package/dist/cookie/index.js +56 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/jsx/{intrinsic-elements.d.ts → elements.d.ts} +14 -7
- package/dist/jsx/elements.d.ts.map +1 -0
- package/dist/jsx/index.d.ts +40 -53
- package/dist/jsx/index.d.ts.map +1 -1
- package/dist/jsx/index.js +71 -200
- package/dist/middleware/index.d.ts +22 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/multipart/index.d.ts +122 -0
- package/dist/multipart/index.d.ts.map +1 -0
- package/dist/multipart/index.js +340 -0
- package/dist/render/index.d.ts +78 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +248 -0
- package/dist/route/index.d.ts +147 -0
- package/dist/route/index.d.ts.map +1 -0
- package/dist/route/index.js +126 -0
- package/dist/trie/index.d.ts +30 -30
- package/dist/trie/index.d.ts.map +1 -1
- package/dist/trie/index.js +67 -82
- package/dist/util/index.d.ts +36 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +87 -0
- package/package.json +3 -3
- package/src/app/index.ts +99 -224
- package/src/context/index.ts +262 -0
- package/src/cookie/index.ts +189 -0
- package/src/index.ts +6 -7
- package/src/jsx/{intrinsic-elements.ts → elements.ts} +14 -7
- package/src/jsx/index.ts +81 -221
- package/src/middleware/index.ts +29 -0
- package/src/multipart/index.ts +485 -0
- package/src/render/index.ts +300 -0
- package/src/route/index.ts +332 -0
- package/src/trie/index.ts +87 -111
- package/src/util/index.ts +109 -0
- package/dist/app/context.d.ts +0 -149
- package/dist/app/context.d.ts.map +0 -1
- package/dist/app/context.js +0 -246
- package/dist/app/helper/get.d.ts +0 -30
- package/dist/app/helper/get.d.ts.map +0 -1
- package/dist/app/helper/get.js +0 -33
- package/dist/app/helper/index.d.ts +0 -51
- package/dist/app/helper/index.d.ts.map +0 -1
- package/dist/app/helper/index.js +0 -82
- package/dist/app/helper/post.d.ts +0 -35
- package/dist/app/helper/post.d.ts.map +0 -1
- package/dist/app/helper/post.js +0 -15
- package/dist/app/memo/index.d.ts +0 -12
- package/dist/app/memo/index.d.ts.map +0 -1
- package/dist/app/memo/index.js +0 -34
- package/dist/jsx/chunk/index.d.ts +0 -38
- package/dist/jsx/chunk/index.d.ts.map +0 -1
- package/dist/jsx/chunk/index.js +0 -69
- package/dist/jsx/intrinsic-elements.d.ts.map +0 -1
- package/dist/jsx/merge-async-generators.d.ts +0 -14
- package/dist/jsx/merge-async-generators.d.ts.map +0 -1
- package/dist/jsx/merge-async-generators.js +0 -42
- package/dist/types/index.d.ts +0 -17
- package/dist/types/index.d.ts.map +0 -1
- package/dist/util/hash.d.ts +0 -11
- package/dist/util/hash.d.ts.map +0 -1
- package/dist/util/hash.js +0 -16
- package/src/app/context.ts +0 -303
- package/src/app/helper/get.ts +0 -46
- package/src/app/helper/index.ts +0 -156
- package/src/app/helper/post.ts +0 -54
- package/src/app/memo/index.ts +0 -40
- package/src/jsx/chunk/index.ts +0 -79
- package/src/jsx/merge-async-generators.ts +0 -47
- package/src/types/index.ts +0 -42
- package/src/util/hash.ts +0 -17
- /package/dist/jsx/{intrinsic-elements.js → elements.js} +0 -0
- /package/dist/{types → middleware}/index.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intrinsic-elements.d.ts","sourceRoot":"","sources":["../../src/jsx/intrinsic-elements.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EA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,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,EAAE,EAAE,YAAY,CAAC;IACjB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,UAAU,CAAC;IAClB,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,EAAE,EAAE,UAAU,CAAC;IACf,KAAK,EAAE,eAAe,CAAC;IACvB,CAAC,EAAE,UAAU,CAAC;IACd,EAAE,EAAE,UAAU,CAAC;IACf,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,eAAe,CAAC;IACvB,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;CAClC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merges `AsyncGenerator[]` into a single `AsyncGenerator`, resolving all in parallel.
|
|
3
|
-
* The return of each `AsyncGenerator` is yielded from the generator with `done: true`.
|
|
4
|
-
*
|
|
5
|
-
* Adapted from [stack overflow answers](https://stackoverflow.com/questions/50585456).
|
|
6
|
-
*
|
|
7
|
-
* @param generators Resolved in parallel.
|
|
8
|
-
* @yields `IteratorResult` and `index` of the resolved generator.
|
|
9
|
-
*/
|
|
10
|
-
export declare function merge<T>(generators: AsyncGenerator<T, void>[]): AsyncGenerator<{
|
|
11
|
-
index: number;
|
|
12
|
-
result: IteratorResult<T, void>;
|
|
13
|
-
}, void, unknown>;
|
|
14
|
-
//# sourceMappingURL=merge-async-generators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const next = async (iterator, index) => ({
|
|
2
|
-
index,
|
|
3
|
-
result: await iterator.next(),
|
|
4
|
-
});
|
|
5
|
-
/**
|
|
6
|
-
* Merges `AsyncGenerator[]` into a single `AsyncGenerator`, resolving all in parallel.
|
|
7
|
-
* The return of each `AsyncGenerator` is yielded from the generator with `done: true`.
|
|
8
|
-
*
|
|
9
|
-
* Adapted from [stack overflow answers](https://stackoverflow.com/questions/50585456).
|
|
10
|
-
*
|
|
11
|
-
* @param generators Resolved in parallel.
|
|
12
|
-
* @yields `IteratorResult` and `index` of the resolved generator.
|
|
13
|
-
*/
|
|
14
|
-
export async function* merge(generators) {
|
|
15
|
-
const iterators = generators.map((gen) => gen[Symbol.asyncIterator]());
|
|
16
|
-
const promises = new Map();
|
|
17
|
-
for (let i = 0; i < iterators.length; i++) {
|
|
18
|
-
promises.set(i, next(iterators[i], i));
|
|
19
|
-
}
|
|
20
|
-
let current;
|
|
21
|
-
try {
|
|
22
|
-
while (promises.size > 0) {
|
|
23
|
-
yield (current = await Promise.race(promises.values()));
|
|
24
|
-
if (current.result.done) {
|
|
25
|
-
promises.delete(current.index);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
promises.set(current.index, next(iterators[current.index], current.index));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
finally {
|
|
33
|
-
for (const iterator of iterators) {
|
|
34
|
-
try {
|
|
35
|
-
iterator.return();
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
// could have already returned
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Params } from "../trie/index.js";
|
|
2
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
3
|
-
export type MaybeFunction<T> = T | (() => T);
|
|
4
|
-
export type DeepArray<T> = T | DeepArray<T>[];
|
|
5
|
-
export type ExtractParams<Pattern extends string = string> = Pattern extends `${infer _Start}:${infer Param}/${infer Rest}` ? {
|
|
6
|
-
[k in Param | keyof ExtractParams<Rest>]: string;
|
|
7
|
-
} : Pattern extends `${infer _Start}:${infer Param}` ? {
|
|
8
|
-
[k in Param]: string;
|
|
9
|
-
} : Pattern extends `${infer _Rest}*` ? {
|
|
10
|
-
"*": string;
|
|
11
|
-
} : {};
|
|
12
|
-
export type ExtractMultiParams<Patterns extends string[]> = Patterns extends [
|
|
13
|
-
infer First extends string,
|
|
14
|
-
...infer Rest extends string[]
|
|
15
|
-
] ? Rest["length"] extends 0 ? ExtractParams<First> : ExtractParams<First> | ExtractMultiParams<Rest> : never;
|
|
16
|
-
export type InsertParams<Pattern extends string, P extends Params> = Pattern extends `${infer Start}:${infer Param}/${infer Rest}` ? Param extends keyof P ? `${Start}${P[Param]}/${InsertParams<Rest, P>}` : Pattern : Pattern extends `${infer Start}:${infer Param}` ? Param extends keyof P ? `${Start}${P[Param]}` : Pattern : Pattern extends `${infer Start}*` ? "*" extends keyof P ? `${Start}${P["*"]}` : Pattern : Pattern;
|
|
17
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7C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M,KAAK,IAAI,MAAM,KAAK,EAAE,GAC9C,KAAK,SAAS,MAAM,CAAC,GACpB,GAAG,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,GACrB,OAAO,GACR,OAAO,SAAS,GAAG,MAAM,KAAK,GAAG,GAChC,GAAG,SAAS,MAAM,CAAC,GAClB,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GACnB,OAAO,GACR,OAAO,CAAC"}
|
package/dist/util/hash.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fast hashing algorithm - [djb2](http://www.cse.yorku.ca/~oz/hash.html)
|
|
3
|
-
*
|
|
4
|
-
* Adapted from
|
|
5
|
-
* [SvelteKit](https://github.com/sveltejs/kit/blob/25d459104814b0c2dc6b4cf73b680378a29d8200/packages/kit/src/runtime/hash.js)
|
|
6
|
-
*
|
|
7
|
-
* @param s String to hash
|
|
8
|
-
* @returns Hashed string
|
|
9
|
-
*/
|
|
10
|
-
export declare const hash: (s: string) => string;
|
|
11
|
-
//# sourceMappingURL=hash.d.ts.map
|
package/dist/util/hash.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/util/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,WAO7B,CAAC"}
|
package/dist/util/hash.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fast hashing algorithm - [djb2](http://www.cse.yorku.ca/~oz/hash.html)
|
|
3
|
-
*
|
|
4
|
-
* Adapted from
|
|
5
|
-
* [SvelteKit](https://github.com/sveltejs/kit/blob/25d459104814b0c2dc6b4cf73b680378a29d8200/packages/kit/src/runtime/hash.js)
|
|
6
|
-
*
|
|
7
|
-
* @param s String to hash
|
|
8
|
-
* @returns Hashed string
|
|
9
|
-
*/
|
|
10
|
-
export const hash = (s) => {
|
|
11
|
-
let hash = 5381;
|
|
12
|
-
let i = s.length;
|
|
13
|
-
while (i)
|
|
14
|
-
hash = (hash * 33) ^ s.charCodeAt(--i);
|
|
15
|
-
return (hash >>> 0).toString(36);
|
|
16
|
-
};
|
package/src/app/context.ts
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { Chunk } from "../jsx/chunk/index.js";
|
|
2
|
-
import { type JSX, toStream } from "../jsx/index.js";
|
|
3
|
-
import { type Params, Route } from "../trie/index.js";
|
|
4
|
-
import { hash } from "../util/hash.js";
|
|
5
|
-
import { type Middleware } from "./index.js";
|
|
6
|
-
import { Memo } from "./memo/index.js";
|
|
7
|
-
|
|
8
|
-
type Layout = (props: { children: JSX.Element }) => JSX.Element;
|
|
9
|
-
|
|
10
|
-
class TagNotFound extends Error {
|
|
11
|
-
override name = "TagNotFound";
|
|
12
|
-
|
|
13
|
-
constructor(tag: string) {
|
|
14
|
-
super(`No closing ${tag} tag found`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class Context<P extends Params = Params> {
|
|
19
|
-
/**
|
|
20
|
-
* Incoming `Request` to the server.
|
|
21
|
-
*
|
|
22
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Request)
|
|
23
|
-
*/
|
|
24
|
-
req: Request;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Parsed `URL` created from `req.url`.
|
|
28
|
-
*
|
|
29
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/URL)
|
|
30
|
-
*/
|
|
31
|
-
url: URL;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Route pattern parameters
|
|
35
|
-
*
|
|
36
|
-
* Given the route pattern `/posts/:slug` is added, a request made to
|
|
37
|
-
* `/posts/my-post` creates a `params` object `{ slug: "my-post" }`.
|
|
38
|
-
*
|
|
39
|
-
* @example { slug: "my-post" }
|
|
40
|
-
*/
|
|
41
|
-
params: P = {} as P; // set after match
|
|
42
|
-
|
|
43
|
-
/** Matched `Route` instance. */
|
|
44
|
-
route: Route<Middleware<P>[]> | null = null;
|
|
45
|
-
|
|
46
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#body) */
|
|
47
|
-
body: BodyInit | null = null;
|
|
48
|
-
|
|
49
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) */
|
|
50
|
-
status?: number;
|
|
51
|
-
|
|
52
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers) */
|
|
53
|
-
headers = new Headers();
|
|
54
|
-
|
|
55
|
-
/** `layouts` for the `Page` to be passed into before being injected into the `<body>` */
|
|
56
|
-
layouts: Layout[] = [];
|
|
57
|
-
|
|
58
|
-
/** `JSX.Element`(s) to add to the head */
|
|
59
|
-
head: JSX.Element[] = [];
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Middleware to run when no `body` or `status` has been set on the `context`.
|
|
63
|
-
* Set to a new function to override the default.
|
|
64
|
-
*
|
|
65
|
-
* @default
|
|
66
|
-
*
|
|
67
|
-
* ```ts
|
|
68
|
-
* (c) => {
|
|
69
|
-
* c.text("Not found", 404);
|
|
70
|
-
* c.headers.set("cache-control", "no-cache");
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
notFound: Middleware<P> = (c) => {
|
|
75
|
-
c.text("Not found", 404);
|
|
76
|
-
c.headers.set("cache-control", "no-cache");
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Base HTML to inject the `head` and `page` elements into.
|
|
81
|
-
*
|
|
82
|
-
* If left empty, components will be returned as partials.
|
|
83
|
-
*
|
|
84
|
-
* @default ""
|
|
85
|
-
*/
|
|
86
|
-
base = "";
|
|
87
|
-
|
|
88
|
-
/** `Memo` unique to the current `Request` context */
|
|
89
|
-
memo = new Memo();
|
|
90
|
-
|
|
91
|
-
static readonly #contentType = "content-type";
|
|
92
|
-
static readonly #headClose = "</head>";
|
|
93
|
-
static readonly #bodyClose = "</body>";
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Creates a new `Context` with the current `Request`.
|
|
97
|
-
*
|
|
98
|
-
* @param req Request
|
|
99
|
-
*/
|
|
100
|
-
constructor(req: Request) {
|
|
101
|
-
this.req = req;
|
|
102
|
-
this.url = new URL(req.url);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Mirrors `new Response()` constructor, set values with one function.
|
|
107
|
-
*
|
|
108
|
-
* @param body Response BodyInit
|
|
109
|
-
* @param init ResponseInit
|
|
110
|
-
*/
|
|
111
|
-
res(
|
|
112
|
-
body: BodyInit | null,
|
|
113
|
-
init?: {
|
|
114
|
-
/**
|
|
115
|
-
* [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
116
|
-
*
|
|
117
|
-
* @default 200
|
|
118
|
-
*/
|
|
119
|
-
status?: number;
|
|
120
|
-
|
|
121
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers) */
|
|
122
|
-
headers?: HeadersInit;
|
|
123
|
-
},
|
|
124
|
-
) {
|
|
125
|
-
this.body = body;
|
|
126
|
-
this.status = init?.status ?? 200;
|
|
127
|
-
|
|
128
|
-
if (init?.headers) {
|
|
129
|
-
for (const [name, value] of new Headers(init.headers)) {
|
|
130
|
-
this.headers.set(name, value);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Creates an HTML response.
|
|
137
|
-
*
|
|
138
|
-
* @param body HTML body
|
|
139
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
140
|
-
*/
|
|
141
|
-
html(body: BodyInit | null, status?: number) {
|
|
142
|
-
this.res(body, {
|
|
143
|
-
status,
|
|
144
|
-
headers: { [Context.#contentType]: "text/html; charset=utf-8" },
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Creates a JSON response.
|
|
150
|
-
*
|
|
151
|
-
* @param data passed into JSON.stringify to create the body
|
|
152
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
153
|
-
*/
|
|
154
|
-
json(data: any, status?: number) {
|
|
155
|
-
this.res(JSON.stringify(data), {
|
|
156
|
-
status,
|
|
157
|
-
headers: { [Context.#contentType]: "application/json" },
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Creates a plain text response.
|
|
163
|
-
*
|
|
164
|
-
* @param body response body
|
|
165
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
166
|
-
*/
|
|
167
|
-
text(body: BodyInit, status?: number) {
|
|
168
|
-
this.res(body, {
|
|
169
|
-
status,
|
|
170
|
-
headers: { [Context.#contentType]: "text/plain; charset=utf-8" },
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Creates a redirect response.
|
|
176
|
-
*
|
|
177
|
-
* @param location redirect `Location` header
|
|
178
|
-
* @param status HTTP status code
|
|
179
|
-
*
|
|
180
|
-
* - [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301)
|
|
181
|
-
* - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) (default)
|
|
182
|
-
* - [303 See Other](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/303)
|
|
183
|
-
* - [307 Temporary Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307)
|
|
184
|
-
* - [308 Permanent Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308)
|
|
185
|
-
*/
|
|
186
|
-
redirect(location: string | URL, status: 301 | 302 | 303 | 307 | 308 = 302) {
|
|
187
|
-
this.res(null, { status, headers: { location: location.toString() } });
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Creates an HTML response based on the `head` elements, `Layout`(s), and `Page` provided.
|
|
192
|
-
*
|
|
193
|
-
* @param Page `JSX.Element` to inject into the `<body>`
|
|
194
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
195
|
-
*/
|
|
196
|
-
page(Page: JSX.Element, status?: number) {
|
|
197
|
-
for (let i = this.layouts.length - 1; i >= 0; i--) {
|
|
198
|
-
// add layouts around the page in reverse order (1st is the root layout)
|
|
199
|
-
Page = this.layouts[i]!({ children: Page });
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (this.base) {
|
|
203
|
-
// inject into base
|
|
204
|
-
const elements: JSX.Element[] = this.base.split(Context.#headClose);
|
|
205
|
-
if (!elements[1]) throw new TagNotFound(Context.#headClose);
|
|
206
|
-
|
|
207
|
-
elements.splice(1, 0, this.head, Context.#headClose);
|
|
208
|
-
|
|
209
|
-
const bodyParts = (elements[3] as string).split(Context.#bodyClose);
|
|
210
|
-
if (!bodyParts[1]) throw new TagNotFound(Context.#bodyClose);
|
|
211
|
-
|
|
212
|
-
const userAgent = this.req.headers.get("user-agent");
|
|
213
|
-
if (userAgent?.includes("Safari") && !userAgent.includes("Chrome")) {
|
|
214
|
-
// https://bugs.webkit.org/show_bug.cgi?id=252413
|
|
215
|
-
// https://github.com/sveltejs/kit/issues/10315
|
|
216
|
-
// https://github.com/remix-run/remix/issues/5804
|
|
217
|
-
bodyParts[0] += `<div aria-hidden=true style=position:absolute;width:0;height:0;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0>${"\u200b".repeat(200)}</div>`;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
elements[3] = bodyParts[0];
|
|
221
|
-
elements.push(Page, Context.#bodyClose + bodyParts[1]);
|
|
222
|
-
|
|
223
|
-
return this.html(
|
|
224
|
-
toStream(
|
|
225
|
-
elements.map((el) => (typeof el === "string" ? Chunk.safe(el) : el)),
|
|
226
|
-
),
|
|
227
|
-
status,
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// HTML partial - just use the layouts + page
|
|
232
|
-
// head elements are ignored if no base is set
|
|
233
|
-
return this.html(toStream(Page), status);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Generates an etag from a hash of the string provided.
|
|
238
|
-
* If the etag matches, sets the response to not modified.
|
|
239
|
-
*
|
|
240
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)
|
|
241
|
-
*
|
|
242
|
-
* @param s string to hash
|
|
243
|
-
* @returns `true` if the etag matches, `false` otherwise
|
|
244
|
-
*/
|
|
245
|
-
etag(s: string) {
|
|
246
|
-
const etag = `"${hash(s)}"`;
|
|
247
|
-
|
|
248
|
-
this.headers.set("etag", etag);
|
|
249
|
-
|
|
250
|
-
if (this.req.headers.get("if-none-match") === etag) {
|
|
251
|
-
this.body = null;
|
|
252
|
-
this.status = 304;
|
|
253
|
-
|
|
254
|
-
return true;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Modifies the context based on the the return value of middleware.
|
|
262
|
-
*
|
|
263
|
-
* @param value value returned from middleware
|
|
264
|
-
*/
|
|
265
|
-
#resolveReturn(value: unknown) {
|
|
266
|
-
if (value instanceof Response) {
|
|
267
|
-
this.res(value.body, value);
|
|
268
|
-
} else if (value instanceof ReadableStream) {
|
|
269
|
-
this.body = value;
|
|
270
|
-
} else if (value != null) {
|
|
271
|
-
// nullish are not used so `void` will not render empty page
|
|
272
|
-
this.page(value);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Dispatches the stack of `middleware` provided.
|
|
278
|
-
*
|
|
279
|
-
* @param middleware stack to run
|
|
280
|
-
* @param i current middleware index (default `0`)
|
|
281
|
-
*/
|
|
282
|
-
async #run(middleware: Middleware<P>[], i = 0) {
|
|
283
|
-
if (!middleware[i]) return;
|
|
284
|
-
|
|
285
|
-
this.#resolveReturn(
|
|
286
|
-
await middleware[i](this, () => this.#run(middleware, i + 1)),
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Composes a stack of `middleware` into a `Response`.
|
|
292
|
-
*
|
|
293
|
-
* @param middleware stack to compose
|
|
294
|
-
* @returns constructed `Response`
|
|
295
|
-
*/
|
|
296
|
-
async build(middleware: Middleware<P>[]) {
|
|
297
|
-
await this.#run(middleware);
|
|
298
|
-
|
|
299
|
-
if (!this.body && !this.status) this.notFound(this, Promise.resolve);
|
|
300
|
-
|
|
301
|
-
return new Response(this.body, this);
|
|
302
|
-
}
|
|
303
|
-
}
|
package/src/app/helper/get.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { type JSX, jsx } from "../../jsx/index.js";
|
|
2
|
-
import type { ExtractParams } from "../../types/index.js";
|
|
3
|
-
import type { Middleware } from "../index.js";
|
|
4
|
-
import { Helper, type UrlOptions } from "./index.js";
|
|
5
|
-
|
|
6
|
-
export class Get<Pattern extends string = string> extends Helper<Pattern> {
|
|
7
|
-
/** `<a>` component with preset `href` attribute. */
|
|
8
|
-
Anchor: (
|
|
9
|
-
props: JSX.IntrinsicElements["a"] & UrlOptions<ExtractParams<Pattern>>,
|
|
10
|
-
) => JSX.Element;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @param pattern Route pattern
|
|
14
|
-
* @param middleware GET middleware
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
*
|
|
18
|
-
* ```tsx
|
|
19
|
-
* import { Get } from "ovr";
|
|
20
|
-
*
|
|
21
|
-
* const page = new Get("/", () => {
|
|
22
|
-
* return <p>Hello world</p>
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* const Nav = () => {
|
|
26
|
-
* return <page.Anchor>Home</page.Anchor>
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* app.add(page); // register
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
constructor(
|
|
33
|
-
pattern: Pattern,
|
|
34
|
-
...middleware: Middleware<ExtractParams<Pattern>>[]
|
|
35
|
-
) {
|
|
36
|
-
super("GET", pattern, ...middleware);
|
|
37
|
-
|
|
38
|
-
this.Anchor = ({ params, search, hash, ...rest }) =>
|
|
39
|
-
jsx("a", {
|
|
40
|
-
href: this.url({ params, search, hash } as UrlOptions<
|
|
41
|
-
ExtractParams<Pattern>
|
|
42
|
-
>),
|
|
43
|
-
...rest,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
package/src/app/helper/index.ts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { type JSX, jsx } from "../../jsx/index.js";
|
|
2
|
-
import type { Params } from "../../trie/index.js";
|
|
3
|
-
import type { ExtractParams, InsertParams } from "../../types/index.js";
|
|
4
|
-
import type { Middleware } from "../index.js";
|
|
5
|
-
|
|
6
|
-
export type UrlOptions<P extends Params> = {
|
|
7
|
-
/**
|
|
8
|
-
* Passed into `URLSearchParams` constructor to create new params.
|
|
9
|
-
*
|
|
10
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
|
|
11
|
-
*/
|
|
12
|
-
search?:
|
|
13
|
-
| string
|
|
14
|
-
// Iterable is more accurate than the built in string[][] + URLSearchParams
|
|
15
|
-
// https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/2070
|
|
16
|
-
| Iterable<[string, string]>
|
|
17
|
-
| Record<string, string>;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Hash (fragment) of the URL. `"#"` prefix is added if not present.
|
|
21
|
-
*
|
|
22
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash)
|
|
23
|
-
*/
|
|
24
|
-
hash?: string;
|
|
25
|
-
} & (keyof P extends never
|
|
26
|
-
? {
|
|
27
|
-
/** Route pattern does not contain parameters */
|
|
28
|
-
params?: never;
|
|
29
|
-
}
|
|
30
|
-
: {
|
|
31
|
-
/** Route pattern parameters */
|
|
32
|
-
params: P;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export class Helper<Pattern extends string> {
|
|
36
|
-
/** Extracted parameters type for the pattern */
|
|
37
|
-
declare readonly Params: ExtractParams<Pattern>;
|
|
38
|
-
|
|
39
|
-
/** Route pattern */
|
|
40
|
-
pattern: Pattern;
|
|
41
|
-
|
|
42
|
-
/** GET middleware */
|
|
43
|
-
middleware: Middleware<any>[]; // any so you can use other middleware
|
|
44
|
-
|
|
45
|
-
/** `<button>` component with preset `formaction` and `formmethod` attributes. */
|
|
46
|
-
Button: (
|
|
47
|
-
props: JSX.IntrinsicElements["button"] & UrlOptions<ExtractParams<Pattern>>,
|
|
48
|
-
) => JSX.Element;
|
|
49
|
-
|
|
50
|
-
/** `<form>` component with preset `method` and `action` attributes. */
|
|
51
|
-
Form: (
|
|
52
|
-
props: JSX.IntrinsicElements["form"] & UrlOptions<ExtractParams<Pattern>>,
|
|
53
|
-
) => JSX.Element;
|
|
54
|
-
|
|
55
|
-
/** Pattern parts */
|
|
56
|
-
#parts: string[];
|
|
57
|
-
|
|
58
|
-
constructor(
|
|
59
|
-
method: string,
|
|
60
|
-
pattern: Pattern,
|
|
61
|
-
...middleware: Middleware<ExtractParams<Pattern>>[]
|
|
62
|
-
) {
|
|
63
|
-
this.pattern = pattern;
|
|
64
|
-
this.middleware = middleware;
|
|
65
|
-
this.#parts = pattern.split("/");
|
|
66
|
-
|
|
67
|
-
this.Button = ({ params, search, hash, ...rest }) =>
|
|
68
|
-
jsx("button", {
|
|
69
|
-
formaction: this.url({ params, search, hash } as UrlOptions<
|
|
70
|
-
ExtractParams<Pattern>
|
|
71
|
-
>),
|
|
72
|
-
formmethod: method,
|
|
73
|
-
...rest,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
this.Form = ({ params, search, hash, ...rest }) =>
|
|
77
|
-
jsx("form", {
|
|
78
|
-
action: this.url({ params, search, hash } as UrlOptions<
|
|
79
|
-
ExtractParams<Pattern>
|
|
80
|
-
>),
|
|
81
|
-
method,
|
|
82
|
-
...rest,
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Constructs a _relative_ URL for the route.
|
|
88
|
-
*
|
|
89
|
-
* @param [options] Options with type safe parameters
|
|
90
|
-
* @returns `pathname` + `search` + `hash`
|
|
91
|
-
*/
|
|
92
|
-
url(
|
|
93
|
-
...[options]: keyof ExtractParams<Pattern> extends never
|
|
94
|
-
? [UrlOptions<ExtractParams<Pattern>>] | []
|
|
95
|
-
: [UrlOptions<ExtractParams<Pattern>>]
|
|
96
|
-
) {
|
|
97
|
-
const pathname = this.pathname(
|
|
98
|
-
// @ts-expect-error - do not have to pass in {} if no params
|
|
99
|
-
options?.params,
|
|
100
|
-
);
|
|
101
|
-
let search = "";
|
|
102
|
-
let hash = "";
|
|
103
|
-
|
|
104
|
-
if (options?.search) {
|
|
105
|
-
// use the value as the init
|
|
106
|
-
// @ts-expect-error - see above
|
|
107
|
-
search = "?" + new URLSearchParams(options.search);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (options?.hash) {
|
|
111
|
-
// adding # prefix if not present matches the URL setter:
|
|
112
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/URL/hash
|
|
113
|
-
if (options.hash.startsWith("#")) {
|
|
114
|
-
hash = options.hash;
|
|
115
|
-
} else {
|
|
116
|
-
hash = "#" + options.hash;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return pathname + search + hash;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* @param [params] Parameters to insert
|
|
125
|
-
* @returns Resolved `pathname` with params
|
|
126
|
-
*/
|
|
127
|
-
pathname<Params extends ExtractParams<Pattern>>(
|
|
128
|
-
...[params]: keyof Params extends never ? [] : [Params]
|
|
129
|
-
): InsertParams<Pattern, Params> {
|
|
130
|
-
if (!params) return this.pattern as InsertParams<Pattern, Params>;
|
|
131
|
-
|
|
132
|
-
const wild = "*";
|
|
133
|
-
|
|
134
|
-
return this.#parts
|
|
135
|
-
.map((part) => {
|
|
136
|
-
if (part.startsWith(":")) {
|
|
137
|
-
const param = part.slice(1);
|
|
138
|
-
|
|
139
|
-
if (!(param in params))
|
|
140
|
-
throw new Error(`Parameter "${param}" did not match pattern.`);
|
|
141
|
-
|
|
142
|
-
return params[param as keyof typeof params];
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (part === wild) {
|
|
146
|
-
if (!(wild in params))
|
|
147
|
-
throw new Error("No wildcard parameter found.");
|
|
148
|
-
|
|
149
|
-
return params[wild];
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return part;
|
|
153
|
-
})
|
|
154
|
-
.join("/") as InsertParams<Pattern, Params>;
|
|
155
|
-
}
|
|
156
|
-
}
|