@empjs/share 3.1.14 → 3.2.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/runtime.cjs +1 -1
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +1 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/output/full.d.ts +5 -3
- package/output/full.js +1 -1
- package/output/full.js.map +1 -1
- package/output/sdk.d.ts +2 -2
- package/output/sdk.js +1 -1
- package/output/sdk.js.map +1 -1
- package/output/sdkPolyfill.js +1 -1
- package/output/sdkPolyfill.js.map +1 -1
- package/package.json +3 -2
package/dist/runtime.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var R=(t,i)=>{for(var e in i)r(t,e,{get:i[e],enumerable:!0})},T=(t,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of h(i))!y.call(t,s)&&s!==e&&r(t,s,{get:()=>i[s],enumerable:!(n=b(i,s))||n.enumerable});return t};var f=t=>T(r({},"__esModule",{value:!0}),t);var M={};R(M,{EMPRuntime:()=>o,default:()=>d});module.exports=f(M);function a(t,...i){for(let e of i)for(let n in e){let s=e[n],p=t[n];if(Object(s)==s&&Object(p)===p){t[n]=a(p,s);continue}t[n]=e[n]}return t}var l="EMP_SHARE_RUNTIME";var u=window[l]||{},c=window,{EMPShareGlobalVal:m}=c||{};m&&m.runtimeLib&&(u=c[m.runtimeLib]);var o=class{libs=u;initOptions;options={showLog:!1};shareGlobalName=l;isInit=!1;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={}){if(this.isInit)return;let e={name:"empRuntimeProject",remotes:[]};e=a(e,i),this.libs.MFRuntime.init(e),this.isInit=!0}load(...i){return this.libs.MFRuntime.loadRemote(...i)}register=this.libs?.MFRuntime.registerRemotes;preload=this.libs?.MFRuntime.preloadRemote;loadShare=this.libs?.MFRuntime.loadShare},d=new o;0&&(module.exports={EMPRuntime});
|
|
2
2
|
//# sourceMappingURL=runtime.cjs.map
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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
|
|
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,KAAg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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"]}
|
package/dist/runtime.d.cts
CHANGED
package/dist/runtime.d.ts
CHANGED
package/dist/runtime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function p(e,...i){for(let t of i)for(let
|
|
1
|
+
function p(e,...i){for(let t of i)for(let s in t){let n=t[s],o=e[s];if(Object(n)==n&&Object(o)===o){e[s]=p(o,n);continue}e[s]=t[s]}return e}var r="EMP_SHARE_RUNTIME";var m=window[r]||{},u=window,{EMPShareGlobalVal:a}=u||{};a&&a.runtimeLib&&(m=u[a.runtimeLib]);var l=class{libs=m;initOptions;options={showLog:!1};shareGlobalName=r;isInit=!1;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={}){if(this.isInit)return;let t={name:"empRuntimeProject",remotes:[]};t=p(t,i),this.libs.MFRuntime.init(t),this.isInit=!0}load(...i){return this.libs.MFRuntime.loadRemote(...i)}register=this.libs?.MFRuntime.registerRemotes;preload=this.libs?.MFRuntime.preloadRemote;loadShare=this.libs?.MFRuntime.loadShare},R=new l;export{l as EMPRuntime,R as default};
|
|
2
2
|
//# sourceMappingURL=runtime.js.map
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/helper/index.ts","../src/helper/config.ts","../src/runtime/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","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","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
|
|
1
|
+
{"version":3,"sources":["../src/helper/index.ts","../src/helper/config.ts","../src/runtime/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","export const shareGlobalName = 'EMP_SHARE_RUNTIME'\n","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"],"mappings":"AAEO,SAASA,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,oBCI/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,EACjB,OAAS,GACjB,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,CAC5C,GAAI,KAAK,OAAQ,OACjB,IAAIF,EAAsB,CACxB,KAAM,oBACN,QAAS,CAAC,CAEZ,EACAA,EAAKG,EAA4BH,EAAIE,CAAO,EAC5C,KAAK,KAAK,UAAU,KAAKF,CAAE,EAC3B,KAAK,OAAS,EAChB,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":["deepAssign","target","sources","source","k","vs","vt","shareGlobalName","globalLib","shareGlobalName","win","EMPShareGlobalVal","EMPRuntime","op","o","options","deepAssign","args","runtime_default"]}
|
package/output/full.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import * as MFRuntime from '@module-federation/enhanced/runtime';
|
|
2
|
-
import MFRuntime__default from '@module-federation/enhanced/runtime';
|
|
3
|
-
export { MFRuntime };
|
|
4
1
|
import MFSDK__default from '@module-federation/sdk';
|
|
5
2
|
import * as MFSDK from '@module-federation/sdk';
|
|
6
3
|
export { MFSDK };
|
|
4
|
+
import * as MFRuntime from '@module-federation/enhanced/runtime';
|
|
5
|
+
import MFRuntime__default from '@module-federation/enhanced/runtime';
|
|
6
|
+
import * as moduleFederationRuntime from '@empjs/module-federation-runtime';
|
|
7
|
+
export { moduleFederationRuntime as MFRuntime };
|
|
7
8
|
|
|
8
9
|
type EMPShareRuntimeType = {
|
|
9
10
|
MFRuntime: Required<typeof MFRuntime__default>;
|
|
@@ -37,6 +38,7 @@ declare class EMPRuntime {
|
|
|
37
38
|
initOptions: InitOptionsType;
|
|
38
39
|
options: EmpRuntimeOptions;
|
|
39
40
|
shareGlobalName: string;
|
|
41
|
+
private isInit;
|
|
40
42
|
constructor(op?: EMPShareRuntimeType);
|
|
41
43
|
/**
|
|
42
44
|
* 实例化 adapter libs
|