ovr 4.6.0 → 6.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/LICENSE.md +26 -0
- package/dist/app/index.d.ts +55 -103
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +67 -145
- 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 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -7
- 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 +37 -52
- package/dist/jsx/index.d.ts.map +1 -1
- package/dist/jsx/index.js +71 -197
- 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 +341 -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 +31 -26
- package/dist/trie/index.d.ts.map +1 -1
- package/dist/trie/index.js +71 -80
- package/dist/util/index.d.ts +38 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +88 -0
- package/package.json +4 -4
- package/src/app/index.ts +128 -265
- package/src/context/index.ts +262 -0
- package/src/cookie/index.ts +189 -0
- package/src/index.ts +6 -8
- package/src/jsx/{intrinsic-elements.ts → elements.ts} +14 -7
- package/src/jsx/index.ts +81 -222
- package/src/middleware/index.ts +29 -0
- package/src/multipart/index.ts +486 -0
- package/src/render/index.ts +300 -0
- package/src/route/index.ts +332 -0
- package/src/trie/index.ts +90 -107
- package/src/util/index.ts +112 -0
- package/dist/app/context.d.ts +0 -147
- package/dist/app/context.d.ts.map +0 -1
- package/dist/app/context.js +0 -283
- 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 -55
- package/dist/app/helper/index.d.ts.map +0 -1
- package/dist/app/helper/index.js +0 -96
- 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/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/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 -365
- package/src/app/helper/get.ts +0 -46
- package/src/app/helper/index.ts +0 -174
- package/src/app/helper/post.ts +0 -54
- package/src/app/memo/index.ts +0 -40
- package/src/app/mw/csrf.ts +0 -32
- 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,38 +0,0 @@
|
|
|
1
|
-
export declare class Chunk {
|
|
2
|
-
#private;
|
|
3
|
-
/** Safe value to render */
|
|
4
|
-
value: string;
|
|
5
|
-
/**
|
|
6
|
-
* `Chunk` to send in an HTML stream.
|
|
7
|
-
*
|
|
8
|
-
* @param html string of HTML to escape
|
|
9
|
-
* @param safe Set to `true` if the HTML is safe and should not be escaped
|
|
10
|
-
*/
|
|
11
|
-
constructor(html: unknown, safe?: boolean);
|
|
12
|
-
/**
|
|
13
|
-
* @returns `value`
|
|
14
|
-
*/
|
|
15
|
-
toString(): string;
|
|
16
|
-
/**
|
|
17
|
-
* @param chunks Chunks to append to the end of the chunk
|
|
18
|
-
*/
|
|
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;
|
|
29
|
-
/**
|
|
30
|
-
* Escapes strings of HTML.
|
|
31
|
-
*
|
|
32
|
-
* @param html String to escape
|
|
33
|
-
* @param attr Set to `true` if the value is an attribute, otherwise it's a string of HTML content
|
|
34
|
-
* @returns Escaped string of HTML
|
|
35
|
-
*/
|
|
36
|
-
static escape(html: string, attr?: boolean): string;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export class Chunk {
|
|
2
|
-
static #attr = /[&"<]/g;
|
|
3
|
-
static #content = /[&<]/g;
|
|
4
|
-
/** Safe value to render */
|
|
5
|
-
value;
|
|
6
|
-
/**
|
|
7
|
-
* `Chunk` to send in an HTML stream.
|
|
8
|
-
*
|
|
9
|
-
* @param html string of HTML to escape
|
|
10
|
-
* @param safe Set to `true` if the HTML is safe and should not be escaped
|
|
11
|
-
*/
|
|
12
|
-
constructor(html, safe) {
|
|
13
|
-
const value = String(html ?? "");
|
|
14
|
-
this.value = safe ? value : Chunk.escape(value);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @returns `value`
|
|
18
|
-
*/
|
|
19
|
-
toString() {
|
|
20
|
-
return this.value;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @param chunks Chunks to append to the end of the chunk
|
|
24
|
-
*/
|
|
25
|
-
concat(...chunks) {
|
|
26
|
-
this.value += chunks.join("");
|
|
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
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Escapes strings of HTML.
|
|
41
|
-
*
|
|
42
|
-
* @param html String to escape
|
|
43
|
-
* @param attr Set to `true` if the value is an attribute, otherwise it's a string of HTML content
|
|
44
|
-
* @returns Escaped string of HTML
|
|
45
|
-
*/
|
|
46
|
-
static escape(html, attr) {
|
|
47
|
-
// adapted from https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/escaping.js
|
|
48
|
-
const regex = attr ? Chunk.#attr : Chunk.#content;
|
|
49
|
-
// search starts at beginning of the string
|
|
50
|
-
regex.lastIndex = 0;
|
|
51
|
-
// tracks the position of the last successful match in the input string
|
|
52
|
-
let start = 0;
|
|
53
|
-
let result = "";
|
|
54
|
-
// since `g` flag is used, regex maintains state with each loop,
|
|
55
|
-
// checking from the lastIndex onward each time
|
|
56
|
-
while (regex.test(html)) {
|
|
57
|
-
// index of the match
|
|
58
|
-
const i = regex.lastIndex - 1;
|
|
59
|
-
const match = html[i];
|
|
60
|
-
result +=
|
|
61
|
-
// everything that didn't match during this test
|
|
62
|
-
html.slice(start, i) +
|
|
63
|
-
// replacement
|
|
64
|
-
(match === "&" ? "&" : match === '"' ? """ : "<");
|
|
65
|
-
start = regex.lastIndex;
|
|
66
|
-
}
|
|
67
|
-
return result + html.slice(start);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -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,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAG7C,KAAK,UAAU,CACd,CAAC,SAAS,KAAK,GAAG,KAAK,EACvB,QAAQ,GAAG,GAAG,CAAC,OAAO,IACnB,OAAO,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,IAAI,GAAG,KAAK,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;IACpE,WAAW,EAAE,IAAI,GAAG,KAAK,CAAC;IAC1B,SAA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;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,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7C,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AAE9C,MAAM,MAAM,aAAa,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,IACxD,OAAO,SAAS,GAAG,MAAM,MAAM,IAAI,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,GAC3D;KAAG,CAAC,IAAI,KAAK,GAAG,MAAM,aAAa,CAAC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* 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,365 +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 {
|
|
6
|
-
App,
|
|
7
|
-
type ErrorHandler,
|
|
8
|
-
type Middleware,
|
|
9
|
-
type NotFoundHandler,
|
|
10
|
-
type TrailingSlash,
|
|
11
|
-
} from "./index.js";
|
|
12
|
-
import { Memo } from "./memo/index.js";
|
|
13
|
-
|
|
14
|
-
type Layout = (props: { children: JSX.Element }) => JSX.Element;
|
|
15
|
-
|
|
16
|
-
class TagNotFound extends Error {
|
|
17
|
-
override name = "TagNotFound";
|
|
18
|
-
constructor(tag: string) {
|
|
19
|
-
super(`No closing ${tag} tag found`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
class ResponseFinalized extends Error {
|
|
24
|
-
override name = "ResponseFinalized";
|
|
25
|
-
constructor(property: string) {
|
|
26
|
-
super(
|
|
27
|
-
`Cannot set \`${property}\` after the \`Response\` has been finalized. ` +
|
|
28
|
-
`This can occur if \`${property}\` is set within a component since ` +
|
|
29
|
-
"components are evaluated during streaming.",
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export class Context<P extends Params = Params> {
|
|
35
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Request) */
|
|
36
|
-
req: Request;
|
|
37
|
-
|
|
38
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/URL) */
|
|
39
|
-
url: URL;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Route pattern parameters
|
|
43
|
-
*
|
|
44
|
-
* Given the route pattern `/posts/:slug` is added, a request made to
|
|
45
|
-
* `/posts/my-post` creates a `params` object `{ slug: "my-post" }`.
|
|
46
|
-
*
|
|
47
|
-
* @example { slug: "my-post" }
|
|
48
|
-
*/
|
|
49
|
-
params!: P; // set after match
|
|
50
|
-
|
|
51
|
-
/** The matched `Route` instance. */
|
|
52
|
-
route!: Route<Middleware<P>[]>; // set after match
|
|
53
|
-
|
|
54
|
-
#body: BodyInit | null = null;
|
|
55
|
-
|
|
56
|
-
#status?: number;
|
|
57
|
-
|
|
58
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers) */
|
|
59
|
-
headers = new Headers();
|
|
60
|
-
|
|
61
|
-
#layouts: Layout[] = [];
|
|
62
|
-
|
|
63
|
-
#headElements: JSX.Element[] = [];
|
|
64
|
-
|
|
65
|
-
#trailingSlash: TrailingSlash;
|
|
66
|
-
|
|
67
|
-
#base: string;
|
|
68
|
-
|
|
69
|
-
/** Passed from `app.error` */
|
|
70
|
-
error: ErrorHandler<P>;
|
|
71
|
-
|
|
72
|
-
/** Passed from `app.notFound` */
|
|
73
|
-
notFound: NotFoundHandler<P>;
|
|
74
|
-
|
|
75
|
-
/** `Memo` unique to the current `Request` context */
|
|
76
|
-
#memo = new Memo();
|
|
77
|
-
|
|
78
|
-
memo = this.#memo.use;
|
|
79
|
-
|
|
80
|
-
/** Check if the `Response` has been built already */
|
|
81
|
-
#finalized = false;
|
|
82
|
-
|
|
83
|
-
static readonly #contentType = "content-type";
|
|
84
|
-
static readonly #headClose = "</head>";
|
|
85
|
-
static readonly #bodyClose = "</body>";
|
|
86
|
-
|
|
87
|
-
constructor(
|
|
88
|
-
req: Request,
|
|
89
|
-
url: URL,
|
|
90
|
-
trailingSlash: TrailingSlash,
|
|
91
|
-
base: string,
|
|
92
|
-
error: ErrorHandler<P>,
|
|
93
|
-
notFound: NotFoundHandler<P>,
|
|
94
|
-
) {
|
|
95
|
-
this.req = req;
|
|
96
|
-
this.url = url;
|
|
97
|
-
this.#trailingSlash = trailingSlash;
|
|
98
|
-
this.#base = base;
|
|
99
|
-
this.error = error;
|
|
100
|
-
this.notFound = notFound;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) */
|
|
104
|
-
get status() {
|
|
105
|
-
return this.#status;
|
|
106
|
-
}
|
|
107
|
-
set status(status) {
|
|
108
|
-
if (this.#finalized) throw new ResponseFinalized("status");
|
|
109
|
-
this.#status = status;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#body) */
|
|
113
|
-
get body() {
|
|
114
|
-
return this.#body;
|
|
115
|
-
}
|
|
116
|
-
set body(body) {
|
|
117
|
-
if (this.#finalized) throw new ResponseFinalized("body");
|
|
118
|
-
this.#body = body;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** Passed from `app.base` */
|
|
122
|
-
get base() {
|
|
123
|
-
return this.#base;
|
|
124
|
-
}
|
|
125
|
-
set base(base) {
|
|
126
|
-
if (this.#finalized) throw new ResponseFinalized("base");
|
|
127
|
-
this.#base = base;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Mirrors `new Response()` constructor, set values with one function.
|
|
132
|
-
*
|
|
133
|
-
* @param body Response BodyInit
|
|
134
|
-
* @param init Enhanced ResponseInit
|
|
135
|
-
*/
|
|
136
|
-
res(
|
|
137
|
-
body: BodyInit | null,
|
|
138
|
-
init?: {
|
|
139
|
-
/**
|
|
140
|
-
* [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
141
|
-
*
|
|
142
|
-
* @default 200
|
|
143
|
-
*/
|
|
144
|
-
status?: number;
|
|
145
|
-
|
|
146
|
-
/** [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers) */
|
|
147
|
-
headers?: HeadersInit;
|
|
148
|
-
},
|
|
149
|
-
) {
|
|
150
|
-
this.body = body;
|
|
151
|
-
this.status = init?.status ?? 200;
|
|
152
|
-
|
|
153
|
-
if (init?.headers) {
|
|
154
|
-
for (const [name, value] of new Headers(init.headers)) {
|
|
155
|
-
this.headers.set(name, value);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Creates an HTML response.
|
|
162
|
-
*
|
|
163
|
-
* @param body HTML body
|
|
164
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
165
|
-
*/
|
|
166
|
-
html(body: BodyInit | null, status?: number) {
|
|
167
|
-
this.res(body, {
|
|
168
|
-
status,
|
|
169
|
-
headers: { [Context.#contentType]: "text/html; charset=utf-8" },
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Creates a JSON response.
|
|
175
|
-
*
|
|
176
|
-
* @param data passed into JSON.stringify to create the body
|
|
177
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
178
|
-
*/
|
|
179
|
-
json(data: any, status?: number) {
|
|
180
|
-
this.res(JSON.stringify(data), {
|
|
181
|
-
status,
|
|
182
|
-
headers: { [Context.#contentType]: "application/json" },
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Creates a plain text response.
|
|
188
|
-
*
|
|
189
|
-
* @param body response body
|
|
190
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
191
|
-
*/
|
|
192
|
-
text(body: BodyInit, status?: number) {
|
|
193
|
-
this.res(body, {
|
|
194
|
-
status,
|
|
195
|
-
headers: { [Context.#contentType]: "text/plain; charset=utf-8" },
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Creates a redirect response.
|
|
201
|
-
*
|
|
202
|
-
* @param location redirect `Location` header
|
|
203
|
-
* @param status HTTP status code
|
|
204
|
-
*
|
|
205
|
-
* - [301 Moved Permanently](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/301)
|
|
206
|
-
* - [302 Found](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302) (default)
|
|
207
|
-
* - [303 See Other](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/303)
|
|
208
|
-
* - [307 Temporary Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/307)
|
|
209
|
-
* - [308 Permanent Redirect](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/308)
|
|
210
|
-
*/
|
|
211
|
-
redirect(location: string | URL, status: 301 | 302 | 303 | 307 | 308 = 302) {
|
|
212
|
-
this.headers.set("location", location.toString());
|
|
213
|
-
this.status = status;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @param Element `JSX.Element` to add to the head
|
|
218
|
-
*/
|
|
219
|
-
head(...Element: JSX.Element[]) {
|
|
220
|
-
if (this.#finalized) throw new ResponseFinalized("head");
|
|
221
|
-
this.#headElements.push(...Element);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @param Layout `Layout`(s) for the `Page` to be passed into before being injected into the `<body>`
|
|
226
|
-
*/
|
|
227
|
-
layout(...Layout: Layout[]) {
|
|
228
|
-
if (this.#finalized) throw new ResponseFinalized("layout");
|
|
229
|
-
this.#layouts.push(...Layout);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Creates an HTML response based on the `head` elements, `Layout`(s), and `Page` provided.
|
|
234
|
-
*
|
|
235
|
-
* @param Page `JSX.Element` to inject into the `<body>`
|
|
236
|
-
* @param status [HTTP response status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
|
|
237
|
-
*/
|
|
238
|
-
page(Page: JSX.Element, status?: number) {
|
|
239
|
-
for (let i = this.#layouts.length - 1; i >= 0; i--) {
|
|
240
|
-
Page = this.#layouts[i]!({ children: Page });
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
let stream: ReadableStream<Uint8Array>;
|
|
244
|
-
|
|
245
|
-
if (this.base) {
|
|
246
|
-
// inject into base
|
|
247
|
-
const elements: JSX.Element[] = this.base.split(Context.#headClose);
|
|
248
|
-
if (!elements[1]) throw new TagNotFound(Context.#headClose);
|
|
249
|
-
|
|
250
|
-
elements.splice(1, 0, this.#headElements, Context.#headClose);
|
|
251
|
-
|
|
252
|
-
const bodyParts = (elements[3] as string).split(Context.#bodyClose);
|
|
253
|
-
if (!bodyParts[1]) throw new TagNotFound(Context.#bodyClose);
|
|
254
|
-
|
|
255
|
-
const userAgent = this.req.headers.get("user-agent");
|
|
256
|
-
if (userAgent?.includes("Safari") && !userAgent.includes("Chrome")) {
|
|
257
|
-
// https://bugs.webkit.org/show_bug.cgi?id=252413
|
|
258
|
-
// https://github.com/sveltejs/kit/issues/10315
|
|
259
|
-
// https://github.com/remix-run/remix/issues/5804
|
|
260
|
-
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>`;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
elements[3] = bodyParts[0];
|
|
264
|
-
elements.push(Page, Context.#bodyClose + bodyParts[1]);
|
|
265
|
-
|
|
266
|
-
stream = toStream(
|
|
267
|
-
elements.map((el) => (typeof el === "string" ? Chunk.safe(el) : el)),
|
|
268
|
-
);
|
|
269
|
-
} else {
|
|
270
|
-
// HTML partial - just use the layouts + page
|
|
271
|
-
stream = toStream(Page);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
this.html(stream, status);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Generates an etag from a hash of the string provided.
|
|
279
|
-
* If the etag matches, sets the response to not modified.
|
|
280
|
-
*
|
|
281
|
-
* [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)
|
|
282
|
-
*
|
|
283
|
-
* @param s string to hash
|
|
284
|
-
* @returns `true` if the etag matches, `false` otherwise
|
|
285
|
-
*/
|
|
286
|
-
etag(s: string) {
|
|
287
|
-
const etag = `"${hash(s)}"`;
|
|
288
|
-
|
|
289
|
-
this.headers.set("etag", etag);
|
|
290
|
-
|
|
291
|
-
if (this.req.headers.get("if-none-match") === etag) {
|
|
292
|
-
this.body = null;
|
|
293
|
-
this.status = 304;
|
|
294
|
-
|
|
295
|
-
return true;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
return false;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* @returns the constructed `Response`
|
|
303
|
-
*/
|
|
304
|
-
build() {
|
|
305
|
-
if (
|
|
306
|
-
(!this.status || this.status === 404) &&
|
|
307
|
-
this.#trailingSlash !== "ignore"
|
|
308
|
-
) {
|
|
309
|
-
const last = this.url.pathname.at(-1);
|
|
310
|
-
|
|
311
|
-
if (this.#trailingSlash === "always" && last !== "/") {
|
|
312
|
-
this.url.pathname += "/";
|
|
313
|
-
this.redirect(this.url, 308);
|
|
314
|
-
} else if (
|
|
315
|
-
this.#trailingSlash === "never" &&
|
|
316
|
-
this.url.pathname !== "/" &&
|
|
317
|
-
last === "/"
|
|
318
|
-
) {
|
|
319
|
-
this.url.pathname = this.url.pathname.slice(0, -1);
|
|
320
|
-
this.redirect(this.url, 308);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if (!this.body && !this.status) this.notFound(this);
|
|
325
|
-
|
|
326
|
-
this.#finalized = true;
|
|
327
|
-
|
|
328
|
-
return new Response(this.body, this);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Call within the scope of a handler to get the current context.
|
|
333
|
-
*
|
|
334
|
-
* @returns Request context
|
|
335
|
-
*
|
|
336
|
-
* @example
|
|
337
|
-
*
|
|
338
|
-
* ```ts
|
|
339
|
-
* import { Context } from "ovr";
|
|
340
|
-
*
|
|
341
|
-
* const app = new Router();
|
|
342
|
-
*
|
|
343
|
-
* const fn = () => {
|
|
344
|
-
* const c = Context.get();
|
|
345
|
-
* // ...
|
|
346
|
-
* }
|
|
347
|
-
*
|
|
348
|
-
* app.get("/", () => {
|
|
349
|
-
* fn(); // OK
|
|
350
|
-
* });
|
|
351
|
-
*
|
|
352
|
-
* fn() // ReferenceError - outside AsyncLocalStorage scope
|
|
353
|
-
* ```
|
|
354
|
-
*/
|
|
355
|
-
static get() {
|
|
356
|
-
const c = App.storage.getStore();
|
|
357
|
-
|
|
358
|
-
if (!c)
|
|
359
|
-
throw new ReferenceError(
|
|
360
|
-
"Context can only be obtained within a handler.",
|
|
361
|
-
);
|
|
362
|
-
|
|
363
|
-
return c;
|
|
364
|
-
}
|
|
365
|
-
}
|