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

@module-federation/enhanced

Package Overview
Dependencies
Maintainers
8
Versions
664
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@module-federation/enhanced - npm Package Compare versions

Comparing version 0.0.0-next-20240119073703 to 0.0.0-next-20240119085716

dist/src/declarations/plugins/container/AsyncDependenciesBlock.d.ts

3

dist/package.json
{
"name": "@module-federation/enhanced",
"version": "0.0.8",
"version": "0.0.9",
"main": "./src/index.js",

@@ -19,2 +19,3 @@ "types": "./dist/src/index.d.ts",

"require": "./dist/src/index.js",
"import": "./dist/src/index.js",
"types": "./dist/index.d.ts"

@@ -21,0 +22,0 @@ }

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

import type { Compiler, Chunk, Module } from 'webpack';
import type { Compiler, Compilation, Chunk, Module } from 'webpack';
export interface Options {

@@ -12,2 +12,3 @@ eager?: RegExp | ((module: Module) => boolean);

private _collectRuntimeChunks;
getChunkByName(compilation: Compilation, dependOn: string[]): (string | number | undefined)[];
private _handleRenderStartup;

@@ -14,0 +15,0 @@ private _getChunkRuntime;

@@ -30,2 +30,12 @@ "use strict";

}
getChunkByName(compilation, dependOn) {
const byname = [];
for (const name of dependOn) {
const chunk = compilation.namedChunks.get(name);
if (chunk) {
byname.push(chunk.id || chunk.name);
}
}
return byname;
}
_handleRenderStartup(compiler, compilation) {

@@ -56,5 +66,5 @@ compiler.webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(compilation).renderStartup.tap('AsyncEntryStartupPlugin', (source, _renderContext, upperContext) => {

const initialChunks = Array.from(upperContext.chunk.getAllInitialChunks()).map((chunk) => chunk.id);
const chunksToRef = entryOptions?.dependOn
? [...entryOptions.dependOn, ...initialChunks]
: [...initialChunks];
const dependOn = entryOptions?.dependOn || [];
const dependOnIDs = this.getChunkByName(compilation, dependOn);
const chunksToRef = [...dependOnIDs, ...initialChunks];
remotes = this._getRemotes(compiler.webpack.RuntimeGlobals, requirements, Boolean(hasRemoteModules), chunksToRef, remotes);

@@ -101,3 +111,3 @@ shared = this._getShared(compiler.webpack.RuntimeGlobals, requirements, Boolean(consumeShares), chunksToRef, shared);

for (const chunkId of chunksToRef) {
if (chunkId !== null) {
if (chunkId !== null && chunkId !== undefined) {
remotesParts.push(` __webpack_require__.f.remotes(${JSON.stringify(chunkId)}, promiseTrack);`);

@@ -122,3 +132,3 @@ }

for (const chunkId of chunksToRef) {
if (chunkId !== null) {
if (chunkId !== null && chunkId !== undefined) {
sharedParts.push(` __webpack_require__.f.consumes(${JSON.stringify(chunkId)}, promiseTrack);`);

@@ -125,0 +135,0 @@ }

@@ -1,22 +0,24 @@

import { ExposeOptions } from './ContainerEntryModule';
declare const Dependency: typeof import("webpack").Dependency;
export = ContainerEntryDependency;
/** @typedef {import("./ContainerEntryModule").ExposeOptions} ExposeOptions */
declare class ContainerEntryDependency extends Dependency {
name: string;
exposes: [string, ExposeOptions][];
shareScope: string;
injectRuntimeEntry: string;
/**
* @param {string} name entry name
* @param {[string, ExposeOptions][]} exposes list of exposed modules
* @param {string} shareScope name of the share scope
* @param {string[]} injectRuntimeEntry the path of injectRuntime file.
*/
constructor(name: string, exposes: [string, ExposeOptions][], shareScope: string, injectRuntimeEntry: string);
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier(): string | null;
get type(): string;
get category(): string;
/**
* @param {string} name entry name
* @param {[string, ExposeOptions][]} exposes list of exposed modules
* @param {string} shareScope name of the share scope
* @param {string[]} runtimePlugins Runtime plugin file paths or package name.
*/
constructor(
name: string,
exposes: [string, ExposeOptions][],
shareScope: string,
runtimePlugins: string[],
);
name: string;
exposes: [string, import('./ContainerEntryModule').ExposeOptions][];
shareScope: string;
runtimePlugins: string[];
}
export default ContainerEntryDependency;
declare namespace ContainerEntryDependency {
export { ExposeOptions };
}
type ExposeOptions = import('./ContainerEntryModule').ExposeOptions;

@@ -1,86 +0,75 @@

import type { Compilation } from 'webpack';
import type { LibIdentOptions, NeedBuildContext, RequestShortener, ObjectDeserializerContext, ObjectSerializerContext, WebpackOptions, InputFileSystem, ResolverWithOptions } from 'webpack/lib/Module';
import type WebpackError from 'webpack/lib/WebpackError';
declare const Module: typeof import("webpack").Module;
import Module = require('webpack/lib/Module');
export type ExposeOptions = {
/**
* requests to exposed modules (last one is exported)
*/
import: string[];
/**
* custom chunk name for the exposed module
*/
name: string;
/**
* requests to exposed modules (last one is exported)
*/
import: string[];
/**
* custom chunk name for the exposed module
*/
name: string;
};
type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
type WebpackOptions = any;
type ChunkGraph = import('webpack/lib/ChunkGraph');
type ChunkGroup = import('webpack/lib/ChunkGroup');
type Compilation = import('webpack/lib/Compilation');
type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
type RequestShortener = import('webpack/lib/RequestShortener');
type ResolverWithOptions =
import('webpack/lib/ResolverFactory').ResolverWithOptions;
type WebpackError = import('webpack/lib/WebpackError');
type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
type Hash = import('webpack/lib/util/Hash');
type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
type ContainerEntryDependency = typeof import('./ContainerEntryDependency');
declare class ContainerEntryModule extends Module {
private _name;
private _exposes;
private _shareScope;
private _injectRuntimeEntry;
/**
* @param {string} name container entry name
* @param {[string, ExposeOptions][]} exposes list of exposed modules
* @param {string} shareScope name of the share scope
*/
constructor(name: string, exposes: [string, ExposeOptions][], shareScope: string, injectRuntimeEntry: string);
/**
* @param {ObjectDeserializerContext} context context
* @returns {ContainerEntryModule} deserialized container entry module
*/
static deserialize(context: ObjectDeserializerContext): ContainerEntryModule;
/**
* @returns {Set<string>} types available (do not mutate)
*/
getSourceTypes(): Set<string>;
/**
* @returns {string} a unique identifier of the module
*/
identifier(): string;
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener: RequestShortener): string;
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options: LibIdentOptions): string | null;
/**
* @param {NeedBuildContext} context context info
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context: NeedBuildContext, callback: (arg0: (WebpackError | null) | undefined, arg1: boolean | undefined) => void): void;
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {function(WebpackError): void} callback callback function
* @returns {void}
*/
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError) => void): void;
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }: {
moduleGraph: any;
chunkGraph: any;
runtimeTemplate: any;
}): {
sources: Map<any, any>;
runtimeRequirements: Set<"__webpack_exports__" | "__webpack_require__.d" | "__webpack_require__.o">;
};
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type?: string): number;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
/**
* @param {ObjectDeserializerContext} context context
* @returns {ContainerEntryModule} deserialized container entry module
*/
static deserialize(context: ObjectDeserializerContext): ContainerEntryModule;
/**
* @param {string} name container entry name
* @param {[string, ExposeOptions][]} exposes list of exposed modules
* @param {string} shareScope name of the share scope
* @param {string[]} runtimePlugins Runtime plugin file paths or package name.
*/
constructor(
name: string,
exposes: [string, ExposeOptions][],
shareScope: string,
);
_name: string;
_exposes: [string, ExposeOptions][];
_shareScope: string;
runtimePlugins: string[];
}
declare namespace ContainerEntryModule {
export {
WebpackOptions,
ChunkGraph,
ChunkGroup,
Compilation,
CodeGenerationContext,
CodeGenerationResult,
LibIdentOptions,
NeedBuildContext,
RequestShortener,
ResolverWithOptions,
WebpackError,
ObjectDeserializerContext,
ObjectSerializerContext,
Hash,
InputFileSystem,
ContainerEntryDependency,
ExposeOptions,
};
}
export default ContainerEntryModule;

