@module-federation/modern-js 0.0.0-next-20250609065828 → 0.0.0-next-20250611085515
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/mfRuntimePlugins/auto-fetch-data.js +4 -2
- package/dist/cjs/cli/ssrPlugin.js +8 -8
- package/dist/esm/cli/mfRuntimePlugins/auto-fetch-data.js +5 -3
- package/dist/esm/cli/ssrPlugin.js +1 -1
- package/dist/esm-node/cli/mfRuntimePlugins/auto-fetch-data.js +4 -2
- package/dist/esm-node/cli/ssrPlugin.js +1 -1
- package/package.json +8 -8
|
@@ -74,10 +74,12 @@ const autoFetchData = () => ({
|
|
|
74
74
|
return args;
|
|
75
75
|
}
|
|
76
76
|
const dataFetchMap = (0, import_utils.getDataFetchMap)();
|
|
77
|
-
const
|
|
77
|
+
const hasSSRAsset = Boolean(remoteSnapshot.ssrRemoteEntry);
|
|
78
|
+
const hasDataFetchClient = Boolean(remoteSnapshot.modules.find((module2) => module2.moduleName === `${dataFetchName}${import_constant2.DATA_FETCH_CLIENT_SUFFIX}`));
|
|
79
|
+
const downgradeType = hasDataFetchClient ? import_constant.MF_DATA_FETCH_TYPE.FETCH_CLIENT : hasSSRAsset ? import_constant.MF_DATA_FETCH_TYPE.FETCH_SERVER : import_constant.MF_DATA_FETCH_TYPE.FETCH_CLIENT;
|
|
78
80
|
let finalDataFetchId = dataFetchId;
|
|
79
81
|
if (typeof window !== "undefined") {
|
|
80
|
-
finalDataFetchId = downgradeType === import_constant.MF_DATA_FETCH_TYPE.FETCH_CLIENT ? `${dataFetchId}${import_constant2.DATA_FETCH_CLIENT_SUFFIX}` : dataFetchId;
|
|
82
|
+
finalDataFetchId = downgradeType === import_constant.MF_DATA_FETCH_TYPE.FETCH_CLIENT ? hasDataFetchClient ? `${dataFetchId}${import_constant2.DATA_FETCH_CLIENT_SUFFIX}` : dataFetchId : dataFetchId;
|
|
81
83
|
}
|
|
82
84
|
const getDataFetchGetter = () => (0, import_dataFetch.loadDataFetchModule)(host, finalDataFetchId);
|
|
83
85
|
const dataFetchFnItem = [
|
|
@@ -41,8 +41,8 @@ var import_rspack = require("@module-federation/enhanced/rspack");
|
|
|
41
41
|
var import_universe_entry_chunk_tracker_plugin = __toESM(require("@module-federation/node/universe-entry-chunk-tracker-plugin"));
|
|
42
42
|
var import_logger = __toESM(require("../logger"));
|
|
43
43
|
var import_utils = require("./utils");
|
|
44
|
-
var
|
|
45
|
-
var
|
|
44
|
+
var import_utils2 = require("@module-federation/rsbuild-plugin/utils");
|
|
45
|
+
var import_utils3 = require("./utils");
|
|
46
46
|
function setEnv() {
|
|
47
47
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
48
48
|
process.env["MF_SSR_PRJ"] = "true";
|
|
@@ -63,10 +63,10 @@ const mfSSRRsbuildPlugin = (pluginOptions) => {
|
|
|
63
63
|
let ssrEnv = "";
|
|
64
64
|
api.modifyEnvironmentConfig((config, { name }) => {
|
|
65
65
|
const target = config.output.target;
|
|
66
|
-
if ((0,
|
|
66
|
+
if ((0, import_utils3.skipByTarget)(target)) {
|
|
67
67
|
return config;
|
|
68
68
|
}
|
|
69
|
-
if ((0,
|
|
69
|
+
if ((0, import_utils3.isWebTarget)(target)) {
|
|
70
70
|
csrOutputPath = config.output.distPath.root;
|
|
71
71
|
} else {
|
|
72
72
|
ssrOutputPath = config.output.distPath.root;
|
|
@@ -149,12 +149,12 @@ const moduleFederationSSRPlugin = (pluginOptions) => ({
|
|
|
149
149
|
}
|
|
150
150
|
api.modifyBundlerChain((chain) => {
|
|
151
151
|
const target = chain.get("target");
|
|
152
|
-
if ((0,
|
|
152
|
+
if ((0, import_utils3.skipByTarget)(target)) {
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
const bundlerType = api.getAppContext().bundlerType === "rspack" ? "rspack" : "webpack";
|
|
156
156
|
const MFPlugin = bundlerType === "webpack" ? import_webpack.ModuleFederationPlugin : import_rspack.ModuleFederationPlugin;
|
|
157
|
-
const isWeb = (0,
|
|
157
|
+
const isWeb = (0, import_utils3.isWebTarget)(target);
|
|
158
158
|
if (!isWeb) {
|
|
159
159
|
if (!chain.plugins.has(CHAIN_MF_PLUGIN_ID)) {
|
|
160
160
|
chain.plugin(CHAIN_MF_PLUGIN_ID).use(MFPlugin, [
|
|
@@ -219,11 +219,11 @@ const moduleFederationSSRPlugin = (pluginOptions) => ({
|
|
|
219
219
|
});
|
|
220
220
|
api.onAfterBuild(() => {
|
|
221
221
|
const { nodePlugin, browserPlugin, distOutputDir } = pluginOptions;
|
|
222
|
-
(0,
|
|
222
|
+
(0, import_utils2.updateStatsAndManifest)(nodePlugin, browserPlugin, distOutputDir);
|
|
223
223
|
});
|
|
224
224
|
api.onDevCompileDone(() => {
|
|
225
225
|
const { nodePlugin, browserPlugin, distOutputDir } = pluginOptions;
|
|
226
|
-
(0,
|
|
226
|
+
(0, import_utils2.updateStatsAndManifest)(nodePlugin, browserPlugin, distOutputDir);
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
});
|
|
@@ -42,12 +42,14 @@ var autoFetchData = function() {
|
|
|
42
42
|
return args;
|
|
43
43
|
}
|
|
44
44
|
var dataFetchMap = getDataFetchMap();
|
|
45
|
-
var
|
|
45
|
+
var hasSSRAsset = Boolean(remoteSnapshot.ssrRemoteEntry);
|
|
46
|
+
var hasDataFetchClient = Boolean(remoteSnapshot.modules.find(function(module) {
|
|
46
47
|
return module.moduleName === "".concat(dataFetchName).concat(DATA_FETCH_CLIENT_SUFFIX);
|
|
47
|
-
})
|
|
48
|
+
}));
|
|
49
|
+
var downgradeType = hasDataFetchClient ? MF_DATA_FETCH_TYPE.FETCH_CLIENT : hasSSRAsset ? MF_DATA_FETCH_TYPE.FETCH_SERVER : MF_DATA_FETCH_TYPE.FETCH_CLIENT;
|
|
48
50
|
var finalDataFetchId = dataFetchId;
|
|
49
51
|
if (typeof window !== "undefined") {
|
|
50
|
-
finalDataFetchId = downgradeType === MF_DATA_FETCH_TYPE.FETCH_CLIENT ? "".concat(dataFetchId).concat(DATA_FETCH_CLIENT_SUFFIX) : dataFetchId;
|
|
52
|
+
finalDataFetchId = downgradeType === MF_DATA_FETCH_TYPE.FETCH_CLIENT ? hasDataFetchClient ? "".concat(dataFetchId).concat(DATA_FETCH_CLIENT_SUFFIX) : dataFetchId : dataFetchId;
|
|
51
53
|
}
|
|
52
54
|
var getDataFetchGetter = function() {
|
|
53
55
|
return loadDataFetchModule(host, finalDataFetchId);
|
|
@@ -8,7 +8,7 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
|
|
|
8
8
|
import UniverseEntryChunkTrackerPlugin from "@module-federation/node/universe-entry-chunk-tracker-plugin";
|
|
9
9
|
import logger from "../logger";
|
|
10
10
|
import { isDev } from "./utils";
|
|
11
|
-
import { updateStatsAndManifest } from "@module-federation/rsbuild-plugin/
|
|
11
|
+
import { updateStatsAndManifest } from "@module-federation/rsbuild-plugin/utils";
|
|
12
12
|
import { isWebTarget, skipByTarget } from "./utils";
|
|
13
13
|
function setEnv() {
|
|
14
14
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
|
@@ -41,10 +41,12 @@ const autoFetchData = () => ({
|
|
|
41
41
|
return args;
|
|
42
42
|
}
|
|
43
43
|
const dataFetchMap = getDataFetchMap();
|
|
44
|
-
const
|
|
44
|
+
const hasSSRAsset = Boolean(remoteSnapshot.ssrRemoteEntry);
|
|
45
|
+
const hasDataFetchClient = Boolean(remoteSnapshot.modules.find((module) => module.moduleName === `${dataFetchName}${DATA_FETCH_CLIENT_SUFFIX}`));
|
|
46
|
+
const downgradeType = hasDataFetchClient ? MF_DATA_FETCH_TYPE.FETCH_CLIENT : hasSSRAsset ? MF_DATA_FETCH_TYPE.FETCH_SERVER : MF_DATA_FETCH_TYPE.FETCH_CLIENT;
|
|
45
47
|
let finalDataFetchId = dataFetchId;
|
|
46
48
|
if (typeof window !== "undefined") {
|
|
47
|
-
finalDataFetchId = downgradeType === MF_DATA_FETCH_TYPE.FETCH_CLIENT ? `${dataFetchId}${DATA_FETCH_CLIENT_SUFFIX}` : dataFetchId;
|
|
49
|
+
finalDataFetchId = downgradeType === MF_DATA_FETCH_TYPE.FETCH_CLIENT ? hasDataFetchClient ? `${dataFetchId}${DATA_FETCH_CLIENT_SUFFIX}` : dataFetchId : dataFetchId;
|
|
48
50
|
}
|
|
49
51
|
const getDataFetchGetter = () => loadDataFetchModule(host, finalDataFetchId);
|
|
50
52
|
const dataFetchFnItem = [
|
|
@@ -5,7 +5,7 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
|
|
|
5
5
|
import UniverseEntryChunkTrackerPlugin from "@module-federation/node/universe-entry-chunk-tracker-plugin";
|
|
6
6
|
import logger from "../logger";
|
|
7
7
|
import { isDev } from "./utils";
|
|
8
|
-
import { updateStatsAndManifest } from "@module-federation/rsbuild-plugin/
|
|
8
|
+
import { updateStatsAndManifest } from "@module-federation/rsbuild-plugin/utils";
|
|
9
9
|
import { isWebTarget, skipByTarget } from "./utils";
|
|
10
10
|
function setEnv() {
|
|
11
11
|
process.env["MF_DISABLE_EMIT_STATS"] = "true";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250611085515",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -120,12 +120,12 @@
|
|
|
120
120
|
"@swc/helpers": "^0.5.17",
|
|
121
121
|
"node-fetch": "~3.3.0",
|
|
122
122
|
"react-error-boundary": "4.1.2",
|
|
123
|
-
"@module-federation/rsbuild-plugin": "0.0.0-next-
|
|
124
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
125
|
-
"@module-federation/runtime": "0.0.0-next-
|
|
126
|
-
"@module-federation/node": "0.0.0-next-
|
|
127
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
128
|
-
"@module-federation/cli": "0.0.0-next-
|
|
123
|
+
"@module-federation/rsbuild-plugin": "0.0.0-next-20250611085515",
|
|
124
|
+
"@module-federation/enhanced": "0.0.0-next-20250611085515",
|
|
125
|
+
"@module-federation/runtime": "0.0.0-next-20250611085515",
|
|
126
|
+
"@module-federation/node": "0.0.0-next-20250611085515",
|
|
127
|
+
"@module-federation/sdk": "0.0.0-next-20250611085515",
|
|
128
|
+
"@module-federation/cli": "0.0.0-next-20250611085515"
|
|
129
129
|
},
|
|
130
130
|
"devDependencies": {
|
|
131
131
|
"@modern-js/core": "2.67.5",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@modern-js/module-tools": "2.67.6",
|
|
136
136
|
"@modern-js/runtime": "2.67.6",
|
|
137
137
|
"@modern-js/tsconfig": "2.67.6",
|
|
138
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
138
|
+
"@module-federation/manifest": "0.0.0-next-20250611085515"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|
|
141
141
|
"react": ">=17",
|