@solapi/ui-kit 1.0.3 → 1.0.4
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.md +48 -2
- package/dist/{GlobalMfa-B5iDrclc.js → GlobalMfa-CpdX96gd.js} +624 -624
- package/dist/GlobalMfa-da5YXeg9.cjs +1 -0
- package/dist/createMutationConfig-CwzGbAzV.js +402 -0
- package/dist/createMutationConfig-fwPFxVVI.cjs +1 -0
- package/dist/createMutationConfig.cjs +1 -1
- package/dist/createMutationConfig.js +9 -207
- package/dist/export/UIProvider.d.ts +1 -0
- package/dist/federation/FederationErrorBoundary.d.ts +48 -0
- package/dist/federation/hookLoader.d.ts +6 -3
- package/dist/federation/index.d.ts +1 -0
- package/dist/federation.cjs +2 -1
- package/dist/federation.js +162 -77
- package/dist/{index-B2Ik6wwn.js → index-BRkOTEs0.js} +3618 -3795
- package/dist/index-C7JWA6MN.cjs +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +17 -17
- package/dist/ui-kit.css +1 -1
- package/package.json +1 -1
- package/dist/GlobalMfa-B5pCOBH8.cjs +0 -1
- package/dist/index-ByFG8WvP.cjs +0 -5
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 원격 hook을 안전하게 로드하는 wrapper 생성
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* 팩토리 호출 시점에 loadModuleSafely를 즉시 트리거하여 모듈 로드를 시작한다.
|
|
5
|
+
* createSafeProviderLoader가 children 렌더를 차단하므로,
|
|
6
|
+
* 실제 hook 호출 시점에는 모듈이 이미 캐시에 있거나 실패로 확정된 상태이다.
|
|
7
|
+
*
|
|
8
|
+
* 동일한 moduleImport 함수 참조를 Provider/Component 로더와 공유하면
|
|
9
|
+
* loadModuleSafely 내부 중복 방지(dedup)로 한 번만 로드된다.
|
|
7
10
|
*/
|
|
8
11
|
export declare const createSafeHookLoader: <T>(moduleImport: () => Promise<any>, hookName: string, fallback: T) => (() => T);
|
|
@@ -2,3 +2,4 @@ export { loadModuleSafely, getModuleFromCache, clearModuleCache, isModuleEmpty,
|
|
|
2
2
|
export { createSafeProviderLoader, type SafeProviderLoaderOptions } from './providerLoader';
|
|
3
3
|
export { createSafeComponentLoader } from './componentLoader';
|
|
4
4
|
export { createSafeHookLoader } from './hookLoader';
|
|
5
|
+
export { default as FederationErrorBoundary, type FederationErrorBoundaryProps, type FederationErrorInfo } from './FederationErrorBoundary';
|
package/dist/federation.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("react"),d=new Map,h=new Map,y=async e=>{const r=h.get(e);if(r)return r;const o=d.get(e);if(o)return o;const s=e().then(n=>{const a=n?.default||n;return d.set(e,a),a}).catch(n=>(console.error("모듈 로드 실패:",n),d.set(e,{}),{})).finally(()=>{h.delete(e)});return h.set(e,s),s},k=e=>d.get(e)??null,M=e=>{e?(d.delete(e),h.delete(e)):(d.clear(),h.clear())},b=e=>!e||Object.keys(e).length===0,j=(e,r,o)=>{if(!e)return;const n=(e?.default||e)?.[r]??e?.[r];return n||console.error(`[${r}] ${o}를 모듈에서 찾을 수 없습니다.`,"모듈 키:",Object.keys(e||{})),n},R=({message:e})=>t.jsxs("div",{style:{height:"43px",lineHeight:"41px",backgroundColor:"#feebec",color:"#cf3035",textAlign:"center",fontSize:"14px",fontWeight:500,borderBottom:"1px solid #cf3035",zIndex:1e4},children:["⚠️ ",e]}),F=(e,r,o={})=>{const{warningMessage:s}=o;return n=>{const[a,l]=c.useState(null),[S,g]=c.useState(!0),[x,i]=c.useState(!1),u=c.useRef(e);if(u.current=e,c.useEffect(()=>{y(u.current).then(f=>{if(b(f)){i(!0);return}const C=j(f,r,"모듈");C?l(()=>C):i(!0)}).finally(()=>g(!1))},[r]),S)return null;if(x){const f=n?.children;return t.jsxs(t.Fragment,{children:[s&&t.jsx(R,{message:s}),f&&t.jsx("div",{style:{paddingTop:"16px"},children:f})]})}if(a)return t.jsx(a,{...n});const v=n?.children;return v?t.jsx(t.Fragment,{children:v}):null}},L=({componentName:e,children:r})=>t.jsxs("div",{style:{padding:"16px",backgroundColor:"#fff3cd",border:"1px solid #ffc107",borderRadius:"4px"},children:[t.jsxs("p",{style:{fontWeight:500},children:["⚠️ ",e," 컴포넌트를 찾을 수 없습니다."]}),r]}),_=(e,r)=>o=>{const[s,n]=c.useState(null),[a,l]=c.useState(!0),[S,g]=c.useState(!1),x=c.useRef(e);if(x.current=e,c.useEffect(()=>{y(x.current).then(i=>{if(b(i)){g(!0);return}const u=j(i,r,"컴포넌트");u?n(()=>u):g(!0)}).finally(()=>l(!1))},[r]),a){const i=o?.children;return i?t.jsx(t.Fragment,{children:i}):null}if(S||!s){const i=o?.children;return t.jsx(L,{componentName:r,children:i})}return t.jsx(s,{...o})},E=(e,r,o)=>{let s=null,n=!1;return y(e),()=>{if(!n){const a=k(e);if(a&&(n=!0,!b(a))){const l=j(a,r,"hook");l&&typeof l=="function"&&(s=l)}}if(s)try{return s()}catch(a){return console.error(`[${r}] 원격 hook 호출 실패, fallback 사용:`,a),o}return o}},m="_root_16oj8_1 _base_1tubv_6",D="_message_16oj8_14",w="_errorDetails_16oj8_22",z="_actions_16oj8_38",p={root:m,message:D,errorDetails:w,actions:z};class P extends c.Component{constructor(r){super(r),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,o){this.setState({errorInfo:o}),this.props.onError?.(r,o)}handleRetry=()=>{this.setState({hasError:!1,error:null,errorInfo:null}),this.props.onRetry?.()};handleReload=()=>{window.location.reload()};render(){if(!this.state.hasError)return this.props.children;const{error:r,errorInfo:o}=this.state,{fallback:s,showDetails:n=!1,message:a}=this.props;return s?t.jsx(s,{error:r,onRetry:this.handleRetry,onReload:this.handleReload}):t.jsxs("div",{className:p.root,children:[t.jsx("div",{className:p.message,children:a||"모듈을 로드하는 중 오류가 발생했습니다."}),n&&r&&t.jsxs("div",{className:p.errorDetails,children:[r.toString(),o?.componentStack&&`
|
|
2
|
+
${o.componentStack}`]}),t.jsxs("div",{className:p.actions,children:[t.jsx("button",{type:"button",onClick:this.handleRetry,style:{padding:"6px 16px",fontSize:"14px",fontWeight:500,border:"1px solid var(--color-border, #ddd)",borderRadius:"var(--border-radius-sm, 4px)",background:"var(--color-background, #fff)",color:"var(--color-text, #333)",cursor:"pointer"},children:"재시도"}),t.jsx("button",{type:"button",onClick:this.handleReload,style:{padding:"6px 16px",fontSize:"14px",fontWeight:500,border:"none",borderRadius:"var(--border-radius-sm, 4px)",background:"var(--color-primary, #5780ff)",color:"#fff",cursor:"pointer"},children:"새로고침"})]})]})}}exports.FederationErrorBoundary=P;exports.clearModuleCache=M;exports.createSafeComponentLoader=_;exports.createSafeHookLoader=E;exports.createSafeProviderLoader=F;exports.findExportInModule=j;exports.getModuleFromCache=k;exports.isModuleEmpty=b;exports.loadModuleSafely=y;
|
package/dist/federation.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as d, useRef as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
if (n) return n;
|
|
6
|
-
const r = a.get(e);
|
|
1
|
+
import { jsxs as l, Fragment as k, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as M, useEffect as F, Component as L } from "react";
|
|
3
|
+
const u = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), v = async (e) => {
|
|
4
|
+
const r = p.get(e);
|
|
7
5
|
if (r) return r;
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const t = u.get(e);
|
|
7
|
+
if (t) return t;
|
|
8
|
+
const n = e().then((o) => {
|
|
9
|
+
const s = o?.default || o;
|
|
10
|
+
return u.set(e, s), s;
|
|
11
|
+
}).catch((o) => (console.error("모듈 로드 실패:", o), u.set(e, {}), {})).finally(() => {
|
|
12
|
+
p.delete(e);
|
|
13
13
|
});
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
e ? (
|
|
17
|
-
},
|
|
14
|
+
return p.set(e, n), n;
|
|
15
|
+
}, E = (e) => u.get(e) ?? null, H = (e) => {
|
|
16
|
+
e ? (u.delete(e), p.delete(e)) : (u.clear(), p.clear());
|
|
17
|
+
}, C = (e) => !e || Object.keys(e).length === 0, R = (e, r, t) => {
|
|
18
18
|
if (!e) return;
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
`[${
|
|
19
|
+
const o = (e?.default || e)?.[r] ?? e?.[r];
|
|
20
|
+
return o || console.error(
|
|
21
|
+
`[${r}] ${t}를 모듈에서 찾을 수 없습니다.`,
|
|
22
22
|
"모듈 키:",
|
|
23
23
|
Object.keys(e || {})
|
|
24
|
-
),
|
|
25
|
-
},
|
|
24
|
+
), o;
|
|
25
|
+
}, j = ({ message: e }) => /* @__PURE__ */ l(
|
|
26
26
|
"div",
|
|
27
27
|
{
|
|
28
28
|
style: {
|
|
@@ -41,92 +41,177 @@ const a = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), S = async (e
|
|
|
41
41
|
e
|
|
42
42
|
]
|
|
43
43
|
}
|
|
44
|
-
), P = (e,
|
|
45
|
-
const { warningMessage:
|
|
46
|
-
return (
|
|
47
|
-
const [
|
|
48
|
-
if (f.current = e,
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
|
|
44
|
+
), P = (e, r, t = {}) => {
|
|
45
|
+
const { warningMessage: n } = t;
|
|
46
|
+
return (o) => {
|
|
47
|
+
const [s, a] = d(null), [x, g] = d(!0), [b, c] = d(!1), f = M(e);
|
|
48
|
+
if (f.current = e, F(() => {
|
|
49
|
+
v(f.current).then((h) => {
|
|
50
|
+
if (C(h)) {
|
|
51
|
+
c(!0);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const S = R(h, r, "모듈");
|
|
55
|
+
S ? a(() => S) : c(!0);
|
|
56
56
|
}).finally(() => g(!1));
|
|
57
|
-
}, [
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
}, [r]), x) return null;
|
|
58
|
+
if (b) {
|
|
59
|
+
const h = o?.children;
|
|
60
|
+
return /* @__PURE__ */ l(k, { children: [
|
|
61
|
+
n && /* @__PURE__ */ i(j, { message: n }),
|
|
62
|
+
h && /* @__PURE__ */ i("div", { style: { paddingTop: "16px" }, children: h })
|
|
63
63
|
] });
|
|
64
64
|
}
|
|
65
|
-
if (
|
|
66
|
-
const
|
|
67
|
-
return
|
|
65
|
+
if (s) return /* @__PURE__ */ i(s, { ...o });
|
|
66
|
+
const _ = o?.children;
|
|
67
|
+
return _ ? /* @__PURE__ */ i(k, { children: _ }) : null;
|
|
68
68
|
};
|
|
69
|
-
},
|
|
69
|
+
}, m = ({
|
|
70
70
|
componentName: e,
|
|
71
|
-
children:
|
|
72
|
-
}) => /* @__PURE__ */
|
|
71
|
+
children: r
|
|
72
|
+
}) => /* @__PURE__ */ l("div", { style: {
|
|
73
73
|
padding: "16px",
|
|
74
74
|
backgroundColor: "#fff3cd",
|
|
75
75
|
border: "1px solid #ffc107",
|
|
76
76
|
borderRadius: "4px"
|
|
77
77
|
}, children: [
|
|
78
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ l("p", { style: { fontWeight: 500 }, children: [
|
|
79
79
|
"⚠️ ",
|
|
80
80
|
e,
|
|
81
81
|
" 컴포넌트를 찾을 수 없습니다."
|
|
82
82
|
] }),
|
|
83
|
-
|
|
84
|
-
] }), T = (e,
|
|
85
|
-
const [
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
if (
|
|
83
|
+
r
|
|
84
|
+
] }), T = (e, r) => (t) => {
|
|
85
|
+
const [n, o] = d(null), [s, a] = d(!0), [x, g] = d(!1), b = M(e);
|
|
86
|
+
if (b.current = e, F(() => {
|
|
87
|
+
v(b.current).then((c) => {
|
|
88
|
+
if (C(c)) {
|
|
89
89
|
g(!0);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
|
-
const f =
|
|
93
|
-
f ?
|
|
94
|
-
}).finally(() =>
|
|
95
|
-
}, [
|
|
96
|
-
const
|
|
97
|
-
return
|
|
92
|
+
const f = R(c, r, "컴포넌트");
|
|
93
|
+
f ? o(() => f) : g(!0);
|
|
94
|
+
}).finally(() => a(!1));
|
|
95
|
+
}, [r]), s) {
|
|
96
|
+
const c = t?.children;
|
|
97
|
+
return c ? /* @__PURE__ */ i(k, { children: c }) : null;
|
|
98
98
|
}
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
return /* @__PURE__ */
|
|
99
|
+
if (x || !n) {
|
|
100
|
+
const c = t?.children;
|
|
101
|
+
return /* @__PURE__ */ i(m, { componentName: r, children: c });
|
|
102
102
|
}
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
},
|
|
105
|
-
let
|
|
106
|
-
return () => {
|
|
107
|
-
if (!
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
const
|
|
111
|
-
|
|
103
|
+
return /* @__PURE__ */ i(n, { ...t });
|
|
104
|
+
}, K = (e, r, t) => {
|
|
105
|
+
let n = null, o = !1;
|
|
106
|
+
return v(e), () => {
|
|
107
|
+
if (!o) {
|
|
108
|
+
const s = E(e);
|
|
109
|
+
if (s && (o = !0, !C(s))) {
|
|
110
|
+
const a = R(s, r, "hook");
|
|
111
|
+
a && typeof a == "function" && (n = a);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
if (
|
|
114
|
+
if (n)
|
|
115
115
|
try {
|
|
116
|
-
return
|
|
117
|
-
} catch (
|
|
118
|
-
return console.error(`[${
|
|
116
|
+
return n();
|
|
117
|
+
} catch (s) {
|
|
118
|
+
return console.error(`[${r}] 원격 hook 호출 실패, fallback 사용:`, s), t;
|
|
119
119
|
}
|
|
120
|
-
return
|
|
120
|
+
return t;
|
|
121
121
|
};
|
|
122
|
+
}, D = "_root_16oj8_1 _base_1tubv_6", w = "_message_16oj8_14", z = "_errorDetails_16oj8_22", W = "_actions_16oj8_38", y = {
|
|
123
|
+
root: D,
|
|
124
|
+
message: w,
|
|
125
|
+
errorDetails: z,
|
|
126
|
+
actions: W
|
|
122
127
|
};
|
|
128
|
+
class O extends L {
|
|
129
|
+
constructor(r) {
|
|
130
|
+
super(r), this.state = { hasError: !1, error: null, errorInfo: null };
|
|
131
|
+
}
|
|
132
|
+
static getDerivedStateFromError(r) {
|
|
133
|
+
return { hasError: !0, error: r };
|
|
134
|
+
}
|
|
135
|
+
componentDidCatch(r, t) {
|
|
136
|
+
this.setState({ errorInfo: t }), this.props.onError?.(r, t);
|
|
137
|
+
}
|
|
138
|
+
handleRetry = () => {
|
|
139
|
+
this.setState({ hasError: !1, error: null, errorInfo: null }), this.props.onRetry?.();
|
|
140
|
+
};
|
|
141
|
+
handleReload = () => {
|
|
142
|
+
window.location.reload();
|
|
143
|
+
};
|
|
144
|
+
render() {
|
|
145
|
+
if (!this.state.hasError)
|
|
146
|
+
return this.props.children;
|
|
147
|
+
const { error: r, errorInfo: t } = this.state, {
|
|
148
|
+
fallback: n,
|
|
149
|
+
showDetails: o = !1,
|
|
150
|
+
message: s
|
|
151
|
+
} = this.props;
|
|
152
|
+
return n ? /* @__PURE__ */ i(
|
|
153
|
+
n,
|
|
154
|
+
{
|
|
155
|
+
error: r,
|
|
156
|
+
onRetry: this.handleRetry,
|
|
157
|
+
onReload: this.handleReload
|
|
158
|
+
}
|
|
159
|
+
) : /* @__PURE__ */ l("div", { className: y.root, children: [
|
|
160
|
+
/* @__PURE__ */ i("div", { className: y.message, children: s || "모듈을 로드하는 중 오류가 발생했습니다." }),
|
|
161
|
+
o && r && /* @__PURE__ */ l("div", { className: y.errorDetails, children: [
|
|
162
|
+
r.toString(),
|
|
163
|
+
t?.componentStack && `
|
|
164
|
+
${t.componentStack}`
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ l("div", { className: y.actions, children: [
|
|
167
|
+
/* @__PURE__ */ i(
|
|
168
|
+
"button",
|
|
169
|
+
{
|
|
170
|
+
type: "button",
|
|
171
|
+
onClick: this.handleRetry,
|
|
172
|
+
style: {
|
|
173
|
+
padding: "6px 16px",
|
|
174
|
+
fontSize: "14px",
|
|
175
|
+
fontWeight: 500,
|
|
176
|
+
border: "1px solid var(--color-border, #ddd)",
|
|
177
|
+
borderRadius: "var(--border-radius-sm, 4px)",
|
|
178
|
+
background: "var(--color-background, #fff)",
|
|
179
|
+
color: "var(--color-text, #333)",
|
|
180
|
+
cursor: "pointer"
|
|
181
|
+
},
|
|
182
|
+
children: "재시도"
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
/* @__PURE__ */ i(
|
|
186
|
+
"button",
|
|
187
|
+
{
|
|
188
|
+
type: "button",
|
|
189
|
+
onClick: this.handleReload,
|
|
190
|
+
style: {
|
|
191
|
+
padding: "6px 16px",
|
|
192
|
+
fontSize: "14px",
|
|
193
|
+
fontWeight: 500,
|
|
194
|
+
border: "none",
|
|
195
|
+
borderRadius: "var(--border-radius-sm, 4px)",
|
|
196
|
+
background: "var(--color-primary, #5780ff)",
|
|
197
|
+
color: "#fff",
|
|
198
|
+
cursor: "pointer"
|
|
199
|
+
},
|
|
200
|
+
children: "새로고침"
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] })
|
|
204
|
+
] });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
123
207
|
export {
|
|
208
|
+
O as FederationErrorBoundary,
|
|
124
209
|
H as clearModuleCache,
|
|
125
210
|
T as createSafeComponentLoader,
|
|
126
|
-
|
|
211
|
+
K as createSafeHookLoader,
|
|
127
212
|
P as createSafeProviderLoader,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
213
|
+
R as findExportInModule,
|
|
214
|
+
E as getModuleFromCache,
|
|
215
|
+
C as isModuleEmpty,
|
|
216
|
+
v as loadModuleSafely
|
|
132
217
|
};
|