@@ -1,11 +0,15 @@

declare const ModuleFactory: typeof import("webpack/lib/ModuleFactory");
import type { ModuleFactoryCreateData, ModuleFactoryResult } from 'webpack/lib/ModuleFactory';
export default class ContainerEntryModuleFactory extends ModuleFactory {
/**
* @param {ModuleFactoryCreateData} data data object
* @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
* @returns {void}
*/
create(data: ModuleFactoryCreateData, callback: (error: Error | null, result: ModuleFactoryResult) => void): void;
export = ContainerEntryModuleFactory;
declare class ContainerEntryModuleFactory extends ModuleFactory {}
declare namespace ContainerEntryModuleFactory {
export {
ModuleFactoryCreateData,
ModuleFactoryResult,
ContainerEntryDependency,
};
}
export {};
import ModuleFactory = require('webpack/lib/ModuleFactory');
type ModuleFactoryCreateData =
import('webpack/lib/ModuleFactory').ModuleFactoryCreateData;
type ModuleFactoryResult =
import('webpack/lib/ModuleFactory').ModuleFactoryResult;
type ContainerEntryDependency = import('./ContainerEntryDependency');

@@ -1,26 +0,19 @@

declare const dependencies: typeof import("webpack").dependencies;
import type { ObjectDeserializerContext, ObjectSerializerContext } from 'webpack/lib/dependencies/ModuleDependency';
declare class ContainerExposedDependency extends dependencies.ModuleDependency {
exposedName: string;
request: string;
/**
* @param {string} exposedName public name
* @param {string} request request to module
*/
constructor(exposedName: string, request: string);
get type(): string;
get category(): string;
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier(): string | null;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context: ObjectDeserializerContext): void;
export = ContainerExposedDependency;
/** @typedef {import("webpack/lib/serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
/** @typedef {import("webpack/lib/serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
declare class ContainerExposedDependency extends ModuleDependency {
/**
* @param {string} exposedName public name
* @param {string} request request to module
*/
constructor(exposedName: string, request: string);
exposedName: string;
}
export default ContainerExposedDependency;
declare namespace ContainerExposedDependency {
export { ObjectDeserializerContext, ObjectSerializerContext };
}
import ModuleDependency = require('webpack/lib/dependencies/ModuleDependency');
type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;

@@ -1,13 +0,34 @@

import type { Compiler } from 'webpack';
import type { ContainerPluginOptions } from '../../declarations/plugins/container/ContainerPlugin';
export = ContainerPlugin;
declare class ContainerPlugin {
_options: ContainerPluginOptions;
/**
* @param {ContainerPluginOptions} options options
*/
constructor(options: ContainerPluginOptions);
name: string;
_options: {
name: string;
/**
* @param {ContainerPluginOptions} options options
*/
constructor(options: ContainerPluginOptions);
static patchChunkSplit(compiler: Compiler, name: string): void;
apply(compiler: Compiler): void;
shareScope: string;
library: import('../../declarations/plugins/container/ContainerPlugin').LibraryOptions;
runtime: import('../../declarations/plugins/container/ContainerPlugin').EntryRuntime;
filename: string;
exposes: [
string,
{
import: string[];
name: any;
},
][];
};
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
}
export default ContainerPlugin;
declare namespace ContainerPlugin {
export { ContainerPluginOptions, Compiler };
}
type Compiler = import('webpack/lib/Compiler');
type ContainerPluginOptions =
import('../../declarations/plugins/container/ContainerPlugin').ContainerPluginOptions;

@@ -1,14 +0,29 @@

import type { Compiler } from 'webpack';
import { ContainerReferencePluginOptions } from '../../declarations/plugins/container/ContainerReferencePlugin';
export = ContainerReferencePlugin;
declare class ContainerReferencePlugin {
private _remoteType;
private _remotes;
constructor(options: ContainerReferencePluginOptions);
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
/**
* @param {ContainerReferencePluginOptions} options options
*/
constructor(options: ContainerReferencePluginOptions);
_remoteType: import('../../declarations/plugins/container/ContainerReferencePlugin').ExternalsType;
_remotes: [
string,
{
external: string[];
shareScope: string;
},
][];
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
}
export default ContainerReferencePlugin;
declare namespace ContainerReferencePlugin {
export { ContainerReferencePluginOptions, RemotesConfig, Compiler };
}
type Compiler = import('webpack/lib/Compiler');
type ContainerReferencePluginOptions =
import('../../declarations/plugins/container/ContainerReferencePlugin').ContainerReferencePluginOptions;
type RemotesConfig =
import('../../declarations/plugins/container/ContainerReferencePlugin').RemotesConfig;

@@ -1,21 +0,15 @@

