@nine-lab/nine-mu 0.1.346 → 0.1.347
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 +84 -6
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +3 -3
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +2 -1
- package/src/components/exception/ExceptionHook.js +33 -18
- package/src/index.js +2 -2
- package/vite.config.js +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nine-lab/nine-mu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.347",
|
|
4
4
|
"description": "AI-Driven Full-Stack Code Fabrication Engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/nine-mu.umd.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@nine-lab/nine-nomenu": "*",
|
|
26
26
|
"@nine-lab/nine-util": "^0.9.126",
|
|
27
27
|
"@nine-lab/nine-ux": "^0.1.244",
|
|
28
|
+
"@vitejs/plugin-react": "^6.0.2",
|
|
28
29
|
"terser": "^5.31.0",
|
|
29
30
|
"vite": "^6.0.0"
|
|
30
31
|
},
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// src/components/exception/ExceptionHook.js
|
|
2
|
-
import { nine } from '@nine-lab/nine-util';
|
|
3
|
-
import { trace } from '@nopeer';
|
|
4
|
-
// npm 라이브러리용 패키지의 핵심 소스 (예: src/components/ContentErrorBoundary.jsx)
|
|
5
1
|
import React from 'react';
|
|
6
2
|
|
|
7
3
|
export class NineExceptionHook extends React.Component {
|
|
4
|
+
|
|
8
5
|
constructor(props) {
|
|
9
6
|
super(props);
|
|
10
7
|
this.state = { hasError: false, error: null };
|
|
@@ -19,12 +16,10 @@ export class NineExceptionHook extends React.Component {
|
|
|
19
16
|
componentDidCatch(error, errorInfo) {
|
|
20
17
|
console.error("🚨 [Nine-Library] 본문 렌더링 에러 포착:", error);
|
|
21
18
|
|
|
22
|
-
// 1. 외부 전역 복구 엔진(triggerAutoRecovery)이 있으면 호출
|
|
23
19
|
if (window.triggerAutoRecovery) {
|
|
24
20
|
window.triggerAutoRecovery(error.message || String(error));
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
// 2. 라이브러리 확장성: 컴포넌트 자체 Props로 콜백을 넘겨받았다면 실행
|
|
28
23
|
if (this.props.onCatch) {
|
|
29
24
|
this.props.onCatch(error, errorInfo);
|
|
30
25
|
}
|
|
@@ -52,24 +47,44 @@ export class NineExceptionHook extends React.Component {
|
|
|
52
47
|
|
|
53
48
|
render() {
|
|
54
49
|
if (this.state.hasError) {
|
|
55
|
-
// 라이브러리 커스텀 UI 제공 (외부에서 커스텀 fallback UI를 주입하지 않았다면 기본 템플릿 사용)
|
|
56
50
|
if (this.props.fallback) {
|
|
57
51
|
return this.props.fallback(this.state.error);
|
|
58
52
|
}
|
|
59
53
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
const errorMessage = this.state.error?.message || String(this.state.error);
|
|
55
|
+
|
|
56
|
+
// ⭐ Vite 빌드 통과를 위해 순수 자바스크립트 함수(React.createElement)로 변경
|
|
57
|
+
return React.createElement(
|
|
58
|
+
'div',
|
|
59
|
+
{
|
|
60
|
+
style: {
|
|
61
|
+
padding: '30px',
|
|
62
|
+
margin: '20px',
|
|
63
|
+
background: '#FFF5F5',
|
|
64
|
+
border: '1px solid #FEB2B2',
|
|
65
|
+
borderRadius: '8px',
|
|
66
|
+
fontFamily: 'sans-serif',
|
|
67
|
+
textAlign: 'left',
|
|
68
|
+
...this.props.containerStyle
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
React.createElement('h3', { style: { color: '#C53030', marginTop: 0, fontSize: '18px' } }, '⚠️ 컴포넌트 빌드/렌더링 에러 감지'),
|
|
72
|
+
React.createElement('p', { style: { margin: '10px 0 5px 0', fontWeight: 'bold', color: '#4A5568' } }, '[에러 원인 로그]:'),
|
|
73
|
+
React.createElement('pre', {
|
|
74
|
+
style: {
|
|
75
|
+
background: '#1A202C',
|
|
76
|
+
color: '#EDF2F7',
|
|
77
|
+
padding: '15px',
|
|
78
|
+
borderRadius: '6px',
|
|
79
|
+
overflowX: 'auto',
|
|
80
|
+
whiteSpace: 'pre-wrap',
|
|
81
|
+
fontFamily: 'monospace'
|
|
82
|
+
}
|
|
83
|
+
}, errorMessage),
|
|
84
|
+
React.createElement('div', { style: { marginTop: '15px', fontSize: '14px', color: '#718096' } }, '🔄 에러 로그가 관제탑으로 자동 피드백되었습니다. AI가 소스 코드를 재수정하는 동안 잠시만 기다려주세요...')
|
|
71
85
|
);
|
|
72
86
|
}
|
|
87
|
+
|
|
73
88
|
return this.props.children;
|
|
74
89
|
}
|
|
75
90
|
}
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { NineDiff } from './components/NineDiff.js';
|
|
|
4
4
|
import { NineDiffPopup } from './components/NineDiffPopup.js';
|
|
5
5
|
import { NineMenuDiffPopup } from './components/NineMenuDiffPopup.js';
|
|
6
6
|
import './components/ChatMessage.js';
|
|
7
|
-
|
|
7
|
+
import { NineExceptionHook } from './components/exception/ExceptionHook.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Nine-Mu 엔진 메인 클래스
|
|
@@ -20,4 +20,4 @@ export const NineMu = {
|
|
|
20
20
|
|
|
21
21
|
// 기본 export 및 컴포넌트 export
|
|
22
22
|
export default NineMu;
|
|
23
|
-
export { NineChat, NineDiff, NineDiffPopup };
|
|
23
|
+
export { NineChat, NineDiff, NineDiffPopup, NineExceptionHook };
|
package/vite.config.js
CHANGED
|
@@ -19,7 +19,7 @@ export default defineConfig({
|
|
|
19
19
|
formats: ['es', 'umd']
|
|
20
20
|
},
|
|
21
21
|
rollupOptions: {
|
|
22
|
-
external: ['@nine-lab/nine-ai', '@nine-lab/nine-util', '@nine-lab/nine-ux'],
|
|
22
|
+
external: ['@nine-lab/nine-ai', '@nine-lab/nine-util', '@nine-lab/nine-ux', 'react', 'react-dom'],
|
|
23
23
|
output: {
|
|
24
24
|
globals: {
|
|
25
25
|
'@nine-lab/nine-ai': 'NineAi',
|
|
@@ -31,5 +31,9 @@ export default defineConfig({
|
|
|
31
31
|
minify: 'terser',
|
|
32
32
|
sourcemap: true,
|
|
33
33
|
emptyOutDir: true
|
|
34
|
+
},
|
|
35
|
+
esbuild: {
|
|
36
|
+
loader: 'jsx',
|
|
37
|
+
include: /src\/.*\.js$/, // src 폴더 내의 모든 .js 파일을 대상으로 지정
|
|
34
38
|
}
|
|
35
39
|
});
|