Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

21
node_modules/@module-federation/rspack/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024-present hanric(2heal1)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
node_modules/@module-federation/rspack/README.md generated vendored Normal file
View File

@@ -0,0 +1 @@
# `@module-federation/rspack` Documentation

21
node_modules/@module-federation/rspack/dist/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024-present hanric(2heal1)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,19 @@
import type { Compiler, RspackPluginInstance } from '@rspack/core';
import { moduleFederationPlugin } from '@module-federation/sdk';
import { RemoteEntryPlugin } from './RemoteEntryPlugin';
export declare const PLUGIN_NAME = "RspackModuleFederationPlugin";
type ResolveFn = typeof require.resolve;
export declare function resolveRspackRuntimeImplementation(implementation?: string, resolve?: ResolveFn): string;
export declare function resolveRspackRuntimeAlias(implementation: string, resolve?: ResolveFn): string;
export declare class ModuleFederationPlugin implements RspackPluginInstance {
readonly name = "RspackModuleFederationPlugin";
private _options;
private _statsPlugin?;
constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions);
private _patchBundlerConfig;
private _checkSingleton;
apply(compiler: Compiler): void;
private _patchChunkSplit;
}
export declare const GetPublicPathPlugin: typeof RemoteEntryPlugin;
export { TreeShakingSharedPlugin, type TreeShakingSharedPluginOptions, } from './TreeShakingSharedPlugin';

View File

