@module-federation/modern-js 0.0.0-refactor-manifest-20251016072532 → 0.0.0-refactor-manifest-20251017070814
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/cjs/cli/configPlugin.js +0 -12
- package/dist/cjs/cli/index.js +1 -0
- package/dist/cjs/cli/ssrPlugin.js +3 -3
- package/dist/esm/cli/configPlugin.js +0 -12
- package/dist/esm/cli/index.js +1 -0
- package/dist/esm/cli/ssrPlugin.js +3 -3
- package/dist/esm-node/cli/configPlugin.js +0 -12
- package/dist/esm-node/cli/index.js +1 -0
- package/dist/esm-node/cli/ssrPlugin.js +3 -3
- package/dist/types/types/index.d.ts +8 -0
- package/package.json +9 -9
|
@@ -40,7 +40,6 @@ __export(configPlugin_exports, {
|
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(configPlugin_exports);
|
|
42
42
|
var import_path = __toESM(require("path"));
|
|
43
|
-
var import_fs = __toESM(require("fs"));
|
|
44
43
|
var import_utils = require("./utils");
|
|
45
44
|
var import_sdk = require("@module-federation/sdk");
|
|
46
45
|
var import_node_bundle_require = require("@modern-js/node-bundle-require");
|
|
@@ -153,17 +152,6 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
|
|
|
153
152
|
const runtimePlugins = [
|
|
154
153
|
...mfConfig.runtimePlugins || []
|
|
155
154
|
];
|
|
156
|
-
try {
|
|
157
|
-
const nodeModulesPath = import_path.default.resolve(process.cwd(), "node_modules");
|
|
158
|
-
const bridgeReactPath = import_path.default.join(nodeModulesPath, "@module-federation/bridge-react");
|
|
159
|
-
if (import_fs.default.existsSync(bridgeReactPath) && (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.bridge) || !mfConfig.bridge.disableAlias)) {
|
|
160
|
-
mfConfig.bridge = {
|
|
161
|
-
disableAlias: true
|
|
162
|
-
};
|
|
163
|
-
import_logger.default.debug(`${import_constant.PLUGIN_IDENTIFIER} use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !`);
|
|
164
|
-
}
|
|
165
|
-
} catch (e) {
|
|
166
|
-
}
|
|
167
155
|
patchDTSConfig(mfConfig, isServer);
|
|
168
156
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
169
157
|
if (enableSSR && (0, import_utils3.isDev)()) {
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -41,6 +41,7 @@ const moduleFederationPlugin = (userConfig = {}) => {
|
|
|
41
41
|
originPluginOptions: userConfig,
|
|
42
42
|
remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
|
|
43
43
|
userConfig: userConfig || {},
|
|
44
|
+
assetFileNames: {},
|
|
44
45
|
fetchServerQuery: (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) !== null && _userConfig_fetchServerQuery !== void 0 ? _userConfig_fetchServerQuery : void 0
|
|
45
46
|
};
|
|
46
47
|
return {
|
|
@@ -74,7 +74,7 @@ const mfSSRRsbuildPlugin = (pluginOptions) => {
|
|
|
74
74
|
"@modern-js/builder-plugin-ssr"
|
|
75
75
|
],
|
|
76
76
|
setup(api) {
|
|
77
|
-
var _pluginOptions_csrConfig, _pluginOptions_ssrConfig;
|
|
77
|
+
var _pluginOptions_csrConfig, _pluginOptions_assetFileNames, _pluginOptions_ssrConfig;
|
|
78
78
|
if (pluginOptions.csrConfig.getPublicPath) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
@@ -82,8 +82,8 @@ const mfSSRRsbuildPlugin = (pluginOptions) => {
|
|
|
82
82
|
let ssrOutputPath = "";
|
|
83
83
|
let ssrEnv = "";
|
|
84
84
|
let csrEnv = "";
|
|
85
|
-
const browserAssetFileNames = getManifestAssetFileNames((_pluginOptions_csrConfig = pluginOptions.csrConfig) === null || _pluginOptions_csrConfig === void 0 ? void 0 : _pluginOptions_csrConfig.manifest);
|
|
86
|
-
const nodeAssetFileNames = getManifestAssetFileNames((_pluginOptions_ssrConfig = pluginOptions.ssrConfig) === null || _pluginOptions_ssrConfig === void 0 ? void 0 : _pluginOptions_ssrConfig.manifest);
|
|
85
|
+
const browserAssetFileNames = pluginOptions.assetFileNames.browser || getManifestAssetFileNames((_pluginOptions_csrConfig = pluginOptions.csrConfig) === null || _pluginOptions_csrConfig === void 0 ? void 0 : _pluginOptions_csrConfig.manifest);
|
|
86
|
+
const nodeAssetFileNames = ((_pluginOptions_assetFileNames = pluginOptions.assetFileNames) === null || _pluginOptions_assetFileNames === void 0 ? void 0 : _pluginOptions_assetFileNames.node) || getManifestAssetFileNames((_pluginOptions_ssrConfig = pluginOptions.ssrConfig) === null || _pluginOptions_ssrConfig === void 0 ? void 0 : _pluginOptions_ssrConfig.manifest);
|
|
87
87
|
const collectAssets = (assets, fileNames, tag) => {
|
|
88
88
|
const statsAsset = assets[fileNames.statsFileName];
|
|
89
89
|
const manifestAsset = assets[fileNames.manifestFileName];
|
|
@@ -5,7 +5,6 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
|
5
5
|
import { _ as _type_of } from "@swc/helpers/_/_type_of";
|
|
6
6
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
7
|
import path from "path";
|
|
8
|
-
import fs from "fs";
|
|
9
8
|
import { getIPV4, isWebTarget, skipByTarget } from "./utils";
|
|
10
9
|
import { encodeName } from "@module-federation/sdk";
|
|
11
10
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
@@ -143,17 +142,6 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy, enableSSR) {
|
|
|
143
142
|
throw new Error("".concat(PLUGIN_IDENTIFIER, " mfConfig.name can not be empty!"));
|
|
144
143
|
}
|
|
145
144
|
var runtimePlugins = _to_consumable_array(mfConfig.runtimePlugins || []);
|
|
146
|
-
try {
|
|
147
|
-
var nodeModulesPath = path.resolve(process.cwd(), "node_modules");
|
|
148
|
-
var bridgeReactPath = path.join(nodeModulesPath, "@module-federation/bridge-react");
|
|
149
|
-
if (fs.existsSync(bridgeReactPath) && (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.bridge) || !mfConfig.bridge.disableAlias)) {
|
|
150
|
-
mfConfig.bridge = {
|
|
151
|
-
disableAlias: true
|
|
152
|
-
};
|
|
153
|
-
logger.debug("".concat(PLUGIN_IDENTIFIER, ' use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !'));
|
|
154
|
-
}
|
|
155
|
-
} catch (e) {
|
|
156
|
-
}
|
|
157
145
|
patchDTSConfig(mfConfig, isServer);
|
|
158
146
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
159
147
|
if (enableSSR && isDev()) {
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var moduleFederationPlugin = function() {
|
|
|
19
19
|
originPluginOptions: userConfig,
|
|
20
20
|
remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
|
|
21
21
|
userConfig: userConfig || {},
|
|
22
|
+
assetFileNames: {},
|
|
22
23
|
fetchServerQuery: (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) !== null && _userConfig_fetchServerQuery !== void 0 ? _userConfig_fetchServerQuery : void 0
|
|
23
24
|
};
|
|
24
25
|
return {
|
|
@@ -46,7 +46,7 @@ var mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
|
46
46
|
"@modern-js/builder-plugin-ssr"
|
|
47
47
|
],
|
|
48
48
|
setup: function setup(api) {
|
|
49
|
-
var _pluginOptions_csrConfig, _pluginOptions_ssrConfig;
|
|
49
|
+
var _pluginOptions_csrConfig, _pluginOptions_assetFileNames, _pluginOptions_ssrConfig;
|
|
50
50
|
if (pluginOptions.csrConfig.getPublicPath) {
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
@@ -54,8 +54,8 @@ var mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
|
54
54
|
var ssrOutputPath = "";
|
|
55
55
|
var ssrEnv = "";
|
|
56
56
|
var csrEnv = "";
|
|
57
|
-
var browserAssetFileNames = getManifestAssetFileNames((_pluginOptions_csrConfig = pluginOptions.csrConfig) === null || _pluginOptions_csrConfig === void 0 ? void 0 : _pluginOptions_csrConfig.manifest);
|
|
58
|
-
var nodeAssetFileNames = getManifestAssetFileNames((_pluginOptions_ssrConfig = pluginOptions.ssrConfig) === null || _pluginOptions_ssrConfig === void 0 ? void 0 : _pluginOptions_ssrConfig.manifest);
|
|
57
|
+
var browserAssetFileNames = pluginOptions.assetFileNames.browser || getManifestAssetFileNames((_pluginOptions_csrConfig = pluginOptions.csrConfig) === null || _pluginOptions_csrConfig === void 0 ? void 0 : _pluginOptions_csrConfig.manifest);
|
|
58
|
+
var nodeAssetFileNames = ((_pluginOptions_assetFileNames = pluginOptions.assetFileNames) === null || _pluginOptions_assetFileNames === void 0 ? void 0 : _pluginOptions_assetFileNames.node) || getManifestAssetFileNames((_pluginOptions_ssrConfig = pluginOptions.ssrConfig) === null || _pluginOptions_ssrConfig === void 0 ? void 0 : _pluginOptions_ssrConfig.manifest);
|
|
59
59
|
var collectAssets = function(assets, fileNames, tag) {
|
|
60
60
|
var statsAsset = assets[fileNames.statsFileName];
|
|
61
61
|
var manifestAsset = assets[fileNames.manifestFileName];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
2
|
import { getIPV4, isWebTarget, skipByTarget } from "./utils";
|
|
4
3
|
import { encodeName } from "@module-federation/sdk";
|
|
5
4
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
@@ -112,17 +111,6 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
|
|
|
112
111
|
const runtimePlugins = [
|
|
113
112
|
...mfConfig.runtimePlugins || []
|
|
114
113
|
];
|
|
115
|
-
try {
|
|
116
|
-
const nodeModulesPath = path.resolve(process.cwd(), "node_modules");
|
|
117
|
-
const bridgeReactPath = path.join(nodeModulesPath, "@module-federation/bridge-react");
|
|
118
|
-
if (fs.existsSync(bridgeReactPath) && (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.bridge) || !mfConfig.bridge.disableAlias)) {
|
|
119
|
-
mfConfig.bridge = {
|
|
120
|
-
disableAlias: true
|
|
121
|
-
};
|
|
122
|
-
logger.debug(`${PLUGIN_IDENTIFIER} use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !`);
|
|
123
|
-
}
|
|
124
|
-
} catch (e) {
|
|
125
|
-
}
|
|
126
114
|
patchDTSConfig(mfConfig, isServer);
|
|
127
115
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
128
116
|
if (enableSSR && isDev()) {
|
|
@@ -15,6 +15,7 @@ const moduleFederationPlugin = (userConfig = {}) => {
|
|
|
15
15
|
originPluginOptions: userConfig,
|
|
16
16
|
remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
|
|
17
17
|
userConfig: userConfig || {},
|
|
18
|
+
assetFileNames: {},
|
|
18
19
|
fetchServerQuery: (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) !== null && _userConfig_fetchServerQuery !== void 0 ? _userConfig_fetchServerQuery : void 0
|
|
19
20
|
};
|
|
20
21
|
return {
|
|
@@ -38,7 +38,7 @@ const mfSSRRsbuildPlugin = (pluginOptions) => {
|
|
|
38
38
|
"@modern-js/builder-plugin-ssr"
|
|
39
39
|
],
|
|
40
40
|
setup(api) {
|
|
41
|
-
var _pluginOptions_csrConfig, _pluginOptions_ssrConfig;
|
|
41
|
+
var _pluginOptions_csrConfig, _pluginOptions_assetFileNames, _pluginOptions_ssrConfig;
|
|
42
42
|
if (pluginOptions.csrConfig.getPublicPath) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
@@ -46,8 +46,8 @@ const mfSSRRsbuildPlugin = (pluginOptions) => {
|
|
|
46
46
|
let ssrOutputPath = "";
|
|
47
47
|
let ssrEnv = "";
|
|
48
48
|
let csrEnv = "";
|
|
49
|
-
const browserAssetFileNames = getManifestAssetFileNames((_pluginOptions_csrConfig = pluginOptions.csrConfig) === null || _pluginOptions_csrConfig === void 0 ? void 0 : _pluginOptions_csrConfig.manifest);
|
|
50
|
-
const nodeAssetFileNames = getManifestAssetFileNames((_pluginOptions_ssrConfig = pluginOptions.ssrConfig) === null || _pluginOptions_ssrConfig === void 0 ? void 0 : _pluginOptions_ssrConfig.manifest);
|
|
49
|
+
const browserAssetFileNames = pluginOptions.assetFileNames.browser || getManifestAssetFileNames((_pluginOptions_csrConfig = pluginOptions.csrConfig) === null || _pluginOptions_csrConfig === void 0 ? void 0 : _pluginOptions_csrConfig.manifest);
|
|
50
|
+
const nodeAssetFileNames = ((_pluginOptions_assetFileNames = pluginOptions.assetFileNames) === null || _pluginOptions_assetFileNames === void 0 ? void 0 : _pluginOptions_assetFileNames.node) || getManifestAssetFileNames((_pluginOptions_ssrConfig = pluginOptions.ssrConfig) === null || _pluginOptions_ssrConfig === void 0 ? void 0 : _pluginOptions_ssrConfig.manifest);
|
|
51
51
|
const collectAssets = (assets, fileNames, tag) => {
|
|
52
52
|
const statsAsset = assets[fileNames.statsFileName];
|
|
53
53
|
const manifestAsset = assets[fileNames.manifestFileName];
|
|
@@ -9,6 +9,10 @@ export interface PluginOptions {
|
|
|
9
9
|
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
10
10
|
fetchServerQuery?: Record<string, unknown>;
|
|
11
11
|
}
|
|
12
|
+
export type AssetFileNames = {
|
|
13
|
+
statsFileName: string;
|
|
14
|
+
manifestFileName: string;
|
|
15
|
+
};
|
|
12
16
|
export interface InternalModernPluginOptions {
|
|
13
17
|
csrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
14
18
|
ssrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
@@ -16,6 +20,10 @@ export interface InternalModernPluginOptions {
|
|
|
16
20
|
originPluginOptions: PluginOptions;
|
|
17
21
|
browserPlugin?: BundlerPlugin;
|
|
18
22
|
nodePlugin?: BundlerPlugin;
|
|
23
|
+
assetFileNames: {
|
|
24
|
+
node?: AssetFileNames;
|
|
25
|
+
browser?: AssetFileNames;
|
|
26
|
+
};
|
|
19
27
|
assetResources: {
|
|
20
28
|
browser?: StatsAssetResource;
|
|
21
29
|
node?: StatsAssetResource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-refactor-manifest-
|
|
3
|
+
"version": "0.0.0-refactor-manifest-20251017070814",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -119,13 +119,13 @@
|
|
|
119
119
|
"@swc/helpers": "^0.5.17",
|
|
120
120
|
"node-fetch": "~3.3.0",
|
|
121
121
|
"react-error-boundary": "4.1.2",
|
|
122
|
-
"@module-federation/
|
|
123
|
-
"@module-federation/runtime": "0.0.0-refactor-manifest-
|
|
124
|
-
"@module-federation/enhanced": "0.0.0-refactor-manifest-
|
|
125
|
-
"@module-federation/
|
|
126
|
-
"@module-federation/
|
|
127
|
-
"@module-federation/
|
|
128
|
-
"@module-federation/
|
|
122
|
+
"@module-federation/rsbuild-plugin": "0.0.0-refactor-manifest-20251017070814",
|
|
123
|
+
"@module-federation/runtime": "0.0.0-refactor-manifest-20251017070814",
|
|
124
|
+
"@module-federation/enhanced": "0.0.0-refactor-manifest-20251017070814",
|
|
125
|
+
"@module-federation/node": "0.0.0-refactor-manifest-20251017070814",
|
|
126
|
+
"@module-federation/sdk": "0.0.0-refactor-manifest-20251017070814",
|
|
127
|
+
"@module-federation/cli": "0.0.0-refactor-manifest-20251017070814",
|
|
128
|
+
"@module-federation/bridge-react": "0.0.0-refactor-manifest-20251017070814"
|
|
129
129
|
},
|
|
130
130
|
"devDependencies": {
|
|
131
131
|
"@modern-js/core": "2.68.2",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"@modern-js/tsconfig": "2.68.2",
|
|
138
138
|
"@types/react": "^18.3.11",
|
|
139
139
|
"@types/react-dom": "^18.3.0",
|
|
140
|
-
"@module-federation/manifest": "0.0.0-refactor-manifest-
|
|
140
|
+
"@module-federation/manifest": "0.0.0-refactor-manifest-20251017070814"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
143
|
"react": ">=17",
|