babavoss 0.12.2 → 0.12.4
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/package.json +1 -1
- package/src/baba/config.ts +8 -1
- package/src/generated/build.ts +1 -1
- package/src/kernel/children.ts +5 -1
- package/src/server/edge.ts +19 -0
package/package.json
CHANGED
package/src/baba/config.ts
CHANGED
|
@@ -58,13 +58,20 @@ export function viewsConfig(): string {
|
|
|
58
58
|
// The whole DOM: a view runs in the browser, whose sandbox is its own.
|
|
59
59
|
return JSON.stringify({
|
|
60
60
|
"//": note,
|
|
61
|
-
compilerOptions: { lib: ["ESNext", "DOM", "DOM.Iterable"], ...rest, jsx: "react-jsx", jsxImportSource: "react", paths: alias, composite: true, declaration: true, emitDeclarationOnly: true, rootDir: "..", outDir: "./types/views" },
|
|
61
|
+
compilerOptions: { lib: ["ESNext", "DOM", "DOM.Iterable"], ...rest, jsx: "react-jsx", jsxImportSource: "react", paths: { ...alias, ...frameworkPaths }, composite: true, declaration: true, emitDeclarationOnly: true, rootDir: "..", outDir: "./types/views" },
|
|
62
62
|
// A composite program lists every file it reaches: the backend modules a view imports types from too.
|
|
63
63
|
include: ["assets.d.ts", "../**/*.ts", "../**/*.tsx"],
|
|
64
64
|
exclude: ["../node_modules/**", "../.voss/types/**", "../**/*.test.ts", "../**/*.test.tsx"],
|
|
65
65
|
}, null, 2) + "\n";
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/**
|
|
69
|
+
* The framework's files by package name. A composite program names the types a spec or an app exports; with `@/*`
|
|
70
|
+
* reaching into node_modules as well, the checker would name a framework type through the alias and refuse it as
|
|
71
|
+
* not portable (TS2883). This pattern names it as `babavoss/src/…` instead, with or without the package in node_modules.
|
|
72
|
+
*/
|
|
73
|
+
const frameworkPaths: Record<string, string[]> = { "babavoss/*": ["../node_modules/babavoss/*"] };
|
|
74
|
+
|
|
68
75
|
const doc = (s: string) => `/** ${s} */`;
|
|
69
76
|
const quote = (s: string) => JSON.stringify(s);
|
|
70
77
|
|
package/src/generated/build.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// The commit and the moment a package was built from, stamped by the pack
|
|
2
2
|
// of a release (tools/release/pack.ts) and restored after it. From a
|
|
3
3
|
// checkout both are empty: the tree is the build.
|
|
4
|
-
export const build = {"sha":"
|
|
4
|
+
export const build = {"sha":"f1afec7","at":"2026-10-08T21:00:04.416Z"};
|
package/src/kernel/children.ts
CHANGED
|
@@ -88,7 +88,11 @@ export function linkTargets(baba: string): { targets: string[]; links: string[]
|
|
|
88
88
|
p = next;
|
|
89
89
|
}
|
|
90
90
|
const target = real(e);
|
|
91
|
-
if (
|
|
91
|
+
if (inside(target) || readable().some((r) => target === r || target.startsWith(r + "/"))) continue;
|
|
92
|
+
// A package in an isolated store, `node_modules/.bun/NAME@VERSION/node_modules/NAME`, reaches its own dependencies
|
|
93
|
+
// by links into the same store: the store's node_modules is the grant, as the hoisted layout's would be.
|
|
94
|
+
const store = target.indexOf("/node_modules/.bun/");
|
|
95
|
+
out.add(store >= 0 ? target.slice(0, store + "/node_modules".length) : target);
|
|
92
96
|
}
|
|
93
97
|
return { targets: [...out], links: [...links] };
|
|
94
98
|
}
|
package/src/server/edge.ts
CHANGED
|
@@ -47,6 +47,20 @@ const failed = (f: Failure) => json({ error: { code: f.code, message: f.message
|
|
|
47
47
|
|
|
48
48
|
const RAW = new Set(["spawn", "add", "remove", "despawn", "set"]);
|
|
49
49
|
|
|
50
|
+
/** On every answer: no other site frames a page (clickjacking), loads a bundle, an asset or an answer into its own (CORP), or has one sniffed as another type. */
|
|
51
|
+
const GUARDS: [string, string][] = [
|
|
52
|
+
["content-security-policy", "frame-ancestors 'none'"],
|
|
53
|
+
["x-frame-options", "DENY"],
|
|
54
|
+
["cross-origin-resource-policy", "same-origin"],
|
|
55
|
+
["x-content-type-options", "nosniff"],
|
|
56
|
+
["referrer-policy", "no-referrer"],
|
|
57
|
+
];
|
|
58
|
+
function guarded(r: Response): Response {
|
|
59
|
+
const headers = new Headers(r.headers);
|
|
60
|
+
for (const [k, v] of GUARDS) headers.set(k, v);
|
|
61
|
+
return new Response(r.body, { status: r.status, statusText: r.statusText, headers });
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
// ---- the sockets ------------------------------------------------------------
|
|
51
65
|
|
|
52
66
|
/** A window's socket: which baba it follows, where it stands, and what it asks for. */
|
|
@@ -235,6 +249,11 @@ export function edge(state: Serve, ask: Ask): Edge {
|
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
const fetch = async (req: globalThis.Request, server: Server<Peer>): Promise<Response | undefined> => {
|
|
252
|
+
const r = await route(req, server);
|
|
253
|
+
return r && guarded(r);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const route = async (req: globalThis.Request, server: Server<Peer>): Promise<Response | undefined> => {
|
|
238
257
|
const host = req.headers.get("host") ?? "";
|
|
239
258
|
if (!localHost(host)) return text("host", 403);
|
|
240
259
|
const origin = req.headers.get("origin");
|