@@ -0,0 +1,391 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
// The require scope
var __webpack_require__ = {};
/************************************************************************/
// webpack/runtime/compat_get_default_export
(() => {
// getDefaultExport function for compatibility with non-ESM modules
__webpack_require__.n = (module) => {
var getter = module && module.__esModule ?
() => (module['default']) :
() => (module);
__webpack_require__.d(getter, { a: getter });
return getter;
};
})();
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
ModuleFederationPlugin: () => (/* binding */ ModuleFederationPlugin),
GetPublicPathPlugin: () => (/* binding */ GetPublicPathPlugin),
PLUGIN_NAME: () => (/* binding */ PLUGIN_NAME),
resolveRspackRuntimeImplementation: () => (/* binding */ resolveRspackRuntimeImplementation),
resolveRspackRuntimeAlias: () => (/* binding */ resolveRspackRuntimeAlias),
TreeShakingSharedPlugin: () => (/* reexport */ external_TreeShakingSharedPlugin_js_namespaceObject.TreeShakingSharedPlugin)
});
;// CONCATENATED MODULE: external "@module-federation/sdk"
const sdk_namespaceObject = require("@module-federation/sdk");
;// CONCATENATED MODULE: external "@module-federation/manifest"
const manifest_namespaceObject = require("@module-federation/manifest");
;// CONCATENATED MODULE: external "@module-federation/managers"
const managers_namespaceObject = require("@module-federation/managers");
;// CONCATENATED MODULE: external "@module-federation/dts-plugin"
const dts_plugin_namespaceObject = require("@module-federation/dts-plugin");
;// CONCATENATED MODULE: external "@module-federation/bridge-react-webpack-plugin"
const bridge_react_webpack_plugin_namespaceObject = require("@module-federation/bridge-react-webpack-plugin");
var bridge_react_webpack_plugin_default = /*#__PURE__*/__webpack_require__.n(bridge_react_webpack_plugin_namespaceObject);
;// CONCATENATED MODULE: external "node:path"
const external_node_path_namespaceObject = require("node:path");
var external_node_path_default = /*#__PURE__*/__webpack_require__.n(external_node_path_namespaceObject);
;// CONCATENATED MODULE: external "node:fs"
const external_node_fs_namespaceObject = require("node:fs");
var external_node_fs_default = /*#__PURE__*/__webpack_require__.n(external_node_fs_namespaceObject);
;// CONCATENATED MODULE: external "./RemoteEntryPlugin.js"
const external_RemoteEntryPlugin_js_namespaceObject = require("./RemoteEntryPlugin.js");
;// CONCATENATED MODULE: external "./logger.js"
const external_logger_js_namespaceObject = require("./logger.js");
var external_logger_js_default = /*#__PURE__*/__webpack_require__.n(external_logger_js_namespaceObject);
;// CONCATENATED MODULE: external "./TreeShakingSharedPlugin.js"
const external_TreeShakingSharedPlugin_js_namespaceObject = require("./TreeShakingSharedPlugin.js");
;// CONCATENATED MODULE: ./src/ModuleFederationPlugin.ts
const PLUGIN_NAME = 'RspackModuleFederationPlugin';
function resolveRuntimeEntry(spec, implementation, resolve = require.resolve) {
const candidates = [
spec.bundler,
spec.esm,
spec.cjs
];
const modulePaths = implementation ? [
implementation
] : undefined;
let lastError;
for (const candidate of candidates){
try {
return modulePaths ? resolve(candidate, {
paths: modulePaths
}) : resolve(candidate);
} catch (error) {
lastError = error;
}
}
throw lastError;
}
function resolveRspackRuntimeImplementation(implementation, resolve = require.resolve) {
return resolveRuntimeEntry({
bundler: '@module-federation/runtime-tools/bundler',
esm: '@module-federation/runtime-tools/dist/index.js',
cjs: '@module-federation/runtime-tools/dist/index.cjs'
}, implementation, resolve);
}
function resolveRspackRuntimeAlias(implementation, resolve = require.resolve) {
return resolveRuntimeEntry({
bundler: '@module-federation/runtime/bundler',
esm: '@module-federation/runtime/dist/index.js',
cjs: '@module-federation/runtime/dist/index.cjs'
}, implementation, resolve);
}
class ModuleFederationPlugin {
_patchBundlerConfig(compiler) {
var _experiments_optimization;
const { name, experiments } = this._options;
const definePluginOptions = {};
if (name) {
definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify((0,sdk_namespaceObject.composeKeyWithSeparator)(name, managers_namespaceObject.utils.getBuildVersion()));
}
// Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
const disableSnapshot = (experiments === null || experiments === void 0 ? void 0 : (_experiments_optimization = experiments.optimization) === null || _experiments_optimization === void 0 ? void 0 : _experiments_optimization.disableSnapshot) ?? false;
definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
// Determine ENV_TARGET: only if manually specified in experiments.optimization.target
if ((experiments === null || experiments === void 0 ? void 0 : experiments.optimization) && typeof experiments.optimization === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
const manualTarget = experiments.optimization.target;
// Ensure the target is one of the expected values before setting
if (manualTarget === 'web' || manualTarget === 'node') {
definePluginOptions['ENV_TARGET'] = JSON.stringify(manualTarget);
}
}
// No inference for ENV_TARGET. If not manually set and valid, it's not defined.
new compiler.webpack.DefinePlugin(definePluginOptions).apply(compiler);
}
_checkSingleton(compiler) {
let count = 0;
compiler.options.plugins.forEach((p)=>{
if (typeof p !== 'object' || !p) {
return;
}
if (p['name'] === this.name) {
count++;
if (count > 1) {
throw new Error(`Detect duplicate register ${this.name},please ensure ${this.name} is singleton!`);
}
}
});
}
apply(compiler) {
var _options_experiments, _options_experiments1;
(0,sdk_namespaceObject.bindLoggerToCompiler)((external_logger_js_default()), compiler, PLUGIN_NAME);
const { _options: options } = this;
if (!options.name) {
throw new Error('[ ModuleFederationPlugin ]: name is required');
}
this._checkSingleton(compiler);
this._patchBundlerConfig(compiler);
const containerManager = new managers_namespaceObject.ContainerManager();
containerManager.init(options);
if (containerManager.enable) {
this._patchChunkSplit(compiler, options.name);
}
// must before ModuleFederationPlugin
new external_RemoteEntryPlugin_js_namespaceObject.RemoteEntryPlugin(options).apply(compiler);
if ((_options_experiments = options.experiments) === null || _options_experiments === void 0 ? void 0 : _options_experiments.provideExternalRuntime) {
if (containerManager.enable) {
throw new Error('You can only set provideExternalRuntime: true in pure consumer which not expose modules.');
}
const runtimePlugins = options.runtimePlugins || [];
options.runtimePlugins = runtimePlugins.concat(require.resolve('@module-federation/inject-external-runtime-core-plugin'));
}
if (((_options_experiments1 = options.experiments) === null || _options_experiments1 === void 0 ? void 0 : _options_experiments1.externalRuntime) === true) {
const Externals = compiler.webpack.ExternalsPlugin;
new Externals(compiler.options.externalsType || 'global', {
'@module-federation/runtime-core': '_FEDERATION_RUNTIME_CORE'
}).apply(compiler);
}
const implementationPath = options.implementation ? options.implementation : resolveRspackRuntimeImplementation();
options.implementation = implementationPath;
let disableManifest = options.manifest === false;
let disableDts = options.dts === false;
if (!disableDts) {
const dtsPlugin = new dts_plugin_namespaceObject.DtsPlugin(options);
// @ts-ignore
dtsPlugin.apply(compiler);
dtsPlugin.addRuntimePlugins();
}
if (!disableManifest && options.exposes) {
try {
options.exposes = containerManager.containerPluginExposesOptions;
} catch (err) {
if (err instanceof Error) {
err.message = `[ ModuleFederationPlugin ]: Manifest will not generate, because: ${err.message}`;
}
external_logger_js_default().warn(err);
disableManifest = true;
}
}
new compiler.webpack.container.ModuleFederationPlugin(options).apply(compiler);
let runtimePath;
try {
runtimePath = resolveRspackRuntimeAlias(implementationPath);
} catch (err) {
const detail = err instanceof Error ? err.message : String(err);
throw new Error(`[ ModuleFederationPlugin ]: Unable to resolve runtime entry (paths: [${implementationPath}]): ${detail}`);
}
compiler.hooks.afterPlugins.tap('PatchAliasWebpackPlugin', ()=>{
compiler.options.resolve.alias = {
...compiler.options.resolve.alias,
'@module-federation/runtime$': runtimePath
};
});
if (!disableManifest) {
this._statsPlugin = new manifest_namespaceObject.StatsPlugin(options, {
pluginVersion: "2.5.0",
bundler: 'rspack'
});
// @ts-ignore
this._statsPlugin.apply(compiler);
}
const checkBridgeReactInstalled = ()=>{
try {
const userPackageJsonPath = external_node_path_default().resolve(compiler.context, 'package.json');
if (external_node_fs_default().existsSync(userPackageJsonPath)) {
const userPackageJson = JSON.parse(external_node_fs_default().readFileSync(userPackageJsonPath, 'utf-8'));
const userDependencies = {
...userPackageJson.dependencies,
...userPackageJson.devDependencies
};
return !!userDependencies['@module-federation/bridge-react'];
}
return false;
} catch (error) {
return false;
}
};
const hasBridgeReact = checkBridgeReactInstalled();
// react bridge plugin
const shouldEnableBridgePlugin = ()=>{
var _options_bridge, _options_bridge1, _options_bridge2;
// Priority 1: Explicit enableBridgeRouter configuration
if ((options === null || options === void 0 ? void 0 : (_options_bridge = options.bridge) === null || _options_bridge === void 0 ? void 0 : _options_bridge.enableBridgeRouter) === true) {
return true;
}
// Priority 2: Explicit disable via enableBridgeRouter:false or disableAlias:true
if ((options === null || options === void 0 ? void 0 : (_options_bridge1 = options.bridge) === null || _options_bridge1 === void 0 ? void 0 : _options_bridge1.enableBridgeRouter) === false || (options === null || options === void 0 ? void 0 : (_options_bridge2 = options.bridge) === null || _options_bridge2 === void 0 ? void 0 : _options_bridge2.disableAlias) === true) {
var _options_bridge3;
if ((options === null || options === void 0 ? void 0 : (_options_bridge3 = options.bridge) === null || _options_bridge3 === void 0 ? void 0 : _options_bridge3.disableAlias) === true) {
external_logger_js_default().warn("\u26A0\uFE0F [ModuleFederationPlugin] The `disableAlias` option is deprecated and will be removed in a future version.\n" + ' Please use `enableBridgeRouter: false` instead:\n' + ' {\n' + ' bridge: {\n' + ' enableBridgeRouter: false // Use this instead of disableAlias: true\n' + ' }\n' + ' }');
}
return false;
}
// Priority 3: Automatic detection based on bridge-react installation
if (hasBridgeReact) {
external_logger_js_default().info("\uD83D\uDCA1 [ModuleFederationPlugin] Detected @module-federation/bridge-react in your dependencies.\n" + ' For better control and to avoid future breaking changes, please explicitly set:\n' + ' {\n' + ' bridge: {\n' + ' enableBridgeRouter: true // Explicitly enable bridge router\n' + ' }\n' + ' }');
return true;
}
return false;
};
const enableBridgePlugin = shouldEnableBridgePlugin();
// When bridge plugin is disabled (router disabled), alias to /base entry
if (!enableBridgePlugin && hasBridgeReact) {
compiler.hooks.afterPlugins.tap('BridgeReactBaseAliasPlugin', ()=>{
try {
const bridgeReactBasePath = external_node_path_default().resolve(compiler.context, 'node_modules/@module-federation/bridge-react/dist/base.es.js');
if (!external_node_fs_default().existsSync(bridgeReactBasePath)) {
external_logger_js_default().warn("\u26A0\uFE0F [ModuleFederationPlugin] bridge-react /base entry not found, falling back to default entry");
return;
}
compiler.options.resolve.alias = {
...compiler.options.resolve.alias,
'@module-federation/bridge-react$': bridgeReactBasePath
};
external_logger_js_default().info("\u2705 [ModuleFederationPlugin] Router disabled - using /base entry (no react-router-dom)");
} catch (error) {
external_logger_js_default().warn("\u26A0\uFE0F [ModuleFederationPlugin] Failed to set /base alias, using default entry");
}
});
}
if (enableBridgePlugin) {
new (bridge_react_webpack_plugin_default())({
moduleFederationOptions: this._options
}).apply(compiler);
}
}
_patchChunkSplit(compiler, name) {
const { splitChunks } = compiler.options.optimization;
const patchChunkSplit = (cacheGroup)=>{
switch(typeof cacheGroup){
case 'boolean':
case 'string':
case 'function':
break;
// cacheGroup.chunks will inherit splitChunks.chunks, so you only need to modify the chunks that are set separately
case 'object':
{
if (cacheGroup instanceof RegExp) {
break;
}
if (!cacheGroup.chunks) {
break;
}
if (typeof cacheGroup.chunks === 'function') {
const prevChunks = cacheGroup.chunks;
cacheGroup.chunks = (chunk)=>{
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
return false;
}
return prevChunks(chunk);
};
break;
}
if (cacheGroup.chunks === 'all') {
cacheGroup.chunks = (chunk)=>{
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
return false;
}
return true;
};
break;
}
if (cacheGroup.chunks === 'initial') {
cacheGroup.chunks = (chunk)=>{
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
return false;
}
return chunk.isOnlyInitial();
};
break;
}
break;
}
default:
break;
}
};
if (!splitChunks) {
return;
}
// 修改 splitChunk.chunks
patchChunkSplit(splitChunks);
const { cacheGroups } = splitChunks;
if (!cacheGroups) {
return;
}
// 修改 splitChunk.cacheGroups[key].chunks
Object.keys(cacheGroups).forEach((cacheGroupKey)=>{
patchChunkSplit(cacheGroups[cacheGroupKey]);
});
}
constructor(options){
this.name = PLUGIN_NAME;
this._options = options;
}
}
const GetPublicPathPlugin = external_RemoteEntryPlugin_js_namespaceObject.RemoteEntryPlugin;
exports.GetPublicPathPlugin = __webpack_exports__.GetPublicPathPlugin;
exports.ModuleFederationPlugin = __webpack_exports__.ModuleFederationPlugin;
exports.PLUGIN_NAME = __webpack_exports__.PLUGIN_NAME;
exports.TreeShakingSharedPlugin = __webpack_exports__.TreeShakingSharedPlugin;
exports.resolveRspackRuntimeAlias = __webpack_exports__.resolveRspackRuntimeAlias;
exports.resolveRspackRuntimeImplementation = __webpack_exports__.resolveRspackRuntimeImplementation;
for(var __webpack_i__ in __webpack_exports__) {
if(["GetPublicPathPlugin","ModuleFederationPlugin","PLUGIN_NAME","TreeShakingSharedPlugin","resolveRspackRuntimeAlias","resolveRspackRuntimeImplementation"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,324 @@
import { bindLoggerToCompiler, composeKeyWithSeparator } from "@module-federation/sdk";
import { StatsPlugin } from "@module-federation/manifest";
import { ContainerManager, utils } from "@module-federation/managers";
import { DtsPlugin } from "@module-federation/dts-plugin";
import bridge_react_webpack_plugin from "@module-federation/bridge-react-webpack-plugin";
import node_path from "node:path";
import node_fs from "node:fs";
import { RemoteEntryPlugin } from "./RemoteEntryPlugin.mjs";
import logger from "./logger.mjs";
import { TreeShakingSharedPlugin } from "./TreeShakingSharedPlugin.mjs";
;// CONCATENATED MODULE: external "@module-federation/sdk"
;// CONCATENATED MODULE: external "@module-federation/manifest"
;// CONCATENATED MODULE: external "@module-federation/managers"
;// CONCATENATED MODULE: external "@module-federation/dts-plugin"
;// CONCATENATED MODULE: external "@module-federation/bridge-react-webpack-plugin"
;// CONCATENATED MODULE: external "node:path"
;// CONCATENATED MODULE: external "node:fs"
;// CONCATENATED MODULE: external "./RemoteEntryPlugin.mjs"
;// CONCATENATED MODULE: external "./logger.mjs"
;// CONCATENATED MODULE: external "./TreeShakingSharedPlugin.mjs"
;// CONCATENATED MODULE: ./src/ModuleFederationPlugin.ts
const PLUGIN_NAME = 'RspackModuleFederationPlugin';
function resolveRuntimeEntry(spec, implementation, resolve = require.resolve) {
const candidates = [
spec.bundler,
spec.esm,
spec.cjs
];
const modulePaths = implementation ? [
implementation
] : undefined;
let lastError;
for (const candidate of candidates){
try {
return modulePaths ? resolve(candidate, {
paths: modulePaths
}) : resolve(candidate);
} catch (error) {
lastError = error;
}
}
throw lastError;
}
function resolveRspackRuntimeImplementation(implementation, resolve = require.resolve) {
return resolveRuntimeEntry({
bundler: '@module-federation/runtime-tools/bundler',
esm: '@module-federation/runtime-tools/dist/index.js',
cjs: '@module-federation/runtime-tools/dist/index.cjs'
}, implementation, resolve);
}
function resolveRspackRuntimeAlias(implementation, resolve = require.resolve) {
return resolveRuntimeEntry({
bundler: '@module-federation/runtime/bundler',
esm: '@module-federation/runtime/dist/index.js',
cjs: '@module-federation/runtime/dist/index.cjs'
}, implementation, resolve);
}
class ModuleFederationPlugin {
_patchBundlerConfig(compiler) {
var _experiments_optimization;
const { name, experiments } = this._options;
const definePluginOptions = {};
if (name) {
definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify(composeKeyWithSeparator(name, utils.getBuildVersion()));
}
// Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
const disableSnapshot = (experiments === null || experiments === void 0 ? void 0 : (_experiments_optimization = experiments.optimization) === null || _experiments_optimization === void 0 ? void 0 : _experiments_optimization.disableSnapshot) ?? false;
definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
// Determine ENV_TARGET: only if manually specified in experiments.optimization.target
if ((experiments === null || experiments === void 0 ? void 0 : experiments.optimization) && typeof experiments.optimization === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
const manualTarget = experiments.optimization.target;
// Ensure the target is one of the expected values before setting
if (manualTarget === 'web' || manualTarget === 'node') {
definePluginOptions['ENV_TARGET'] = JSON.stringify(manualTarget);
}
}
// No inference for ENV_TARGET. If not manually set and valid, it's not defined.
new compiler.webpack.DefinePlugin(definePluginOptions).apply(compiler);
}
_checkSingleton(compiler) {
let count = 0;
compiler.options.plugins.forEach((p)=>{
if (typeof p !== 'object' || !p) {
return;
}
if (p['name'] === this.name) {
count++;
if (count > 1) {
throw new Error(`Detect duplicate register ${this.name},please ensure ${this.name} is singleton!`);
}
}
});
}
apply(compiler) {
var _options_experiments, _options_experiments1;
bindLoggerToCompiler(logger, compiler, PLUGIN_NAME);
const { _options: options } = this;
if (!options.name) {
throw new Error('[ ModuleFederationPlugin ]: name is required');
}
this._checkSingleton(compiler);
this._patchBundlerConfig(compiler);
const containerManager = new ContainerManager();
containerManager.init(options);
if (containerManager.enable) {
this._patchChunkSplit(compiler, options.name);
}
// must before ModuleFederationPlugin
new RemoteEntryPlugin(options).apply(compiler);
if ((_options_experiments = options.experiments) === null || _options_experiments === void 0 ? void 0 : _options_experiments.provideExternalRuntime) {
if (containerManager.enable) {
throw new Error('You can only set provideExternalRuntime: true in pure consumer which not expose modules.');
}
const runtimePlugins = options.runtimePlugins || [];
options.runtimePlugins = runtimePlugins.concat(require.resolve('@module-federation/inject-external-runtime-core-plugin'));
}
if (((_options_experiments1 = options.experiments) === null || _options_experiments1 === void 0 ? void 0 : _options_experiments1.externalRuntime) === true) {
const Externals = compiler.webpack.ExternalsPlugin;
new Externals(compiler.options.externalsType || 'global', {
'@module-federation/runtime-core': '_FEDERATION_RUNTIME_CORE'
}).apply(compiler);
}
const implementationPath = options.implementation ? options.implementation : resolveRspackRuntimeImplementation();
options.implementation = implementationPath;
let disableManifest = options.manifest === false;
let disableDts = options.dts === false;
if (!disableDts) {
const dtsPlugin = new DtsPlugin(options);
// @ts-ignore
dtsPlugin.apply(compiler);
dtsPlugin.addRuntimePlugins();
}
if (!disableManifest && options.exposes) {
try {
options.exposes = containerManager.containerPluginExposesOptions;
} catch (err) {
if (err instanceof Error) {
err.message = `[ ModuleFederationPlugin ]: Manifest will not generate, because: ${err.message}`;
}
logger.warn(err);
disableManifest = true;
}
}
new compiler.webpack.container.ModuleFederationPlugin(options).apply(compiler);
let runtimePath;
try {
runtimePath = resolveRspackRuntimeAlias(implementationPath);
} catch (err) {
const detail = err instanceof Error ? err.message : String(err);
throw new Error(`[ ModuleFederationPlugin ]: Unable to resolve runtime entry (paths: [${implementationPath}]): ${detail}`);
}
compiler.hooks.afterPlugins.tap('PatchAliasWebpackPlugin', ()=>{
compiler.options.resolve.alias = {
...compiler.options.resolve.alias,
'@module-federation/runtime$': runtimePath
};
});
if (!disableManifest) {
this._statsPlugin = new StatsPlugin(options, {
pluginVersion: "2.5.0",
bundler: 'rspack'
});
// @ts-ignore
this._statsPlugin.apply(compiler);
}
const checkBridgeReactInstalled = ()=>{
try {
const userPackageJsonPath = node_path.resolve(compiler.context, 'package.json');
if (node_fs.existsSync(userPackageJsonPath)) {
const userPackageJson = JSON.parse(node_fs.readFileSync(userPackageJsonPath, 'utf-8'));
const userDependencies = {
...userPackageJson.dependencies,
...userPackageJson.devDependencies
};
return !!userDependencies['@module-federation/bridge-react'];
}
return false;
} catch (error) {
return false;
}
};
const hasBridgeReact = checkBridgeReactInstalled();
// react bridge plugin
const shouldEnableBridgePlugin = ()=>{
var _options_bridge, _options_bridge1, _options_bridge2;
// Priority 1: Explicit enableBridgeRouter configuration
if ((options === null || options === void 0 ? void 0 : (_options_bridge = options.bridge) === null || _options_bridge === void 0 ? void 0 : _options_bridge.enableBridgeRouter) === true) {
return true;
}
// Priority 2: Explicit disable via enableBridgeRouter:false or disableAlias:true
if ((options === null || options === void 0 ? void 0 : (_options_bridge1 = options.bridge) === null || _options_bridge1 === void 0 ? void 0 : _options_bridge1.enableBridgeRouter) === false || (options === null || options === void 0 ? void 0 : (_options_bridge2 = options.bridge) === null || _options_bridge2 === void 0 ? void 0 : _options_bridge2.disableAlias) === true) {
var _options_bridge3;
if ((options === null || options === void 0 ? void 0 : (_options_bridge3 = options.bridge) === null || _options_bridge3 === void 0 ? void 0 : _options_bridge3.disableAlias) === true) {
logger.warn("\u26A0\uFE0F [ModuleFederationPlugin] The `disableAlias` option is deprecated and will be removed in a future version.\n" + ' Please use `enableBridgeRouter: false` instead:\n' + ' {\n' + ' bridge: {\n' + ' enableBridgeRouter: false // Use this instead of disableAlias: true\n' + ' }\n' + ' }');
}
return false;
}
// Priority 3: Automatic detection based on bridge-react installation
if (hasBridgeReact) {
logger.info("\uD83D\uDCA1 [ModuleFederationPlugin] Detected @module-federation/bridge-react in your dependencies.\n" + ' For better control and to avoid future breaking changes, please explicitly set:\n' + ' {\n' + ' bridge: {\n' + ' enableBridgeRouter: true // Explicitly enable bridge router\n' + ' }\n' + ' }');
return true;
}
return false;
};
const enableBridgePlugin = shouldEnableBridgePlugin();
// When bridge plugin is disabled (router disabled), alias to /base entry
if (!enableBridgePlugin && hasBridgeReact) {
compiler.hooks.afterPlugins.tap('BridgeReactBaseAliasPlugin', ()=>{
try {
const bridgeReactBasePath = node_path.resolve(compiler.context, 'node_modules/@module-federation/bridge-react/dist/base.es.js');
if (!node_fs.existsSync(bridgeReactBasePath)) {
logger.warn("\u26A0\uFE0F [ModuleFederationPlugin] bridge-react /base entry not found, falling back to default entry");
return;
}
compiler.options.resolve.alias = {
...compiler.options.resolve.alias,
'@module-federation/bridge-react$': bridgeReactBasePath
};
logger.info("\u2705 [ModuleFederationPlugin] Router disabled - using /base entry (no react-router-dom)");
} catch (error) {
logger.warn("\u26A0\uFE0F [ModuleFederationPlugin] Failed to set /base alias, using default entry");
}
});
}
if (enableBridgePlugin) {
new bridge_react_webpack_plugin({
moduleFederationOptions: this._options
}).apply(compiler);
}
}
_patchChunkSplit(compiler, name) {
const { splitChunks } = compiler.options.optimization;
const patchChunkSplit = (cacheGroup)=>{
switch(typeof cacheGroup){
case 'boolean':
case 'string':
case 'function':
break;
// cacheGroup.chunks will inherit splitChunks.chunks, so you only need to modify the chunks that are set separately
case 'object':
{
if (cacheGroup instanceof RegExp) {
break;
}
if (!cacheGroup.chunks) {
break;
}
if (typeof cacheGroup.chunks === 'function') {
const prevChunks = cacheGroup.chunks;
cacheGroup.chunks = (chunk)=>{
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
return false;
}
return prevChunks(chunk);
};
break;
}
if (cacheGroup.chunks === 'all') {
cacheGroup.chunks = (chunk)=>{
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
return false;
}
return true;
};
break;
}
if (cacheGroup.chunks === 'initial') {
cacheGroup.chunks = (chunk)=>{
if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
return false;
}
return chunk.isOnlyInitial();
};
break;
}
break;
}
default:
break;
}
};
if (!splitChunks) {
return;
}
// 修改 splitChunk.chunks
patchChunkSplit(splitChunks);
const { cacheGroups } = splitChunks;
if (!cacheGroups) {
return;
}
// 修改 splitChunk.cacheGroups[key].chunks
Object.keys(cacheGroups).forEach((cacheGroupKey)=>{
patchChunkSplit(cacheGroups[cacheGroupKey]);
});
}
constructor(options){
this.name = PLUGIN_NAME;
this._options = options;
}
}
const GetPublicPathPlugin = RemoteEntryPlugin;
export { GetPublicPathPlugin, ModuleFederationPlugin, PLUGIN_NAME, TreeShakingSharedPlugin, resolveRspackRuntimeAlias, resolveRspackRuntimeImplementation };