import type { ObjectDeserializerContext, ObjectSerializerContext } from 'webpack/lib/Dependency';
declare const Dependency: typeof import("webpack").Dependency;
declare class FallbackDependency extends Dependency {
requests: string[];
/**
* @param {string[]} requests requests
*/
constructor(requests: string[]);
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier(): string | null;
get type(): string;
get category(): string;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
static deserialize(context: ObjectDeserializerContext): FallbackDependency;
export class FallbackDependency extends Dependency {
/**
* @param {ObjectDeserializerContext} context context
* @returns {FallbackDependency} deserialize fallback dependency
*/
static deserialize(context: ObjectDeserializerContext): FallbackDependency;
/**
* @param {string[]} requests requests
*/
constructor(requests: string[]);
requests: string[];
}
export default FallbackDependency;
declare namespace FallbackDependency {
export { ObjectDeserializerContext, ObjectSerializerContext };
}

@@ -1,10 +0,3 @@

declare const dependencies: typeof import("webpack").dependencies;
declare class FallbackItemDependency extends dependencies.ModuleDependency {
/**
* @param {string} request request
*/
constructor(request: string);
get type(): string;
get category(): string;
}
export default FallbackItemDependency;
export = FallbackItemDependency;
declare class FallbackItemDependency extends ModuleDependency {}
import ModuleDependency = require('webpack/lib/dependencies/ModuleDependency');

@@ -1,72 +0,54 @@

import type { ChunkGraph, Chunk } from 'webpack';
import type { RequestShortener, LibIdentOptions, CodeGenerationContext, CodeGenerationResult, NeedBuildContext, WebpackError, ResolverWithOptions, InputFileSystem, Compilation, WebpackOptions, ObjectDeserializerContext, ObjectSerializerContext } from 'webpack/lib/Module';
declare const Module: typeof import("webpack").Module;
export = FallbackModule;
declare class FallbackModule extends Module {
requests: string[];
private _identifier;
/**
* @param {string[]} requests list of requests to choose one
*/
constructor(requests: string[]);
/**
* @returns {string} a unique identifier of the module
*/
identifier(): string;
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener: RequestShortener): string;
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options: LibIdentOptions): string | null;
/**
* @param {Chunk} chunk the chunk which condition should be checked
* @param {Compilation} compilation the compilation
* @returns {boolean} true, if the chunk is ok for the module
*/
chunkCondition(chunk: Chunk, { chunkGraph }: {
chunkGraph: ChunkGraph;
}): boolean;
/**
* @param {NeedBuildContext} context context info
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context: NeedBuildContext, callback: (error: WebpackError | null, result?: boolean) => void): void;
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {function(WebpackError=): void} callback callback function
* @returns {void}
*/
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (error?: WebpackError) => void): void;
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type?: string): number;
/**
* @returns {Set<string>} types available (do not mutate)
*/
getSourceTypes(): Set<string>;
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph, }: CodeGenerationContext): CodeGenerationResult;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
/**
* @param {ObjectDeserializerContext} context context
* @returns {FallbackModule} deserialized fallback module
*/
static deserialize(context: ObjectDeserializerContext): FallbackModule;
/**
* @param {ObjectDeserializerContext} context context
* @returns {FallbackModule} deserialized fallback module
*/
static deserialize(context: ObjectDeserializerContext): FallbackModule;
/**
* @param {string[]} requests list of requests to choose one
*/
constructor(requests: string[]);
requests: string[];
_identifier: string;
}
export default FallbackModule;
declare namespace FallbackModule {
export {
WebpackOptions,
Chunk,
ChunkGraph,
ChunkGroup,
Compilation,
CodeGenerationContext,
CodeGenerationResult,
LibIdentOptions,
NeedBuildContext,
RequestShortener,
ResolverWithOptions,
WebpackError,
ObjectDeserializerContext,
ObjectSerializerContext,
Hash,
InputFileSystem,
};
}
import Module = require('webpack/lib/Module');
type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
type WebpackOptions = any;
type Chunk = import('webpack/lib/Chunk');
type ChunkGraph = import('webpack/lib/ChunkGraph');
type ChunkGroup = import('webpack/lib/ChunkGroup');
type Compilation = import('webpack/lib/Compilation');
type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
type RequestShortener = import('webpack/lib/RequestShortener');
type ResolverWithOptions =
import('webpack/lib/ResolverFactory').ResolverWithOptions;
type WebpackError = import('webpack/lib/WebpackError');
type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
type Hash = import('webpack/lib/util/Hash');
type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;

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

