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

@module-federation/webpack-bundler-runtime

Package Overview
Dependencies
Maintainers
8
Versions
669
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/webpack-bundler-runtime - npm Package Compare versions

Comparing version 0.0.0-canary-1702278361811 to 0.0.0-canary-1702367824043

src/initContainerEntry.d.ts

25

index.cjs.js

@@ -321,2 +321,24 @@ 'use strict';

function initContainerEntry(options) {
var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey;
if (!webpackRequire.S) return;
if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
var name = shareScopeKey || "default";
webpackRequire.federation.instance.initOptions({
name: webpackRequire.federation.initOptions.name,
remotes: []
});
webpackRequire.federation.instance.initShareScopeMap(name, shareScope);
var prevShareScope = webpackRequire.g.__FEDERATION__.__SHARE__["default"];
if (prevShareScope) {
webpackRequire.federation.instance.initShareScopeMap(name, prevShareScope);
}
webpackRequire.S[name] = shareScope;
if (webpackRequire.federation.attachShareScopeMap) {
webpackRequire.federation.attachShareScopeMap(webpackRequire);
}
// @ts-ignore
return webpackRequire.I(name, initScope);
}
var federation = {

@@ -331,3 +353,4 @@ runtime: runtime__namespace,

S: {},
installInitialConsumes: installInitialConsumes
installInitialConsumes: installInitialConsumes,
initContainerEntry: initContainerEntry
},

@@ -334,0 +357,0 @@ attachShareScopeMap: attachShareScopeMap,

@@ -299,2 +299,24 @@ import * as runtime from '@module-federation/runtime';

function initContainerEntry(options) {
var webpackRequire = options.webpackRequire, shareScope = options.shareScope, initScope = options.initScope, shareScopeKey = options.shareScopeKey;
if (!webpackRequire.S) return;
if (!webpackRequire.federation || !webpackRequire.federation.instance || !webpackRequire.federation.initOptions) return;
var name = shareScopeKey || "default";
webpackRequire.federation.instance.initOptions({
name: webpackRequire.federation.initOptions.name,
remotes: []
});
webpackRequire.federation.instance.initShareScopeMap(name, shareScope);
var prevShareScope = webpackRequire.g.__FEDERATION__.__SHARE__["default"];
if (prevShareScope) {
webpackRequire.federation.instance.initShareScopeMap(name, prevShareScope);
}
webpackRequire.S[name] = shareScope;
if (webpackRequire.federation.attachShareScopeMap) {
webpackRequire.federation.attachShareScopeMap(webpackRequire);
}
// @ts-ignore
return webpackRequire.I(name, initScope);
}
var federation = {

@@ -309,3 +331,4 @@ runtime: runtime,

S: {},
installInitialConsumes: installInitialConsumes
installInitialConsumes: installInitialConsumes,
initContainerEntry: initContainerEntry
},

@@ -312,0 +335,0 @@ attachShareScopeMap: attachShareScopeMap,

4

package.json
{
"public": true,
"name": "@module-federation/webpack-bundler-runtime",
"version": "0.0.0-canary-1702278361811",
"version": "0.0.0-canary-1702367824043",
"license": "MIT",

@@ -19,5 +19,5 @@ "description": "Module Federation Runtime for webpack",

"dependencies": {
"@module-federation/runtime": "0.0.0-canary-1702278361811"
"@module-federation/runtime": "0.0.0-canary-1702367824043"
},
"peerDependencies": {}
}

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

import { WebpackRequire } from './types';
type InitToken = Record<string, Record<string, any>>;
interface Options {
shareScopeName: string;
webpackRequire: WebpackRequire;
initPromises: Record<string, Promise<boolean> | boolean>;
initTokens: InitToken;
initScope: InitToken[];
}
export declare function initializeSharing({ shareScopeName, webpackRequire, initPromises, initTokens, initScope, }: Options): Promise<boolean> | boolean | void;
export {};
import { InitializeSharingOptions } from './types';
export declare function initializeSharing({ shareScopeName, webpackRequire, initPromises, initTokens, initScope, }: InitializeSharingOptions): Promise<boolean> | boolean | void;
import * as runtime from '@module-federation/runtime';
import { initializeSharing } from './initializeSharing';
import { attachShareScopeMap } from './attachShareScopeMap';
import { initContainerEntry } from './initContainerEntry';
type ExcludeUndefined<T> = T extends undefined ? never : T;

@@ -12,2 +13,11 @@ type NonUndefined<T = Shared> = ExcludeUndefined<T>;

type InferredModule = InferModule<ModuleCache>;
export type ShareScopeMap = runtime.FederationHost['shareScopeMap'];
type InitToken = Record<string, Record<string, any>>;
export interface InitializeSharingOptions {
shareScopeName: string;
webpackRequire: WebpackRequire;
initPromises: Record<string, Promise<boolean> | boolean>;
initTokens: InitToken;
initScope: InitToken[];
}
export type RemoteEntryExports = NonUndefined<InferredModule['remoteEntryExports']>;

@@ -31,3 +41,3 @@ type ExtractInitParameters<T> = T extends {

c: Record<string, any>;
I: typeof initializeSharing;
I: (scopeName: string, initScope?: InitializeSharingOptions['initScope']) => ReturnType<typeof initializeSharing>;
S?: InferredGlobalShareScope;

@@ -79,2 +89,8 @@ federation: Federation;

}
export interface InitContainerEntryOptions {
shareScope: ShareScopeMap[string];
shareScopeKey: string;
webpackRequire: WebpackRequire;
initScope?: InitializeSharingOptions['initScope'];
}
export interface Federation {

@@ -91,2 +107,3 @@ runtime?: typeof runtime;

installInitialConsumes: (options: InstallInitialConsumesOptions) => any;
initContainerEntry: typeof initContainerEntry;
};

@@ -93,0 +110,0 @@ bundlerRuntimeOptions: {

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