@module-federation/rsbuild-plugin 0.0.0-next-20241224092514 → 0.0.0-next-20241224132836
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.
- package/dist/index.cjs.js +13 -8
- package/dist/index.esm.js +13 -8
- package/dist/src/cli/index.d.ts +2 -2
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -122,6 +122,11 @@ var LIB_FORMAT = [
|
|
|
122
122
|
'umd',
|
|
123
123
|
'modern-module'
|
|
124
124
|
];
|
|
125
|
+
function isMFFormat(bundlerConfig) {
|
|
126
|
+
var _bundlerConfig_output;
|
|
127
|
+
var library = (_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.library;
|
|
128
|
+
return !((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && LIB_FORMAT.includes(library.type));
|
|
129
|
+
}
|
|
125
130
|
var pluginModuleFederation = function(moduleFederationOptions) {
|
|
126
131
|
return {
|
|
127
132
|
name: RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
|
|
@@ -144,14 +149,14 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
144
149
|
});
|
|
145
150
|
api.onBeforeCreateCompiler(function(param) {
|
|
146
151
|
var bundlerConfigs = param.bundlerConfigs;
|
|
152
|
+
if (!bundlerConfigs) {
|
|
153
|
+
throw new Error('Can not get bundlerConfigs!');
|
|
154
|
+
}
|
|
147
155
|
bundlerConfigs.forEach(function(bundlerConfig) {
|
|
148
|
-
|
|
149
|
-
var library = (_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.library;
|
|
150
|
-
// lib format
|
|
151
|
-
if ((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && LIB_FORMAT.includes(library.type)) {
|
|
156
|
+
if (!isMFFormat(bundlerConfig)) {
|
|
152
157
|
return;
|
|
153
158
|
} else {
|
|
154
|
-
var
|
|
159
|
+
var _bundlerConfig_output, _bundlerConfig_output1;
|
|
155
160
|
// mf
|
|
156
161
|
utils.autoDeleteSplitChunkCacheGroups(moduleFederationOptions, bundlerConfig);
|
|
157
162
|
var externals = bundlerConfig.externals;
|
|
@@ -211,11 +216,11 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
211
216
|
}
|
|
212
217
|
}
|
|
213
218
|
}
|
|
214
|
-
if (!((
|
|
219
|
+
if (!((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.chunkLoadingGlobal)) {
|
|
215
220
|
bundlerConfig.output.chunkLoadingGlobal = 'jsonp';
|
|
216
221
|
}
|
|
217
222
|
// `uniqueName` is required for react refresh to work
|
|
218
|
-
if (!((
|
|
223
|
+
if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.uniqueName)) {
|
|
219
224
|
bundlerConfig.output.uniqueName = moduleFederationOptions.name;
|
|
220
225
|
}
|
|
221
226
|
if (!bundlerConfig.plugins.find(function(p) {
|
|
@@ -266,7 +271,7 @@ Object.defineProperty(exports, "PLUGIN_NAME", {
|
|
|
266
271
|
enumerable: true,
|
|
267
272
|
get: function () { return rspack.PLUGIN_NAME; }
|
|
268
273
|
});
|
|
269
|
-
exports.LIB_FORMAT = LIB_FORMAT;
|
|
270
274
|
exports.RSBUILD_PLUGIN_MODULE_FEDERATION_NAME = RSBUILD_PLUGIN_MODULE_FEDERATION_NAME;
|
|
271
275
|
exports.RSPACK_PLUGIN_MODULE_FEDERATION_NAME = RSPACK_PLUGIN_MODULE_FEDERATION_NAME;
|
|
276
|
+
exports.isMFFormat = isMFFormat;
|
|
272
277
|
exports.pluginModuleFederation = pluginModuleFederation;
|
package/dist/index.esm.js
CHANGED
|
@@ -121,6 +121,11 @@ var LIB_FORMAT = [
|
|
|
121
121
|
'umd',
|
|
122
122
|
'modern-module'
|
|
123
123
|
];
|
|
124
|
+
function isMFFormat(bundlerConfig) {
|
|
125
|
+
var _bundlerConfig_output;
|
|
126
|
+
var library = (_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.library;
|
|
127
|
+
return !((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && LIB_FORMAT.includes(library.type));
|
|
128
|
+
}
|
|
124
129
|
var pluginModuleFederation = function(moduleFederationOptions) {
|
|
125
130
|
return {
|
|
126
131
|
name: RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
|
|
@@ -143,14 +148,14 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
143
148
|
});
|
|
144
149
|
api.onBeforeCreateCompiler(function(param) {
|
|
145
150
|
var bundlerConfigs = param.bundlerConfigs;
|
|
151
|
+
if (!bundlerConfigs) {
|
|
152
|
+
throw new Error('Can not get bundlerConfigs!');
|
|
153
|
+
}
|
|
146
154
|
bundlerConfigs.forEach(function(bundlerConfig) {
|
|
147
|
-
|
|
148
|
-
var library = (_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.library;
|
|
149
|
-
// lib format
|
|
150
|
-
if ((typeof library === "undefined" ? "undefined" : _type_of(library)) === 'object' && !Array.isArray(library) && 'type' in library && LIB_FORMAT.includes(library.type)) {
|
|
155
|
+
if (!isMFFormat(bundlerConfig)) {
|
|
151
156
|
return;
|
|
152
157
|
} else {
|
|
153
|
-
var
|
|
158
|
+
var _bundlerConfig_output, _bundlerConfig_output1;
|
|
154
159
|
// mf
|
|
155
160
|
autoDeleteSplitChunkCacheGroups(moduleFederationOptions, bundlerConfig);
|
|
156
161
|
var externals = bundlerConfig.externals;
|
|
@@ -210,11 +215,11 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
210
215
|
}
|
|
211
216
|
}
|
|
212
217
|
}
|
|
213
|
-
if (!((
|
|
218
|
+
if (!((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.chunkLoadingGlobal)) {
|
|
214
219
|
bundlerConfig.output.chunkLoadingGlobal = 'jsonp';
|
|
215
220
|
}
|
|
216
221
|
// `uniqueName` is required for react refresh to work
|
|
217
|
-
if (!((
|
|
222
|
+
if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.uniqueName)) {
|
|
218
223
|
bundlerConfig.output.uniqueName = moduleFederationOptions.name;
|
|
219
224
|
}
|
|
220
225
|
if (!bundlerConfig.plugins.find(function(p) {
|
|
@@ -261,4 +266,4 @@ var pluginModuleFederation = function(moduleFederationOptions) {
|
|
|
261
266
|
};
|
|
262
267
|
};
|
|
263
268
|
|
|
264
|
-
export {
|
|
269
|
+
export { RSBUILD_PLUGIN_MODULE_FEDERATION_NAME, RSPACK_PLUGIN_MODULE_FEDERATION_NAME, isMFFormat, pluginModuleFederation };
|
package/dist/src/cli/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PLUGIN_NAME } from '@module-federation/enhanced/rspack';
|
|
2
2
|
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
|
-
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
3
|
+
import type { RsbuildPlugin, Rspack } from '@rsbuild/core';
|
|
4
4
|
type ModuleFederationOptions = moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
5
5
|
declare const RSBUILD_PLUGIN_MODULE_FEDERATION_NAME = "rsbuild:module-federation-enhanced";
|
|
6
6
|
declare const RSPACK_PLUGIN_MODULE_FEDERATION_NAME = "module-federation";
|
|
7
7
|
export { RSBUILD_PLUGIN_MODULE_FEDERATION_NAME, RSPACK_PLUGIN_MODULE_FEDERATION_NAME, PLUGIN_NAME, };
|
|
8
|
-
export declare
|
|
8
|
+
export declare function isMFFormat(bundlerConfig: Rspack.Configuration): boolean;
|
|
9
9
|
export declare const pluginModuleFederation: (moduleFederationOptions: ModuleFederationOptions) => RsbuildPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/rsbuild-plugin",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20241224132836",
|
|
4
4
|
"description": "Module Federation plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://module-federation.io",
|
|
6
6
|
"bugs": {
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
43
|
+
"@module-federation/sdk": "0.0.0-next-20241224132836"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@rsbuild/core": "^1.0.19"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@rsbuild/core": "1.x",
|
|
50
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
50
|
+
"@module-federation/enhanced": "0.0.0-next-20241224132836"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=16.0.0"
|