import type { ModuleFactoryCreateData, ModuleFactoryResult } from 'webpack/lib/ModuleFactory';
declare const ModuleFactory: typeof import("webpack/lib/ModuleFactory");
export default class FallbackModuleFactory extends ModuleFactory {
/**
* @param {ModuleFactoryCreateData} data data object
* @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
* @returns {void}
*/
create(data: ModuleFactoryCreateData, callback: (error: Error | null, result?: ModuleFactoryResult) => void): void;
export = FallbackModuleFactory;
declare class FallbackModuleFactory extends ModuleFactory {}
declare namespace FallbackModuleFactory {
export { ModuleFactoryCreateData, ModuleFactoryResult, FallbackDependency };
}
export {};
import ModuleFactory = require('webpack/lib/ModuleFactory');
type ModuleFactoryCreateData =
import('webpack/lib/ModuleFactory').ModuleFactoryCreateData;
type ModuleFactoryResult =
import('webpack/lib/ModuleFactory').ModuleFactoryResult;
type FallbackDependency = import('./FallbackDependency');

@@ -1,16 +0,23 @@

import type { Compiler, WebpackPluginInstance } from 'webpack';
import type { ModuleFederationPluginOptions } from './ModuleFederationPluginTypes';
declare class ModuleFederationPlugin implements WebpackPluginInstance {
private _options;
/**
* @param {ModuleFederationPluginOptions} options options
*/
constructor(options: ModuleFederationPluginOptions);
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
export = ModuleFederationPlugin;
declare class ModuleFederationPlugin {
/**
* @param {ModuleFederationPluginOptions} options options
*/
constructor(options: any);
name: string;
_options: any;
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
}
export default ModuleFederationPlugin;
declare namespace ModuleFederationPlugin {
export { ExternalsType, ModuleFederationPluginOptions, Shared, Compiler };
}
type Compiler = import('webpack/lib/Compiler');
type ExternalsType = any;
type ModuleFederationPluginOptions =
import('../../declarations/plugins/container/ModuleFederationPlugin').ModuleFederationPluginOptions;
type Shared = any;

@@ -11,3 +11,2 @@ /*

const normalize_webpack_path_1 = require("@module-federation/sdk/normalize-webpack-path");
const ExternalsType_check_js_1 = __importDefault(require("webpack/schemas/plugins/container/ExternalsType.check.js"));
const SharePlugin_1 = __importDefault(require("../sharing/SharePlugin"));

@@ -19,2 +18,3 @@ const ContainerPlugin_1 = __importDefault(require("./ContainerPlugin"));

const FederationRuntimePlugin_1 = __importDefault(require("./runtime/FederationRuntimePlugin"));
const isValidExternalsType = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/schemas/plugins/container/ExternalsType.check.js'));
const createSchemaValidation = require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/lib/util/create-schema-validation'));

@@ -46,3 +46,3 @@ const validate = createSchemaValidation(

const remoteType = options.remoteType ||
(options.library && (0, ExternalsType_check_js_1.default)(options.library.type)
(options.library && isValidExternalsType(options.library.type)
? options.library.type

@@ -49,0 +49,0 @@ : 'script');

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

export type ContainerOptionsFormat<T> = (string | Record<string, string | string[] | T>)[] | Record<string, string | string[] | T>;
export type ContainerOptionsFormat<T> =
| (string | Record<string, string | string[] | T>)[]
| Record<string, string | string[] | T>;
/**

@@ -10,3 +12,7 @@ * @template T

*/
declare const parseOptions: <T, R>(options: ContainerOptionsFormat<T>, normalizeSimple: (item: string | string[], name: string) => R, normalizeOptions: (item: T, name: string) => R) => [string, R][];
export function parseOptions<T, R>(
options: ContainerOptionsFormat<T>,
normalizeSimple: (arg0: string | string[], arg1: string) => R,
normalizeOptions: (arg0: T, arg1: string) => R,
): [string, R][];
/**

@@ -18,3 +24,5 @@ * @template T

*/
declare const scope: <T>(scope: string, options: ContainerOptionsFormat<T>) => Record<string, string | string[] | T>;
export { parseOptions, scope };
export function scope<T>(
scope: string,
options: ContainerOptionsFormat<T>,
): Record<string, string | string[] | T>;

@@ -1,75 +0,90 @@

import type { Compilation, WebpackOptionsNormalized } from 'webpack';
import type { CodeGenerationContext, CodeGenerationResult, LibIdentOptions, NeedBuildContext, WebpackError } from 'webpack/lib/Module';
import type { ResolverWithOptions } from 'webpack/lib/ResolverFactory';
import type { InputFileSystem } from 'webpack/lib/FileSystemInfo';
import type { RequestShortener } from 'webpack/lib/RuntimeModule';
import type { ObjectDeserializerContext } from 'webpack/lib/serialization/ObjectMiddleware';
declare const Module: typeof import("webpack").Module;
export default RemoteModule;
declare class RemoteModule extends Module {
private _identifier;
request: string;
externalRequests: string[];
internalRequest: string;
shareScope: string;
/**
* @param {string} request request string
* @param {string[]} externalRequests list of external requests to containers
* @param {string} internalRequest name of exposed module in container
* @param {string} shareScope the used share scope name
*/
constructor(request: string, externalRequests: string[], internalRequest: string, shareScope: string);
/**
* @returns {string} a unique identifier of the module
*/
identifier(): string;
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener: RequestShortener): string;
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options: LibIdentOptions): string | null;
/**
* @param {NeedBuildContext} context context info
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context: NeedBuildContext, callback: (err: WebpackError | null, needsRebuild?: boolean) => void): void;
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {function(WebpackError=): void} callback callback function
* @returns {void}
*/
build(options: WebpackOptionsNormalized, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (err?: WebpackError | undefined) => void): void;
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type?: string): number;
/**
* @returns {Set<string>} types available (do not mutate)
*/
getSourceTypes(): Set<string>;
/**
* @returns {string | null} absolute path which should be used for condition matching (usually the resource path)
*/
nameForCondition(): string | null;
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration(context: CodeGenerationContext): CodeGenerationResult;
serialize(context: any): void;
/**
* @param {ObjectDeserializerContext} context context
* @returns {RemoteModule} deserialized module
*/
static deserialize(context: ObjectDeserializerContext): RemoteModule;
/**
* @param {ObjectDeserializerContext} context context
* @returns {RemoteModule} deserialized module
*/
static deserialize(context: ObjectDeserializerContext): RemoteModule;
/**
* @param {string} request request string
* @param {string[]} externalRequests list of external requests to containers
* @param {string} internalRequest name of exposed module in container
* @param {string} shareScope the used share scope name
*/
constructor(
request: string,
externalRequests: string[],
internalRequest: string,
shareScope: string,
);
request: string;
externalRequests: string[];
internalRequest: string;
shareScope: string;
_identifier: string;
/**
* @param {NeedBuildContext} context context info
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(
context: NeedBuildContext,
callback: (
arg0: (WebpackError | null) | undefined,
arg1: boolean | undefined,
) => void,
): void;
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {function(WebpackError=): void} callback callback function
* @returns {void}webpack
*/
build(
options: WebpackOptions,
compilation: Compilation,
resolver: ResolverWithOptions,
fs: InputFileSystem,
callback: (arg0: WebpackError | undefined) => void,
): void;
}
export default RemoteModule;
declare namespace RemoteModule {
export {
WebpackOptionsohunkGraph,
ChunkGroup,
Compilation,
CodeGenerationContext,
CodeGenerationResult,
LibIdentOptions,
NeedBuildContext,
RequestShortener,
ResolverWithOptions,
WebpackError,
ObjectDeserializerContext,
ObjectSerializerContext,
Hash,
InputFileSystem,
};
}
import Module = require('webpack/lib/Module');
type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
type WebpackError = import('webpack/lib/WebpackError');
type WebpackOptions =
import('webpack/declarations/WebpackOptions').WebpackOptionsNormalized;
type Compilation = import('webpack/lib/Compilation');
type ResolverWithOptions =
import('webpack/lib/ResolverFactory').ResolverWithOptions;
type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
type ChunkGraph = import('webpack/lib/ChunkGraph');
type ChunkGroup = import('webpack/lib/ChunkGroup');
type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
type RequestShortener = import('webpack/lib/RequestShortener');
type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
type Hash = import('webpack/lib/util/Hash');

@@ -1,9 +0,12 @@

declare const RuntimeModule: typeof import("webpack").RuntimeModule;
export default RemoteRuntimeModule;
/** @typedef {import("webpack/lib/Chunk")} Chunk */
/** @typedef {import("./RemoteModule")} RemoteModule */
declare class RemoteRuntimeModule extends RuntimeModule {
constructor();
/**
* @returns {string | null} runtime code
*/
generate(): string | null;
constructor();
}
export default RemoteRuntimeModule;
declare namespace RemoteRuntimeModule {
export { Chunk, RemoteModule };
}
import RuntimeModule = require('webpack/lib/RuntimeModule');
type Chunk = import('webpack/lib/Chunk');
type RemoteModule = import('./RemoteModule');

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

declare const dependencies: typeof import("webpack").dependencies;
declare class RemoteToExternalDependency extends dependencies.ModuleDependency {
/**
* @param {string} request request
*/
constructor(request: string);
get type(): string;
get category(): string;
}
export default RemoteToExternalDependency;
declare class RemoteToExternalDependency extends ModuleDependency {}
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';

