@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.
Files changed (88) hide show
  1. package/package.json +21 -4
  2. package/src/auth/__tests__/login.test.ts +420 -419
  3. package/src/auth/__tests__/reset.test.ts +296 -296
  4. package/src/brain/adapters/anthropic-oauth.ts +421 -420
  5. package/src/brain/adapters/index.ts +2 -1
  6. package/src/brain/adapters/ollama.ts +1 -1
  7. package/src/brain/adapters/openai-oauth.ts +534 -533
  8. package/src/brain/brain.ts +2 -1
  9. package/src/brain/redactor.ts +196 -196
  10. package/src/bundler/__tests__/cli-bench-utils.test.ts +149 -149
  11. package/src/bundler/__tests__/cold-start.test.ts +504 -504
  12. package/src/bundler/__tests__/fast-refresh.test.ts +607 -606
  13. package/src/bundler/__tests__/hdr.test.ts +1 -1
  14. package/src/bundler/analyzer.ts +958 -958
  15. package/src/bundler/build.ts +104 -14
  16. package/src/bundler/dev.ts +125 -0
  17. package/src/bundler/hmr-types.ts +1 -0
  18. package/src/bundler/plugins/__tests__/react-compiler-lint.test.ts +110 -0
  19. package/src/bundler/plugins/index.ts +14 -0
  20. package/src/bundler/plugins/react-compiler-lint.ts +253 -0
  21. package/src/bundler/plugins/react-compiler.ts +162 -0
  22. package/src/bundler/types.ts +12 -0
  23. package/src/change/integrity.ts +2 -1
  24. package/src/client/index.ts +10 -0
  25. package/src/client/island.ts +38 -11
  26. package/src/client/router.ts +6 -1
  27. package/src/config/mandu.ts +57 -0
  28. package/src/config/validate.ts +42 -0
  29. package/src/content/collection.ts +844 -809
  30. package/src/content/content-layer.ts +316 -314
  31. package/src/content/content.test.ts +433 -433
  32. package/src/content/digest.ts +133 -133
  33. package/src/content/generate-types.ts +168 -168
  34. package/src/content/index.ts +6 -1
  35. package/src/content/llms-txt.ts +277 -277
  36. package/src/contract/define.ts +474 -474
  37. package/src/contract/route-helpers.ts +2 -1
  38. package/src/contract/zod-utils.ts +158 -155
  39. package/src/db/index.ts +513 -513
  40. package/src/desktop/__tests__/smoke.test.ts +100 -100
  41. package/src/desktop/webview-fallback.ts +583 -583
  42. package/src/desktop/window.ts +3 -1
  43. package/src/dev-error-overlay/overlay-client.ts +300 -300
  44. package/src/devtools/ai/mcp-connector.ts +499 -498
  45. package/src/devtools/client/components/kitchen-root.tsx +7 -2
  46. package/src/email/resend.ts +163 -163
  47. package/src/guard/__tests__/tsgolint-bridge.test.ts +347 -0
  48. package/src/guard/ast-analyzer.ts +806 -806
  49. package/src/guard/graph.ts +898 -898
  50. package/src/guard/index.ts +16 -0
  51. package/src/guard/statistics.ts +578 -578
  52. package/src/guard/tsgolint-bridge.ts +512 -0
  53. package/src/i18n/locale-resolver.ts +214 -214
  54. package/src/id/__tests__/id.test.ts +120 -120
  55. package/src/intent/index.ts +321 -321
  56. package/src/island/index.ts +39 -23
  57. package/src/kitchen/api/contract-api.ts +15 -8
  58. package/src/kitchen/kitchen-ui.ts +2137 -2137
  59. package/src/lockfile/index.ts +3 -2
  60. package/src/middleware/oauth/__tests__/oauth.test.ts +575 -574
  61. package/src/middleware/rate-limit/__tests__/rate-limit.test.ts +642 -642
  62. package/src/middleware/secure/index.ts +417 -417
  63. package/src/observability/event-bus.ts +2 -2
  64. package/src/observability/metrics.ts +334 -334
  65. package/src/observability/tracing.ts +694 -694
  66. package/src/openapi/generator.ts +1 -1
  67. package/src/perf/user-marks.ts +553 -553
  68. package/src/plugins/registry.ts +387 -387
  69. package/src/resource/ddl/diff.ts +392 -392
  70. package/src/resource/ddl/snapshot.ts +448 -447
  71. package/src/resource/generator-schema.ts +477 -476
  72. package/src/resource/parser.ts +4 -2
  73. package/src/resource/schema.ts +1 -1
  74. package/src/router/fs-patterns.ts +422 -422
  75. package/src/runtime/fast-refresh-types.ts +126 -128
  76. package/src/runtime/image-handler.ts +206 -195
  77. package/src/runtime/router.test.ts +476 -476
  78. package/src/runtime/security.ts +155 -155
  79. package/src/runtime/server.ts +36 -19
  80. package/src/runtime/session-key.ts +328 -328
  81. package/src/scheduler/__tests__/scheduler.test.ts +514 -514
  82. package/src/seo/resolve/index.ts +353 -353
  83. package/src/spec/load.ts +1 -1
  84. package/src/testing/reporter.ts +676 -676
  85. package/src/testing/server.ts +196 -196
  86. package/src/testing/snapshot.ts +444 -444
  87. package/src/utils/__tests__/lru-cache.test.ts +186 -186
  88. 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
+ );