View File

@@ -0,0 +1,9 @@
import type { Compiler, RspackPluginInstance } from '@rspack/core';
import type { moduleFederationPlugin } from '@module-federation/sdk';
export declare class RemoteEntryPlugin implements RspackPluginInstance {
readonly name = "VmokRemoteEntryPlugin";
_options: moduleFederationPlugin.ModuleFederationPluginOptions;
constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions);
static addPublicPathEntry(compiler: Compiler, getPublicPath: string, name: string): void;
apply(compiler: Compiler): void;
}

View File

@@ -0,0 +1,127 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
// The require scope
var __webpack_require__ = {};
/************************************************************************/
// webpack/runtime/compat_get_default_export
(() => {
// getDefaultExport function for compatibility with non-ESM modules
__webpack_require__.n = (module) => {
var getter = module && module.__esModule ?
() => (module['default']) :
() => (module);
__webpack_require__.d(getter, { a: getter });
return getter;
};
})();
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
RemoteEntryPlugin: () => (/* binding */ RemoteEntryPlugin)
});
;// CONCATENATED MODULE: external "@module-federation/managers"
const managers_namespaceObject = require("@module-federation/managers");
;// CONCATENATED MODULE: external "./logger.js"
const external_logger_js_namespaceObject = require("./logger.js");
var external_logger_js_default = /*#__PURE__*/__webpack_require__.n(external_logger_js_namespaceObject);
;// CONCATENATED MODULE: ./src/RemoteEntryPlugin.ts
// @ts-ignore
const charMap = {
'<': '\\u003C',
'>': '\\u003E',
'/': '\\u002F',
'\\': '\\\\',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
'\0': '\\0',
'\u2028': '\\u2028',
'\u2029': '\\u2029'
};
function escapeUnsafeChars(str) {
return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x)=>charMap[x]);
}
class RemoteEntryPlugin {
static addPublicPathEntry(compiler, getPublicPath, name) {
let code;
const sanitizedPublicPath = escapeUnsafeChars(getPublicPath);
if (!getPublicPath.startsWith('function')) {
code = `${compiler.webpack.RuntimeGlobals.publicPath} = new Function(${JSON.stringify(sanitizedPublicPath)})()`;
} else {
code = `(${sanitizedPublicPath}())`;
}
const base64Code = Buffer.from(code, 'utf8').toString('base64');
const dataUrl = `data:text/javascript;base64,${base64Code}`;
compiler.hooks.afterPlugins.tap('VmokRemoteEntryPlugin', ()=>{
new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {
name: name
}).apply(compiler);
});
}
apply(compiler) {
const { name, getPublicPath } = this._options;
if (!getPublicPath || !name) {
return;
}
const containerManager = new managers_namespaceObject.ContainerManager();
containerManager.init(this._options);
if (!containerManager.enable) {
external_logger_js_default().warn("Detect you don't set exposes, 'getPublicPath' will not have effect.");
return;
}
RemoteEntryPlugin.addPublicPathEntry(compiler, getPublicPath, name);
}
constructor(options){
this.name = 'VmokRemoteEntryPlugin';
this._options = options;
}
}
exports.RemoteEntryPlugin = __webpack_exports__.RemoteEntryPlugin;
for(var __webpack_i__ in __webpack_exports__) {
if(["RemoteEntryPlugin"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,65 @@
import { ContainerManager } from "@module-federation/managers";
import logger from "./logger.mjs";
;// CONCATENATED MODULE: external "@module-federation/managers"
;// CONCATENATED MODULE: external "./logger.mjs"
;// CONCATENATED MODULE: ./src/RemoteEntryPlugin.ts
// @ts-ignore
const charMap = {
'<': '\\u003C',
'>': '\\u003E',
'/': '\\u002F',
'\\': '\\\\',
'\b': '\\b',
'\f': '\\f',
'\n': '\\n',
'\r': '\\r',
'\t': '\\t',
'\0': '\\0',
'\u2028': '\\u2028',
'\u2029': '\\u2029'
};
function escapeUnsafeChars(str) {
return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x)=>charMap[x]);
}
class RemoteEntryPlugin {
static addPublicPathEntry(compiler, getPublicPath, name) {
let code;
const sanitizedPublicPath = escapeUnsafeChars(getPublicPath);
if (!getPublicPath.startsWith('function')) {
code = `${compiler.webpack.RuntimeGlobals.publicPath} = new Function(${JSON.stringify(sanitizedPublicPath)})()`;
} else {
code = `(${sanitizedPublicPath}())`;
}
const base64Code = Buffer.from(code, 'utf8').toString('base64');
const dataUrl = `data:text/javascript;base64,${base64Code}`;
compiler.hooks.afterPlugins.tap('VmokRemoteEntryPlugin', ()=>{
new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {
name: name
}).apply(compiler);
});
}
apply(compiler) {
const { name, getPublicPath } = this._options;
if (!getPublicPath || !name) {
return;
}
const containerManager = new ContainerManager();
containerManager.init(this._options);
if (!containerManager.enable) {
logger.warn("Detect you don't set exposes, 'getPublicPath' will not have effect.");
return;
}
RemoteEntryPlugin.addPublicPathEntry(compiler, getPublicPath, name);
}
constructor(options){
this.name = 'VmokRemoteEntryPlugin';
this._options = options;
}
}
export { RemoteEntryPlugin };

