Add semantic token highlighting for 'that' variable and comment file references in VS Code extension Add Phone_Text_Input and Currency_Input components with formatting utilities Implement client widgets, form standardization, and soft delete functionality Add modal scroll lock and update documentation Implement comprehensive modal system with form integration and validation Fix modal component instantiation using jQuery plugin API Implement modal system with responsive sizing, queuing, and validation support Implement form submission with validation, error handling, and loading states Implement country/state selectors with dynamic data loading and Bootstrap styling Revert Rsx::Route() highlighting in Blade/PHP files Target specific PHP scopes for Rsx::Route() highlighting in Blade Expand injection selector for Rsx::Route() highlighting Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls Update jqhtml packages to v2.2.165 Add bundle path validation for common mistakes (development mode only) Create Ajax_Select_Input widget and Rsx_Reference_Data controller Create Country_Select_Input widget with default country support Initialize Tom Select on Select_Input widgets Add Tom Select bundle for enhanced select dropdowns Implement ISO 3166 geographic data system for country/region selection Implement widget-based form system with disabled state support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
132 lines
4.0 KiB
JavaScript
132 lines
4.0 KiB
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const { SyncHook } = require("tapable");
|
|
const isValidExternalsType = require("../../schemas/plugins/container/ExternalsType.check");
|
|
const Compilation = require("../Compilation");
|
|
const SharePlugin = require("../sharing/SharePlugin");
|
|
const createSchemaValidation = require("../util/create-schema-validation");
|
|
const ContainerPlugin = require("./ContainerPlugin");
|
|
const ContainerReferencePlugin = require("./ContainerReferencePlugin");
|
|
const HoistContainerReferences = require("./HoistContainerReferencesPlugin");
|
|
|
|
/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ExternalsType} ExternalsType */
|
|
/** @typedef {import("../../declarations/plugins/container/ModuleFederationPlugin").ModuleFederationPluginOptions} ModuleFederationPluginOptions */
|
|
/** @typedef {import("../Compiler")} Compiler */
|
|
/** @typedef {import("../Dependency")} Dependency */
|
|
|
|
/**
|
|
* @typedef {object} CompilationHooks
|
|
* @property {SyncHook<Dependency>} addContainerEntryDependency
|
|
* @property {SyncHook<Dependency>} addFederationRuntimeDependency
|
|
*/
|
|
|
|
const validate = createSchemaValidation(
|
|
require("../../schemas/plugins/container/ModuleFederationPlugin.check"),
|
|
() => require("../../schemas/plugins/container/ModuleFederationPlugin.json"),
|
|
{
|
|
name: "Module Federation Plugin",
|
|
baseDataPath: "options"
|
|
}
|
|
);
|
|
|
|
/** @type {WeakMap<Compilation, CompilationHooks>} */
|
|
const compilationHooksMap = new WeakMap();
|
|
const PLUGIN_NAME = "ModuleFederationPlugin";
|
|
|
|
class ModuleFederationPlugin {
|
|
/**
|
|
* @param {ModuleFederationPluginOptions} options options
|
|
*/
|
|
constructor(options) {
|
|
validate(options);
|
|
|
|
this._options = options;
|
|
}
|
|
|
|
/**
|
|
* Get the compilation hooks associated with this plugin.
|
|
* @param {Compilation} compilation The compilation instance.
|
|
* @returns {CompilationHooks} The hooks for the compilation.
|
|
*/
|
|
static getCompilationHooks(compilation) {
|
|
if (!(compilation instanceof Compilation)) {
|
|
throw new TypeError(
|
|
"The 'compilation' argument must be an instance of Compilation"
|
|
);
|
|
}
|
|
let hooks = compilationHooksMap.get(compilation);
|
|
if (!hooks) {
|
|
hooks = {
|
|
addContainerEntryDependency: new SyncHook(["dependency"]),
|
|
addFederationRuntimeDependency: new SyncHook(["dependency"])
|
|
};
|
|
compilationHooksMap.set(compilation, hooks);
|
|
}
|
|
return hooks;
|
|
}
|
|
|
|
/**
|
|
* Apply the plugin
|
|
* @param {Compiler} compiler the compiler instance
|
|
* @returns {void}
|
|
*/
|
|
apply(compiler) {
|
|
const { _options: options } = this;
|
|
const library = options.library || { type: "var", name: options.name };
|
|
const remoteType =
|
|
options.remoteType ||
|
|
(options.library && isValidExternalsType(options.library.type)
|
|
? /** @type {ExternalsType} */ (options.library.type)
|
|
: "script");
|
|
if (
|
|
library &&
|
|
!compiler.options.output.enabledLibraryTypes.includes(library.type)
|
|
) {
|
|
compiler.options.output.enabledLibraryTypes.push(library.type);
|
|
}
|
|
compiler.hooks.afterPlugins.tap(PLUGIN_NAME, () => {
|
|
if (
|
|
options.exposes &&
|
|
(Array.isArray(options.exposes)
|
|
? options.exposes.length > 0
|
|
: Object.keys(options.exposes).length > 0)
|
|
) {
|
|
new ContainerPlugin({
|
|
name: /** @type {string} */ (options.name),
|
|
library,
|
|
filename: options.filename,
|
|
runtime: options.runtime,
|
|
shareScope: options.shareScope,
|
|
exposes: options.exposes
|
|
}).apply(compiler);
|
|
}
|
|
if (
|
|
options.remotes &&
|
|
(Array.isArray(options.remotes)
|
|
? options.remotes.length > 0
|
|
: Object.keys(options.remotes).length > 0)
|
|
) {
|
|
new ContainerReferencePlugin({
|
|
remoteType,
|
|
shareScope: options.shareScope,
|
|
remotes: options.remotes
|
|
}).apply(compiler);
|
|
}
|
|
if (options.shared) {
|
|
new SharePlugin({
|
|
shared: options.shared,
|
|
shareScope: options.shareScope
|
|
}).apply(compiler);
|
|
}
|
|
new HoistContainerReferences().apply(compiler);
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = ModuleFederationPlugin;
|