@mandujs/core 0.52.0 → 0.53.1

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 (109) hide show
  1. package/package.json +38 -2
  2. package/src/a11y/run-audit.ts +6 -6
  3. package/src/brain/adapters/oauth-flow.ts +1 -1
  4. package/src/brain/architecture/analyzer.ts +0 -2
  5. package/src/brain/credentials.ts +2 -2
  6. package/src/bundler/__tests__/build-runner.ts +13 -1
  7. package/src/bundler/__tests__/extended-watch.test.ts +3 -2
  8. package/src/bundler/__tests__/fast-refresh.test.ts +10 -12
  9. package/src/bundler/build.test.ts +30 -33
  10. package/src/bundler/build.ts +2 -1
  11. package/src/bundler/dev.ts +23 -22
  12. package/src/bundler/prerender.ts +63 -0
  13. package/src/bundler/safe-build.test.ts +2 -1
  14. package/src/bundler/types.ts +5 -3
  15. package/src/change/history.ts +1 -1
  16. package/src/change/snapshot.ts +18 -9
  17. package/src/client/Link.tsx +9 -9
  18. package/src/client/globals.ts +3 -2
  19. package/src/client/hooks.ts +0 -4
  20. package/src/client/hydrate.ts +1 -1
  21. package/src/client/router.ts +12 -12
  22. package/src/client/rpc.ts +1 -1
  23. package/src/client/use-fetch.ts +6 -6
  24. package/src/client/use-sse.ts +5 -5
  25. package/src/config/mcp-status.ts +0 -1
  26. package/src/config/validate.ts +1 -1
  27. package/src/config/watcher.ts +1 -1
  28. package/src/content/collection.ts +8 -12
  29. package/src/content/content-layer.ts +5 -5
  30. package/src/content/data-store.ts +2 -2
  31. package/src/content/loader-context.ts +0 -1
  32. package/src/content/loaders/file.ts +1 -1
  33. package/src/content/loaders/glob.ts +4 -4
  34. package/src/content/loaders/types.ts +1 -1
  35. package/src/content/meta-store.ts +1 -1
  36. package/src/content/types.ts +1 -1
  37. package/src/contract/define.ts +11 -12
  38. package/src/contract/index.ts +3 -3
  39. package/src/contract/protection.ts +2 -2
  40. package/src/contract/types.ts +1 -1
  41. package/src/contract/validator.ts +0 -1
  42. package/src/db/__tests__/db.test.ts +4 -7
  43. package/src/db/migrations/index.ts +3 -0
  44. package/src/db/migrations/lock.ts +11 -11
  45. package/src/deploy/cache.ts +1 -0
  46. package/src/design/__tests__/agents-link.test.ts +109 -0
  47. package/src/design/__tests__/lint.test.ts +110 -0
  48. package/src/design/agents-link.ts +165 -0
  49. package/src/design/extract.ts +2 -1
  50. package/src/design/index.ts +16 -0
  51. package/src/design/lint.ts +209 -0
  52. package/src/design/patch.ts +0 -1
  53. package/src/devtools/ai/mcp-connector.ts +24 -24
  54. package/src/devtools/client/components/kitchen-root.tsx +1 -1
  55. package/src/devtools/client/components/panel/errors-panel.tsx +1 -1
  56. package/src/devtools/client/state-manager.ts +1 -1
  57. package/src/devtools/init.ts +2 -3
  58. package/src/devtools/server/source-context.ts +1 -1
  59. package/src/devtools/worker/redaction-worker.ts +8 -4
  60. package/src/devtools/worker/worker-manager.ts +4 -3
  61. package/src/error/classifier.ts +1 -1
  62. package/src/error/domains.ts +1 -1
  63. package/src/filling/sse.ts +5 -5
  64. package/src/generator/generate.ts +2 -2
  65. package/src/guard/analyzer.ts +1 -1
  66. package/src/guard/ast-analyzer.ts +7 -7
  67. package/src/guard/auto-correct.ts +2 -2
  68. package/src/guard/config-guard.ts +0 -2
  69. package/src/guard/contract-guard.ts +1 -1
  70. package/src/guard/decision-memory.ts +2 -2
  71. package/src/guard/design-inline-class.ts +2 -1
  72. package/src/guard/graph.ts +1 -1
  73. package/src/guard/healing.ts +36 -41
  74. package/src/guard/negotiation.ts +3 -3
  75. package/src/guard/reporter.ts +1 -4
  76. package/src/guard/semantic-slots.ts +2 -2
  77. package/src/guard/suggestions.ts +2 -2
  78. package/src/guard/watcher.ts +5 -4
  79. package/src/index.ts +5 -5
  80. package/src/intent/index.ts +1 -1
  81. package/src/kitchen/api/contract-api.ts +1 -1
  82. package/src/kitchen/api/file-api.ts +3 -3
  83. package/src/kitchen/kitchen-handler.ts +29 -21
  84. package/src/lockfile/validate.ts +0 -1
  85. package/src/openapi/generator.ts +2 -1
  86. package/src/openapi/openapi.test.ts +43 -14
  87. package/src/perf/user-marks.ts +1 -1
  88. package/src/plugins/registry.ts +1 -2
  89. package/src/plugins/types.ts +1 -1
  90. package/src/resource/ddl/diff.ts +0 -1
  91. package/src/resource/generator.ts +1 -1
  92. package/src/resource/generators/contract.ts +1 -1
  93. package/src/resource/schema.ts +2 -1
  94. package/src/router/fs-routes.ts +6 -6
  95. package/src/router/fs-scanner.ts +1 -1
  96. package/src/runtime/env.ts +1 -1
  97. package/src/runtime/image-handler.ts +2 -1
  98. package/src/runtime/middleware.ts +2 -1
  99. package/src/runtime/server.ts +67 -60
  100. package/src/runtime/ssr.ts +3 -3
  101. package/src/runtime/streaming-ssr.ts +25 -27
  102. package/src/scheduler/validate.ts +1 -1
  103. package/src/seo/integration/ssr.ts +2 -3
  104. package/src/seo/render/opengraph.ts +1 -1
  105. package/src/seo/resolve/index.ts +0 -4
  106. package/src/slot/corrector.ts +1 -1
  107. package/src/slot/validator.ts +4 -4
  108. package/src/watcher/reporter.ts +1 -1
  109. package/src/watcher/watcher.ts +19 -19
