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

@module-federation/runtime

Package Overview
Dependencies
Maintainers
6
Versions
692
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-next-20241230025944 to 0.0.0-next-20241230030326

dist/core.cjs.d.ts

34

dist/helpers.cjs.js
'use strict';
var share = require('./share.cjs.js');
var polyfills = require('./polyfills.cjs.js');
var runtimeCore = require('@module-federation/runtime-core');
var utils = require('./utils.cjs.js');
const ShareUtils = {
getRegisteredShare: share.getRegisteredShare,
getGlobalShareScope: share.getGlobalShareScope
};
const GlobalUtils = {
Global: share.Global,
nativeGlobal: share.nativeGlobal,
resetFederationGlobalInfo: share.resetFederationGlobalInfo,
getGlobalFederationInstance: share.getGlobalFederationInstance,
setGlobalFederationInstance: share.setGlobalFederationInstance,
getGlobalFederationConstructor: share.getGlobalFederationConstructor,
setGlobalFederationConstructor: share.setGlobalFederationConstructor,
getInfoWithoutType: share.getInfoWithoutType,
getGlobalSnapshot: share.getGlobalSnapshot,
getTargetSnapshotInfoByModuleInfo: share.getTargetSnapshotInfoByModuleInfo,
getGlobalSnapshotInfoByModuleInfo: share.getGlobalSnapshotInfoByModuleInfo,
setGlobalSnapshotInfoByModuleInfo: share.setGlobalSnapshotInfoByModuleInfo,
addGlobalSnapshot: share.addGlobalSnapshot,
getRemoteEntryExports: share.getRemoteEntryExports,
registerGlobalPlugins: share.registerGlobalPlugins,
getGlobalHostPlugins: share.getGlobalHostPlugins,
getPreloaded: share.getPreloaded,
setPreloaded: share.setPreloaded
};
var helpers = {
global: GlobalUtils,
share: ShareUtils
global: polyfills._extends({}, runtimeCore.helpers.global, {
getGlobalFederationInstance: utils.getGlobalFederationInstance
}),
share: runtimeCore.helpers.share
};
module.exports = helpers;

@@ -14,16 +14,2 @@ 'use strict';

function _object_without_properties_loose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
exports._extends = _extends;
exports._object_without_properties_loose = _object_without_properties_loose;

@@ -1,114 +0,3 @@