@@ -141,7 +141,16 @@ "use strict";

}
if (Array.isArray(compiler.options.resolve.alias)) {
return;
}
compiler.options.resolve.alias = {
...compiler.options.resolve.alias,
'@module-federation/runtime$': runtimePath,
'@module-federation/runtime-tools$': this.options?.implementation || RuntimeToolsPath,
};
if (!compiler.options.resolve.alias['@module-federation/runtime$']) {
compiler.options.resolve.alias['@module-federation/runtime$'] =
runtimePath;
}
if (!compiler.options.resolve.alias['@module-federation/runtime-tools$']) {
compiler.options.resolve.alias['@module-federation/runtime-tools$'] =
this.options?.implementation || RuntimeToolsPath;
}
}

@@ -148,0 +157,0 @@ apply(compiler) {

@@ -1,10 +0,3 @@

declare const dependencies: typeof import("webpack").dependencies;
declare class ConsumeSharedFallbackDependency extends dependencies.ModuleDependency {
/**
* @param {string} request the request
*/
constructor(request: string);
get type(): string;
get category(): string;
}
export default ConsumeSharedFallbackDependency;
export = ConsumeSharedFallbackDependency;
declare class ConsumeSharedFallbackDependency extends ModuleDependency {}
import ModuleDependency = require('webpack/lib/dependencies/ModuleDependency');

@@ -1,106 +0,99 @@

import type { WebpackOptions, Compilation, UpdateHashContext, CodeGenerationContext, CodeGenerationResult, LibIdentOptions, NeedBuildContext, RequestShortener, ResolverWithOptions, WebpackError, ObjectDeserializerContext, ObjectSerializerContext, Hash, InputFileSystem } from 'webpack/lib/Module';
declare const Module: typeof import("webpack").Module;
export type ConsumeOptions = {
/**
* fallback request
*/
import?: string | undefined;
/**
* resolved fallback request
*/
importResolved?: string | undefined;
/**
* global share key
*/
shareKey: string;
/**
* share scope
*/
shareScope: string;
/**
* version requirement
*/
requiredVersion: import('webpack/lib/util/semver').SemVerRange | false | undefined;
/**
* package name to determine required version automatically
*/
packageName: string;
/**
* don't use shared version even if version isn't valid
*/
strictVersion: boolean;
/**
* use single global version
*/
singleton: boolean;
/**
* include the fallback module in a sync way
*/
eager: boolean;
};
export = ConsumeSharedModule;
declare class ConsumeSharedModule extends Module {
options: ConsumeOptions;
/**
* @param {string} context context
* @param {ConsumeOptions} options consume options
*/
constructor(context: string, options: ConsumeOptions);
/**
* @returns {string} a unique identifier of the module
*/
identifier(): string;
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener: RequestShortener): string;
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options: LibIdentOptions): string | null;
/**
* @param {NeedBuildContext} context context info
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context: NeedBuildContext, callback: (error?: WebpackError | null, needsRebuild?: boolean) => void): void;
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {function(WebpackError=): void} callback callback function
* @returns {void}
*/
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (error?: WebpackError) => void): void;
/**
* @returns {Set<string>} types available (do not mutate)
*/
getSourceTypes(): Set<string>;
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type?: string): number;
/**
* @param {Hash} hash the hash used to track dependencies
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash: Hash, context: UpdateHashContext): void;
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration({ chunkGraph, moduleGraph, runtimeTemplate, }: CodeGenerationContext): CodeGenerationResult;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
/**
* @param {ObjectDeserializerContext} context context
*/
deserialize(context: ObjectDeserializerContext): void;
/**
* @param {string} context context
* @param {ConsumeOptions} options consume options
*/
constructor(context: string, options: ConsumeOptions);
options: ConsumeOptions;
/**
* @param {Hash} hash the hash used to track dependencies
* @param {UpdateHashContext} context context
* @returns {void}
*/
updateHash(hash: Hash, context: UpdateHashContext): void;
}
export default ConsumeSharedModule;
declare namespace ConsumeSharedModule {
export {
WebpackOptions,
ChunkGraph,
ChunkGroup,
Compilation,
UpdateHashContext,
CodeGenerationContext,
CodeGenerationResult,
LibIdentOptions,
NeedBuildContext,
RequestShortener,
ResolverWithOptions,
WebpackError,
ObjectDeserializerContext,
ObjectSerializerContext,
Hash,
InputFileSystem,
SemVerRange,
ConsumeOptions,
};
}
import Module = require('webpack/lib/Module');
type ConsumeOptions = {
/**
* fallback request
*/
import?: string | undefined;
/**
* resolved fallback request
*/
importResolved?: string | undefined;
/**
* global share key
*/
shareKey: string;
/**
* share scope
*/
shareScope: string;
/**
* version requirement
*/
requiredVersion:
| import('webpack/lib/util/semver').SemVerRange
| false
| undefined;
/**
* package name to determine required version automatically
*/
packageName: string;
/**
* don't use shared version even if version isn't valid
*/
strictVersion: boolean;
/**
* use single global version
*/
singleton: boolean;
/**
* include the fallback module in a sync way
*/
eager: boolean;
};
type Hash = import('webpack/lib/util/Hash');
type UpdateHashContext = import('webpack/lib/Dependency').UpdateHashContext;
type WebpackOptions = any;
type ChunkGraph = import('webpack/lib/ChunkGraph');
type ChunkGroup = import('webpack/lib/ChunkGroup');
type Compilation = import('webpack/lib/Compilation');
type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
type RequestShortener = import('webpack/lib/RequestShortener');
type ResolverWithOptions =
import('webpack/lib/ResolverFactory').ResolverWithOptions;
type WebpackError = import('webpack/lib/WebpackError');
type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
type SemVerRange = import('webpack/lib/util/semver').SemVerRange;

@@ -1,8 +0,30 @@

import type { Compiler } from 'webpack';
import { ConsumeSharedPluginOptions } from '../../declarations/plugins/sharing/ConsumeSharedPlugin';
export = ConsumeSharedPlugin;
declare class ConsumeSharedPlugin {
private _consumes;
constructor(options: ConsumeSharedPluginOptions);
apply(compiler: Compiler): void;
/**
* @param {ConsumeSharedPluginOptions} options options
*/
constructor(options: any);
/** @type {[string, ConsumeOptions][]} */
_consumes: [string, ConsumeOptions][];
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
}
export default ConsumeSharedPlugin;
declare namespace ConsumeSharedPlugin {
export {
ConsumeSharedPluginOptions,
ConsumesConfig,
Compiler,
ResolveOptionsWithDependencyType,
ConsumeOptions,
};
}
type ConsumeOptions = import('./ConsumeSharedModule').ConsumeOptions;
type Compiler = import('webpack/lib/Compiler');
type ConsumeSharedPluginOptions = any;
type ConsumesConfig = any;
type ResolveOptionsWithDependencyType =
import('webpack/lib/ResolverFactory').ResolveOptionsWithDependencyType;

