@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,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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
+
}
|