import type { CreateScriptHookReturn, ModuleInfo } from '@module-federation/sdk';
import { Options, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions, CallFrom } from './type';
import { getRemoteEntry } from './utils';
import { Module } from './module';
import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler';
import { SharedHandler } from './shared';
import { RemoteHandler } from './remote';
export declare class FederationHost {
options: Options;
hooks: PluginSystem<{
beforeInit: SyncWaterfallHook<{
userOptions: UserOptions;
options: Options;
origin: FederationHost;
shareInfo: ShareInfos;
}>;
init: SyncHook<[{
options: Options;
origin: FederationHost;
}], void>;
beforeInitContainer: AsyncWaterfallHook<{
shareScope: ShareScopeMap[string];
initScope: InitScope;
remoteEntryInitOptions: RemoteEntryInitOptions;
remoteInfo: RemoteInfo;
origin: FederationHost;
}>;
initContainer: AsyncWaterfallHook<{
shareScope: ShareScopeMap[string];
initScope: InitScope;
remoteEntryInitOptions: RemoteEntryInitOptions;
remoteInfo: RemoteInfo;
remoteEntryExports: RemoteEntryExports;
origin: FederationHost;
id: string;
remoteSnapshot?: ModuleInfo;
}>;
}>;
version: string;
name: string;
moduleCache: Map<string, Module>;
snapshotHandler: SnapshotHandler;
sharedHandler: SharedHandler;
remoteHandler: RemoteHandler;
shareScopeMap: ShareScopeMap;
loaderHook: PluginSystem<{
getModuleInfo: SyncHook<[{
target: Record<string, any>;
key: any;
}], void | {
value: any | undefined;
key: string;
}>;
createScript: SyncHook<[{
url: string;
attrs?: Record<string, any>;
}], CreateScriptHookReturn>;
createLink: SyncHook<[{
url: string;
attrs?: Record<string, any>;
}], void | HTMLLinkElement>;
fetch: AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
loadEntryError: AsyncHook<[{
getRemoteEntry: typeof getRemoteEntry;
origin: FederationHost;
remoteInfo: RemoteInfo;
remoteEntryExports?: RemoteEntryExports | undefined;
globalLoading: Record<string, Promise<void | RemoteEntryExports> | undefined>;
uniqueKey: string;
}], Promise<(() => Promise<RemoteEntryExports | undefined>) | undefined>>;
getModuleFactory: AsyncHook<[{
remoteEntryExports: RemoteEntryExports;
expose: string;
moduleInfo: RemoteInfo;
}], Promise<(() => Promise<Module>) | undefined>>;
}>;
bridgeHook: PluginSystem<{
beforeBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
afterBridgeRender: SyncHook<[Record<string, any>], void | Record<string, any>>;
beforeBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
afterBridgeDestroy: SyncHook<[Record<string, any>], void | Record<string, any>>;
}>;
constructor(userOptions: UserOptions);
initOptions(userOptions: UserOptions): Options;
loadShare<T>(pkgName: string, extraOptions?: {
customShareInfo?: Partial<Shared>;
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
}): Promise<false | (() => T | undefined)>;
loadShareSync<T>(pkgName: string, extraOptions?: {
customShareInfo?: Partial<Shared>;
from?: 'build' | 'runtime';
resolver?: (sharedOptions: ShareInfos[string]) => Shared;
}): () => T | never;
initializeSharing(shareScopeName?: string, extraOptions?: {
initScope?: InitScope;
from?: CallFrom;
strategy?: Shared['strategy'];
}): Array<Promise<void>>;
initRawContainer(name: string, url: string, container: RemoteEntryExports): Module;
loadRemote<T>(id: string, options?: {
loadFactory?: boolean;
from: CallFrom;
}): Promise<T | null>;
preloadRemote(preloadOptions: Array<PreloadRemoteArgs>): Promise<void>;
initShareScopeMap(scopeName: string, shareScope: ShareScopeMap[string], extraOptions?: {
hostShareScopeMap?: ShareScopeMap;
}): void;
formatOptions(globalOptions: Options, userOptions: UserOptions): Options;
registerPlugins(plugins: UserOptions['plugins']): void;
registerRemotes(remotes: Remote[], options?: {
force?: boolean;
}): void;
}
import runtimeCore from '@module-federation/runtime-core';
export * from '@module-federation/runtime-core';
export default runtimeCore;

@@ -20,28 +20,28 @@ import type * as IndexModule from './index';

