@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,4 +1,5 @@
1
- import { z, type ZodTypeAny } from "zod";
1
+ import type { z} from "zod";
2
+ import { type ZodTypeAny } from "zod";
2
3
 
3
4
  export type ApiErrorCode = string;
4
5
 
@@ -1,155 +1,158 @@
1
- /**
2
- * Zod Internal Access Utilities
3
- *
4
- * Zod 스키마의 내부 `_def` 속성에 접근하는 로직을 중앙화합니다.
5
- * `as any` 캐스팅은 이 파일 내부에만 존재하며,
6
- * 외부에는 타입 안전한 API만 노출합니다.
7
- */
8
-
9
- import type { ZodTypeAny } from "zod";
10
-
11
- // ============================================================================
12
- // Internal _def access (as any is confined here)
13
- // ============================================================================
14
-
15
- interface ZodDef {
16
- typeName: string;
17
- innerType?: ZodTypeAny;
18
- type?: ZodTypeAny;
19
- schema?: ZodTypeAny;
20
- shape?: () => Record<string, ZodTypeAny>;
21
- checks?: ReadonlyArray<{ kind: string; value?: number; inclusive?: boolean; regex?: RegExp }>;
22
- values?: readonly unknown[];
23
- options?: readonly ZodTypeAny[];
24
- value?: unknown;
25
- defaultValue?: () => unknown;
26
- description?: string;
27
- }
28
-
29
- /**
30
- * Zod 스키마의 내부 _def 속성을 안전하게 추출합니다.
31
- */
32
- function getDef(schema: ZodTypeAny): ZodDef {
33
- return (schema as any)._def;
34
- }
35
-
36
- // ============================================================================
37
- // Type Name
38
- // ============================================================================
39
-
40
- /** Zod 스키마의 typeName을 반환합니다. */
41
- export function getZodTypeName(schema: ZodTypeAny): string {
42
- return getDef(schema).typeName;
43
- }
44
-
45
- // ============================================================================
46
- // Inner Type Access
47
- // ============================================================================
48
-
49
- /**
50
- * ZodOptional, ZodNullable, ZodDefault 등 래퍼 스키마의 내부 타입을 반환합니다.
51
- * `_def.innerType`에 해당합니다.
52
- */
53
- export function getZodInnerType(schema: ZodTypeAny): ZodTypeAny | undefined {
54
- return getDef(schema).innerType;
55
- }
56
-
57
- /**
58
- * ZodArray의 요소 타입을 반환합니다.
59
- * `_def.type`에 해당합니다.
60
- */
61
- export function getZodArrayElementType(schema: ZodTypeAny): ZodTypeAny | undefined {
62
- return getDef(schema).type;
63
- }
64
-
65
- /**
66
- * ZodEffects의 내부 스키마를 반환합니다.
67
- * `_def.schema`에 해당합니다.
68
- */
69
- export function getZodEffectsSchema(schema: ZodTypeAny): ZodTypeAny | undefined {
70
- return getDef(schema).schema;
71
- }
72
-
73
- // ============================================================================
74
- // Object Shape
75
- // ============================================================================
76
-
77
- /**
78
- * ZodObject의 shape를 반환합니다.
79
- * `_def.shape()`에 해당합니다.
80
- */
81
- export function getZodObjectShape(schema: ZodTypeAny): Record<string, ZodTypeAny> | undefined {
82
- const def = getDef(schema);
83
- return typeof def.shape === "function" ? def.shape() : undefined;
84
- }
85
-
86
- // ============================================================================
87
- // Checks (validation rules)
88
- // ============================================================================
89
-
90
- interface ZodCheck {
91
- kind: string;
92
- value?: number;
93
- inclusive?: boolean;
94
- regex?: RegExp;
95
- }
96
-
97
- /**
98
- * ZodString, ZodNumber 등의 validation checks를 반환합니다.
99
- * `_def.checks`에 해당합니다.
100
- */
101
- export function getZodChecks(schema: ZodTypeAny): readonly ZodCheck[] {
102
- return getDef(schema).checks ?? [];
103
- }
104
-
105
- // ============================================================================
106
- // Enum / Literal / Union
107
- // ============================================================================
108
-
109
- /** ZodEnum의 values를 반환합니다. */
110
- export function getZodEnumValues(schema: ZodTypeAny): readonly unknown[] | undefined {
111
- return getDef(schema).values;
112
- }
113
-
114
- /** ZodUnion의 options를 반환합니다. */
115
- export function getZodUnionOptions(schema: ZodTypeAny): readonly ZodTypeAny[] | undefined {
116
- return getDef(schema).options;
117
- }
118
-
119
- /** ZodLiteral의 value를 반환합니다. */
120
- export function getZodLiteralValue(schema: ZodTypeAny): unknown {
121
- return getDef(schema).value;
122
- }
123
-
124
- // ============================================================================
125
- // Default Value
126
- // ============================================================================
127
-
128
- /**
129
- * ZodDefault의 기본값을 반환합니다.
130
- * `_def.defaultValue()`에 해당합니다.
131
- */
132
- export function getZodDefaultValue(schema: ZodTypeAny): unknown {
133
- const fn = getDef(schema).defaultValue;
134
- return typeof fn === "function" ? fn() : undefined;
135
- }
136
-
137
- // ============================================================================
138
- // Type Predicates
139
- // ============================================================================
140
-
141
- /** 스키마가 ZodOptional인지 확인합니다. */
142
- export function isZodOptional(schema: ZodTypeAny): boolean {
143
- return getZodTypeName(schema) === "ZodOptional";
144
- }
145
-
146
- /** 스키마가 ZodDefault인지 확인합니다. */
147
- export function isZodDefault(schema: ZodTypeAny): boolean {
148
- return getZodTypeName(schema) === "ZodDefault";
149
- }
150
-
151
- /** 필드가 required인지 확인합니다 (Optional/Default가 아닌 경우). */
152
- export function isZodRequired(schema: ZodTypeAny): boolean {
153
- const typeName = getZodTypeName(schema);
154
- return typeName !== "ZodOptional" && typeName !== "ZodDefault";
155
- }
1
+ /**
2
+ * Zod Internal Access Utilities
3
+ *
4
+ * Zod 스키마의 내부 `_def` 속성에 접근하는 로직을 중앙화합니다.
5
+ * `as any` 캐스팅은 이 파일 내부에만 존재하며,
6
+ * 외부에는 타입 안전한 API만 노출합니다.
7
+ */
8
+
9
+ import type { ZodTypeAny } from "zod";
10
+
11
+ // ============================================================================
12
+ // Internal _def access (as any is confined here)
13
+ // ============================================================================
14
+
15
+ interface ZodDef {
16
+ typeName: string;
17
+ innerType?: ZodTypeAny;
18
+ type?: ZodTypeAny;
19
+ schema?: ZodTypeAny;
20
+ shape?: () => Record<string, ZodTypeAny>;
21
+ checks?: ReadonlyArray<{ kind: string; value?: number; inclusive?: boolean; regex?: RegExp }>;
22
+ values?: readonly unknown[];
23
+ options?: readonly ZodTypeAny[];
24
+ value?: unknown;
25
+ defaultValue?: () => unknown;
26
+ description?: string;
27
+ }
28
+
29
+ /**
30
+ * Zod 스키마의 내부 _def 속성을 안전하게 추출합니다.
31
+ * `_def` is Zod's documented-but-internal introspection field and is not
32
+ * part of the public `ZodTypeAny` type. A narrow `{ _def: ZodDef }` cast
33
+ * keeps the escape hatch localised without relying on `any`.
34
+ */
35
+ function getDef(schema: ZodTypeAny): ZodDef {
36
+ return (schema as unknown as { _def: ZodDef })._def;
37
+ }
38
+
39
+ // ============================================================================
40
+ // Type Name
41
+ // ============================================================================
42
+
43
+ /** Zod 스키마의 typeName을 반환합니다. */
44
+ export function getZodTypeName(schema: ZodTypeAny): string {
45
+ return getDef(schema).typeName;
46
+ }
47
+
48
+ // ============================================================================
49
+ // Inner Type Access
50
+ // ============================================================================
51
+
52
+ /**
53
+ * ZodOptional, ZodNullable, ZodDefault 래퍼 스키마의 내부 타입을 반환합니다.
54
+ * `_def.innerType`에 해당합니다.
55
+ */
56
+ export function getZodInnerType(schema: ZodTypeAny): ZodTypeAny | undefined {
57
+ return getDef(schema).innerType;
58
+ }
59
+
60
+ /**
61
+ * ZodArray의 요소 타입을 반환합니다.
62
+ * `_def.type`에 해당합니다.
63
+ */
64
+ export function getZodArrayElementType(schema: ZodTypeAny): ZodTypeAny | undefined {
65
+ return getDef(schema).type;
66
+ }
67
+
68
+ /**
69
+ * ZodEffects의 내부 스키마를 반환합니다.
70
+ * `_def.schema`에 해당합니다.
71
+ */
72
+ export function getZodEffectsSchema(schema: ZodTypeAny): ZodTypeAny | undefined {
73
+ return getDef(schema).schema;
74
+ }
75
+
76
+ // ============================================================================
77
+ // Object Shape
78
+ // ============================================================================
79
+
80
+ /**
81
+ * ZodObject의 shape를 반환합니다.
82
+ * `_def.shape()`에 해당합니다.
83
+ */
84
+ export function getZodObjectShape(schema: ZodTypeAny): Record<string, ZodTypeAny> | undefined {
85
+ const def = getDef(schema);
86
+ return typeof def.shape === "function" ? def.shape() : undefined;
87
+ }
88
+
89
+ // ============================================================================
90
+ // Checks (validation rules)
91
+ // ============================================================================
92
+
93
+ interface ZodCheck {
94
+ kind: string;
95
+ value?: number;
96
+ inclusive?: boolean;
97
+ regex?: RegExp;
98
+ }
99
+
100
+ /**
101
+ * ZodString, ZodNumber 등의 validation checks를 반환합니다.
102
+ * `_def.checks`에 해당합니다.
103
+ */
104
+ export function getZodChecks(schema: ZodTypeAny): readonly ZodCheck[] {
105
+ return getDef(schema).checks ?? [];
106
+ }
107
+
108
+ // ============================================================================
109
+ // Enum / Literal / Union
110
+ // ============================================================================
111
+
112
+ /** ZodEnum의 values를 반환합니다. */
113
+ export function getZodEnumValues(schema: ZodTypeAny): readonly unknown[] | undefined {
114
+ return getDef(schema).values;
115
+ }
116
+
117
+ /** ZodUnion의 options를 반환합니다. */
118
+ export function getZodUnionOptions(schema: ZodTypeAny): readonly ZodTypeAny[] | undefined {
119
+ return getDef(schema).options;
120
+ }
121
+
122
+ /** ZodLiteral의 value를 반환합니다. */
123
+ export function getZodLiteralValue(schema: ZodTypeAny): unknown {
124
+ return getDef(schema).value;
125
+ }
126
+
127
+ // ============================================================================
128
+ // Default Value
129
+ // ============================================================================
130
+
131
+ /**
132
+ * ZodDefault의 기본값을 반환합니다.
133
+ * `_def.defaultValue()`에 해당합니다.
134
+ */
135
+ export function getZodDefaultValue(schema: ZodTypeAny): unknown {
136
+ const fn = getDef(schema).defaultValue;
137
+ return typeof fn === "function" ? fn() : undefined;
138
+ }
139
+
140
+ // ============================================================================
141
+ // Type Predicates
142
+ // ============================================================================
143
+
144
+ /** 스키마가 ZodOptional인지 확인합니다. */
145
+ export function isZodOptional(schema: ZodTypeAny): boolean {
146
+ return getZodTypeName(schema) === "ZodOptional";
147
+ }
148
+
149
+ /** 스키마가 ZodDefault인지 확인합니다. */
150
+ export function isZodDefault(schema: ZodTypeAny): boolean {
151
+ return getZodTypeName(schema) === "ZodDefault";
152
+ }
153
+
154
+ /** 필드가 required인지 확인합니다 (Optional/Default가 아닌 경우). */
155
+ export function isZodRequired(schema: ZodTypeAny): boolean {
156
+ const typeName = getZodTypeName(schema);
157
+ return typeName !== "ZodOptional" && typeName !== "ZodDefault";
158
+ }