@@ -28,3 +28,3 @@ /*

//eslint-disable-next-line
require('webpack/schemas/plugins/sharing/ConsumeSharedPlugin.check.js'), () => require('webpack/schemas/plugins/sharing/ConsumeSharedPlugin.json'), {
require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/schemas/plugins/sharing/ConsumeSharedPlugin.check.js')), () => require((0, normalize_webpack_path_1.normalizeWebpackPath)('webpack/schemas/plugins/sharing/ConsumeSharedPlugin.json')), {
name: 'Consume Shared Plugin',

@@ -31,0 +31,0 @@ baseDataPath: 'options',

@@ -1,13 +0,31 @@

declare const RuntimeModule: typeof import("webpack").RuntimeModule;
export = ConsumeSharedRuntimeModule;
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("webpack/lib/Chunk")} Chunk */
/** @typedef {import("webpack/lib/ChunkGraph")} ChunkGraph */
/** @typedef {import("webpack/lib/Compilation")} Compilation */
/** @typedef {import("webpack/lib/Module")} Module */
/** @typedef {import("./ConsumeSharedModule")} ConsumeSharedModule */
declare class ConsumeSharedRuntimeModule extends RuntimeModule {
private _runtimeRequirements;
/**
* @param {ReadonlySet<string>} runtimeRequirements runtime requirements
*/
constructor(runtimeRequirements: ReadonlySet<string>);
/**
* @returns {string | null} runtime code
*/
generate(): string | null;
/**
* @param {ReadonlySet<string>} runtimeRequirements runtime requirements
*/
constructor(runtimeRequirements: ReadonlySet<string>);
_runtimeRequirements: ReadonlySet<string>;
}
export default ConsumeSharedRuntimeModule;
declare namespace ConsumeSharedRuntimeModule {
export {
Source,
Chunk,
ChunkGraph,
Compilation,
Module,
ConsumeSharedModule,
};
}
import RuntimeModule = require('webpack/lib/RuntimeModule');
type Source = import('webpack-sources').Source;
type Chunk = import('webpack/lib/Chunk');
type ChunkGraph = import('webpack/lib/ChunkGraph');
type Compilation = import('webpack/lib/Compilation');
type Module = import('webpack/lib/Module');
type ConsumeSharedModule = import('./ConsumeSharedModule');

@@ -1,11 +0,3 @@

declare const dependencies: typeof import("webpack").dependencies;
declare class ProvideForSharedDependency extends dependencies.ModuleDependency {
/**
*
* @param request request string
*/
constructor(request: string);
get type(): string;
get category(): string;
}
export default ProvideForSharedDependency;
export = ProvideForSharedDependency;
declare class ProvideForSharedDependency extends ModuleDependency {}
import ModuleDependency = require('webpack/lib/dependencies/ModuleDependency');

@@ -1,38 +0,36 @@

