@mandujs/core 0.12.2 → 0.13.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.
- package/README.ko.md +304 -304
- package/package.json +1 -1
- package/src/brain/architecture/analyzer.ts +28 -26
- package/src/brain/doctor/analyzer.ts +1 -1
- package/src/bundler/dev.ts +0 -1
- package/src/change/history.ts +3 -3
- package/src/change/snapshot.ts +10 -9
- package/src/change/transaction.ts +2 -2
- package/src/config/mandu.ts +103 -96
- package/src/config/validate.ts +225 -215
- package/src/error/classifier.ts +2 -2
- package/src/error/formatter.ts +32 -32
- package/src/error/stack-analyzer.ts +5 -0
- package/src/filling/context.ts +592 -569
- package/src/filling/index.ts +2 -0
- package/src/filling/sse.test.ts +168 -0
- package/src/filling/sse.ts +162 -0
- package/src/generator/contract-glue.ts +2 -1
- package/src/generator/generate.ts +12 -10
- package/src/generator/templates.ts +80 -79
- package/src/guard/auto-correct.ts +1 -1
- package/src/guard/check.ts +128 -128
- package/src/guard/presets/cqrs.test.ts +35 -14
- package/src/index.ts +7 -1
- package/src/paths.test.ts +47 -0
- package/src/paths.ts +47 -0
- package/src/report/build.ts +1 -1
- package/src/router/fs-routes.ts +344 -401
- package/src/router/fs-types.ts +270 -278
- package/src/router/index.ts +81 -81
- package/src/runtime/escape.ts +44 -0
- package/src/runtime/server.ts +281 -24
- package/src/runtime/ssr.ts +362 -367
- package/src/runtime/streaming-ssr.ts +1236 -1245
- package/src/watcher/rules.ts +5 -5
package/src/config/validate.ts
CHANGED
|
@@ -1,215 +1,225 @@
|
|
|
1
|
-
import { z, ZodError, ZodIssueCode } from "zod";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { pathToFileURL } from "url";
|
|
4
|
-
import { CONFIG_FILES, coerceConfig } from "./mandu";
|
|
5
|
-
import { readJsonFile } from "../utils/bun";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* DNA-003: Strict mode schema helper
|
|
9
|
-
*
|
|
10
|
-
* Creates a schema that warns about unknown keys instead of failing
|
|
11
|
-
* This provides the benefits of .strict() while maintaining compatibility
|
|
12
|
-
*/
|
|
13
|
-
function strictWithWarnings<T extends z.ZodRawShape>(
|
|
14
|
-
schema: z.ZodObject<T>,
|
|
15
|
-
schemaName: string
|
|
16
|
-
): z.ZodObject<T> {
|
|
17
|
-
return schema.superRefine((data, ctx) => {
|
|
18
|
-
if (typeof data !== "object" || data === null) return;
|
|
19
|
-
|
|
20
|
-
const knownKeys = new Set(Object.keys(schema.shape));
|
|
21
|
-
const unknownKeys = Object.keys(data).filter((key) => !knownKeys.has(key));
|
|
22
|
-
|
|
23
|
-
if (unknownKeys.length > 0 && process.env.MANDU_STRICT !== "0") {
|
|
24
|
-
// In strict mode (default), add warnings to issues
|
|
25
|
-
for (const key of unknownKeys) {
|
|
26
|
-
ctx.addIssue({
|
|
27
|
-
code: ZodIssueCode.unrecognized_keys,
|
|
28
|
-
keys: [key],
|
|
29
|
-
message: `Unknown key '${key}' in ${schemaName}. Did you mean one of: ${[...knownKeys].join(", ")}?`,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Server 설정 스키마 (strict)
|
|
38
|
-
*/
|
|
39
|
-
const ServerConfigSchema = z
|
|
40
|
-
.object({
|
|
41
|
-
port: z.number().min(1).max(65535).default(3000),
|
|
42
|
-
hostname: z.string().default("localhost"),
|
|
43
|
-
cors: z
|
|
44
|
-
.union([
|
|
45
|
-
z.boolean(),
|
|
46
|
-
z.object({
|
|
47
|
-
origin: z.union([z.string(), z.array(z.string())]).optional(),
|
|
48
|
-
methods: z.array(z.string()).optional(),
|
|
49
|
-
credentials: z.boolean().optional(),
|
|
50
|
-
}).strict(),
|
|
51
|
-
])
|
|
52
|
-
.default(false),
|
|
53
|
-
streaming: z.boolean().default(false),
|
|
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
|
-
.strict();
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
*/
|
|
85
|
-
const
|
|
86
|
-
.object({
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
1
|
+
import { z, ZodError, ZodIssueCode } from "zod";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { pathToFileURL } from "url";
|
|
4
|
+
import { CONFIG_FILES, coerceConfig } from "./mandu";
|
|
5
|
+
import { readJsonFile } from "../utils/bun";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* DNA-003: Strict mode schema helper
|
|
9
|
+
*
|
|
10
|
+
* Creates a schema that warns about unknown keys instead of failing
|
|
11
|
+
* This provides the benefits of .strict() while maintaining compatibility
|
|
12
|
+
*/
|
|
13
|
+
function strictWithWarnings<T extends z.ZodRawShape>(
|
|
14
|
+
schema: z.ZodObject<T>,
|
|
15
|
+
schemaName: string
|
|
16
|
+
): z.ZodObject<T> {
|
|
17
|
+
return schema.superRefine((data, ctx) => {
|
|
18
|
+
if (typeof data !== "object" || data === null) return;
|
|
19
|
+
|
|
20
|
+
const knownKeys = new Set(Object.keys(schema.shape));
|
|
21
|
+
const unknownKeys = Object.keys(data).filter((key) => !knownKeys.has(key));
|
|
22
|
+
|
|
23
|
+
if (unknownKeys.length > 0 && process.env.MANDU_STRICT !== "0") {
|
|
24
|
+
// In strict mode (default), add warnings to issues
|
|
25
|
+
for (const key of unknownKeys) {
|
|
26
|
+
ctx.addIssue({
|
|
27
|
+
code: ZodIssueCode.unrecognized_keys,
|
|
28
|
+
keys: [key],
|
|
29
|
+
message: `Unknown key '${key}' in ${schemaName}. Did you mean one of: ${[...knownKeys].join(", ")}?`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Server 설정 스키마 (strict)
|
|
38
|
+
*/
|
|
39
|
+
const ServerConfigSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
port: z.number().min(1).max(65535).default(3000),
|
|
42
|
+
hostname: z.string().default("localhost"),
|
|
43
|
+
cors: z
|
|
44
|
+
.union([
|
|
45
|
+
z.boolean(),
|
|
46
|
+
z.object({
|
|
47
|
+
origin: z.union([z.string(), z.array(z.string())]).optional(),
|
|
48
|
+
methods: z.array(z.string()).optional(),
|
|
49
|
+
credentials: z.boolean().optional(),
|
|
50
|
+
}).strict(),
|
|
51
|
+
])
|
|
52
|
+
.default(false),
|
|
53
|
+
streaming: z.boolean().default(false),
|
|
54
|
+
rateLimit: z
|
|
55
|
+
.union([
|
|
56
|
+
z.boolean(),
|
|
57
|
+
z.object({
|
|
58
|
+
windowMs: z.number().int().positive().optional(),
|
|
59
|
+
max: z.number().int().positive().optional(),
|
|
60
|
+
message: z.string().min(1).optional(),
|
|
61
|
+
statusCode: z.number().int().min(400).max(599).optional(),
|
|
62
|
+
headers: z.boolean().optional(),
|
|
63
|
+
}).strict(),
|
|
64
|
+
])
|
|
65
|
+
.default(false),
|
|
66
|
+
})
|
|
67
|
+
.strict();
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Guard 설정 스키마 (strict)
|
|
71
|
+
*/
|
|
72
|
+
const GuardConfigSchema = z
|
|
73
|
+
.object({
|
|
74
|
+
preset: z.enum(["mandu", "fsd", "clean", "hexagonal", "atomic"]).default("mandu"),
|
|
75
|
+
srcDir: z.string().default("src"),
|
|
76
|
+
exclude: z.array(z.string()).default([]),
|
|
77
|
+
realtime: z.boolean().default(true),
|
|
78
|
+
rules: z.record(z.enum(["error", "warn", "warning", "off"])).optional(),
|
|
79
|
+
})
|
|
80
|
+
.strict();
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Build 설정 스키마 (strict)
|
|
84
|
+
*/
|
|
85
|
+
const BuildConfigSchema = z
|
|
86
|
+
.object({
|
|
87
|
+
outDir: z.string().default(".mandu"),
|
|
88
|
+
minify: z.boolean().default(true),
|
|
89
|
+
sourcemap: z.boolean().default(false),
|
|
90
|
+
splitting: z.boolean().default(false),
|
|
91
|
+
})
|
|
92
|
+
.strict();
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Dev 설정 스키마 (strict)
|
|
96
|
+
*/
|
|
97
|
+
const DevConfigSchema = z
|
|
98
|
+
.object({
|
|
99
|
+
hmr: z.boolean().default(true),
|
|
100
|
+
watchDirs: z.array(z.string()).default([]),
|
|
101
|
+
})
|
|
102
|
+
.strict();
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* FS Routes 설정 스키마 (strict)
|
|
106
|
+
*/
|
|
107
|
+
const FsRoutesConfigSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
routesDir: z.string().default("app"),
|
|
110
|
+
extensions: z.array(z.string()).default([".tsx", ".ts", ".jsx", ".js"]),
|
|
111
|
+
exclude: z.array(z.string()).default([]),
|
|
112
|
+
islandSuffix: z.string().default(".island"),
|
|
113
|
+
})
|
|
114
|
+
.strict();
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* SEO 설정 스키마 (strict)
|
|
118
|
+
*/
|
|
119
|
+
const SeoConfigSchema = z
|
|
120
|
+
.object({
|
|
121
|
+
enabled: z.boolean().default(true),
|
|
122
|
+
defaultTitle: z.string().optional(),
|
|
123
|
+
titleTemplate: z.string().optional(),
|
|
124
|
+
})
|
|
125
|
+
.strict();
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Mandu 설정 스키마 (DNA-003: strict mode)
|
|
129
|
+
*
|
|
130
|
+
* 알 수 없는 키가 있으면 오류 발생 → 오타 즉시 감지
|
|
131
|
+
* MANDU_STRICT=0 으로 비활성화 가능
|
|
132
|
+
*/
|
|
133
|
+
export const ManduConfigSchema = z
|
|
134
|
+
.object({
|
|
135
|
+
server: ServerConfigSchema.default({}),
|
|
136
|
+
guard: GuardConfigSchema.default({}),
|
|
137
|
+
build: BuildConfigSchema.default({}),
|
|
138
|
+
dev: DevConfigSchema.default({}),
|
|
139
|
+
fsRoutes: FsRoutesConfigSchema.default({}),
|
|
140
|
+
seo: SeoConfigSchema.default({}),
|
|
141
|
+
})
|
|
142
|
+
.strict();
|
|
143
|
+
|
|
144
|
+
export type ValidatedManduConfig = z.infer<typeof ManduConfigSchema>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 검증 결과
|
|
148
|
+
*/
|
|
149
|
+
export interface ValidationResult {
|
|
150
|
+
valid: boolean;
|
|
151
|
+
config?: ValidatedManduConfig;
|
|
152
|
+
errors?: Array<{
|
|
153
|
+
path: string;
|
|
154
|
+
message: string;
|
|
155
|
+
}>;
|
|
156
|
+
source?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 설정 파일 검증
|
|
161
|
+
*/
|
|
162
|
+
export async function validateConfig(rootDir: string): Promise<ValidationResult> {
|
|
163
|
+
for (const fileName of CONFIG_FILES) {
|
|
164
|
+
const filePath = path.join(rootDir, fileName);
|
|
165
|
+
if (!(await Bun.file(filePath).exists())) {
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
let raw: unknown;
|
|
171
|
+
if (fileName.endsWith(".json")) {
|
|
172
|
+
raw = await readJsonFile(filePath);
|
|
173
|
+
} else {
|
|
174
|
+
const module = await import(pathToFileURL(filePath).href);
|
|
175
|
+
raw = module?.default ?? module;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const config = ManduConfigSchema.parse(coerceConfig(raw ?? {}, fileName));
|
|
179
|
+
return { valid: true, config, source: fileName };
|
|
180
|
+
} catch (error) {
|
|
181
|
+
if (error instanceof ZodError) {
|
|
182
|
+
const errors = error.errors.map((e) => ({
|
|
183
|
+
path: e.path.join("."),
|
|
184
|
+
message: e.message,
|
|
185
|
+
}));
|
|
186
|
+
return { valid: false, errors, source: fileName };
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
valid: false,
|
|
191
|
+
errors: [
|
|
192
|
+
{
|
|
193
|
+
path: "",
|
|
194
|
+
message: `Failed to load config: ${
|
|
195
|
+
error instanceof Error ? error.message : String(error)
|
|
196
|
+
}`,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
source: fileName,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// 설정 파일 없음 - 기본값 사용
|
|
205
|
+
return { valid: true, config: ManduConfigSchema.parse({}) };
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* CLI용 검증 및 리포트
|
|
210
|
+
*/
|
|
211
|
+
export async function validateAndReport(rootDir: string): Promise<ValidatedManduConfig | null> {
|
|
212
|
+
const result = await validateConfig(rootDir);
|
|
213
|
+
|
|
214
|
+
if (!result.valid) {
|
|
215
|
+
console.error(`\n❌ Invalid config${result.source ? ` (${result.source})` : ""}:\n`);
|
|
216
|
+
for (const error of result.errors || []) {
|
|
217
|
+
const location = error.path ? ` ${error.path}: ` : " ";
|
|
218
|
+
console.error(`${location}${error.message}`);
|
|
219
|
+
}
|
|
220
|
+
console.error("");
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return result.config!;
|
|
225
|
+
}
|
package/src/error/classifier.ts
CHANGED
|
@@ -95,7 +95,7 @@ export class ErrorClassifier {
|
|
|
95
95
|
case "spec":
|
|
96
96
|
errorType = "SPEC_ERROR";
|
|
97
97
|
code = ErrorCode.SPEC_VALIDATION_ERROR;
|
|
98
|
-
fixFile = blameFrame?.file || "
|
|
98
|
+
fixFile = blameFrame?.file || ".mandu/routes.manifest.json";
|
|
99
99
|
suggestion = "Spec 파일의 JSON 구문 또는 스키마를 확인하세요";
|
|
100
100
|
break;
|
|
101
101
|
|
|
@@ -258,7 +258,7 @@ export class ErrorClassifier {
|
|
|
258
258
|
export function createSpecError(
|
|
259
259
|
code: ErrorCode,
|
|
260
260
|
message: string,
|
|
261
|
-
file: string = "
|
|
261
|
+
file: string = ".mandu/routes.manifest.json",
|
|
262
262
|
suggestion?: string
|
|
263
263
|
): ManduError {
|
|
264
264
|
return {
|
package/src/error/formatter.ts
CHANGED
|
@@ -105,14 +105,14 @@ export function createNotFoundResponse(
|
|
|
105
105
|
pathname: string,
|
|
106
106
|
routeContext?: RouteContext
|
|
107
107
|
): ManduError {
|
|
108
|
-
return {
|
|
109
|
-
errorType: "SPEC_ERROR",
|
|
110
|
-
code: ErrorCode.SPEC_ROUTE_NOT_FOUND,
|
|
111
|
-
httpStatus: 404,
|
|
112
|
-
message: `Route not found: ${pathname}`,
|
|
113
|
-
summary: "라우트 없음 - spec 파일에 추가 필요",
|
|
114
|
-
fix: {
|
|
115
|
-
file: "
|
|
108
|
+
return {
|
|
109
|
+
errorType: "SPEC_ERROR",
|
|
110
|
+
code: ErrorCode.SPEC_ROUTE_NOT_FOUND,
|
|
111
|
+
httpStatus: 404,
|
|
112
|
+
message: `Route not found: ${pathname}`,
|
|
113
|
+
summary: "라우트 없음 - spec 파일에 추가 필요",
|
|
114
|
+
fix: {
|
|
115
|
+
file: ".mandu/routes.manifest.json",
|
|
116
116
|
suggestion: `'${pathname}' 패턴의 라우트를 추가하세요`,
|
|
117
117
|
},
|
|
118
118
|
route: routeContext,
|
|
@@ -127,14 +127,14 @@ export function createHandlerNotFoundResponse(
|
|
|
127
127
|
routeId: string,
|
|
128
128
|
pattern: string
|
|
129
129
|
): ManduError {
|
|
130
|
-
return {
|
|
131
|
-
errorType: "FRAMEWORK_BUG",
|
|
132
|
-
code: ErrorCode.FRAMEWORK_ROUTER_ERROR,
|
|
133
|
-
httpStatus: 500,
|
|
134
|
-
message: `Handler not registered for route: ${routeId}`,
|
|
135
|
-
summary: "핸들러 미등록 - generate 재실행 필요",
|
|
136
|
-
fix: {
|
|
137
|
-
file:
|
|
130
|
+
return {
|
|
131
|
+
errorType: "FRAMEWORK_BUG",
|
|
132
|
+
code: ErrorCode.FRAMEWORK_ROUTER_ERROR,
|
|
133
|
+
httpStatus: 500,
|
|
134
|
+
message: `Handler not registered for route: ${routeId}`,
|
|
135
|
+
summary: "핸들러 미등록 - generate 재실행 필요",
|
|
136
|
+
fix: {
|
|
137
|
+
file: `.mandu/generated/server/routes/${routeId}.route.ts`,
|
|
138
138
|
suggestion: "bunx mandu generate를 실행하세요",
|
|
139
139
|
},
|
|
140
140
|
route: {
|
|
@@ -153,14 +153,14 @@ export function createPageLoadErrorResponse(
|
|
|
153
153
|
pattern: string,
|
|
154
154
|
originalError?: Error
|
|
155
155
|
): ManduError {
|
|
156
|
-
const error: ManduError = {
|
|
157
|
-
errorType: "LOGIC_ERROR",
|
|
158
|
-
code: ErrorCode.SLOT_IMPORT_ERROR,
|
|
159
|
-
httpStatus: 500,
|
|
160
|
-
message: originalError?.message || `Failed to load page module for route: ${routeId}`,
|
|
161
|
-
summary: `페이지 모듈 로드 실패 - ${routeId}.route.tsx 확인 필요`,
|
|
162
|
-
fix: {
|
|
163
|
-
file:
|
|
156
|
+
const error: ManduError = {
|
|
157
|
+
errorType: "LOGIC_ERROR",
|
|
158
|
+
code: ErrorCode.SLOT_IMPORT_ERROR,
|
|
159
|
+
httpStatus: 500,
|
|
160
|
+
message: originalError?.message || `Failed to load page module for route: ${routeId}`,
|
|
161
|
+
summary: `페이지 모듈 로드 실패 - ${routeId}.route.tsx 확인 필요`,
|
|
162
|
+
fix: {
|
|
163
|
+
file: `.mandu/generated/web/routes/${routeId}.route.tsx`,
|
|
164
164
|
suggestion: "import 경로와 컴포넌트 export를 확인하세요",
|
|
165
165
|
},
|
|
166
166
|
route: {
|
|
@@ -189,14 +189,14 @@ export function createSSRErrorResponse(
|
|
|
189
189
|
pattern: string,
|
|
190
190
|
originalError?: Error
|
|
191
191
|
): ManduError {
|
|
192
|
-
const error: ManduError = {
|
|
193
|
-
errorType: "FRAMEWORK_BUG",
|
|
194
|
-
code: ErrorCode.FRAMEWORK_SSR_ERROR,
|
|
195
|
-
httpStatus: 500,
|
|
196
|
-
message: originalError?.message || `SSR rendering failed for route: ${routeId}`,
|
|
197
|
-
summary: `SSR 렌더링 실패 - 컴포넌트 확인 필요`,
|
|
198
|
-
fix: {
|
|
199
|
-
file:
|
|
192
|
+
const error: ManduError = {
|
|
193
|
+
errorType: "FRAMEWORK_BUG",
|
|
194
|
+
code: ErrorCode.FRAMEWORK_SSR_ERROR,
|
|
195
|
+
httpStatus: 500,
|
|
196
|
+
message: originalError?.message || `SSR rendering failed for route: ${routeId}`,
|
|
197
|
+
summary: `SSR 렌더링 실패 - 컴포넌트 확인 필요`,
|
|
198
|
+
fix: {
|
|
199
|
+
file: `.mandu/generated/web/routes/${routeId}.route.tsx`,
|
|
200
200
|
suggestion: "React 컴포넌트가 서버에서 렌더링 가능한지 확인하세요 (브라우저 전용 API 사용 금지)",
|
|
201
201
|
},
|
|
202
202
|
route: {
|
|
@@ -183,6 +183,11 @@ export class StackTraceAnalyzer {
|
|
|
183
183
|
isSpecFile(file: string): boolean {
|
|
184
184
|
const normalized = this.normalizePath(file);
|
|
185
185
|
|
|
186
|
+
// .mandu/ 디렉토리 내 생성된 매니페스트/락 파일
|
|
187
|
+
if (normalized.startsWith(".mandu/") && normalized.endsWith(".json")) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
|
|
186
191
|
// spec/ 디렉토리 내 JSON 파일
|
|
187
192
|
if (normalized.startsWith("spec/") && normalized.endsWith(".json")) {
|
|
188
193
|
return true;
|