View File

@@ -0,0 +1,13 @@
import type { Compiler, RspackPluginInstance } from '@rspack/core';
import type { moduleFederationPlugin } from '@module-federation/sdk';
export declare const PLUGIN_NAME = "RspackTreeShakingSharedPlugin";
export interface TreeShakingSharedPluginOptions {
mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
secondary?: boolean;
}
export declare class TreeShakingSharedPlugin implements RspackPluginInstance {
readonly name = "RspackTreeShakingSharedPlugin";
private _options;
constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions);
apply(compiler: Compiler): void;
}

View File

@@ -0,0 +1,63 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
// The require scope
var __webpack_require__ = {};
/************************************************************************/
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
PLUGIN_NAME: () => (PLUGIN_NAME),
TreeShakingSharedPlugin: () => (TreeShakingSharedPlugin)
});
const PLUGIN_NAME = 'RspackTreeShakingSharedPlugin';
class TreeShakingSharedPlugin {
apply(compiler) {
// @ts-expect-error wait rspack release
new compiler.rspack.sharing.TreeShakingSharedPlugin(this._options).apply(compiler);
}
constructor(options){
this.name = PLUGIN_NAME;
this._options = options;
}
}
exports.PLUGIN_NAME = __webpack_exports__.PLUGIN_NAME;
exports.TreeShakingSharedPlugin = __webpack_exports__.TreeShakingSharedPlugin;
for(var __webpack_i__ in __webpack_exports__) {
if(["PLUGIN_NAME","TreeShakingSharedPlugin"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,15 @@
;// CONCATENATED MODULE: ./src/TreeShakingSharedPlugin.ts
const PLUGIN_NAME = 'RspackTreeShakingSharedPlugin';
class TreeShakingSharedPlugin {
apply(compiler) {
// @ts-expect-error wait rspack release
new compiler.rspack.sharing.TreeShakingSharedPlugin(this._options).apply(compiler);
}
constructor(options){
this.name = PLUGIN_NAME;
this._options = options;
}
}
export { PLUGIN_NAME, TreeShakingSharedPlugin };

View File

@@ -0,0 +1,3 @@
export { ModuleFederationPlugin, PLUGIN_NAME } from './ModuleFederationPlugin';
export declare const ContainerPlugin: typeof import("@rspack/core/dist/container/ContainerPlugin").ContainerPlugin;
export declare const ContainerReferencePlugin: typeof import("@rspack/core/dist/container/ContainerReferencePlugin").ContainerReferencePlugin;

69
node_modules/@module-federation/rspack/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,69 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
// The require scope
var __webpack_require__ = {};
/************************************************************************/
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
ModuleFederationPlugin: () => (/* reexport */ external_ModuleFederationPlugin_js_namespaceObject.ModuleFederationPlugin),
PLUGIN_NAME: () => (/* reexport */ external_ModuleFederationPlugin_js_namespaceObject.PLUGIN_NAME),
ContainerPlugin: () => (/* binding */ ContainerPlugin),
ContainerReferencePlugin: () => (/* binding */ ContainerReferencePlugin)
});
;// CONCATENATED MODULE: external "./ModuleFederationPlugin.js"
const external_ModuleFederationPlugin_js_namespaceObject = require("./ModuleFederationPlugin.js");
;// CONCATENATED MODULE: external "@rspack/core"
const core_namespaceObject = require("@rspack/core");
;// CONCATENATED MODULE: ./src/index.ts
const ContainerPlugin = core_namespaceObject.container.ContainerPlugin;
const ContainerReferencePlugin = core_namespaceObject.container.ContainerReferencePlugin;
exports.ContainerPlugin = __webpack_exports__.ContainerPlugin;
exports.ContainerReferencePlugin = __webpack_exports__.ContainerReferencePlugin;
exports.ModuleFederationPlugin = __webpack_exports__.ModuleFederationPlugin;
exports.PLUGIN_NAME = __webpack_exports__.PLUGIN_NAME;
for(var __webpack_i__ in __webpack_exports__) {
if(["ContainerPlugin","ContainerReferencePlugin","ModuleFederationPlugin","PLUGIN_NAME"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

14
node_modules/@module-federation/rspack/dist/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { ModuleFederationPlugin, PLUGIN_NAME } from "./ModuleFederationPlugin.mjs";
import { container } from "@rspack/core";
;// CONCATENATED MODULE: external "./ModuleFederationPlugin.mjs"
;// CONCATENATED MODULE: external "@rspack/core"
;// CONCATENATED MODULE: ./src/index.ts
const ContainerPlugin = container.ContainerPlugin;
const ContainerReferencePlugin = container.ContainerReferencePlugin;
export { ContainerPlugin, ContainerReferencePlugin, ModuleFederationPlugin, PLUGIN_NAME };

View File

@@ -0,0 +1,3 @@
import { type Logger } from '@module-federation/sdk';
declare const logger: Logger;
export default logger;

62
node_modules/@module-federation/rspack/dist/logger.js generated vendored Normal file
View File

@@ -0,0 +1,62 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
// The require scope
var __webpack_require__ = {};
/************************************************************************/
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ src_logger)
});
;// CONCATENATED MODULE: external "@module-federation/sdk"
const sdk_namespaceObject = require("@module-federation/sdk");
;// CONCATENATED MODULE: ./src/logger.ts
const isLoggerFactory = (candidate)=>typeof candidate === 'function';
const createBundlerLogger = isLoggerFactory(sdk_namespaceObject.createInfrastructureLogger) ? (prefix)=>(0,sdk_namespaceObject.createInfrastructureLogger)(prefix) : sdk_namespaceObject.createLogger;
const logger = createBundlerLogger('[ Module Federation Rspack Plugin ]');
/* ESM default export */ const src_logger = (logger);
exports["default"] = __webpack_exports__["default"];
for(var __webpack_i__ in __webpack_exports__) {
if(["default"].indexOf(__webpack_i__) === -1) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
}
Object.defineProperty(exports, '__esModule', { value: true });

12
node_modules/@module-federation/rspack/dist/logger.mjs generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import { createInfrastructureLogger, createLogger } from "@module-federation/sdk";
;// CONCATENATED MODULE: external "@module-federation/sdk"
;// CONCATENATED MODULE: ./src/logger.ts
const isLoggerFactory = (candidate)=>typeof candidate === 'function';
const createBundlerLogger = isLoggerFactory(createInfrastructureLogger) ? (prefix)=>createInfrastructureLogger(prefix) : createLogger;
const logger = createBundlerLogger('[ Module Federation Rspack Plugin ]');
/* ESM default export */ const src_logger = (logger);
export { src_logger as default };

View File

@@ -0,0 +1 @@
export * from './ModuleFederationPlugin';

95
node_modules/@module-federation/rspack/dist/plugin.js generated vendored Normal file
View File

@@ -0,0 +1,95 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
var __webpack_modules__ = ({
"./ModuleFederationPlugin": (function (module) {
module.exports = require("./ModuleFederationPlugin.js");
}),
});
/************************************************************************/
// The module cache
var __webpack_module_cache__ = {};
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
// Return the exports of the module
return module.exports;
}
/************************************************************************/
// webpack/runtime/compat_get_default_export
(() => {
// getDefaultExport function for compatibility with non-ESM modules
__webpack_require__.n = (module) => {
var getter = module && module.__esModule ?
() => (module['default']) :
() => (module);
__webpack_require__.d(getter, { a: getter });
return getter;
};
})();
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
__webpack_require__.r(__webpack_exports__);
/* ESM import */var _ModuleFederationPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./ModuleFederationPlugin");
/* ESM import */var _ModuleFederationPlugin__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_ModuleFederationPlugin__WEBPACK_IMPORTED_MODULE_0__);
/* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
/* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _ModuleFederationPlugin__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _ModuleFederationPlugin__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
/* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
})();
for(var __webpack_i__ in __webpack_exports__) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,5 @@
export * from "./ModuleFederationPlugin.mjs";
;// CONCATENATED MODULE: ./src/plugin.ts

View File

@@ -0,0 +1 @@
export * from './RemoteEntryPlugin';

View File

@@ -0,0 +1,95 @@
"use strict";
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
return typeof document === 'undefined'
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
: (document.currentScript && document.currentScript.src) ||
new URL('main.js', document.baseURI).href;
})();
;
var __webpack_modules__ = ({
"./RemoteEntryPlugin": (function (module) {
module.exports = require("./RemoteEntryPlugin.js");
}),
});
/************************************************************************/
// The module cache
var __webpack_module_cache__ = {};
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
var cachedModule = __webpack_module_cache__[moduleId];
if (cachedModule !== undefined) {
return cachedModule.exports;
}
// Create a new module (and put it into the cache)
var module = (__webpack_module_cache__[moduleId] = {
exports: {}
});
// Execute the module function
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
// Return the exports of the module
return module.exports;
}
/************************************************************************/
// webpack/runtime/compat_get_default_export
(() => {
// getDefaultExport function for compatibility with non-ESM modules
__webpack_require__.n = (module) => {
var getter = module && module.__esModule ?
() => (module['default']) :
() => (module);
__webpack_require__.d(getter, { a: getter });
return getter;
};
})();
// webpack/runtime/define_property_getters
(() => {
__webpack_require__.d = (exports, definition) => {
for(var key in definition) {
if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
}
}
};
})();
// webpack/runtime/has_own_property
(() => {
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
})();
// webpack/runtime/make_namespace_object
(() => {
// define __esModule on exports
__webpack_require__.r = (exports) => {
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
}
Object.defineProperty(exports, '__esModule', { value: true });
};
})();
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
__webpack_require__.r(__webpack_exports__);
/* ESM import */var _RemoteEntryPlugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./RemoteEntryPlugin");
/* ESM import */var _RemoteEntryPlugin__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_RemoteEntryPlugin__WEBPACK_IMPORTED_MODULE_0__);
/* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
/* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _RemoteEntryPlugin__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _RemoteEntryPlugin__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
/* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
})();
for(var __webpack_i__ in __webpack_exports__) {
exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
}
Object.defineProperty(exports, '__esModule', { value: true });

View File

@@ -0,0 +1,5 @@
export * from "./RemoteEntryPlugin.mjs";
;// CONCATENATED MODULE: ./src/remote-entry-plugin.ts

103
node_modules/@module-federation/rspack/package.json generated vendored Normal file
View File

@@ -0,0 +1,103 @@
{
"name": "@module-federation/rspack",
"version": "2.5.0",
"license": "MIT",
"keywords": [
"Module Federation",
"Rspack"
],
"files": [
"dist/",
"README.md"
],
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/module-federation/core.git",
"directory": "packages/rspack"
},
"author": "hanric <hanric.zhang@gmail.com>",
"sideEffects": false,
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"dependencies": {
"@module-federation/bridge-react-webpack-plugin": "2.5.0",
"@module-federation/dts-plugin": "2.5.0",
"@module-federation/managers": "2.5.0",
"@module-federation/manifest": "2.5.0",
"@module-federation/sdk": "2.5.0",
"@module-federation/inject-external-runtime-core-plugin": "2.5.0",
"@module-federation/runtime-tools": "2.5.0"
},
"devDependencies": {
"@rspack/core": "^1.0.2"
},
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./plugin": {
"import": {
"types": "./dist/plugin.d.ts",
"default": "./dist/plugin.mjs"
},
"require": {
"types": "./dist/plugin.d.ts",
"default": "./dist/plugin.js"
}
},
"./remote-entry-plugin": {
"import": {
"types": "./dist/remote-entry-plugin.d.ts",
"default": "./dist/remote-entry-plugin.mjs"
},
"require": {
"types": "./dist/remote-entry-plugin.d.ts",
"default": "./dist/remote-entry-plugin.js"
}
}
},
"typesVersions": {
"*": {
".": [
"./dist/index.d.ts"
],
"plugin": [
"./dist/plugin.d.ts"
],
"remote-entry-plugin": [
"./dist/remote-entry-plugin.d.ts"
]
}
},
"peerDependencies": {
"typescript": "^4.9.0 || ^5.0.0",
"vue-tsc": ">=1.0.24",
"@rspack/core": "^0.7.0 || ^1.0.0 || ^2.0.0-0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
},
"vue-tsc": {
"optional": true
}
},
"scripts": {
"build": "rslib build",
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\" \"package.json\"",
"test": "pnpm exec jest --config jest.config.js --passWithNoTests",
"test:ci": "pnpm exec jest --config jest.config.js --passWithNoTests --ci --coverage",
"pre-release": "pnpm run test && pnpm run build"
}
}