declare const Dependency: typeof import("webpack").Dependency;
import { ObjectDeserializerContext, ObjectSerializerContext } from '../../declarations/plugins/container/Dependency';
declare class ProvideSharedDependency extends Dependency {
shareScope: string;
name: string;
version: string | false;
request: string;
eager: boolean;
requiredVersion: string | false;
strictVersion: boolean;
singleton: boolean;
/**
* @param {string} shareScope share scope
* @param {string} name module name
* @param {string | false} version version
* @param {string} request request
* @param {boolean} eager true, if this is an eager dependency
* @param {boolean} requiredVersion version requirement
* @param {boolean} strictVersion don't use shared version even if version isn't valid
* @param {boolean} singleton use single global version
*/
constructor(shareScope: string, name: string, version: string | false, request: string, eager: boolean, requiredVersion: string | false, strictVersion: boolean, singleton: boolean);
get type(): string;
/**
* @returns {string | null} an identifier to merge equal requests
*/
getResourceIdentifier(): string | null;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
/**
* @param {ObjectDeserializerContext} context context
* @returns {ProvideSharedDependency} deserialize fallback dependency
*/
static deserialize(context: ObjectDeserializerContext): ProvideSharedDependency;
export class ProvideSharedDependency extends Dependency {
/**
* @param {ObjectDeserializerContext} context context
* @returns {ProvideSharedDependency} deserialize fallback dependency
*/
static deserialize(
context: ObjectDeserializerContext,
): ProvideSharedDependency;
/**
* @param {string} shareScope share scope
* @param {string} name module name
* @param {string | false} version version
* @param {string} request request
* @param {boolean} eager true, if this is an eager dependency
*/
constructor(
shareScope: string,
name: string,
version: string | false,
request: string,
eager: boolean,
);
shareScope: string;
name: string;
version: string | false;
request: string;
eager: boolean;
}
export default ProvideSharedDependency;
declare namespace ProvideSharedDependency {
export { shareScope, ObjectDeserializerContext, ObjectSerializerContext };
}
export type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
declare let shareScope: any;
export type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;

@@ -1,85 +0,67 @@

import type { Compilation } from 'webpack';
import type WebpackError from 'webpack/lib/WebpackError';
import type { CodeGenerationContext, CodeGenerationResult, LibIdentOptions, NeedBuildContext, RequestShortener, ResolverWithOptions, ObjectDeserializerContext, ObjectSerializerContext } from 'webpack/lib/Module';
import type { InputFileSystem } from 'webpack/lib/util/fs';
import type { WebpackOptionsNormalized as WebpackOptions } from 'webpack/declarations/WebpackOptions';
declare const Module: typeof import("webpack").Module;
/**
* @class
* @extends {Module}
*/
export = ProvideSharedModule;
declare class ProvideSharedModule extends Module {
private _shareScope;
private _name;
private _version;
private _request;
private _eager;
private _requiredVersion;
private _strictVersion;
private _singleton;
/**
* @constructor
* @param {string} shareScope shared scope name
* @param {string} name shared key
* @param {string | false} version version
* @param {string} request request to the provided module
* @param {boolean} eager include the module in sync way
* @param {boolean} requiredVersion version requirement
* @param {boolean} strictVersion don't use shared version even if version isn't valid
* @param {boolean} singleton use single global version
*/
constructor(shareScope: string, name: string, version: string | false, request: string, eager: boolean, requiredVersion: string | false, strictVersion: boolean, singleton: boolean);
/**
* @returns {string} a unique identifier of the module
*/
identifier(): string;
/**
* @param {RequestShortener} requestShortener the request shortener
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener: RequestShortener): string;
/**
* @param {LibIdentOptions} options options
* @returns {string | null} an identifier for library inclusion
*/
libIdent(options: LibIdentOptions): string | null;
/**
* @param {NeedBuildContext} context context info
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
* @returns {void}
*/
needBuild(context: NeedBuildContext, callback: (error?: WebpackError | null, needsRebuild?: boolean) => void): void;
/**
* @param {WebpackOptions} options webpack options
* @param {Compilation} compilation the compilation
* @param {ResolverWithOptions} resolver the resolver
* @param {InputFileSystem} fs the file system
* @param {function(WebpackError=): void} callback callback function
* @returns {void}
*/
build(options: WebpackOptions, compilation: Compilation, resolver: ResolverWithOptions, fs: InputFileSystem, callback: (error?: WebpackError) => void): void;
/**
* @param {string=} type the source type for which the size should be estimated
* @returns {number} the estimated size of the module (must be non-zero)
*/
size(type?: string): number;
/**
* @returns {Set<string>} types available (do not mutate)
*/
getSourceTypes(): Set<string>;
/**
* @param {CodeGenerationContext} context context for code generation
* @returns {CodeGenerationResult} result
*/
codeGeneration({ runtimeTemplate, moduleGraph, chunkGraph, }: CodeGenerationContext): CodeGenerationResult;
/**
* @param {ObjectSerializerContext} context context
*/
serialize(context: ObjectSerializerContext): void;
/**
* @param {ObjectDeserializerContext} context context
* @returns {ProvideSharedModule} deserialize fallback dependency
*/
static deserialize(context: ObjectDeserializerContext): ProvideSharedModule;
/**
* @param {ObjectDeserializerContext} context context
* @returns {ProvideSharedModule} deserialize fallback dependency
*/
static deserialize(context: ObjectDeserializerContext): ProvideSharedModule;
/**
* @param {string} shareScope shared scope name
* @param {string} name shared key
* @param {string | false} version version
* @param {string} request request to the provided module
* @param {boolean} eager include the module in sync way
*/
constructor(
shareScope: string,
name: string,
version: string | false,
request: string,
eager: boolean,
);
_shareScope: string;
_name: string;
_version: string | false;
_request: string;
_eager: boolean;
}
export default ProvideSharedModule;
declare namespace ProvideSharedModule {
export {
WebpackOptions,
Chunk,
ChunkGraph,
ChunkGroup,
Compilation,
CodeGenerationContext,
CodeGenerationResult,
LibIdentOptions,
NeedBuildContext,
RequestShortener,
ResolverWithOptions,
WebpackError,
ObjectDeserializerContext,
ObjectSerializerContext,
Hash,
InputFileSystem,
};
}
import Module = require('webpack/lib/Module');
type ObjectDeserializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectDeserializerContext;
type WebpackOptions = any;
type Chunk = import('webpack/lib/Chunk');
type ChunkGraph = import('webpack/lib/ChunkGraph');
type ChunkGroup = import('webpack/lib/ChunkGroup');
type Compilation = import('webpack/lib/Compilation');
type CodeGenerationContext = import('webpack/lib/Module').CodeGenerationContext;
type CodeGenerationResult = import('webpack/lib/Module').CodeGenerationResult;
type LibIdentOptions = import('webpack/lib/Module').LibIdentOptions;
type NeedBuildContext = import('webpack/lib/Module').NeedBuildContext;
type RequestShortener = import('webpack/lib/RequestShortener');
type ResolverWithOptions =
import('webpack/lib/ResolverFactory').ResolverWithOptions;
type WebpackError = import('webpack/lib/WebpackError');
type ObjectSerializerContext =
import('webpack/lib/serialization/ObjectMiddleware').ObjectSerializerContext;
type Hash = import('webpack/lib/util/Hash');
type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;

@@ -1,11 +0,18 @@

import type { ModuleFactoryCreateData, ModuleFactoryResult } from 'webpack/lib/ModuleFactory';
declare const ModuleFactory: typeof import("webpack/lib/ModuleFactory");
declare class ProvideSharedModuleFactory extends ModuleFactory {
/**
* @param {ModuleFactoryCreateData} data data object
* @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback
* @returns {void}
*/
create(data: ModuleFactoryCreateData, callback: (error: Error | null, result?: ModuleFactoryResult) => void): void;
export = ProvideSharedModuleFactory;
/** @typedef {import("webpack/lib/ModuleFactory").ModuleFactoryCreateData} ModuleFactoryCreateData */
/** @typedef {import("webpack/lib/ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
/** @typedef {import("./ProvideSharedDependency")} ProvideSharedDependency */
declare class ProvideSharedModuleFactory extends ModuleFactory {}
declare namespace ProvideSharedModuleFactory {
export {
ModuleFactoryCreateData,
ModuleFactoryResult,
ProvideSharedDependency,
};
}
export default ProvideSharedModuleFactory;
import ModuleFactory = require('webpack/lib/ModuleFactory');
type ModuleFactoryCreateData =
import('webpack/lib/ModuleFactory').ModuleFactoryCreateData;
type ModuleFactoryResult =
import('webpack/lib/ModuleFactory').ModuleFactoryResult;
type ProvideSharedDependency = import('./ProvideSharedDependency');

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

import type { Compiler } from 'webpack';
import type { ProvideSharedPluginOptions, ProvidesConfig } from '../../declarations/plugins/sharing/ProvideSharedPlugin';
export type ProvideOptions = ProvidesConfig;
export type ResolvedProvideMap = Map<string, {
config: ProvideOptions;
version: string | undefined | false;
}>;
export = ProvideSharedPlugin;
/**

@@ -17,14 +11,38 @@ * @typedef {Object} ProvideOptions

declare class ProvideSharedPlugin {
private _provides;
/**
* @param {ProvideSharedPluginOptions} options options
*/
constructor(options: ProvideSharedPluginOptions);
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
/**
* @param {ProvideSharedPluginOptions} options options
*/
constructor(options: any);
_provides: [string, ProvideOptions][];
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
}
export default ProvideSharedPlugin;
declare namespace ProvideSharedPlugin {
export {
ProvideSharedPluginOptions,
Compilation,
Compiler,
ProvideOptions,
ResolvedProvideMap,
};
}
type ProvideOptions = {
shareKey: string;
shareScope: string;
version: string | undefined | false;
eager: boolean;
};
type Compiler = import('webpack/lib/Compiler');
type ProvideSharedPluginOptions = any;
type Compilation = import('webpack/lib/Compilation');
type ResolvedProvideMap = Map<
string,
{
config: ProvideOptions;
version: string | undefined | false;
}
>;

@@ -1,8 +0,12 @@

import type { Compilation } from 'webpack';
interface MatchedConfigs<T> {
resolved: Map<string, T>;
unresolved: Map<string, T>;
prefixed: Map<string, T>;
}
export declare function resolveMatchedConfigs<T>(compilation: Compilation, configs: [string, T][]): Promise<MatchedConfigs<T>>;
export {};
export function resolveMatchedConfigs<T>(
compilation: Compilation,
configs: [string, T][],
): Promise<MatchedConfigs<T>>;
export type Compilation = import('webpack/lib/Compilation');
export type ResolveOptionsWithDependencyType =
import('webpack/lib/ResolverFactory').ResolveOptionsWithDependencyType;
export type MatchedConfigs<T> = {
resolved: Map<string, T>;
unresolved: Map<string, T>;
prefixed: Map<string, T>;
};

@@ -1,15 +0,41 @@

import type { Compiler } from 'webpack';
import type { SharePluginOptions } from '../../declarations/plugins/sharing/SharePlugin';
export = SharePlugin;
/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumeSharedPluginOptions} ConsumeSharedPluginOptions */
/** @typedef {import("../../declarations/plugins/sharing/ConsumeSharedPlugin").ConsumesConfig} ConsumesConfig */
/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvideSharedPluginOptions} ProvideSharedPluginOptions */
/** @typedef {import("../../declarations/plugins/sharing/ProvideSharedPlugin").ProvidesConfig} ProvidesConfig */
/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharePluginOptions} SharePluginOptions */
/** @typedef {import("../../declarations/plugins/sharing/SharePlugin").SharedConfig} SharedConfig */
/** @typedef {import("webpack/lib/Compiler")} Compiler */
declare class SharePlugin {
private _shareScope;
private _consumes;
private _provides;
constructor(options: SharePluginOptions);
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
/**
* @param {SharePluginOptions} options options
*/
constructor(options: any);
_shareScope: any;
_consumes: Record<string, any>[];
_provides: Record<string, any>[];
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler: Compiler): void;
}
export default SharePlugin;
declare namespace SharePlugin {
export {
ConsumeSharedPluginOptions,
ConsumesConfig,
ProvideSharedPluginOptions,
ProvidesConfig,
SharePluginOptions,
SharedConfig,
Compiler,
};
}
type Compiler = import('webpack/lib/Compiler');
type ConsumeSharedPluginOptions = any;
type ConsumesConfig = any;
type ProvideSharedPluginOptions = any;
type ProvidesConfig = any;
type SharePluginOptions = any;
type SharedConfig = any;

