@fulgurjs/federation 0.9.1-test.1 → 2.0.0
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/CHANGELOG.md +65 -0
- package/DESIGN.md +3 -3
- package/README.md +42 -37
- package/client.d.ts +11 -18
- package/dist/{chunk-CK42RK2O.js → chunk-3VBYOVH4.js} +3 -3
- package/dist/{chunk-NXN26CWX.js → chunk-5GZKZWP2.js} +1 -1
- package/dist/cli.js +6 -6
- package/dist/config.cjs +6 -6
- package/dist/config.d.cts +18 -18
- package/dist/config.d.ts +18 -18
- package/dist/config.js +4 -4
- package/dist/context.cjs +24 -20
- package/dist/context.d.cts +8 -9
- package/dist/context.d.ts +8 -9
- package/dist/context.js +21 -17
- package/dist/index.cjs +2 -9
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -9
- package/dist/pages.cjs +7 -7
- package/dist/pages.d.cts +6 -6
- package/dist/pages.d.ts +6 -6
- package/dist/pages.js +5 -5
- package/dist/runtime.js +2 -2
- package/dist/vue.cjs +19 -34
- package/dist/vue.js +20 -35
- package/docs//350/277/201/347/247/273/346/214/207/345/215/227.md +10 -11
- package/examples/{fulgur.config.example.ts → fulgurjs.config.example.ts} +2 -2
- package/package.json +6 -6
package/dist/pages.cjs
CHANGED
|
@@ -20,8 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/pages.ts
|
|
21
21
|
var pages_exports = {};
|
|
22
22
|
__export(pages_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
definePages: () => definePages,
|
|
24
|
+
validatePages: () => validatePages
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(pages_exports);
|
|
27
27
|
var normSpec = (s) => s.replace(/^[./]+/, "").replace(/\/+$/, "");
|
|
@@ -53,7 +53,7 @@ function remoteOfRoute(route, remotes) {
|
|
|
53
53
|
}
|
|
54
54
|
return null;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function validatePages(pages, options = {}) {
|
|
57
57
|
const deriveSpec = options.deriveSpec ?? defaultDeriveSpec;
|
|
58
58
|
const violations = [];
|
|
59
59
|
const effective = pages.map((p) => normSpec(p.spec ?? deriveSpec(p.route)));
|
|
@@ -149,8 +149,8 @@ function formatViolations(violations) {
|
|
|
149
149
|
}
|
|
150
150
|
return out.trim();
|
|
151
151
|
}
|
|
152
|
-
function
|
|
153
|
-
const violations =
|
|
152
|
+
function definePages(pages, options = {}) {
|
|
153
|
+
const violations = validatePages(pages, options);
|
|
154
154
|
const errors = violations.filter((v) => v.level === "error");
|
|
155
155
|
const warns = violations.filter((v) => v.level === "warn");
|
|
156
156
|
const text = formatViolations(violations);
|
|
@@ -164,6 +164,6 @@ function defineFulgurjsPages(pages, options = {}) {
|
|
|
164
164
|
}
|
|
165
165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
166
|
0 && (module.exports = {
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
definePages,
|
|
168
|
+
validatePages
|
|
169
169
|
});
|
package/dist/pages.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* D.2 宿主路由表校验器(
|
|
2
|
+
* D.2 宿主路由表校验器(definePages)
|
|
3
3
|
*
|
|
4
4
|
* 背景:带参路由缺省推导 spec 时会剥离 :参数 段,可能与其它条目(如列表页)的
|
|
5
5
|
* expose 键收敛相同 → 静默加载错误组件(真实事故:复制流程误走更新语义)。
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* 含路由完全重复
|
|
18
18
|
* - R5 [WARN] name 字段重复(vue-router 命名跳转歧义)
|
|
19
19
|
*/
|
|
20
|
-
interface
|
|
20
|
+
interface PageRouteLike {
|
|
21
21
|
/** 宿主路由路径(:param 段) */
|
|
22
22
|
route: string;
|
|
23
23
|
/** 显式 spec(缺省走推导) */
|
|
@@ -32,7 +32,7 @@ interface RemoteSchemaEntry {
|
|
|
32
32
|
/** manifest 是否成功拉取(false 时跳过该 remote 的 R3,诚实降级) */
|
|
33
33
|
exists?: boolean;
|
|
34
34
|
}
|
|
35
|
-
interface
|
|
35
|
+
interface PagesOptions {
|
|
36
36
|
/**
|
|
37
37
|
* 带参路由的缺省 spec 推导规则(宿主私有约定,如
|
|
38
38
|
* (route) => `pages/${route 去前缀去 :参}`)。
|
|
@@ -55,12 +55,12 @@ interface PageViolation {
|
|
|
55
55
|
/**
|
|
56
56
|
* 校验路由表(独立导出便于单测):返回违例清单(不抛错)。
|
|
57
57
|
*/
|
|
58
|
-
declare function
|
|
58
|
+
declare function validatePages(pages: PageRouteLike[], options?: PagesOptions): PageViolation[];
|
|
59
59
|
/**
|
|
60
60
|
* 宿主路由表定义入口:校验(聚合报错)后原样返回入参,不改写任何字段。
|
|
61
61
|
* 违反 ERROR 级规则时默认 throw(dev overlay / build 失败直接可见);
|
|
62
62
|
* strict: false 时降级 console.error。WARN 级始终 console.warn。
|
|
63
63
|
*/
|
|
64
|
-
declare function
|
|
64
|
+
declare function definePages<P extends PageRouteLike[]>(pages: P, options?: PagesOptions): P;
|
|
65
65
|
|
|
66
|
-
export { type
|
|
66
|
+
export { type PageRouteLike, type PageViolation, type PagesOptions, type RemoteSchemaEntry, definePages, validatePages };
|
package/dist/pages.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* D.2 宿主路由表校验器(
|
|
2
|
+
* D.2 宿主路由表校验器(definePages)
|
|
3
3
|
*
|
|
4
4
|
* 背景:带参路由缺省推导 spec 时会剥离 :参数 段,可能与其它条目(如列表页)的
|
|
5
5
|
* expose 键收敛相同 → 静默加载错误组件(真实事故:复制流程误走更新语义)。
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* 含路由完全重复
|
|
18
18
|
* - R5 [WARN] name 字段重复(vue-router 命名跳转歧义)
|
|
19
19
|
*/
|
|
20
|
-
interface
|
|
20
|
+
interface PageRouteLike {
|
|
21
21
|
/** 宿主路由路径(:param 段) */
|
|
22
22
|
route: string;
|
|
23
23
|
/** 显式 spec(缺省走推导) */
|
|
@@ -32,7 +32,7 @@ interface RemoteSchemaEntry {
|
|
|
32
32
|
/** manifest 是否成功拉取(false 时跳过该 remote 的 R3,诚实降级) */
|
|
33
33
|
exists?: boolean;
|
|
34
34
|
}
|
|
35
|
-
interface
|
|
35
|
+
interface PagesOptions {
|
|
36
36
|
/**
|
|
37
37
|
* 带参路由的缺省 spec 推导规则(宿主私有约定,如
|
|
38
38
|
* (route) => `pages/${route 去前缀去 :参}`)。
|
|
@@ -55,12 +55,12 @@ interface PageViolation {
|
|
|
55
55
|
/**
|
|
56
56
|
* 校验路由表(独立导出便于单测):返回违例清单(不抛错)。
|
|
57
57
|
*/
|
|
58
|
-
declare function
|
|
58
|
+
declare function validatePages(pages: PageRouteLike[], options?: PagesOptions): PageViolation[];
|
|
59
59
|
/**
|
|
60
60
|
* 宿主路由表定义入口:校验(聚合报错)后原样返回入参,不改写任何字段。
|
|
61
61
|
* 违反 ERROR 级规则时默认 throw(dev overlay / build 失败直接可见);
|
|
62
62
|
* strict: false 时降级 console.error。WARN 级始终 console.warn。
|
|
63
63
|
*/
|
|
64
|
-
declare function
|
|
64
|
+
declare function definePages<P extends PageRouteLike[]>(pages: P, options?: PagesOptions): P;
|
|
65
65
|
|
|
66
|
-
export { type
|
|
66
|
+
export { type PageRouteLike, type PageViolation, type PagesOptions, type RemoteSchemaEntry, definePages, validatePages };
|
package/dist/pages.js
CHANGED
|
@@ -28,7 +28,7 @@ function remoteOfRoute(route, remotes) {
|
|
|
28
28
|
}
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function validatePages(pages, options = {}) {
|
|
32
32
|
const deriveSpec = options.deriveSpec ?? defaultDeriveSpec;
|
|
33
33
|
const violations = [];
|
|
34
34
|
const effective = pages.map((p) => normSpec(p.spec ?? deriveSpec(p.route)));
|
|
@@ -124,8 +124,8 @@ function formatViolations(violations) {
|
|
|
124
124
|
}
|
|
125
125
|
return out.trim();
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
const violations =
|
|
127
|
+
function definePages(pages, options = {}) {
|
|
128
|
+
const violations = validatePages(pages, options);
|
|
129
129
|
const errors = violations.filter((v) => v.level === "error");
|
|
130
130
|
const warns = violations.filter((v) => v.level === "warn");
|
|
131
131
|
const text = formatViolations(violations);
|
|
@@ -138,6 +138,6 @@ function defineFulgurjsPages(pages, options = {}) {
|
|
|
138
138
|
return pages;
|
|
139
139
|
}
|
|
140
140
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
definePages,
|
|
142
|
+
validatePages
|
|
143
143
|
};
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
1
|
+
var X=/^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-((?:[0-9A-Za-z-]+)(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z.-]+)?$/;function T(t){let n=X.exec(String(t).trim());return n?{major:Number(n[1]),minor:Number(n[2]??0),patch:Number(n[3]??0),pre:n[4]?n[4].split("."):[]}:null}function Y(t,n){if(t.length===0&&n.length===0)return 0;if(t.length===0)return 1;if(n.length===0)return-1;let o=Math.max(t.length,n.length);for(let r=0;r<o;r++){let l=t[r],m=n[r];if(l===void 0)return-1;if(m===void 0)return 1;let y=/^\d+$/.test(l),E=/^\d+$/.test(m);if(y&&E){let w=Number(l)-Number(m);if(w!==0)return w}else{if(y!==E)return y?-1:1;if(l!==m)return l<m?-1:1}}return 0}function v(t,n){let o=T(t),r=T(n);return!o||!r?t<n?-1:t>n?1:0:o.major!==r.major?o.major-r.major:o.minor!==r.minor?o.minor-r.minor:o.patch!==r.patch?o.patch-r.patch:Y(o.pre,r.pre)}var Z=/^[a-z]+[+:-]/i;function O(t,n){if(n===!1||n==null||n==="")return!0;let o=String(n).trim();return!o||o==="*"||o==="latest"||Z.test(o)?!0:o.split("||").some(r=>Q(t,r.trim()))}function Q(t,n){if(!n||n==="*")return!T(t)?.pre.length;let o=n.split(/\s+-\s+/);if(o.length===2){let m=o[0].trim(),y=o[1].trim();return!(!O(t,`>=${m}`)||!O(t,`<=${y}`))}let r=T(t);if(!r)return!1;let l=ee(n);if(l===null)return!0;for(let m of l)if(!ie(r,t,m))return!1;return!(r.pre.length>0&&!l.some(m=>m.ver.pre.length>0)&&!l.some(y=>y.ver.major===r.major&&y.ver.minor===r.minor&&y.ver.patch===r.patch))}function ee(t){let n=[],o=t.trim().split(/\s+/).filter(Boolean);if(o.length===0)return null;for(let r of o){let l=/^(>=|<=|>|<|=|\^|~)?(.*)$/.exec(r);if(!l)return null;let m=l[1],y=l[2],E=re(m,y);if(E===null)return null;n.push(...E)}return n}function re(t,n){let o=ne(n);if(!o)return null;let{ver:r,partial:l}=o;switch(t){case"^":{let m=te(r);return m?[{op:">=",ver:r},{op:"<",ver:m}]:null}case"~":{let m=l>=2?{major:r.major,minor:r.minor+1,patch:0,pre:[]}:{major:r.major+1,minor:0,patch:0,pre:[]};return[{op:">=",ver:r},{op:"<",ver:m}]}case">=":return[{op:">=",ver:r}];case">":return l===1?[{op:">=",ver:{major:r.major+1,minor:0,patch:0,pre:[]}}]:l===2?[{op:">=",ver:{major:r.major,minor:r.minor+1,patch:0,pre:[]}}]:[{op:">",ver:r}];case"<":return l===1?[{op:"<",ver:{major:r.major,minor:0,patch:0,pre:[]}}]:l===2?[{op:"<",ver:{major:r.major,minor:r.minor,patch:0,pre:[]}}]:[{op:"<",ver:r}];case"<=":return[{op:"<=",ver:r}];case"=":case void 0:return l===1?[{op:">=",ver:r},{op:"<",ver:{major:r.major+1,minor:0,patch:0,pre:[]}}]:l===2?[{op:">=",ver:r},{op:"<",ver:{major:r.major,minor:r.minor+1,patch:0,pre:[]}}]:[{op:"=",ver:r}];default:return null}}function te(t){return t.major>0?{major:t.major+1,minor:0,patch:0,pre:[]}:t.minor>0?{major:0,minor:t.minor+1,patch:0,pre:[]}:{major:0,minor:0,patch:t.patch+1,pre:[]}}function ne(t){let n=t.replace(/^v/,"").trim();if(!n||n==="*"||n==="x"||n==="X")return{ver:{major:0,minor:0,patch:0,pre:[]},partial:0};let o=n.split("."),r=[],l=0;for(let E of o.slice(0,3))if(/^\d+$/.test(E))r.push(Number(E)),l++;else{if(E==="x"||E==="X"||E==="*")break;break}let m=n.split("-"),y=m.length>1?m.slice(1).join("-").split("+")[0].split("."):[];return l===0&&y.length===0?{ver:{major:0,minor:0,patch:0,pre:[]},partial:0}:{ver:{major:r[0]??0,minor:r[1]??0,patch:r[2]??0,pre:y},partial:l}}function oe(t,n){switch(n){case">=":return t>=0;case">":return t>0;case"<":return t<0;case"<=":return t<=0;case"=":return t===0}}function ie(t,n,o){let r=`${t.major}.${t.minor}.${t.patch}`+(t.pre.length?`-${t.pre.join(".")}`:"");if(o.upper)return!(!(v(r,`${o.ver.major}.${o.ver.minor}.${o.ver.patch}`+(o.ver.pre.length?`-${o.ver.pre.join(".")}`:""))>=0)||!(v(r,`${o.upper.major}.${o.upper.minor}.${o.upper.patch}`)<0));let l=v(r,`${o.ver.major}.${o.ver.minor}.${o.ver.patch}`+(o.ver.pre.length?`-${o.ver.pre.join(".")}`:"")),m=oe(l,o.op);return o.ver.pre.length>0&&t.pre.length===0&&(o.op===">"||o.op==="<")?!1:m}var g=class extends Error{code;details;constructor(n,o,r){super(`[fulgurjs:${n}] ${o}`),this.name="FgError",this.code=n,this.details=r}},S={REMOTE_LOAD_FAILED:"MFU-001",REMOTE_NAME_MISMATCH:"MFU-002",SHARE_STRICT_VERSION:"MFU-003",SHARE_NOT_AVAILABLE:"MFU-004",CONTAINER_REINIT_CONFLICT:"MFU-005",MODULE_NOT_EXPOSED:"MFU-006",PRELOAD_FAILED:"MFU-007",REMOTE_UNKNOWN:"MFU-008",EMPTY_EXPORTS:"MFU-009",SINGLETON_SKEW:"MFU-010"};var U="2.0.0";var A=15e3,P=2,ae=5,se=3e4;function ce(){let t={},n=new Map,o=[],r=new Map,l=new WeakMap,m={},y=()=>{for(let e of o)try{e.init?.(m)}catch(i){console.warn("[fulgurjs] runtimePlugin init failed:",e.name,i)}},E=e=>t[e]??={};function w(e){try{m.onRemoteError?.(e)}catch{}typeof window<"u"&&window.dispatchEvent(new CustomEvent("fulgurjs:error",{detail:e}))}function F(e="default"){return E(e),t}function V(e,i,a,c,R={}){let s=E(e||"default"),u=s[i]??={};u[a]||(u[a]={version:a,get:c,from:R.from??"unknown",eager:!!R.eager,loaded:!!R.loaded})}function I(e){for(let i of e){let a=n.get(i.name);n.set(i.name,{timeout:A,retries:P,...a,...i,state:a?.state??"idle",breakerState:a?.breakerState??{fails:0,openUntil:0},debug:a?.debug??{entry:i.entry,status:"idle"}})}}function D(e){I([e])}function H(e){o.push(...e),y()}async function K(e,i={}){let a=i.shareScope||"default",c=i.shareKey||e,s=E(a)[c]||{},u=Object.keys(s),d=i.requiredVersion,f=u.filter(p=>d===void 0||d===!1||O(p,d)),_;if(i.singleton&&u.length>0){let p=u.filter(h=>s[h].loaded);if(_=[...p.length?p:u].sort(v).pop(),u.length>1||!f.includes(_)){let h=s[_],j=`singleton skew "${c}": req "${d??"any"}" use ${_} from ${h.from}`;if(i.strictVersion){let M=new g(S.SHARE_STRICT_VERSION,j,{shareKey:c,requiredVersion:d});throw w({remote:h.from,error:M}),M}console.warn(`[fulgurjs:MFU-010] ${j}`)}}else if(_=[...f].sort(v).pop(),!_){if(i.strictVersion){let h=new g(S.SHARE_STRICT_VERSION,`no satisfying version for "${c}" (required "${d}") in share scope "${a}"`);throw w({remote:c,error:h}),h}if(i.fallback)return i.fallback();let p=new g(S.SHARE_NOT_AVAILABLE,`shared "${c}" (${d??"any"}) unavailable in scope "${a}" (no local fallback)`,{shareKey:c,requiredVersion:d});throw w({remote:c,error:p}),p}let $=s[_];if(m.resolveShare){let p=await m.resolveShare({shareKey:c,shareScope:a,requiredVersion:d,picked:$,available:Object.values(s)});p&&($=p)}return $.loaded=!0,$.get()}function q(e,i,a){return new Promise((c,R)=>{let s=setTimeout(()=>R(new Error(`timeout after ${i}ms: ${a}`)),i);e.then(u=>{clearTimeout(s),c(u)},u=>{clearTimeout(s),R(u)})})}let z=e=>new Promise(i=>setTimeout(i,e));function k(e,i){if(!e||typeof e.get!="function")throw new Error(`remoteEntry of "${i.name}" does not export a container interface (get/init)`);if(e.name&&i.name&&e.name!==i.name){let a=`remoteEntry self-reported name "${e.name}" mismatches configured name "${i.name}"`;if(i.promise)console.warn(`[fulgurjs] ${a} (promise-based remote, continuing)`);else throw Object.assign(new Error(a),{code:S.REMOTE_NAME_MISMATCH})}}async function L(e,i){return q(import(e),i.timeout??A,`load remoteEntry ${e}`)}async function x(e,i){let a=e.shareScope||"default";if(e.container){let s=l.get(e.container);if(s&&s!==a)throw new g(S.CONTAINER_REINIT_CONFLICT,`container "${e.name}" already initialized with share scope "${s}", cannot re-init with "${a}"`);return e.container}if(e.containerPromise)return e.containerPromise;let c=e.breakerState;if(c.openUntil>Date.now()){let s=new g(S.REMOTE_LOAD_FAILED,`circuit breaker open for remote "${e.name}" until ${new Date(c.openUntil).toISOString()}`,{remote:e.name});throw w({remote:e.name,error:s}),s}e.state="loading",e.debug.status="loading";let R=(async()=>{let s=[];if(e.promise)s.push(async()=>{let p=await e.promise(),h=typeof p=="string"?await L(p,e):p;return k(h,e),h});else for(let p of[e.entry,...e.fallback??[]])s.push(async()=>{let h=await L(p,e);return k(h,e),h});let u,d,f=!1,_=i?.retries??e.retries??P;for(let p of s){for(let h=0;h<=_;h++){let j=performance.now();try{u=await p(),e.lastLoadMs=Math.round(performance.now()-j),e.debug.lastLoadMs=e.lastLoadMs,f=!0;break}catch(M){if(d=M,M?.code)throw M;h<_&&await z(200*2**h)}}if(f)break}if(!f||!u){let p=[];throw/^https?:\/\//.test(e.entry)&&typeof location<"u"?(p.push(`1. is the remote dev server running? try opening ${e.entry} in the browser \u2014 it must return JS, not HTML/an error`),p.push("2. is the URL correct in federation({ remotes })? dev and prod entries can differ"),p.push("3. CORS: the remote dev server must allow cross-origin requests (fulgurjs-federation enables server.cors automatically; a custom server config may have disabled it)")):(p.push(`1. is the remote deployed and reachable? try opening ${e.entry} in the browser \u2014 it must return JS`),p.push("2. NGINX/CDN routing: the entry path must serve the remoteEntry JS file (check try_files / fallback rules)")),new g(S.REMOTE_LOAD_FAILED,`failed to load remote "${e.name}" from ${e.entry}: ${String(d?.message??d)}
|
|
2
2
|
`+p.join(`
|
|
3
|
-
`),{remote:e.name})}
|
|
3
|
+
`),{remote:e.name})}k(u,e);let $=l.get(u);if($&&$!==a)throw new g(S.CONTAINER_REINIT_CONFLICT,`container "${e.name}" already initialized with share scope "${$}", cannot re-init with "${a}"`);return typeof u.init=="function"&&await u.init(t),l.set(u,a),e.container=u,e.state="loaded",e.debug.status="loaded",c.fails=0,u})();e.containerPromise=R;try{return await R}catch(s){if(e.containerPromise=void 0,e.state="failed",e.debug.status="failed",e.debug.error=String(s?.message??s),c.fails+=1,c.fails>=ae&&(c.openUntil=Date.now()+se,c.fails=0),s instanceof g)throw w({remote:e.name,error:s}),s;if(s?.code)throw w({remote:e.name,error:s}),s;let u=new g(S.REMOTE_LOAD_FAILED,String(s?.message??s),{remote:e.name});throw w({remote:e.name,error:u}),u}}function N(e){let i=e.indexOf("/");return i===-1?{remote:e,module:""}:{remote:e.slice(0,i),module:G(e.slice(i+1))}}function G(e){return e?e.startsWith(".")?e:`./${e}`:""}async function J(e,i){let{remote:a,module:c}=N(e);m.beforeLoadRemote?.({remote:a,module:c});let R=n.get(a);if(!R)throw new g(S.REMOTE_UNKNOWN,`unknown remote "${a}". Register it via federation({ remotes }) or registerRemote().`,{remote:a});let s;try{s=await x(R,{retries:i?.retries})}catch(f){if(i?.fallbackModule)return console.error(`[fulgurjs] loadRemote("${e}") failed; returning fallbackModule (\u663E\u5F0F\u964D\u7EA7\uFF0C\u9519\u8BEF\u5DF2\u900F\u51FA)`,f),w({remote:a,error:f}),await i.fallbackModule();throw f}if(!c)return s;let u=`${a}@${R.shareScope||"default"}#${c}`;r.has(u)||r.set(u,s.get(c).catch(f=>{throw r.delete(u),f instanceof g||f?.code?f:new g(S.REMOTE_LOAD_FAILED,`failed to load module "${c}" from remote "${a}": ${String(f?.message??f)}`,{remote:a,module:c})}));let d;try{d=await r.get(u)}catch(f){if(i?.fallbackModule)return console.error(`[fulgurjs] loadRemote("${e}") failed; returning fallbackModule (\u663E\u5F0F\u964D\u7EA7\uFF0C\u9519\u8BEF\u5DF2\u900F\u51FA)`,f),w({remote:a,error:f}),await i.fallbackModule();throw f}if(m.afterLoadRemote?.({remote:a,module:c,module_ns:d}),d&&typeof d=="object"&&Object.keys(d).length===0){let f=new g(S.EMPTY_EXPORTS,`no exports: ${c} @ ${a}`,{remote:a,module:c});w({remote:a,error:f}),console.error(`[fulgurjs:MFU-009] ${f.message}`)}return d}function W(e){let i=n.get(e);if(!i)throw new g(S.REMOTE_UNKNOWN,`unknown remote "${e}"`,{remote:e});return x(i)}async function B(e,i={}){let{remote:a}=N(e),c=n.get(a);if(!c)throw new g(S.REMOTE_UNKNOWN,`unknown remote "${a}"`,{remote:a});let R=i.mode??"preload",s=(u,d)=>{if(typeof document>"u"||document.querySelector(`link[href="${u}"]`))return;let f=document.createElement("link");f.rel=d==="style"?"stylesheet":"modulepreload",f.href=u,R==="prefetch"&&(f.fetchPriority="low"),document.head.appendChild(f)};try{if(c.manifestUrl){let u=await fetch(c.manifestUrl,{cache:"no-cache"});if(u.ok){let d=await u.json();s(c.entry,"modulepreload");let f=d.exposes??{};for(let _ of Object.keys(f)){let $=f[_];$?.file&&s(new URL($.file,c.entry).href,"modulepreload");for(let p of $?.css??[])s(new URL(p,c.entry).href,"style")}return}}s(c.entry,"modulepreload")}catch(u){w({remote:a,error:new g(S.PRELOAD_FAILED,String(u?.message??u),{remote:a})})}}return typeof window>"u"||(window.__FULGURJS_SCOPE__=t,window.__FULGURJS_INFO__={get remotes(){let e={};for(let[i,a]of n)e[i]={...a.debug,entry:a.entry};return e},errors:[]}),{shareScopeMap:t,initSharing:F,registerShare:V,registerRemotes:I,registerRemote:D,registerPlugins:H,loadShare:K,loadRemote:J,getContainer:W,preloadRemote:B,parseSpec:N}}var C=globalThis,b=C.__FULGURJS_RUNTIME__??ce();C.__FULGURJS_RUNTIME__=b;try{Object.freeze(b)}catch{}var he=U;function ye(){return b}var Ee=b.initSharing,Re=b.registerShare,Se=b.registerRemotes,we=b.registerRemote,be=b.registerPlugins,_e=b.loadShare,$e=b.loadRemote,Me=b.getContainer,ve=b.preloadRemote,je=b.shareScopeMap;function Te(t){if(t&&typeof t=="object"&&"default"in t){let n=t.default;return n!==void 0?n:t}return t}var Oe=b;export{Oe as default,Me as getContainer,ye as getRuntime,Ee as initSharing,$e as loadRemote,_e as loadShare,ve as preloadRemote,be as registerPlugins,we as registerRemote,Se as registerRemotes,Re as registerShare,b as runtime,je as shareScopeMap,Te as unwrapDefault,he as version};
|
package/dist/vue.cjs
CHANGED
|
@@ -224,12 +224,12 @@ function testComparator(v, versionStr, c) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/runtime/errors.ts
|
|
227
|
-
var
|
|
227
|
+
var FgError = class extends Error {
|
|
228
228
|
code;
|
|
229
229
|
details;
|
|
230
230
|
constructor(code, message, details) {
|
|
231
231
|
super(`[fulgurjs:${code}] ${message}`);
|
|
232
|
-
this.name = "
|
|
232
|
+
this.name = "FgError";
|
|
233
233
|
this.code = code;
|
|
234
234
|
this.details = details;
|
|
235
235
|
}
|
|
@@ -268,17 +268,6 @@ function createRuntime() {
|
|
|
268
268
|
const plugins = [];
|
|
269
269
|
const loadedModules = /* @__PURE__ */ new Map();
|
|
270
270
|
const containerInitScopes = /* @__PURE__ */ new WeakMap();
|
|
271
|
-
let fulgurjsAppConfig = {};
|
|
272
|
-
function provideFulgurjsAppConfig2(config) {
|
|
273
|
-
fulgurjsAppConfig = { ...fulgurjsAppConfig, ...config };
|
|
274
|
-
if (typeof globalThis !== "undefined") {
|
|
275
|
-
;
|
|
276
|
-
globalThis.__FULGURJS_APP_CONFIG__ = fulgurjsAppConfig;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
function getFulgurjsAppConfig2() {
|
|
280
|
-
return fulgurjsAppConfig;
|
|
281
|
-
}
|
|
282
271
|
const hooks = {};
|
|
283
272
|
const applyPlugins = () => {
|
|
284
273
|
for (const p of plugins) {
|
|
@@ -350,7 +339,7 @@ function createRuntime() {
|
|
|
350
339
|
const entry0 = byName[pick];
|
|
351
340
|
const msg = `singleton skew "${shareKey}": req "${req ?? "any"}" use ${pick} from ${entry0.from}`;
|
|
352
341
|
if (opts.strictVersion) {
|
|
353
|
-
const err = new
|
|
342
|
+
const err = new FgError(ErrorCodes.SHARE_STRICT_VERSION, msg, {
|
|
354
343
|
shareKey,
|
|
355
344
|
requiredVersion: req
|
|
356
345
|
});
|
|
@@ -363,7 +352,7 @@ function createRuntime() {
|
|
|
363
352
|
pick = [...satisfying].sort(compareVersions).pop();
|
|
364
353
|
if (!pick) {
|
|
365
354
|
if (opts.strictVersion) {
|
|
366
|
-
const err2 = new
|
|
355
|
+
const err2 = new FgError(
|
|
367
356
|
ErrorCodes.SHARE_STRICT_VERSION,
|
|
368
357
|
`no satisfying version for "${shareKey}" (required "${req}") in share scope "${scopeName}"`
|
|
369
358
|
);
|
|
@@ -371,7 +360,7 @@ function createRuntime() {
|
|
|
371
360
|
throw err2;
|
|
372
361
|
}
|
|
373
362
|
if (opts.fallback) return opts.fallback();
|
|
374
|
-
const err = new
|
|
363
|
+
const err = new FgError(
|
|
375
364
|
ErrorCodes.SHARE_NOT_AVAILABLE,
|
|
376
365
|
`shared "${shareKey}" (${req ?? "any"}) unavailable in scope "${scopeName}" (no local fallback)`,
|
|
377
366
|
{ shareKey, requiredVersion: req }
|
|
@@ -440,7 +429,7 @@ function createRuntime() {
|
|
|
440
429
|
if (remote.container) {
|
|
441
430
|
const prevScope = containerInitScopes.get(remote.container);
|
|
442
431
|
if (prevScope && prevScope !== scopeKey) {
|
|
443
|
-
throw new
|
|
432
|
+
throw new FgError(
|
|
444
433
|
ErrorCodes.CONTAINER_REINIT_CONFLICT,
|
|
445
434
|
`container "${remote.name}" already initialized with share scope "${prevScope}", cannot re-init with "${scopeKey}"`
|
|
446
435
|
);
|
|
@@ -450,7 +439,7 @@ function createRuntime() {
|
|
|
450
439
|
if (remote.containerPromise) return remote.containerPromise;
|
|
451
440
|
const b = remote.breakerState;
|
|
452
441
|
if (b.openUntil > Date.now()) {
|
|
453
|
-
const err = new
|
|
442
|
+
const err = new FgError(
|
|
454
443
|
ErrorCodes.REMOTE_LOAD_FAILED,
|
|
455
444
|
`circuit breaker open for remote "${remote.name}" until ${new Date(b.openUntil).toISOString()}`,
|
|
456
445
|
{ remote: remote.name }
|
|
@@ -511,7 +500,7 @@ function createRuntime() {
|
|
|
511
500
|
hints.push(`1. is the remote deployed and reachable? try opening ${remote.entry} in the browser \u2014 it must return JS`);
|
|
512
501
|
hints.push(`2. NGINX/CDN routing: the entry path must serve the remoteEntry JS file (check try_files / fallback rules)`);
|
|
513
502
|
}
|
|
514
|
-
throw new
|
|
503
|
+
throw new FgError(
|
|
515
504
|
ErrorCodes.REMOTE_LOAD_FAILED,
|
|
516
505
|
`failed to load remote "${remote.name}" from ${remote.entry}: ${String(lastErr?.message ?? lastErr)}
|
|
517
506
|
` + hints.join("\n"),
|
|
@@ -521,7 +510,7 @@ function createRuntime() {
|
|
|
521
510
|
validateContainerInterface(container, remote);
|
|
522
511
|
const prevScope = containerInitScopes.get(container);
|
|
523
512
|
if (prevScope && prevScope !== scopeKey) {
|
|
524
|
-
throw new
|
|
513
|
+
throw new FgError(
|
|
525
514
|
ErrorCodes.CONTAINER_REINIT_CONFLICT,
|
|
526
515
|
`container "${remote.name}" already initialized with share scope "${prevScope}", cannot re-init with "${scopeKey}"`
|
|
527
516
|
);
|
|
@@ -549,7 +538,7 @@ function createRuntime() {
|
|
|
549
538
|
b.openUntil = Date.now() + BREAKER_RESET_MS;
|
|
550
539
|
b.fails = 0;
|
|
551
540
|
}
|
|
552
|
-
if (err instanceof
|
|
541
|
+
if (err instanceof FgError) {
|
|
553
542
|
emitError({ remote: remote.name, error: err });
|
|
554
543
|
throw err;
|
|
555
544
|
}
|
|
@@ -557,7 +546,7 @@ function createRuntime() {
|
|
|
557
546
|
emitError({ remote: remote.name, error: err });
|
|
558
547
|
throw err;
|
|
559
548
|
}
|
|
560
|
-
const wrapped = new
|
|
549
|
+
const wrapped = new FgError(ErrorCodes.REMOTE_LOAD_FAILED, String(err?.message ?? err), {
|
|
561
550
|
remote: remote.name
|
|
562
551
|
});
|
|
563
552
|
emitError({ remote: remote.name, error: wrapped });
|
|
@@ -578,7 +567,7 @@ function createRuntime() {
|
|
|
578
567
|
hooks.beforeLoadRemote?.({ remote: name, module: module2 });
|
|
579
568
|
const remote = remotes.get(name);
|
|
580
569
|
if (!remote) {
|
|
581
|
-
throw new
|
|
570
|
+
throw new FgError(
|
|
582
571
|
ErrorCodes.REMOTE_UNKNOWN,
|
|
583
572
|
`unknown remote "${name}". Register it via federation({ remotes }) or registerRemote().`,
|
|
584
573
|
{ remote: name }
|
|
@@ -602,8 +591,8 @@ function createRuntime() {
|
|
|
602
591
|
cacheKey,
|
|
603
592
|
container.get(module2).catch((err) => {
|
|
604
593
|
loadedModules.delete(cacheKey);
|
|
605
|
-
if (err instanceof
|
|
606
|
-
throw new
|
|
594
|
+
if (err instanceof FgError || err?.code) throw err;
|
|
595
|
+
throw new FgError(
|
|
607
596
|
ErrorCodes.REMOTE_LOAD_FAILED,
|
|
608
597
|
`failed to load module "${module2}" from remote "${name}": ${String(err?.message ?? err)}`,
|
|
609
598
|
{ remote: name, module: module2 }
|
|
@@ -624,7 +613,7 @@ function createRuntime() {
|
|
|
624
613
|
}
|
|
625
614
|
hooks.afterLoadRemote?.({ remote: name, module: module2, module_ns: ns });
|
|
626
615
|
if (ns && typeof ns === "object" && Object.keys(ns).length === 0) {
|
|
627
|
-
const err = new
|
|
616
|
+
const err = new FgError(
|
|
628
617
|
ErrorCodes.EMPTY_EXPORTS,
|
|
629
618
|
`no exports: ${module2} @ ${name}`,
|
|
630
619
|
{ remote: name, module: module2 }
|
|
@@ -637,7 +626,7 @@ function createRuntime() {
|
|
|
637
626
|
function getContainer2(name) {
|
|
638
627
|
const remote = remotes.get(name);
|
|
639
628
|
if (!remote) {
|
|
640
|
-
throw new
|
|
629
|
+
throw new FgError(ErrorCodes.REMOTE_UNKNOWN, `unknown remote "${name}"`, { remote: name });
|
|
641
630
|
}
|
|
642
631
|
return acquireContainer(remote);
|
|
643
632
|
}
|
|
@@ -645,7 +634,7 @@ function createRuntime() {
|
|
|
645
634
|
const { remote: name } = parseSpec(spec);
|
|
646
635
|
const remote = remotes.get(name);
|
|
647
636
|
if (!remote) {
|
|
648
|
-
throw new
|
|
637
|
+
throw new FgError(ErrorCodes.REMOTE_UNKNOWN, `unknown remote "${name}"`, { remote: name });
|
|
649
638
|
}
|
|
650
639
|
const mode = opts.mode ?? "preload";
|
|
651
640
|
const inject = (href, as) => {
|
|
@@ -679,7 +668,7 @@ function createRuntime() {
|
|
|
679
668
|
} catch (err) {
|
|
680
669
|
emitError({
|
|
681
670
|
remote: name,
|
|
682
|
-
error: new
|
|
671
|
+
error: new FgError(ErrorCodes.PRELOAD_FAILED, String(err?.message ?? err), {
|
|
683
672
|
remote: name
|
|
684
673
|
})
|
|
685
674
|
});
|
|
@@ -711,9 +700,7 @@ function createRuntime() {
|
|
|
711
700
|
loadRemote: loadRemote2,
|
|
712
701
|
getContainer: getContainer2,
|
|
713
702
|
preloadRemote: preloadRemote2,
|
|
714
|
-
parseSpec
|
|
715
|
-
provideFulgurjsAppConfig: provideFulgurjsAppConfig2,
|
|
716
|
-
getFulgurjsAppConfig: getFulgurjsAppConfig2
|
|
703
|
+
parseSpec
|
|
717
704
|
};
|
|
718
705
|
}
|
|
719
706
|
var g = globalThis;
|
|
@@ -733,8 +720,6 @@ var loadRemote = runtime.loadRemote;
|
|
|
733
720
|
var getContainer = runtime.getContainer;
|
|
734
721
|
var preloadRemote = runtime.preloadRemote;
|
|
735
722
|
var shareScopeMap = runtime.shareScopeMap;
|
|
736
|
-
var provideFulgurjsAppConfig = runtime.provideFulgurjsAppConfig;
|
|
737
|
-
var getFulgurjsAppConfig = runtime.getFulgurjsAppConfig;
|
|
738
723
|
|
|
739
724
|
// src/vue.ts
|
|
740
725
|
var ERROR_STYLE = {
|
package/dist/vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ErrorCodes,
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
FgError
|
|
4
|
+
} from "./chunk-3VBYOVH4.js";
|
|
5
|
+
import "./chunk-5GZKZWP2.js";
|
|
6
6
|
|
|
7
7
|
// src/vue.ts
|
|
8
8
|
import { defineAsyncComponent, defineComponent, h } from "vue";
|
|
@@ -216,17 +216,6 @@ function createRuntime() {
|
|
|
216
216
|
const plugins = [];
|
|
217
217
|
const loadedModules = /* @__PURE__ */ new Map();
|
|
218
218
|
const containerInitScopes = /* @__PURE__ */ new WeakMap();
|
|
219
|
-
let fulgurjsAppConfig = {};
|
|
220
|
-
function provideFulgurjsAppConfig2(config) {
|
|
221
|
-
fulgurjsAppConfig = { ...fulgurjsAppConfig, ...config };
|
|
222
|
-
if (typeof globalThis !== "undefined") {
|
|
223
|
-
;
|
|
224
|
-
globalThis.__FULGURJS_APP_CONFIG__ = fulgurjsAppConfig;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function getFulgurjsAppConfig2() {
|
|
228
|
-
return fulgurjsAppConfig;
|
|
229
|
-
}
|
|
230
219
|
const hooks = {};
|
|
231
220
|
const applyPlugins = () => {
|
|
232
221
|
for (const p of plugins) {
|
|
@@ -298,7 +287,7 @@ function createRuntime() {
|
|
|
298
287
|
const entry0 = byName[pick];
|
|
299
288
|
const msg = `singleton skew "${shareKey}": req "${req ?? "any"}" use ${pick} from ${entry0.from}`;
|
|
300
289
|
if (opts.strictVersion) {
|
|
301
|
-
const err = new
|
|
290
|
+
const err = new FgError(ErrorCodes.SHARE_STRICT_VERSION, msg, {
|
|
302
291
|
shareKey,
|
|
303
292
|
requiredVersion: req
|
|
304
293
|
});
|
|
@@ -311,7 +300,7 @@ function createRuntime() {
|
|
|
311
300
|
pick = [...satisfying].sort(compareVersions).pop();
|
|
312
301
|
if (!pick) {
|
|
313
302
|
if (opts.strictVersion) {
|
|
314
|
-
const err2 = new
|
|
303
|
+
const err2 = new FgError(
|
|
315
304
|
ErrorCodes.SHARE_STRICT_VERSION,
|
|
316
305
|
`no satisfying version for "${shareKey}" (required "${req}") in share scope "${scopeName}"`
|
|
317
306
|
);
|
|
@@ -319,7 +308,7 @@ function createRuntime() {
|
|
|
319
308
|
throw err2;
|
|
320
309
|
}
|
|
321
310
|
if (opts.fallback) return opts.fallback();
|
|
322
|
-
const err = new
|
|
311
|
+
const err = new FgError(
|
|
323
312
|
ErrorCodes.SHARE_NOT_AVAILABLE,
|
|
324
313
|
`shared "${shareKey}" (${req ?? "any"}) unavailable in scope "${scopeName}" (no local fallback)`,
|
|
325
314
|
{ shareKey, requiredVersion: req }
|
|
@@ -388,7 +377,7 @@ function createRuntime() {
|
|
|
388
377
|
if (remote.container) {
|
|
389
378
|
const prevScope = containerInitScopes.get(remote.container);
|
|
390
379
|
if (prevScope && prevScope !== scopeKey) {
|
|
391
|
-
throw new
|
|
380
|
+
throw new FgError(
|
|
392
381
|
ErrorCodes.CONTAINER_REINIT_CONFLICT,
|
|
393
382
|
`container "${remote.name}" already initialized with share scope "${prevScope}", cannot re-init with "${scopeKey}"`
|
|
394
383
|
);
|
|
@@ -398,7 +387,7 @@ function createRuntime() {
|
|
|
398
387
|
if (remote.containerPromise) return remote.containerPromise;
|
|
399
388
|
const b = remote.breakerState;
|
|
400
389
|
if (b.openUntil > Date.now()) {
|
|
401
|
-
const err = new
|
|
390
|
+
const err = new FgError(
|
|
402
391
|
ErrorCodes.REMOTE_LOAD_FAILED,
|
|
403
392
|
`circuit breaker open for remote "${remote.name}" until ${new Date(b.openUntil).toISOString()}`,
|
|
404
393
|
{ remote: remote.name }
|
|
@@ -459,7 +448,7 @@ function createRuntime() {
|
|
|
459
448
|
hints.push(`1. is the remote deployed and reachable? try opening ${remote.entry} in the browser \u2014 it must return JS`);
|
|
460
449
|
hints.push(`2. NGINX/CDN routing: the entry path must serve the remoteEntry JS file (check try_files / fallback rules)`);
|
|
461
450
|
}
|
|
462
|
-
throw new
|
|
451
|
+
throw new FgError(
|
|
463
452
|
ErrorCodes.REMOTE_LOAD_FAILED,
|
|
464
453
|
`failed to load remote "${remote.name}" from ${remote.entry}: ${String(lastErr?.message ?? lastErr)}
|
|
465
454
|
` + hints.join("\n"),
|
|
@@ -469,7 +458,7 @@ function createRuntime() {
|
|
|
469
458
|
validateContainerInterface(container, remote);
|
|
470
459
|
const prevScope = containerInitScopes.get(container);
|
|
471
460
|
if (prevScope && prevScope !== scopeKey) {
|
|
472
|
-
throw new
|
|
461
|
+
throw new FgError(
|
|
473
462
|
ErrorCodes.CONTAINER_REINIT_CONFLICT,
|
|
474
463
|
`container "${remote.name}" already initialized with share scope "${prevScope}", cannot re-init with "${scopeKey}"`
|
|
475
464
|
);
|
|
@@ -497,7 +486,7 @@ function createRuntime() {
|
|
|
497
486
|
b.openUntil = Date.now() + BREAKER_RESET_MS;
|
|
498
487
|
b.fails = 0;
|
|
499
488
|
}
|
|
500
|
-
if (err instanceof
|
|
489
|
+
if (err instanceof FgError) {
|
|
501
490
|
emitError({ remote: remote.name, error: err });
|
|
502
491
|
throw err;
|
|
503
492
|
}
|
|
@@ -505,7 +494,7 @@ function createRuntime() {
|
|
|
505
494
|
emitError({ remote: remote.name, error: err });
|
|
506
495
|
throw err;
|
|
507
496
|
}
|
|
508
|
-
const wrapped = new
|
|
497
|
+
const wrapped = new FgError(ErrorCodes.REMOTE_LOAD_FAILED, String(err?.message ?? err), {
|
|
509
498
|
remote: remote.name
|
|
510
499
|
});
|
|
511
500
|
emitError({ remote: remote.name, error: wrapped });
|
|
@@ -526,7 +515,7 @@ function createRuntime() {
|
|
|
526
515
|
hooks.beforeLoadRemote?.({ remote: name, module });
|
|
527
516
|
const remote = remotes.get(name);
|
|
528
517
|
if (!remote) {
|
|
529
|
-
throw new
|
|
518
|
+
throw new FgError(
|
|
530
519
|
ErrorCodes.REMOTE_UNKNOWN,
|
|
531
520
|
`unknown remote "${name}". Register it via federation({ remotes }) or registerRemote().`,
|
|
532
521
|
{ remote: name }
|
|
@@ -550,8 +539,8 @@ function createRuntime() {
|
|
|
550
539
|
cacheKey,
|
|
551
540
|
container.get(module).catch((err) => {
|
|
552
541
|
loadedModules.delete(cacheKey);
|
|
553
|
-
if (err instanceof
|
|
554
|
-
throw new
|
|
542
|
+
if (err instanceof FgError || err?.code) throw err;
|
|
543
|
+
throw new FgError(
|
|
555
544
|
ErrorCodes.REMOTE_LOAD_FAILED,
|
|
556
545
|
`failed to load module "${module}" from remote "${name}": ${String(err?.message ?? err)}`,
|
|
557
546
|
{ remote: name, module }
|
|
@@ -572,7 +561,7 @@ function createRuntime() {
|
|
|
572
561
|
}
|
|
573
562
|
hooks.afterLoadRemote?.({ remote: name, module, module_ns: ns });
|
|
574
563
|
if (ns && typeof ns === "object" && Object.keys(ns).length === 0) {
|
|
575
|
-
const err = new
|
|
564
|
+
const err = new FgError(
|
|
576
565
|
ErrorCodes.EMPTY_EXPORTS,
|
|
577
566
|
`no exports: ${module} @ ${name}`,
|
|
578
567
|
{ remote: name, module }
|
|
@@ -585,7 +574,7 @@ function createRuntime() {
|
|
|
585
574
|
function getContainer2(name) {
|
|
586
575
|
const remote = remotes.get(name);
|
|
587
576
|
if (!remote) {
|
|
588
|
-
throw new
|
|
577
|
+
throw new FgError(ErrorCodes.REMOTE_UNKNOWN, `unknown remote "${name}"`, { remote: name });
|
|
589
578
|
}
|
|
590
579
|
return acquireContainer(remote);
|
|
591
580
|
}
|
|
@@ -593,7 +582,7 @@ function createRuntime() {
|
|
|
593
582
|
const { remote: name } = parseSpec(spec);
|
|
594
583
|
const remote = remotes.get(name);
|
|
595
584
|
if (!remote) {
|
|
596
|
-
throw new
|
|
585
|
+
throw new FgError(ErrorCodes.REMOTE_UNKNOWN, `unknown remote "${name}"`, { remote: name });
|
|
597
586
|
}
|
|
598
587
|
const mode = opts.mode ?? "preload";
|
|
599
588
|
const inject = (href, as) => {
|
|
@@ -627,7 +616,7 @@ function createRuntime() {
|
|
|
627
616
|
} catch (err) {
|
|
628
617
|
emitError({
|
|
629
618
|
remote: name,
|
|
630
|
-
error: new
|
|
619
|
+
error: new FgError(ErrorCodes.PRELOAD_FAILED, String(err?.message ?? err), {
|
|
631
620
|
remote: name
|
|
632
621
|
})
|
|
633
622
|
});
|
|
@@ -659,9 +648,7 @@ function createRuntime() {
|
|
|
659
648
|
loadRemote: loadRemote2,
|
|
660
649
|
getContainer: getContainer2,
|
|
661
650
|
preloadRemote: preloadRemote2,
|
|
662
|
-
parseSpec
|
|
663
|
-
provideFulgurjsAppConfig: provideFulgurjsAppConfig2,
|
|
664
|
-
getFulgurjsAppConfig: getFulgurjsAppConfig2
|
|
651
|
+
parseSpec
|
|
665
652
|
};
|
|
666
653
|
}
|
|
667
654
|
var g = globalThis;
|
|
@@ -681,8 +668,6 @@ var loadRemote = runtime.loadRemote;
|
|
|
681
668
|
var getContainer = runtime.getContainer;
|
|
682
669
|
var preloadRemote = runtime.preloadRemote;
|
|
683
670
|
var shareScopeMap = runtime.shareScopeMap;
|
|
684
|
-
var provideFulgurjsAppConfig = runtime.provideFulgurjsAppConfig;
|
|
685
|
-
var getFulgurjsAppConfig = runtime.getFulgurjsAppConfig;
|
|
686
671
|
|
|
687
672
|
// src/vue.ts
|
|
688
673
|
var ERROR_STYLE = {
|