@mandujs/core 0.18.22 → 0.19.2
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 +0 -14
- package/package.json +4 -1
- package/src/brain/architecture/analyzer.ts +4 -4
- package/src/brain/doctor/analyzer.ts +18 -14
- package/src/bundler/build.test.ts +127 -0
- package/src/bundler/build.ts +291 -113
- package/src/bundler/css.ts +20 -5
- package/src/bundler/dev.ts +55 -2
- package/src/bundler/prerender.ts +195 -0
- package/src/change/snapshot.ts +4 -23
- package/src/change/types.ts +2 -3
- package/src/client/Form.tsx +105 -0
- package/src/client/__tests__/use-sse.test.ts +153 -0
- package/src/client/hooks.ts +105 -6
- package/src/client/index.ts +35 -6
- package/src/client/router.ts +670 -433
- package/src/client/rpc.ts +140 -0
- package/src/client/runtime.ts +24 -21
- package/src/client/use-fetch.ts +239 -0
- package/src/client/use-head.ts +197 -0
- package/src/client/use-sse.ts +378 -0
- package/src/components/Image.tsx +162 -0
- package/src/config/mandu.ts +5 -0
- package/src/config/validate.ts +34 -0
- package/src/content/index.ts +5 -1
- package/src/devtools/client/catchers/error-catcher.ts +17 -0
- package/src/devtools/client/catchers/network-proxy.ts +390 -367
- package/src/devtools/client/components/kitchen-root.tsx +479 -467
- package/src/devtools/client/components/panel/diff-viewer.tsx +219 -0
- package/src/devtools/client/components/panel/guard-panel.tsx +374 -244
- package/src/devtools/client/components/panel/index.ts +45 -32
- package/src/devtools/client/components/panel/panel-container.tsx +332 -312
- package/src/devtools/client/components/panel/preview-panel.tsx +188 -0
- package/src/devtools/client/state-manager.ts +535 -478
- package/src/devtools/design-tokens.ts +265 -264
- package/src/devtools/types.ts +345 -319
- package/src/filling/context.ts +65 -0
- package/src/filling/filling.ts +336 -14
- package/src/filling/index.ts +5 -1
- package/src/filling/session.ts +216 -0
- package/src/filling/ws.ts +78 -0
- package/src/generator/generate.ts +2 -2
- package/src/guard/auto-correct.ts +0 -29
- package/src/guard/check.ts +14 -31
- package/src/guard/presets/index.ts +296 -294
- package/src/guard/rules.ts +15 -19
- package/src/guard/validator.ts +834 -834
- package/src/index.ts +5 -1
- package/src/island/index.ts +373 -304
- package/src/kitchen/api/contract-api.ts +225 -0
- package/src/kitchen/api/diff-parser.ts +108 -0
- package/src/kitchen/api/file-api.ts +273 -0
- package/src/kitchen/api/guard-api.ts +83 -0
- package/src/kitchen/api/guard-decisions.ts +100 -0
- package/src/kitchen/api/routes-api.ts +50 -0
- package/src/kitchen/index.ts +21 -0
- package/src/kitchen/kitchen-handler.ts +256 -0
- package/src/kitchen/kitchen-ui.ts +1732 -0
- package/src/kitchen/stream/activity-sse.ts +145 -0
- package/src/kitchen/stream/file-tailer.ts +99 -0
- package/src/middleware/compress.ts +62 -0
- package/src/middleware/cors.ts +47 -0
- package/src/middleware/index.ts +10 -0
- package/src/middleware/jwt.ts +134 -0
- package/src/middleware/logger.ts +58 -0
- package/src/middleware/timeout.ts +55 -0
- package/src/paths.ts +0 -4
- package/src/plugins/hooks.ts +64 -0
- package/src/plugins/index.ts +3 -0
- package/src/plugins/types.ts +5 -0
- package/src/report/build.ts +0 -6
- package/src/resource/__tests__/backward-compat.test.ts +0 -1
- package/src/router/fs-patterns.ts +11 -1
- package/src/router/fs-routes.ts +78 -14
- package/src/router/fs-scanner.ts +2 -2
- package/src/router/fs-types.ts +2 -1
- package/src/runtime/adapter-bun.ts +62 -0
- package/src/runtime/adapter.ts +47 -0
- package/src/runtime/cache.ts +310 -0
- package/src/runtime/handler.ts +65 -0
- package/src/runtime/image-handler.ts +195 -0
- package/src/runtime/index.ts +12 -0
- package/src/runtime/middleware.ts +263 -0
- package/src/runtime/server.ts +686 -92
- package/src/runtime/ssr.ts +55 -29
- package/src/runtime/streaming-ssr.ts +106 -82
- package/src/spec/index.ts +0 -1
- package/src/spec/schema.ts +1 -0
- package/src/testing/index.ts +144 -0
- package/src/watcher/watcher.ts +27 -1
- package/src/spec/lock.ts +0 -56
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mandu Kitchen DevTools - Diff Viewer
|
|
3
|
+
* @version 2.0.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { colors, typography, spacing, borderRadius, animation } from '../../../design-tokens';
|
|
8
|
+
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Types
|
|
11
|
+
// ============================================================================
|
|
12
|
+
|
|
13
|
+
export interface DiffLine {
|
|
14
|
+
type: 'add' | 'remove' | 'context';
|
|
15
|
+
content: string;
|
|
16
|
+
oldLine?: number;
|
|
17
|
+
newLine?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface DiffHunk {
|
|
21
|
+
header: string;
|
|
22
|
+
lines: DiffLine[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface FileDiff {
|
|
26
|
+
filePath: string;
|
|
27
|
+
hunks: DiffHunk[];
|
|
28
|
+
additions: number;
|
|
29
|
+
deletions: number;
|
|
30
|
+
isNew: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface DiffViewerProps {
|
|
34
|
+
diff: FileDiff;
|
|
35
|
+
onClose: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// Styles
|
|
40
|
+
// ============================================================================
|
|
41
|
+
|
|
42
|
+
const styles = {
|
|
43
|
+
container: {
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexDirection: 'column' as const,
|
|
46
|
+
height: '100%',
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
},
|
|
49
|
+
header: {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'space-between',
|
|
53
|
+
padding: `${spacing.sm} ${spacing.md}`,
|
|
54
|
+
borderBottom: `1px solid ${colors.background.light}`,
|
|
55
|
+
backgroundColor: colors.background.medium,
|
|
56
|
+
flexShrink: 0,
|
|
57
|
+
},
|
|
58
|
+
headerLeft: {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
gap: spacing.sm,
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
},
|
|
64
|
+
fileName: {
|
|
65
|
+
fontSize: typography.fontSize.sm,
|
|
66
|
+
fontFamily: typography.fontFamily.mono,
|
|
67
|
+
color: colors.text.primary,
|
|
68
|
+
overflow: 'hidden',
|
|
69
|
+
textOverflow: 'ellipsis',
|
|
70
|
+
whiteSpace: 'nowrap' as const,
|
|
71
|
+
},
|
|
72
|
+
stats: {
|
|
73
|
+
display: 'flex',
|
|
74
|
+
gap: spacing.sm,
|
|
75
|
+
fontSize: typography.fontSize.xs,
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
},
|
|
78
|
+
addStat: {
|
|
79
|
+
color: colors.semantic.success,
|
|
80
|
+
fontWeight: typography.fontWeight.medium,
|
|
81
|
+
},
|
|
82
|
+
removeStat: {
|
|
83
|
+
color: colors.semantic.error,
|
|
84
|
+
fontWeight: typography.fontWeight.medium,
|
|
85
|
+
},
|
|
86
|
+
closeBtn: {
|
|
87
|
+
background: 'transparent',
|
|
88
|
+
border: 'none',
|
|
89
|
+
color: colors.text.secondary,
|
|
90
|
+
fontSize: typography.fontSize.md,
|
|
91
|
+
cursor: 'pointer',
|
|
92
|
+
padding: spacing.xs,
|
|
93
|
+
borderRadius: borderRadius.sm,
|
|
94
|
+
transition: `color ${animation.duration.fast}`,
|
|
95
|
+
flexShrink: 0,
|
|
96
|
+
},
|
|
97
|
+
body: {
|
|
98
|
+
flex: 1,
|
|
99
|
+
overflow: 'auto',
|
|
100
|
+
fontFamily: typography.fontFamily.mono,
|
|
101
|
+
fontSize: typography.fontSize.xs,
|
|
102
|
+
lineHeight: typography.lineHeight.normal,
|
|
103
|
+
},
|
|
104
|
+
hunkHeader: {
|
|
105
|
+
padding: `${spacing.xs} ${spacing.md}`,
|
|
106
|
+
backgroundColor: `${colors.semantic.info}10`,
|
|
107
|
+
color: colors.semantic.info,
|
|
108
|
+
fontSize: typography.fontSize.xs,
|
|
109
|
+
borderBottom: `1px solid ${colors.background.light}`,
|
|
110
|
+
},
|
|
111
|
+
line: {
|
|
112
|
+
display: 'flex',
|
|
113
|
+
minHeight: '20px',
|
|
114
|
+
borderBottom: `1px solid ${colors.background.dark}`,
|
|
115
|
+
},
|
|
116
|
+
lineNumber: {
|
|
117
|
+
width: '40px',
|
|
118
|
+
padding: `0 ${spacing.xs}`,
|
|
119
|
+
textAlign: 'right' as const,
|
|
120
|
+
color: colors.text.muted,
|
|
121
|
+
userSelect: 'none' as const,
|
|
122
|
+
flexShrink: 0,
|
|
123
|
+
fontSize: typography.fontSize.xs,
|
|
124
|
+
lineHeight: '20px',
|
|
125
|
+
},
|
|
126
|
+
lineContent: {
|
|
127
|
+
flex: 1,
|
|
128
|
+
padding: `0 ${spacing.sm}`,
|
|
129
|
+
whiteSpace: 'pre' as const,
|
|
130
|
+
overflow: 'hidden',
|
|
131
|
+
textOverflow: 'ellipsis',
|
|
132
|
+
lineHeight: '20px',
|
|
133
|
+
},
|
|
134
|
+
emptyState: {
|
|
135
|
+
padding: spacing.xl,
|
|
136
|
+
textAlign: 'center' as const,
|
|
137
|
+
color: colors.text.muted,
|
|
138
|
+
fontSize: typography.fontSize.sm,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const lineStyles: Record<string, React.CSSProperties> = {
|
|
143
|
+
add: {
|
|
144
|
+
backgroundColor: `${colors.semantic.success}15`,
|
|
145
|
+
color: colors.text.primary,
|
|
146
|
+
},
|
|
147
|
+
remove: {
|
|
148
|
+
backgroundColor: `${colors.semantic.error}15`,
|
|
149
|
+
color: colors.text.primary,
|
|
150
|
+
},
|
|
151
|
+
context: {
|
|
152
|
+
backgroundColor: 'transparent',
|
|
153
|
+
color: colors.text.secondary,
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const linePrefix: Record<string, string> = {
|
|
158
|
+
add: '+',
|
|
159
|
+
remove: '-',
|
|
160
|
+
context: ' ',
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// ============================================================================
|
|
164
|
+
// Component
|
|
165
|
+
// ============================================================================
|
|
166
|
+
|
|
167
|
+
export function DiffViewer({ diff, onClose }: DiffViewerProps): React.ReactElement {
|
|
168
|
+
if (diff.hunks.length === 0) {
|
|
169
|
+
return (
|
|
170
|
+
<div style={styles.container}>
|
|
171
|
+
<div style={styles.header}>
|
|
172
|
+
<div style={styles.headerLeft}>
|
|
173
|
+
<span style={styles.fileName}>{diff.filePath}</span>
|
|
174
|
+
</div>
|
|
175
|
+
<button style={styles.closeBtn} onClick={onClose} aria-label="닫기">×</button>
|
|
176
|
+
</div>
|
|
177
|
+
<div style={styles.emptyState}>변경 사항 없음</div>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<div style={styles.container}>
|
|
184
|
+
<div style={styles.header}>
|
|
185
|
+
<div style={styles.headerLeft}>
|
|
186
|
+
<span style={styles.fileName}>
|
|
187
|
+
{diff.isNew ? '(new) ' : ''}{diff.filePath}
|
|
188
|
+
</span>
|
|
189
|
+
<div style={styles.stats}>
|
|
190
|
+
<span style={styles.addStat}>+{diff.additions}</span>
|
|
191
|
+
<span style={styles.removeStat}>-{diff.deletions}</span>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
<button style={styles.closeBtn} onClick={onClose} aria-label="닫기">×</button>
|
|
195
|
+
</div>
|
|
196
|
+
|
|
197
|
+
<div style={styles.body}>
|
|
198
|
+
{diff.hunks.map((hunk, hi) => (
|
|
199
|
+
<div key={hi}>
|
|
200
|
+
<div style={styles.hunkHeader}>{hunk.header}</div>
|
|
201
|
+
{hunk.lines.map((line, li) => (
|
|
202
|
+
<div key={li} style={{ ...styles.line, ...lineStyles[line.type] }}>
|
|
203
|
+
<span style={styles.lineNumber}>
|
|
204
|
+
{line.type !== 'add' ? (line.oldLine ?? '') : ''}
|
|
205
|
+
</span>
|
|
206
|
+
<span style={styles.lineNumber}>
|
|
207
|
+
{line.type !== 'remove' ? (line.newLine ?? '') : ''}
|
|
208
|
+
</span>
|
|
209
|
+
<span style={styles.lineContent}>
|
|
210
|
+
{linePrefix[line.type]}{line.content}
|
|
211
|
+
</span>
|
|
212
|
+
</div>
|
|
213
|
+
))}
|
|
214
|
+
</div>
|
|
215
|
+
))}
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
}
|