@@ -1,9 +0,14 @@

declare const RuntimeModule: typeof import("webpack").RuntimeModule;
export = ShareRuntimeModule;
/** @typedef {import("webpack/lib/Chunk")} Chunk */
/** @typedef {import("webpack/lib/ChunkGraph")} ChunkGraph */
/** @typedef {import("webpack/lib/Compilation")} Compilation */
declare class ShareRuntimeModule extends RuntimeModule {
constructor();
/**
* @returns {string | null} runtime code
*/
generate(): string | null;
constructor();
}
export default ShareRuntimeModule;
declare namespace ShareRuntimeModule {
export { Chunk, ChunkGraph, Compilation };
}
import RuntimeModule = require('webpack/lib/RuntimeModule');
type Chunk = import('webpack/lib/Chunk');
type ChunkGraph = import('webpack/lib/ChunkGraph');
type Compilation = import('webpack/lib/Compilation');

@@ -1,3 +0,6 @@

import type { ConsumeOptions } from 'webpack/lib/sharing/ConsumeSharedModule';
import type { InputFileSystem } from 'webpack/lib/util/fs';
export function getRequiredVersionFromDescriptionFile(
data: any,
packageName: any,
): string;
export type InputFileSystem = import('webpack/lib/util/fs').InputFileSystem;
/**

@@ -7,4 +10,3 @@ * @param {string} str maybe required version

*/
declare function isRequiredVersion(str: string): boolean;
export { isRequiredVersion };
export function isRequiredVersion(str: string): boolean;
/**

@@ -15,4 +17,3 @@ * @see https://docs.npmjs.com/cli/v7/configuring-npm/package-json#urls-as-dependencies

*/
declare function normalizeVersion(versionDesc: string): string;
export { normalizeVersion };
export function normalizeVersion(versionDesc: string): string;
/**

@@ -25,24 +26,15 @@ *

*/
declare const getDescriptionFile: (fs: InputFileSystem, directory: string, descriptionFiles: string[], callback: (err: Error | null, data?: {
data: object;
path: string;
} | undefined) => void) => void;
export { getDescriptionFile };
/**
* Get required version from description file
* @param {Record<string, any>} data - The data object
* @param {string} packageName - The package name
* @returns {string | undefined} The normalized version
*/
export declare function getRequiredVersionFromDescriptionFile(data: Record<string, any>, packageName: string): string | undefined | void;
export declare function normalizeConsumeShareOptions(consumeOptions: ConsumeOptions): {
shareConfig: {
fixedDependencies: boolean;
requiredVersion: false | import("../../../../../webpack/lib/util/semver").SemVerRange;
strictVersion: boolean;
singleton: boolean;
eager: boolean;
};
shareScope: string;
shareKey: string;
};
export function getDescriptionFile(
fs: InputFileSystem,
directory: string,
descriptionFiles: string[],
callback: (
arg0: (Error | null) | undefined,
arg1:
| {
data: object;
path: string;
}
| undefined,
) => void,
): void;

@@ -1,7 +0,9 @@

declare function validate48(data: any, { instancePath, parentData, parentDataProperty, rootData }?: {
instancePath?: string | undefined;
parentData: any;
parentDataProperty: any;
rootData?: any;
}): boolean;
export default validate48;
/*
* This file was automatically generated.
* DO NOT MODIFY BY HAND.
* Run `yarn special-lint-fix` to update
*/
declare const check: (
options: import('../../../declarations/plugins/container/ModuleFederationPlugin').ModuleFederationPluginOptions,
) => boolean;
export = check;
{
"name": "@module-federation/enhanced",
"version": "0.0.0-next-20240119073703",
"version": "0.0.0-next-20240119085716",
"main": "./dist/src/index.js",

@@ -19,2 +19,3 @@ "types": "./dist/src/index.d.ts",

"require": "./dist/src/index.js",
"import": "./dist/src/index.js",
"types": "./dist/index.d.ts"

@@ -31,8 +32,8 @@ }

"devDependencies": {
"@module-federation/webpack-bundler-runtime": "0.0.0-next-20240119073703"
"@module-federation/webpack-bundler-runtime": "0.0.0-next-20240119085716"
},
"dependencies": {
"@module-federation/sdk": "0.0.0-next-20240119073703",
"@module-federation/runtime-tools": "0.0.0-next-20240119073703"
"@module-federation/sdk": "0.0.0-next-20240119085716",
"@module-federation/runtime-tools": "0.0.0-next-20240119085716"
}
}

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

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