@empjs/share 3.9.3 → 3.10.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/dist/index.js CHANGED
@@ -1,3 +1,385 @@
1
- var f=s=>`data:text/javascript,${s}`;function u(s,...e){for(let t of e)for(let r in t){let a=t[r],n=s[r];if(Object(a)==a&&Object(n)===n){s[r]=u(n,a);continue}s[r]=t[r]}return s}var k=!1,E=k?console.log.bind(console,"[EMP Share]"):()=>{};var h="EMP_SHARE_RUNTIME";import{ModuleFederationPlugin as b}from"@empjs/module-federation-enhanced/rspack";var R=s=>{let e=[`import '${s}'`].join(`
2
- `);return f(e)},l=class{options;constructor(e){this.options=e}apply(e){let{webpack:t}=e,r=R("@empjs/share/library");new t.EntryPlugin(e.context,r,{name:void 0}).apply(e)}};function y(s,e,t="runtime"){return typeof s=="string"?t==="runtime"?`${s}/runtime${e==="development"?".development":""}.umd.js`:`${s}/${t}.${e}.umd.js`:typeof s=="object"?e==="development"?s.dev:s.prod:""}var g=/^([0-9a-zA-Z_\s]+)@(.*)/,c=class{op;store;injectHtml=[];externalsLib=[];constructor(e,t){this.op=e||{},this.store=t}setup(){this.resetRuntime(),this.resetFramework(),this.setMfName(),this.setMF(),this.injectGlobalVal(),this.injectFramework(),this.setShareLib(),this.setRuntimeLib(),this.injectToHtml(),this.setExternal()}injectToHtml(){let{store:e,injectHtml:t}=this;t.length>0&&e.injectTags(t,"EMPShare")}injectFramework(){if(this.fk&&this.fk.libs.length>0)return this.injectFkLibs(this.fk.libs);if(!this.op.empRuntime||!this.fk.lib)return;let{store:e,injectHtml:t}=this;if(this.fk.lib){let r=y(this.fk.lib,e.mode,this.fk.entry);t.push({attributes:{src:r},tagName:"script"})}}injectFkLibs(e){e.map(t=>{if(t.endsWith(".css"))return this.injectHtml.push({attributes:{href:t,rel:"stylesheet"},tagName:"link"});this.injectHtml.push({attributes:{src:t},tagName:"script"})})}injectGlobalVal(){if(!this.op.empRuntime)return;let{empRuntime:e}=this.op,{injectHtml:t}=this,r=this.fk.global||(e.shareLib?"window":"");if(!(e.injectGlobalValToHtml===!1||!this.rt.lib)){let n={frameworkLib:r,runtimeLib:this.rt.global};this.fk.name&&this.fk.name!=="none"&&(n.framework=this.fk.name),t.push({tagName:"script",innerHTML:`EMPShareGlobalVal=${JSON.stringify(n)}`})}}fk;resetFramework(){if(!this.op.empRuntime)return;let{framework:e,frameworkGlobal:t,frameworkLib:r}=this.op.empRuntime;this.fk={name:"none",version:0,entry:"",global:t||"",lib:r||"",libs:[]},typeof e=="string"?this.fk.name=e:typeof e=="object"&&Object.keys(e).length>0&&(e.entry=e.entry?e.entry:e.name,this.fk=u(this.fk,e))}rt;resetRuntime(){let{empRuntime:e}=this.op;if(!e)return;let t=e.runtimeGlobal||h,r=e.runtimeLib?e.runtimeLib:e.runtime?.lib?e.runtime.lib:"";this.rt={lib:r,global:t}}setExternal(){if(!this.op.empRuntime)return;let{store:e,externalsLib:t}=this,{empRuntime:r}=this.op,{shareLib:a}=r,n=this.rt.lib?{"@module-federation/runtime":"MFRuntime","@module-federation/sdk":"MFSDK"}:{},i={};for(let[o,m]of Object.entries(n))i[o]=`${this.rt.global}.${m}`;if(this.fk.name==="react"&&!a&&this.fk.global){let o=this.fk.version,m={react:"React","react-dom":"ReactDOM"};this.fk.entry==="reactRouter"&&(m["react-router-dom"]="ReactRouterDOM");for(let[p,d]of Object.entries(m))i[p]=`${this.fk.global}.${d}`;[17,18,19].includes(o)&&(i["react-dom/client"]=this.fk.global,i["react/jsx-runtime"]=this.fk.global,i["react/jsx-dev-runtime"]=this.fk.global)}a&&t.map(o=>{o.type==="js"&&o.module&&o.global&&(i[o.module]=`${this.fk.global}.${o.global}`)}),r.setExternals&&r.setExternals(i,this.fk.global,this.rt.global),e.chain.merge({externals:i})}setRuntimeLib(){if(!this.op.empRuntime)return;let{shareLib:e}=this.op.empRuntime,{store:t,injectHtml:r}=this,{empRuntime:a}=this.op;this.rt.lib?this.rt.lib==="useFrameworkLib"&&!e||r.push({tagName:"script",pos:"head",attributes:{src:this.rt.lib}}):t.chain.plugin("plugin-emp-share-framework").use(l,[a])}setMfName(){this.op.name?(this.op.name=this.store.encodeVarName(this.op.name),this.op.name!==this.store.empConfig.output.uniqueName&&this.store.chain.output.set("uniqueName",this.op.name)):this.op.name=this.store.empConfig.output.uniqueName}setMF(){let e=this.op,{store:t}=this;if(e.name){let r=t.deepAssign({filename:"emp.js",manifest:!1,dts:!1,dev:{disableDynamicRemoteTypeHints:!0}},e);e.dev===!1&&(r.dev=!1),r.empRuntime&&delete r.empRuntime,t.chain.plugin("plugin-emp-share").use(b,[r])}}setShareLib(){if(!this.op.empRuntime)return;let{shareLib:e}=this.op.empRuntime,{externalsLib:t,injectHtml:r}=this;if(e&&typeof e=="object"){for(let[a,n]of Object.entries(e)){let i={};if(i.module=a,typeof n=="string"){let o=n.match(g)||[];o.length>0?(i.global=o[1],i.entry=o[2],i.type="js",t.push(i),i={}):(i.global="",i.entry=n,i.type="js",t.push(i),i={})}else Array.isArray(n)?n.map(o=>{if(!o)return;if(o.split("?")[0].endsWith(".css"))i.entry=o,i.type="css";else{let p=o.match(g)||[];p.length>0?(i.global=p[1],i.entry=p[2],i.type="js"):(i.global="",i.entry=o,i.type="js")}t.push(i),i={}}):typeof n=="object"&&n.entry&&(i.entry=n.entry,i.global=n.global,i.type=n.type,t.push(i),i={})}t.map(a=>{a.type==="js"?r.push({attributes:{src:a.entry},tagName:"script"}):a.type==="css"&&r.push({attributes:{href:a.entry,rel:"stylesheet"},tagName:"link"})})}}};var A=(s,e)=>(s=Object.assign(s,{react:`${e}.React`,"react-dom":`${e}.ReactDOM`,"react-dom/client":e,"react/jsx-runtime":e,"react/jsx-dev-runtime":e,"react-router-dom":`${e}.ReactRouterDOM`}),s);var V=(s,e)=>(s=Object.assign(s,{vue:`${e}.Vue`,"vue-router":`${e}.VueRouter`}),s);var x=(s={})=>({name:"@empjs/share",async rsConfig(e){s.manifest===!0?s.manifest={fileName:"emp.json"}:typeof s.manifest=="object"&&(s.manifest=e.deepAssign({fileName:"emp.json"},s.manifest)),new c(s,e).setup()}}),j=x;var z=j;export{z as default,A as externalReact,V as externalVue,x as pluginRspackEmpShare};
1
+ // src/helper/index.ts
2
+ var importJsVm = (content) => `data:text/javascript,${content}`;
3
+ function deepAssign(target, ...sources) {
4
+ for (const source of sources) {
5
+ for (const k in source) {
6
+ const vs = source[k], vt = target[k];
7
+ if (Object(vs) == vs && Object(vt) === vt) {
8
+ target[k] = deepAssign(vt, vs);
9
+ continue;
10
+ }
11
+ target[k] = source[k];
12
+ }
13
+ }
14
+ return target;
15
+ }
16
+ var isDev = true;
17
+ var log = isDev ? console.log.bind(console, "[EMP Share]") : () => {
18
+ };
19
+
20
+ // src/helper/config.ts
21
+ var shareGlobalName = "EMP_SHARE_RUNTIME";
22
+
23
+ // src/helper/rspack.ts
24
+ import { ModuleFederationPlugin } from "@module-federation/rspack";
25
+
26
+ // src/plugins/rspack/plugin.ts
27
+ var getShareRuntimeEntry = (url) => {
28
+ const content = [`import '${url}'`].join("\n");
29
+ return importJsVm(content);
30
+ };
31
+ var EmpShareRemoteLibPlugin = class {
32
+ options;
33
+ constructor(op) {
34
+ this.options = op;
35
+ }
36
+ apply(compiler) {
37
+ const { webpack } = compiler;
38
+ const entry = getShareRuntimeEntry("@empjs/share/library");
39
+ new webpack.EntryPlugin(compiler.context, entry, {
40
+ name: void 0
41
+ }).apply(compiler);
42
+ }
43
+ };
44
+
45
+ // src/plugins/rspack/utils.ts
46
+ function getRuntimeLib(host, mode, entry = "runtime") {
47
+ if (typeof host === "string") {
48
+ if (entry === "runtime") {
49
+ return `${host}/runtime${mode === "development" ? ".development" : ""}.umd.js`;
50
+ } else {
51
+ return `${host}/${entry}.${mode}.umd.js`;
52
+ }
53
+ } else if (typeof host === "object") {
54
+ if (mode === "development") return host.dev;
55
+ else return host.prod;
56
+ }
57
+ return "";
58
+ }
59
+
60
+ // src/plugins/rspack/share.ts
61
+ var exp = /^([0-9a-zA-Z_\s]+)@(.*)/;
62
+ var EmpShare = class {
63
+ op;
64
+ store;
65
+ /**
66
+ * 注入资源
67
+ */
68
+ injectHtml = [];
69
+ /**
70
+ * 兼容 shareLib
71
+ */
72
+ externalsLib = [];
73
+ constructor(op, store) {
74
+ this.op = op || {};
75
+ this.store = store;
76
+ }
77
+ setup() {
78
+ this.resetRuntime();
79
+ this.resetFramework();
80
+ this.setMfName();
81
+ this.setMF();
82
+ this.injectGlobalVal();
83
+ this.injectFramework();
84
+ this.setShareLib();
85
+ this.setRuntimeLib();
86
+ this.injectToHtml();
87
+ this.setExternal();
88
+ }
89
+ injectToHtml() {
90
+ const { store, injectHtml } = this;
91
+ if (injectHtml.length > 0) {
92
+ store.injectTags(injectHtml, "EMPShare");
93
+ }
94
+ }
95
+ injectFramework() {
96
+ if (this.fk && this.fk.libs.length > 0) {
97
+ return this.injectFkLibs(this.fk.libs);
98
+ }
99
+ if (!this.op.empRuntime || !this.fk.lib) return;
100
+ const { store, injectHtml } = this;
101
+ if (this.fk.lib) {
102
+ const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry);
103
+ injectHtml.push({
104
+ attributes: {
105
+ src: url
106
+ },
107
+ tagName: "script"
108
+ });
109
+ }
110
+ }
111
+ injectFkLibs(libs) {
112
+ libs.map((url) => {
113
+ if (url.endsWith(".css")) {
114
+ return this.injectHtml.push({
115
+ attributes: {
116
+ href: url,
117
+ rel: "stylesheet"
118
+ },
119
+ tagName: "link"
120
+ });
121
+ }
122
+ this.injectHtml.push({
123
+ attributes: {
124
+ src: url
125
+ },
126
+ tagName: "script"
127
+ });
128
+ });
129
+ }
130
+ injectGlobalVal() {
131
+ if (!this.op.empRuntime) return;
132
+ const { empRuntime } = this.op;
133
+ const { injectHtml } = this;
134
+ const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? "window" : "");
135
+ const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true;
136
+ if (injectGlobalValToHtml) {
137
+ const injectData = { frameworkLib: frameworkGlobal, runtimeLib: this.rt.global };
138
+ if (this.fk.name && this.fk.name !== "none") injectData.framework = this.fk.name;
139
+ injectHtml.push({
140
+ // type: 'js',
141
+ tagName: "script",
142
+ innerHTML: `EMPShareGlobalVal=${JSON.stringify(injectData)}`
143
+ });
144
+ }
145
+ }
146
+ fk;
147
+ resetFramework() {
148
+ if (!this.op.empRuntime) return;
149
+ const { framework, frameworkGlobal, frameworkLib } = this.op.empRuntime;
150
+ this.fk = {
151
+ name: "none",
152
+ version: 0,
153
+ entry: "",
154
+ global: frameworkGlobal || "",
155
+ lib: frameworkLib || "",
156
+ libs: []
157
+ };
158
+ if (typeof framework === "string") {
159
+ this.fk.name = framework;
160
+ } else if (typeof framework === "object" && Object.keys(framework).length > 0) {
161
+ framework.entry = framework.entry ? framework.entry : framework.name;
162
+ this.fk = deepAssign(this.fk, framework);
163
+ }
164
+ }
165
+ rt;
166
+ resetRuntime() {
167
+ const { empRuntime } = this.op;
168
+ if (!empRuntime) return;
169
+ const global = empRuntime.runtimeGlobal || shareGlobalName;
170
+ const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : "";
171
+ this.rt = {
172
+ lib,
173
+ global
174
+ };
175
+ }
176
+ setExternal() {
177
+ if (!this.op.empRuntime) return;
178
+ const { store, externalsLib } = this;
179
+ const { empRuntime } = this.op;
180
+ const { shareLib } = empRuntime;
181
+ const externalRuntime = this.rt.lib ? {
182
+ "@module-federation/runtime": `MFRuntime`,
183
+ "@module-federation/sdk": `MFSDK`
184
+ } : {};
185
+ const externals = {};
186
+ for (const [key, value] of Object.entries(externalRuntime)) {
187
+ externals[key] = `${this.rt.global}.${value}`;
188
+ }
189
+ if (this.fk.name === "react" && !shareLib && this.fk.global) {
190
+ const version = this.fk.version;
191
+ const externalReact2 = {
192
+ react: `React`,
193
+ "react-dom": `ReactDOM`
194
+ };
195
+ if (this.fk.entry === "reactRouter") {
196
+ externalReact2["react-router-dom"] = "ReactRouterDOM";
197
+ }
198
+ for (const [key, value] of Object.entries(externalReact2)) {
199
+ externals[key] = `${this.fk.global}.${value}`;
200
+ }
201
+ if ([17, 18, 19].includes(version)) {
202
+ externals["react-dom/client"] = this.fk.global;
203
+ externals["react/jsx-runtime"] = this.fk.global;
204
+ externals["react/jsx-dev-runtime"] = this.fk.global;
205
+ }
206
+ }
207
+ if (shareLib) {
208
+ externalsLib.map((v) => {
209
+ if (v.type === "js" && v.module && v.global) {
210
+ externals[v.module] = `${this.fk.global}.${v.global}`;
211
+ }
212
+ });
213
+ }
214
+ if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global);
215
+ store.chain.merge({ externals });
216
+ }
217
+ setRuntimeLib() {
218
+ if (!this.op.empRuntime) return;
219
+ const { shareLib } = this.op.empRuntime;
220
+ const { store, injectHtml } = this;
221
+ const { empRuntime } = this.op;
222
+ if (!this.rt.lib) {
223
+ store.chain.plugin("plugin-emp-share-framework").use(EmpShareRemoteLibPlugin, [empRuntime]);
224
+ } else if (this.rt.lib === "useFrameworkLib" && !shareLib) {
225
+ } else {
226
+ injectHtml.push({ tagName: "script", pos: "head", attributes: { src: this.rt.lib } });
227
+ }
228
+ }
229
+ setMfName() {
230
+ if (this.op.name) {
231
+ this.op.name = this.store.encodeVarName(this.op.name);
232
+ if (this.op.name !== this.store.empConfig.output.uniqueName) {
233
+ this.store.chain.output.set("uniqueName", this.op.name);
234
+ }
235
+ } else {
236
+ this.op.name = this.store.empConfig.output.uniqueName;
237
+ }
238
+ }
239
+ setMF() {
240
+ const o = this.op;
241
+ const { store } = this;
242
+ if (o.name) {
243
+ const op = store.deepAssign(
244
+ {
245
+ filename: "emp.js",
246
+ manifest: false,
247
+ dts: false,
248
+ dev: {
249
+ disableDynamicRemoteTypeHints: true
250
+ }
251
+ },
252
+ o
253
+ );
254
+ if (o.dev === false) op.dev = false;
255
+ if (op.empRuntime) {
256
+ delete op.empRuntime;
257
+ }
258
+ store.chain.plugin("plugin-emp-share").use(ModuleFederationPlugin, [op]);
259
+ }
260
+ }
261
+ setShareLib() {
262
+ if (!this.op.empRuntime) return;
263
+ const { shareLib } = this.op.empRuntime;
264
+ const { externalsLib, injectHtml } = this;
265
+ if (shareLib && typeof shareLib === "object") {
266
+ for (const [k, v] of Object.entries(shareLib)) {
267
+ let externalsItem = {};
268
+ externalsItem.module = k;
269
+ if (typeof v === "string") {
270
+ const cb = v.match(exp) || [];
271
+ if (cb.length > 0) {
272
+ externalsItem.global = cb[1];
273
+ externalsItem.entry = cb[2];
274
+ externalsItem.type = "js";
275
+ externalsLib.push(externalsItem);
276
+ externalsItem = {};
277
+ } else {
278
+ externalsItem.global = "";
279
+ externalsItem.entry = v;
280
+ externalsItem.type = "js";
281
+ externalsLib.push(externalsItem);
282
+ externalsItem = {};
283
+ }
284
+ } else if (Array.isArray(v)) {
285
+ v.map((vo) => {
286
+ if (!vo) return;
287
+ const isCSS = vo.split("?")[0].endsWith(".css");
288
+ if (isCSS) {
289
+ externalsItem.entry = vo;
290
+ externalsItem.type = "css";
291
+ } else {
292
+ const cb = vo.match(exp) || [];
293
+ if (cb.length > 0) {
294
+ externalsItem.global = cb[1];
295
+ externalsItem.entry = cb[2];
296
+ externalsItem.type = "js";
297
+ } else {
298
+ externalsItem.global = "";
299
+ externalsItem.entry = vo;
300
+ externalsItem.type = "js";
301
+ }
302
+ }
303
+ externalsLib.push(externalsItem);
304
+ externalsItem = {};
305
+ });
306
+ } else if (typeof v === "object" && v.entry) {
307
+ externalsItem.entry = v.entry;
308
+ externalsItem.global = v.global;
309
+ externalsItem.type = v.type;
310
+ externalsLib.push(externalsItem);
311
+ externalsItem = {};
312
+ }
313
+ }
314
+ externalsLib.map((v) => {
315
+ if (v.type === "js") {
316
+ injectHtml.push({
317
+ attributes: {
318
+ src: v.entry
319
+ },
320
+ tagName: "script"
321
+ });
322
+ } else if (v.type === "css") {
323
+ injectHtml.push({
324
+ attributes: {
325
+ href: v.entry,
326
+ rel: "stylesheet"
327
+ },
328
+ tagName: "link"
329
+ });
330
+ }
331
+ });
332
+ }
333
+ }
334
+ };
335
+
336
+ // src/framework/react/config.ts
337
+ var externalReact = (o, globalVal) => {
338
+ o = Object.assign(o, {
339
+ react: `${globalVal}.React`,
340
+ "react-dom": `${globalVal}.ReactDOM`,
341
+ "react-dom/client": globalVal,
342
+ "react/jsx-runtime": globalVal,
343
+ "react/jsx-dev-runtime": globalVal,
344
+ "react-router-dom": `${globalVal}.ReactRouterDOM`
345
+ });
346
+ return o;
347
+ };
348
+
349
+ // src/framework/vue/config.ts
350
+ var externalVue = (o, globalVal) => {
351
+ o = Object.assign(o, {
352
+ vue: `${globalVal}.Vue`,
353
+ "vue-router": `${globalVal}.VueRouter`
354
+ });
355
+ return o;
356
+ };
357
+
358
+ // src/plugins/rspack/index.ts
359
+ var pluginRspackEmpShare = (o = {}) => {
360
+ return {
361
+ name: "@empjs/share",
362
+ async rsConfig(store) {
363
+ if (o.manifest === true) {
364
+ o.manifest = {
365
+ fileName: "emp.json"
366
+ };
367
+ } else if (typeof o.manifest === "object") {
368
+ o.manifest = store.deepAssign({ fileName: "emp.json" }, o.manifest);
369
+ }
370
+ const empShare = new EmpShare(o, store);
371
+ empShare.setup();
372
+ }
373
+ };
374
+ };
375
+ var rspack_default = pluginRspackEmpShare;
376
+
377
+ // src/index.ts
378
+ var src_default = rspack_default;
379
+ export {
380
+ src_default as default,
381
+ externalReact,
382
+ externalVue,
383
+ pluginRspackEmpShare
384
+ };
3
385
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/helper/index.ts","../src/helper/config.ts","../src/helper/rspack.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/utils.ts","../src/plugins/rspack/share.ts","../src/framework/react/config.ts","../src/framework/vue/config.ts","../src/plugins/rspack/index.ts","../src/index.ts"],"sourcesContent":["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\n//\nexport const isDev = process.env.EMPSHARE_ENV === 'dev'\nexport const log = isDev ? console.log.bind(console, '[EMP Share]') : () => {}\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export {ModuleFederationPlugin} from '@empjs/module-federation-enhanced/rspack'\n","import {Compiler} from '@empjs/cli'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\n\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\n// 当没有设置 runtimeLib 时候需要内置\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 entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string, entry = 'runtime') {\n if (typeof host === 'string') {\n if (entry === 'runtime') {\n return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n } else {\n return `${host}/${entry}.${mode}.umd.js`\n }\n } else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName} from 'src/helper/config'\nimport {ModuleFederationPlugin} from 'src/helper/rspack'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport type {\n EMPPluginShareType,\n ExternalsItemType,\n frameworkOptions,\n ModuleFederationPluginOptions,\n runtimeLibType,\n} from './types'\nimport {getRuntimeLib} from './utils'\n\nconst exp = /^([0-9a-zA-Z_\\s]+)@(.*)/\nexport class EmpShare {\n private op: EMPPluginShareType\n private store: GlobalStore\n /**\n * 注入资源\n */\n private injectHtml: any[] = []\n /**\n * 兼容 shareLib\n */\n private externalsLib: ExternalsItemType[] = []\n constructor(op: EMPPluginShareType, store: GlobalStore) {\n this.op = op || {}\n this.store = store\n }\n setup() {\n this.resetRuntime()\n this.resetFramework()\n this.setMfName() //设置 mfName 默认为 uniqueName\n this.setMF() // 设置 MF 配置\n this.injectGlobalVal() // 插入全局变量 方便emp外的项目调用\n this.injectFramework() // 插入ui框架库\n this.setShareLib() //兼容 emp Sharelib的共享模型设置\n this.setRuntimeLib() // 设置 MF SDK\n this.injectToHtml() //触发插入动作\n this.setExternal() // 设置 external 降低包体\n }\n private injectToHtml() {\n const {store, injectHtml} = this\n if (injectHtml.length > 0) {\n store.injectTags(injectHtml, 'EMPShare')\n }\n }\n private injectFramework() {\n if (this.fk && this.fk.libs.length > 0) {\n return this.injectFkLibs(this.fk.libs)\n }\n if (!this.op.empRuntime || !this.fk.lib) return\n const {store, injectHtml} = this\n if (this.fk.lib) {\n const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry)\n injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n }\n }\n private injectFkLibs(libs: string[]) {\n libs.map(url => {\n if (url.endsWith('.css')) {\n return this.injectHtml.push({\n attributes: {\n href: url,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n this.injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n })\n }\n private injectGlobalVal() {\n if (!this.op.empRuntime) return\n const {empRuntime} = this.op\n const {injectHtml} = this\n const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? 'window' : '')\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n const injectData: any = {frameworkLib: frameworkGlobal, runtimeLib: this.rt.global}\n if (this.fk.name && this.fk.name !== 'none') injectData.framework = this.fk.name\n injectHtml.push({\n // type: 'js',\n tagName: 'script',\n innerHTML: `EMPShareGlobalVal=${JSON.stringify(injectData)}`,\n })\n }\n }\n public fk!: Required<frameworkOptions>\n private resetFramework() {\n if (!this.op.empRuntime) return\n const {framework, frameworkGlobal, frameworkLib} = this.op.empRuntime\n //\n this.fk = {\n name: 'none',\n version: 0,\n entry: '',\n global: frameworkGlobal || '',\n lib: frameworkLib || '',\n libs: [],\n }\n //\n if (typeof framework === 'string') {\n this.fk.name = framework as any\n }\n // TODO 通用 CDN 的适配方案\n else if (typeof framework === 'object' && Object.keys(framework).length > 0) {\n // 默认 框架名 为入口\n framework.entry = framework.entry ? framework.entry : framework.name\n this.fk = deepAssign(this.fk, framework)\n }\n }\n public rt!: Required<runtimeLibType>\n private resetRuntime() {\n const {empRuntime} = this.op\n if (!empRuntime) return\n const global = empRuntime.runtimeGlobal || shareGlobalName\n const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : ''\n this.rt = {\n lib,\n global,\n }\n }\n private setExternal() {\n if (!this.op.empRuntime) return\n const {store, externalsLib} = this\n const {empRuntime} = this.op\n const {shareLib} = empRuntime\n //\n const externalRuntime = this.rt.lib\n ? {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n : {}\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${this.rt.global}.${value}`\n }\n /**\n * TODO\n * 框架相关内容需要移除 share 由外部简化配置实现\n */\n if (this.fk.name === 'react' && !shareLib && this.fk.global) {\n const version = this.fk.version\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n if (this.fk.entry === 'reactRouter') {\n externalReact['react-router-dom'] = 'ReactRouterDOM'\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${this.fk.global}.${value}`\n }\n if ([17, 18, 19].includes(version)) {\n externals['react-dom/client'] = this.fk.global\n externals['react/jsx-runtime'] = this.fk.global\n externals['react/jsx-dev-runtime'] = this.fk.global\n }\n }\n if (shareLib) {\n externalsLib.map(v => {\n if (v.type === 'js' && v.module && v.global) {\n externals[v.module] = `${this.fk.global}.${v.global}`\n }\n })\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n private setRuntimeLib() {\n if (!this.op.empRuntime) return\n\n const {shareLib} = this.op.empRuntime\n const {store, injectHtml} = this\n const {empRuntime} = this.op\n if (!this.rt.lib) {\n // 内置 this.rt.lib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (this.rt.lib === 'useFrameworkLib' && !shareLib) {\n } else {\n // 插入 runtime\n injectHtml.push({tagName: 'script', pos: 'head', attributes: {src: this.rt.lib}})\n }\n }\n private setMfName() {\n if (this.op.name) {\n this.op.name = this.store.encodeVarName(this.op.name)\n if (this.op.name !== this.store.empConfig.output.uniqueName) {\n this.store.chain.output.set('uniqueName', this.op.name)\n }\n } else {\n this.op.name = this.store.empConfig.output.uniqueName\n }\n }\n private setMF() {\n const o = this.op\n const {store} = this\n if (o.name) {\n const op = store.deepAssign<ModuleFederationPluginOptions & {empRuntime: any}>(\n {\n filename: 'emp.js',\n manifest: false,\n dts: false,\n dev: {\n disableDynamicRemoteTypeHints: true,\n },\n },\n o,\n )\n //\n if (o.dev === false) op.dev = false\n //\n if (op.empRuntime) {\n delete op.empRuntime\n }\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n }\n private setShareLib() {\n if (!this.op.empRuntime) return\n const {shareLib} = this.op.empRuntime\n const {externalsLib, injectHtml} = this\n if (shareLib && typeof shareLib === 'object') {\n for (const [k, v] of Object.entries(shareLib)) {\n let externalsItem: ExternalsItemType = {}\n externalsItem.module = k\n //增加下划线 支持lodash 等特殊符号的问题 如 _@http\n\n if (typeof v === 'string') {\n const cb: any = v.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n } else {\n externalsItem.global = ''\n externalsItem.entry = v\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n } else if (Array.isArray(v)) {\n v.map(vo => {\n if (!vo) return\n const isCSS = vo.split('?')[0].endsWith('.css')\n if (isCSS) {\n externalsItem.entry = vo\n externalsItem.type = 'css'\n } else {\n const cb: any = vo.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n } else {\n externalsItem.global = ''\n externalsItem.entry = vo\n externalsItem.type = 'js'\n }\n }\n externalsLib.push(externalsItem)\n externalsItem = {}\n })\n } else if (typeof v === 'object' && v.entry) {\n externalsItem.entry = v.entry\n externalsItem.global = v.global\n externalsItem.type = v.type\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n }\n // console.log(externalsLib)\n externalsLib.map(v => {\n if (v.type === 'js') {\n injectHtml.push({\n attributes: {\n src: v.entry,\n },\n tagName: 'script',\n })\n } else if (v.type === 'css') {\n injectHtml.push({\n attributes: {\n href: v.entry,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n })\n }\n }\n}\n","export const externalReact = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n react: `${globalVal}.React`,\n 'react-dom': `${globalVal}.ReactDOM`,\n 'react-dom/client': globalVal,\n 'react/jsx-runtime': globalVal,\n 'react/jsx-dev-runtime': globalVal,\n 'react-router-dom': `${globalVal}.ReactRouterDOM`,\n })\n return o\n}\n","export const externalVue = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n vue: `${globalVal}.Vue`,\n 'vue-router': `${globalVal}.VueRouter`,\n })\n return o\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {EmpShare} from './share'\nimport type {EMPPluginShareType} from './types'\n\n//\nexport * from 'src/framework/react/config'\nexport * from 'src/framework/vue/config'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n //\n if (o.manifest === true) {\n o.manifest = {\n fileName: 'emp.json',\n }\n } else if (typeof o.manifest === 'object') {\n o.manifest = store.deepAssign({fileName: 'emp.json'}, o.manifest)\n }\n const empShare = new EmpShare(o, store)\n empShare.setup()\n },\n }\n}\nexport default pluginRspackEmpShare\n","import {default as pluginRspackEmpShare} from 'src/plugins/rspack'\nexport default pluginRspackEmpShare\nexport * from 'src/plugins/rspack'\n"],"mappings":"AAAO,IAAMA,EAAcC,GAAoB,wBAAwBA,CAAO,GAEvE,SAASC,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,CAMO,IAAMM,EAAQ,GACRC,EAAMD,EAAQ,QAAQ,IAAI,KAAK,QAAS,aAAa,EAAI,IAAM,CAAC,ECtBtE,IAAME,EAAkB,oBCA/B,OAAQ,0BAAAC,MAA6B,2CCIrC,IAAMC,EAAuBC,GAAO,CAClC,IAAMC,EAAU,CAAC,WAAWD,CAAG,GAAG,EAAE,KAAK;AAAA,CAAI,EAC7C,OAAOE,EAAWD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O,KAEzB,CACAb,EAAa,KAAKa,CAAa,EAC/BA,EAAgB,CAAC,CACnB,CAAC,EACQ,OAAOL,GAAM,UAAYA,EAAE,QACpCK,EAAc,MAAQL,EAAE,MACxBK,EAAc,OAASL,EAAE,OACzBK,EAAc,KAAOL,EAAE,KACvBR,EAAa,KAAKa,CAAa,EAC/BA,EAAgB,CAAC,EAErB,CAEAb,EAAa,IAAIQ,GAAK,CAChBA,EAAE,OAAS,KACbrB,EAAW,KAAK,CACd,WAAY,CACV,IAAKqB,EAAE,KACT,EACA,QAAS,QACX,CAAC,EACQA,EAAE,OAAS,OACpBrB,EAAW,KAAK,CACd,WAAY,CACV,KAAMqB,EAAE,MACR,IAAK,YACP,EACA,QAAS,MACX,CAAC,CAEL,CAAC,CACH,CACF,CACF,ECxTO,IAAMQ,EAAgB,CAACC,EAAQC,KACpCD,EAAI,OAAO,OAAOA,EAAG,CACnB,MAAO,GAAGC,CAAS,SACnB,YAAa,GAAGA,CAAS,YACzB,mBAAoBA,EACpB,oBAAqBA,EACrB,wBAAyBA,EACzB,mBAAoB,GAAGA,CAAS,iBAClC,CAAC,EACMD,GCTF,IAAME,EAAc,CAACC,EAAQC,KAClCD,EAAI,OAAO,OAAOA,EAAG,CACnB,IAAK,GAAGC,CAAS,OACjB,aAAc,GAAGA,CAAS,YAC5B,CAAC,EACMD,GCGF,IAAME,EAAuB,CAACC,EAAwB,CAAC,KACrD,CACL,KAAM,eACN,MAAM,SAASC,EAAoB,CAE7BD,EAAE,WAAa,GACjBA,EAAE,SAAW,CACX,SAAU,UACZ,EACS,OAAOA,EAAE,UAAa,WAC/BA,EAAE,SAAWC,EAAM,WAAW,CAAC,SAAU,UAAU,EAAGD,EAAE,QAAQ,GAEjD,IAAIE,EAASF,EAAGC,CAAK,EAC7B,MAAM,CACjB,CACF,GAEKE,EAAQJ,ECxBf,IAAOK,EAAQC","names":["importJsVm","content","deepAssign","target","sources","source","k","vs","vt","isDev","log","shareGlobalName","ModuleFederationPlugin","getShareRuntimeEntry","url","content","importJsVm","EmpShareRemoteLibPlugin","op","compiler","webpack","entry","getRuntimeLib","host","mode","entry","exp","EmpShare","op","store","injectHtml","url","getRuntimeLib","libs","empRuntime","frameworkGlobal","injectData","framework","frameworkLib","deepAssign","global","shareGlobalName","lib","externalsLib","shareLib","externalRuntime","externals","key","value","version","externalReact","v","EmpShareRemoteLibPlugin","o","ModuleFederationPlugin","k","externalsItem","cb","vo","externalReact","o","globalVal","externalVue","o","globalVal","pluginRspackEmpShare","o","store","EmpShare","rspack_default","src_default","rspack_default"]}
1
+ {"version":3,"sources":["../src/helper/index.ts","../src/helper/config.ts","../src/helper/rspack.ts","../src/plugins/rspack/plugin.ts","../src/plugins/rspack/utils.ts","../src/plugins/rspack/share.ts","../src/framework/react/config.ts","../src/framework/vue/config.ts","../src/plugins/rspack/index.ts","../src/index.ts"],"sourcesContent":["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\n//\nexport const isDev = process.env.EMPSHARE_ENV === 'dev'\nexport const log = isDev ? console.log.bind(console, '[EMP Share]') : () => {}\n","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","export {ModuleFederationPlugin} from '@module-federation/rspack'\n","import {Compiler} from '@empjs/cli'\nimport {importJsVm} from 'src/helper'\nimport type {EMPSHARERuntimeOptions} from './types'\n\nconst getShareRuntimeEntry = url => {\n const content = [`import '${url}'`].join('\\n')\n return importJsVm(content)\n}\n// 当没有设置 runtimeLib 时候需要内置\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 entry = getShareRuntimeEntry('@empjs/share/library')\n new webpack.EntryPlugin(compiler.context, entry, {\n name: undefined,\n }).apply(compiler)\n }\n}\n","import type {EMPSHARERuntimeOptions} from './types'\nexport function getRuntimeLib(host: EMPSHARERuntimeOptions['frameworkLib'], mode: string, entry = 'runtime') {\n if (typeof host === 'string') {\n if (entry === 'runtime') {\n return `${host}/runtime${mode === 'development' ? '.development' : ''}.umd.js`\n } else {\n return `${host}/${entry}.${mode}.umd.js`\n }\n } else if (typeof host === 'object') {\n if (mode === 'development') return host.dev\n else return host.prod\n }\n return ''\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {deepAssign} from 'src/helper'\nimport {shareGlobalName} from 'src/helper/config'\nimport {ModuleFederationPlugin} from 'src/helper/rspack'\nimport {EmpShareRemoteLibPlugin} from './plugin'\nimport type {\n EMPPluginShareType,\n ExternalsItemType,\n frameworkOptions,\n ModuleFederationPluginOptions,\n runtimeLibType,\n} from './types'\nimport {getRuntimeLib} from './utils'\n\nconst exp = /^([0-9a-zA-Z_\\s]+)@(.*)/\nexport class EmpShare {\n private op: EMPPluginShareType\n private store: GlobalStore\n /**\n * 注入资源\n */\n private injectHtml: any[] = []\n /**\n * 兼容 shareLib\n */\n private externalsLib: ExternalsItemType[] = []\n constructor(op: EMPPluginShareType, store: GlobalStore) {\n this.op = op || {}\n this.store = store\n }\n setup() {\n this.resetRuntime()\n this.resetFramework()\n this.setMfName() //设置 mfName 默认为 uniqueName\n this.setMF() // 设置 MF 配置\n this.injectGlobalVal() // 插入全局变量 方便emp外的项目调用\n this.injectFramework() // 插入ui框架库\n this.setShareLib() //兼容 emp Sharelib的共享模型设置\n this.setRuntimeLib() // 设置 MF SDK\n this.injectToHtml() //触发插入动作\n this.setExternal() // 设置 external 降低包体\n }\n private injectToHtml() {\n const {store, injectHtml} = this\n if (injectHtml.length > 0) {\n store.injectTags(injectHtml, 'EMPShare')\n }\n }\n private injectFramework() {\n if (this.fk && this.fk.libs.length > 0) {\n return this.injectFkLibs(this.fk.libs)\n }\n if (!this.op.empRuntime || !this.fk.lib) return\n const {store, injectHtml} = this\n if (this.fk.lib) {\n const url = getRuntimeLib(this.fk.lib, store.mode, this.fk.entry)\n injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n }\n }\n private injectFkLibs(libs: string[]) {\n libs.map(url => {\n if (url.endsWith('.css')) {\n return this.injectHtml.push({\n attributes: {\n href: url,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n this.injectHtml.push({\n attributes: {\n src: url,\n },\n tagName: 'script',\n })\n })\n }\n private injectGlobalVal() {\n if (!this.op.empRuntime) return\n const {empRuntime} = this.op\n const {injectHtml} = this\n const frameworkGlobal = this.fk.global || (empRuntime.shareLib ? 'window' : '')\n const injectGlobalValToHtml = empRuntime.injectGlobalValToHtml === false || !this.rt.lib ? false : true\n // 插入全局引用变量 让 empRuntime 可以提前实例化 不需要在页面重复实例化\n if (injectGlobalValToHtml) {\n const injectData: any = {frameworkLib: frameworkGlobal, runtimeLib: this.rt.global}\n if (this.fk.name && this.fk.name !== 'none') injectData.framework = this.fk.name\n injectHtml.push({\n // type: 'js',\n tagName: 'script',\n innerHTML: `EMPShareGlobalVal=${JSON.stringify(injectData)}`,\n })\n }\n }\n public fk!: Required<frameworkOptions>\n private resetFramework() {\n if (!this.op.empRuntime) return\n const {framework, frameworkGlobal, frameworkLib} = this.op.empRuntime\n //\n this.fk = {\n name: 'none',\n version: 0,\n entry: '',\n global: frameworkGlobal || '',\n lib: frameworkLib || '',\n libs: [],\n }\n //\n if (typeof framework === 'string') {\n this.fk.name = framework as any\n }\n // TODO 通用 CDN 的适配方案\n else if (typeof framework === 'object' && Object.keys(framework).length > 0) {\n // 默认 框架名 为入口\n framework.entry = framework.entry ? framework.entry : framework.name\n this.fk = deepAssign(this.fk, framework)\n }\n }\n public rt!: Required<runtimeLibType>\n private resetRuntime() {\n const {empRuntime} = this.op\n if (!empRuntime) return\n const global = empRuntime.runtimeGlobal || shareGlobalName\n const lib = empRuntime.runtimeLib ? empRuntime.runtimeLib : empRuntime.runtime?.lib ? empRuntime.runtime.lib : ''\n this.rt = {\n lib,\n global,\n }\n }\n private setExternal() {\n if (!this.op.empRuntime) return\n const {store, externalsLib} = this\n const {empRuntime} = this.op\n const {shareLib} = empRuntime\n //\n const externalRuntime = this.rt.lib\n ? {\n '@module-federation/runtime': `MFRuntime`,\n '@module-federation/sdk': `MFSDK`,\n }\n : {}\n const externals = {}\n for (const [key, value] of Object.entries(externalRuntime)) {\n externals[key] = `${this.rt.global}.${value}`\n }\n /**\n * TODO\n * 框架相关内容需要移除 share 由外部简化配置实现\n */\n if (this.fk.name === 'react' && !shareLib && this.fk.global) {\n const version = this.fk.version\n const externalReact = {\n react: `React`,\n 'react-dom': `ReactDOM`,\n }\n if (this.fk.entry === 'reactRouter') {\n externalReact['react-router-dom'] = 'ReactRouterDOM'\n }\n for (const [key, value] of Object.entries(externalReact)) {\n externals[key] = `${this.fk.global}.${value}`\n }\n if ([17, 18, 19].includes(version)) {\n externals['react-dom/client'] = this.fk.global\n externals['react/jsx-runtime'] = this.fk.global\n externals['react/jsx-dev-runtime'] = this.fk.global\n }\n }\n if (shareLib) {\n externalsLib.map(v => {\n if (v.type === 'js' && v.module && v.global) {\n externals[v.module] = `${this.fk.global}.${v.global}`\n }\n })\n }\n if (empRuntime.setExternals) empRuntime.setExternals(externals, this.fk.global, this.rt.global)\n //\n // console.log('externals in plugin', externals)\n store.chain.merge({externals})\n }\n private setRuntimeLib() {\n if (!this.op.empRuntime) return\n\n const {shareLib} = this.op.empRuntime\n const {store, injectHtml} = this\n const {empRuntime} = this.op\n if (!this.rt.lib) {\n // 内置 this.rt.lib\n store.chain.plugin('plugin-emp-share-framework').use(EmpShareRemoteLibPlugin, [empRuntime])\n }\n // 统一封装到 frameworkLib\n else if (this.rt.lib === 'useFrameworkLib' && !shareLib) {\n } else {\n // 插入 runtime\n injectHtml.push({tagName: 'script', pos: 'head', attributes: {src: this.rt.lib}})\n }\n }\n private setMfName() {\n if (this.op.name) {\n this.op.name = this.store.encodeVarName(this.op.name)\n if (this.op.name !== this.store.empConfig.output.uniqueName) {\n this.store.chain.output.set('uniqueName', this.op.name)\n }\n } else {\n this.op.name = this.store.empConfig.output.uniqueName\n }\n }\n private setMF() {\n const o = this.op\n const {store} = this\n if (o.name) {\n const op = store.deepAssign<ModuleFederationPluginOptions & {empRuntime: any}>(\n {\n filename: 'emp.js',\n manifest: false,\n dts: false,\n dev: {\n disableDynamicRemoteTypeHints: true,\n },\n },\n o,\n )\n //\n if (o.dev === false) op.dev = false\n //\n if (op.empRuntime) {\n delete op.empRuntime\n }\n store.chain.plugin('plugin-emp-share').use(ModuleFederationPlugin, [op])\n }\n }\n private setShareLib() {\n if (!this.op.empRuntime) return\n const {shareLib} = this.op.empRuntime\n const {externalsLib, injectHtml} = this\n if (shareLib && typeof shareLib === 'object') {\n for (const [k, v] of Object.entries(shareLib)) {\n let externalsItem: ExternalsItemType = {}\n externalsItem.module = k\n //增加下划线 支持lodash 等特殊符号的问题 如 _@http\n\n if (typeof v === 'string') {\n const cb: any = v.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n } else {\n externalsItem.global = ''\n externalsItem.entry = v\n externalsItem.type = 'js'\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n } else if (Array.isArray(v)) {\n v.map(vo => {\n if (!vo) return\n const isCSS = vo.split('?')[0].endsWith('.css')\n if (isCSS) {\n externalsItem.entry = vo\n externalsItem.type = 'css'\n } else {\n const cb: any = vo.match(exp) || []\n if (cb.length > 0) {\n externalsItem.global = cb[1]\n externalsItem.entry = cb[2]\n externalsItem.type = 'js'\n } else {\n externalsItem.global = ''\n externalsItem.entry = vo\n externalsItem.type = 'js'\n }\n }\n externalsLib.push(externalsItem)\n externalsItem = {}\n })\n } else if (typeof v === 'object' && v.entry) {\n externalsItem.entry = v.entry\n externalsItem.global = v.global\n externalsItem.type = v.type\n externalsLib.push(externalsItem)\n externalsItem = {}\n }\n }\n // console.log(externalsLib)\n externalsLib.map(v => {\n if (v.type === 'js') {\n injectHtml.push({\n attributes: {\n src: v.entry,\n },\n tagName: 'script',\n })\n } else if (v.type === 'css') {\n injectHtml.push({\n attributes: {\n href: v.entry,\n rel: 'stylesheet',\n },\n tagName: 'link',\n })\n }\n })\n }\n }\n}\n","export const externalReact = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n react: `${globalVal}.React`,\n 'react-dom': `${globalVal}.ReactDOM`,\n 'react-dom/client': globalVal,\n 'react/jsx-runtime': globalVal,\n 'react/jsx-dev-runtime': globalVal,\n 'react-router-dom': `${globalVal}.ReactRouterDOM`,\n })\n return o\n}\n","export const externalVue = (o: any, globalVal: string) => {\n o = Object.assign(o, {\n vue: `${globalVal}.Vue`,\n 'vue-router': `${globalVal}.VueRouter`,\n })\n return o\n}\n","import type {GlobalStore} from '@empjs/cli'\nimport {EmpShare} from './share'\nimport type {EMPPluginShareType} from './types'\n\n//\nexport * from 'src/framework/react/config'\nexport * from 'src/framework/vue/config'\n//\nexport const pluginRspackEmpShare = (o: EMPPluginShareType = {}) => {\n return {\n name: '@empjs/share',\n async rsConfig(store: GlobalStore) {\n //\n if (o.manifest === true) {\n o.manifest = {\n fileName: 'emp.json',\n }\n } else if (typeof o.manifest === 'object') {\n o.manifest = store.deepAssign({fileName: 'emp.json'}, o.manifest)\n }\n const empShare = new EmpShare(o, store)\n empShare.setup()\n },\n }\n}\nexport default pluginRspackEmpShare\n","import {default as pluginRspackEmpShare} from 'src/plugins/rspack'\nexport default pluginRspackEmpShare\nexport * from 'src/plugins/rspack'\n"],"mappings":";AAAO,IAAM,aAAa,CAAC,YAAoB,wBAAwB,OAAO;AAEvE,SAAS,WAAc,WAAgB,SAAiB;AAC7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SAAO;AACT;;;ACVO,IAAM,cAAc,CAAC,GAAQ,cAAsB;AACxD,MAAI,OAAO,OAAO,GAAG;AAAA,IACnB,KAAK,GAAG,SAAS;AAAA,IACjB,cAAc,GAAG,SAAS;AAAA,EAC5B,CAAC;AACD,SAAO;AACT;;;ACEO,IAAM,uBAAuB,CAAC,IAAwB,CAAC,MAAM;AAClE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,SAAS,OAAoB;AAEjC,UAAI,EAAE,aAAa,MAAM;AACvB,UAAE,WAAW;AAAA,UACX,UAAU;AAAA,QACZ;AAAA,MACF,WAAW,OAAO,EAAE,aAAa,UAAU;AACzC,UAAE,WAAW,MAAM,WAAW,EAAC,UAAU,WAAU,GAAG,EAAE,QAAQ;AAAA,MAClE;AACA,YAAM,WAAW,IAAI,SAAS,GAAG,KAAK;AACtC,eAAS,MAAM;AAAA,IACjB;AAAA,EACF;AACF;AACA,IAAO,iBAAQ;;;ACxBf,IAAO,cAAQ;","names":["externalReact"]}
@@ -0,0 +1,25 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+
17
+ // src/runtime/mfRuntime.ts
18
+ var mfRuntime_exports = {};
19
+ module.exports = __toCommonJS(mfRuntime_exports);
20
+ __reExport(mfRuntime_exports, require("@module-federation/runtime"), module.exports);
21
+ // Annotate the CommonJS export names for ESM import in node:
22
+ 0 && (module.exports = {
23
+ ...require("@module-federation/runtime")
24
+ });
25
+ //# sourceMappingURL=mfRuntime.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime/mfRuntime.ts"],"sourcesContent":["export * from '@module-federation/runtime'\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,8BAAc,uCAAd;","names":[]}
@@ -0,0 +1 @@
1
+ export * from '@module-federation/runtime';
@@ -0,0 +1 @@
1
+ export * from '@module-federation/runtime';
@@ -0,0 +1,3 @@
1
+ // src/runtime/mfRuntime.ts
2
+ export * from "@module-federation/runtime";
3
+ //# sourceMappingURL=mfRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/runtime/mfRuntime.ts"],"sourcesContent":["export * from '@module-federation/runtime'\n"],"mappings":";AAAA,cAAc;","names":[]}