@nine-lab/nine-mu 0.1.359 → 0.1.361
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/dist/nine-mu.js +68 -45
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/exception/ExceptionHook.js +68 -37
package/package.json
CHANGED
|
@@ -5,60 +5,64 @@ import React from 'react';
|
|
|
5
5
|
// ==========================================
|
|
6
6
|
export const NineExceptionStyles = {
|
|
7
7
|
container: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
//
|
|
8
|
+
minHeight: '100%',
|
|
9
|
+
flexGrow: 1,
|
|
10
|
+
padding: '25px',
|
|
11
|
+
background: '#121314', // 터미널 다크 블랙 배경
|
|
12
|
+
// ⭐ 모든 요소의 폰트 크기, 패딩, 높이 기준을 부모 레벨에서 완벽히 통일
|
|
12
13
|
fontFamily: 'Consolas, Monaco, "Courier New", monospace',
|
|
14
|
+
fontSize: '14px',
|
|
15
|
+
lineHeight: '1.6', // 줄간격을 터미널 배시 화면 비율(1.6)로 고정
|
|
16
|
+
color: '#999', // 기본 텍스트 색상 #999 적용
|
|
13
17
|
textAlign: 'left',
|
|
14
18
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
|
15
|
-
|
|
16
|
-
// 내부 라인들을 인라인 텍스트 흐름처럼 촘촘하게 쌓기 위해 flex 간격 조정
|
|
17
|
-
display: 'flex',
|
|
18
|
-
flexDirection: 'column',
|
|
19
|
-
gap: '10px', // 줄간 간격을 10px로 타이트하게 조여 터미널 감성 극대화
|
|
20
|
-
lineHeight: '1.2' // 모든 라인의 글자 높이 기준 통일
|
|
19
|
+
boxSizing: 'border-box'
|
|
21
20
|
},
|
|
21
|
+
// 1. 모든 라인의 display 형식을 'block'으로 맞추고 마진/패딩을 0으로 통일
|
|
22
22
|
systemError: {
|
|
23
|
-
color: '#999',
|
|
23
|
+
color: '#999',
|
|
24
24
|
fontWeight: 'bold',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
padding: '0'
|
|
25
|
+
margin: '0',
|
|
26
|
+
padding: '0',
|
|
27
|
+
display: 'block'
|
|
29
28
|
},
|
|
29
|
+
// 2. 에러 본문 텍스트도 불필요한 속성을 다 버리고 일반 라인과 똑같이 흐르게 교정
|
|
30
30
|
pre: {
|
|
31
31
|
background: 'transparent',
|
|
32
|
-
color: '#666',
|
|
32
|
+
color: '#666', // aa is not defined는 요청하신 #666 적용
|
|
33
33
|
padding: '0',
|
|
34
|
-
margin: '0',
|
|
34
|
+
margin: '0',
|
|
35
35
|
border: 'none',
|
|
36
36
|
overflowX: 'auto',
|
|
37
37
|
whiteSpace: 'pre-wrap',
|
|
38
|
-
fontFamily: '
|
|
39
|
-
fontSize: '
|
|
38
|
+
fontFamily: 'inherit', // 부모 폰트 그대로 상속
|
|
39
|
+
fontSize: 'inherit', // 부모 크기 그대로 상속
|
|
40
40
|
display: 'block'
|
|
41
41
|
},
|
|
42
|
+
// 3. 에러 위치 추적 라인
|
|
43
|
+
locationRow: {
|
|
44
|
+
color: '#666',
|
|
45
|
+
margin: '0',
|
|
46
|
+
padding: '0',
|
|
47
|
+
display: 'block'
|
|
48
|
+
},
|
|
49
|
+
// 4. 하단 영역의 flex와 gap을 완전히 제거하여 줄간격 왜곡 원천 차단
|
|
42
50
|
footer: {
|
|
43
|
-
fontSize: '14px',
|
|
44
|
-
color: '#999',
|
|
45
51
|
margin: '0',
|
|
46
52
|
padding: '0',
|
|
47
|
-
display: '
|
|
48
|
-
flexDirection: 'column',
|
|
49
|
-
gap: '10px' // 후속 로그가 찍힐 때도 동일한 간격 유지
|
|
53
|
+
display: 'block'
|
|
50
54
|
},
|
|
51
55
|
promptRow: {
|
|
52
56
|
margin: '0',
|
|
53
57
|
padding: '0',
|
|
54
58
|
display: 'block',
|
|
55
|
-
color: '#999'
|
|
59
|
+
color: '#999'
|
|
56
60
|
},
|
|
57
61
|
cliLink: {
|
|
58
|
-
color: '#38A169',
|
|
59
|
-
padding: '0
|
|
60
|
-
fontFamily: '
|
|
61
|
-
fontSize: '
|
|
62
|
+
color: '#38A169', // y 링크 터미널 그린
|
|
63
|
+
padding: '0',
|
|
64
|
+
fontFamily: 'inherit',
|
|
65
|
+
fontSize: 'inherit',
|
|
62
66
|
fontWeight: 'bold',
|
|
63
67
|
cursor: 'pointer',
|
|
64
68
|
textDecoration: 'underline',
|
|
@@ -86,6 +90,11 @@ export class NineExceptionHook extends React.Component {
|
|
|
86
90
|
|
|
87
91
|
componentDidCatch(error, errorInfo) {
|
|
88
92
|
console.error("🚨 [Nine-Library] 본문 렌더링 에러 포착:", error);
|
|
93
|
+
|
|
94
|
+
this.setState({
|
|
95
|
+
errorInfo: errorInfo || null
|
|
96
|
+
});
|
|
97
|
+
|
|
89
98
|
if (this.props.onCatch) {
|
|
90
99
|
this.props.onCatch(error, errorInfo);
|
|
91
100
|
}
|
|
@@ -114,7 +123,8 @@ export class NineExceptionHook extends React.Component {
|
|
|
114
123
|
|
|
115
124
|
handleLocationChange() {
|
|
116
125
|
setTimeout(() => {
|
|
117
|
-
|
|
126
|
+
// reportStatus 조건 대신, 에러가 나 있는 상태에서 주소가 바뀌었는지만 체크해야 안전합니다.
|
|
127
|
+
if (this.state.hasError && this.lastPath !== window.location.pathname) {
|
|
118
128
|
console.log("[Nine-Library] 페이지 주소 변경 감지 -> 에러 상태 초기화");
|
|
119
129
|
this.lastPath = window.location.pathname;
|
|
120
130
|
this.setState({ hasError: false, error: null, reportStatus: 'idle' });
|
|
@@ -147,23 +157,43 @@ export class NineExceptionHook extends React.Component {
|
|
|
147
157
|
const errorMessage = this.state.error?.message || String(this.state.error);
|
|
148
158
|
const customStyles = this.props.styles || {};
|
|
149
159
|
|
|
160
|
+
// 🔍 React 컴포넌트 스택에서 파일명과 라인 번호 추출
|
|
161
|
+
let errorLocation = '';
|
|
162
|
+
if (this.state.errorInfo?.componentStack) {
|
|
163
|
+
const lines = this.state.errorInfo.componentStack.trim().split('\n');
|
|
164
|
+
const targetLine = lines[0] || '';
|
|
165
|
+
const match = targetLine.match(/at\s+(\w+)\s+\((.*)\)/) || targetLine.match(/at\s+(.*)/);
|
|
166
|
+
if (match) {
|
|
167
|
+
errorLocation = match[2] ? `${match[1]} (${match[2]})` : match[1];
|
|
168
|
+
} else {
|
|
169
|
+
errorLocation = targetLine.trim();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
150
173
|
return React.createElement(
|
|
151
174
|
'div',
|
|
152
175
|
{
|
|
153
176
|
style: { ...NineExceptionStyles.container, ...customStyles.container, ...this.props.containerStyle }
|
|
154
177
|
},
|
|
155
178
|
|
|
156
|
-
// 1.
|
|
179
|
+
// 1. [SYSTEM] 라인
|
|
157
180
|
React.createElement(
|
|
158
181
|
'div',
|
|
159
182
|
{ style: { ...NineExceptionStyles.systemError, ...customStyles.systemError } },
|
|
160
183
|
'[SYSTEM] COMPONENT RENDER ERROR DETECTED'
|
|
161
184
|
),
|
|
162
185
|
|
|
163
|
-
// 2.
|
|
186
|
+
// 2. aa is not defined 라인
|
|
164
187
|
React.createElement('pre', { style: { ...NineExceptionStyles.pre, ...customStyles.pre } }, errorMessage),
|
|
165
188
|
|
|
166
|
-
// 3.
|
|
189
|
+
// 3. at MemberUsers 라인
|
|
190
|
+
errorLocation && React.createElement(
|
|
191
|
+
'div',
|
|
192
|
+
{ style: { ...NineExceptionStyles.locationRow, ...customStyles.locationRow } },
|
|
193
|
+
` at ${errorLocation}`
|
|
194
|
+
),
|
|
195
|
+
|
|
196
|
+
// 4. CLI 프롬프트 및 후속 결과 라인 영역
|
|
167
197
|
React.createElement(
|
|
168
198
|
'div',
|
|
169
199
|
{ style: { ...NineExceptionStyles.footer, ...customStyles.footer } },
|
|
@@ -183,17 +213,18 @@ export class NineExceptionHook extends React.Component {
|
|
|
183
213
|
React.createElement('span', null, '/n)?')
|
|
184
214
|
),
|
|
185
215
|
|
|
216
|
+
// display: 'block'과 margin/padding 0을 주어 다른 라인들과 오차 없이 간격을 맞춤
|
|
186
217
|
this.state.reportStatus === 'sending' && React.createElement(
|
|
187
218
|
'div',
|
|
188
|
-
{ style: { color: '#ED8936', margin: '0',
|
|
219
|
+
{ style: { color: '#ED8936', margin: '0', padding: '0', display: 'block' } },
|
|
189
220
|
'>> Connecting to Control Tower... Sending payload.'
|
|
190
221
|
),
|
|
191
222
|
|
|
192
223
|
this.state.reportStatus === 'success' && React.createElement(
|
|
193
224
|
'div',
|
|
194
|
-
{ style: {
|
|
195
|
-
React.createElement('div', { style: { color: '#38A169', fontWeight: 'bold',
|
|
196
|
-
React.createElement('div', { style: { color: '#A0AEC0', fontStyle: 'italic', fontSize: '13px',
|
|
225
|
+
{ style: { margin: '0', padding: '0', display: 'block' } },
|
|
226
|
+
React.createElement('div', { style: { color: '#38A169', fontWeight: 'bold', display: 'block', margin: '0' } }, '>> Transmit complete. Core engine initialized.'),
|
|
227
|
+
React.createElement('div', { style: { color: '#A0AEC0', fontStyle: 'italic', fontSize: '13px', display: 'block', margin: '4px 0 0 0' } }, 'AI가 소스 코드를 재수정하는 동안 잠시만 기다려주세요...')
|
|
197
228
|
)
|
|
198
229
|
)
|
|
199
230
|
);
|