mirror of https://github.com/webpack/webpack.git
validate options for container-related plugins
expose options types via declarations hide private properties in plugins move container-related schemas into container folder
This commit is contained in:
parent
ba46b87c4b
commit
5ad346ec98
|
|
@ -1,28 +0,0 @@
|
|||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
|
||||
export interface ContainerReferencePlugin {
|
||||
/**
|
||||
* A list of requests that should be overridable by the host container.
|
||||
*/
|
||||
overrides?:
|
||||
| any[]
|
||||
| {
|
||||
[k: string]: any;
|
||||
};
|
||||
/**
|
||||
* The libraryTarget of a remote build.
|
||||
*/
|
||||
remoteType?: string;
|
||||
/**
|
||||
* A list of remote scopes or namespaces that reference federated Webpack instances.
|
||||
*/
|
||||
remotes?:
|
||||
| any[]
|
||||
| {
|
||||
[k: string]: any;
|
||||
};
|
||||
}
|
||||
|
|
@ -4,6 +4,15 @@
|
|||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
||||
*/
|
||||
export type Exposes =
|
||||
| Exposes[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Exposes;
|
||||
};
|
||||
/**
|
||||
* Add a comment in the UMD wrapper.
|
||||
*/
|
||||
|
|
@ -41,19 +50,20 @@ export type LibraryType =
|
|||
*/
|
||||
export type UmdNamedDefine = boolean;
|
||||
/**
|
||||
* Array of strings.
|
||||
* Modules in this container that should be able to be overridden by the host. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
export type ArrayOfStringValues = string[];
|
||||
export type Overridables =
|
||||
| Overridables[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Overridables;
|
||||
};
|
||||
|
||||
export interface ContainerPluginOptions {
|
||||
/**
|
||||
* A map of modules you wish to expose.
|
||||
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
||||
*/
|
||||
exposes?:
|
||||
| any[]
|
||||
| {
|
||||
[k: string]: any;
|
||||
};
|
||||
exposes: Exposes;
|
||||
/**
|
||||
* The filename for this container relative path inside the `output.path` directory.
|
||||
*/
|
||||
|
|
@ -67,13 +77,9 @@ export interface ContainerPluginOptions {
|
|||
*/
|
||||
name: string;
|
||||
/**
|
||||
* An object for requests to override from host to this container.
|
||||
* Modules in this container that should be able to be overridden by the host. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
overridables?:
|
||||
| any[]
|
||||
| {
|
||||
[k: string]: any;
|
||||
};
|
||||
overridables?: Overridables;
|
||||
}
|
||||
/**
|
||||
* Options for library.
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modules in this container that should override overridable modules in the remote container. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
export type Overrides =
|
||||
| Overrides[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Overrides;
|
||||
};
|
||||
/**
|
||||
* Type of library.
|
||||
*/
|
||||
export type LibraryType =
|
||||
| "var"
|
||||
| "module"
|
||||
| "assign"
|
||||
| "this"
|
||||
| "window"
|
||||
| "self"
|
||||
| "global"
|
||||
| "commonjs"
|
||||
| "commonjs2"
|
||||
| "commonjs-module"
|
||||
| "amd"
|
||||
| "amd-require"
|
||||
| "umd"
|
||||
| "umd2"
|
||||
| "jsonp"
|
||||
| "system";
|
||||
/**
|
||||
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
||||
*/
|
||||
export type Remotes =
|
||||
| Remotes[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Remotes;
|
||||
};
|
||||
|
||||
export interface ContainerReferencePluginOptions {
|
||||
/**
|
||||
* Modules in this container that should override overridable modules in the remote container. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
overrides?: Overrides;
|
||||
/**
|
||||
* The external type of the remote containers.
|
||||
*/
|
||||
remoteType: LibraryType;
|
||||
/**
|
||||
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
||||
*/
|
||||
remotes: Remotes;
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
||||
*/
|
||||
export type Exposes =
|
||||
| Exposes[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Exposes;
|
||||
};
|
||||
/**
|
||||
* Add a comment in the UMD wrapper.
|
||||
*/
|
||||
export type AuxiliaryComment = string | LibraryCustomUmdCommentObject;
|
||||
/**
|
||||
* Specify which export should be exposed as library.
|
||||
*/
|
||||
export type LibraryExport = string[] | string;
|
||||
/**
|
||||
* The name of the library (some types allow unnamed libraries too).
|
||||
*/
|
||||
export type LibraryName = string[] | string | LibraryCustomUmdObject;
|
||||
/**
|
||||
* Type of library.
|
||||
*/
|
||||
export type LibraryType =
|
||||
| "var"
|
||||
| "module"
|
||||
| "assign"
|
||||
| "this"
|
||||
| "window"
|
||||
| "self"
|
||||
| "global"
|
||||
| "commonjs"
|
||||
| "commonjs2"
|
||||
| "commonjs-module"
|
||||
| "amd"
|
||||
| "amd-require"
|
||||
| "umd"
|
||||
| "umd2"
|
||||
| "jsonp"
|
||||
| "system";
|
||||
/**
|
||||
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
|
||||
*/
|
||||
export type UmdNamedDefine = boolean;
|
||||
/**
|
||||
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
||||
*/
|
||||
export type Remotes =
|
||||
| Remotes[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Remotes;
|
||||
};
|
||||
/**
|
||||
* Modules that should be shared with remotes and/or host. When provided, property name is used as shared key, otherwise shared key is automatically inferred from request.
|
||||
*/
|
||||
export type Shared =
|
||||
| Shared[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: Shared;
|
||||
};
|
||||
|
||||
export interface ModuleFederationPluginOptions {
|
||||
/**
|
||||
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
||||
*/
|
||||
exposes?: Exposes;
|
||||
/**
|
||||
* The filename of the container as relative path inside the `output.path` directory.
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* Options for library.
|
||||
*/
|
||||
library?: LibraryOptions;
|
||||
/**
|
||||
* The name of the container.
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* The external type of the remote containers.
|
||||
*/
|
||||
remoteType?: LibraryType;
|
||||
/**
|
||||
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
||||
*/
|
||||
remotes?: Remotes;
|
||||
/**
|
||||
* Modules that should be shared with remotes and/or host. When provided, property name is used as shared key, otherwise shared key is automatically inferred from request.
|
||||
*/
|
||||
shared?: Shared;
|
||||
}
|
||||
/**
|
||||
* Options for library.
|
||||
*/
|
||||
export interface LibraryOptions {
|
||||
/**
|
||||
* Add a comment in the UMD wrapper.
|
||||
*/
|
||||
auxiliaryComment?: AuxiliaryComment;
|
||||
/**
|
||||
* Specify which export should be exposed as library.
|
||||
*/
|
||||
export?: LibraryExport;
|
||||
/**
|
||||
* The name of the library (some types allow unnamed libraries too).
|
||||
*/
|
||||
name?: LibraryName;
|
||||
/**
|
||||
* Type of library.
|
||||
*/
|
||||
type: LibraryType;
|
||||
/**
|
||||
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
|
||||
*/
|
||||
umdNamedDefine?: UmdNamedDefine;
|
||||
}
|
||||
/**
|
||||
* Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.
|
||||
*/
|
||||
export interface LibraryCustomUmdCommentObject {
|
||||
/**
|
||||
* Set comment for `amd` section in UMD.
|
||||
*/
|
||||
amd?: string;
|
||||
/**
|
||||
* Set comment for `commonjs` (exports) section in UMD.
|
||||
*/
|
||||
commonjs?: string;
|
||||
/**
|
||||
* Set comment for `commonjs2` (module.exports) section in UMD.
|
||||
*/
|
||||
commonjs2?: string;
|
||||
/**
|
||||
* Set comment for `root` (global variable) section in UMD.
|
||||
*/
|
||||
root?: string;
|
||||
}
|
||||
/**
|
||||
* Description object for all UMD variants of the library name.
|
||||
*/
|
||||
export interface LibraryCustomUmdObject {
|
||||
/**
|
||||
* Name of the exposed AMD library in the UMD.
|
||||
*/
|
||||
amd?: string;
|
||||
/**
|
||||
* Name of the exposed commonjs export in the UMD.
|
||||
*/
|
||||
commonjs?: string;
|
||||
/**
|
||||
* Name of the property exposed globally by a UMD library.
|
||||
*/
|
||||
root?: string[] | string;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
/**
|
||||
* This file was automatically generated.
|
||||
* DO NOT MODIFY BY HAND.
|
||||
* Run `yarn special-lint-fix` to update
|
||||
*/
|
||||
|
||||
/**
|
||||
* Modules that should be able to be overridden. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
export type OverridablesPluginOptions =
|
||||
| OverridablesPluginOptions[]
|
||||
| string
|
||||
| {
|
||||
[k: string]: OverridablesPluginOptions;
|
||||
};
|
||||
|
|
@ -6,14 +6,14 @@
|
|||
"use strict";
|
||||
|
||||
const validateOptions = require("schema-utils");
|
||||
const schema = require("../../schemas/plugins/ContainerPlugin.json");
|
||||
const schema = require("../../schemas/plugins/container/ContainerPlugin.json");
|
||||
const ContainerEntryDependency = require("./ContainerEntryDependency");
|
||||
const ContainerEntryModuleFactory = require("./ContainerEntryModuleFactory");
|
||||
const ContainerExposedDependency = require("./ContainerExposedDependency");
|
||||
const OverridablesPlugin = require("./OverridablesPlugin");
|
||||
const parseOptions = require("./parseOptions");
|
||||
|
||||
/** @typedef {import("../../declarations/plugins/ContainerPlugin").ContainerPluginOptions} ContainerPluginOptions */
|
||||
/** @typedef {import("../../declarations/plugins/container/ContainerPlugin").ContainerPluginOptions} ContainerPluginOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
|
||||
const PLUGIN_NAME = "ContainerPlugin";
|
||||
|
|
@ -23,9 +23,9 @@ module.exports = class ContainerPlugin {
|
|||
* @param {ContainerPluginOptions} options options
|
||||
*/
|
||||
constructor(options) {
|
||||
validateOptions(schema, options, { name: PLUGIN_NAME });
|
||||
validateOptions(schema, options, { name: "Container Plugin" });
|
||||
|
||||
this.options = {
|
||||
this._options = {
|
||||
overridables: options.overridables,
|
||||
name: options.name,
|
||||
library: options.library || {
|
||||
|
|
@ -38,15 +38,18 @@ module.exports = class ContainerPlugin {
|
|||
}
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compiler) {
|
||||
const { name, exposes, filename, library, overridables } = this.options;
|
||||
const { name, exposes, filename, library, overridables } = this._options;
|
||||
|
||||
compiler.options.output.enabledLibraryTypes.push(library.type);
|
||||
|
||||
new OverridablesPlugin(overridables).apply(compiler);
|
||||
if (overridables) {
|
||||
new OverridablesPlugin(overridables).apply(compiler);
|
||||
}
|
||||
|
||||
compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
|
||||
const dep = new ContainerEntryDependency(exposes);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
"use strict";
|
||||
|
||||
const validateOptions = require("schema-utils");
|
||||
const schema = require("../../schemas/plugins/ContainerReferencePlugin.json");
|
||||
const schema = require("../../schemas/plugins/container/ContainerReferencePlugin.json");
|
||||
const ExternalsPlugin = require("../ExternalsPlugin");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const RemoteModule = require("./RemoteModule");
|
||||
|
|
@ -17,33 +17,35 @@ const RemoteToExternalDependency = require("./RemoteToExternalDependency");
|
|||
const RemoteToOverrideDependency = require("./RemoteToOverrideDependency");
|
||||
const parseOptions = require("./parseOptions");
|
||||
|
||||
/** @typedef {import("../../declarations/plugins/container/ContainerReferencePlugin").ContainerReferencePluginOptions} ContainerReferencePluginOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
|
||||
module.exports = class ContainerReferencePlugin {
|
||||
/**
|
||||
* @param {ContainerReferencePluginOptions} options options
|
||||
*/
|
||||
constructor(options) {
|
||||
this.remoteType = options.remoteType || "global";
|
||||
this.remotes = parseOptions(options.remotes || []);
|
||||
this.overrides = parseOptions(options.overrides || {});
|
||||
validateOptions(schema, options, { name: "Container Reference Plugin" });
|
||||
|
||||
validateOptions(schema, options, {
|
||||
name: "Container Reference Plugin"
|
||||
});
|
||||
// TODO: Apply some validation around what was passed in.
|
||||
this._remoteType = options.remoteType;
|
||||
this._remotes = parseOptions(options.remotes || []);
|
||||
this._overrides = parseOptions(options.overrides || {});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Compiler} compiler webpack compiler
|
||||
* Apply the plugin
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compiler) {
|
||||
const { remotes, remoteType } = this;
|
||||
const { _remotes: remotes, _remoteType: remoteType } = this;
|
||||
|
||||
const remoteExternals = {};
|
||||
for (const [key, value] of remotes) {
|
||||
remoteExternals[`container-reference/${key}`] = value;
|
||||
}
|
||||
|
||||
new ExternalsPlugin(remoteType || "var", remoteExternals).apply(compiler);
|
||||
new ExternalsPlugin(remoteType, remoteExternals).apply(compiler);
|
||||
|
||||
compiler.hooks.compilation.tap(
|
||||
"ContainerReferencePlugin",
|
||||
|
|
@ -71,7 +73,7 @@ module.exports = class ContainerReferencePlugin {
|
|||
if (data.request.startsWith(`${key}/`)) {
|
||||
return new RemoteModule(
|
||||
data.request,
|
||||
this.overrides,
|
||||
this._overrides,
|
||||
`container-reference/${key}`,
|
||||
data.request.slice(key.length + 1)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,23 +5,31 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const validateOptions = require("schema-utils");
|
||||
const schema = require("../../schemas/plugins/container/ModuleFederationPlugin.json");
|
||||
const ContainerPlugin = require("./ContainerPlugin");
|
||||
const ContainerReferencePlugin = require("./ContainerReferencePlugin");
|
||||
|
||||
/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ModuleFederationPluginOptions} ModuleFederationPluginOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
|
||||
class ModuleFederationPlugin {
|
||||
/**
|
||||
* @param {ModuleFederationPluginOptions} options options
|
||||
*/
|
||||
constructor(options) {
|
||||
// TODO options validation
|
||||
this.options = options;
|
||||
validateOptions(schema, options, { name: "Module Federation Plugin" });
|
||||
|
||||
this._options = options;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Compiler} compiler webpack compiler
|
||||
* Apply the plugin
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compiler) {
|
||||
const { options } = this;
|
||||
const { _options: options } = this;
|
||||
if (
|
||||
options.library &&
|
||||
!compiler.options.output.enabledLibraryTypes.includes(
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const validateOptions = require("schema-utils");
|
||||
const schema = require("../../schemas/plugins/container/OverridablesPlugin.json");
|
||||
const ModuleNotFoundError = require("../ModuleNotFoundError");
|
||||
const RuntimeGlobals = require("../RuntimeGlobals");
|
||||
const {
|
||||
|
|
@ -18,19 +20,31 @@ const OverridablesRuntimeModule = require("./OverridablesRuntimeModule");
|
|||
const parseOptions = require("./parseOptions");
|
||||
|
||||
/** @typedef {import("enhanced-resolve").ResolveContext} ResolveContext */
|
||||
/** @typedef {import("../../declarations/plugins/container/OverridablesPlugin").OverridablesPluginOptions} OverridablesPluginOptions */
|
||||
/** @typedef {import("../Compiler")} Compiler */
|
||||
|
||||
const PLUGIN_NAME = "OverridablesPlugin";
|
||||
|
||||
class OverridablesPlugin {
|
||||
constructor(options) {
|
||||
this.overridables = parseOptions(options);
|
||||
}
|
||||
/**
|
||||
* @param {Compiler} compiler webpack compiler
|
||||
* @param {OverridablesPluginOptions} options options
|
||||
*/
|
||||
constructor(options) {
|
||||
if (typeof options !== "string") {
|
||||
validateOptions(schema, options, { name: "Overridables Plugin" });
|
||||
}
|
||||
|
||||
this._overridables = parseOptions(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
* @param {Compiler} compiler the compiler instance
|
||||
* @returns {void}
|
||||
*/
|
||||
apply(compiler) {
|
||||
compiler.hooks.thisCompilation.tap(
|
||||
"OverridablesPlugin",
|
||||
PLUGIN_NAME,
|
||||
(compilation, { normalModuleFactory }) => {
|
||||
compilation.dependencyFactories.set(
|
||||
OverridableOriginalDependency,
|
||||
|
|
@ -47,7 +61,7 @@ class OverridablesPlugin {
|
|||
missingDependencies: new LazySet()
|
||||
};
|
||||
const promise = Promise.all(
|
||||
this.overridables.map(([key, request]) => {
|
||||
this._overridables.map(([key, request]) => {
|
||||
const resolver = compilation.resolverFactory.get("normal");
|
||||
return new Promise((resolve, reject) => {
|
||||
resolver.resolve(
|
||||
|
|
@ -80,14 +94,14 @@ class OverridablesPlugin {
|
|||
);
|
||||
});
|
||||
normalModuleFactory.hooks.afterResolve.tapAsync(
|
||||
"OverridablesPlugin",
|
||||
PLUGIN_NAME,
|
||||
(resolveData, callback) => {
|
||||
// wait for resolving to be complete
|
||||
promise.then(() => callback());
|
||||
}
|
||||
);
|
||||
normalModuleFactory.hooks.module.tap(
|
||||
"OverridablesPlugin",
|
||||
PLUGIN_NAME,
|
||||
(module, createData, resolveData) => {
|
||||
if (
|
||||
resolveData.dependencies[0] instanceof
|
||||
|
|
@ -107,7 +121,7 @@ class OverridablesPlugin {
|
|||
);
|
||||
compilation.hooks.runtimeRequirementInTree
|
||||
.for(RuntimeGlobals.ensureChunkHandlers)
|
||||
.tap("OverridablesPlugin", (chunk, set) => {
|
||||
.tap(PLUGIN_NAME, (chunk, set) => {
|
||||
set.add(RuntimeGlobals.module);
|
||||
set.add(RuntimeGlobals.moduleFactories);
|
||||
set.add(RuntimeGlobals.hasOwnProperty);
|
||||
|
|
@ -120,7 +134,7 @@ class OverridablesPlugin {
|
|||
parser.hooks.expression
|
||||
.for("__webpack_override__")
|
||||
.tap(
|
||||
"OverridablesPlugin",
|
||||
PLUGIN_NAME,
|
||||
toConstantDependency(
|
||||
parser,
|
||||
`Object.assign.bind(Object, ${RuntimeGlobals.overrides})`,
|
||||
|
|
@ -129,7 +143,7 @@ class OverridablesPlugin {
|
|||
);
|
||||
parser.hooks.evaluateTypeof
|
||||
.for("__webpack_override__")
|
||||
.tap("OverridablesPlugin", evaluateToString("function"));
|
||||
.tap(PLUGIN_NAME, evaluateToString("function"));
|
||||
};
|
||||
normalModuleFactory.hooks.parser
|
||||
.for("javascript/auto")
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"title": "ContainerReferencePlugin",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"overrides": {
|
||||
"description": "A list of requests that should be overridable by the host container.",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "List of provided remote scopes.",
|
||||
"type": "array",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "A object of key value pairs for remote scopes.",
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"remoteType": {
|
||||
"description": "The libraryTarget of a remote build.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"remotes": {
|
||||
"description": "A list of remote scopes or namespaces that reference federated Webpack instances.",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "List of provided remote scopes.",
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"description": "A object of key value pairs for remote scopes.",
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,5 @@
|
|||
{
|
||||
"definitions": {
|
||||
"ArrayOfStringValues": {
|
||||
"description": "Array of strings.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A non-empty string.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"AuxiliaryComment": {
|
||||
"description": "Add a comment in the UMD wrapper.",
|
||||
"anyOf": [
|
||||
|
|
@ -21,6 +12,29 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"Exposes": {
|
||||
"description": "Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Exposes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Request to a module that should be exposed by this container.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Requests to modules that should be exposed by this container. Property names are used as public names.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Exposes"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LibraryCustomUmdCommentObject": {
|
||||
"description": "Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.",
|
||||
"type": "object",
|
||||
|
|
@ -159,6 +173,29 @@
|
|||
"system"
|
||||
]
|
||||
},
|
||||
"Overridables": {
|
||||
"description": "Modules in this container that should be able to be overridden by the host. When provided, property name is used as override key, otherwise override key is automatically inferred from request.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Overridables"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Request to a module in this container that should be able to be overridden by the host. Override key is automatically inferred from request.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Requests to modules in this container that should be able to be overridden by the host. Property names are used as override keys.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Overridables"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"UmdNamedDefine": {
|
||||
"description": "If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.",
|
||||
"type": "boolean"
|
||||
|
|
@ -169,15 +206,7 @@
|
|||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"exposes": {
|
||||
"description": "A map of modules you wish to expose.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
"$ref": "#/definitions/Exposes"
|
||||
},
|
||||
"filename": {
|
||||
"description": "The filename for this container relative path inside the `output.path` directory.",
|
||||
|
|
@ -192,16 +221,8 @@
|
|||
"type": "string"
|
||||
},
|
||||
"overridables": {
|
||||
"description": "An object for requests to override from host to this container.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
"$ref": "#/definitions/Overridables"
|
||||
}
|
||||
},
|
||||
"required": ["name"]
|
||||
"required": ["name", "exposes"]
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
"definitions": {
|
||||
"LibraryType": {
|
||||
"description": "Type of library.",
|
||||
"enum": [
|
||||
"var",
|
||||
"module",
|
||||
"assign",
|
||||
"this",
|
||||
"window",
|
||||
"self",
|
||||
"global",
|
||||
"commonjs",
|
||||
"commonjs2",
|
||||
"commonjs-module",
|
||||
"amd",
|
||||
"amd-require",
|
||||
"umd",
|
||||
"umd2",
|
||||
"jsonp",
|
||||
"system"
|
||||
]
|
||||
},
|
||||
"Overrides": {
|
||||
"description": "Modules in this container that should override overridable modules in the remote container. When provided, property name is used as override key, otherwise override key is automatically inferred from request.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Overrides"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Request to a module in this container that should override overridable modules in the remote container. Override key is automatically inferred from request.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Request to a module in this container that should override overridable modules in the remote container. Property names are used as override keys.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Overrides"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Remotes": {
|
||||
"description": "Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Remotes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Container location from which modules should be resolved and loaded at runtime.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Remotes"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"title": "ContainerReferencePluginOptions",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"overrides": {
|
||||
"$ref": "#/definitions/Overrides"
|
||||
},
|
||||
"remoteType": {
|
||||
"description": "The external type of the remote containers.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/LibraryType"
|
||||
}
|
||||
]
|
||||
},
|
||||
"remotes": {
|
||||
"$ref": "#/definitions/Remotes"
|
||||
}
|
||||
},
|
||||
"required": ["remoteType", "remotes"]
|
||||
}
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
{
|
||||
"definitions": {
|
||||
"AuxiliaryComment": {
|
||||
"description": "Add a comment in the UMD wrapper.",
|
||||
"anyOf": [
|
||||
{
|
||||
"description": "Append the same comment above each import style.",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/LibraryCustomUmdCommentObject"
|
||||
}
|
||||
]
|
||||
},
|
||||
"Exposes": {
|
||||
"description": "Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Exposes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Request to a module that should be exposed by this container. Public name is automatically inferred from request.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Requests to modules that should be exposed by this container. Property names are used as public names.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Exposes"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LibraryCustomUmdCommentObject": {
|
||||
"description": "Set explicit comments for `commonjs`, `commonjs2`, `amd`, and `root`.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"amd": {
|
||||
"description": "Set comment for `amd` section in UMD.",
|
||||
"type": "string"
|
||||
},
|
||||
"commonjs": {
|
||||
"description": "Set comment for `commonjs` (exports) section in UMD.",
|
||||
"type": "string"
|
||||
},
|
||||
"commonjs2": {
|
||||
"description": "Set comment for `commonjs2` (module.exports) section in UMD.",
|
||||
"type": "string"
|
||||
},
|
||||
"root": {
|
||||
"description": "Set comment for `root` (global variable) section in UMD.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"LibraryCustomUmdObject": {
|
||||
"description": "Description object for all UMD variants of the library name.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"amd": {
|
||||
"description": "Name of the exposed AMD library in the UMD.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"commonjs": {
|
||||
"description": "Name of the exposed commonjs export in the UMD.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"root": {
|
||||
"description": "Name of the property exposed globally by a UMD library.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Part of the name of the property exposed globally by a UMD library.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"LibraryExport": {
|
||||
"description": "Specify which export should be exposed as library.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "Part of the export that should be exposed as library.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"LibraryName": {
|
||||
"description": "The name of the library (some types allow unnamed libraries too).",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"description": "A part of the library name.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/LibraryCustomUmdObject"
|
||||
}
|
||||
]
|
||||
},
|
||||
"LibraryOptions": {
|
||||
"description": "Options for library.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"auxiliaryComment": {
|
||||
"$ref": "#/definitions/AuxiliaryComment"
|
||||
},
|
||||
"export": {
|
||||
"$ref": "#/definitions/LibraryExport"
|
||||
},
|
||||
"name": {
|
||||
"$ref": "#/definitions/LibraryName"
|
||||
},
|
||||
"type": {
|
||||
"$ref": "#/definitions/LibraryType"
|
||||
},
|
||||
"umdNamedDefine": {
|
||||
"$ref": "#/definitions/UmdNamedDefine"
|
||||
}
|
||||
},
|
||||
"required": ["type"]
|
||||
},
|
||||
"LibraryType": {
|
||||
"description": "Type of library.",
|
||||
"enum": [
|
||||
"var",
|
||||
"module",
|
||||
"assign",
|
||||
"this",
|
||||
"window",
|
||||
"self",
|
||||
"global",
|
||||
"commonjs",
|
||||
"commonjs2",
|
||||
"commonjs-module",
|
||||
"amd",
|
||||
"amd-require",
|
||||
"umd",
|
||||
"umd2",
|
||||
"jsonp",
|
||||
"system"
|
||||
]
|
||||
},
|
||||
"Remotes": {
|
||||
"description": "Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Remotes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Container location from which modules should be resolved and loaded at runtime.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Remotes"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Shared": {
|
||||
"description": "Modules that should be shared with remotes and/or host. When provided, property name is used as shared key, otherwise shared key is automatically inferred from request.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Shared"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Request to a module that should be shared with remotes and/or host.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Requests to modules that should be shared with remotes and/or host. Property names are used as shared keys.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/Shared"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"UmdNamedDefine": {
|
||||
"description": "If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"title": "ModuleFederationPluginOptions",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"exposes": {
|
||||
"$ref": "#/definitions/Exposes"
|
||||
},
|
||||
"filename": {
|
||||
"description": "The filename of the container as relative path inside the `output.path` directory.",
|
||||
"type": "string",
|
||||
"absolutePath": false
|
||||
},
|
||||
"library": {
|
||||
"$ref": "#/definitions/LibraryOptions"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the container.",
|
||||
"type": "string"
|
||||
},
|
||||
"remoteType": {
|
||||
"description": "The external type of the remote containers.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/LibraryType"
|
||||
}
|
||||
]
|
||||
},
|
||||
"remotes": {
|
||||
"$ref": "#/definitions/Remotes"
|
||||
},
|
||||
"shared": {
|
||||
"$ref": "#/definitions/Shared"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"title": "OverridablesPluginOptions",
|
||||
"description": "Modules that should be able to be overridden. When provided, property name is used as override key, otherwise override key is automatically inferred from request.",
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "Request to a module that should be able to be overridden.",
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
{
|
||||
"description": "Requests to modules that should be able to be overridden. Property names are used as override keys.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"$ref": "#"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1460,20 +1460,17 @@ declare interface Configuration {
|
|||
}
|
||||
declare class ContainerPlugin {
|
||||
constructor(options: ContainerPluginOptions);
|
||||
options: {
|
||||
overridables: any[] | { [index: string]: any };
|
||||
name: string;
|
||||
library: LibraryOptions;
|
||||
filename: string;
|
||||
exposes: [string, string][];
|
||||
};
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
*/
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
declare interface ContainerPluginOptions {
|
||||
/**
|
||||
* A map of modules you wish to expose.
|
||||
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
||||
*/
|
||||
exposes?: any[] | { [index: string]: any };
|
||||
exposes: ExposesContainerPlugin;
|
||||
|
||||
/**
|
||||
* The filename for this container relative path inside the `output.path` directory.
|
||||
|
|
@ -1491,17 +1488,34 @@ declare interface ContainerPluginOptions {
|
|||
name: string;
|
||||
|
||||
/**
|
||||
* An object for requests to override from host to this container.
|
||||
* Modules in this container that should be able to be overridden by the host. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
overridables?: any[] | { [index: string]: any };
|
||||
overridables?: Overridables;
|
||||
}
|
||||
declare class ContainerReferencePlugin {
|
||||
constructor(options?: any);
|
||||
remoteType: any;
|
||||
remotes: [string, string][];
|
||||
overrides: [string, string][];
|
||||
constructor(options: ContainerReferencePluginOptions);
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
*/
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
declare interface ContainerReferencePluginOptions {
|
||||
/**
|
||||
* Modules in this container that should override overridable modules in the remote container. When provided, property name is used as override key, otherwise override key is automatically inferred from request.
|
||||
*/
|
||||
overrides?: Overrides;
|
||||
|
||||
/**
|
||||
* The external type of the remote containers.
|
||||
*/
|
||||
remoteType: LibraryType;
|
||||
|
||||
/**
|
||||
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
||||
*/
|
||||
remotes: RemotesContainerReferencePlugin;
|
||||
}
|
||||
declare class ContextExclusionPlugin {
|
||||
constructor(negativeMatcher: RegExp);
|
||||
negativeMatcher: RegExp;
|
||||
|
|
@ -2252,6 +2266,14 @@ declare interface ExportsSpec {
|
|||
*/
|
||||
dependencies?: Module[];
|
||||
}
|
||||
type ExposesContainerPlugin =
|
||||
| string
|
||||
| ExposesContainerPlugin[]
|
||||
| { [index: string]: ExposesContainerPlugin };
|
||||
type ExposesModuleFederationPlugin =
|
||||
| string
|
||||
| ExposesModuleFederationPlugin[]
|
||||
| { [index: string]: ExposesModuleFederationPlugin };
|
||||
type Expression =
|
||||
| UnaryExpression
|
||||
| ThisExpression
|
||||
|
|
@ -3703,10 +3725,49 @@ declare interface ModuleFactoryResult {
|
|||
missingDependencies?: Set<string>;
|
||||
}
|
||||
declare class ModuleFederationPlugin {
|
||||
constructor(options?: any);
|
||||
options: any;
|
||||
constructor(options: ModuleFederationPluginOptions);
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
*/
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
declare interface ModuleFederationPluginOptions {
|
||||
/**
|
||||
* Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
|
||||
*/
|
||||
exposes?: ExposesModuleFederationPlugin;
|
||||
|
||||
/**
|
||||
* The filename of the container as relative path inside the `output.path` directory.
|
||||
*/
|
||||
filename?: string;
|
||||
|
||||
/**
|
||||
* Options for library.
|
||||
*/
|
||||
library?: LibraryOptions;
|
||||
|
||||
/**
|
||||
* The name of the container.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The external type of the remote containers.
|
||||
*/
|
||||
remoteType?: LibraryType;
|
||||
|
||||
/**
|
||||
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
|
||||
*/
|
||||
remotes?: RemotesModuleFederationPlugin;
|
||||
|
||||
/**
|
||||
* Modules that should be shared with remotes and/or host. When provided, property name is used as shared key, otherwise shared key is automatically inferred from request.
|
||||
*/
|
||||
shared?: Shared;
|
||||
}
|
||||
declare class ModuleGraph {
|
||||
constructor();
|
||||
setParents(
|
||||
|
|
@ -4992,11 +5053,20 @@ declare interface OutputNormalized {
|
|||
*/
|
||||
webassemblyModuleFilename?: string;
|
||||
}
|
||||
type Overridables = string | Overridables[] | { [index: string]: Overridables };
|
||||
declare class OverridablesPlugin {
|
||||
constructor(options?: any);
|
||||
overridables: [string, string][];
|
||||
constructor(options: OverridablesPluginOptions);
|
||||
|
||||
/**
|
||||
* Apply the plugin
|
||||
*/
|
||||
apply(compiler: Compiler): void;
|
||||
}
|
||||
type OverridablesPluginOptions =
|
||||
| string
|
||||
| OverridablesPluginOptions[]
|
||||
| { [index: string]: OverridablesPluginOptions };
|
||||
type Overrides = string | Overrides[] | { [index: string]: Overrides };
|
||||
declare class Parser {
|
||||
constructor();
|
||||
parse(
|
||||
|
|
@ -5223,6 +5293,14 @@ type RecursiveArrayOrRecord =
|
|||
| RuntimeValue
|
||||
| { [index: string]: RecursiveArrayOrRecord }
|
||||
| RecursiveArrayOrRecord[];
|
||||
type RemotesContainerReferencePlugin =
|
||||
| string
|
||||
| RemotesContainerReferencePlugin[]
|
||||
| { [index: string]: RemotesContainerReferencePlugin };
|
||||
type RemotesModuleFederationPlugin =
|
||||
| string
|
||||
| RemotesModuleFederationPlugin[]
|
||||
| { [index: string]: RemotesModuleFederationPlugin };
|
||||
declare interface RenderBootstrapContext {
|
||||
/**
|
||||
* the chunk
|
||||
|
|
@ -6150,6 +6228,7 @@ declare abstract class Serializer {
|
|||
serialize(obj?: any, context?: any): any;
|
||||
deserialize(value?: any, context?: any): any;
|
||||
}
|
||||
type Shared = string | Shared[] | { [index: string]: Shared };
|
||||
declare class SideEffectsFlagPlugin {
|
||||
constructor();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue