@module-federation/modern-js 0.0.0-next-20250325025859 → 0.0.0-next-20250327052500
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/correct-ssr-public-path.js +49 -0
- package/dist/cjs/cli/utils.js +1 -0
- package/dist/cjs/cli/utils.spec.js +2 -1
- package/dist/esm/cli/mfRuntimePlugins/correct-ssr-public-path.js +31 -0
- package/dist/esm/cli/utils.js +1 -0
- package/dist/esm/cli/utils.spec.js +2 -1
- package/dist/esm-node/cli/mfRuntimePlugins/correct-ssr-public-path.js +29 -0
- package/dist/esm-node/cli/utils.js +1 -0
- package/dist/esm-node/cli/utils.spec.js +2 -1
- package/dist/types/cli/mfRuntimePlugins/correct-ssr-public-path.d.ts +3 -0
- package/package.json +15 -7
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var correct_ssr_public_path_exports = {};
|
|
20
|
+
__export(correct_ssr_public_path_exports, {
|
|
21
|
+
default: () => correct_ssr_public_path_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(correct_ssr_public_path_exports);
|
|
24
|
+
var import_runtime_core = require("@module-federation/enhanced/runtime-core");
|
|
25
|
+
const correctSsrPublicPathPlugin = () => ({
|
|
26
|
+
name: "inject-node-fetch-plugin",
|
|
27
|
+
beforeInit(args) {
|
|
28
|
+
const { options } = args;
|
|
29
|
+
if (typeof window !== "undefined" || !options.version) {
|
|
30
|
+
return args;
|
|
31
|
+
}
|
|
32
|
+
if (typeof __webpack_require__ !== "undefined" && __webpack_require__.p) {
|
|
33
|
+
const publicPath = __webpack_require__.p;
|
|
34
|
+
const snapshot = (0, import_runtime_core.getGlobalSnapshotInfoByModuleInfo)({
|
|
35
|
+
version: options.version,
|
|
36
|
+
name: options.name
|
|
37
|
+
});
|
|
38
|
+
if (!snapshot || !("ssrRemoteEntry" in snapshot) || !snapshot.ssrRemoteEntry) {
|
|
39
|
+
return args;
|
|
40
|
+
}
|
|
41
|
+
const ssrPath = snapshot.ssrRemoteEntry.split("/").slice(0, -1).join("/") + "/";
|
|
42
|
+
if (publicPath.endsWith(ssrPath)) {
|
|
43
|
+
__webpack_require__.p = publicPath + ssrPath;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return args;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var correct_ssr_public_path_default = correctSsrPublicPathPlugin;
|
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -148,6 +148,7 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
|
|
|
148
148
|
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
149
149
|
}
|
|
150
150
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
151
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/correct-ssr-public-path"), runtimePlugins);
|
|
151
152
|
if (!mfConfig.library) {
|
|
152
153
|
mfConfig.library = {
|
|
153
154
|
type: "commonjs-module",
|
|
@@ -61,7 +61,8 @@ const mfConfig = {
|
|
|
61
61
|
runtimePlugins: [
|
|
62
62
|
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
63
63
|
require.resolve("@module-federation/node/runtimePlugin"),
|
|
64
|
-
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
64
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch"),
|
|
65
|
+
require.resolve("@module-federation/modern-js/correct-ssr-public-path")
|
|
65
66
|
],
|
|
66
67
|
shared: {
|
|
67
68
|
react: {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getGlobalSnapshotInfoByModuleInfo } from "@module-federation/enhanced/runtime-core";
|
|
2
|
+
var correctSsrPublicPathPlugin = function() {
|
|
3
|
+
return {
|
|
4
|
+
name: "inject-node-fetch-plugin",
|
|
5
|
+
beforeInit: function beforeInit(args) {
|
|
6
|
+
var options = args.options;
|
|
7
|
+
if (typeof window !== "undefined" || !options.version) {
|
|
8
|
+
return args;
|
|
9
|
+
}
|
|
10
|
+
if (typeof __webpack_require__ !== "undefined" && __webpack_require__.p) {
|
|
11
|
+
var publicPath = __webpack_require__.p;
|
|
12
|
+
var snapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
13
|
+
version: options.version,
|
|
14
|
+
name: options.name
|
|
15
|
+
});
|
|
16
|
+
if (!snapshot || !("ssrRemoteEntry" in snapshot) || !snapshot.ssrRemoteEntry) {
|
|
17
|
+
return args;
|
|
18
|
+
}
|
|
19
|
+
var ssrPath = snapshot.ssrRemoteEntry.split("/").slice(0, -1).join("/") + "/";
|
|
20
|
+
if (publicPath.endsWith(ssrPath)) {
|
|
21
|
+
__webpack_require__.p = publicPath + ssrPath;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return args;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
var correct_ssr_public_path_default = correctSsrPublicPathPlugin;
|
|
29
|
+
export {
|
|
30
|
+
correct_ssr_public_path_default as default
|
|
31
|
+
};
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -140,6 +140,7 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy) {
|
|
|
140
140
|
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
141
141
|
}
|
|
142
142
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
143
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/correct-ssr-public-path"), runtimePlugins);
|
|
143
144
|
if (!mfConfig.library) {
|
|
144
145
|
mfConfig.library = {
|
|
145
146
|
type: "commonjs-module",
|
|
@@ -43,7 +43,8 @@ describe("patchMFConfig", /* @__PURE__ */ _async_to_generator(function() {
|
|
|
43
43
|
runtimePlugins: [
|
|
44
44
|
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
45
45
|
require.resolve("@module-federation/node/runtimePlugin"),
|
|
46
|
-
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
46
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch"),
|
|
47
|
+
require.resolve("@module-federation/modern-js/correct-ssr-public-path")
|
|
47
48
|
],
|
|
48
49
|
shared: {
|
|
49
50
|
react: {
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getGlobalSnapshotInfoByModuleInfo } from "@module-federation/enhanced/runtime-core";
|
|
2
|
+
const correctSsrPublicPathPlugin = () => ({
|
|
3
|
+
name: "inject-node-fetch-plugin",
|
|
4
|
+
beforeInit(args) {
|
|
5
|
+
const { options } = args;
|
|
6
|
+
if (typeof window !== "undefined" || !options.version) {
|
|
7
|
+
return args;
|
|
8
|
+
}
|
|
9
|
+
if (typeof __webpack_require__ !== "undefined" && __webpack_require__.p) {
|
|
10
|
+
const publicPath = __webpack_require__.p;
|
|
11
|
+
const snapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
12
|
+
version: options.version,
|
|
13
|
+
name: options.name
|
|
14
|
+
});
|
|
15
|
+
if (!snapshot || !("ssrRemoteEntry" in snapshot) || !snapshot.ssrRemoteEntry) {
|
|
16
|
+
return args;
|
|
17
|
+
}
|
|
18
|
+
const ssrPath = snapshot.ssrRemoteEntry.split("/").slice(0, -1).join("/") + "/";
|
|
19
|
+
if (publicPath.endsWith(ssrPath)) {
|
|
20
|
+
__webpack_require__.p = publicPath + ssrPath;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return args;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var correct_ssr_public_path_default = correctSsrPublicPathPlugin;
|
|
27
|
+
export {
|
|
28
|
+
correct_ssr_public_path_default as default
|
|
29
|
+
};
|
|
@@ -109,6 +109,7 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
|
|
|
109
109
|
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
110
110
|
}
|
|
111
111
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
112
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/correct-ssr-public-path"), runtimePlugins);
|
|
112
113
|
if (!mfConfig.library) {
|
|
113
114
|
mfConfig.library = {
|
|
114
115
|
type: "commonjs-module",
|
|
@@ -38,7 +38,8 @@ describe("patchMFConfig", async () => {
|
|
|
38
38
|
runtimePlugins: [
|
|
39
39
|
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
40
40
|
require.resolve("@module-federation/node/runtimePlugin"),
|
|
41
|
-
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
41
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch"),
|
|
42
|
+
require.resolve("@module-federation/modern-js/correct-ssr-public-path")
|
|
42
43
|
],
|
|
43
44
|
shared: {
|
|
44
45
|
react: {
|
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-20250327052500",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
"types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts",
|
|
53
53
|
"import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
|
|
54
54
|
"require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js"
|
|
55
|
+
},
|
|
56
|
+
"./correct-ssr-public-path": {
|
|
57
|
+
"types": "./dist/types/cli/mfRuntimePlugins/correct-ssr-public-path.d.ts",
|
|
58
|
+
"import": "./dist/esm/cli/mfRuntimePlugins/correct-ssr-public-path.js",
|
|
59
|
+
"require": "./dist/esm/cli/mfRuntimePlugins/correct-ssr-public-path.js"
|
|
55
60
|
}
|
|
56
61
|
},
|
|
57
62
|
"typesVersions": {
|
|
@@ -76,6 +81,9 @@
|
|
|
76
81
|
],
|
|
77
82
|
"inject-node-fetch": [
|
|
78
83
|
"./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
|
|
84
|
+
],
|
|
85
|
+
"correct-ssr-public-path": [
|
|
86
|
+
"./dist/types/cli/mfRuntimePlugins/correct-ssr-public-path.d.ts"
|
|
79
87
|
]
|
|
80
88
|
}
|
|
81
89
|
},
|
|
@@ -89,11 +97,11 @@
|
|
|
89
97
|
"@swc/helpers": "0.5.13",
|
|
90
98
|
"node-fetch": "~3.3.0",
|
|
91
99
|
"react-error-boundary": "4.1.2",
|
|
92
|
-
"@module-federation/rsbuild-plugin": "0.0.0-next-
|
|
93
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
94
|
-
"@module-federation/node": "0.0.0-next-
|
|
95
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
96
|
-
"@module-federation/cli": "0.0.0-next-
|
|
100
|
+
"@module-federation/rsbuild-plugin": "0.0.0-next-20250327052500",
|
|
101
|
+
"@module-federation/enhanced": "0.0.0-next-20250327052500",
|
|
102
|
+
"@module-federation/node": "0.0.0-next-20250327052500",
|
|
103
|
+
"@module-federation/sdk": "0.0.0-next-20250327052500",
|
|
104
|
+
"@module-federation/cli": "0.0.0-next-20250327052500"
|
|
97
105
|
},
|
|
98
106
|
"devDependencies": {
|
|
99
107
|
"@modern-js/app-tools": "2.65.1",
|
|
@@ -101,7 +109,7 @@
|
|
|
101
109
|
"@modern-js/module-tools": "2.65.1",
|
|
102
110
|
"@modern-js/runtime": "2.65.1",
|
|
103
111
|
"@modern-js/tsconfig": "2.65.1",
|
|
104
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
112
|
+
"@module-federation/manifest": "0.0.0-next-20250327052500"
|
|
105
113
|
},
|
|
106
114
|
"peerDependencies": {
|
|
107
115
|
"react": ">=17",
|