@xingtukeji/micro 1.0.4 → 1.0.5
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 +45 -0
- package/dist/index.js +48 -50
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +2 -0
- package/package.json +1 -1
- package/postcss.config.js +0 -23
- package/tsconfig.json +0 -24
- package/vite.config.ts +0 -27
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
主应用初始化:
|
|
2
|
+
```javascript
|
|
3
|
+
//主微应用加载插件,注意一定要在 pinia 初始化之后
|
|
4
|
+
import xtMicro, { setupApp } from '@xingtukeji/micro'
|
|
5
|
+
app.use(xtMicro)
|
|
6
|
+
// 遍历菜单函数
|
|
7
|
+
function traverseMenu(menu) {
|
|
8
|
+
// 遍历菜单项
|
|
9
|
+
menu.forEach((item) => {
|
|
10
|
+
// 对微应用的菜单做处理
|
|
11
|
+
if(item.type === 'micro'){
|
|
12
|
+
// 设置应用
|
|
13
|
+
setupApp({
|
|
14
|
+
...item.microOptions,
|
|
15
|
+
token: () => useUserStore().token,
|
|
16
|
+
params: item.microOptions?.params || {},
|
|
17
|
+
})
|
|
18
|
+
}
|
|
19
|
+
// 如果当前菜单项有子菜单,则递归遍历子菜单
|
|
20
|
+
if (item.children) {
|
|
21
|
+
traverseMenu(item.children);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
traverseMenu(window.$config.menus)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
子应用初始化:
|
|
29
|
+
```javascript
|
|
30
|
+
//子应用初始化
|
|
31
|
+
import {microInit} from '@xingtukeji/micro'
|
|
32
|
+
microInit({
|
|
33
|
+
// 处理 token,该方法建议同步执行完成,如果有异步处理(比如 http 请求)请后续页面初始化时,判断 token 是否准备完毕。
|
|
34
|
+
authHandler: (token: string)=>{
|
|
35
|
+
return new Promise((resolve,_reject)=>{
|
|
36
|
+
setTimeout(()=>{
|
|
37
|
+
console.log('authHandler',token)
|
|
38
|
+
resolve(token)
|
|
39
|
+
}, 1000)
|
|
40
|
+
})
|
|
41
|
+
},
|
|
42
|
+
//简易处理微应用环境下,隐藏 header
|
|
43
|
+
hideHeaderCssSelector: '#app ._hedaui-header'
|
|
44
|
+
})
|
|
45
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const D = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {}, On = p
|
|
|
37
37
|
}, Nn = /^on[^a-z]/, bn = (e) => Nn.test(e), x = Object.assign, Sn = (e, t) => {
|
|
38
38
|
const n = e.indexOf(t);
|
|
39
39
|
n > -1 && e.splice(n, 1);
|
|
40
|
-
},
|
|
40
|
+
}, In = Object.prototype.hasOwnProperty, g = (e, t) => In.call(e, t), h = Array.isArray, k = (e) => Ce(e) === "[object Map]", yn = (e) => Ce(e) === "[object Set]", E = (e) => typeof e == "function", V = (e) => typeof e == "string", qe = (e) => typeof e == "symbol", I = (e) => e !== null && typeof e == "object", Rn = (e) => I(e) && E(e.then) && E(e.catch), vn = Object.prototype.toString, Ce = (e) => vn.call(e), Ct = (e) => Ce(e).slice(8, -1), xn = (e) => Ce(e) === "[object Object]", Ge = (e) => V(e) && e !== "NaN" && e[0] !== "-" && "" + parseInt(e, 10) === e, Pt = (e) => {
|
|
41
41
|
const t = /* @__PURE__ */ Object.create(null);
|
|
42
42
|
return (n) => t[n] || (t[n] = e(n));
|
|
43
43
|
}, Mt = Pt(
|
|
@@ -66,7 +66,7 @@ function Je(e) {
|
|
|
66
66
|
} else {
|
|
67
67
|
if (V(e))
|
|
68
68
|
return e;
|
|
69
|
-
if (
|
|
69
|
+
if (I(e))
|
|
70
70
|
return e;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -89,7 +89,7 @@ function Xe(e) {
|
|
|
89
89
|
const o = Xe(e[n]);
|
|
90
90
|
o && (t += o + " ");
|
|
91
91
|
}
|
|
92
|
-
else if (
|
|
92
|
+
else if (I(e))
|
|
93
93
|
for (const n in e)
|
|
94
94
|
e[n] && (t += n + " ");
|
|
95
95
|
return t.trim();
|
|
@@ -166,7 +166,7 @@ function Qe() {
|
|
|
166
166
|
const e = $t.pop();
|
|
167
167
|
j = e === void 0 ? !0 : e;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function y(e, t, n) {
|
|
170
170
|
if (j && N) {
|
|
171
171
|
let o = Fe.get(e);
|
|
172
172
|
o || Fe.set(e, o = /* @__PURE__ */ new Map());
|
|
@@ -240,7 +240,7 @@ function Wn() {
|
|
|
240
240
|
e[t] = function(...n) {
|
|
241
241
|
const o = p(this);
|
|
242
242
|
for (let s = 0, i = this.length; s < i; s++)
|
|
243
|
-
|
|
243
|
+
y(o, "get", s + "");
|
|
244
244
|
const r = o[t](...n);
|
|
245
245
|
return r === -1 || r === !1 ? o[t](...n.map(p)) : r;
|
|
246
246
|
};
|
|
@@ -254,7 +254,7 @@ function Wn() {
|
|
|
254
254
|
}
|
|
255
255
|
function Bn(e) {
|
|
256
256
|
const t = p(this);
|
|
257
|
-
return
|
|
257
|
+
return y(t, "has", e), t.hasOwnProperty(e);
|
|
258
258
|
}
|
|
259
259
|
function Ze(e = !1, t = !1) {
|
|
260
260
|
return function(o, r, s) {
|
|
@@ -274,7 +274,7 @@ function Ze(e = !1, t = !1) {
|
|
|
274
274
|
return Bn;
|
|
275
275
|
}
|
|
276
276
|
const c = Reflect.get(o, r, s);
|
|
277
|
-
return (qe(r) ? At.has(r) : Hn(r)) || (e ||
|
|
277
|
+
return (qe(r) ? At.has(r) : Hn(r)) || (e || y(o, "get", r), t) ? c : S(c) ? i && Ge(r) ? c : c.value : I(c) ? e ? zt(c) : Lt(c) : c;
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
280
|
const qn = /* @__PURE__ */ Gn();
|
|
@@ -295,10 +295,10 @@ function Jn(e, t) {
|
|
|
295
295
|
}
|
|
296
296
|
function Xn(e, t) {
|
|
297
297
|
const n = Reflect.has(e, t);
|
|
298
|
-
return (!qe(t) || !At.has(t)) &&
|
|
298
|
+
return (!qe(t) || !At.has(t)) && y(e, "has", t), n;
|
|
299
299
|
}
|
|
300
300
|
function Yn(e) {
|
|
301
|
-
return
|
|
301
|
+
return y(e, "iterate", h(e) ? "length" : q), Reflect.ownKeys(e);
|
|
302
302
|
}
|
|
303
303
|
const Qn = {
|
|
304
304
|
get: Kn,
|
|
@@ -330,7 +330,7 @@ const Qn = {
|
|
|
330
330
|
function pe(e, t, n = !1, o = !1) {
|
|
331
331
|
e = e.__v_raw;
|
|
332
332
|
const r = p(e), s = p(t);
|
|
333
|
-
n || (t !== s &&
|
|
333
|
+
n || (t !== s && y(r, "get", t), y(r, "get", s));
|
|
334
334
|
const { has: i } = Pe(r), c = o ? ke : n ? nt : ae;
|
|
335
335
|
if (i.call(r, t))
|
|
336
336
|
return c(e.get(t));
|
|
@@ -340,10 +340,10 @@ function pe(e, t, n = !1, o = !1) {
|
|
|
340
340
|
}
|
|
341
341
|
function de(e, t = !1) {
|
|
342
342
|
const n = this.__v_raw, o = p(n), r = p(e);
|
|
343
|
-
return t || (e !== r &&
|
|
343
|
+
return t || (e !== r && y(o, "has", e), y(o, "has", r)), e === r ? n.has(e) : n.has(e) || n.has(r);
|
|
344
344
|
}
|
|
345
345
|
function he(e, t = !1) {
|
|
346
|
-
return e = e.__v_raw, !t &&
|
|
346
|
+
return e = e.__v_raw, !t && y(p(e), "iterate", q), Reflect.get(e, "size", e);
|
|
347
347
|
}
|
|
348
348
|
function mt(e) {
|
|
349
349
|
e = p(e);
|
|
@@ -372,13 +372,13 @@ function wt() {
|
|
|
372
372
|
function me(e, t) {
|
|
373
373
|
return function(o, r) {
|
|
374
374
|
const s = this, i = s.__v_raw, c = p(i), l = t ? ke : e ? nt : ae;
|
|
375
|
-
return !e &&
|
|
375
|
+
return !e && y(c, "iterate", q), i.forEach((u, d) => o.call(r, l(u), l(d), s));
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
378
|
function _e(e, t, n) {
|
|
379
379
|
return function(...o) {
|
|
380
380
|
const r = this.__v_raw, s = p(r), i = k(s), c = e === "entries" || e === Symbol.iterator && i, l = e === "keys" && i, u = r[e](...o), d = n ? ke : t ? nt : ae;
|
|
381
|
-
return !t &&
|
|
381
|
+
return !t && y(
|
|
382
382
|
s,
|
|
383
383
|
"iterate",
|
|
384
384
|
l ? He : q
|
|
@@ -569,7 +569,7 @@ function ge(e) {
|
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
571
|
function tt(e, t, n, o, r) {
|
|
572
|
-
if (!
|
|
572
|
+
if (!I(e))
|
|
573
573
|
return process.env.NODE_ENV !== "production" && console.warn(`value cannot be made reactive: ${String(e)}`), e;
|
|
574
574
|
if (e.__v_raw && !(t && e.__v_isReactive))
|
|
575
575
|
return e;
|
|
@@ -604,7 +604,7 @@ function p(e) {
|
|
|
604
604
|
function ur(e) {
|
|
605
605
|
return Pn(e, "__v_skip", !0), e;
|
|
606
606
|
}
|
|
607
|
-
const ae = (e) =>
|
|
607
|
+
const ae = (e) => I(e) ? Lt(e) : e, nt = (e) => I(e) ? zt(e) : e;
|
|
608
608
|
function fr(e) {
|
|
609
609
|
j && N && (e = p(e), process.env.NODE_ENV !== "production" ? Ke(e.dep || (e.dep = ce()), {
|
|
610
610
|
target: e,
|
|
@@ -807,9 +807,9 @@ function qt(e, t, n, o = !0) {
|
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
|
-
|
|
810
|
+
Ir(e, n, r, o);
|
|
811
811
|
}
|
|
812
|
-
function
|
|
812
|
+
function Ir(e, t, n, o = !0) {
|
|
813
813
|
if (process.env.NODE_ENV !== "production") {
|
|
814
814
|
const r = rt[t];
|
|
815
815
|
if (n && wr(n), w(`Unhandled error${r ? ` during execution of ${r}` : ""}`), n && Er(), o)
|
|
@@ -818,14 +818,14 @@ function yr(e, t, n, o = !0) {
|
|
|
818
818
|
} else
|
|
819
819
|
console.error(e);
|
|
820
820
|
}
|
|
821
|
-
let
|
|
821
|
+
let Ie = !1, ze = !1;
|
|
822
822
|
const P = [];
|
|
823
823
|
let U = 0;
|
|
824
824
|
const ee = [];
|
|
825
825
|
let T = null, A = 0;
|
|
826
826
|
const Gt = /* @__PURE__ */ Promise.resolve();
|
|
827
827
|
let ot = null;
|
|
828
|
-
const
|
|
828
|
+
const yr = 100;
|
|
829
829
|
function Rr(e) {
|
|
830
830
|
const t = ot || Gt;
|
|
831
831
|
return e ? t.then(this ? e.bind(this) : e) : t;
|
|
@@ -841,11 +841,11 @@ function vr(e) {
|
|
|
841
841
|
function st(e) {
|
|
842
842
|
(!P.length || !P.includes(
|
|
843
843
|
e,
|
|
844
|
-
|
|
844
|
+
Ie && e.allowRecurse ? U + 1 : U
|
|
845
845
|
)) && (e.id == null ? P.push(e) : P.splice(vr(e.id), 0, e), Jt());
|
|
846
846
|
}
|
|
847
847
|
function Jt() {
|
|
848
|
-
!
|
|
848
|
+
!Ie && !ze && (ze = !0, ot = Gt.then(Yt));
|
|
849
849
|
}
|
|
850
850
|
function Xt(e) {
|
|
851
851
|
h(e) ? ee.push(...e) : (!T || !T.includes(
|
|
@@ -876,7 +876,7 @@ const le = (e) => e.id == null ? 1 / 0 : e.id, Cr = (e, t) => {
|
|
|
876
876
|
return n;
|
|
877
877
|
};
|
|
878
878
|
function Yt(e) {
|
|
879
|
-
ze = !1,
|
|
879
|
+
ze = !1, Ie = !0, process.env.NODE_ENV !== "production" && (e = e || /* @__PURE__ */ new Map()), P.sort(Cr);
|
|
880
880
|
const t = process.env.NODE_ENV !== "production" ? (n) => Qt(e, n) : xt;
|
|
881
881
|
try {
|
|
882
882
|
for (U = 0; U < P.length; U++) {
|
|
@@ -888,7 +888,7 @@ function Yt(e) {
|
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
890
|
} finally {
|
|
891
|
-
U = 0, P.length = 0, xr(e),
|
|
891
|
+
U = 0, P.length = 0, xr(e), Ie = !1, ot = null, (P.length || ee.length) && Yt(e);
|
|
892
892
|
}
|
|
893
893
|
}
|
|
894
894
|
function Qt(e, t) {
|
|
@@ -896,7 +896,7 @@ function Qt(e, t) {
|
|
|
896
896
|
e.set(t, 1);
|
|
897
897
|
else {
|
|
898
898
|
const n = e.get(t);
|
|
899
|
-
if (n >
|
|
899
|
+
if (n > yr) {
|
|
900
900
|
const o = t.ownerInstance, r = o && an(o.type);
|
|
901
901
|
return w(
|
|
902
902
|
`Maximum recursive updates exceeded${r ? ` in component <${r}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
|
|
@@ -911,9 +911,9 @@ process.env.NODE_ENV !== "production" && (Ue().__VUE_HMR_RUNTIME__ = {
|
|
|
911
911
|
rerender: Te(Mr),
|
|
912
912
|
reload: Te(Vr)
|
|
913
913
|
});
|
|
914
|
-
const
|
|
914
|
+
const ye = /* @__PURE__ */ new Map();
|
|
915
915
|
function Pr(e, t) {
|
|
916
|
-
return
|
|
916
|
+
return ye.has(e) ? !1 : (ye.set(e, {
|
|
917
917
|
initialDef: oe(t),
|
|
918
918
|
instances: /* @__PURE__ */ new Set()
|
|
919
919
|
}), !0);
|
|
@@ -922,13 +922,13 @@ function oe(e) {
|
|
|
922
922
|
return un(e) ? e.__vccOpts : e;
|
|
923
923
|
}
|
|
924
924
|
function Mr(e, t) {
|
|
925
|
-
const n =
|
|
925
|
+
const n = ye.get(e);
|
|
926
926
|
n && (n.initialDef.render = t, [...n.instances].forEach((o) => {
|
|
927
927
|
t && (o.render = t, oe(o.type).render = t), o.renderCache = [], o.update();
|
|
928
928
|
}));
|
|
929
929
|
}
|
|
930
930
|
function Vr(e, t) {
|
|
931
|
-
const n =
|
|
931
|
+
const n = ye.get(e);
|
|
932
932
|
if (!n)
|
|
933
933
|
return;
|
|
934
934
|
t = oe(t), Et(n.initialDef, t);
|
|
@@ -1030,9 +1030,9 @@ function Zt(e, t, { immediate: n, deep: o, flush: r, onTrack: s, onTrigger: i }
|
|
|
1030
1030
|
};
|
|
1031
1031
|
W.allowRecurse = !!t;
|
|
1032
1032
|
let ue;
|
|
1033
|
-
r === "sync" ? ue = W : r === "post" ? ue = () =>
|
|
1033
|
+
r === "sync" ? ue = W : r === "post" ? ue = () => It(W, u && u.suspense) : (W.pre = !0, u && (W.id = u.uid), ue = () => st(W));
|
|
1034
1034
|
const C = new jn(d, ue);
|
|
1035
|
-
return process.env.NODE_ENV !== "production" && (C.onTrack = s, C.onTrigger = i), t ? n ? W() : v = C.run() : r === "post" ?
|
|
1035
|
+
return process.env.NODE_ENV !== "production" && (C.onTrack = s, C.onTrigger = i), t ? n ? W() : v = C.run() : r === "post" ? It(
|
|
1036
1036
|
C.run.bind(C),
|
|
1037
1037
|
u && u.suspense
|
|
1038
1038
|
) : C.run(), () => {
|
|
@@ -1058,14 +1058,14 @@ function Fr(e, t) {
|
|
|
1058
1058
|
};
|
|
1059
1059
|
}
|
|
1060
1060
|
function Z(e, t) {
|
|
1061
|
-
if (!
|
|
1061
|
+
if (!I(e) || e.__v_skip || (t = t || /* @__PURE__ */ new Set(), t.has(e)))
|
|
1062
1062
|
return e;
|
|
1063
1063
|
if (t.add(e), S(e))
|
|
1064
1064
|
Z(e.value, t);
|
|
1065
1065
|
else if (h(e))
|
|
1066
1066
|
for (let n = 0; n < e.length; n++)
|
|
1067
1067
|
Z(e[n], t);
|
|
1068
|
-
else if (
|
|
1068
|
+
else if (yn(e) || k(e))
|
|
1069
1069
|
e.forEach((n) => {
|
|
1070
1070
|
Z(n, t);
|
|
1071
1071
|
});
|
|
@@ -1158,7 +1158,7 @@ const kt = (e) => (t, n = z) => (
|
|
|
1158
1158
|
const d = se[t];
|
|
1159
1159
|
let a, f;
|
|
1160
1160
|
if (d)
|
|
1161
|
-
return t === "$attrs" ? (
|
|
1161
|
+
return t === "$attrs" ? (y(e, "get", t), process.env.NODE_ENV !== "production" && void 0) : process.env.NODE_ENV !== "production" && t === "$slots" && y(e, "get", t), d(e);
|
|
1162
1162
|
if (
|
|
1163
1163
|
// css module (injected by vue-loader)
|
|
1164
1164
|
(a = c.__cssModules) && (a = a[t])
|
|
@@ -1219,7 +1219,7 @@ function qr(e) {
|
|
|
1219
1219
|
let l;
|
|
1220
1220
|
return c ? l = c : !r.length && !n && !o ? l = t : (l = {}, r.length && r.forEach(
|
|
1221
1221
|
(u) => Re(l, u, i, !0)
|
|
1222
|
-
), Re(l, t, i)),
|
|
1222
|
+
), Re(l, t, i)), I(t) && s.set(t, l), l;
|
|
1223
1223
|
}
|
|
1224
1224
|
function Re(e, t, n, o = !1) {
|
|
1225
1225
|
const { mixins: r, extends: s } = t;
|
|
@@ -1311,7 +1311,7 @@ function Xr(e, t) {
|
|
|
1311
1311
|
n[o] = O(e[o], t[o]);
|
|
1312
1312
|
return n;
|
|
1313
1313
|
}
|
|
1314
|
-
const
|
|
1314
|
+
const It = $r, Yr = (e) => e.__isTeleport, en = Symbol.for("v-fgt"), Qr = Symbol.for("v-txt"), Zr = Symbol.for("v-cmt"), Ee = [];
|
|
1315
1315
|
let M = null;
|
|
1316
1316
|
function kr(e = !1) {
|
|
1317
1317
|
Ee.push(M = e ? null : []);
|
|
@@ -1399,9 +1399,9 @@ function on(e, t = null, n = null, o = 0, r = null, s = !1) {
|
|
|
1399
1399
|
if (un(e) && (e = e.__vccOpts), t) {
|
|
1400
1400
|
t = io(t);
|
|
1401
1401
|
let { class: c, style: l } = t;
|
|
1402
|
-
c && !V(c) && (t.class = Xe(c)),
|
|
1402
|
+
c && !V(c) && (t.class = Xe(c)), I(l) && (Le(l) && !h(l) && (l = x({}, l)), t.style = Je(l));
|
|
1403
1403
|
}
|
|
1404
|
-
const i = V(e) ? 1 : Dr(e) ? 128 : Yr(e) ? 64 :
|
|
1404
|
+
const i = V(e) ? 1 : Dr(e) ? 128 : Yr(e) ? 64 : I(e) ? 4 : E(e) ? 2 : 0;
|
|
1405
1405
|
return process.env.NODE_ENV !== "production" && i & 4 && Le(e) && (e = p(e), w(
|
|
1406
1406
|
"Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
|
|
1407
1407
|
`
|
|
@@ -1511,8 +1511,8 @@ function ao(...e) {
|
|
|
1511
1511
|
}
|
|
1512
1512
|
return t;
|
|
1513
1513
|
}
|
|
1514
|
-
let z = null, ct, Y,
|
|
1515
|
-
(Y = Ue()[
|
|
1514
|
+
let z = null, ct, Y, yt = "__VUE_INSTANCE_SETTERS__";
|
|
1515
|
+
(Y = Ue()[yt]) || (Y = Ue()[yt] = []), Y.push((e) => z = e), ct = (e) => {
|
|
1516
1516
|
Y.length > 1 ? Y.forEach((t) => t(e)) : Y[0](e);
|
|
1517
1517
|
};
|
|
1518
1518
|
const Be = (e) => {
|
|
@@ -1570,7 +1570,7 @@ function ho() {
|
|
|
1570
1570
|
return;
|
|
1571
1571
|
const e = { style: "color:#3ba776" }, t = { style: "color:#0b1bc9" }, n = { style: "color:#b62e24" }, o = { style: "color:#9d288c" }, r = {
|
|
1572
1572
|
header(a) {
|
|
1573
|
-
return
|
|
1573
|
+
return I(a) ? a.__isVue ? ["div", e, "VueInstance"] : S(a) ? [
|
|
1574
1574
|
"div",
|
|
1575
1575
|
{},
|
|
1576
1576
|
["span", e, d(a)],
|
|
@@ -1650,7 +1650,7 @@ function ho() {
|
|
|
1650
1650
|
] : ["span", {}];
|
|
1651
1651
|
}
|
|
1652
1652
|
function c(a, f = !0) {
|
|
1653
|
-
return typeof a == "number" ? ["span", t, a] : typeof a == "string" ? ["span", n, JSON.stringify(a)] : typeof a == "boolean" ? ["span", o, a] :
|
|
1653
|
+
return typeof a == "number" ? ["span", t, a] : typeof a == "string" ? ["span", n, JSON.stringify(a)] : typeof a == "boolean" ? ["span", o, a] : I(a) ? ["object", { object: f ? p(a) : a }] : ["span", n, String(a)];
|
|
1654
1654
|
}
|
|
1655
1655
|
function l(a, f) {
|
|
1656
1656
|
const m = a.type;
|
|
@@ -1663,7 +1663,7 @@ function ho() {
|
|
|
1663
1663
|
}
|
|
1664
1664
|
function u(a, f, m) {
|
|
1665
1665
|
const R = a[m];
|
|
1666
|
-
if (h(R) && R.includes(f) ||
|
|
1666
|
+
if (h(R) && R.includes(f) || I(R) && f in R || a.extends && u(a.extends, f, m) || a.mixins && a.mixins.some((v) => u(v, f, m)))
|
|
1667
1667
|
return !0;
|
|
1668
1668
|
}
|
|
1669
1669
|
function d(a) {
|
|
@@ -1843,9 +1843,7 @@ function bo(e) {
|
|
|
1843
1843
|
function vt() {
|
|
1844
1844
|
if (!window[b.MICRO_APP])
|
|
1845
1845
|
return;
|
|
1846
|
-
const { name: e, sync: t, mainBaseURL: n } = window[b.MICRO_APP];
|
|
1847
|
-
console.trace("syncUrlToWindow");
|
|
1848
|
-
const o = window.location.pathname + window.location.search + window.location.hash;
|
|
1846
|
+
const { name: e, sync: t, mainBaseURL: n } = window[b.MICRO_APP], o = window.location.pathname + window.location.search + window.location.hash;
|
|
1849
1847
|
window.parent.postMessage({
|
|
1850
1848
|
cmd: "$xt/micro/sync",
|
|
1851
1849
|
data: {
|
|
@@ -1868,9 +1866,9 @@ const So = {
|
|
|
1868
1866
|
return xe[e.name] = Ve(B({}, t), {
|
|
1869
1867
|
instance: new Eo(e)
|
|
1870
1868
|
}), xe[e.name];
|
|
1871
|
-
}, fn = (e) => xe[e],
|
|
1869
|
+
}, fn = (e) => xe[e], Io = (e, t) => xe[e.name] = B(B({}, e), t), yo = (e, t) => new Promise((n, o) => {
|
|
1872
1870
|
let r = fn(e);
|
|
1873
|
-
r ? (t && (r.instance.changeOptions(t), r =
|
|
1871
|
+
r ? (t && (r.instance.changeOptions(t), r = Io(r, t)), r.preload ? r.instance.preloadRender(r.el) : r.instance.mount(r.el), n(r)) : o("app not found");
|
|
1874
1872
|
}), Ro = (e) => {
|
|
1875
1873
|
let t = fn(e);
|
|
1876
1874
|
t && t.instance.unmount();
|
|
@@ -1881,7 +1879,7 @@ const So = {
|
|
|
1881
1879
|
},
|
|
1882
1880
|
setup(e) {
|
|
1883
1881
|
const t = e, n = Wt(), o = () => {
|
|
1884
|
-
t.appId &&
|
|
1882
|
+
t.appId && yo(t.appId, {
|
|
1885
1883
|
el: n.value
|
|
1886
1884
|
});
|
|
1887
1885
|
};
|
|
@@ -1908,6 +1906,6 @@ export {
|
|
|
1908
1906
|
fn as getApp,
|
|
1909
1907
|
Po as microInit,
|
|
1910
1908
|
Mo as setupApp,
|
|
1911
|
-
|
|
1909
|
+
yo as startApp,
|
|
1912
1910
|
Ro as stopApp
|
|
1913
1911
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.xt-micro{background-color:#fff}.xt-micro:before{
|
|
1
|
+
.xt-micro{background-color:#fff}.xt-micro:before{content:"加载中";position:absolute;inset:0;display:flex;justify-content:center;align-items:center;z-index:-1}.micro-iframe{width:100%;height:100%;border:none;margin:0;padding:0}.micro-iframe:after{content:"加载中";position:absolute;inset:0;display:flex;justify-content:center;align-items:center;background:#fff}
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
package/postcss.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
const defaultList = [
|
|
2
|
-
require('postcss-import'), // 使css支持@import相互引入
|
|
3
|
-
// require('postcss-simple-vars'), // 使css支持变量($blue: #056ef0;),老项目如果用到了sass里的变量,需要加载该插件
|
|
4
|
-
require('postcss-utilities'), // 支持常用工具(具体参照: https://github.com/ismamz/postcss-utilities#:~:text=postcss-utilities%20is%20a%20PostCSS%20plugin%20that%20includes%20the,started%20using%20postcss-utilities%20Try%20it%20in%20the%20browser%21)
|
|
5
|
-
require('postcss-nested'), // 支持嵌套语法,貌似postcss-preset-env里含语法嵌套,出现嵌套问题再尝试加载此插件
|
|
6
|
-
require('postcss-preset-env')({
|
|
7
|
-
stage: 0
|
|
8
|
-
}), // 对css4语法进行降阶(如自定义选择器),已经包含autoprefixer
|
|
9
|
-
]
|
|
10
|
-
const developmentList = [
|
|
11
|
-
|
|
12
|
-
]
|
|
13
|
-
|
|
14
|
-
const productionList = [
|
|
15
|
-
require('cssnano'), // css压缩
|
|
16
|
-
]
|
|
17
|
-
module.exports = {
|
|
18
|
-
parser: 'postcss-scss',
|
|
19
|
-
plugins: [
|
|
20
|
-
...defaultList,
|
|
21
|
-
...(process.env.NODE_ENV === 'development' ? developmentList : productionList)
|
|
22
|
-
]
|
|
23
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"strict": false,
|
|
8
|
-
"jsx": "preserve",
|
|
9
|
-
"sourceMap": false,
|
|
10
|
-
"resolveJsonModule": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"lib": ["esnext", "dom"],
|
|
13
|
-
"paths": {
|
|
14
|
-
"@/*": ["./src/*"]
|
|
15
|
-
},
|
|
16
|
-
"types": ["element-plus/global"],
|
|
17
|
-
"declaration": true,
|
|
18
|
-
"declarationDir": "dist",
|
|
19
|
-
"outDir": "./dist",
|
|
20
|
-
"rootDir": "./src",
|
|
21
|
-
},
|
|
22
|
-
"exclude": ["node_modules", "dist"],
|
|
23
|
-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
|
|
24
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import vue from '@vitejs/plugin-vue'
|
|
3
|
-
import dts from 'vite-plugin-dts';
|
|
4
|
-
// import { name, version } from './package.json'
|
|
5
|
-
|
|
6
|
-
export default defineConfig(({ mode }) => {
|
|
7
|
-
return {
|
|
8
|
-
base: './',
|
|
9
|
-
build: {
|
|
10
|
-
lib: {
|
|
11
|
-
entry: ['src/index.ts'],
|
|
12
|
-
name: '__xt_micro__',
|
|
13
|
-
formats: ['es'],
|
|
14
|
-
fileName: (format, entryName) => `index.js`,
|
|
15
|
-
},
|
|
16
|
-
target: 'es2015',
|
|
17
|
-
emptyOutDir: true, //去掉打包到项目外的警告
|
|
18
|
-
outDir: `./dist`,
|
|
19
|
-
},
|
|
20
|
-
plugins: [
|
|
21
|
-
vue(),
|
|
22
|
-
dts({
|
|
23
|
-
outDir: 'dist/types'
|
|
24
|
-
})
|
|
25
|
-
],
|
|
26
|
-
}
|
|
27
|
-
})
|