@empjs/share 0.0.1 → 0.1.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/README.md +34 -47
- package/dist/adapter.cjs +2 -0
- package/dist/adapter.cjs.map +1 -0
- package/dist/adapter.d.cts +14 -0
- package/dist/adapter.d.ts +14 -0
- package/dist/adapter.js +2 -0
- package/dist/adapter.js.map +1 -0
- package/dist/index-CLt6ciOL.d.cts +21 -0
- package/dist/index-CLt6ciOL.d.ts +21 -0
- package/dist/index.cjs +2 -108
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +2 -81
- package/dist/index.js.map +1 -1
- package/dist/rspack.cjs +2 -104
- package/dist/rspack.cjs.map +1 -1
- package/dist/rspack.d.cts +5 -4
- package/dist/rspack.d.ts +5 -4
- package/dist/rspack.js +2 -81
- package/dist/rspack.js.map +1 -1
- package/dist/runtime.cjs +1 -210
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +8 -63
- package/dist/runtime.d.ts +8 -63
- package/dist/runtime.js +1 -187
- package/dist/runtime.js.map +1 -1
- package/package.json +33 -6
package/dist/rspack.cjs
CHANGED
|
@@ -1,105 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/rspack.ts
|
|
21
|
-
var rspack_exports = {};
|
|
22
|
-
__export(rspack_exports, {
|
|
23
|
-
default: () => rspack_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(rspack_exports);
|
|
26
|
-
|
|
27
|
-
// src/plugin/rspack/index.ts
|
|
28
|
-
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
29
|
-
|
|
30
|
-
// src/helper/config.ts
|
|
31
|
-
var shareGlobalName = "EMP_SHARE_RUNTIME";
|
|
32
|
-
|
|
33
|
-
// src/helper/index.ts
|
|
34
|
-
var importJsVm = (content) => `data:text/javascript,${content}`;
|
|
35
|
-
|
|
36
|
-
// src/plugin/rspack/plugin.ts
|
|
37
|
-
var getShareRuntimeEntry = () => {
|
|
38
|
-
const content = [`import '@empjs/share/library'`].join("\n");
|
|
39
|
-
return importJsVm(content);
|
|
40
|
-
};
|
|
41
|
-
var EmpShareRuntimePlugin = class {
|
|
42
|
-
constructor() {
|
|
43
|
-
}
|
|
44
|
-
apply(compiler) {
|
|
45
|
-
const { webpack } = compiler;
|
|
46
|
-
const entry = getShareRuntimeEntry();
|
|
47
|
-
new webpack.EntryPlugin(compiler.context, entry, {
|
|
48
|
-
name: void 0
|
|
49
|
-
}).apply(compiler);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/plugin/rspack/index.ts
|
|
54
|
-
var rspack_default = (o = {}) => {
|
|
55
|
-
return {
|
|
56
|
-
name: "@empjs/share",
|
|
57
|
-
async rsConfig(store) {
|
|
58
|
-
console.log(o);
|
|
59
|
-
if (o.name) {
|
|
60
|
-
const op = store.deepAssign(
|
|
61
|
-
{
|
|
62
|
-
filename: "emp.js",
|
|
63
|
-
manifest: false,
|
|
64
|
-
dts: false,
|
|
65
|
-
dev: {
|
|
66
|
-
disableDynamicRemoteTypeHints: true
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
o
|
|
70
|
-
);
|
|
71
|
-
delete op.empRuntime;
|
|
72
|
-
store.chain.plugin("plugin-emp-share").use(import_rspack.ModuleFederationPlugin, [op]);
|
|
73
|
-
}
|
|
74
|
-
const { empRuntime } = o;
|
|
75
|
-
if (empRuntime) {
|
|
76
|
-
if (!empRuntime.runtimeLib) {
|
|
77
|
-
store.chain.plugin("plugin-emp-runtime").use(EmpShareRuntimePlugin);
|
|
78
|
-
}
|
|
79
|
-
empRuntime.runtimeGlobal = empRuntime.frameworkGlobal || shareGlobalName;
|
|
80
|
-
const externalRuntime = {
|
|
81
|
-
"@module-federation/runtime": `MFRuntime`,
|
|
82
|
-
"@module-federation/sdk": `MFSDK`
|
|
83
|
-
};
|
|
84
|
-
const externals = [];
|
|
85
|
-
for (const [key, value] of Object.entries(externalRuntime)) {
|
|
86
|
-
externals[key] = `${empRuntime.runtimeGlobal}.${value}`;
|
|
87
|
-
}
|
|
88
|
-
empRuntime.framework = empRuntime.framework || "react";
|
|
89
|
-
empRuntime.frameworkGlobal = empRuntime.frameworkGlobal || empRuntime.runtimeGlobal;
|
|
90
|
-
if (empRuntime.framework === "react") {
|
|
91
|
-
const externalReact = {
|
|
92
|
-
react: `React`,
|
|
93
|
-
"react-dom": `ReactDOM`
|
|
94
|
-
};
|
|
95
|
-
for (const [key, value] of Object.entries(externalReact)) {
|
|
96
|
-
externals[key] = `${empRuntime.frameworkGlobal}.${value}`;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (empRuntime.setExternals) empRuntime.setExternals(externals);
|
|
100
|
-
store.merge({ externals });
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
};
|
|
1
|
+
"use strict";var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var P=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},S=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!x.call(t,r)&&r!==n&&u(t,r,{get:()=>e[r],enumerable:!(o=h(e,r))||o.enumerable});return t};var M=t=>S(u({},"__esModule",{value:!0}),t);var G={};P(G,{default:()=>w,pluginRspackEmpShare:()=>E});module.exports=M(G);var R=require("@module-federation/enhanced/rspack");var b="EMP_SHARE_RUNTIME";var y=t=>`data:text/javascript,${t}`;var v=t=>{let e=[`import '${t}'`].join(`
|
|
2
|
+
`);return y(e)},m=class{options;constructor(e){this.options=e}apply(e){let{webpack:n}=e,{runtimeLib:o}=this.options;if(!o){let r=v("@empjs/share/library");new n.EntryPlugin(e.context,r,{name:void 0}).apply(e)}}};function d(t,e){return typeof t=="string"?`${t}/runtime${e==="development"?".development":""}.umd.js`:typeof t=="object"?e==="development"?t.dev:t.prod:""}var E=(t={})=>({name:"@empjs/share",async rsConfig(e){if(t.name){let o=e.deepAssign({filename:"emp.js",manifest:!1,dts:!1,dev:{disableDynamicRemoteTypeHints:!0}},t);delete o.empRuntime,e.chain.plugin("plugin-emp-share").use(R.ModuleFederationPlugin,[o])}let{empRuntime:n}=t;if(n){let o=[],r=n.framework||"react",{frameworkLib:f,runtimeLib:p}=n,l=n.runtimeGlobal||b,s=n.frameworkGlobal||"";if(n.injectGlobalValToHtml!==!1&&o.push({type:"script",value:`EMPShareGlobalVal={frameworkLib:'${s}',runtimeLib:'${l}',framework:'${r}'}`}),f){let i=d(f,e.mode);o.push({type:"js",value:i})}p?p==="useFrameworkLib"?l=s:o.push({type:"js",value:p}):e.chain.plugin("plugin-emp-share-framework").use(m,[n]),o.length>0&&e.injectHeadTags(o,"EMPShare");let j={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"},a={};for(let[i,c]of Object.entries(j))a[i]=`${l}.${c}`;if(r==="react"&&s){let i={react:"React","react-dom":"ReactDOM"};for(let[c,g]of Object.entries(i))a[c]=`${s}.${g}`}n.setExternals&&n.setExternals(a),e.chain.merge({externals:a})}}}),w=E;0&&(module.exports={pluginRspackEmpShare});
|
|
105
3
|
//# sourceMappingURL=rspack.cjs.map
|
package/dist/rspack.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/rspack.ts","../src/
|
|
1
|
+
{"version":3,"sources":["../src/plugins/rspack/index.ts","../src/helper/config.ts","../src/helper/index.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/utils.ts"],"sourcesContent":["import type {GlobalStore} from '@empjs/cli'\nimport {ModuleFederationPlugin} from '@module-federation/enhanced/rspack'\nimport {shareGlobalName} from 'src/helper/config'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport type {EMPPluginShareType} from './types'\nimport {getRuntimeLib} from './utils'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n if (o.name) {\n const op: any = store.deepAssign(\n {\n filename: 'emp.js',\n manifest: false,\n dts: false,\n dev: {\n disableDynamicRemoteTypeHints: true,\n },\n },\n o,\n )\n delete op.empRuntime\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n const {empRuntime} = o\n if (empRuntime) {\n const injectHtml: any[] = []\n const framework = empRuntime.framework || 'react'\n const {frameworkLib, runtimeLib} = empRuntime\n //\n let runtimeGlobal = empRuntime.runtimeGlobal || shareGlobalName\n const frameworkGlobal = empRuntime.frameworkGlobal || ''\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n injectHtml.push({\n type: 'script',\n value: `EMPShareGlobalVal={frameworkLib:'${frameworkGlobal}',runtimeLib:'${runtimeGlobal}',framework:'${framework}'}`,\n })\n }\n /**\n * frameworkLib & runtimeLib 的全局引用\n */\n if (frameworkLib) {\n const url = getRuntimeLib(frameworkLib, store.mode)\n injectHtml.push({\n type: 'js',\n value: url,\n })\n }\n if (!runtimeLib) {\n // 内置 runtimeLib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (runtimeLib === 'useFrameworkLib') {\n runtimeGlobal = frameworkGlobal\n } else {\n // 插入 runtime\n injectHtml.push({type: 'js', value: runtimeLib})\n }\n if (injectHtml.length > 0) {\n store.injectHeadTags(injectHtml, 'EMPShare')\n }\n /**\n * 设置 externals\n */\n const externalRuntime = {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${runtimeGlobal}.${value}`\n }\n if (framework === 'react' && frameworkGlobal) {\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${frameworkGlobal}.${value}`\n }\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n },\n }\n}\n\nexport default pluginRspackEmpShare\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export const importJsVm = (content: string) => `data:text/javascript,${content}`\n\nexport function deepAssign<T>(target: any, ...sources: any): T {\n for (const source of sources) {\n for (const k in source) {\n const vs = source[k],\n vt = target[k]\n if (Object(vs) == vs && Object(vt) === vt) {\n target[k] = deepAssign(vt, vs)\n continue\n }\n target[k] = source[k]\n }\n }\n return target\n}\n\nexport const checkVersion = (version: string) => (version ? Number(version.split('.')[0]) : 0)\nexport const isPromise = (p: any) => p && Object.prototype.toString.call(p) === '[object Promise]'\n","import type {Compiler} from '@rspack/core'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\nexport class EmpShareRemoteLibPlugin {\n options: EMPSHARERuntimeOptions\n constructor(op: EMPSHARERuntimeOptions) {\n this.options = op\n }\n apply(compiler: Compiler) {\n const {webpack} = compiler\n const {runtimeLib} = this.options\n if (!runtimeLib) {\n const entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string) {\n if (typeof host === 'string') return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GACA,IAAAK,EAAqC,8CCD9B,IAAMC,EAAkB,oBCAxB,IAAMC,EAAcC,GAAoB,wBAAwBA,CAAO,GCG9E,IAAMC,EAAuBC,GAAO,CAClC,IAAMC,EAAU,CAAC,WAAWD,CAAG,GAAG,EAAE,KAAK;AAAA,CAAI,EAC7C,OAAOE,EAAWD,CAAO,CAC3B,EACaE,EAAN,KAA8B,CACnC,QACA,YAAYC,EAA4B,CACtC,KAAK,QAAUA,CACjB,CACA,MAAMC,EAAoB,CACxB,GAAM,CAAC,QAAAC,CAAO,EAAID,EACZ,CAAC,WAAAE,CAAU,EAAI,KAAK,QAC1B,GAAI,CAACA,EAAY,CACf,IAAMC,EAAQT,EAAqB,sBAAsB,EACzD,IAAIO,EAAQ,YAAYD,EAAS,QAASG,EAAO,CAC/C,KAAM,MACR,CAAC,EAAE,MAAMH,CAAQ,CACnB,CACF,CACF,ECrBO,SAASI,EAAcC,EAA8CC,EAAc,CACxF,OAAI,OAAOD,GAAS,SAAiB,GAAGA,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QH,CAAe,EACvDC,EAAUC,CAAG,EAAI,GAAGR,CAAa,IAAIS,CAAK,GAE5C,GAAIZ,IAAc,SAAWK,EAAiB,CAC5C,IAAMQ,EAAgB,CACpB,MAAO,QACP,YAAa,UACf,EACA,OAAW,CAACF,EAAKC,CAAK,IAAK,OAAO,QAAQC,CAAa,EACrDH,EAAUC,CAAG,EAAI,GAAGN,CAAe,IAAIO,CAAK,EAEhD,CACId,EAAW,cAAcA,EAAW,aAAaY,CAAS,EAG9Dd,EAAM,MAAM,MAAM,CAAC,UAAAc,CAAS,CAAC,CAC/B,CACF,CACF,GAGKI,EAAQpB","names":["rspack_exports","__export","rspack_default","pluginRspackEmpShare","__toCommonJS","import_rspack","shareGlobalName","importJsVm","content","getShareRuntimeEntry","url","content","importJsVm","EmpShareRemoteLibPlugin","op","compiler","webpack","runtimeLib","entry","getRuntimeLib","host","mode","pluginRspackEmpShare","o","store","op","empRuntime","injectHtml","framework","frameworkLib","runtimeLib","runtimeGlobal","shareGlobalName","frameworkGlobal","url","getRuntimeLib","EmpShareRemoteLibPlugin","externalRuntime","externals","key","value","externalReact","rspack_default"]}
|
package/dist/rspack.d.cts
CHANGED
|
@@ -17,24 +17,25 @@ type EMPSHARERuntimeOptions = {
|
|
|
17
17
|
/**
|
|
18
18
|
* MFRuntime 远程地址
|
|
19
19
|
*/
|
|
20
|
-
runtimeLib?: string;
|
|
20
|
+
runtimeLib?: string | 'useFrameworkLib';
|
|
21
21
|
/**
|
|
22
22
|
* MFRuntime 全局命名
|
|
23
23
|
*/
|
|
24
24
|
runtimeGlobal?: string;
|
|
25
25
|
setExternals?: (o: any) => void;
|
|
26
|
+
injectGlobalValToHtml?: boolean;
|
|
26
27
|
/**
|
|
27
28
|
* 快捷设置 external 默认为 react
|
|
28
29
|
*/
|
|
29
|
-
framework?:
|
|
30
|
+
framework?: 'react' | 'vue2' | 'vue';
|
|
30
31
|
};
|
|
31
32
|
type EMPPluginShareType = ModuleFederationPluginOptions & {
|
|
32
33
|
empRuntime?: EMPSHARERuntimeOptions;
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
declare const
|
|
36
|
+
declare const pluginRspackEmpShare: (o?: EMPPluginShareType) => {
|
|
36
37
|
name: string;
|
|
37
38
|
rsConfig(store: GlobalStore): Promise<void>;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
export {
|
|
41
|
+
export { pluginRspackEmpShare as default, pluginRspackEmpShare };
|
package/dist/rspack.d.ts
CHANGED
|
@@ -17,24 +17,25 @@ type EMPSHARERuntimeOptions = {
|
|
|
17
17
|
/**
|
|
18
18
|
* MFRuntime 远程地址
|
|
19
19
|
*/
|
|
20
|
-
runtimeLib?: string;
|
|
20
|
+
runtimeLib?: string | 'useFrameworkLib';
|
|
21
21
|
/**
|
|
22
22
|
* MFRuntime 全局命名
|
|
23
23
|
*/
|
|
24
24
|
runtimeGlobal?: string;
|
|
25
25
|
setExternals?: (o: any) => void;
|
|
26
|
+
injectGlobalValToHtml?: boolean;
|
|
26
27
|
/**
|
|
27
28
|
* 快捷设置 external 默认为 react
|
|
28
29
|
*/
|
|
29
|
-
framework?:
|
|
30
|
+
framework?: 'react' | 'vue2' | 'vue';
|
|
30
31
|
};
|
|
31
32
|
type EMPPluginShareType = ModuleFederationPluginOptions & {
|
|
32
33
|
empRuntime?: EMPSHARERuntimeOptions;
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
declare const
|
|
36
|
+
declare const pluginRspackEmpShare: (o?: EMPPluginShareType) => {
|
|
36
37
|
name: string;
|
|
37
38
|
rsConfig(store: GlobalStore): Promise<void>;
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
export {
|
|
41
|
+
export { pluginRspackEmpShare as default, pluginRspackEmpShare };
|
package/dist/rspack.js
CHANGED
|
@@ -1,82 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// src/helper/config.ts
|
|
5
|
-
var shareGlobalName = "EMP_SHARE_RUNTIME";
|
|
6
|
-
|
|
7
|
-
// src/helper/index.ts
|
|
8
|
-
var importJsVm = (content) => `data:text/javascript,${content}`;
|
|
9
|
-
|
|
10
|
-
// src/plugin/rspack/plugin.ts
|
|
11
|
-
var getShareRuntimeEntry = () => {
|
|
12
|
-
const content = [`import '@empjs/share/library'`].join("\n");
|
|
13
|
-
return importJsVm(content);
|
|
14
|
-
};
|
|
15
|
-
var EmpShareRuntimePlugin = class {
|
|
16
|
-
constructor() {
|
|
17
|
-
}
|
|
18
|
-
apply(compiler) {
|
|
19
|
-
const { webpack } = compiler;
|
|
20
|
-
const entry = getShareRuntimeEntry();
|
|
21
|
-
new webpack.EntryPlugin(compiler.context, entry, {
|
|
22
|
-
name: void 0
|
|
23
|
-
}).apply(compiler);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
// src/plugin/rspack/index.ts
|
|
28
|
-
var rspack_default = (o = {}) => {
|
|
29
|
-
return {
|
|
30
|
-
name: "@empjs/share",
|
|
31
|
-
async rsConfig(store) {
|
|
32
|
-
console.log(o);
|
|
33
|
-
if (o.name) {
|
|
34
|
-
const op = store.deepAssign(
|
|
35
|
-
{
|
|
36
|
-
filename: "emp.js",
|
|
37
|
-
manifest: false,
|
|
38
|
-
dts: false,
|
|
39
|
-
dev: {
|
|
40
|
-
disableDynamicRemoteTypeHints: true
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
o
|
|
44
|
-
);
|
|
45
|
-
delete op.empRuntime;
|
|
46
|
-
store.chain.plugin("plugin-emp-share").use(ModuleFederationPlugin, [op]);
|
|
47
|
-
}
|
|
48
|
-
const { empRuntime } = o;
|
|
49
|
-
if (empRuntime) {
|
|
50
|
-
if (!empRuntime.runtimeLib) {
|
|
51
|
-
store.chain.plugin("plugin-emp-runtime").use(EmpShareRuntimePlugin);
|
|
52
|
-
}
|
|
53
|
-
empRuntime.runtimeGlobal = empRuntime.frameworkGlobal || shareGlobalName;
|
|
54
|
-
const externalRuntime = {
|
|
55
|
-
"@module-federation/runtime": `MFRuntime`,
|
|
56
|
-
"@module-federation/sdk": `MFSDK`
|
|
57
|
-
};
|
|
58
|
-
const externals = [];
|
|
59
|
-
for (const [key, value] of Object.entries(externalRuntime)) {
|
|
60
|
-
externals[key] = `${empRuntime.runtimeGlobal}.${value}`;
|
|
61
|
-
}
|
|
62
|
-
empRuntime.framework = empRuntime.framework || "react";
|
|
63
|
-
empRuntime.frameworkGlobal = empRuntime.frameworkGlobal || empRuntime.runtimeGlobal;
|
|
64
|
-
if (empRuntime.framework === "react") {
|
|
65
|
-
const externalReact = {
|
|
66
|
-
react: `React`,
|
|
67
|
-
"react-dom": `ReactDOM`
|
|
68
|
-
};
|
|
69
|
-
for (const [key, value] of Object.entries(externalReact)) {
|
|
70
|
-
externals[key] = `${empRuntime.frameworkGlobal}.${value}`;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (empRuntime.setExternals) empRuntime.setExternals(externals);
|
|
74
|
-
store.merge({ externals });
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
export {
|
|
80
|
-
rspack_default as default
|
|
81
|
-
};
|
|
1
|
+
import{ModuleFederationPlugin as j}from"@module-federation/enhanced/rspack";var f="EMP_SHARE_RUNTIME";var b=t=>`data:text/javascript,${t}`;var E=t=>{let e=[`import '${t}'`].join(`
|
|
2
|
+
`);return b(e)},m=class{options;constructor(e){this.options=e}apply(e){let{webpack:n}=e,{runtimeLib:o}=this.options;if(!o){let i=E("@empjs/share/library");new n.EntryPlugin(e.context,i,{name:void 0}).apply(e)}}};function y(t,e){return typeof t=="string"?`${t}/runtime${e==="development"?".development":""}.umd.js`:typeof t=="object"?e==="development"?t.dev:t.prod:""}var g=(t={})=>({name:"@empjs/share",async rsConfig(e){if(t.name){let o=e.deepAssign({filename:"emp.js",manifest:!1,dts:!1,dev:{disableDynamicRemoteTypeHints:!0}},t);delete o.empRuntime,e.chain.plugin("plugin-emp-share").use(j,[o])}let{empRuntime:n}=t;if(n){let o=[],i=n.framework||"react",{frameworkLib:u,runtimeLib:p}=n,l=n.runtimeGlobal||f,s=n.frameworkGlobal||"";if(n.injectGlobalValToHtml!==!1&&o.push({type:"script",value:`EMPShareGlobalVal={frameworkLib:'${s}',runtimeLib:'${l}',framework:'${i}'}`}),u){let r=y(u,e.mode);o.push({type:"js",value:r})}p?p==="useFrameworkLib"?l=s:o.push({type:"js",value:p}):e.chain.plugin("plugin-emp-share-framework").use(m,[n]),o.length>0&&e.injectHeadTags(o,"EMPShare");let d={"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"},a={};for(let[r,c]of Object.entries(d))a[r]=`${l}.${c}`;if(i==="react"&&s){let r={react:"React","react-dom":"ReactDOM"};for(let[c,R]of Object.entries(r))a[c]=`${s}.${R}`}n.setExternals&&n.setExternals(a),e.chain.merge({externals:a})}}}),O=g;export{O as default,g as pluginRspackEmpShare};
|
|
82
3
|
//# sourceMappingURL=rspack.js.map
|
package/dist/rspack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/plugins/rspack/index.ts","../src/helper/config.ts","../src/helper/index.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/utils.ts"],"sourcesContent":["import type {GlobalStore} from '@empjs/cli'\nimport {ModuleFederationPlugin} from '@module-federation/enhanced/rspack'\nimport {shareGlobalName} from 'src/helper/config'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport type {EMPPluginShareType} from './types'\nimport {getRuntimeLib} from './utils'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n if (o.name) {\n const op: any = store.deepAssign(\n {\n filename: 'emp.js',\n manifest: false,\n dts: false,\n dev: {\n disableDynamicRemoteTypeHints: true,\n },\n },\n o,\n )\n delete op.empRuntime\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n const {empRuntime} = o\n if (empRuntime) {\n const injectHtml: any[] = []\n const framework = empRuntime.framework || 'react'\n const {frameworkLib, runtimeLib} = empRuntime\n //\n let runtimeGlobal = empRuntime.runtimeGlobal || shareGlobalName\n const frameworkGlobal = empRuntime.frameworkGlobal || ''\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n injectHtml.push({\n type: 'script',\n value: `EMPShareGlobalVal={frameworkLib:'${frameworkGlobal}',runtimeLib:'${runtimeGlobal}',framework:'${framework}'}`,\n })\n }\n /**\n * frameworkLib & runtimeLib 的全局引用\n */\n if (frameworkLib) {\n const url = getRuntimeLib(frameworkLib, store.mode)\n injectHtml.push({\n type: 'js',\n value: url,\n })\n }\n if (!runtimeLib) {\n // 内置 runtimeLib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (runtimeLib === 'useFrameworkLib') {\n runtimeGlobal = frameworkGlobal\n } else {\n // 插入 runtime\n injectHtml.push({type: 'js', value: runtimeLib})\n }\n if (injectHtml.length > 0) {\n store.injectHeadTags(injectHtml, 'EMPShare')\n }\n /**\n * 设置 externals\n */\n const externalRuntime = {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${runtimeGlobal}.${value}`\n }\n if (framework === 'react' && frameworkGlobal) {\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${frameworkGlobal}.${value}`\n }\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n },\n }\n}\n\nexport default pluginRspackEmpShare\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export const importJsVm = (content: string) => `data:text/javascript,${content}`\n\nexport function deepAssign<T>(target: any, ...sources: any): T {\n for (const source of sources) {\n for (const k in source) {\n const vs = source[k],\n vt = target[k]\n if (Object(vs) == vs && Object(vt) === vt) {\n target[k] = deepAssign(vt, vs)\n continue\n }\n target[k] = source[k]\n }\n }\n return target\n}\n\nexport const checkVersion = (version: string) => (version ? Number(version.split('.')[0]) : 0)\nexport const isPromise = (p: any) => p && Object.prototype.toString.call(p) === '[object Promise]'\n","import type {Compiler} from '@rspack/core'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\nexport class EmpShareRemoteLibPlugin {\n options: EMPSHARERuntimeOptions\n constructor(op: EMPSHARERuntimeOptions) {\n this.options = op\n }\n apply(compiler: Compiler) {\n const {webpack} = compiler\n const {runtimeLib} = this.options\n if (!runtimeLib) {\n const entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string) {\n if (typeof host === 'string') return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n"],"mappings":"AACA,OAAQ,0BAAAA,MAA6B,qCCD9B,IAAMC,EAAkB,oBCAxB,IAAMC,EAAcC,GAAoB,wBAAwBA,CAAO,GCG9E,IAAMC,EAAuBC,GAAO,CAClC,IAAMC,EAAU,CAAC,WAAWD,CAAG,GAAG,EAAE,KAAK;AAAA,CAAI,EAC7C,OAAOE,EAAWD,CAAO,CAC3B,EACaE,EAAN,KAA8B,CACnC,QACA,YAAYC,EAA4B,CACtC,KAAK,QAAUA,CACjB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AKIA,IAAe,kBACtBC,EAAgBE,EAGhBN,EAAW,KAAK,CAAC,KAAM,KAAM,MAAOG,CAAU,CAAC,EAP/CP,EAAM,MAAM,OAAO,4BAA4B,EAAE,IAAIa,EAAyB,CAACV,CAAU,CAAC,EASxFC,EAAW,OAAS,GACtBJ,EAAM,eAAeI,EAAY,UAAU,EAK7C,IAAMU,EAAkB,CACtB,6BAA8B,YAC9B,yBAA0B,OAC5B,EACMC,EAAY,CAAC,EACnB,OAAW,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQH,CAAe,EACvDC,EAAUC,CAAG,EAAI,GAAGR,CAAa,IAAIS,CAAK,GAE5C,GAAIZ,IAAc,SAAWK,EAAiB,CAC5C,IAAMQ,EAAgB,CACpB,MAAO,QACP,YAAa,UACf,EACA,OAAW,CAACF,EAAKC,CAAK,IAAK,OAAO,QAAQC,CAAa,EACrDH,EAAUC,CAAG,EAAI,GAAGN,CAAe,IAAIO,CAAK,EAEhD,CACId,EAAW,cAAcA,EAAW,aAAaY,CAAS,EAG9Df,EAAM,MAAM,MAAM,CAAC,UAAAe,CAAS,CAAC,CAC/B,CACF,CACF,GAGKI,EAAQrB","names":["ModuleFederationPlugin","shareGlobalName","importJsVm","content","getShareRuntimeEntry","url","content","importJsVm","EmpShareRemoteLibPlugin","op","compiler","webpack","runtimeLib","entry","getRuntimeLib","host","mode","pluginRspackEmpShare","o","store","op","ModuleFederationPlugin","empRuntime","injectHtml","framework","frameworkLib","runtimeLib","runtimeGlobal","shareGlobalName","frameworkGlobal","url","getRuntimeLib","EmpShareRemoteLibPlugin","externalRuntime","externals","key","value","externalReact","rspack_default"]}
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,211 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/runtime.ts
|
|
21
|
-
var runtime_exports = {};
|
|
22
|
-
__export(runtime_exports, {
|
|
23
|
-
default: () => mfRuntime_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(runtime_exports);
|
|
26
|
-
|
|
27
|
-
// src/helper/config.ts
|
|
28
|
-
var shareGlobalName = "EMP_SHARE_RUNTIME";
|
|
29
|
-
|
|
30
|
-
// src/mfRuntime/helper.ts
|
|
31
|
-
function deepAssign(target, ...sources) {
|
|
32
|
-
for (const source of sources) {
|
|
33
|
-
for (const k in source) {
|
|
34
|
-
const vs = source[k], vt = target[k];
|
|
35
|
-
if (Object(vs) == vs && Object(vt) === vt) {
|
|
36
|
-
target[k] = deepAssign(vt, vs);
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
target[k] = source[k];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return target;
|
|
43
|
-
}
|
|
44
|
-
var checkVersion = (version) => version ? Number(version.split(".")[0]) : 0;
|
|
45
|
-
var isPromise = (p) => p && Object.prototype.toString.call(p) === "[object Promise]";
|
|
46
|
-
|
|
47
|
-
// src/mfRuntime/framework/base.ts
|
|
48
|
-
var BaseAdapter = class {
|
|
49
|
-
libs;
|
|
50
|
-
constructor(libs) {
|
|
51
|
-
this.libs = libs;
|
|
52
|
-
}
|
|
53
|
-
get shared() {
|
|
54
|
-
const { React, ReactDOM, scope } = this.libs;
|
|
55
|
-
return {
|
|
56
|
-
react: {
|
|
57
|
-
lib: () => React,
|
|
58
|
-
version: React.version,
|
|
59
|
-
scope,
|
|
60
|
-
shareConfig: {
|
|
61
|
-
singleton: true,
|
|
62
|
-
requiredVersion: `^${React.version}`
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"react-dom": {
|
|
66
|
-
lib: () => ReactDOM,
|
|
67
|
-
version: ReactDOM.version,
|
|
68
|
-
scope,
|
|
69
|
-
shareConfig: {
|
|
70
|
-
singleton: true,
|
|
71
|
-
requiredVersion: `^${React.version}`
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// src/mfRuntime/framework/react.tsx
|
|
79
|
-
var ReactAdapter = class extends BaseAdapter {
|
|
80
|
-
constructor(libs) {
|
|
81
|
-
super(libs);
|
|
82
|
-
}
|
|
83
|
-
adapter(component, scope = this.libs.scope, React = this.libs.React, ReactDOM = this.libs.ReactDOM) {
|
|
84
|
-
const reactVersion = checkVersion(React.version);
|
|
85
|
-
const self = this;
|
|
86
|
-
class WrappedComponent extends React.Component {
|
|
87
|
-
containerRef;
|
|
88
|
-
root;
|
|
89
|
-
constructor(props) {
|
|
90
|
-
super(props);
|
|
91
|
-
this.containerRef = React.createRef();
|
|
92
|
-
}
|
|
93
|
-
componentDidMount() {
|
|
94
|
-
this.mountOriginalComponent(true);
|
|
95
|
-
}
|
|
96
|
-
componentDidUpdate() {
|
|
97
|
-
this.mountOriginalComponent();
|
|
98
|
-
}
|
|
99
|
-
componentWillUnmount() {
|
|
100
|
-
this.unMountOriginalComponent();
|
|
101
|
-
}
|
|
102
|
-
unMountOriginalComponent() {
|
|
103
|
-
if (!this.containerRef.current) return;
|
|
104
|
-
if (reactVersion < 18) {
|
|
105
|
-
ReactDOM.unmountComponentAtNode(this.containerRef.current);
|
|
106
|
-
} else {
|
|
107
|
-
this.root.unmount();
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
async mountOriginalComponent(shouldRender) {
|
|
111
|
-
if (isPromise(component))
|
|
112
|
-
component = await component.then((m) => {
|
|
113
|
-
return m[scope];
|
|
114
|
-
});
|
|
115
|
-
const element = React.createElement(component, this.props);
|
|
116
|
-
if (reactVersion < 18) {
|
|
117
|
-
const Render = shouldRender ? ReactDOM.render : ReactDOM.hydrate;
|
|
118
|
-
Render(element, this.containerRef.current);
|
|
119
|
-
} else {
|
|
120
|
-
if (shouldRender) {
|
|
121
|
-
const { createRoot } = self.libs;
|
|
122
|
-
this.root = createRoot(this.containerRef.current);
|
|
123
|
-
this.root.render(element);
|
|
124
|
-
} else {
|
|
125
|
-
const { hydrateRoot } = self.libs;
|
|
126
|
-
this.root = hydrateRoot(this.containerRef.current, element);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
render() {
|
|
131
|
-
return /* @__PURE__ */ React.createElement("div", { ref: this.containerRef });
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
return WrappedComponent;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// src/mfRuntime/plugins.ts
|
|
139
|
-
var catchErrorNextPlugin = function(showLog = false) {
|
|
140
|
-
return {
|
|
141
|
-
name: "catch-error-next-plugin",
|
|
142
|
-
errorLoadRemote(o) {
|
|
143
|
-
if (showLog) {
|
|
144
|
-
console.log("[@emp/adapter]", o.id, o.lifecycle, o.from);
|
|
145
|
-
console.error("[@emp/adapter]", o.error);
|
|
146
|
-
}
|
|
147
|
-
return {};
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// src/mfRuntime/index.ts
|
|
153
|
-
var EMPRuntime = class {
|
|
154
|
-
libs = deepAssign(
|
|
155
|
-
{
|
|
156
|
-
scope: "default"
|
|
157
|
-
},
|
|
158
|
-
window[shareGlobalName] || {}
|
|
159
|
-
);
|
|
160
|
-
initOptions;
|
|
161
|
-
options = {
|
|
162
|
-
showLog: false
|
|
163
|
-
};
|
|
164
|
-
framework;
|
|
165
|
-
isInit = false;
|
|
166
|
-
react;
|
|
167
|
-
constructor(op) {
|
|
168
|
-
if (op) this.setupLibs(op);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* 实例化 adapter libs
|
|
172
|
-
* @param EMP_ADAPTER
|
|
173
|
-
*/
|
|
174
|
-
setupLibs(o) {
|
|
175
|
-
if (o) {
|
|
176
|
-
this.libs = o;
|
|
177
|
-
}
|
|
178
|
-
if (!this.libs.MFRuntime) {
|
|
179
|
-
throw new Error("EMP FastMode must load MFRuntime!");
|
|
180
|
-
}
|
|
181
|
-
if (!this.libs.MFSDK) {
|
|
182
|
-
throw new Error("EMP FastMode must load MFSDK!");
|
|
183
|
-
}
|
|
184
|
-
if (this.libs.React && this.libs.ReactDOM) {
|
|
185
|
-
this.framework = "react";
|
|
186
|
-
this.react = new ReactAdapter(this.libs);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
init(options = {}) {
|
|
190
|
-
if (this.isInit) return;
|
|
191
|
-
let op = {
|
|
192
|
-
name: "empAdepterProject",
|
|
193
|
-
remotes: [],
|
|
194
|
-
plugins: [catchErrorNextPlugin(this.options.showLog)]
|
|
195
|
-
};
|
|
196
|
-
if (this.framework === "react") {
|
|
197
|
-
op.shared = this.react.shared;
|
|
198
|
-
}
|
|
199
|
-
op = deepAssign(op, options);
|
|
200
|
-
this.libs.MFRuntime.init(op);
|
|
201
|
-
this.isInit = true;
|
|
202
|
-
}
|
|
203
|
-
load(...args) {
|
|
204
|
-
return this.libs.MFRuntime.loadRemote(...args);
|
|
205
|
-
}
|
|
206
|
-
register = this.libs.MFRuntime.registerRemotes;
|
|
207
|
-
preload = this.libs.MFRuntime.preloadRemote;
|
|
208
|
-
loadShare = this.libs.MFRuntime.loadShare;
|
|
209
|
-
};
|
|
210
|
-
var mfRuntime_default = new EMPRuntime();
|
|
1
|
+
"use strict";var r=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var e in i)r(t,e,{get:i[e],enumerable:!0})},T=(t,i,e,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of y(i))!h.call(t,n)&&n!==e&&r(t,n,{get:()=>i[n],enumerable:!(o=b(i,n))||o.enumerable});return t};var d=t=>T(r({},"__esModule",{value:!0}),t);var M={};R(M,{EMPRuntime:()=>s,default:()=>f});module.exports=d(M);function l(t,...i){for(let e of i)for(let o in e){let n=e[o],p=t[o];if(Object(n)==n&&Object(p)===p){t[o]=l(p,n);continue}t[o]=e[o]}return t}var a="EMP_SHARE_RUNTIME";var u=window[a]||{},c=window,{EMPShareGlobalVal:m}=c||{};m&&m.runtimeLib&&(u=c[m.runtimeLib]);var s=class{libs=u;initOptions;options={showLog:!1};shareGlobalName=a;constructor(i){i&&this.setup(i)}setup(i){if(i&&(typeof i=="string"&&(i=window[i]),this.libs=i),!this.libs.MFRuntime||!this.libs.MFSDK)throw new Error("MFRuntime and MFSDK Required!")}init(i={}){let e={name:"empRuntimeProject",remotes:[]};e=l(e,i),this.libs.MFRuntime.init(e)}load(...i){return this.libs.MFRuntime.loadRemote(...i)}register=this.libs?.MFRuntime.registerRemotes;preload=this.libs?.MFRuntime.preloadRemote;loadShare=this.libs?.MFRuntime.loadShare},f=new s;0&&(module.exports={EMPRuntime});
|
|
211
2
|
//# sourceMappingURL=runtime.cjs.map
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/runtime.ts","../src/helper/config.ts","../src/mfRuntime/helper.ts","../src/mfRuntime/framework/base.ts","../src/mfRuntime/framework/react.tsx","../src/mfRuntime/plugins.ts","../src/mfRuntime/index.ts"],"sourcesContent":["export {default} from './mfRuntime'\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export function deepAssign<T>(target: any, ...sources: any): T {\n for (const source of sources) {\n for (const k in source) {\n const vs = source[k],\n vt = target[k]\n if (Object(vs) == vs && Object(vt) === vt) {\n target[k] = deepAssign(vt, vs)\n continue\n }\n target[k] = source[k]\n }\n }\n return target\n}\n\nexport const checkVersion = (version: string) => (version ? Number(version.split('.')[0]) : 0)\nexport const isPromise = (p: any) => p && Object.prototype.toString.call(p) === '[object Promise]'\n","import type {EMP_ADAPTER_Type} from '../types'\nexport class BaseAdapter {\n libs: EMP_ADAPTER_Type\n\n constructor(libs: EMP_ADAPTER_Type) {\n this.libs = libs\n }\n get shared() {\n const {React, ReactDOM, scope} = this.libs as EMP_ADAPTER_Type\n return {\n react: {\n lib: () => React,\n version: React.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n 'react-dom': {\n lib: () => ReactDOM,\n version: ReactDOM.version,\n scope,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n }\n }\n}\n","import {checkVersion, isPromise} from '../helper'\nimport type {EMP_ADAPTER_Type} from '../types'\nimport {BaseAdapter} from './base'\nexport class ReactAdapter extends BaseAdapter {\n constructor(libs: EMP_ADAPTER_Type) {\n super(libs)\n }\n adapter<P = any>(\n component: any,\n scope: string = this.libs.scope,\n React: any = this.libs.React,\n ReactDOM: any = this.libs.ReactDOM,\n ): P {\n const reactVersion = checkVersion(React.version)\n const self = this\n class WrappedComponent extends React.Component {\n public containerRef: any\n public root: any\n constructor(props: P) {\n super(props as any)\n this.containerRef = React.createRef()\n }\n\n componentDidMount() {\n this.mountOriginalComponent(true)\n }\n\n componentDidUpdate() {\n this.mountOriginalComponent()\n }\n\n componentWillUnmount() {\n this.unMountOriginalComponent()\n }\n unMountOriginalComponent() {\n if (!this.containerRef.current) return\n if (reactVersion < 18) {\n ReactDOM.unmountComponentAtNode(this.containerRef.current)\n } else {\n this.root.unmount()\n }\n }\n async mountOriginalComponent(shouldRender?: boolean) {\n if (isPromise(component))\n component = await component.then((m: any) => {\n return m[scope]\n })\n const element = React.createElement(component, this.props)\n if (reactVersion < 18) {\n const Render = shouldRender ? ReactDOM.render : ReactDOM.hydrate\n Render(element, this.containerRef.current)\n } else {\n if (shouldRender) {\n const {createRoot} = self.libs\n this.root = createRoot(this.containerRef.current!)\n this.root.render(element)\n } else {\n const {hydrateRoot} = self.libs\n this.root = hydrateRoot(this.containerRef.current!, element)\n }\n }\n }\n\n render() {\n return <div ref={this.containerRef} />\n }\n }\n return WrappedComponent as any\n }\n}\n","import type {FederationRuntimePlugin} from '@module-federation/runtime'\nexport const errorLoadPlugin: () => FederationRuntimePlugin = function () {\n return {\n name: 'fallback-plugin',\n errorLoadRemote(...args) {\n console.error('[errorLoadRemote]', ...args)\n const fallback = 'error loading modules'\n return fallback\n },\n }\n}\n\nexport const catchErrorNextPlugin: (showLog?: boolean) => FederationRuntimePlugin = function (showLog = false) {\n return {\n name: 'catch-error-next-plugin',\n errorLoadRemote(o) {\n if (showLog) {\n // console.error('[@emp/adapter]', o)\n console.log('[@emp/adapter]', o.id, o.lifecycle, o.from)\n console.error('[@emp/adapter]', o.error)\n }\n return {}\n },\n }\n}\n","import {shareGlobalName} from 'src/helper/config'\nimport {ReactAdapter} from './framework/react'\nimport {deepAssign} from './helper'\nimport {catchErrorNextPlugin} from './plugins'\nimport type {\n EMP_ADAPTER_OPTIONS_Type,\n EMP_ADAPTER_Type,\n EmpRuntimeOptions,\n FrameworkType,\n InitOptionsType,\n LoadRemoteType,\n} from './types'\ntype EmpInitOptionsType = Partial<InitOptionsType>\nexport class EMPRuntime {\n public libs: EMP_ADAPTER_OPTIONS_Type = deepAssign(\n {\n scope: 'default',\n },\n window[shareGlobalName] || {},\n )\n public initOptions!: InitOptionsType\n public options: EmpRuntimeOptions = {\n showLog: false,\n }\n framework?: FrameworkType\n private isInit = false\n react!: ReactAdapter\n constructor(op?: EMP_ADAPTER_OPTIONS_Type) {\n if (op) this.setupLibs(op)\n }\n /**\n * 实例化 adapter libs\n * @param EMP_ADAPTER\n */\n public setupLibs(o?: EMP_ADAPTER_OPTIONS_Type) {\n if (o) {\n // console.log(this.libs, o)\n // this.libs = deepAssign(this.libs, o)\n this.libs = o\n }\n if (!this.libs.MFRuntime) {\n throw new Error('EMP FastMode must load MFRuntime!')\n }\n if (!this.libs.MFSDK) {\n throw new Error('EMP FastMode must load MFSDK!')\n }\n if (this.libs.React && this.libs.ReactDOM) {\n this.framework = 'react'\n this.react = new ReactAdapter(this.libs as EMP_ADAPTER_Type)\n }\n }\n public init(options: EmpInitOptionsType = {}) {\n if (this.isInit) return\n let op: InitOptionsType = {\n name: 'empAdepterProject',\n remotes: [],\n plugins: [catchErrorNextPlugin(this.options.showLog)],\n }\n if (this.framework === 'react') {\n op.shared = this.react.shared\n }\n op = deepAssign<InitOptionsType>(op, options)\n this.libs.MFRuntime.init(op)\n this.isInit = true\n }\n public load<T = any>(...args: LoadRemoteType) {\n return this.libs.MFRuntime.loadRemote<T>(...args) as Promise<T>\n }\n public register = this.libs.MFRuntime.registerRemotes\n public preload = this.libs.MFRuntime.preloadRemote\n public loadShare = this.libs.MFRuntime.loadShare\n}\n//\nexport default new EMPRuntime()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kBAAkB;;;ACAxB,SAAS,WAAc,WAAgB,SAAiB;AAC7D,aAAW,UAAU,SAAS;AAC5B,eAAW,KAAK,QAAQ;AACtB,YAAM,KAAK,OAAO,CAAC,GACjB,KAAK,OAAO,CAAC;AACf,UAAI,OAAO,EAAE,KAAK,MAAM,OAAO,EAAE,MAAM,IAAI;AACzC,eAAO,CAAC,IAAI,WAAW,IAAI,EAAE;AAC7B;AAAA,MACF;AACA,aAAO,CAAC,IAAI,OAAO,CAAC;AAAA,I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C;AAEA,IAAO,oBAAQ,IAAI,WAAW;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/runtime/index.ts","../src/helper/index.ts","../src/helper/config.ts"],"sourcesContent":["import {deepAssign} from 'src/helper'\nimport {shareGlobalName} from 'src/helper/config'\nimport type {EMPShareRuntimeType, EmpRuntimeOptions, InitOptionsType, LoadRemoteType} from 'src/types'\ntype EmpInitOptionsType = Partial<InitOptionsType>\nlet globalLib = window[shareGlobalName] || {}\n// 根据 injectGlobalValToHtml 提前把库赋值到 EMPRuntime\nconst win: any = window\nconst {EMPShareGlobalVal} = win || {}\nif (EMPShareGlobalVal && EMPShareGlobalVal.runtimeLib) {\n globalLib = win[EMPShareGlobalVal.runtimeLib]\n}\n\nexport class EMPRuntime {\n public libs: EMPShareRuntimeType = globalLib\n public initOptions!: InitOptionsType\n public options: EmpRuntimeOptions = {\n showLog: false,\n }\n public shareGlobalName = shareGlobalName\n // private isInit = false\n constructor(op?: EMPShareRuntimeType) {\n if (op) this.setup(op)\n }\n /**\n * 实例化 adapter libs\n */\n public setup(o?: EMPShareRuntimeType | string) {\n if (o) {\n if (typeof o === 'string') o = window[o]\n this.libs = o as any\n }\n if (!this.libs.MFRuntime || !this.libs.MFSDK) {\n throw new Error('MFRuntime and MFSDK Required!')\n }\n }\n public init(options: EmpInitOptionsType = {}) {\n // if (this.isInit) return\n let op: InitOptionsType = {\n name: 'empRuntimeProject',\n remotes: [],\n // plugins: [catchErrorNextPlugin(this.options.showLog)],\n }\n op = deepAssign<InitOptionsType>(op, options)\n this.libs.MFRuntime.init(op)\n // this.isInit = true\n }\n public load<T = any>(...args: LoadRemoteType) {\n return this.libs.MFRuntime.loadRemote<T>(...args) as Promise<T>\n }\n public register = this.libs?.MFRuntime.registerRemotes\n public preload = this.libs?.MFRuntime.preloadRemote\n public loadShare = this.libs?.MFRuntime.loadShare\n}\n//\nexport default new EMPRuntime()\n","export const importJsVm = (content: string) => `data:text/javascript,${content}`\n\nexport function deepAssign<T>(target: any, ...sources: any): T {\n for (const source of sources) {\n for (const k in source) {\n const vs = source[k],\n vt = target[k]\n if (Object(vs) == vs && Object(vt) === vt) {\n target[k] = deepAssign(vt, vs)\n continue\n }\n target[k] = source[k]\n }\n }\n return target\n}\n\nexport const checkVersion = (version: string) => (version ? Number(version.split('.')[0]) : 0)\nexport const isPromise = (p: any) => p && Object.prototype.toString.call(p) === '[object Promise]'\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GCEO,SAASK,EAAcC,KAAgBC,EAAiB,CAC7D,QAAWC,KAAUD,EACnB,QAAWE,KAAKD,EAAQ,CACtB,IAAME,EAAKF,EAAOC,CAAC,EACjBE,EAAKL,EAAOG,CAAC,EACf,GAAI,OAAOC,CAAE,GAAKA,GAAM,OAAOC,CAAE,IAAMA,EAAI,CACzCL,EAAOG,CAAC,EAAIJ,EAAWM,EAAID,CAAE,EAC7B,QACF,CACAJ,EAAOG,CAAC,EAAID,EAAOC,CAAC,CACtB,CAEF,OAAOH,CACT,CCfO,IAAMM,EAAkB,oBFI/B,IAAIC,EAAY,OAAOC,CAAe,GAAK,CAAC,EAEtCC,EAAW,OACX,CAAC,kBAAAC,CAAiB,EAAID,GAAO,CAAC,EAChCC,GAAqBA,EAAkB,aACzCH,EAAYE,EAAIC,EAAkB,UAAU,GAGvC,IAAMC,EAAN,KAAiB,CACf,KAA4BJ,EAC5B,YACA,QAA6B,CAClC,QAAS,EACX,EACO,gBAAkBC,EAEzB,YAAYI,EAA0B,CAChCA,GAAI,KAAK,MAAMA,CAAE,CACvB,CAIO,MAAMC,EAAkC,CAK7C,GAJIA,IACE,OAAOA,GAAM,WAAUA,EAAI,OAAOA,CAAC,GACvC,KAAK,KAAOA,GAEV,CAAC,KAAK,KAAK,WAAa,CAAC,KAAK,KAAK,MACrC,MAAM,IAAI,MAAM,+BAA+B,CAEnD,CACO,KAAKC,EAA8B,CAAC,EAAG,CAE5C,IAAIF,EAAsB,CACxB,KAAM,oBACN,QAAS,CAAC,CAEZ,EACAA,EAAKG,EAA4BH,EAAIE,CAAO,EAC5C,KAAK,KAAK,UAAU,KAAKF,CAAE,CAE7B,CACO,QAAiBI,EAAsB,CAC5C,OAAO,KAAK,KAAK,UAAU,WAAc,GAAGA,CAAI,CAClD,CACO,SAAW,KAAK,MAAM,UAAU,gBAChC,QAAU,KAAK,MAAM,UAAU,cAC/B,UAAY,KAAK,MAAM,UAAU,SAC1C,EAEOC,EAAQ,IAAIN","names":["runtime_exports","__export","EMPRuntime","runtime_default","__toCommonJS","deepAssign","target","sources","source","k","vs","vt","shareGlobalName","globalLib","shareGlobalName","win","EMPShareGlobalVal","EMPRuntime","op","o","options","deepAssign","args","runtime_default"]}
|