Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@module-federation/runtime

Package Overview
Dependencies
Maintainers
8
Versions
616
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/runtime - npm Package Compare versions

Comparing version 0.0.0-canary-1701669627295 to 0.0.0-canary-1701680335968

src/utils/dom.d.ts

2

helpers.cjs.js

@@ -6,3 +6,3 @@ 'use strict';

const ShareUtils = {
getGlobalShare: share.getGlobalShare,
getRegisteredShare: share.getRegisteredShare,
getGlobalShareScope: share.getGlobalShareScope

@@ -9,0 +9,0 @@ };

@@ -1,5 +0,5 @@

import { l as getGlobalShare, x as getGlobalShareScope, 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 { n as getRegisteredShare, x as getGlobalShareScope, I as nativeGlobal, J as resetFederationGlobalInfo, C as getGlobalFederationInstance, F as setGlobalFederationInstance, E as getGlobalFederationConstructor, B as setGlobalFederationConstructor, o as getInfoWithoutType, u as getGlobalSnapshot, K as getTargetSnapshotInfoByModuleInfo, r as getGlobalSnapshotInfoByModuleInfo, t as setGlobalSnapshotInfoByModuleInfo, L as addGlobalSnapshot, c as getRemoteEntryExports, H as registerGlobalPlugins, g as getGlobalHostPlugins, p as getPreloaded, q as setPreloaded } from './share.esm.js';
const ShareUtils = {
getGlobalShare,
getRegisteredShare,
getGlobalShareScope

@@ -6,0 +6,0 @@ };

{
"name": "@module-federation/runtime",
"version": "0.0.0-canary-1701669627295",
"version": "0.0.0-canary-1701680335968",
"author": "zhouxiao <codingzx@gmail.com>",

@@ -37,5 +37,5 @@ "main": "./index.cjs.js",

"dependencies": {
"@module-federation/sdk": "0.0.0-canary-1701669627295"
"@module-federation/sdk": "0.0.0-canary-1701680335968"
},
"peerDependencies": {}
}

@@ -48,2 +48,12 @@ 'use strict';

}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function safeWrapper(callback, disableWarn) {
try {
const res = await callback();
return res;
} catch (e) {
!disableWarn && warn(e);
return;
}
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types

@@ -65,2 +75,10 @@ function safeToString(info) {

}
function isStaticResourcesEqual(url1, url2) {
const REG_EXP = /^(https?:)?\/\//i;
// Transform url1 and url2 into relative paths
const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\/$/, '');
const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\/$/, '');
// Check if the relative paths are identical
return relativeUrl1 === relativeUrl2;
}

@@ -93,3 +111,3 @@ function _extends$1() {

}
var _nativeGlobal___FEDERATION__, _nativeGlobal___FEDERATION__1, _nativeGlobal___FEDERATION__2, _nativeGlobal___FEDERATION__3, _nativeGlobal___FEDERATION__4, _nativeGlobal___FEDERATION__5, _nativeGlobal___FEDERATION__6;
var _nativeGlobal___FEDERATION__, _nativeGlobal___FEDERATION__1, _nativeGlobal___FEDERATION__2, _nativeGlobal___FEDERATION__3, _nativeGlobal___FEDERATION__4, _nativeGlobal___FEDERATION__5;
// export const nativeGlobal: typeof global = new Function('return this')();

@@ -117,3 +135,2 @@ const nativeGlobal = new Function('return this')();

__MANIFEST_LOADING__: {},
__SHARE_SCOPE_LOADING__: {},
__PRELOADED_MAP__: new Map()

@@ -133,6 +150,4 @@ };