private _getInstance;
get options(): import("./type").Options;
set options(value: import("./type").Options);
get hooks(): import("./utils/hooks").PluginSystem<{
beforeInit: import("./utils/hooks").SyncWaterfallHook<{
userOptions: import("./type").UserOptions;
options: import("./type").Options;
get options(): import("packages/runtime-core/dist/types.cjs").Options;
set options(value: import("packages/runtime-core/dist/types.cjs").Options);
get hooks(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
beforeInit: import("packages/runtime-core/dist/src/utils/hooks").SyncWaterfallHook<{
userOptions: import("packages/runtime-core/dist/src").UserOptions;
options: import("packages/runtime-core/dist/types.cjs").Options;
origin: IndexModule.FederationHost;
shareInfo: import("./type").ShareInfos;
shareInfo: import("packages/runtime-core/dist/types.cjs").ShareInfos;
}>;
init: import("./utils/hooks").SyncHook<[{
options: import("./type").Options;
init: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
options: import("packages/runtime-core/dist/types.cjs").Options;
origin: IndexModule.FederationHost;
}], void>;
beforeInitContainer: import("./utils/hooks").AsyncWaterfallHook<{
shareScope: import("./type").ShareScopeMap[string];
initScope: import("./type").InitScope;
remoteEntryInitOptions: import("./type").RemoteEntryInitOptions;
remoteInfo: import("./type").RemoteInfo;
beforeInitContainer: import("packages/runtime-core/dist/src/utils/hooks").AsyncWaterfallHook<{
shareScope: import("packages/runtime-core/dist/types.cjs").ShareScopeMap[string];
initScope: import("packages/runtime-core/dist/types.cjs").InitScope;
remoteEntryInitOptions: import("packages/runtime-core/dist/types.cjs").RemoteEntryInitOptions;
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
origin: IndexModule.FederationHost;
}>;
initContainer: import("./utils/hooks").AsyncWaterfallHook<{
shareScope: import("./type").ShareScopeMap[string];
initScope: import("./type").InitScope;
remoteEntryInitOptions: import("./type").RemoteEntryInitOptions;
remoteInfo: import("./type").RemoteInfo;
remoteEntryExports: import("./type").RemoteEntryExports;
initContainer: import("packages/runtime-core/dist/src/utils/hooks").AsyncWaterfallHook<{
shareScope: import("packages/runtime-core/dist/types.cjs").ShareScopeMap[string];
initScope: import("packages/runtime-core/dist/types.cjs").InitScope;
remoteEntryInitOptions: import("packages/runtime-core/dist/types.cjs").RemoteEntryInitOptions;
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
remoteEntryExports: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports;
origin: IndexModule.FederationHost;

@@ -55,8 +55,8 @@ id: string;

get moduleCache(): Map<string, IndexModule.Module>;
get snapshotHandler(): import("./plugins/snapshot/SnapshotHandler").SnapshotHandler;
get sharedHandler(): import("./shared").SharedHandler;
get remoteHandler(): import("./remote").RemoteHandler;
get shareScopeMap(): import("./type").ShareScopeMap;
get loaderHook(): import("./utils/hooks").PluginSystem<{
getModuleInfo: import("./utils/hooks").SyncHook<[{
get snapshotHandler(): import("packages/runtime-core/dist/src/plugins/snapshot/SnapshotHandler").SnapshotHandler;
get sharedHandler(): import("packages/runtime-core/dist/src/shared").SharedHandler;
get remoteHandler(): import("packages/runtime-core/dist/src/remote").RemoteHandler;
get shareScopeMap(): import("packages/runtime-core/dist/types.cjs").ShareScopeMap;
get loaderHook(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
getModuleInfo: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
target: Record<string, any>;

@@ -68,32 +68,32 @@ key: any;

}>;
createScript: import("./utils/hooks").SyncHook<[{
createScript: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
url: string;
attrs?: Record<string, any>;
}], import("packages/sdk/dist/src").CreateScriptHookReturn>;
createLink: import("./utils/hooks").SyncHook<[{
createLink: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[{
url: string;
attrs?: Record<string, any>;
}], void | HTMLLinkElement>;
fetch: import("./utils/hooks").AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
loadEntryError: import("./utils/hooks").AsyncHook<[{
fetch: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[string, RequestInit], false | void | Promise<Response>>;
loadEntryError: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[{
getRemoteEntry: typeof IndexModule.getRemoteEntry;
origin: IndexModule.FederationHost;
remoteInfo: import("./type").RemoteInfo;
remoteEntryExports?: import("./type").RemoteEntryExports | undefined;
globalLoading: Record<string, Promise<void | import("./type").RemoteEntryExports> | undefined>;
remoteInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
remoteEntryExports?: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined;
globalLoading: Record<string, Promise<void | import("packages/runtime-core/dist/types.cjs").RemoteEntryExports> | undefined>;
uniqueKey: string;
}], Promise<(() => Promise<import("./type").RemoteEntryExports | undefined>) | undefined>>;
getModuleFactory: import("./utils/hooks").AsyncHook<[{
remoteEntryExports: import("./type").RemoteEntryExports;
}], Promise<(() => Promise<import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined>) | undefined>>;
getModuleFactory: import("packages/runtime-core/dist/src/utils/hooks").AsyncHook<[{
remoteEntryExports: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports;
expose: string;
moduleInfo: import("./type").RemoteInfo;
moduleInfo: import("packages/runtime-core/dist/types.cjs").RemoteInfo;
}], Promise<(() => Promise<IndexModule.Module>) | undefined>>;
}>;
get bridgeHook(): import("./utils/hooks").PluginSystem<{
beforeBridgeRender: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
afterBridgeRender: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
beforeBridgeDestroy: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
afterBridgeDestroy: import("./utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
get bridgeHook(): import("packages/runtime-core/dist/src/utils/hooks").PluginSystem<{
beforeBridgeRender: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
afterBridgeRender: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
beforeBridgeDestroy: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
afterBridgeDestroy: import("packages/runtime-core/dist/src/utils/hooks").SyncHook<[Record<string, any>], void | Record<string, any>>;
}>;
initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("./type").Options;
initOptions(...args: Parameters<IndexModule.FederationHost['initOptions']>): import("packages/runtime-core/dist/types.cjs").Options;
loadShare<T>(...args: Parameters<IndexModule.FederationHost['loadShare']>): Promise<false | (() => T | undefined)>;

@@ -108,3 +108,3 @@ loadShareSync<T>(...args: Parameters<IndexModule.FederationHost['loadShareSync']>): () => T | never;

registerRemotes(...args: Parameters<IndexModule.FederationHost['registerRemotes']>): void;
formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>): import("./type").Options;
formatOptions(...args: Parameters<IndexModule.FederationHost['formatOptions']>): import("packages/runtime-core/dist/types.cjs").Options;
}

@@ -124,13 +124,13 @@ export interface ModuleInterface {

private _getInstance;
get remoteInfo(): import("./type").RemoteInfo;
set remoteInfo(value: import("./type").RemoteInfo);
get remoteInfo(): import("packages/runtime-core/dist/types.cjs").RemoteInfo;
set remoteInfo(value: import("packages/runtime-core/dist/types.cjs").RemoteInfo);
get inited(): boolean;
set inited(value: boolean);
get lib(): import("./type").RemoteEntryExports | undefined;
set lib(value: import("./type").RemoteEntryExports | undefined);
get lib(): import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined;
set lib(value: import("packages/runtime-core/dist/types.cjs").RemoteEntryExports | undefined);
get host(): IndexModule.FederationHost;
set host(value: IndexModule.FederationHost);
getEntry(...args: Parameters<IndexModule.Module['getEntry']>): Promise<import("./type").RemoteEntryExports>;
getEntry(...args: Parameters<IndexModule.Module['getEntry']>): Promise<import("packages/runtime-core/dist/types.cjs").RemoteEntryExports>;
get(...args: Parameters<IndexModule.Module['get']>): Promise<any>;
private wraperFactory;
}

@@ -1,32 +0,26 @@

import { resetFederationGlobalInfo, getGlobalFederationInstance, setGlobalFederationInstance, getGlobalFederationConstructor, setGlobalFederationConstructor, getInfoWithoutType, getGlobalSnapshot, getTargetSnapshotInfoByModuleInfo, getGlobalSnapshotInfoByModuleInfo, setGlobalSnapshotInfoByModuleInfo, addGlobalSnapshot, getRemoteEntryExports, registerGlobalPlugins, getGlobalHostPlugins, getPreloaded, setPreloaded, Global } from './global';
import { getRegisteredShare, getGlobalShareScope } from './utils/share';
interface IShareUtils {
getRegisteredShare: typeof getRegisteredShare;
getGlobalShareScope: typeof getGlobalShareScope;
}
interface IGlobalUtils {
Global: typeof Global;
nativeGlobal: typeof global;
resetFederationGlobalInfo: typeof resetFederationGlobalInfo;
getGlobalFederationInstance: typeof getGlobalFederationInstance;
setGlobalFederationInstance: typeof setGlobalFederationInstance;
getGlobalFederationConstructor: typeof getGlobalFederationConstructor;
setGlobalFederationConstructor: typeof setGlobalFederationConstructor;
getInfoWithoutType: typeof getInfoWithoutType;
getGlobalSnapshot: typeof getGlobalSnapshot;
getTargetSnapshotInfoByModuleInfo: typeof getTargetSnapshotInfoByModuleInfo;
getGlobalSnapshotInfoByModuleInfo: typeof getGlobalSnapshotInfoByModuleInfo;
setGlobalSnapshotInfoByModuleInfo: typeof setGlobalSnapshotInfoByModuleInfo;
addGlobalSnapshot: typeof addGlobalSnapshot;
getRemoteEntryExports: typeof getRemoteEntryExports;
registerGlobalPlugins: typeof registerGlobalPlugins;
getGlobalHostPlugins: typeof getGlobalHostPlugins;
getPreloaded: typeof getPreloaded;
setPreloaded: typeof setPreloaded;
}
import { getGlobalFederationInstance } from './utils';
export type { IGlobalUtils, IShareUtils, } from '@module-federation/runtime-core';
declare const _default: {
global: IGlobalUtils;
share: IShareUtils;
global: {
getGlobalFederationInstance: typeof getGlobalFederationInstance;
Global: typeof import("@module-federation/runtime-core").Global;
nativeGlobal: typeof global;
resetFederationGlobalInfo: typeof import("@module-federation/runtime-core").resetFederationGlobalInfo;
setGlobalFederationInstance: typeof import("@module-federation/runtime-core").setGlobalFederationInstance;
getGlobalFederationConstructor: typeof import("@module-federation/runtime-core").getGlobalFederationConstructor;
setGlobalFederationConstructor: typeof import("@module-federation/runtime-core").setGlobalFederationConstructor;
getInfoWithoutType: typeof import("@module-federation/runtime-core").getInfoWithoutType;
getGlobalSnapshot: typeof import("@module-federation/runtime-core").getGlobalSnapshot;
getTargetSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").getTargetSnapshotInfoByModuleInfo;
getGlobalSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").getGlobalSnapshotInfoByModuleInfo;
setGlobalSnapshotInfoByModuleInfo: typeof import("packages/runtime-core/dist/src/global").setGlobalSnapshotInfoByModuleInfo;
addGlobalSnapshot: typeof import("@module-federation/runtime-core").addGlobalSnapshot;
getRemoteEntryExports: typeof import("packages/runtime-core/dist/src/global").getRemoteEntryExports;
registerGlobalPlugins: typeof import("@module-federation/runtime-core").registerGlobalPlugins;
getGlobalHostPlugins: typeof import("packages/runtime-core/dist/src/global").getGlobalHostPlugins;
getPreloaded: typeof import("packages/runtime-core/dist/src/global").getPreloaded;
setPreloaded: typeof import("packages/runtime-core/dist/src/global").setPreloaded;
};
share: import("@module-federation/runtime-core").IShareUtils;
};
export default _default;
export type { IGlobalUtils, IShareUtils };

@@ -1,10 +0,4 @@

import { FederationHost } from './core';
import { UserOptions, FederationRuntimePlugin } from './type';
export { FederationHost } from './core';
export { registerGlobalPlugins } from './global';
export { getRemoteEntry, getRemoteInfo } from './utils';
export { loadScript, loadScriptNode } from '@module-federation/sdk';
export { Module } from './module';
export type { Federation } from './global';
export type { FederationRuntimePlugin };
import { FederationHost, type UserOptions } from '@module-federation/runtime-core';
export { loadScript, loadScriptNode, Module, getRemoteEntry, getRemoteInfo, registerGlobalPlugins, type FederationRuntimePlugin, type Federation, } from '@module-federation/runtime-core';
export { FederationHost };
export declare function init(options: UserOptions): FederationHost;

@@ -11,0 +5,0 @@ export declare function loadRemote<T>(...args: Parameters<FederationHost['loadRemote']>): Promise<T | null>;

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

export * from './type';
export * from '@module-federation/runtime-core/types';
'use strict';
var types = require('@module-federation/runtime-core/types');
Object.keys(types).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
enumerable: true,
get: function () { return types[k]; }
});
});
{
"name": "@module-federation/runtime",
"version": "0.0.0-next-20241230025944",
"version": "0.0.0-next-20241230030326",
"author": "zhouxiao <codingzx@gmail.com>",

@@ -37,2 +37,7 @@ "main": "./dist/index.cjs.js",

},
"./core": {
"types": "./dist/core.cjs.d.ts",
"import": "./dist/core.esm.mjs",
"require": "./dist/core.cjs.js"
},
"./embedded": {

@@ -55,2 +60,5 @@ "types": "./dist/embedded.cjs.d.ts",

"./dist/types.cjs.d.ts"
],
"core": [
"./dist/core.cjs.d.ts"
]

@@ -60,5 +68,6 @@ }

"dependencies": {
"@module-federation/sdk": "0.0.0-next-20241230025944",
"@module-federation/error-codes": "0.0.0-next-20241230025944"
"@module-federation/sdk": "0.0.0-next-20241230030326",
"@module-federation/error-codes": "0.0.0-next-20241230030326",
"@module-federation/runtime-core": "0.0.0-next-20241230030326"
}
}

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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