@module-federation/rspack 0.0.0-chore-bump-node-22-20260710161714

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,309 @@
1
+ import { bindLoggerToCompiler, composeKeyWithSeparator } from "@module-federation/sdk";
2
+ import { StatsPlugin } from "@module-federation/manifest";
3
+ import { ContainerManager, utils } from "@module-federation/managers";
4
+ import { DtsPlugin } from "@module-federation/dts-plugin";
5
+ import bridge_react_webpack_plugin from "@module-federation/bridge-react-webpack-plugin";
6
+ import node_path from "node:path";
7
+ import node_fs from "node:fs";
8
+ import { RemoteEntryPlugin } from "./RemoteEntryPlugin.mjs";
9
+ import logger from "./logger.mjs";
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ const PLUGIN_NAME = 'RspackModuleFederationPlugin';
31
+ function resolveRuntimeEntry(spec, implementation, resolve = require.resolve) {
32
+ const candidates = [
33
+ spec.bundler,
34
+ spec.esm,
35
+ spec.cjs
36
+ ];
37
+ const modulePaths = implementation ? [
38
+ implementation
39
+ ] : undefined;
40
+ let lastError;
41
+ for (const candidate of candidates){
42
+ try {
43
+ return modulePaths ? resolve(candidate, {
44
+ paths: modulePaths
45
+ }) : resolve(candidate);
46
+ } catch (error) {
47
+ lastError = error;
48
+ }
49
+ }
50
+ throw lastError;
51
+ }
52
+ function resolveRspackRuntimeImplementation(implementation, resolve = require.resolve) {
53
+ return resolveRuntimeEntry({
54
+ bundler: '@module-federation/runtime-tools/bundler',
55
+ esm: '@module-federation/runtime-tools/dist/index.js',
56
+ cjs: '@module-federation/runtime-tools/dist/index.cjs'
57
+ }, implementation, resolve);
58
+ }
59
+ function resolveRspackRuntimeAlias(implementation, resolve = require.resolve) {
60
+ return resolveRuntimeEntry({
61
+ bundler: '@module-federation/runtime/bundler',
62
+ esm: '@module-federation/runtime/dist/index.js',
63
+ cjs: '@module-federation/runtime/dist/index.cjs'
64
+ }, implementation, resolve);
65
+ }
66
+ class ModuleFederationPlugin {
67
+ _patchBundlerConfig(compiler) {
68
+ const { name, experiments } = this._options;
69
+ const definePluginOptions = {};
70
+ if (name) {
71
+ definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify(composeKeyWithSeparator(name, utils.getBuildVersion()));
72
+ }
73
+ // Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
74
+ const disableSnapshot = experiments?.optimization?.disableSnapshot ?? false;
75
+ definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
76
+ // Determine ENV_TARGET: only if manually specified in experiments.optimization.target
77
+ if (experiments?.optimization && typeof experiments.optimization === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
78
+ const manualTarget = experiments.optimization.target;
79
+ // Ensure the target is one of the expected values before setting
80
+ if (manualTarget === 'web' || manualTarget === 'node') {
81
+ definePluginOptions['ENV_TARGET'] = JSON.stringify(manualTarget);
82
+ }
83
+ }
84
+ // No inference for ENV_TARGET. If not manually set and valid, it's not defined.
85
+ new compiler.webpack.DefinePlugin(definePluginOptions).apply(compiler);
86
+ }
87
+ _checkSingleton(compiler) {
88
+ let count = 0;
89
+ compiler.options.plugins.forEach((p)=>{
90
+ if (typeof p !== 'object' || !p) {
91
+ return;
92
+ }
93
+ if (p['name'] === this.name) {
94
+ count++;
95
+ if (count > 1) {
96
+ throw new Error(`Detect duplicate register ${this.name},please ensure ${this.name} is singleton!`);
97
+ }
98
+ }
99
+ });
100
+ }
101
+ apply(compiler) {
102
+ bindLoggerToCompiler(logger, compiler, PLUGIN_NAME);
103
+ const { _options: options } = this;
104
+ if (!options.name) {
105
+ throw new Error('[ ModuleFederationPlugin ]: name is required');
106
+ }
107
+ this._checkSingleton(compiler);
108
+ this._patchBundlerConfig(compiler);
109
+ const containerManager = new ContainerManager();
110
+ containerManager.init(options);
111
+ if (containerManager.enable) {
112
+ this._patchChunkSplit(compiler, options.name);
113
+ }
114
+ // must before ModuleFederationPlugin
115
+ new RemoteEntryPlugin(options).apply(compiler);
116
+ if (options.experiments?.provideExternalRuntime) {
117
+ if (containerManager.enable) {
118
+ throw new Error('You can only set provideExternalRuntime: true in pure consumer which not expose modules.');
119
+ }
120
+ const runtimePlugins = options.runtimePlugins || [];
121
+ options.runtimePlugins = runtimePlugins.concat(require.resolve('@module-federation/inject-external-runtime-core-plugin'));
122
+ }
123
+ if (options.experiments?.externalRuntime === true) {
124
+ const Externals = compiler.webpack.ExternalsPlugin;
125
+ new Externals(compiler.options.externalsType || 'global', {
126
+ '@module-federation/runtime-core': '_FEDERATION_RUNTIME_CORE'
127
+ }).apply(compiler);
128
+ }
129
+ const implementationPath = options.implementation ? options.implementation : resolveRspackRuntimeImplementation();
130
+ options.implementation = implementationPath;
131
+ let disableManifest = options.manifest === false;
132
+ let disableDts = options.dts === false;
133
+ if (!disableDts) {
134
+ const dtsPlugin = new DtsPlugin(options);
135
+ // @ts-ignore
136
+ dtsPlugin.apply(compiler);
137
+ dtsPlugin.addRuntimePlugins();
138
+ }
139
+ if (!disableManifest && options.exposes) {
140
+ try {
141
+ options.exposes = containerManager.containerPluginExposesOptions;
142
+ } catch (err) {
143
+ if (err instanceof Error) {
144
+ err.message = `[ ModuleFederationPlugin ]: Manifest will not generate, because: ${err.message}`;
145
+ }
146
+ logger.warn(err);
147
+ disableManifest = true;
148
+ }
149
+ }
150
+ new compiler.webpack.container.ModuleFederationPlugin(options).apply(compiler);
151
+ let runtimePath;
152
+ try {
153
+ runtimePath = resolveRspackRuntimeAlias(implementationPath);
154
+ } catch (err) {
155
+ const detail = err instanceof Error ? err.message : String(err);
156
+ throw new Error(`[ ModuleFederationPlugin ]: Unable to resolve runtime entry (paths: [${implementationPath}]): ${detail}`);
157
+ }
158
+ compiler.hooks.afterPlugins.tap('PatchAliasWebpackPlugin', ()=>{
159
+ compiler.options.resolve.alias = {
160
+ ...compiler.options.resolve.alias,
161
+ '@module-federation/runtime$': runtimePath
162
+ };
163
+ });
164
+ if (!disableManifest) {
165
+ this._statsPlugin = new StatsPlugin(options, {
166
+ pluginVersion: "0.0.0-chore-bump-node-22-20260710161714",
167
+ bundler: 'rspack'
168
+ });
169
+ // @ts-ignore
170
+ this._statsPlugin.apply(compiler);
171
+ }
172
+ const checkBridgeReactInstalled = ()=>{
173
+ try {
174
+ const userPackageJsonPath = node_path.resolve(compiler.context, 'package.json');
175
+ if (node_fs.existsSync(userPackageJsonPath)) {
176
+ const userPackageJson = JSON.parse(node_fs.readFileSync(userPackageJsonPath, 'utf-8'));
177
+ const userDependencies = {
178
+ ...userPackageJson.dependencies,
179
+ ...userPackageJson.devDependencies
180
+ };
181
+ return !!userDependencies['@module-federation/bridge-react'];
182
+ }
183
+ return false;
184
+ } catch (error) {
185
+ return false;
186
+ }
187
+ };
188
+ const hasBridgeReact = checkBridgeReactInstalled();
189
+ // react bridge plugin
190
+ const shouldEnableBridgePlugin = ()=>{
191
+ // Priority 1: Explicit enableBridgeRouter configuration
192
+ if (options?.bridge?.enableBridgeRouter === true) {
193
+ return true;
194
+ }
195
+ // Priority 2: Explicit disable via enableBridgeRouter:false or disableAlias:true
196
+ if (options?.bridge?.enableBridgeRouter === false || options?.bridge?.disableAlias === true) {
197
+ if (options?.bridge?.disableAlias === true) {
198
+ logger.warn('⚠️ [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' + ' }');
199
+ }
200
+ return false;
201
+ }
202
+ // Priority 3: Automatic detection based on bridge-react installation
203
+ if (hasBridgeReact) {
204
+ logger.info('💡 [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' + ' }');
205
+ return true;
206
+ }
207
+ return false;
208
+ };
209
+ const enableBridgePlugin = shouldEnableBridgePlugin();
210
+ // When bridge plugin is disabled (router disabled), alias to /base entry
211
+ if (!enableBridgePlugin && hasBridgeReact) {
212
+ compiler.hooks.afterPlugins.tap('BridgeReactBaseAliasPlugin', ()=>{
213
+ try {
214
+ const bridgeReactBasePath = node_path.resolve(compiler.context, 'node_modules/@module-federation/bridge-react/dist/base.es.js');
215
+ if (!node_fs.existsSync(bridgeReactBasePath)) {
216
+ logger.warn('⚠️ [ModuleFederationPlugin] bridge-react /base entry not found, falling back to default entry');
217
+ return;
218
+ }
219
+ compiler.options.resolve.alias = {
220
+ ...compiler.options.resolve.alias,
221
+ '@module-federation/bridge-react$': bridgeReactBasePath
222
+ };
223
+ logger.info('✅ [ModuleFederationPlugin] Router disabled - using /base entry (no react-router-dom)');
224
+ } catch (error) {
225
+ logger.warn('⚠️ [ModuleFederationPlugin] Failed to set /base alias, using default entry');
226
+ }
227
+ });
228
+ }
229
+ if (enableBridgePlugin) {
230
+ new bridge_react_webpack_plugin({
231
+ moduleFederationOptions: this._options
232
+ }).apply(compiler);
233
+ }
234
+ }
235
+ _patchChunkSplit(compiler, name) {
236
+ const { splitChunks } = compiler.options.optimization;
237
+ const patchChunkSplit = (cacheGroup)=>{
238
+ switch(typeof cacheGroup){
239
+ case 'boolean':
240
+ case 'string':
241
+ case 'function':
242
+ break;
243
+ // cacheGroup.chunks will inherit splitChunks.chunks, so you only need to modify the chunks that are set separately
244
+ case 'object':
245
+ {
246
+ if (cacheGroup instanceof RegExp) {
247
+ break;
248
+ }
249
+ if (!cacheGroup.chunks) {
250
+ break;
251
+ }
252
+ if (typeof cacheGroup.chunks === 'function') {
253
+ const prevChunks = cacheGroup.chunks;
254
+ cacheGroup.chunks = (chunk)=>{
255
+ if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
256
+ return false;
257
+ }
258
+ return prevChunks(chunk);
259
+ };
260
+ break;
261
+ }
262
+ if (cacheGroup.chunks === 'all') {
263
+ cacheGroup.chunks = (chunk)=>{
264
+ if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
265
+ return false;
266
+ }
267
+ return true;
268
+ };
269
+ break;
270
+ }
271
+ if (cacheGroup.chunks === 'initial') {
272
+ cacheGroup.chunks = (chunk)=>{
273
+ if (chunk.name && (chunk.name === name || chunk.name === name + '_partial')) {
274
+ return false;
275
+ }
276
+ return chunk.isOnlyInitial();
277
+ };
278
+ break;
279
+ }
280
+ break;
281
+ }
282
+ default:
283
+ break;
284
+ }
285
+ };
286
+ if (!splitChunks) {
287
+ return;
288
+ }
289
+ // 修改 splitChunk.chunks
290
+ patchChunkSplit(splitChunks);
291
+ const { cacheGroups } = splitChunks;
292
+ if (!cacheGroups) {
293
+ return;
294
+ }
295
+ // 修改 splitChunk.cacheGroups[key].chunks
296
+ Object.keys(cacheGroups).forEach((cacheGroupKey)=>{
297
+ patchChunkSplit(cacheGroups[cacheGroupKey]);
298
+ });
299
+ }
300
+ constructor(options){
301
+ this.name = PLUGIN_NAME;
302
+ this._options = options;
303
+ }
304
+ }
305
+ const GetPublicPathPlugin = RemoteEntryPlugin;
306
+
307
+
308
+ export { GetPublicPathPlugin, ModuleFederationPlugin, PLUGIN_NAME, resolveRspackRuntimeAlias, resolveRspackRuntimeImplementation };
309
+ export { TreeShakingSharedPlugin } from "./TreeShakingSharedPlugin.mjs";
@@ -0,0 +1,9 @@
1
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
2
+ import type { moduleFederationPlugin } from '@module-federation/sdk';
3
+ export declare class RemoteEntryPlugin implements RspackPluginInstance {
4
+ readonly name = "VmokRemoteEntryPlugin";
5
+ _options: moduleFederationPlugin.ModuleFederationPluginOptions;
6
+ constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions);
7
+ static addPublicPathEntry(compiler: Compiler, getPublicPath: string, name: string): void;
8
+ apply(compiler: Compiler): void;
9
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/compat_get_default_export
13
+ (() => {
14
+ // getDefaultExport function for compatibility with non-ESM modules
15
+ __webpack_require__.n = (module) => {
16
+ var getter = module && module.__esModule ?
17
+ () => (module['default']) :
18
+ () => (module);
19
+ __webpack_require__.d(getter, { a: getter });
20
+ return getter;
21
+ };
22
+
23
+ })();
24
+ // webpack/runtime/define_property_getters
25
+ (() => {
26
+ __webpack_require__.d = (exports, getters, values) => {
27
+ var define = (defs, kind) => {
28
+ for(var key in defs) {
29
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
31
+ }
32
+ }
33
+ };
34
+ define(getters, "get");
35
+ define(values, "value");
36
+ };
37
+ })();
38
+ // webpack/runtime/has_own_property
39
+ (() => {
40
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
41
+ })();
42
+ // webpack/runtime/make_namespace_object
43
+ (() => {
44
+ // define __esModule on exports
45
+ __webpack_require__.r = (exports) => {
46
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
+ }
49
+ Object.defineProperty(exports, '__esModule', { value: true });
50
+ };
51
+ })();
52
+ var __webpack_exports__ = {};
53
+ // ESM COMPAT FLAG
54
+ __webpack_require__.r(__webpack_exports__);
55
+
56
+ // EXPORTS
57
+ __webpack_require__.d(__webpack_exports__, {
58
+ RemoteEntryPlugin: () => (/* binding */ RemoteEntryPlugin)
59
+ });
60
+
61
+ ;// CONCATENATED MODULE: external "@module-federation/managers"
62
+ const managers_namespaceObject = require("@module-federation/managers");
63
+ ;// CONCATENATED MODULE: external "./logger.js"
64
+ const external_logger_js_namespaceObject = require("./logger.js");
65
+ var external_logger_js_default = /*#__PURE__*/__webpack_require__.n(external_logger_js_namespaceObject);
66
+ ;// CONCATENATED MODULE: ./src/RemoteEntryPlugin.ts
67
+
68
+
69
+ // @ts-ignore
70
+ const charMap = {
71
+ '<': '\\u003C',
72
+ '>': '\\u003E',
73
+ '/': '\\u002F',
74
+ '\\': '\\\\',
75
+ '\b': '\\b',
76
+ '\f': '\\f',
77
+ '\n': '\\n',
78
+ '\r': '\\r',
79
+ '\t': '\\t',
80
+ '\0': '\\0',
81
+ '\u2028': '\\u2028',
82
+ '\u2029': '\\u2029'
83
+ };
84
+ function escapeUnsafeChars(str) {
85
+ return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x)=>charMap[x]);
86
+ }
87
+ class RemoteEntryPlugin {
88
+ static addPublicPathEntry(compiler, getPublicPath, name) {
89
+ let code;
90
+ const sanitizedPublicPath = escapeUnsafeChars(getPublicPath);
91
+ if (!getPublicPath.startsWith('function')) {
92
+ code = `${compiler.webpack.RuntimeGlobals.publicPath} = new Function(${JSON.stringify(sanitizedPublicPath)})()`;
93
+ } else {
94
+ code = `(${sanitizedPublicPath}())`;
95
+ }
96
+ const base64Code = Buffer.from(code, 'utf8').toString('base64');
97
+ const dataUrl = `data:text/javascript;base64,${base64Code}`;
98
+ compiler.hooks.afterPlugins.tap('VmokRemoteEntryPlugin', ()=>{
99
+ new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {
100
+ name: name
101
+ }).apply(compiler);
102
+ });
103
+ }
104
+ apply(compiler) {
105
+ const { name, getPublicPath } = this._options;
106
+ if (!getPublicPath || !name) {
107
+ return;
108
+ }
109
+ const containerManager = new managers_namespaceObject.ContainerManager();
110
+ containerManager.init(this._options);
111
+ if (!containerManager.enable) {
112
+ external_logger_js_default().warn("Detect you don't set exposes, 'getPublicPath' will not have effect.");
113
+ return;
114
+ }
115
+ RemoteEntryPlugin.addPublicPathEntry(compiler, getPublicPath, name);
116
+ }
117
+ constructor(options){
118
+ this.name = 'VmokRemoteEntryPlugin';
119
+ this._options = options;
120
+ }
121
+ }
122
+
123
+ exports.RemoteEntryPlugin = __webpack_exports__.RemoteEntryPlugin;
124
+ for(var __rspack_i in __webpack_exports__) {
125
+ if(["RemoteEntryPlugin"].indexOf(__rspack_i) === -1) {
126
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
127
+ }
128
+ }
129
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,62 @@
1
+ import { ContainerManager } from "@module-federation/managers";
2
+ import logger from "./logger.mjs";
3
+
4
+
5
+
6
+
7
+
8
+ // @ts-ignore
9
+ const charMap = {
10
+ '<': '\\u003C',
11
+ '>': '\\u003E',
12
+ '/': '\\u002F',
13
+ '\\': '\\\\',
14
+ '\b': '\\b',
15
+ '\f': '\\f',
16
+ '\n': '\\n',
17
+ '\r': '\\r',
18
+ '\t': '\\t',
19
+ '\0': '\\0',
20
+ '\u2028': '\\u2028',
21
+ '\u2029': '\\u2029'
22
+ };
23
+ function escapeUnsafeChars(str) {
24
+ return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x)=>charMap[x]);
25
+ }
26
+ class RemoteEntryPlugin {
27
+ static addPublicPathEntry(compiler, getPublicPath, name) {
28
+ let code;
29
+ const sanitizedPublicPath = escapeUnsafeChars(getPublicPath);
30
+ if (!getPublicPath.startsWith('function')) {
31
+ code = `${compiler.webpack.RuntimeGlobals.publicPath} = new Function(${JSON.stringify(sanitizedPublicPath)})()`;
32
+ } else {
33
+ code = `(${sanitizedPublicPath}())`;
34
+ }
35
+ const base64Code = Buffer.from(code, 'utf8').toString('base64');
36
+ const dataUrl = `data:text/javascript;base64,${base64Code}`;
37
+ compiler.hooks.afterPlugins.tap('VmokRemoteEntryPlugin', ()=>{
38
+ new compiler.webpack.EntryPlugin(compiler.context, dataUrl, {
39
+ name: name
40
+ }).apply(compiler);
41
+ });
42
+ }
43
+ apply(compiler) {
44
+ const { name, getPublicPath } = this._options;
45
+ if (!getPublicPath || !name) {
46
+ return;
47
+ }
48
+ const containerManager = new ContainerManager();
49
+ containerManager.init(this._options);
50
+ if (!containerManager.enable) {
51
+ logger.warn("Detect you don't set exposes, 'getPublicPath' will not have effect.");
52
+ return;
53
+ }
54
+ RemoteEntryPlugin.addPublicPathEntry(compiler, getPublicPath, name);
55
+ }
56
+ constructor(options){
57
+ this.name = 'VmokRemoteEntryPlugin';
58
+ this._options = options;
59
+ }
60
+ }
61
+
62
+ export { RemoteEntryPlugin };
@@ -0,0 +1,13 @@
1
+ import type { Compiler, RspackPluginInstance } from '@rspack/core';
2
+ import type { moduleFederationPlugin } from '@module-federation/sdk';
3
+ export declare const PLUGIN_NAME = "RspackTreeShakingSharedPlugin";
4
+ export interface TreeShakingSharedPluginOptions {
5
+ mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
6
+ secondary?: boolean;
7
+ }
8
+ export declare class TreeShakingSharedPlugin implements RspackPluginInstance {
9
+ readonly name = "RspackTreeShakingSharedPlugin";
10
+ private _options;
11
+ constructor(options: moduleFederationPlugin.ModuleFederationPluginOptions);
12
+ apply(compiler: Compiler): void;
13
+ }
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
25
+ })();
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ __webpack_require__.r(__webpack_exports__);
42
+ const PLUGIN_NAME = 'RspackTreeShakingSharedPlugin';
43
+ class TreeShakingSharedPlugin {
44
+ apply(compiler) {
45
+ // @ts-expect-error wait rspack release
46
+ new compiler.rspack.sharing.TreeShakingSharedPlugin(this._options).apply(compiler);
47
+ }
48
+ constructor(options){
49
+ this.name = PLUGIN_NAME;
50
+ this._options = options;
51
+ }
52
+ }
53
+
54
+ __webpack_require__.d(__webpack_exports__, {
55
+ TreeShakingSharedPlugin: () => (TreeShakingSharedPlugin)
56
+ }, {
57
+ PLUGIN_NAME: PLUGIN_NAME
58
+ });
59
+
60
+ exports.PLUGIN_NAME = __webpack_exports__.PLUGIN_NAME;
61
+ exports.TreeShakingSharedPlugin = __webpack_exports__.TreeShakingSharedPlugin;
62
+ for(var __rspack_i in __webpack_exports__) {
63
+ if(["PLUGIN_NAME","TreeShakingSharedPlugin"].indexOf(__rspack_i) === -1) {
64
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
65
+ }
66
+ }
67
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,13 @@
1
+ const PLUGIN_NAME = 'RspackTreeShakingSharedPlugin';
2
+ class TreeShakingSharedPlugin {
3
+ apply(compiler) {
4
+ // @ts-expect-error wait rspack release
5
+ new compiler.rspack.sharing.TreeShakingSharedPlugin(this._options).apply(compiler);
6
+ }
7
+ constructor(options){
8
+ this.name = PLUGIN_NAME;
9
+ this._options = options;
10
+ }
11
+ }
12
+
13
+ export { PLUGIN_NAME, TreeShakingSharedPlugin };
@@ -0,0 +1,3 @@
1
+ export { ModuleFederationPlugin, PLUGIN_NAME } from './ModuleFederationPlugin';
2
+ export declare const ContainerPlugin: typeof import("@rspack/core/dist/container/ContainerPlugin").ContainerPlugin;
3
+ export declare const ContainerReferencePlugin: typeof import("@rspack/core/dist/container/ContainerReferencePlugin").ContainerReferencePlugin;
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
25
+ })();
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29
+ })();
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
39
+ })();
40
+ var __webpack_exports__ = {};
41
+ // ESM COMPAT FLAG
42
+ __webpack_require__.r(__webpack_exports__);
43
+
44
+ // EXPORTS
45
+ __webpack_require__.d(__webpack_exports__, {
46
+ ContainerPlugin: () => (/* binding */ ContainerPlugin),
47
+ ContainerReferencePlugin: () => (/* binding */ ContainerReferencePlugin),
48
+ ModuleFederationPlugin: () => (/* reexport */ external_ModuleFederationPlugin_js_namespaceObject.ModuleFederationPlugin),
49
+ PLUGIN_NAME: () => (/* reexport */ external_ModuleFederationPlugin_js_namespaceObject.PLUGIN_NAME)
50
+ });
51
+
52
+ ;// CONCATENATED MODULE: external "./ModuleFederationPlugin.js"
53
+ const external_ModuleFederationPlugin_js_namespaceObject = require("./ModuleFederationPlugin.js");
54
+ ;// CONCATENATED MODULE: external "@rspack/core"
55
+ const core_namespaceObject = require("@rspack/core");
56
+ ;// CONCATENATED MODULE: ./src/index.ts
57
+
58
+
59
+ const ContainerPlugin = core_namespaceObject.container.ContainerPlugin;
60
+ const ContainerReferencePlugin = core_namespaceObject.container.ContainerReferencePlugin;
61
+
62
+ exports.ContainerPlugin = __webpack_exports__.ContainerPlugin;
63
+ exports.ContainerReferencePlugin = __webpack_exports__.ContainerReferencePlugin;
64
+ exports.ModuleFederationPlugin = __webpack_exports__.ModuleFederationPlugin;
65
+ exports.PLUGIN_NAME = __webpack_exports__.PLUGIN_NAME;
66
+ for(var __rspack_i in __webpack_exports__) {
67
+ if(["ContainerPlugin","ContainerReferencePlugin","ModuleFederationPlugin","PLUGIN_NAME"].indexOf(__rspack_i) === -1) {
68
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
69
+ }
70
+ }
71
+ Object.defineProperty(exports, '__esModule', { value: true });