@module-federation/runtime
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -1,2 +0,2 @@ | ||
import { l as getRegisteredShare, t as getGlobalShareScope, G as Global, F as nativeGlobal, H as resetFederationGlobalInfo, A as getGlobalFederationInstance, C as setGlobalFederationInstance, B as getGlobalFederationConstructor, z as setGlobalFederationConstructor, m as getInfoWithoutType, r as getGlobalSnapshot, I as getTargetSnapshotInfoByModuleInfo, p as getGlobalSnapshotInfoByModuleInfo, q as setGlobalSnapshotInfoByModuleInfo, J as addGlobalSnapshot, c as getRemoteEntryExports, E as registerGlobalPlugins, g as getGlobalHostPlugins, n as getPreloaded, o as setPreloaded } from './share.esm.js'; | ||
import { l as getRegisteredShare, u as getGlobalShareScope, G as Global, H as nativeGlobal, I as resetFederationGlobalInfo, B as getGlobalFederationInstance, E as setGlobalFederationInstance, C as getGlobalFederationConstructor, A as setGlobalFederationConstructor, m as getInfoWithoutType, t as getGlobalSnapshot, J as getTargetSnapshotInfoByModuleInfo, p as getGlobalSnapshotInfoByModuleInfo, r as setGlobalSnapshotInfoByModuleInfo, q as addGlobalSnapshot, c as getRemoteEntryExports, F as registerGlobalPlugins, g as getGlobalHostPlugins, n as getPreloaded, o as setPreloaded } from './share.esm.js'; | ||
@@ -3,0 +3,0 @@ const ShareUtils = { |
{ | ||
"name": "@module-federation/runtime", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"author": "zhouxiao <codingzx@gmail.com>", | ||
@@ -5,0 +5,0 @@ "main": "./index.cjs.js", |
@@ -171,25 +171,44 @@ 'use strict'; | ||
} | ||
function setGlobalFederationConstructor(FederationConstructor) { | ||
if (isDebugMode()) { | ||
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) { | ||
if (isDebug) { | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.9"; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.10"; | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function getInfoWithoutType(target, key, getModuleInfoHook) { | ||
let res = { | ||
value: target[key], | ||
key: key | ||
}; | ||
if (getModuleInfoHook) { | ||
const hookRes = getModuleInfoHook(target, key); | ||
res = hookRes || res; | ||
function getInfoWithoutType(target, key) { | ||
if (typeof key === 'string') { | ||
const keyRes = target[key]; | ||
if (keyRes) { | ||
return { | ||
value: target[key], | ||
key: key | ||
}; | ||
} else { | ||
const targetKeys = Object.keys(target); | ||
for (const targetKey of targetKeys){ | ||
const [targetTypeOrName, _] = targetKey.split(':'); | ||
const nKey = `${targetTypeOrName}:${key}`; | ||
const typeWithKeyRes = target[nKey]; | ||
if (typeWithKeyRes) { | ||
return { | ||
value: typeWithKeyRes, | ||
key: nKey | ||
}; | ||
} | ||
} | ||
return { | ||
value: undefined, | ||
key: key | ||
}; | ||
} | ||
} else { | ||
throw new Error('key must be string'); | ||
} | ||
return res; | ||
} | ||
const getGlobalSnapshot = ()=>nativeGlobal.__FEDERATION__.moduleInfo; | ||
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{ | ||
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{ | ||
// Check if the remote is included in the hostSnapshot | ||
const moduleKey = getFMId(moduleInfo); | ||
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey, getModuleInfoHook).value; | ||
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey).value; | ||
// The remoteSnapshot might not include a version | ||
@@ -208,3 +227,3 @@ if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) { | ||
const moduleKeyWithoutVersion = getFMId(resModuleInfo); | ||
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion, getModuleInfoHook).value; | ||
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value; | ||
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) { | ||
@@ -216,3 +235,3 @@ return getModuleInfoWithoutVersion; | ||
}; | ||
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo, extraOptions == null ? void 0 : extraOptions.getModuleInfoHook); | ||
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo); | ||
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{ | ||
@@ -219,0 +238,0 @@ const moduleKey = getFMId(remoteInfo); |
@@ -169,25 +169,44 @@ function getBuilderId() { | ||
} | ||
function setGlobalFederationConstructor(FederationConstructor) { | ||
if (isDebugMode()) { | ||
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) { | ||
if (isDebug) { | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.9"; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.10"; | ||
} | ||
} | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
function getInfoWithoutType(target, key, getModuleInfoHook) { | ||
let res = { | ||
value: target[key], | ||
key: key | ||
}; | ||
if (getModuleInfoHook) { | ||
const hookRes = getModuleInfoHook(target, key); | ||
res = hookRes || res; | ||
function getInfoWithoutType(target, key) { | ||
if (typeof key === 'string') { | ||
const keyRes = target[key]; | ||
if (keyRes) { | ||
return { | ||
value: target[key], | ||
key: key | ||
}; | ||
} else { | ||
const targetKeys = Object.keys(target); | ||
for (const targetKey of targetKeys){ | ||
const [targetTypeOrName, _] = targetKey.split(':'); | ||
const nKey = `${targetTypeOrName}:${key}`; | ||
const typeWithKeyRes = target[nKey]; | ||
if (typeWithKeyRes) { | ||
return { | ||
value: typeWithKeyRes, | ||
key: nKey | ||
}; | ||
} | ||
} | ||
return { | ||
value: undefined, | ||
key: key | ||
}; | ||
} | ||
} else { | ||
throw new Error('key must be string'); | ||
} | ||
return res; | ||
} | ||
const getGlobalSnapshot = ()=>nativeGlobal.__FEDERATION__.moduleInfo; | ||
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{ | ||
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{ | ||
// Check if the remote is included in the hostSnapshot | ||
const moduleKey = getFMId(moduleInfo); | ||
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey, getModuleInfoHook).value; | ||
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey).value; | ||
// The remoteSnapshot might not include a version | ||
@@ -206,3 +225,3 @@ if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) { | ||
const moduleKeyWithoutVersion = getFMId(resModuleInfo); | ||
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion, getModuleInfoHook).value; | ||
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value; | ||
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) { | ||
@@ -214,3 +233,3 @@ return getModuleInfoWithoutVersion; | ||
}; | ||
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo, extraOptions == null ? void 0 : extraOptions.getModuleInfoHook); | ||
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo); | ||
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{ | ||
@@ -776,2 +795,2 @@ const moduleKey = getFMId(remoteInfo); | ||
export { getGlobalFederationInstance as A, getGlobalFederationConstructor as B, setGlobalFederationInstance as C, DEFAULT_REMOTE_TYPE as D, registerGlobalPlugins as E, nativeGlobal as F, Global as G, resetFederationGlobalInfo as H, getTargetSnapshotInfoByModuleInfo as I, addGlobalSnapshot as J, DEFAULT_SCOPE as a, globalLoading as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getRegisteredShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, setGlobalSnapshotInfoByModuleInfo as q, getGlobalSnapshot as r, safeToString as s, getGlobalShareScope as t, formatShareConfigs as u, isBrowserEnv as v, warn as w, getBuilderId as x, addUniqueItem as y, setGlobalFederationConstructor as z }; | ||
export { setGlobalFederationConstructor as A, getGlobalFederationInstance as B, getGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, setGlobalFederationInstance as E, registerGlobalPlugins as F, Global as G, nativeGlobal as H, resetFederationGlobalInfo as I, getTargetSnapshotInfoByModuleInfo as J, DEFAULT_SCOPE as a, globalLoading as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getRegisteredShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, addGlobalSnapshot as q, setGlobalSnapshotInfoByModuleInfo as r, safeToString as s, getGlobalSnapshot as t, getGlobalShareScope as u, formatShareConfigs as v, warn as w, isBrowserEnv as x, getBuilderId as y, addUniqueItem as z }; |
@@ -26,7 +26,4 @@ /// <reference types="node" /> | ||
export declare function getGlobalFederationConstructor(): typeof FederationHost | undefined; | ||
export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost): void; | ||
export declare function getInfoWithoutType<T extends object>(target: T, key: keyof T, getModuleInfoHook?: (target: any, key: string | number | symbol) => { | ||
value: any | undefined; | ||
key: string; | ||
} | void): { | ||
export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost | undefined, isDebug?: boolean): void; | ||
export declare function getInfoWithoutType<T extends object>(target: T, key: keyof T): { | ||
value: T[keyof T] | undefined; | ||
@@ -36,12 +33,4 @@ key: string; | ||
export declare const getGlobalSnapshot: () => GlobalModuleInfo; | ||
export declare const getTargetSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>, snapshot: GlobalModuleInfo, getModuleInfoHook?: ((target: any, key: string | number | symbol) => void | { | ||
value: any | undefined; | ||
key: string; | ||
}) | undefined) => GlobalModuleInfo[string] | undefined; | ||
export declare const getGlobalSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>, extraOptions?: { | ||
getModuleInfoHook?: ((target: any, key: string | number | symbol) => void | { | ||
value: any | undefined; | ||
key: string; | ||
}) | undefined; | ||
} | undefined) => GlobalModuleInfo[string] | undefined; | ||
export declare const getTargetSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>, snapshot: GlobalModuleInfo) => GlobalModuleInfo[string] | undefined; | ||
export declare const getGlobalSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>) => GlobalModuleInfo[string] | undefined; | ||
export declare const setGlobalSnapshotInfoByModuleInfo: (remoteInfo: Remote, moduleDetailInfo: GlobalModuleInfo[string]) => GlobalModuleInfo; | ||
@@ -48,0 +37,0 @@ export declare const addGlobalSnapshot: (moduleInfos: GlobalModuleInfo) => (() => void); |
@@ -41,8 +41,8 @@ import type { RemoteWithEntry, RemoteWithVersion, Module, RemoteEntryType } from '@module-federation/sdk'; | ||
}; | ||
export type SharedGetter = (() => () => Module) | (() => Promise<() => Module>); | ||
export type ShareArgs = (SharedBaseArgs & { | ||
get: () => () => Module | Promise<() => Module>; | ||
get: SharedGetter; | ||
}) | (SharedBaseArgs & { | ||
lib: () => Module; | ||
}); | ||
export type SharedGetter = () => () => Promise<() => Module> | Module; | ||
export type Shared = { | ||
@@ -49,0 +49,0 @@ version: string; |
{ | ||
"name": "@module-federation/runtime", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"author": "zhouxiao <codingzx@gmail.com>", | ||
@@ -48,4 +48,4 @@ "main": "./dist/index.cjs", | ||
"dependencies": { | ||
"@module-federation/sdk": "0.0.9" | ||
"@module-federation/sdk": "0.0.10" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256922
5611
+ Added@module-federation/sdk@0.0.10(transitive)
- Removed@module-federation/sdk@0.0.9(transitive)