@@ -16,9 +16,34 @@ import {
16
16
  } from "./generator";
17
17
  import type { OpenAPIDocument } from "./generator";
18
18
  import type { RoutesManifest } from "../spec/schema";
19
- import fs from "node:fs/promises";
20
- import os from "node:os";
21
- import path from "node:path";
19
+ import fs from "node:fs/promises";
20
+ import os from "node:os";
21
+ import path from "node:path";
22
+
23
+ async function linkWorkspaceNodeModules(rootDir: string): Promise<void> {
24
+ const workspaceNodeModules = path.join(process.cwd(), "node_modules");
25
+ const fixtureNodeModules = path.join(rootDir, "node_modules");
26
+
27
+ try {
28
+ await fs.access(workspaceNodeModules);
29
+ } catch {
30
+ return;
31
+ }
32
+
33
+ try {
34
+ await fs.symlink(
35
+ workspaceNodeModules,
36
+ fixtureNodeModules,
37
+ process.platform === "win32" ? "junction" : "dir"
38
+ );
39
+ } catch (error) {
40
+ try {
41
+ await fs.access(fixtureNodeModules);
42
+ } catch {
43
+ throw error;
44
+ }
45
+ }
46
+ }
22
47
 
23
48
  describe("zodToOpenAPISchema", () => {
24
49
  describe("primitive types", () => {
@@ -321,9 +346,10 @@ describe("Real-world contract conversion", () => {
321
346
  * exercise the full build pipeline (generate + write + read) without
322
347
  * faking the dynamic import path.
323
348
  */
324
- async function buildFixture(): Promise<{ rootDir: string; manifest: RoutesManifest; cleanup: () => Promise<void> }> {
325
- const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-"));
326
- const contractPath = "contracts/users.contract.ts";
349
+ async function buildFixture(): Promise<{ rootDir: string; manifest: RoutesManifest; cleanup: () => Promise<void> }> {
350
+ const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-"));
351
+ await linkWorkspaceNodeModules(rootDir);
352
+ const contractPath = "contracts/users.contract.ts";
327
353
  const contractAbs = path.join(rootDir, contractPath);
328
354
  await fs.mkdir(path.dirname(contractAbs), { recursive: true });
329
355
  await fs.writeFile(
@@ -534,8 +560,9 @@ async function buildSharedSchemaFixture(opts: {
534
560
  manifest: RoutesManifest;
535
561
  cleanup: () => Promise<void>;
536
562
  }> {
537
- const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-hoist-"));
538
- const [nameA, nameB] = opts.contractNames ?? ["users", "admins"];
563
+ const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-hoist-"));
564
+ await linkWorkspaceNodeModules(rootDir);
565
+ const [nameA, nameB] = opts.contractNames ?? ["users", "admins"];
539
566
  const bodyB =
540
567
  opts.secondBody ??
541
568
  `z.object({ name: z.string().min(2), email: z.string().email() })`;
@@ -642,9 +669,10 @@ describe("hoistSharedSchemas", () => {
642
669
  });
643
670
 
644
671
  test("one-off schema stays inline (no hoist, no components.schemas entry for it)", async () => {
645
- const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-oneoff-"));
646
- try {
647
- await fs.mkdir(path.join(rootDir, "contracts"), { recursive: true });
672
+ const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-oneoff-"));
673
+ try {
674
+ await linkWorkspaceNodeModules(rootDir);
675
+ await fs.mkdir(path.join(rootDir, "contracts"), { recursive: true });
648
676
  await fs.writeFile(
649
677
  path.join(rootDir, "contracts/solo.contract.ts"),
650
678
  `import { z } from "zod";
@@ -816,9 +844,10 @@ export default {
816
844
  });
817
845
 
818
846
  test("enum / primitive schemas are never hoisted", async () => {
819
- const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-enum-"));
820
- try {
821
- await fs.mkdir(path.join(rootDir, "contracts"), { recursive: true });
847
+ const rootDir = await fs.mkdtemp(path.join(os.tmpdir(), "mandu-openapi-enum-"));
848
+ try {
849
+ await linkWorkspaceNodeModules(rootDir);
850
+ await fs.mkdir(path.join(rootDir, "contracts"), { recursive: true });
822
851
  const contractBody = `import { z } from "zod";
823
852
  export default {
824
853
  name: NAME,
@@ -62,7 +62,7 @@
62
62
  */
63
63
 
64
64
  import { isPerfEnabled } from "./index";
65
- import { getTracer, getActiveSpan, runWithSpan, type Span } from "../observability/tracing";
65
+ import { getTracer, runWithSpan, type Span } from "../observability/tracing";
66
66
 
67
67
  // ─── Types ──────────────────────────────────────────────────────────────
68
68
 
@@ -11,7 +11,6 @@ import type {
11
11
  Plugin,
12
12
  PluginApi,
13
13
  PluginCategory,
14
- PluginMeta,
15
14
  GuardPresetPlugin,
16
15
  BuildPlugin,
17
16
  LoggerTransportPlugin,
@@ -22,7 +21,7 @@ import type {
22
21
  /**
23
22
  * 플러그인 등록 상태
24
23
  */
25
- type PluginState = "pending" | "loaded" | "error" | "unloaded";
24
+ type _PluginState = "pending" | "loaded" | "error" | "unloaded";
26
25
 
27
26
  /**
28
27
  * 등록된 플러그인 정보 (discriminated union by state)
@@ -7,7 +7,7 @@
7
7
  * - 라이프사이클 훅
8
8
  */
9
9
 
10
- import type { z, ZodSchema } from "zod";
10
+ import type { ZodSchema } from "zod";
11
11
 
12
12
  /**
13
13
  * 플러그인 카테고리
@@ -62,7 +62,6 @@ import type { ParsedResource } from "../parser";
62
62
  import type {
63
63
  Change,
64
64
  DdlDefault,
65
- DdlFieldDef,
66
65
  DdlIndex,
67
66
  DdlResource,
68
67
  Snapshot,
@@ -74,7 +74,7 @@ async function fileExists(filePath: string): Promise<boolean> {
74
74
  async function ensureDir(dirPath: string): Promise<void> {
75
75
  try {
76
76
  await fs.mkdir(dirPath, { recursive: true });
77
- } catch (error) {
77
+ } catch {
78
78
  // Ignore if exists
79
79
  }
80
80
  }
@@ -14,7 +14,7 @@ import { getPluralName, getEnabledEndpoints } from "../schema";
14
14
  export function generateResourceContract(definition: ResourceDefinition): string {
15
15
  const resourceName = definition.name;
16
16
  const pascalName = toPascalCase(resourceName);
17
- const pluralName = getPluralName(definition);
17
+ const _pluralName = getPluralName(definition);
18
18
  const endpoints = getEnabledEndpoints(definition);
19
19
 
20
20
  // Generate schema definitions
@@ -1,3 +1,4 @@
1
+ import type * as __ManduDdlPersistenceTypesTypes0 from "./ddl/persistence-types";
1
2
  /**
2
3
  * Resource Schema Definition
3
4
  * Resource-Centric Architecture의 핵심 스키마 정의
@@ -100,7 +101,7 @@ export interface ResourceOptions {
100
101
  * });
101
102
  * ```
102
103
  */
103
- persistence?: import("./ddl/persistence-types").ExtendedResourcePersistence;
104
+ persistence?: __ManduDdlPersistenceTypesTypes0.ExtendedResourcePersistence;
104
105
  }
105
106
 
106
107
  // ============================================
@@ -451,12 +451,12 @@ export async function watchFSRoutes(
451
451
 
452
452
  return {
453
453
  close() {
454
- if (debounceTimer) {
455
- clearTimeout(debounceTimer);
456
- }
457
- routesWatcher.close();
458
- specWatcher.close();
459
- },
454
+ if (debounceTimer) {
455
+ clearTimeout(debounceTimer);
456
+ }
457
+ void routesWatcher.close();
458
+ void specWatcher.close();
459
+ },
460
460
  async rescan() {
461
461
  return triggerRescan();
462
462
  },
@@ -228,7 +228,7 @@ export class FSScanner {
228
228
  */
229
229
  private async createRouteConfigs(
230
230
  files: ScannedFile[],
231
- rootDir: string
231
+ _rootDir: string
232
232
  ): Promise<{ routes: FSRouteConfig[]; routeErrors: ScanError[] }> {
233
233
  const routes: FSRouteConfig[] = [];
234
234
  const routeErrors: ScanError[] = [];
@@ -93,7 +93,7 @@ function parseEnvFile(content: string): Record<string, string> {
93
93
  /**
94
94
  * 파일이 존재하는지 확인
95
95
  */
96
- async function fileExists(filePath: string): Promise<boolean> {
96
+ async function _fileExists(filePath: string): Promise<boolean> {
97
97
  try {
98
98
  const file = Bun.file(filePath);
99
99
  return await file.exists();
@@ -1,3 +1,4 @@
1
+ import type * as __ManduFsTypes0 from "fs";
1
2
  /**
2
3
  * Mandu Image Handler
3
4
  * /_mandu/image?url=...&w=...&q=... 엔드포인트
@@ -76,7 +77,7 @@ export async function handleImageRequest(
76
77
  // realpath로 symlink를 해석한 후 allowedBaseDir 내부인지 검증
77
78
  let resolvedPath: string;
78
79
  try {
79
- const realFs = require("fs") as typeof import("fs");
80
+ const realFs = require("fs") as typeof __ManduFsTypes0;
80
81
  resolvedPath = realFs.realpathSync(filePath);
81
82
  const resolvedBase = realFs.realpathSync(allowedBaseDir);
82
83
  if (!resolvedPath.startsWith(resolvedBase + path.sep) && resolvedPath !== resolvedBase) {
@@ -1,3 +1,4 @@
1
+ import type * as __ManduFsTypes0 from "fs";
1
2
  /**
2
3
  * Mandu Global Middleware
3
4
  * 라우트 매칭 전에 실행되는 글로벌 미들웨어 시스템
@@ -227,7 +228,7 @@ export async function loadMiddleware(
227
228
  export function loadMiddlewareSync(
228
229
  rootDir: string
229
230
  ): { fn: MiddlewareFn; config: MiddlewareConfig | null } | null {
230
- const fs = require("fs") as typeof import("fs");
231
+ const fs = require("fs") as typeof __ManduFsTypes0;
231
232
  const possiblePaths = [
232
233
  `${rootDir}/middleware.ts`,
233
234
  `${rootDir}/middleware.js`,
@@ -1,30 +1,28 @@
1
- import type { Server, ServerWebSocket } from "bun";
1
+ import type { BunFile, Server, ServerWebSocket } from "bun";
2
2
  import type { RoutesManifest, RouteSpec, HydrationConfig, StaticParamSetSchema } from "../spec/schema";
3
3
  import type { BundleManifest } from "../bundler/types";
4
4
  import type { ManduFilling, RenderMode } from "../filling/filling";
5
5
  import { ManduContext, CookieManager } from "../filling/context";
6
6
  import { Router } from "./router";
7
7
  import { renderSSR, renderStreamingResponse, resolveAsyncElement } from "./ssr";
8
- import {
9
- resolveMetadata,
10
- renderMetadata,
11
- renderTitle,
12
- type Metadata,
8
+ import {
9
+ resolveMetadata,
10
+ renderMetadata,
11
+ renderTitle,
12
+ type Metadata,
13
13
  type MetadataItem,
14
- type GenerateMetadata,
15
- } from "../seo";
16
- import { type ErrorFallbackProps } from "./boundary";
17
- import React, { type ReactNode } from "react";
14
+ type GenerateMetadata,
15
+ } from "../seo";
16
+ import { type ErrorFallbackProps } from "./boundary";
17
+ import React from "react";
18
18
  import path from "path";
19
19
  import fs from "fs/promises";
20
20
  import { PORTS } from "../constants";
21
21
  import {
22
- type CacheStore,
23
- type CacheStoreStats,
24
- type CacheLookupResult,
25
- type CacheConfig,
26
- MemoryCacheStore,
27
- lookupCache,
22
+ type CacheStore,
23
+ type CacheStoreStats,
24
+ type CacheConfig,
25
+ lookupCache,
28
26
  createCacheEntry,
29
27
  createCachedResponse,
30
28
  computeCacheControl,
@@ -53,7 +51,12 @@ import {
53
51
  } from "./cors";
54
52
  import { validateImportPath } from "./security";
55
53
  import { KITCHEN_PREFIX, KitchenHandler, recordRequest } from "../kitchen/kitchen-handler";
56
- import { eventBus } from "../observability/event-bus";
54
+ import {
55
+ eventBus,
56
+ type EventType,
57
+ type ObservabilityEvent,
58
+ type ObservabilitySeverity,
59
+ } from "../observability/event-bus";
57
60
  import {
58
61
  HEAP_ENDPOINT,
59
62
  METRICS_ENDPOINT,
@@ -62,11 +65,12 @@ import {
62
65
  isObservabilityExposed,
63
66
  recordHttpRequest,
64
67
  } from "../observability/metrics";
65
- import {
66
- handleOpenAPIRequest,
67
- isOpenAPIEndpointEnabled,
68
- resolveOpenAPIEndpointSettings,
69
- } from "./openapi-endpoint";
68
+ import {
69
+ handleOpenAPIRequest,
70
+ isOpenAPIEndpointEnabled,
71
+ resolveOpenAPIEndpointSettings,
72
+ type OpenAPIEndpointSettings,
73
+ } from "./openapi-endpoint";
70
74
  // Phase 18.ψ — user-facing perf marks dashboard append. We include a
71
75
  // `perf` block on the `/_mandu/heap` payload when the feature is active
72
76
  // so operators see a unified view (heap + caches + perf histogram).
@@ -77,8 +81,7 @@ import { collectPerfSnapshot } from "../perf/user-marks";
77
81
  // `startServer()`; `runWithSpan` is used at the absolute TOP of the
78
82
  // request handler so every downstream await (middleware, filling
79
83
  // loader, SSR render) inherits the active span via AsyncLocalStorage.
80
- import type {
81
- Tracer} from "../observability/tracing";
84
+ import type { Tracer } from "../observability/tracing";
82
85
  import {
83
86
  createTracerFromConfig,
84
87
  runWithSpan,
@@ -99,10 +102,10 @@ import type { Middleware } from "../middleware/define";
99
102
  // Phase 18.λ — scheduler wiring (statically imported so `startServer` stays
100
103
  // synchronous; the cost of unused code is trivial — `defineCron` is a thin
101
104
  // wrapper around `Bun.cron`).
102
- import { defineCron as schedulerDefineCron } from "../scheduler";
105
+ import { defineCron as schedulerDefineCron, type CronDef, type CronRegistration } from "../scheduler";
103
106
  import { setActiveSchedulerRegistration } from "../middleware/scheduler-cron";
104
107
  import { createFetchHandler } from "./handler";
105
- import { wrapBunWebSocket, type WSUpgradeData } from "../filling/ws";
108
+ import { wrapBunWebSocket, type WSHandlers, type WSUpgradeData } from "../filling/ws";
106
109
  import { handleImageRequest } from "./image-handler";
107
110
  import { extractShellHtml, createPPRResponse } from "./ppr";
108
111
  import { isRedirectResponse } from "./redirect";
@@ -110,12 +113,16 @@ import { isNotFoundResponse } from "./not-found";
110
113
  import { newId } from "../id";
111
114
  // Phase 18.κ — typed RPC dispatch (tRPC-like). See
112
115
  // `packages/core/src/contract/rpc.ts` + `docs/architect/typed-rpc.md`.
113
- import {
114
- matchRpcPath,
115
- dispatchRpc,
116
- registerRpc,
117
- clearRpcRegistry,
118
- } from "../contract/rpc";
116
+ import {
117
+ matchRpcPath,
118
+ dispatchRpc,
119
+ registerRpc,
120
+ clearRpcRegistry,
121
+ type RpcDefinition,
122
+ type RpcProcedureRecord,
123
+ } from "../contract/rpc";
124
+ import type { GuardConfig } from "../guard/types";
125
+ import type { ManduHooks, ManduPlugin } from "../plugins/hooks";
119
126
  import { handleMetadataRoute as dispatchMetadataRoute } from "../routes/metadata-routes";
120
127
  import {
121
128
  DEFAULT_PRERENDER_DIR,
@@ -419,7 +426,7 @@ export interface ServerOptions {
419
426
  /**
420
427
  * Guard config for Kitchen dev dashboard (dev mode only)
421
428
  */
422
- guardConfig?: import("../guard/types").GuardConfig | null;
429
+ guardConfig?: GuardConfig | null;
423
430
  /**
424
431
  * SSR 캐시 설정 (ISR/SWR 용).
425
432
  *
@@ -575,8 +582,8 @@ export interface ServerOptions {
575
582
  * `options.middleware` so they run BEFORE user-declared layers. Both
576
583
  * fields are optional; omission is a zero-overhead passthrough.
577
584
  */
578
- plugins?: readonly import("../plugins/hooks").ManduPlugin[];
579
- configHooks?: Partial<import("../plugins/hooks").ManduHooks>;
585
+ plugins?: readonly ManduPlugin[];
586
+ configHooks?: Partial<ManduHooks>;
580
587
  /**
581
588
  * Phase 18.κ — tRPC-like typed RPC endpoints.
582
589
  *
@@ -589,7 +596,7 @@ export interface ServerOptions {
589
596
  * Typically threaded from `ManduConfig.rpc.endpoints`.
590
597
  */
591
598
  rpc?: {
592
- endpoints?: Record<string, import("../contract/rpc").RpcDefinition<import("../contract/rpc").RpcProcedureRecord>>;
599
+ endpoints?: Record<string, RpcDefinition<RpcProcedureRecord>>;
593
600
  };
594
601
  /**
595
602
  * Phase 18.λ — declarative cron scheduler.
@@ -605,7 +612,7 @@ export interface ServerOptions {
605
612
  * Typically threaded from `ManduConfig.scheduler`.
606
613
  */
607
614
  scheduler?: {
608
- jobs?: import("../scheduler").CronDef[];
615
+ jobs?: CronDef[];
609
616
  disabled?: boolean;
610
617
  };
611
618
  /**
@@ -816,7 +823,7 @@ export interface ServerRegistrySettings {
816
823
  * tracing is disabled (the hot path is branch-free). When set, every
817
824
  * request opens a root span via `tracer.startSpanFromRequest()`.
818
825
  */
819
- tracer?: import("../observability/tracing").Tracer;
826
+ tracer?: Tracer;
820
827
  /**
821
828
  * Production OpenAPI endpoint — resolved from `ServerOptions.openapi`.
822
829
  * `undefined` means the endpoint is disabled (hot path branch-free).
@@ -824,7 +831,7 @@ export interface ServerRegistrySettings {
824
831
  * `<basePath>.json` / `<basePath>.yaml` short-circuits before route
825
832
  * dispatch to serve the cached spec body.
826
833
  */
827
- openapi?: import("./openapi-endpoint").OpenAPIEndpointSettings;
834
+ openapi?: OpenAPIEndpointSettings;
828
835
  /**
829
836
  * Phase 18 — resolved prerender pass-through state. `undefined`
830
837
  * means the feature is disabled for this server instance.
@@ -910,7 +917,7 @@ export class ServerRegistry {
910
917
  /** Layout slot 파일 경로 캐시 (모듈 경로 → slot 경로 | null) */
911
918
  readonly layoutSlotPaths: Map<string, string | null> = new Map();
912
919
  /** WebSocket 핸들러 (라우트 ID → WSHandlers) */
913
- readonly wsHandlers: Map<string, import("../filling/ws").WSHandlers> = new Map();
920
+ readonly wsHandlers: Map<string, WSHandlers> = new Map();
914
921
  /**
915
922
  * Metadata API 캐시 (#186)
916
923
  * - pageMetadata: routeId → page 모듈의 static `metadata` export
@@ -918,10 +925,10 @@ export class ServerRegistry {
918
925
  * - layoutMetadata: layout 모듈 경로 → static `metadata` export (null = 시도했지만 없음)
919
926
  * - layoutGenerateMetadata: layout 모듈 경로 → `generateMetadata` 함수
920
927
  */
921
- readonly pageMetadata: Map<string, import("../seo").Metadata> = new Map();
922
- readonly pageGenerateMetadata: Map<string, import("../seo").GenerateMetadata> = new Map();
923
- readonly layoutMetadata: Map<string, import("../seo").Metadata | null> = new Map();
924
- readonly layoutGenerateMetadata: Map<string, import("../seo").GenerateMetadata> = new Map();
928
+ readonly pageMetadata: Map<string, Metadata> = new Map();
929
+ readonly pageGenerateMetadata: Map<string, GenerateMetadata> = new Map();
930
+ readonly layoutMetadata: Map<string, Metadata | null> = new Map();
931
+ readonly layoutGenerateMetadata: Map<string, GenerateMetadata> = new Map();
925
932
  settings: ServerRegistrySettings = {
926
933
  isDev: false,
927
934
  rootDir: process.cwd(),
@@ -1270,7 +1277,7 @@ export function registerNotFoundHandler(handler: PageHandler): void {
1270
1277
  defaultRegistry.registerNotFoundHandler(handler);
1271
1278
  }
1272
1279
 
1273
- export function registerWSHandler(routeId: string, handlers: import("../filling/ws").WSHandlers): void {
1280
+ export function registerWSHandler(routeId: string, handlers: WSHandlers): void {
1274
1281
  defaultRegistry.wsHandlers.set(routeId, handlers);
1275
1282
  }
1276
1283
 
@@ -1356,7 +1363,7 @@ function handleEventsStreamRequest(req: Request): Response {
1356
1363
  const filterSource = url.searchParams.get("source") || undefined;
1357
1364
  const filterTrace = url.searchParams.get("trace") || undefined;
1358
1365
 
1359
- const matches = (e: import("../observability/event-bus").ObservabilityEvent): boolean => {
1366
+ const matches = (e: ObservabilityEvent): boolean => {
1360
1367
  if (filterType && e.type !== filterType) return false;
1361
1368
  if (filterSeverity && e.severity !== filterSeverity) return false;
1362
1369
  if (filterSource && e.source !== filterSource) return false;
@@ -1437,8 +1444,8 @@ function handleEventsRecentRequest(req: Request): Response {
1437
1444
  const events = eventBus.getRecent(
1438
1445
  count ? Number(count) : undefined,
1439
1446
  {
1440
- type: type as import("../observability/event-bus").EventType | undefined,
1441
- severity: severity as import("../observability/event-bus").ObservabilitySeverity | undefined,
1447
+ type: type as EventType | undefined,
1448
+ severity: severity as ObservabilitySeverity | undefined,
1442
1449
  },
1443
1450
  );
1444
1451
  const stats = eventBus.getStats(windowMs);
@@ -1544,7 +1551,7 @@ function evictEtagCacheIfNeeded(): void {
1544
1551
  */
1545
1552
  async function computeStrongEtag(
1546
1553
  filePath: string,
1547
- file: import("bun").BunFile,
1554
+ file: BunFile,
1548
1555
  ): Promise<string> {
1549
1556
  const size = file.size;
1550
1557
  const mtime = file.lastModified;
@@ -4675,12 +4682,12 @@ export function startServer(manifest: RoutesManifest, options: ServerOptions = {
4675
4682
  }
4676
4683
  // ─── End Phase 18.ζ ────────────────────────────────────────────────────
4677
4684
 
4678
- // Kitchen dev dashboard (dev mode only)
4679
- if (isDev) {
4680
- const kitchen = new KitchenHandler({ rootDir, manifest, guardConfig });
4681
- kitchen.start();
4682
- registry.kitchen = kitchen;
4683
- }
4685
+ // Kitchen dev dashboard (dev mode only)
4686
+ if (isDev) {
4687
+ const kitchen = new KitchenHandler({ rootDir, manifest, guardConfig });
4688
+ void kitchen.start();
4689
+ registry.kitchen = kitchen;
4690
+ }
4684
4691
 
4685
4692
  const router = new Router(manifest.routes);
4686
4693
 
@@ -4862,7 +4869,7 @@ export function startServer(manifest: RoutesManifest, options: ServerOptions = {
4862
4869
  // other boot errors rather than aborting the server. `startServer` is
4863
4870
  // synchronous by contract, so we use the already-imported scheduler
4864
4871
  // module rather than `await import`.
4865
- let schedulerRegistration: import("../scheduler").CronRegistration | null = null;
4872
+ let schedulerRegistration: CronRegistration | null = null;
4866
4873
  const jobDefs = schedulerOption?.jobs ?? [];
4867
4874
  const schedulerDisabled = schedulerOption?.disabled === true;
4868
4875
  if (jobDefs.length > 0 && !schedulerDisabled) {
@@ -4914,10 +4921,10 @@ export function startServer(manifest: RoutesManifest, options: ServerOptions = {
4914
4921
  console.error("[scheduler] shutdown error:", err);
4915
4922
  });
4916
4923
  }
4917
- server.stop();
4918
- },
4919
- };
4920
- }
4924
+ void server.stop();
4925
+ },
4926
+ };
4927
+ }
4921
4928
 
4922
4929
  // Clear registries (useful for testing) - deprecated, use clearDefaultRegistry()
4923
4930
  export function clearRegistry(): void {
@@ -165,7 +165,7 @@ export interface SSROptions {
165
165
 
166
166
  let projectRenderToString: ((element: ReactElement) => string) | null | undefined;
167
167
 
168
- function loadProjectRenderToString(): ((element: ReactElement) => string) | null {
168
+ function _loadProjectRenderToString(): ((element: ReactElement) => string) | null {
169
169
  if (projectRenderToString !== undefined) {
170
170
  return projectRenderToString;
171
171
  }
@@ -851,7 +851,7 @@ export function renderToHTML(element: ReactElement, options: SSROptions = {}): s
851
851
  function generateRouteScript(
852
852
  routeId: string,
853
853
  pattern: string,
854
- serverData?: Record<string, unknown>
854
+ _serverData?: Record<string, unknown>
855
855
  ): string {
856
856
  const routeInfo = {
857
857
  id: routeId,
@@ -867,7 +867,7 @@ function generateRouteScript(
867
867
  /**
868
868
  * URL 패턴에서 파라미터 추출 (클라이언트에서 사용)
869
869
  */
870
- function extractParamsFromUrl(pattern: string): Record<string, string> {
870
+ function extractParamsFromUrl(_pattern: string): Record<string, string> {
871
871
  // 서버에서는 실제 params를 전달받으므로 빈 객체 반환
872
872
  // 실제 params는 serverData나 별도 전달
873
873
  return {};
@@ -80,10 +80,10 @@ export interface StreamingError {
80
80
  export interface StreamingMetrics {
81
81
  /** Shell ready까지 걸린 시간 (ms) */
82
82
  shellReadyTime: number;
83
- /** All ready까지 걸린 시간 (ms) */
84
- allReadyTime: number;
85
- /** Deferred chunk 개수 */
86
- deferredChunkCount: number;
83
+ /** All ready까지 걸린 시간 (ms) */
84
+ allReadyTime: number;
85
+ /** Deferred chunk 개수 */
86
+ deferredChunkCount: number;
87
87
  /** 에러 발생 여부 */
88
88
  hasError: boolean;
89
89
  /** 시작 시간 */
@@ -1001,9 +1001,9 @@ export async function renderToStream(
1001
1001
 
1002
1002
  // 메트릭 수집
1003
1003
  const metrics: StreamingMetrics = {
1004
- shellReadyTime: 0,
1005
- allReadyTime: 0,
1006
- deferredChunkCount: 0,
1004
+ shellReadyTime: 0,
1005
+ allReadyTime: 0,
1006
+ deferredChunkCount: 0,
1007
1007
  hasError: false,
1008
1008
  startTime: Date.now(),
1009
1009
  };
@@ -1379,10 +1379,9 @@ export async function renderWithDeferredData(
1379
1379
  const encoder = new TextEncoder();
1380
1380
  const startTime = Date.now();
1381
1381
 
1382
- // 준비된 deferred 스크립트를 담을 배열 (mutable)
1383
- const readyScripts: string[] = [];
1384
- let deferredChunkCount = 0;
1385
- let allDeferredSettled = false;
1382
+ // 준비된 deferred 스크립트를 담을 배열 (mutable)
1383
+ const readyScripts: string[] = [];
1384
+ let allDeferredSettled = false;
1386
1385
 
1387
1386
  // 1. Deferred promises 병렬 시작 (막지 않음!)
1388
1387
  const deferredEntries = Object.entries(deferredPromises);
@@ -1396,12 +1395,11 @@ export async function renderWithDeferredData(
1396
1395
  );
1397
1396
  const data = await Promise.race([promise, timeoutPromise]);
1398
1397
 
1399
- // 스크립트 생성 및 추가
1400
- const script = generateDeferredDataScript(routeId, key, data);
1401
- readyScripts.push(script);
1402
- deferredChunkCount++;
1403
-
1404
- if (isDev) {
1398
+ // 스크립트 생성 및 추가
1399
+ const script = generateDeferredDataScript(routeId, key, data);
1400
+ readyScripts.push(script);
1401
+
1402
+ if (isDev) {
1405
1403
  console.log(`[Mandu Streaming] Deferred ready: ${key} (${Date.now() - startTime}ms)`);
1406
1404
  }
1407
1405
  } catch (error) {
@@ -1475,22 +1473,22 @@ export async function renderWithDeferredData(
1475
1473
 
1476
1474
  // 최종 메트릭 보고 (injectedCount가 실제 메트릭)
1477
1475
  if (onMetrics && baseMetrics) {
1478
- onMetrics({
1479
- ...baseMetrics,
1480
- deferredChunkCount: injectedCount,
1481
- allReadyTime: Date.now() - startTime,
1482
- });
1476
+ onMetrics({
1477
+ ...baseMetrics,
1478
+ deferredChunkCount: injectedCount,
1479
+ allReadyTime: Date.now() - startTime,
1480
+ });
1483
1481
  }
1484
1482
 
1485
1483
  controller.close();
1486
1484
  } catch (error) {
1487
1485
  controller.error(error);
1488
1486
  }
1489
- },
1490
- cancel() {
1491
- reader.cancel();
1492
- },
1493
- });
1487
+ },
1488
+ cancel() {
1489
+ void reader.cancel();
1490
+ },
1491
+ });
1494
1492
 
1495
1493
  // Phase 7.2 R1 Agent C (H1): if the base stream produced a CSP
1496
1494
  // nonce during shell emission, forward the matching header on the
@@ -159,7 +159,7 @@ export function validateTimezone(tz: string): void {
159
159
  }
160
160
  try {
161
161
  // `Intl.DateTimeFormat` throws `RangeError` for unknown zones.
162
- new Intl.DateTimeFormat("en-US", { timeZone: tz });
162
+ Intl.DateTimeFormat("en-US", { timeZone: tz });
163
163
  } catch {
164
164
  throw new Error(
165
165
  `[@mandujs/core/scheduler] unknown IANA timezone "${tz}". ` +