@module-federation/runtime
Advanced tools
Comparing version 0.0.0-next-20241106033302 to 0.0.0-next-20241106063644
@@ -93,3 +93,2 @@ 'use strict'; | ||
const CurrentGlobal = typeof globalThis === 'object' ? globalThis : window; | ||
const nativeGlobal = (()=>{ | ||
@@ -101,3 +100,3 @@ try { | ||
// node env | ||
return CurrentGlobal; | ||
return globalThis; | ||
} | ||
@@ -119,6 +118,6 @@ })(); | ||
// If there is no loading content on the global object, this section defines the loading object. | ||
if (!includeOwnProperty(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__')) { | ||
definePropertyGlobalVal(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__', {}); | ||
if (!includeOwnProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) { | ||
definePropertyGlobalVal(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {}); | ||
} | ||
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__; | ||
const globalLoading = globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__; | ||
function setGlobalDefaultVal(target) { | ||
@@ -153,14 +152,14 @@ var _target___FEDERATION__, _target___FEDERATION__1, _target___FEDERATION__2, _target___FEDERATION__3, _target___FEDERATION__4, _target___FEDERATION__5; | ||
} | ||
setGlobalDefaultVal(CurrentGlobal); | ||
setGlobalDefaultVal(globalThis); | ||
setGlobalDefaultVal(nativeGlobal); | ||
function resetFederationGlobalInfo() { | ||
CurrentGlobal.__FEDERATION__.__GLOBAL_PLUGIN__ = []; | ||
CurrentGlobal.__FEDERATION__.__INSTANCES__ = []; | ||
CurrentGlobal.__FEDERATION__.moduleInfo = {}; | ||
CurrentGlobal.__FEDERATION__.__SHARE__ = {}; | ||
CurrentGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {}; | ||
globalThis.__FEDERATION__.__GLOBAL_PLUGIN__ = []; | ||
globalThis.__FEDERATION__.__INSTANCES__ = []; | ||
globalThis.__FEDERATION__.moduleInfo = {}; | ||
globalThis.__FEDERATION__.__SHARE__ = {}; | ||
globalThis.__FEDERATION__.__MANIFEST_LOADING__ = {}; | ||
} | ||
function getGlobalFederationInstance(name, version) { | ||
const buildId = getBuilderId(); | ||
return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{ | ||
return globalThis.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{ | ||
if (buildId && GMInstance.options.id === getBuilderId()) { | ||
@@ -179,11 +178,11 @@ return true; | ||
function setGlobalFederationInstance(FederationInstance) { | ||
CurrentGlobal.__FEDERATION__.__INSTANCES__.push(FederationInstance); | ||
globalThis.__FEDERATION__.__INSTANCES__.push(FederationInstance); | ||
} | ||
function getGlobalFederationConstructor() { | ||
return CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__; | ||
return globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__; | ||
} | ||
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) { | ||
if (isDebug) { | ||
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor; | ||
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.0"; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor; | ||
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.0"; | ||
} | ||
@@ -264,3 +263,3 @@ } | ||
const remoteEntryKey = globalName || `__FEDERATION_${name}:custom__`; | ||
const entryExports = CurrentGlobal[remoteEntryKey]; | ||
const entryExports = globalThis[remoteEntryKey]; | ||
return { | ||
@@ -286,4 +285,4 @@ remoteEntryKey, | ||
const getGlobalHostPlugins = ()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__; | ||
const getPreloaded = (id)=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(id); | ||
const setPreloaded = (id)=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(id, true); | ||
const getPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.get(id); | ||
const setPreloaded = (id)=>globalThis.__FEDERATION__.__PRELOADED_MAP__.set(id, true); | ||
@@ -888,3 +887,2 @@ const DEFAULT_SCOPE = 'default'; | ||
exports.CurrentGlobal = CurrentGlobal; | ||
exports.DEFAULT_REMOTE_TYPE = DEFAULT_REMOTE_TYPE; | ||
@@ -891,0 +889,0 @@ exports.DEFAULT_SCOPE = DEFAULT_SCOPE; |
@@ -15,3 +15,2 @@ import { FederationHost } from './core'; | ||
} | ||
export declare const CurrentGlobal: typeof globalThis; | ||
export declare const nativeGlobal: typeof global; | ||
@@ -18,0 +17,0 @@ export declare const Global: typeof globalThis; |
{ | ||
"name": "@module-federation/runtime", | ||
"version": "0.0.0-next-20241106033302", | ||
"version": "0.0.0-next-20241106063644", | ||
"author": "zhouxiao <codingzx@gmail.com>", | ||
@@ -53,5 +53,5 @@ "main": "./dist/index.cjs.js", | ||
"dependencies": { | ||
"@module-federation/sdk": "0.0.0-next-20241106033302", | ||
"@module-federation/error-codes": "0.0.0-next-20241106033302" | ||
"@module-federation/sdk": "0.0.0-next-20241106063644", | ||
"@module-federation/error-codes": "0.0.0-next-20241106063644" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
323542
7552
+ Added@module-federation/error-codes@0.0.0-next-20241106063644(transitive)
+ Added@module-federation/sdk@0.0.0-next-20241106063644(transitive)
+ Addedisomorphic-rslog@0.0.6(transitive)
- Removed@module-federation/error-codes@0.0.0-next-20241106033302(transitive)
- Removed@module-federation/sdk@0.0.0-next-20241106033302(transitive)
- Removedisomorphic-rslog@0.0.5(transitive)
Updated@module-federation/error-codes@0.0.0-next-20241106063644