@mandujs/core 0.41.2 → 0.43.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/package.json +21 -4
- package/src/auth/__tests__/login.test.ts +420 -419
- package/src/auth/__tests__/reset.test.ts +296 -296
- package/src/brain/adapters/anthropic-oauth.ts +421 -420
- package/src/brain/adapters/index.ts +2 -1
- package/src/brain/adapters/ollama.ts +1 -1
- package/src/brain/adapters/openai-oauth.ts +534 -533
- package/src/brain/brain.ts +2 -1
- package/src/brain/redactor.ts +196 -196
- package/src/bundler/__tests__/cli-bench-utils.test.ts +149 -149
- package/src/bundler/__tests__/cold-start.test.ts +504 -504
- package/src/bundler/__tests__/fast-refresh.test.ts +607 -606
- package/src/bundler/__tests__/hdr.test.ts +1 -1
- package/src/bundler/analyzer.ts +958 -958
- package/src/bundler/build.ts +104 -14
- package/src/bundler/dev.ts +125 -0
- package/src/bundler/hmr-types.ts +1 -0
- package/src/bundler/plugins/__tests__/react-compiler-lint.test.ts +110 -0
- package/src/bundler/plugins/index.ts +14 -0
- package/src/bundler/plugins/react-compiler-lint.ts +253 -0
- package/src/bundler/plugins/react-compiler.ts +162 -0
- package/src/bundler/types.ts +12 -0
- package/src/change/integrity.ts +2 -1
- package/src/client/index.ts +10 -0
- package/src/client/island.ts +38 -11
- package/src/client/router.ts +6 -1
- package/src/config/mandu.ts +57 -0
- package/src/config/validate.ts +42 -0
- package/src/content/collection.ts +844 -809
- package/src/content/content-layer.ts +316 -314
- package/src/content/content.test.ts +433 -433
- package/src/content/digest.ts +133 -133
- package/src/content/generate-types.ts +168 -168
- package/src/content/index.ts +6 -1
- package/src/content/llms-txt.ts +277 -277
- package/src/contract/define.ts +474 -474
- package/src/contract/route-helpers.ts +2 -1
- package/src/contract/zod-utils.ts +158 -155
- package/src/db/index.ts +513 -513
- package/src/desktop/__tests__/smoke.test.ts +100 -100
- package/src/desktop/webview-fallback.ts +583 -583
- package/src/desktop/window.ts +3 -1
- package/src/dev-error-overlay/overlay-client.ts +300 -300
- package/src/devtools/ai/mcp-connector.ts +499 -498
- package/src/devtools/client/components/kitchen-root.tsx +7 -2
- package/src/email/resend.ts +163 -163
- package/src/guard/__tests__/tsgolint-bridge.test.ts +347 -0
- package/src/guard/ast-analyzer.ts +806 -806
- package/src/guard/graph.ts +898 -898
- package/src/guard/index.ts +16 -0
- package/src/guard/statistics.ts +578 -578
- package/src/guard/tsgolint-bridge.ts +512 -0
- package/src/i18n/locale-resolver.ts +214 -214
- package/src/id/__tests__/id.test.ts +120 -120
- package/src/intent/index.ts +321 -321
- package/src/island/index.ts +39 -23
- package/src/kitchen/api/contract-api.ts +15 -8
- package/src/kitchen/kitchen-ui.ts +2137 -2137
- package/src/lockfile/index.ts +3 -2
- package/src/middleware/oauth/__tests__/oauth.test.ts +575 -574
- package/src/middleware/rate-limit/__tests__/rate-limit.test.ts +642 -642
- package/src/middleware/secure/index.ts +417 -417
- package/src/observability/event-bus.ts +2 -2
- package/src/observability/metrics.ts +334 -334
- package/src/observability/tracing.ts +694 -694
- package/src/openapi/generator.ts +1 -1
- package/src/perf/user-marks.ts +553 -553
- package/src/plugins/registry.ts +387 -387
- package/src/resource/ddl/diff.ts +392 -392
- package/src/resource/ddl/snapshot.ts +448 -447
- package/src/resource/generator-schema.ts +477 -476
- package/src/resource/parser.ts +4 -2
- package/src/resource/schema.ts +1 -1
- package/src/router/fs-patterns.ts +422 -422
- package/src/runtime/fast-refresh-types.ts +126 -128
- package/src/runtime/image-handler.ts +206 -195
- package/src/runtime/router.test.ts +476 -476
- package/src/runtime/security.ts +155 -155
- package/src/runtime/server.ts +36 -19
- package/src/runtime/session-key.ts +328 -328
- package/src/scheduler/__tests__/scheduler.test.ts +514 -514
- package/src/seo/resolve/index.ts +353 -353
- package/src/spec/load.ts +1 -1
- package/src/testing/reporter.ts +676 -676
- package/src/testing/server.ts +196 -196
- package/src/testing/snapshot.ts +444 -444
- package/src/utils/__tests__/lru-cache.test.ts +186 -186
- package/src/utils/bun.ts +8 -8
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @mandujs/core/desktop — smoke tests
|
|
3
|
-
*
|
|
4
|
-
* Integration-shaped assertions: the barrel re-exports what we expect, the
|
|
5
|
-
* optional peer is genuinely optional (tests pass with it absent), and the
|
|
6
|
-
* demo fixture is present.
|
|
7
|
-
*
|
|
8
|
-
* The browser-visible smoke (actual WebView window opening) runs only when
|
|
9
|
-
* a `MANDU_DESKTOP_E2E=1` env flag is set AND the peer is installed. CI
|
|
10
|
-
* skips it unconditionally.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { describe, it, expect } from "bun:test";
|
|
14
|
-
import path from "path";
|
|
15
|
-
import fs from "fs";
|
|
16
|
-
|
|
17
|
-
const repoRoot = path.resolve(__dirname, "..", "..", "..", "..", "..");
|
|
18
|
-
const demoPath = path.join(repoRoot, "demo", "desktop-starter");
|
|
19
|
-
|
|
20
|
-
describe("@mandujs/core/desktop — smoke", () => {
|
|
21
|
-
it("barrel exports createWindow and the type surface", async () => {
|
|
22
|
-
const mod = await import("../index");
|
|
23
|
-
expect(typeof mod.createWindow).toBe("function");
|
|
24
|
-
// Type-only exports don't survive runtime introspection; the fact
|
|
25
|
-
// that the import succeeds without throwing is the meaningful part.
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("worker entry is importable without a running Worker host", async () => {
|
|
29
|
-
// Importing worker.ts outside a Worker context must not crash — the
|
|
30
|
-
// module guards on `globalThis.addEventListener` presence. In Bun main
|
|
31
|
-
// thread, `addEventListener` exists on globalThis (as a DOM-compat
|
|
32
|
-
// shim), so the installer runs but just doesn't receive messages.
|
|
33
|
-
const mod = await import("../worker");
|
|
34
|
-
expect(typeof mod._installHandler).toBe("function");
|
|
35
|
-
expect(typeof mod._postToParent).toBe("function");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("demo/desktop-starter fixture exists", () => {
|
|
39
|
-
const exists = fs.existsSync(demoPath);
|
|
40
|
-
expect(exists).toBe(true);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("demo/desktop-starter has a package.json with webview-bun peer", () => {
|
|
44
|
-
const pkgPath = path.join(demoPath, "package.json");
|
|
45
|
-
const pkgRaw = fs.readFileSync(pkgPath, "utf-8");
|
|
46
|
-
const pkg = JSON.parse(pkgRaw);
|
|
47
|
-
expect(pkg.name).toBe("mandu-desktop-starter");
|
|
48
|
-
// webview-bun should appear either in dependencies or peerDependencies
|
|
49
|
-
const combined = {
|
|
50
|
-
...(pkg.dependencies ?? {}),
|
|
51
|
-
...(pkg.peerDependencies ?? {}),
|
|
52
|
-
...(pkg.optionalDependencies ?? {}),
|
|
53
|
-
};
|
|
54
|
-
expect("webview-bun" in combined).toBe(true);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("demo/desktop-starter has a desktop entry file", () => {
|
|
58
|
-
const entryPath = path.join(demoPath, "src", "desktop", "main.ts");
|
|
59
|
-
const exists = fs.existsSync(entryPath);
|
|
60
|
-
expect(exists).toBe(true);
|
|
61
|
-
const contents = fs.readFileSync(entryPath, "utf-8");
|
|
62
|
-
// The entry should wire Worker + startServer — sanity-check key symbols.
|
|
63
|
-
expect(contents).toContain("startServer");
|
|
64
|
-
expect(contents).toContain("Worker");
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it("demo/desktop-starter has minimal app/ routes", () => {
|
|
68
|
-
const appDir = path.join(demoPath, "app");
|
|
69
|
-
const exists = fs.existsSync(appDir);
|
|
70
|
-
expect(exists).toBe(true);
|
|
71
|
-
const pagePath = path.join(appDir, "page.tsx");
|
|
72
|
-
expect(fs.existsSync(pagePath)).toBe(true);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Describe block that runs only when explicitly enabled. Left as a
|
|
77
|
-
// placeholder for local Windows smoke — no assertions on CI.
|
|
78
|
-
const canOpenWindow =
|
|
79
|
-
process.env.MANDU_DESKTOP_E2E === "1" &&
|
|
80
|
-
(process.platform === "win32" ||
|
|
81
|
-
process.platform === "darwin" ||
|
|
82
|
-
process.platform === "linux");
|
|
83
|
-
|
|
84
|
-
describe.skipIf(!canOpenWindow)(
|
|
85
|
-
"@mandujs/core/desktop — browser smoke (opt-in)",
|
|
86
|
-
() => {
|
|
87
|
-
it("opens and closes a data: URL window", async () => {
|
|
88
|
-
const { createWindow } = await import("../window");
|
|
89
|
-
const handle = await createWindow({
|
|
90
|
-
url: "data:text/html,<h1>Mandu smoke</h1>",
|
|
91
|
-
title: "Mandu E2E",
|
|
92
|
-
width: 400,
|
|
93
|
-
height: 300,
|
|
94
|
-
});
|
|
95
|
-
// Close immediately — we only assert the handle is constructible.
|
|
96
|
-
await handle.close();
|
|
97
|
-
await handle.closed;
|
|
98
|
-
});
|
|
99
|
-
},
|
|
100
|
-
);
|
|
1
|
+
/**
|
|
2
|
+
* @mandujs/core/desktop — smoke tests
|
|
3
|
+
*
|
|
4
|
+
* Integration-shaped assertions: the barrel re-exports what we expect, the
|
|
5
|
+
* optional peer is genuinely optional (tests pass with it absent), and the
|
|
6
|
+
* demo fixture is present.
|
|
7
|
+
*
|
|
8
|
+
* The browser-visible smoke (actual WebView window opening) runs only when
|
|
9
|
+
* a `MANDU_DESKTOP_E2E=1` env flag is set AND the peer is installed. CI
|
|
10
|
+
* skips it unconditionally.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { describe, it, expect } from "bun:test";
|
|
14
|
+
import path from "path";
|
|
15
|
+
import fs from "fs";
|
|
16
|
+
|
|
17
|
+
const repoRoot = path.resolve(__dirname, "..", "..", "..", "..", "..");
|
|
18
|
+
const demoPath = path.join(repoRoot, "demo", "desktop-starter");
|
|
19
|
+
|
|
20
|
+
describe("@mandujs/core/desktop — smoke", () => {
|
|
21
|
+
it("barrel exports createWindow and the type surface", async () => {
|
|
22
|
+
const mod = await import("../index");
|
|
23
|
+
expect(typeof mod.createWindow).toBe("function");
|
|
24
|
+
// Type-only exports don't survive runtime introspection; the fact
|
|
25
|
+
// that the import succeeds without throwing is the meaningful part.
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("worker entry is importable without a running Worker host", async () => {
|
|
29
|
+
// Importing worker.ts outside a Worker context must not crash — the
|
|
30
|
+
// module guards on `globalThis.addEventListener` presence. In Bun main
|
|
31
|
+
// thread, `addEventListener` exists on globalThis (as a DOM-compat
|
|
32
|
+
// shim), so the installer runs but just doesn't receive messages.
|
|
33
|
+
const mod = await import("../worker");
|
|
34
|
+
expect(typeof mod._installHandler).toBe("function");
|
|
35
|
+
expect(typeof mod._postToParent).toBe("function");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("demo/desktop-starter fixture exists", () => {
|
|
39
|
+
const exists = fs.existsSync(demoPath);
|
|
40
|
+
expect(exists).toBe(true);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("demo/desktop-starter has a package.json with webview-bun peer", () => {
|
|
44
|
+
const pkgPath = path.join(demoPath, "package.json");
|
|
45
|
+
const pkgRaw = fs.readFileSync(pkgPath, "utf-8");
|
|
46
|
+
const pkg = JSON.parse(pkgRaw);
|
|
47
|
+
expect(pkg.name).toBe("mandu-desktop-starter");
|
|
48
|
+
// webview-bun should appear either in dependencies or peerDependencies
|
|
49
|
+
const combined = {
|
|
50
|
+
...(pkg.dependencies ?? {}),
|
|
51
|
+
...(pkg.peerDependencies ?? {}),
|
|
52
|
+
...(pkg.optionalDependencies ?? {}),
|
|
53
|
+
};
|
|
54
|
+
expect("webview-bun" in combined).toBe(true);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("demo/desktop-starter has a desktop entry file", () => {
|
|
58
|
+
const entryPath = path.join(demoPath, "src", "desktop", "main.ts");
|
|
59
|
+
const exists = fs.existsSync(entryPath);
|
|
60
|
+
expect(exists).toBe(true);
|
|
61
|
+
const contents = fs.readFileSync(entryPath, "utf-8");
|
|
62
|
+
// The entry should wire Worker + startServer — sanity-check key symbols.
|
|
63
|
+
expect(contents).toContain("startServer");
|
|
64
|
+
expect(contents).toContain("Worker");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("demo/desktop-starter has minimal app/ routes", () => {
|
|
68
|
+
const appDir = path.join(demoPath, "app");
|
|
69
|
+
const exists = fs.existsSync(appDir);
|
|
70
|
+
expect(exists).toBe(true);
|
|
71
|
+
const pagePath = path.join(appDir, "page.tsx");
|
|
72
|
+
expect(fs.existsSync(pagePath)).toBe(true);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Describe block that runs only when explicitly enabled. Left as a
|
|
77
|
+
// placeholder for local Windows smoke — no assertions on CI.
|
|
78
|
+
const canOpenWindow =
|
|
79
|
+
process.env.MANDU_DESKTOP_E2E === "1" &&
|
|
80
|
+
(process.platform === "win32" ||
|
|
81
|
+
process.platform === "darwin" ||
|
|
82
|
+
process.platform === "linux");
|
|
83
|
+
|
|
84
|
+
describe.skipIf(!canOpenWindow)(
|
|
85
|
+
"@mandujs/core/desktop — browser smoke (opt-in)",
|
|
86
|
+
() => {
|
|
87
|
+
it("opens and closes a data: URL window", async () => {
|
|
88
|
+
const { createWindow } = await import("../window");
|
|
89
|
+
const handle = await createWindow({
|
|
90
|
+
url: "data:text/html,<h1>Mandu smoke</h1>",
|
|
91
|
+
title: "Mandu E2E",
|
|
92
|
+
width: 400,
|
|
93
|
+
height: 300,
|
|
94
|
+
});
|
|
95
|
+
// Close immediately — we only assert the handle is constructible.
|
|
96
|
+
await handle.close();
|
|
97
|
+
await handle.closed;
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
);
|