(___MANIFEST_LOADING__ = (_nativeGlobal___FEDERATION__4 = nativeGlobal.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _nativeGlobal___FEDERATION__4.__MANIFEST_LOADING__ = {};
var ___SHARE_SCOPE_LOADING__;
(___SHARE_SCOPE_LOADING__ = (_nativeGlobal___FEDERATION__5 = nativeGlobal.__FEDERATION__).__SHARE_SCOPE_LOADING__) != null ? ___SHARE_SCOPE_LOADING__ : _nativeGlobal___FEDERATION__5.__SHARE_SCOPE_LOADING__ = {};
var ___PRELOADED_MAP__;
(___PRELOADED_MAP__ = (_nativeGlobal___FEDERATION__6 = nativeGlobal.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _nativeGlobal___FEDERATION__6.__PRELOADED_MAP__ = new Map();
(___PRELOADED_MAP__ = (_nativeGlobal___FEDERATION__5 = nativeGlobal.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _nativeGlobal___FEDERATION__5.__PRELOADED_MAP__ = new Map();
const Global = {

@@ -150,3 +165,2 @@ get __FEDERATION__ () {

nativeGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {};
nativeGlobal.__FEDERATION__.__SHARE_SCOPE_LOADING__ = {};
}

@@ -634,2 +648,3 @@ function getGlobalFederationInstance(name, version) {

get,
loaded: 'lib' in shareArgs ? true : undefined,
scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [

@@ -651,3 +666,15 @@ 'default'

function versionLt(a, b) {
if (satisfy(a, `<=${b}`)) {
const transformInvalidVersion = (version)=>{
const isNumberVersion = !Number.isNaN(Number(version));
if (isNumberVersion) {
const splitArr = version.split('.');
let validVersion = version;
for(let i = 0; i < 3 - splitArr.length; i++){
validVersion += '.0';
}
return validVersion;
}
return version;
};
if (satisfy(transformInvalidVersion(a), `<=${transformInvalidVersion(b)}`)) {
return true;

@@ -658,5 +685,4 @@ } else {

}
const findVersion = (scope, pkgName, cb)=>{
const globalShares = Global.__FEDERATION__.__SHARE__;
const versions = globalShares[scope][pkgName];
const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
const versions = shareScopeMap[scope][pkgName];
const callback = cb || function(prev, cur) {

@@ -672,16 +698,18 @@ return versionLt(prev, cur);

}
// default version is '0' https://github.com/webpack/webpack/blob/main/lib/sharing/ProvideSharedModule.js#L136
if (prev === '0') {
return cur;
}
return prev;
}, 0);
};
function findSingletonVersionOrderByVersion(scope, pkgName) {
const globalShares = Global.__FEDERATION__.__SHARE__;
const versions = globalShares[scope][pkgName];
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
const versions = shareScopeMap[scope][pkgName];
const callback = function(prev, cur) {
return !versions[prev].loaded && versionLt(prev, cur);
};
return findVersion(scope, pkgName, callback);
return findVersion(shareScopeMap, scope, pkgName, callback);
}
function findSingletonVersionOrderByLoaded(scope, pkgName) {
const globalShares = Global.__FEDERATION__.__SHARE__;
const versions = globalShares[scope][pkgName];
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
const versions = shareScopeMap[scope][pkgName];
const callback = function(prev, cur) {

@@ -700,8 +728,18 @@ if (versions[cur].loaded) {

};
return findVersion(scope, pkgName, callback);
return findVersion(shareScopeMap, scope, pkgName, callback);
}
function getFindShareFunction(strategy) {
if (strategy === 'loaded-first') {
return findSingletonVersionOrderByLoaded;
}
return findSingletonVersionOrderByVersion;
}
// Details about shared resources
// TODO: Implement strictVersion for alignment with module federation.
function getGlobalShare(pkgName, shareInfo) {
function getRegisteredShare(instanceName, pkgName, shareInfo) {
const globalShares = Global.__FEDERATION__.__SHARE__;
const localShareScopeMap = globalShares[instanceName];
if (!localShareScopeMap) {
return;
}
const { shareConfig, scope = DEFAULT_SCOPE, strategy } = shareInfo;

@@ -712,24 +750,24 @@ const scopes = Array.isArray(scope) ? scope : [

for (const sc of scopes){
if (shareConfig && globalShares[sc] && globalShares[sc][pkgName]) {
if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
const { requiredVersion } = shareConfig;
// eslint-disable-next-line max-depth
if (shareConfig.singleton) {
const singletonVersion = strategy === 'loaded-first' ? findSingletonVersionOrderByLoaded(sc, pkgName) : findSingletonVersionOrderByVersion(sc, pkgName);
const singletonVersion = getFindShareFunction(strategy)(localShareScopeMap, sc, pkgName);
// eslint-disable-next-line max-depth
if (typeof requiredVersion === 'string' && !satisfy(singletonVersion, requiredVersion)) {
warn(`Version ${singletonVersion} from ${singletonVersion && globalShares[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
warn(`Version ${singletonVersion} from ${singletonVersion && localShareScopeMap[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
}
return globalShares[sc][pkgName][singletonVersion];
return localShareScopeMap[sc][pkgName][singletonVersion];
} else {
const maxVersion = findSingletonVersionOrderByLoaded(sc, pkgName);
const maxVersion = getFindShareFunction(strategy)(localShareScopeMap, sc, pkgName);
// eslint-disable-next-line max-depth
if (requiredVersion === false || requiredVersion === '*') {
return globalShares[sc][pkgName][maxVersion];
return localShareScopeMap[sc][pkgName][maxVersion];
}
// eslint-disable-next-line max-depth
if (satisfy(maxVersion, requiredVersion)) {
return globalShares[sc][pkgName][maxVersion];
return localShareScopeMap[sc][pkgName][maxVersion];
}
// eslint-disable-next-line max-depth
for (const [versionKey, versionValue] of Object.entries(globalShares[sc][pkgName])){
for (const [versionKey, versionValue] of Object.entries(localShareScopeMap[sc][pkgName])){
// eslint-disable-next-line max-depth

@@ -761,3 +799,2 @@ if (satisfy(versionKey, requiredVersion)) {

exports.getGlobalHostPlugins = getGlobalHostPlugins;
exports.getGlobalShare = getGlobalShare;
exports.getGlobalShareScope = getGlobalShareScope;

@@ -768,2 +805,3 @@ exports.getGlobalSnapshot = getGlobalSnapshot;

exports.getPreloaded = getPreloaded;
exports.getRegisteredShare = getRegisteredShare;
exports.getRemoteEntryExports = getRemoteEntryExports;

@@ -777,2 +815,3 @@ exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;

exports.isRemoteInfoWithEntry = isRemoteInfoWithEntry;
exports.isStaticResourcesEqual = isStaticResourcesEqual;
exports.nativeGlobal = nativeGlobal;

@@ -782,2 +821,3 @@ exports.registerGlobalPlugins = registerGlobalPlugins;

exports.safeToString = safeToString;
exports.safeWrapper = safeWrapper;
exports.setGlobalFederationConstructor = setGlobalFederationConstructor;

@@ -784,0 +824,0 @@ exports.setGlobalFederationInstance = setGlobalFederationInstance;

@@ -46,2 +46,12 @@ function getBuilderId() {

}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function safeWrapper(callback, disableWarn) {
try {
const res = await callback();
return res;
} catch (e) {
!disableWarn && warn(e);
return;
}
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types

@@ -63,2 +73,10 @@ function safeToString(info) {

}
function isStaticResourcesEqual(url1, url2) {
const REG_EXP = /^(https?:)?\/\//i;
// Transform url1 and url2 into relative paths
const relativeUrl1 = url1.replace(REG_EXP, '').replace(/\/$/, '');
const relativeUrl2 = url2.replace(REG_EXP, '').replace(/\/$/, '');
// Check if the relative paths are identical
return relativeUrl1 === relativeUrl2;
}

@@ -91,3 +109,3 @@ function _extends$1() {

}
var _nativeGlobal___FEDERATION__, _nativeGlobal___FEDERATION__1, _nativeGlobal___FEDERATION__2, _nativeGlobal___FEDERATION__3, _nativeGlobal___FEDERATION__4, _nativeGlobal___FEDERATION__5, _nativeGlobal___FEDERATION__6;
var _nativeGlobal___FEDERATION__, _nativeGlobal___FEDERATION__1, _nativeGlobal___FEDERATION__2, _nativeGlobal___FEDERATION__3, _nativeGlobal___FEDERATION__4, _nativeGlobal___FEDERATION__5;
// export const nativeGlobal: typeof global = new Function('return this')();

@@ -115,3 +133,2 @@ const nativeGlobal = new Function('return this')();

__MANIFEST_LOADING__: {},
__SHARE_SCOPE_LOADING__: {},
__PRELOADED_MAP__: new Map()

@@ -131,6 +148,4 @@ };

(___MANIFEST_LOADING__ = (_nativeGlobal___FEDERATION__4 = nativeGlobal.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _nativeGlobal___FEDERATION__4.__MANIFEST_LOADING__ = {};
var ___SHARE_SCOPE_LOADING__;
(___SHARE_SCOPE_LOADING__ = (_nativeGlobal___FEDERATION__5 = nativeGlobal.__FEDERATION__).__SHARE_SCOPE_LOADING__) != null ? ___SHARE_SCOPE_LOADING__ : _nativeGlobal___FEDERATION__5.__SHARE_SCOPE_LOADING__ = {};
var ___PRELOADED_MAP__;
(___PRELOADED_MAP__ = (_nativeGlobal___FEDERATION__6 = nativeGlobal.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _nativeGlobal___FEDERATION__6.__PRELOADED_MAP__ = new Map();
(___PRELOADED_MAP__ = (_nativeGlobal___FEDERATION__5 = nativeGlobal.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _nativeGlobal___FEDERATION__5.__PRELOADED_MAP__ = new Map();
const Global = {

@@ -148,3 +163,2 @@ get __FEDERATION__ () {

nativeGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {};
nativeGlobal.__FEDERATION__.__SHARE_SCOPE_LOADING__ = {};
}

@@ -632,2 +646,3 @@ function getGlobalFederationInstance(name, version) {

get,
loaded: 'lib' in shareArgs ? true : undefined,
scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [

@@ -649,3 +664,15 @@ 'default'

function versionLt(a, b) {
if (satisfy(a, `<=${b}`)) {
const transformInvalidVersion = (version)=>{
const isNumberVersion = !Number.isNaN(Number(version));
if (isNumberVersion) {
const splitArr = version.split('.');
let validVersion = version;
for(let i = 0; i < 3 - splitArr.length; i++){
validVersion += '.0';
}
return validVersion;
}
return version;
};
if (satisfy(transformInvalidVersion(a), `<=${transformInvalidVersion(b)}`)) {
return true;

@@ -656,5 +683,4 @@ } else {

}
const findVersion = (scope, pkgName, cb)=>{
const globalShares = Global.__FEDERATION__.__SHARE__;
const versions = globalShares[scope][pkgName];
const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
const versions = shareScopeMap[scope][pkgName];
const callback = cb || function(prev, cur) {

@@ -670,16 +696,18 @@ return versionLt(prev, cur);

}
// default version is '0' https://github.com/webpack/webpack/blob/main/lib/sharing/ProvideSharedModule.js#L136
if (prev === '0') {
return cur;
}
return prev;
}, 0);
};
function findSingletonVersionOrderByVersion(scope, pkgName) {
const globalShares = Global.__FEDERATION__.__SHARE__;
const versions = globalShares[scope][pkgName];
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
const versions = shareScopeMap[scope][pkgName];
const callback = function(prev, cur) {
return !versions[prev].loaded && versionLt(prev, cur);
};
return findVersion(scope, pkgName, callback);
return findVersion(shareScopeMap, scope, pkgName, callback);
}
function findSingletonVersionOrderByLoaded(scope, pkgName) {
const globalShares = Global.__FEDERATION__.__SHARE__;
const versions = globalShares[scope][pkgName];
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
const versions = shareScopeMap[scope][pkgName];
const callback = function(prev, cur) {

@@ -698,8 +726,18 @@ if (versions[cur].loaded) {

};
return findVersion(scope, pkgName, callback);
return findVersion(shareScopeMap, scope, pkgName, callback);
}
function getFindShareFunction(strategy) {
if (strategy === 'loaded-first') {
return findSingletonVersionOrderByLoaded;
}
return findSingletonVersionOrderByVersion;
}
// Details about shared resources
// TODO: Implement strictVersion for alignment with module federation.
function getGlobalShare(pkgName, shareInfo) {
function getRegisteredShare(instanceName, pkgName, shareInfo) {
const globalShares = Global.__FEDERATION__.__SHARE__;
const localShareScopeMap = globalShares[instanceName];
if (!localShareScopeMap) {
return;
}
const { shareConfig, scope = DEFAULT_SCOPE, strategy } = shareInfo;

@@ -710,24 +748,24 @@ const scopes = Array.isArray(scope) ? scope : [

for (const sc of scopes){
if (shareConfig && globalShares[sc] && globalShares[sc][pkgName]) {
if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
const { requiredVersion } = shareConfig;
// eslint-disable-next-line max-depth
if (shareConfig.singleton) {
const singletonVersion = strategy === 'loaded-first' ? findSingletonVersionOrderByLoaded(sc, pkgName) : findSingletonVersionOrderByVersion(sc, pkgName);
const singletonVersion = getFindShareFunction(strategy)(localShareScopeMap, sc, pkgName);
// eslint-disable-next-line max-depth
if (typeof requiredVersion === 'string' && !satisfy(singletonVersion, requiredVersion)) {
warn(`Version ${singletonVersion} from ${singletonVersion && globalShares[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
warn(`Version ${singletonVersion} from ${singletonVersion && localShareScopeMap[sc][pkgName][singletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
}
return globalShares[sc][pkgName][singletonVersion];
return localShareScopeMap[sc][pkgName][singletonVersion];
} else {
const maxVersion = findSingletonVersionOrderByLoaded(sc, pkgName);
const maxVersion = getFindShareFunction(strategy)(localShareScopeMap, sc, pkgName);
// eslint-disable-next-line max-depth
if (requiredVersion === false || requiredVersion === '*') {
return globalShares[sc][pkgName][maxVersion];
return localShareScopeMap[sc][pkgName][maxVersion];
}
// eslint-disable-next-line max-depth
if (satisfy(maxVersion, requiredVersion)) {
return globalShares[sc][pkgName][maxVersion];
return localShareScopeMap[sc][pkgName][maxVersion];
}
// eslint-disable-next-line max-depth
for (const [versionKey, versionValue] of Object.entries(globalShares[sc][pkgName])){
for (const [versionKey, versionValue] of Object.entries(localShareScopeMap[sc][pkgName])){
// eslint-disable-next-line max-depth

@@ -746,2 +784,2 @@ if (satisfy(versionKey, requiredVersion)) {

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, getGlobalShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, setGlobalSnapshotInfoByModuleInfo as q, getGlobalSnapshot as r, safeToString as s, addUniqueItem as t, formatShareConfigs as u, isBrowserEnv as v, warn as w, getGlobalShareScope as x, getBuilderId as y, setGlobalFederationConstructor as z };
export { getBuilderId as A, setGlobalFederationConstructor as B, getGlobalFederationInstance as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationConstructor as E, setGlobalFederationInstance as F, Global as G, registerGlobalPlugins as H, nativeGlobal as I, resetFederationGlobalInfo as J, getTargetSnapshotInfoByModuleInfo as K, addGlobalSnapshot as L, DEFAULT_SCOPE as a, globalLoading as b, getRemoteEntryExports as c, assert as d, safeToString as e, getFMId as f, getGlobalHostPlugins as g, isObject as h, isStaticResourcesEqual as i, error as j, isPlainObject as k, isRemoteInfoWithEntry as l, isPureRemoteEntry as m, getRegisteredShare as n, getInfoWithoutType as o, getPreloaded as p, setPreloaded as q, getGlobalSnapshotInfoByModuleInfo as r, safeWrapper as s, setGlobalSnapshotInfoByModuleInfo as t, getGlobalSnapshot as u, addUniqueItem as v, warn as w, getGlobalShareScope as x, formatShareConfigs as y, isBrowserEnv as z };
import type { ModuleInfo, GlobalModuleInfo } from '@module-federation/sdk';
import { Options, PreloadAssets, PreloadOptions, PreloadRemoteArgs, Remote, Shared, ShareInfos, UserOptions, RemoteInfo } from './type';
import { Options, PreloadAssets, PreloadOptions, PreloadRemoteArgs, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap } from './type';
import { Module, ModuleOptions } from './module';

@@ -82,2 +82,3 @@ import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';

}>;
constructorName: string;
version: string;

@@ -99,5 +100,3 @@ name: string;

}>;
loadingShare: {
[key: string]: Promise<any>;
};
shareScopeMap: ShareScopeMap;
constructor(userOptions: UserOptions);

@@ -117,3 +116,4 @@ initOptions(userOptions: UserOptions): Options;

*/
initializeSharing(shareScopeName?: string): boolean | Promise<boolean>;
initializeSharing(shareScopeName?: string): Array<Promise<void>>;
addShareScope(scopeName: string, shareScope: ShareScopeMap[string]): void;
private formatOptions;

@@ -120,0 +120,0 @@ private registerPlugins;

/// <reference types="node" />
import { FederationHost } from './core';
import { RemoteEntryExports, GlobalShareScope, Remote, Optional } from './type';
import { RemoteEntryExports, GlobalShareScopeMap, Remote, Optional } from './type';
import { GlobalModuleInfo, ModuleInfo } from '@module-federation/sdk';

@@ -12,5 +12,4 @@ import { FederationRuntimePlugin } from './type/plugin';

__INSTANCES__: Array<FederationHost>;
__SHARE__: GlobalShareScope;
__SHARE__: GlobalShareScopeMap;
__MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
__SHARE_SCOPE_LOADING__: Record<string, boolean | Promise<boolean>>;
__PRELOADED_MAP__: Map<string, boolean>;

@@ -17,0 +16,0 @@ }

/// <reference types="node" />
import { resetFederationGlobalInfo, getGlobalFederationInstance, setGlobalFederationInstance, getGlobalFederationConstructor, setGlobalFederationConstructor, getInfoWithoutType, getGlobalSnapshot, getTargetSnapshotInfoByModuleInfo, getGlobalSnapshotInfoByModuleInfo, setGlobalSnapshotInfoByModuleInfo, addGlobalSnapshot, getRemoteEntryExports, registerGlobalPlugins, getGlobalHostPlugins, getPreloaded, setPreloaded } from './global';
import { getGlobalShare, getGlobalShareScope } from './utils/share';
import { getRegisteredShare, getGlobalShareScope } from './utils/share';
interface IShareUtils {
getGlobalShare: typeof getGlobalShare;
getRegisteredShare: typeof getRegisteredShare;
getGlobalShareScope: typeof getGlobalShareScope;

@@ -7,0 +7,0 @@ }

@@ -5,2 +5,3 @@ import { FederationHost } from './core';

export { registerGlobalPlugins } from './global';
export { loadScript } from './utils';
export type { Federation } from './global';

@@ -7,0 +8,0 @@ export declare function init(options: UserOptions): FederationHost;

@@ -60,3 +60,3 @@ import type { RemoteWithEntry, RemoteWithVersion, Module, RemoteEntryType } from '@module-federation/sdk';

};
export type GlobalShareScope = {
export type ShareScopeMap = {
[scope: string]: {

@@ -68,2 +68,5 @@ [pkgName: string]: {

};
export type GlobalShareScopeMap = {
[instanceName: string]: ShareScopeMap;
};
export type ShareInfos = {

@@ -94,4 +97,4 @@ [pkgName: string]: Shared;

get: (id: string) => () => Promise<Module>;
init: (shareScope: GlobalShareScope[string], initScope?: Array<Record<string, never>>, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void;
init: (shareScope: ShareScopeMap[string], initScope?: Array<Record<string, any>>, remoteEntryInitOPtions?: RemoteEntryInitOptions) => void;
};
export {};

@@ -5,2 +5,3 @@ export * from './env';

export * from './logger';
export * from './dom';
export * from './plugin';

@@ -1,2 +0,2 @@

import { GlobalShareScope, Shared, ShareArgs, ShareInfos } from '../type';
import { GlobalShareScopeMap, Shared, ShareArgs, ShareInfos } from '../type';
export declare function formatShare(shareArgs: ShareArgs, from: string): Shared;

@@ -6,3 +6,3 @@ export declare function formatShareConfigs(shareArgs: {

}, from: string): ShareInfos;
export declare function getGlobalShare(pkgName: string, shareInfo: ShareInfos[keyof ShareInfos]): Shared | void;
export declare function getGlobalShareScope(): GlobalShareScope;
export declare function getRegisteredShare(instanceName: string, pkgName: string, shareInfo: ShareInfos[keyof ShareInfos]): Shared | void;
export declare function getGlobalShareScope(): GlobalShareScopeMap;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc