@module-federation/webpack-bundler-runtime
Advanced tools
Comparing version 0.0.0-canary-1702278361811 to 0.0.0-canary-1702367824043
@@ -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, |
{ | ||
"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: { |
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
37145
14
805
+ Added@module-federation/runtime@0.0.0-canary-1702367824043(transitive)
+ Added@module-federation/sdk@0.0.0-canary-1702367824043(transitive)
- Removed@module-federation/runtime@0.0.0-canary-1702278361811(transitive)
- Removed@module-federation/sdk@0.0.0-canary-1702278361811(transitive)
Updated@module-federation/runtime@0.0.0-canary-1702367824043