brumate 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +68 -2
- package/dist/boot-DN1ZU8Hg.d.ts +37 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +68 -0
- package/dist/cli.js.map +1 -0
- package/dist/client-DwJInP_a.d.ts +279 -0
- package/dist/client-routes-DakuM32C.js +94 -0
- package/dist/client-routes-DakuM32C.js.map +1 -0
- package/dist/context-BG8KCF3v.js +15 -0
- package/dist/context-BG8KCF3v.js.map +1 -0
- package/dist/context-aeo9esY9.d.ts +16 -0
- package/dist/cookies-Av5WFmcf.js +175 -0
- package/dist/cookies-Av5WFmcf.js.map +1 -0
- package/dist/devtools-BKjnHrnv.js +113 -0
- package/dist/devtools-BKjnHrnv.js.map +1 -0
- package/dist/devtools-panel-AWOn0VK2.js +434 -0
- package/dist/devtools-panel-AWOn0VK2.js.map +1 -0
- package/dist/files-BBLPU9JR.js +177 -0
- package/dist/files-BBLPU9JR.js.map +1 -0
- package/dist/html-DEeoepg3.js +152 -0
- package/dist/html-DEeoepg3.js.map +1 -0
- package/dist/html-Du8jY2Cc.d.ts +53 -0
- package/dist/index.d.ts +2088 -0
- package/dist/index.js +707 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect-CRZlO11T.js +6926 -0
- package/dist/inspect-CRZlO11T.js.map +1 -0
- package/dist/loader-Dc9OwY5I.js +101 -0
- package/dist/loader-Dc9OwY5I.js.map +1 -0
- package/dist/navigate-CzLjnoPH.js +422 -0
- package/dist/navigate-CzLjnoPH.js.map +1 -0
- package/dist/produce-BRGHP7e0.js +126 -0
- package/dist/produce-BRGHP7e0.js.map +1 -0
- package/dist/produce-CtZ32UGG.d.ts +60 -0
- package/dist/rpc-9fSqL_YK.js +128 -0
- package/dist/rpc-9fSqL_YK.js.map +1 -0
- package/dist/runtime/client.d.ts +5 -0
- package/dist/runtime/client.js +1345 -0
- package/dist/runtime/client.js.map +1 -0
- package/dist/runtime/context.d.ts +2 -0
- package/dist/runtime/context.js +1 -0
- package/dist/runtime/devtools.d.ts +36 -0
- package/dist/runtime/devtools.js +1 -0
- package/dist/runtime/hot.d.ts +36 -0
- package/dist/runtime/hot.js +44 -0
- package/dist/runtime/hot.js.map +1 -0
- package/dist/runtime/html.d.ts +2 -0
- package/dist/runtime/html.js +1 -0
- package/dist/runtime/loader.d.ts +12 -0
- package/dist/runtime/loader.js +3 -0
- package/dist/runtime/routes.d.ts +21 -0
- package/dist/runtime/routes.js +18 -0
- package/dist/runtime/routes.js.map +1 -0
- package/dist/runtime/server.d.ts +5 -0
- package/dist/runtime/server.js +7 -0
- package/dist/runtime/signals.d.ts +46 -0
- package/dist/runtime/signals.js +74 -0
- package/dist/runtime/signals.js.map +1 -0
- package/dist/runtime/static-loader.d.ts +3 -0
- package/dist/runtime/static-loader.js +1 -0
- package/dist/runtime/testing.d.ts +55 -0
- package/dist/runtime/testing.js +172 -0
- package/dist/runtime/testing.js.map +1 -0
- package/dist/server-BxqjLUnV.d.ts +753 -0
- package/dist/server-DZsgnPKS.js +1615 -0
- package/dist/server-DZsgnPKS.js.map +1 -0
- package/dist/shared-CWYOd0H3.js +40 -0
- package/dist/shared-CWYOd0H3.js.map +1 -0
- package/dist/static-loader-BcFh4ebX.d.ts +11 -0
- package/dist/static-loader-ClNkHZGn.js +185 -0
- package/dist/static-loader-ClNkHZGn.js.map +1 -0
- package/dist/stream-bgNCMcaA.js +280 -0
- package/dist/stream-bgNCMcaA.js.map +1 -0
- package/dist/vite.d.ts +146 -0
- package/dist/vite.js +1397 -0
- package/dist/vite.js.map +1 -0
- package/package.json +122 -3
- package/types.d.ts +41 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
//#region src/runtime/cookies.ts
|
|
2
|
+
/** Reads the cookies of a `cookie` header. */
|
|
3
|
+
function parseCookies(header) {
|
|
4
|
+
const result = {};
|
|
5
|
+
for (const part of (header ?? "").split(";")) {
|
|
6
|
+
const index = part.indexOf("=");
|
|
7
|
+
if (index === -1) continue;
|
|
8
|
+
const name = part.slice(0, index).trim();
|
|
9
|
+
if (name && !(name in result)) {
|
|
10
|
+
const value = part.slice(index + 1).trim();
|
|
11
|
+
try {
|
|
12
|
+
result[name] = decodeURIComponent(value);
|
|
13
|
+
} catch {
|
|
14
|
+
result[name] = value;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
/** Writes a `set-cookie` header value. */
|
|
21
|
+
function serializeCookie(name, value, options = {}) {
|
|
22
|
+
if (!/^[\w!#$%&'*+.^`|~-]+$/.test(name)) throw new Error(`"${name}" is not a valid cookie name`);
|
|
23
|
+
const parts = [`${name}=${encodeURIComponent(value)}`, `Path=${options.path ?? "/"}`];
|
|
24
|
+
if (options.maxAge !== void 0) parts.push(`Max-Age=${Math.floor(options.maxAge)}`);
|
|
25
|
+
if (options.expires) parts.push(`Expires=${options.expires.toUTCString()}`);
|
|
26
|
+
if (options.domain) parts.push(`Domain=${options.domain}`);
|
|
27
|
+
if (options.httpOnly !== false) parts.push("HttpOnly");
|
|
28
|
+
if (options.secure) parts.push("Secure");
|
|
29
|
+
parts.push(`SameSite=${(options.sameSite ?? "lax").replace(/^./, (letter) => letter.toUpperCase())}`);
|
|
30
|
+
return parts.join("; ");
|
|
31
|
+
}
|
|
32
|
+
/** The parsed `cookie` header of each event, with the header it was parsed from. */
|
|
33
|
+
const parsed = /* @__PURE__ */ new WeakMap();
|
|
34
|
+
/** The cookies of the request, with the ones that this request set or deleted. */
|
|
35
|
+
function getCookies(event) {
|
|
36
|
+
const header = event.request.headers.get("cookie");
|
|
37
|
+
let cached = parsed.get(event);
|
|
38
|
+
if (cached?.header !== header) {
|
|
39
|
+
cached = {
|
|
40
|
+
header,
|
|
41
|
+
cookies: parseCookies(header)
|
|
42
|
+
};
|
|
43
|
+
parsed.set(event, cached);
|
|
44
|
+
}
|
|
45
|
+
const result = { ...cached.cookies };
|
|
46
|
+
for (const [name, value] of event.cookies ?? []) if (value === void 0) delete result[name];
|
|
47
|
+
else result[name] = value;
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
/** Sets a cookie on the response of an event. See `RequestEvent.setCookie`. */
|
|
51
|
+
function setCookie(event, name, value, options = {}) {
|
|
52
|
+
const secure = options.secure ?? new URL(event.request.url).protocol === "https:";
|
|
53
|
+
event.headers.append("set-cookie", serializeCookie(name, value, {
|
|
54
|
+
...options,
|
|
55
|
+
secure
|
|
56
|
+
}));
|
|
57
|
+
event.cookies ??= /* @__PURE__ */ new Map();
|
|
58
|
+
event.cookies.set(name, value);
|
|
59
|
+
}
|
|
60
|
+
/** Deletes a cookie. Pass the `path` and `domain` that it was set with, if they were not the defaults. */
|
|
61
|
+
function deleteCookie(event, name, options = {}) {
|
|
62
|
+
setCookie(event, name, "", {
|
|
63
|
+
...options,
|
|
64
|
+
secure: void 0,
|
|
65
|
+
maxAge: 0,
|
|
66
|
+
expires: /* @__PURE__ */ new Date(0)
|
|
67
|
+
});
|
|
68
|
+
event.cookies.set(name, void 0);
|
|
69
|
+
}
|
|
70
|
+
const encoder = new TextEncoder();
|
|
71
|
+
const decoder = new TextDecoder();
|
|
72
|
+
const keys = /* @__PURE__ */ new Map();
|
|
73
|
+
function key(secret) {
|
|
74
|
+
let promise = keys.get(secret);
|
|
75
|
+
if (!promise) {
|
|
76
|
+
promise = crypto.subtle.importKey("raw", encoder.encode(secret), {
|
|
77
|
+
name: "HMAC",
|
|
78
|
+
hash: "SHA-256"
|
|
79
|
+
}, false, ["sign", "verify"]);
|
|
80
|
+
keys.set(secret, promise);
|
|
81
|
+
}
|
|
82
|
+
return promise;
|
|
83
|
+
}
|
|
84
|
+
function toBase64Url(bytes) {
|
|
85
|
+
let text = "";
|
|
86
|
+
for (const byte of bytes) text += String.fromCharCode(byte);
|
|
87
|
+
return btoa(text).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
88
|
+
}
|
|
89
|
+
function fromBase64Url(text) {
|
|
90
|
+
const base64 = text.replace(/-/g, "+").replace(/_/g, "/");
|
|
91
|
+
return Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A session in a signed cookie. The browser can read the data, but cannot
|
|
95
|
+
* change it, so keep secrets out of it: store an ID, and look the rest up
|
|
96
|
+
* on the server.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* export const session = createSession<{ userId: string }>({ secret: process.env.SESSION_SECRET! });
|
|
100
|
+
*
|
|
101
|
+
* async function login(form: FormData) {
|
|
102
|
+
* 'use server';
|
|
103
|
+
* const event = getEvent();
|
|
104
|
+
* await session.set(event, { userId: await checkPassword(form) });
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
function createSession(options) {
|
|
109
|
+
const secrets = Array.isArray(options.secret) ? options.secret : [options.secret];
|
|
110
|
+
if (secrets.length === 0 || secrets.some((secret) => secret.length < 32)) throw new Error("A session secret needs at least 32 characters");
|
|
111
|
+
const name = options.name ?? "session";
|
|
112
|
+
const maxAge = options.maxAge ?? 604800;
|
|
113
|
+
const read = async (event) => {
|
|
114
|
+
const value = getCookies(event)[name];
|
|
115
|
+
const dot = value?.lastIndexOf(".") ?? -1;
|
|
116
|
+
if (!value || dot === -1) return;
|
|
117
|
+
const payload = value.slice(0, dot);
|
|
118
|
+
let signature;
|
|
119
|
+
try {
|
|
120
|
+
signature = fromBase64Url(value.slice(dot + 1));
|
|
121
|
+
} catch {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (!(await Promise.all(secrets.map(async (secret) => crypto.subtle.verify("HMAC", await key(secret), signature, encoder.encode(payload))))).includes(true)) return;
|
|
125
|
+
try {
|
|
126
|
+
const { d: data, e: expires } = JSON.parse(decoder.decode(fromBase64Url(payload)));
|
|
127
|
+
return expires > Date.now() ? data : void 0;
|
|
128
|
+
} catch {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const write = async (event, data) => {
|
|
133
|
+
const payload = toBase64Url(encoder.encode(JSON.stringify({
|
|
134
|
+
d: data,
|
|
135
|
+
e: Date.now() + maxAge * 1e3
|
|
136
|
+
})));
|
|
137
|
+
const value = `${payload}.${toBase64Url(new Uint8Array(await crypto.subtle.sign("HMAC", await key(secrets[0]), encoder.encode(payload))))}`;
|
|
138
|
+
if (value.length > 4e3) throw new Error(`The session is ${value.length} bytes, over the 4000 that a cookie can hold. Store an ID in it instead`);
|
|
139
|
+
setCookie(event, name, value, {
|
|
140
|
+
...options.cookie,
|
|
141
|
+
maxAge
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
get: read,
|
|
146
|
+
set: write,
|
|
147
|
+
async update(event, change) {
|
|
148
|
+
const data = {
|
|
149
|
+
...await read(event),
|
|
150
|
+
...change
|
|
151
|
+
};
|
|
152
|
+
await write(event, data);
|
|
153
|
+
return data;
|
|
154
|
+
},
|
|
155
|
+
clear: (event) => deleteCookie(event, name, {
|
|
156
|
+
path: options.cookie?.path,
|
|
157
|
+
domain: options.cookie?.domain
|
|
158
|
+
})
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The headers of a response for Node's `writeHead`, with each `set-cookie`
|
|
163
|
+
* apart. `Object.fromEntries(headers)` joins them into one, which browsers
|
|
164
|
+
* read as a single cookie.
|
|
165
|
+
*/
|
|
166
|
+
function toNodeHeaders(headers) {
|
|
167
|
+
const result = Object.fromEntries(headers);
|
|
168
|
+
const cookies = headers.getSetCookie();
|
|
169
|
+
if (cookies.length > 0) result["set-cookie"] = cookies;
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
//#endregion
|
|
173
|
+
export { serializeCookie as a, parseCookies as i, deleteCookie as n, setCookie as o, getCookies as r, toNodeHeaders as s, createSession as t };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=cookies-Av5WFmcf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookies-Av5WFmcf.js","names":[],"sources":["../src/runtime/cookies.ts"],"sourcesContent":["// Cookies and sessions, for server functions, rendering, middleware and\n// endpoints. They read the request of a `RequestEvent` and write `set-cookie`\n// headers on its response.\n\nimport type { RequestEvent } from './request.ts';\n\nexport interface CookieOptions {\n /** Seconds until the cookie expires. Without it, the cookie lasts until the browser closes. */\n maxAge?: number;\n expires?: Date;\n /** Defaults to `/`. */\n path?: string;\n domain?: string;\n /** Defaults to true when the request is HTTPS. */\n secure?: boolean;\n /** Keeps the cookie from browser code. Defaults to true. */\n httpOnly?: boolean;\n /** Defaults to `lax`. */\n sameSite?: 'strict' | 'lax' | 'none';\n}\n\n/** Reads the cookies of a `cookie` header. */\nexport function parseCookies(header: string | null): Record<string, string> {\n const result: Record<string, string> = {};\n for (const part of (header ?? '').split(';')) {\n const index = part.indexOf('=');\n if (index === -1) {\n continue;\n }\n const name = part.slice(0, index).trim();\n if (name && !(name in result)) {\n const value = part.slice(index + 1).trim();\n try {\n result[name] = decodeURIComponent(value);\n } catch {\n result[name] = value;\n }\n }\n }\n return result;\n}\n\n/** Writes a `set-cookie` header value. */\nexport function serializeCookie(name: string, value: string, options: CookieOptions = {}): string {\n if (!/^[\\w!#$%&'*+.^`|~-]+$/.test(name)) {\n throw new Error(`\"${name}\" is not a valid cookie name`);\n }\n const parts = [`${name}=${encodeURIComponent(value)}`, `Path=${options.path ?? '/'}`];\n if (options.maxAge !== undefined) {\n parts.push(`Max-Age=${Math.floor(options.maxAge)}`);\n }\n if (options.expires) {\n parts.push(`Expires=${options.expires.toUTCString()}`);\n }\n if (options.domain) {\n parts.push(`Domain=${options.domain}`);\n }\n if (options.httpOnly !== false) {\n parts.push('HttpOnly');\n }\n if (options.secure) {\n parts.push('Secure');\n }\n parts.push(\n `SameSite=${(options.sameSite ?? 'lax').replace(/^./, (letter) => letter.toUpperCase())}`,\n );\n return parts.join('; ');\n}\n\n/** The parsed `cookie` header of each event, with the header it was parsed from. */\nconst parsed = new WeakMap<\n RequestEvent,\n { header: string | null; cookies: Record<string, string> }\n>();\n\n/** The cookies of the request, with the ones that this request set or deleted. */\nexport function getCookies(event: RequestEvent): Record<string, string> {\n const header = event.request.headers.get('cookie');\n let cached = parsed.get(event);\n if (cached?.header !== header) {\n cached = { header, cookies: parseCookies(header) };\n parsed.set(event, cached);\n }\n // A copy, so the caller cannot change the cache.\n const result = { ...cached.cookies };\n for (const [name, value] of event.cookies ?? []) {\n if (value === undefined) {\n delete result[name];\n } else {\n result[name] = value;\n }\n }\n return result;\n}\n\n/** Sets a cookie on the response of an event. See `RequestEvent.setCookie`. */\nexport function setCookie(\n event: RequestEvent,\n name: string,\n value: string,\n options: CookieOptions = {},\n): void {\n const secure = options.secure ?? new URL(event.request.url).protocol === 'https:';\n event.headers.append('set-cookie', serializeCookie(name, value, { ...options, secure }));\n event.cookies ??= new Map();\n event.cookies.set(name, value);\n}\n\n/** Deletes a cookie. Pass the `path` and `domain` that it was set with, if they were not the defaults. */\nexport function deleteCookie(\n event: RequestEvent,\n name: string,\n options: Pick<CookieOptions, 'path' | 'domain'> = {},\n): void {\n // `secure` follows the request, as for a cookie set without it.\n setCookie(event, name, '', { ...options, secure: undefined, maxAge: 0, expires: new Date(0) });\n event.cookies!.set(name, undefined);\n}\n\nexport interface SessionOptions {\n /**\n * Signs the cookie, so a browser cannot change it. Use a random string of\n * at least 32 characters, kept out of the code, such as in an environment\n * variable. A list signs with the first and accepts all, for changing it.\n */\n secret: string | string[];\n /** The name of the cookie. Defaults to `session`. */\n name?: string;\n /** Seconds until the session expires. Defaults to 7 days. */\n maxAge?: number;\n /** Other options of the cookie. */\n cookie?: Omit<CookieOptions, 'maxAge' | 'expires'>;\n}\n\nexport interface Session<T> {\n /** The data of the session, or undefined when there is none, it expired, or its signature does not match. */\n get(event: RequestEvent): Promise<T | undefined>;\n /** Replaces the data of the session, and starts its time again. */\n set(event: RequestEvent, data: T): Promise<void>;\n /** Changes some fields of the data, and returns the new data. */\n update(event: RequestEvent, change: Partial<T>): Promise<T>;\n /** Ends the session. */\n clear(event: RequestEvent): void;\n}\n\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder();\nconst keys = new Map<string, Promise<CryptoKey>>();\n\nfunction key(secret: string): Promise<CryptoKey> {\n let promise = keys.get(secret);\n if (!promise) {\n promise = crypto.subtle.importKey(\n 'raw',\n encoder.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign', 'verify'],\n );\n keys.set(secret, promise);\n }\n return promise;\n}\n\nfunction toBase64Url(bytes: Uint8Array): string {\n let text = '';\n for (const byte of bytes) {\n text += String.fromCharCode(byte);\n }\n return btoa(text).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}\n\nfunction fromBase64Url(text: string): Uint8Array<ArrayBuffer> {\n const base64 = text.replace(/-/g, '+').replace(/_/g, '/');\n return Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));\n}\n\n/**\n * A session in a signed cookie. The browser can read the data, but cannot\n * change it, so keep secrets out of it: store an ID, and look the rest up\n * on the server.\n *\n * ```ts\n * export const session = createSession<{ userId: string }>({ secret: process.env.SESSION_SECRET! });\n *\n * async function login(form: FormData) {\n * 'use server';\n * const event = getEvent();\n * await session.set(event, { userId: await checkPassword(form) });\n * }\n * ```\n */\nexport function createSession<T>(options: SessionOptions): Session<T> {\n const secrets = Array.isArray(options.secret) ? options.secret : [options.secret];\n if (secrets.length === 0 || secrets.some((secret) => secret.length < 32)) {\n throw new Error('A session secret needs at least 32 characters');\n }\n const name = options.name ?? 'session';\n const maxAge = options.maxAge ?? 7 * 24 * 60 * 60;\n\n const read = async (event: RequestEvent): Promise<T | undefined> => {\n const value = getCookies(event)[name];\n const dot = value?.lastIndexOf('.') ?? -1;\n if (!value || dot === -1) {\n return undefined;\n }\n const payload = value.slice(0, dot);\n let signature: Uint8Array<ArrayBuffer>;\n try {\n signature = fromBase64Url(value.slice(dot + 1));\n } catch {\n return undefined;\n }\n // Any of the secrets can have signed it, such as an older one while a secret changes.\n const checks = await Promise.all(\n secrets.map(async (secret) =>\n crypto.subtle.verify('HMAC', await key(secret), signature, encoder.encode(payload)),\n ),\n );\n if (!checks.includes(true)) {\n return undefined;\n }\n try {\n const { d: data, e: expires } = JSON.parse(decoder.decode(fromBase64Url(payload))) as {\n d: T;\n e: number;\n };\n return expires > Date.now() ? data : undefined;\n } catch {\n return undefined;\n }\n };\n\n const write = async (event: RequestEvent, data: T): Promise<void> => {\n const payload = toBase64Url(\n encoder.encode(JSON.stringify({ d: data, e: Date.now() + maxAge * 1000 })),\n );\n const signature = new Uint8Array(\n await crypto.subtle.sign('HMAC', await key(secrets[0]!), encoder.encode(payload)),\n );\n const value = `${payload}.${toBase64Url(signature)}`;\n // Browsers drop cookies over about 4 KB.\n if (value.length > 4000) {\n throw new Error(\n `The session is ${value.length} bytes, over the 4000 that a cookie can hold. Store an ID in it instead`,\n );\n }\n setCookie(event, name, value, { ...options.cookie, maxAge });\n };\n\n return {\n get: read,\n set: write,\n async update(event, change) {\n const data = { ...(await read(event)), ...change } as T;\n await write(event, data);\n return data;\n },\n clear: (event) =>\n deleteCookie(event, name, { path: options.cookie?.path, domain: options.cookie?.domain }),\n };\n}\n\n/**\n * The headers of a response for Node's `writeHead`, with each `set-cookie`\n * apart. `Object.fromEntries(headers)` joins them into one, which browsers\n * read as a single cookie.\n */\nexport function toNodeHeaders(headers: Headers): Record<string, string | string[]> {\n const result: Record<string, string | string[]> = Object.fromEntries(headers);\n const cookies = headers.getSetCookie();\n if (cookies.length > 0) {\n result['set-cookie'] = cookies;\n }\n return result;\n}\n"],"mappings":";;AAsBA,SAAgB,aAAa,QAA+C;CAC1E,MAAM,SAAiC,CAAC;CACxC,KAAK,MAAM,SAAS,UAAU,GAAA,CAAI,MAAM,GAAG,GAAG;EAC5C,M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AO,OAAqB,SAA2B;EACnE,MAAM,UAAU,YACd,QAAQ,OAAO,KAAK,UAAU;GAAE,GAAG;GAAM,GAAG,KAAK,IAAI,IAAI,SAAS;EAAK,CAAC,CAAC,CAC3E;EAIA,MAAM,QAAQ,GAAG,QAAQ,GAAG,YAAY,IAHlB,WACpB,MAAM,OAAO,OAAO,KAAK,QAAQ,MAAM,IAAI,QAAQ,EAAG,GAAG,QAAQ,OAAO,OAAO,CAAC,CAElC,CAAC;EAEjD,IAAI,MAAM,SAAS,KACjB,MAAM,IAAI,MACR,kBAAkB,MAAM,OAAO,wEACjC;EAEF,UAAU,OAAO,MAAM,OAAO;GAAE,GAAG,QAAQ;GAAQ;EAAO,CAAC;CAC7D;CAEA,OAAO;EACL,KAAK;EACL,KAAK;EACL,MAAM,OAAO,OAAO,QAAQ;GAC1B,MAAM,OAAO;IAAE,GAAI,MAAM,KAAK,KAAK;IAAI,GAAG;GAAO;GACjD,MAAM,MAAM,OAAO,IAAI;GACvB,OAAO;EACT;EACA,QAAQ,UACN,aAAa,OAAO,MAAM;GAAE,MAAM,QAAQ,QAAQ;GAAM,QAAQ,QAAQ,QAAQ;EAAO,CAAC;CAC5F;AACF;;;;;;AAOA,SAAgB,cAAc,SAAqD;CACjF,MAAM,SAA4C,OAAO,YAAY,OAAO;CAC5E,MAAM,UAAU,QAAQ,aAAa;CACrC,IAAI,QAAQ,SAAS,GACnB,OAAO,gBAAgB;CAEzB,OAAO;AACT"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
//#region src/runtime/devtools.ts
|
|
2
|
+
const DEVTOOLS = Symbol.for("brumate.devtools");
|
|
3
|
+
const MAX_LOG = 300;
|
|
4
|
+
/** The root scope of a scope, whose `m` names its component. */
|
|
5
|
+
function rootOf(scope) {
|
|
6
|
+
let root = scope;
|
|
7
|
+
while (root.p) root = root.p;
|
|
8
|
+
return root;
|
|
9
|
+
}
|
|
10
|
+
/** A short text for a value in the log. */
|
|
11
|
+
function preview(value) {
|
|
12
|
+
if (typeof value === "string") return JSON.stringify(value.length > 40 ? `${value.slice(0, 40)}…` : value);
|
|
13
|
+
if (typeof value === "function") return "function";
|
|
14
|
+
if (Array.isArray(value)) return `Array(${value.length})`;
|
|
15
|
+
if (value instanceof Element) return `<${value.tagName.toLowerCase()}>`;
|
|
16
|
+
if (value !== null && typeof value === "object") {
|
|
17
|
+
const name = value.constructor?.name;
|
|
18
|
+
return name && name !== "Object" ? name : `{${Object.keys(value).slice(0, 3).join(", ")}}`;
|
|
19
|
+
}
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
/** Listens to the core, and adds the button that opens the panel. */
|
|
23
|
+
function installDevtools(endpoint = "/__brumate/inspect", rpc = "/_brumate") {
|
|
24
|
+
const state = {
|
|
25
|
+
log: [],
|
|
26
|
+
written: /* @__PURE__ */ new Set(),
|
|
27
|
+
endpoint
|
|
28
|
+
};
|
|
29
|
+
const add = (entry) => {
|
|
30
|
+
state.log.push({
|
|
31
|
+
...entry,
|
|
32
|
+
time: performance.now()
|
|
33
|
+
});
|
|
34
|
+
if (state.log.length > MAX_LOG) state.log.splice(0, state.log.length - MAX_LOG);
|
|
35
|
+
state.changed?.();
|
|
36
|
+
};
|
|
37
|
+
globalThis[DEVTOOLS] = {
|
|
38
|
+
attach(core) {
|
|
39
|
+
state.scopes = core.scopes;
|
|
40
|
+
state.set = core.set;
|
|
41
|
+
state.changed?.();
|
|
42
|
+
},
|
|
43
|
+
handler(ref, element, event) {
|
|
44
|
+
add({
|
|
45
|
+
kind: "handler",
|
|
46
|
+
text: `${event?.type ?? "call"} on <${element.tagName.toLowerCase()}>: ${ref}`
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
part(component, name) {
|
|
50
|
+
add({
|
|
51
|
+
kind: "part",
|
|
52
|
+
text: `loaded ${component} ${name}`
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
write(scope, slot, value) {
|
|
56
|
+
state.written.add(scope.id);
|
|
57
|
+
const root = rootOf(scope);
|
|
58
|
+
add({
|
|
59
|
+
kind: "write",
|
|
60
|
+
text: `scope ${scope.id} slot ${slot} = ${preview(value)}`,
|
|
61
|
+
scope: scope.id,
|
|
62
|
+
write: {
|
|
63
|
+
component: root.m ?? "",
|
|
64
|
+
k: scope.k,
|
|
65
|
+
slot
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const original = globalThis.fetch.bind(globalThis);
|
|
71
|
+
globalThis.fetch = async (input, init) => {
|
|
72
|
+
const url = new URL(input instanceof Request ? input.url : String(input), location.href);
|
|
73
|
+
if (url.origin !== location.origin || !url.pathname.startsWith(`${rpc}/`)) return original(input, init);
|
|
74
|
+
const name = decodeURIComponent(url.pathname.slice(rpc.length + 1));
|
|
75
|
+
const started = performance.now();
|
|
76
|
+
try {
|
|
77
|
+
const response = await original(input, init);
|
|
78
|
+
const took = Math.round(performance.now() - started);
|
|
79
|
+
const redirect = response.headers.get("x-brumate-redirect");
|
|
80
|
+
add({
|
|
81
|
+
kind: "call",
|
|
82
|
+
text: `${name}: ${redirect ? `redirect to ${redirect}` : response.status} in ${took} ms`
|
|
83
|
+
});
|
|
84
|
+
return response;
|
|
85
|
+
} catch (error) {
|
|
86
|
+
add({
|
|
87
|
+
kind: "call",
|
|
88
|
+
text: `${name}: failed, ${error instanceof Error ? error.message : String(error)}`
|
|
89
|
+
});
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const host = document.createElement("brumate-devtools");
|
|
94
|
+
const root = host.attachShadow({ mode: "open" });
|
|
95
|
+
const button = document.createElement("button");
|
|
96
|
+
button.textContent = "brm";
|
|
97
|
+
button.title = "Open the brumate devtools";
|
|
98
|
+
button.setAttribute("style", "position:fixed;right:12px;bottom:12px;z-index:2147483647;font:600 12px ui-monospace,monospace;padding:6px 10px;border-radius:999px;border:1px solid #8884;background:#111;color:#fff;cursor:pointer");
|
|
99
|
+
button.addEventListener("click", () => {
|
|
100
|
+
import("./devtools-panel-AWOn0VK2.js").then(({ togglePanel }) => togglePanel(root, state));
|
|
101
|
+
});
|
|
102
|
+
root.append(button);
|
|
103
|
+
const append = () => {
|
|
104
|
+
document.documentElement.append(host);
|
|
105
|
+
};
|
|
106
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", append);
|
|
107
|
+
else append();
|
|
108
|
+
return state;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { preview as n, rootOf as r, installDevtools as t };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=devtools-BKjnHrnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools-BKjnHrnv.js","names":[],"sources":["../src/runtime/devtools.ts"],"sourcesContent":["// The devtools overlay of development builds. This module only listens to\n// the core and shows a button. The panel loads when the button is pressed,\n// so the page behaves as in production until then.\n\nimport type { DevtoolsHooks, Scope } from './client.ts';\n\n// The same key as the core's, without importing the core.\nconst DEVTOOLS = Symbol.for('brumate.devtools');\n\n/** Something that happened on the page, for the log of the panel. */\nexport interface DevtoolsEntry {\n time: number;\n kind: 'handler' | 'part' | 'write' | 'call';\n text: string;\n /** The scope of a write, so the panel can mark it. */\n scope?: number;\n /** For a write: the component, the scope in the compiled component, and the slot. */\n write?: { component: string; k: number; slot: number };\n}\n\nexport interface DevtoolsState {\n scopes?: Map<number, Scope>;\n /** Writes a slot, as a handler does, so the page updates. */\n set?: (scope: Scope, slot: number, value: unknown) => void;\n log: DevtoolsEntry[];\n /** The scopes written since the panel last drew, by scope ID. */\n written: Set<number>;\n /** The URL prefix of the inspect endpoint of the dev server. */\n endpoint: string;\n /** Called after each change, while the panel is open. */\n changed?: () => void;\n}\n\nconst MAX_LOG = 300;\n\n/** The root scope of a scope, whose `m` names its component. */\nexport function rootOf(scope: Scope): Scope {\n let root = scope;\n while (root.p) {\n root = root.p;\n }\n return root;\n}\n\n/** A short text for a value in the log. */\nexport function preview(value: unknown): string {\n if (typeof value === 'string') {\n return JSON.stringify(value.length > 40 ? `${value.slice(0, 40)}…` : value);\n }\n if (typeof value === 'function') {\n return 'function';\n }\n if (Array.isArray(value)) {\n return `Array(${value.length})`;\n }\n if (value instanceof Element) {\n return `<${value.tagName.toLowerCase()}>`;\n }\n if (value !== null && typeof value === 'object') {\n const name = value.constructor?.name;\n return name && name !== 'Object' ? name : `{${Object.keys(value).slice(0, 3).join(', ')}}`;\n }\n return String(value);\n}\n\n/** Listens to the core, and adds the button that opens the panel. */\nexport function installDevtools(endpoint = '/__brumate/inspect', rpc = '/_brumate'): DevtoolsState {\n const state: DevtoolsState = { log: [], written: new Set(), endpoint };\n const add = (entry: Omit<DevtoolsEntry, 'time'>): void => {\n state.log.push({ ...entry, time: performance.now() });\n if (state.log.length > MAX_LOG) {\n state.log.splice(0, state.log.length - MAX_LOG);\n }\n state.changed?.();\n };\n const hooks: DevtoolsHooks = {\n attach(core) {\n state.scopes = core.scopes;\n state.set = core.set;\n state.changed?.();\n },\n handler(ref, element, event) {\n add({\n kind: 'handler',\n text: `${event?.type ?? 'call'} on <${element.tagName.toLowerCase()}>: ${ref}`,\n });\n },\n part(component, name) {\n add({ kind: 'part', text: `loaded ${component} ${name}` });\n },\n write(scope, slot, value) {\n state.written.add(scope.id);\n const root = rootOf(scope);\n add({\n kind: 'write',\n text: `scope ${scope.id} slot ${slot} = ${preview(value)}`,\n scope: scope.id,\n write: { component: root.m ?? '', k: scope.k, slot },\n });\n },\n };\n (globalThis as Record<symbol, DevtoolsHooks | undefined>)[DEVTOOLS] = hooks;\n\n // Server function calls, with how long each took and how it answered.\n const original = globalThis.fetch.bind(globalThis);\n globalThis.fetch = async (input, init) => {\n const url = new URL(input instanceof Request ? input.url : String(input), location.href);\n if (url.origin !== location.origin || !url.pathname.startsWith(`${rpc}/`)) {\n return original(input, init);\n }\n const name = decodeURIComponent(url.pathname.slice(rpc.length + 1));\n const started = performance.now();\n try {\n const response = await original(input, init);\n const took = Math.round(performance.now() - started);\n const redirect = response.headers.get('x-brumate-redirect');\n add({\n kind: 'call',\n text: `${name}: ${redirect ? `redirect to ${redirect}` : response.status} in ${took} ms`,\n });\n return response;\n } catch (error) {\n add({\n kind: 'call',\n text: `${name}: failed, ${error instanceof Error ? error.message : String(error)}`,\n });\n throw error;\n }\n };\n\n const host = document.createElement('brumate-devtools');\n const root = host.attachShadow({ mode: 'open' });\n const button = document.createElement('button');\n button.textContent = 'brm';\n button.title = 'Open the brumate devtools';\n button.setAttribute(\n 'style',\n 'position:fixed;right:12px;bottom:12px;z-index:2147483647;font:600 12px ui-monospace,monospace;padding:6px 10px;border-radius:999px;border:1px solid #8884;background:#111;color:#fff;cursor:pointer',\n );\n button.addEventListener('click', () => {\n void import('./devtools-panel.ts').then(({ togglePanel }) => togglePanel(root, state));\n });\n root.append(button);\n const append = (): void => {\n // Navigation replaces the body, so the button goes on the document element.\n document.documentElement.append(host);\n };\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', append);\n } else {\n append();\n }\n return state;\n}\n"],"mappings":";AAOA,MAAM,WAAW,OAAO,IAAI,kBAAkB;AA0B9C,MAAM,UAAU;;AAGhB,SAAgB,OAAO,OAAqB;CAC1C,IAAI,OAAO;CACX,OAAO,KAAK,GACV,OAAO,KAAK;CAEd,OAAO;AACT;;AAGA,SAAgB,QAAQ,OAAwB;CAC9C,IAAI,OAAO,UAAU,UACnB,OAAO,KAAK,UAAU,MAAM,SAAS,KAAK,GAAG,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,KAAK;CAE5E,IAAI,OAAO,UAAU,YACnB,OAAO;CAET,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,SAAS,MAAM,OAAO;CAE/B,IAAI,iBAAiB,SACnB,OAAO,IAAI,MAAM,QAAQ,YAAY,EAAE;CAEzC,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EAC/C,MAAM,OAAO,MAAM,aAAa;EAChC,OAAO,QAAQ,SAAS,WAAW,O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